<?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 PART 2: Flash write gt60 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PART-2-Flash-write-gt60/m-p/124010#M127</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #ff0000;"&gt;This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Ffreescale%2Fboard%2Fmessage%3Fboard.id%3D8BITCOMM%26message.id%3D41" rel="nofollow" target="_blank"&gt;&lt;STRONG&gt;READ PART 1&lt;/STRONG&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;STRONG&gt;Posted: Wed Oct 26, 2005 8:54 am&lt;SPAN class="gen"&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;SPAN class="postbody"&gt;Hello,&lt;BR /&gt; I suppose You use Codewarrior&lt;BR /&gt;&lt;BR /&gt; You can save the routine ERASE_COM,WR_DATA_COM (included in the zip file form motorola) in a file .asm, for example Flash_Utility.asm in your project.&lt;BR /&gt;&lt;BR /&gt; In another file (Flash.c) you can write the function like this&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE align="center" border="0" cellpadding="3" cellspacing="1" width="90%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border:0px solid black;"&gt;&lt;SPAN class="genmed"&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="code" style="border:0px solid black;"&gt;void Flash_Byte_Write(byte Data,unsigned int Address){&amp;nbsp;&lt;BR /&gt;&amp;nbsp; //write to flash&amp;nbsp;&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; asm{&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ldhx Address&lt;BR /&gt;&amp;nbsp; &amp;nbsp; lda Data&lt;BR /&gt;&amp;nbsp; &amp;nbsp; jsr WR_DATA_COM&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;void Flash_Page_Erase(unsigned int Address){&amp;nbsp;&lt;BR /&gt;&amp;nbsp; asm{&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ldhx Address&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; jsr ERASE_COM&lt;BR /&gt;&amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;SPAN class="postbody"&gt;&lt;BR /&gt;&lt;BR /&gt;One function is for erase the flash page and another one in for write a byte. Remember that You can Always Erase the page and then write the correct byte in that page.&lt;BR /&gt;&lt;BR /&gt; OK ?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by RChapman on &lt;SPAN class="date_text"&gt;01-24-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;02:24 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2006 04:23:28 GMT</pubDate>
    <dc:creator>RChapman</dc:creator>
    <dc:date>2006-01-25T04:23:28Z</dc:date>
    <item>
      <title>PART 2: Flash write gt60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/PART-2-Flash-write-gt60/m-p/124010#M127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #ff0000;"&gt;This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Ffreescale%2Fboard%2Fmessage%3Fboard.id%3D8BITCOMM%26message.id%3D41" rel="nofollow" target="_blank"&gt;&lt;STRONG&gt;READ PART 1&lt;/STRONG&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;STRONG&gt;Posted: Wed Oct 26, 2005 8:54 am&lt;SPAN class="gen"&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="postdetails"&gt;&lt;SPAN class="postbody"&gt;Hello,&lt;BR /&gt; I suppose You use Codewarrior&lt;BR /&gt;&lt;BR /&gt; You can save the routine ERASE_COM,WR_DATA_COM (included in the zip file form motorola) in a file .asm, for example Flash_Utility.asm in your project.&lt;BR /&gt;&lt;BR /&gt; In another file (Flash.c) you can write the function like this&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE align="center" border="0" cellpadding="3" cellspacing="1" width="90%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border:0px solid black;"&gt;&lt;SPAN class="genmed"&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="code" style="border:0px solid black;"&gt;void Flash_Byte_Write(byte Data,unsigned int Address){&amp;nbsp;&lt;BR /&gt;&amp;nbsp; //write to flash&amp;nbsp;&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; asm{&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ldhx Address&lt;BR /&gt;&amp;nbsp; &amp;nbsp; lda Data&lt;BR /&gt;&amp;nbsp; &amp;nbsp; jsr WR_DATA_COM&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;&amp;nbsp; .&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;void Flash_Page_Erase(unsigned int Address){&amp;nbsp;&lt;BR /&gt;&amp;nbsp; asm{&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ldhx Address&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; jsr ERASE_COM&lt;BR /&gt;&amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;SPAN class="postbody"&gt;&lt;BR /&gt;&lt;BR /&gt;One function is for erase the flash page and another one in for write a byte. Remember that You can Always Erase the page and then write the correct byte in that page.&lt;BR /&gt;&lt;BR /&gt; OK ?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by RChapman on &lt;SPAN class="date_text"&gt;01-24-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;02:24 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2006 04:23:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/PART-2-Flash-write-gt60/m-p/124010#M127</guid>
      <dc:creator>RChapman</dc:creator>
      <dc:date>2006-01-25T04:23:28Z</dc:date>
    </item>
  </channel>
</rss>

