<?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 do I have to use an absolute variable in the IF statement? in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126131#M937</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Mustafa,&lt;/P&gt;&lt;P&gt;I believe rocco is on the right track here.&lt;/P&gt;&lt;P&gt;The important thing is that the value of the variable (var1 in your example) must be known to the assembler at assemble time.&lt;/P&gt;&lt;P&gt;And the other short answer is.....&lt;/P&gt;&lt;P&gt;Because the manual says so!&lt;/P&gt;&lt;P&gt;Regards David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;2006-08-10&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:54 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Aug 2006 17:50:37 GMT</pubDate>
    <dc:creator>peg</dc:creator>
    <dc:date>2006-08-10T17:50:37Z</dc:date>
    <item>
      <title>Why do I have to use an absolute variable in the IF statement?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126129#M935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;an example code;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if var1 == 5 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; jmp label1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; jmp label2 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is when I use a variable (like var1) there is no problem if the variable is absolute. But if the variable is relocatable I have got an error message which is "complex relocatable expression not supported". Why do I have to use an absolute variable in the IF statement? (my MCU is RS08)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2006 19:09:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126129#M935</guid>
      <dc:creator>muskut</dc:creator>
      <dc:date>2006-08-09T19:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I have to use an absolute variable in the IF statement?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126130#M936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Mustafa:&lt;BR /&gt;&lt;BR /&gt;I believe the IF statements in that context are conditional assembly statements, not program statements. But I'm not sure, because I don't know what programs you are using, and which program generated the error.&lt;BR /&gt;&lt;BR /&gt;Assuming the context is assembly language, and not Basic or some other language then those statements mean the following:&lt;HR /&gt;If the address defined for 'var1' is equal to 5 then compile the assembler instruction 'jmp label1' into the object file, otherwise compile the assembler instruction 'jmp label2' into the object file.&lt;HR /&gt;So the only code that is generated is a single 'jmp' instruction, probably to label2.&lt;BR /&gt;&lt;BR /&gt;The reason for the error is that, if 'var1' is relocatable, it doesn't yet have an address to test against. When the assembler evaluates 'var1==5', it realizes that 'var1' is not yet equal to anything, and generates an error.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2006 15:05:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126130#M936</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-08-10T15:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I have to use an absolute variable in the IF statement?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126131#M937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Mustafa,&lt;/P&gt;&lt;P&gt;I believe rocco is on the right track here.&lt;/P&gt;&lt;P&gt;The important thing is that the value of the variable (var1 in your example) must be known to the assembler at assemble time.&lt;/P&gt;&lt;P&gt;And the other short answer is.....&lt;/P&gt;&lt;P&gt;Because the manual says so!&lt;/P&gt;&lt;P&gt;Regards David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;2006-08-10&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:54 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2006 17:50:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126131#M937</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-08-10T17:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I have to use an absolute variable in the IF statement?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126132#M938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;thanks a lot for the answers. Nice points all&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2006 19:20:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Why-do-I-have-to-use-an-absolute-variable-in-the-IF-statement/m-p/126132#M938</guid>
      <dc:creator>muskut</dc:creator>
      <dc:date>2006-08-10T19:20:23Z</dc:date>
    </item>
  </channel>
</rss>

