<?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 ZVC read a specific byte in P-Flash memory in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ZVC-read-a-specific-byte-in-P-Flash-memory/m-p/1057806#M17223</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;have to change my micro from a S12G64 to a ZVC19.&lt;/P&gt;&lt;P&gt;In my program, I have a line to read a specific&amp;nbsp;byte in the P-Flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem in S12G64, the address has been converted from Global Memory Address to Local Memory address, I am not sure I have to do the same thing ZVC...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In S12G64 my code was:&lt;/P&gt;&lt;P&gt;// Addr variable&amp;nbsp;is Global address, for example 0x38010 for a byte in Page 0xE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define GlobalToLocal(Address) (((Address) &amp;amp; 0x3FFFU) | (((Address) &amp;amp; 0x003FC000UL) &amp;lt;&amp;lt; 2U) | 0x8000U)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unsigned char mybyte;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mybyte= *(unsigned char *far)(GlobalToLocal(Addr));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know if the Following code is right on ZVC:&lt;/P&gt;&lt;P&gt;// In prm, ROM is defined form 0xFD0000 to 0xFFFDFF&lt;/P&gt;&lt;P&gt;// I would like to read Global Address Addr = 0xFE0010&lt;/P&gt;&lt;P&gt;unsigned char mybyte;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mybyte= *(unsigned char *far)(Addr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2020 06:51:35 GMT</pubDate>
    <dc:creator>michael_90300</dc:creator>
    <dc:date>2020-08-24T06:51:35Z</dc:date>
    <item>
      <title>ZVC read a specific byte in P-Flash memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ZVC-read-a-specific-byte-in-P-Flash-memory/m-p/1057806#M17223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;have to change my micro from a S12G64 to a ZVC19.&lt;/P&gt;&lt;P&gt;In my program, I have a line to read a specific&amp;nbsp;byte in the P-Flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem in S12G64, the address has been converted from Global Memory Address to Local Memory address, I am not sure I have to do the same thing ZVC...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In S12G64 my code was:&lt;/P&gt;&lt;P&gt;// Addr variable&amp;nbsp;is Global address, for example 0x38010 for a byte in Page 0xE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define GlobalToLocal(Address) (((Address) &amp;amp; 0x3FFFU) | (((Address) &amp;amp; 0x003FC000UL) &amp;lt;&amp;lt; 2U) | 0x8000U)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unsigned char mybyte;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mybyte= *(unsigned char *far)(GlobalToLocal(Addr));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know if the Following code is right on ZVC:&lt;/P&gt;&lt;P&gt;// In prm, ROM is defined form 0xFD0000 to 0xFFFDFF&lt;/P&gt;&lt;P&gt;// I would like to read Global Address Addr = 0xFE0010&lt;/P&gt;&lt;P&gt;unsigned char mybyte;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mybyte= *(unsigned char *far)(Addr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2020 06:51:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ZVC-read-a-specific-byte-in-P-Flash-memory/m-p/1057806#M17223</guid>
      <dc:creator>michael_90300</dc:creator>
      <dc:date>2020-08-24T06:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: ZVC read a specific byte in P-Flash memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ZVC-read-a-specific-byte-in-P-Flash-memory/m-p/1057807#M17224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;there is a difference between MCUs from the memory space point of view. S12Z devices use 24bit linear space only. So for example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;//.........................................&lt;BR /&gt;&amp;nbsp;// read the flash&lt;BR /&gt;&amp;nbsp;//.........................................&lt;/P&gt;&lt;P&gt;&amp;nbsp;for(addrl=0xFF8000UL; addrl&amp;lt;=0xFF8FFFUL; addrl+=2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = PFLASH_Read_Word(addrl); &lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//==============================================================================&lt;BR /&gt;//PFLASH_Read_Byte&lt;BR /&gt;//==============================================================================&lt;BR /&gt;unsigned char PFLASH_Read_Byte(unsigned long int address)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; unsigned char data8;&lt;BR /&gt;&amp;nbsp; data8 = *(unsigned char *)address;&lt;BR /&gt;&amp;nbsp; return data8;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//==============================================================================&lt;BR /&gt;//PFLASH_Read_Word&lt;BR /&gt;//==============================================================================&lt;BR /&gt;unsigned int PFLASH_Read_Word(unsigned long int address)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; unsigned int data16;&lt;BR /&gt;&amp;nbsp; data16 = *(unsigned int *)address;&lt;BR /&gt;&amp;nbsp; return data16;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2020 17:32:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ZVC-read-a-specific-byte-in-P-Flash-memory/m-p/1057807#M17224</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2020-08-24T17:32:31Z</dc:date>
    </item>
  </channel>
</rss>

