<?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>S12 / MagniV MicrocontrollersのトピックRe: Comparing two variables in different ram pages</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Comparing-two-variables-in-different-ram-pages/m-p/193411#M7635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I read AN3784 and I have to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;Variables in Banked RAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before accessing a banked RAM location, the compiler needs to insert instructions that write an appropriate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value into the RPAGE register. The syntax to instruct the compiler to do this is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __RPAGE_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;I tried with this correction and it's working now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Nov 2012 14:16:35 GMT</pubDate>
    <dc:creator>lucianopalacios</dc:creator>
    <dc:date>2012-11-29T14:16:35Z</dc:date>
    <item>
      <title>Comparing two variables in different ram pages</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Comparing-two-variables-in-different-ram-pages/m-p/193410#M7634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for my project with MC9S12XF512, I'm trying to compare two variables which are in different ram pages. When I debug it I can see in Data window that the value of both variables are equal but the comparison results false.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here a code example of this problem&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;uint8 variable1 = 0xff;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;uint8 variable2 = 0xff;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main(void) &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; volatile uint8 aux = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; while(1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( variable1 == variable2 )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aux = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aux = 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is always "aux = 2". What would be the right way to compare these variables?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2012 12:56:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Comparing-two-variables-in-different-ram-pages/m-p/193410#M7634</guid>
      <dc:creator>lucianopalacios</dc:creator>
      <dc:date>2012-11-29T12:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two variables in different ram pages</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Comparing-two-variables-in-different-ram-pages/m-p/193411#M7635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I read AN3784 and I have to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;Variables in Banked RAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before accessing a banked RAM location, the compiler needs to insert instructions that write an appropriate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value into the RPAGE register. The syntax to instruct the compiler to do this is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __RPAGE_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;I tried with this correction and it's working now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2012 14:16:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Comparing-two-variables-in-different-ram-pages/m-p/193411#M7635</guid>
      <dc:creator>lucianopalacios</dc:creator>
      <dc:date>2012-11-29T14:16:35Z</dc:date>
    </item>
  </channel>
</rss>

