<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why does this execute differently when plugged into the BDM? in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151162#M4297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure you can. It depends on what startup file you picked when creating the project: "minimal" or "ANSI". If you picked ANSI then the intialization of globals/static would work as specified in the C standard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No matter which option you pick, it is best to never initalize any global/statics at all, but to set them in runtime.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Sep 2010 16:52:59 GMT</pubDate>
    <dc:creator>Lundin</dc:creator>
    <dc:date>2010-09-27T16:52:59Z</dc:date>
    <item>
      <title>Why does this execute differently when plugged into the BDM?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151160#M4295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a line of code running on a 9S12XEP that seems to run differently when the micro is plugged into the BDM than it does when it isn't plugged into the BDM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;signed int P_gain_tb = 500;signed int P_val_tb = 0;signed long int PID_tb_result = 0;...PID_tb_result = ((P_gain_tb) * (long)(P_val_tb));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the BDM is plugged in and the BDM resets the micro, the code evaluates as I expect. That is P_gain_tb * a positive value between 0 and 1000 for P_val_tb = a positive value for PID_tb_result. And if P_val_tb is negative, the line of code evaluates so that PID_tb_result is negative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is when i run the micro without being plugged into the BDM (reset the micro myself), the exact opposite happens. Somehow it evaluates negative when it should be positive, and vise versa.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is this related to the BDM at all? I'm going crazy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:54:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151160#M4295</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2020-10-29T08:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this execute differently when plugged into the BDM?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151161#M4296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind, I guess you can't initialize a variable outside a function with this compiler...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Sep 2010 03:54:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151161#M4296</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2010-09-26T03:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this execute differently when plugged into the BDM?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151162#M4297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure you can. It depends on what startup file you picked when creating the project: "minimal" or "ANSI". If you picked ANSI then the intialization of globals/static would work as specified in the C standard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No matter which option you pick, it is best to never initalize any global/statics at all, but to set them in runtime.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Sep 2010 16:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Why-does-this-execute-differently-when-plugged-into-the-BDM/m-p/151162#M4297</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2010-09-27T16:52:59Z</dc:date>
    </item>
  </channel>
</rss>

