<?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 Programming help needed, storing data in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Programming-help-needed-storing-data/m-p/124793#M205</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #333333; FONT-FAMILY: Arial;"&gt;&lt;NAMESPACE ns="urn:schemas-microsoft-com:office:office" prefix="o"&gt;&lt;/NAMESPACE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red;"&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;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sat Nov 5, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;6:26 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For a MC9S12DP256B&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm using this board:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.axman.com/education/edc_hc12.html" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.axman.com/education/edc_hc12.html" target="test_blank"&gt;http://www.axman.com/education/edc_hc12.html&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I now need to now store data variables, so if there is a power off situation, the data is stored -&amp;gt; a back up power supply will not suffice. I adapted a program provided by Axiom (written in C), to take in data from a sensor, and time stamp the data and save it in an array.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;However, I am having an ENORMOUS difficulty understanding how to:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;--&amp;gt; save data from this array, in the event power is lost&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I do not know assembly. I cannot find any books to help me with this problem.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Where can I find a solution - not necessarily the "answer" but somewhere that will explain to a non-EE how this sort of data storage works? I gather there are places to write data to, but haven't the slightest clue where to read about how to write to those portions.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sat Nov 5, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;8:28 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;In the MC9S12DP256 there are two different memories that retain data when power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The terminology used is the result of historical accident, and not very intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The "flash" memory is an "Electrically Erasable Programmable Memory" or "EEPROM" that is optimized for fast block writing at the expense of erase - write cycles. The "EEPROM" is a similar memory, but optimized for many erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You probably will find it easier to use the "EEPROM", unless you accumulate more data than will fit in the EEPROM, in which case you will have to use "flash" memory.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Your compiler may provide library routines for writing to EEPROM or flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If you can't find the appropriate library routines, it relatively easy to write your own functions in C to do this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I recommend studying the Freescale AN2400/D, an application note that describes flash and EEPROM and the usage considerations. At the end it gives well commented examples of flash and EEPROM programming functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If your data will fit, it is much easier to use EEPROM than flash because of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;There is a problem that the flash page visible in the "program page window" with 16 bit addresses form 0x8000 through 0xBFFF is controlled by the PPAGE register, which is changed by the CALL and RTC instructions. (These are the instructions used for calling and returning from "far" functions in paged memory.) A consequence of this is that you should handle reading and writing of data in paged flash from functions that are NOT in paged flash.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;When the flash memory is being programmed, it cannot be read. This means that you cannot execute instructions out of a flash memory that is being programmed.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;On the MC9S12DP256, the flash memory actually has 4 independent sections. This allows you to program one section with code operating out of a different section.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Because of the problems with the paged window, this code also needs to be in one of the "fixed" flash pages, either page 0x3F, which is always mapped to 16-bit addresses 0xC000 through 0xFFFF or page 0x3E which may be mapped to 16-bit addresses 0x4000 through 0x7FFF.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;(On some of the less expensive HC(S)-12 parts there is only one section of flash, so you must transfer some of the programming code into RAM to reprogram the flash.)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;These sections of flash hold several flash "pages". The Freescale documentation mostly calls the sections "flash arrays", but some of the documentation calls them "flash banks". In any case you need to recognize that a bank or array contains several pages.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;There ware provisions for protecting parts of flash and EEPROM from further programming, and there is also a provision for "securing" the entire microcontroller to keep the contents of the microcontroller secret.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I recommend that you avoid doing anything with these features until you have the basic flash and/or EEPROM working reliably. If possible, avoid them completely, because errors in handling them hobble the microcontroller and are hard to debug.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hope this helps. Please tell me if anything is still confusing, or if you need more information.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;5:37 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; In the MC9S12DP256 there are two different memories that retain data when&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The terminology used is the result of historical accident, and not very&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The "flash" memory is an "Electrically Erasable Programmable Memory" or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; "EEPROM" that is optimized for fast block writing at the expense of erase -&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; write cycles. The "EEPROM" is a similar memory, but optimized for many&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The EEPROM - not flash - is what I was thinking about using.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Your compiler may provide library routines for writing to EEPROM or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It looks like the compiler I am using:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.gnu-m68hc11.org/" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.gnu-m68hc11.org/" target="test_blank"&gt;http://www.gnu-m68hc11.org/&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://stephane.carrez.free.fr/examples/persist.php%23persist" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://stephane.carrez.free.fr/examples/persist.php#persist" target="test_blank"&gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I recommend studying the Freescale AN2400/D, an application note that&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; describes flash and EEPROM and the usage considerations. At the end it&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; gives well commented examples of flash and EEPROM programming &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'll re-read it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; If your data will fit, it is much easier to use EEPROM than flash because&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I believe it will. I'm restructuring an array/struct, but it will contain the following data:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Year (char, 00-99)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Month (char, 1-12)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Day (char, 1-31)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Count (int, 0-10000)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Hope this helps. Please tell me if anything is still confusing, or if you need&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; more information.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;My biggest problem isn't the programming (for now), it's trying to visualize the data storage. See, I'm used to directory structures (like in Windows), and I'm not an EE. So, writing to a specific location is very confusing for me. In addition, I'm relatively new to Hex/binary and other notations.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If I knew how to draw a visual map of the data, I think it would help me understand the whole memory location/addressing properly. I also need a good thorough primer on terminology used, I'll probably google this later today.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;11:10 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm confused about what you are confused by, but it sounds like C structures, arrays and indexing are not things that you are comfortable with yet.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Are you trying to code this problem in C style or C++ style?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If you are trying to program in C++ style, you will need to understand classes and templates to understand the "persistent" class template in the example you cite.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Try reading up on them again, and then try to answer the questions I ask below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; In the MC9S12DP256 there are two different memories that retain data when&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; The terminology used is the result of historical accident, and not very&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; The "flash" memory is an "Electrically Erasable Programmable Memory" or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; "EEPROM" that is optimized for fast block writing at the expense of erase -&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; write cycles. The "EEPROM" is a similar memory, but optimized for many&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;The EEPROM - not flash - is what I was thinking about using.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; Your compiler may provide library routines for writing to EEPROM or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;It looks like the compiler I am using:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;http://www.gnu-m68hc11.org/&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;My reading of this example is that the work of using EEPROM is all hidden in the C++ "template&amp;lt;class type&amp;gt; class persistent&amp;lt; type &amp;gt;", which is defined elsewhere.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; I recommend studying the Freescale AN2400/D, an application note that&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; describes flash and EEPROM and the usage considerations. At the end it&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; gives well commented examples of flash and EEPROM programming &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;I'll re-read it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; If your data will fit, it is much easier to use EEPROM than flash because&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;I believe it will. I'm restructuring an array/struct, but it will contain&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;the following data:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I don't understand how you intend this. Can you explain why this item only should be an index?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Year (char, 00-99)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Month (char, 1-12)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Day (char, 1-31)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Count (int, 0-10000)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Do you have a problem understanding this C fragment?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;DATA_POINT SavedData[ 100 ] ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Hour = ThisHour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Year = ThisYear ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Month = ThisMonth ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Day = ThisDay ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i++ ].Count = ThisCount ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I think that you will find things a little easier to understand and program&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;if you re-arrange the item in the entry like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;This has the data in a logical order like the digits of a number. The most rapidly changing variables are at the end, and the least rapidly changing variables are at the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Thu Nov 10, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;1:51 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I'm confused about what you are confused by, but it sounds like C structures,&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; arrays and indexing are not things that you are comfortable with yet.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Are you trying to code this problem in C style or C++ style?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;C&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm comfortable with arrays (though I do not know the terminology properly), structs are something I was introduced to only recently.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; My reading of this example is that the work of using EEPROM is all hidden&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; in the C++ "template&amp;lt;class type&amp;gt; class persistent&amp;lt; type &amp;gt;", which is&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; defined elsewhere.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Ok, sorry!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I don't understand how you intend this. Can you explain why this item only&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; should be an index?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I guess I wasn't clear. If I use an array, I mean to say the pointer/reference, ie:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;arrayData[hour]&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So the array is 24 rows long. As the day progresses, the array is written over from the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Do you have a problem understanding this C fragment?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; {&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; } DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; DATA_POINT SavedData[ 100 ] ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Hour = ThisHour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Year = ThisYear ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Month = ThisMonth ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Day = ThisDay ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i++ ].Count = ThisCount ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm pretty sure I understand it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Not completely - is this just showing how the data is arranged?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I think that you will find things a little easier to understand and program&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; if you re-arrange the item in the entry like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; {&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; } DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; This has the data in a logical order like the digits of a number. The most&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; rapidly changing variables are at the end, and the least rapidly changing&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; variables are at the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;That does make a bit more sense. However, I want to drop Hour:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT datalog[datasize];&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I would get the current time, and use the hour value to locate my record:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;datalog[hour].Count = datalog[hour].Count + accumulated_pulses;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The array/struct is sent via serial port to a serial-&amp;gt;ethernet bridge (over 802.11b, existing implementation), and a computer will be taking the data in and determining when the counts occurred.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Did I confuse the issue further?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Thu Nov 10, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;2:36 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;As I understand it, you are accumulating a count, and every hour you want to record the count.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;As you say you will wrap around on the hour array, I gather that you expect &lt;/FONT&gt;&lt;FONT size="2"&gt;to be able to upload the array to the PC at least once per day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It seems to me that this will not deal with power failures too well.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The situations that I have in mind are:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The power fails for an hour or more starting at half past the hour. In this case the counts for at least two hours will be incorrect, but there is no provision for indicating this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It seems to me that in this case using the hour as the index in a table that is 24 entries long will give you yesterday's data in this case without any indication.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For some reason the upload fails to be recorded on some day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;In this case you would just miss data.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You haven't made clear exactly what the count is recording, and how you want to handle these cases.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The reason that I chose the format where the array index was just the serial number of the entry, was that this would make it clear when observations were missing, and by changing the recording interval you could either fill up the EEPROM with several days data or get finer resolution around a power failure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If this takes up too much space in EEPROM, you could pack the entries into an int taking full advantage of the limited range of the numbers.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Alternatively, you could treat the EEPROM as a log with different kinds of entries.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For example a few times a day you could enter the date time and the interval between count records. The normal entry would be just the count. These would be the majority of the entries. When the microcontroller resets after a power failure, it could add a "reset" entry followed by the date time entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Instead of arranging for the microcontroller to know the date and time, you could just record the relative time since the last reset, modulo some suitable period, like a week. The PC program that processes the uploading can calculate the date of the entries by using the date &amp;amp; time of the upload as the date &amp;amp; time of the latest entry in the table, and calculating the date &amp;amp; time of the earlier entries backward form the last entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Could you write something more about what you mean by "visualizing the data"?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;A note below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hope this helps.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;[snip]&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;Not completely - is this just showing how the data is arranged?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Yes, I was trying to understand what you meant about having trouble "visualize the data"&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 16, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;4:38 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; As I understand it, you are accumulating a count, and every hour you want&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; to record the count.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Yes - and no.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It will record the counts every so often - minute, etc...:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Lets say for 11/20/2005, 13:00, 25 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I could still record the data every 15 minutes:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 2 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 5 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 20 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 25 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 14:00, 1 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;On a power failure, it will run through an accumulation of the last count routine, and save the data to EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So the resolution is essentially 1 hours worth of data, but it is accumulated every 15 minutes or minute.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; As you say you will wrap around on the hour array, I gather that you expect&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; to be able to upload the array to the PC at least once per day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Actually, it will attempt to send data to the PC every 15 minutes, with the hope that the PC will be running 24/7. If the PC crashes, it would be very good to have more than 24 hours worth of data, in case the PC is not monitored exactly as I'm expecting it to be.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; It seems to me that this will not deal with power failures too well.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The situations that I have in mind are:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The power fails for an hour or more starting at half past the hour. In&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; this case the counts for at least two hours will be incorrect, but there is&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; no provision for indicating this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If the power fails, there is nothing to count. The last accumulation would be added up, and then the table will be written to EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; It seems to me that in this case using the hour as the index in a table that is 24 &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; entries long will give you yesterday's data in this case without any indication.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;No - the table will also have the day and month in it, and the computer can infer which row was earlier. However, I am rethinking this, as I may have to provide other information as well, which will require the table to be larger than I planned.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; For some reason the upload fails to be recorded on some day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; In this case you would just miss data.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;This would be a problem, which is one thing I did not consider. Technically, the computer will always be on -&amp;gt; however, if it gets shut off, then there will be some trouble. I'll have to think about this problem a bit, thought it really won't have an impact on what I am doing. Increasing the table to 72 hours would address this situation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; You haven't made clear exactly what the count is recording, and how you&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; want to handle these cases.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The count is recording the pulse of a magnet passing by a hall sensor, and time stamping it (using a DS1305).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The reason that I chose the format where the array index was just the serial &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; number of the entry, was that this would make it clear when observations &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; were missing, and by changing the recording interval you could either fill up the&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; EEPROM with several days data or get finer resolution around a power failure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I think I'll switch my thinking around to what you say here (ie, use the serial number of the entry). However, once a power failure hits, there will be no pulses (as they are tied to power consumption).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Alternatively, you could treat the EEPROM as a log with different kinds of entries.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hmm, right now the last 24-48 hours would be the most important data, 72 would give a bit of room for problems (if there is room in the EEPROM, I believe there is, haven't done the math). So, in a power failure, it writes the last 72 hours worth (72 rows worth) of data to the EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Instead of arranging for the microcontroller to know the date and time, you&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; could just record the relative time since the last reset, modulo some&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; suitable period, like a week. The PC program that processes the uploading&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; can calculate the date of the entries by using the date &amp;amp; time of the&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; upload as the date &amp;amp; time of the latest entry in the table, and calculating&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; the date &amp;amp; time of the earlier entries backward form the last entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hmmm. At this point it's too late to try this, but I will give it some thought. I never liked the idea of the microcontroller knowing the date, as that means the microcontroller has to have the date set physically (keypad/LCD) or via serial -&amp;gt; I only have data coming out, no provision for data coming in via serial port. In a power failure, the DS1305 has enough power for 24 hours to keep the date and time, which can be increased.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Could you write something more about what you mean by "visualizing the data"?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I was thinking of a map of the EEPROM, kinda like the one on page 19 of TechNote AN2400:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The graphic helps me understand what is being done inside the chip. (I believe it's for 'Flash EEPROM', not 'EEPROM')&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It's like this: I tend to be a bit more visual in my thinking. So, I like to use Mathematica over matlab/octave, CAD programs are nice but I work just a bit quicker in Adobe&amp;nbsp;Illustrator, I like GUI's rather than Unix terminal(s). A TI-89 was a big step up from my TI-83 as the 89 had "Pretty Print" (it shows equations and fractions as you'd write them on paper).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So, with memory, I read "bits, bytes, word, block" and have trouble imagining the structure and how the data is laid out and addressed. When someone says, "You can write from this address to that address" I'd like to be able to visually think of the data. I can't, and at the very most, have a serious amount of trouble. Or, when the instructions say, "You need to erase a sector from A to B", I don't know what I'm erasing, even if the code is clearly laid out on how to do the erasure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sun Nov 6, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;7:52 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;To store data so it is not lost during loss of power, you will need to write the data into the internal EEPROM of the S12DP256B device. Writing to the EEPROM is not done by simply writing to its memory locations, but is rather done by a special series of actions that finally writes the data in the EEPROM. This write action is slower that regular writes, so you would probably execute it only when you really need to. Also the EEPROM has a limited lifetime of typically 10,000 - 100,000 cycles of erase/program. This means that you don't want to write to a specific EEPROM location more than 10,000 as otherwise, it may wear off, and fail to store your data reliably. This also means you will need to write to the EEPROM only occasionally, or every several minutes to create a backup data (so if your system looses power, the data since the last backup that was stored in RAM is lost, but the last backup data from the EEPROM can be recovered).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You can read more information on how to write to the EEPROM on the S12DP256B part, in the following Freescale document:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;5:04 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; To store data so it is not lost during loss of power, you will need to&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; write the data into the internal EEPROM of the S12DP256B device.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Writing to the EEPROM is not done by simply writing to its memory&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; locations, but is rather done by a special series of actions that finally&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; writes the data in the EEPROM. This write action is slower that regular&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; writes, so you would probably execute it only when you really need to. Also&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; the EEPROM has a limited lifetime of typically 10,000 - 100,000 cycles of&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; erase/program. This means that you don't want to write to a specific EEPROM&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; location more than 10,000 as otherwise, it may wear off, and fail to store&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; your data reliably. This also means you will need to write to the EEPROM&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; only occasionally, or every several minutes to create a backup data (so if&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; your system looses power, the data since the last backup that was stored in&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; RAM is lost, but the last backup data from the EEPROM can be recovered).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I plan (tentatively!) to use a backup battery I'm working on to trigger a routine that will write the data, then stop the program. The backup battery (maxim sells several power management chips) will only need to power the chip for 20 minutes after power is out. However, I'm first trying to figure out writing to the EEPROM, which I will give App note AN2400/D and the link you posted a better read through.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Message Edited by khumphri on &lt;SPAN class="date_text"&gt;01-27-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:36 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jan 2006 22:26:01 GMT</pubDate>
    <dc:creator>khumphri</dc:creator>
    <dc:date>2006-01-27T22:26:01Z</dc:date>
    <item>
      <title>Programming help needed, storing data</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Programming-help-needed-storing-data/m-p/124793#M205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #333333; FONT-FAMILY: Arial;"&gt;&lt;NAMESPACE ns="urn:schemas-microsoft-com:office:office" prefix="o"&gt;&lt;/NAMESPACE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red;"&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;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sat Nov 5, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;6:26 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For a MC9S12DP256B&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm using this board:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.axman.com/education/edc_hc12.html" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.axman.com/education/edc_hc12.html" target="test_blank"&gt;http://www.axman.com/education/edc_hc12.html&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I now need to now store data variables, so if there is a power off situation, the data is stored -&amp;gt; a back up power supply will not suffice. I adapted a program provided by Axiom (written in C), to take in data from a sensor, and time stamp the data and save it in an array.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;However, I am having an ENORMOUS difficulty understanding how to:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;--&amp;gt; save data from this array, in the event power is lost&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I do not know assembly. I cannot find any books to help me with this problem.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Where can I find a solution - not necessarily the "answer" but somewhere that will explain to a non-EE how this sort of data storage works? I gather there are places to write data to, but haven't the slightest clue where to read about how to write to those portions.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sat Nov 5, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;8:28 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;In the MC9S12DP256 there are two different memories that retain data when power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The terminology used is the result of historical accident, and not very intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The "flash" memory is an "Electrically Erasable Programmable Memory" or "EEPROM" that is optimized for fast block writing at the expense of erase - write cycles. The "EEPROM" is a similar memory, but optimized for many erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You probably will find it easier to use the "EEPROM", unless you accumulate more data than will fit in the EEPROM, in which case you will have to use "flash" memory.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Your compiler may provide library routines for writing to EEPROM or flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If you can't find the appropriate library routines, it relatively easy to write your own functions in C to do this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I recommend studying the Freescale AN2400/D, an application note that describes flash and EEPROM and the usage considerations. At the end it gives well commented examples of flash and EEPROM programming functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If your data will fit, it is much easier to use EEPROM than flash because of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;There is a problem that the flash page visible in the "program page window" with 16 bit addresses form 0x8000 through 0xBFFF is controlled by the PPAGE register, which is changed by the CALL and RTC instructions. (These are the instructions used for calling and returning from "far" functions in paged memory.) A consequence of this is that you should handle reading and writing of data in paged flash from functions that are NOT in paged flash.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;When the flash memory is being programmed, it cannot be read. This means that you cannot execute instructions out of a flash memory that is being programmed.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;On the MC9S12DP256, the flash memory actually has 4 independent sections. This allows you to program one section with code operating out of a different section.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Because of the problems with the paged window, this code also needs to be in one of the "fixed" flash pages, either page 0x3F, which is always mapped to 16-bit addresses 0xC000 through 0xFFFF or page 0x3E which may be mapped to 16-bit addresses 0x4000 through 0x7FFF.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;(On some of the less expensive HC(S)-12 parts there is only one section of flash, so you must transfer some of the programming code into RAM to reprogram the flash.)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;These sections of flash hold several flash "pages". The Freescale documentation mostly calls the sections "flash arrays", but some of the documentation calls them "flash banks". In any case you need to recognize that a bank or array contains several pages.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;There ware provisions for protecting parts of flash and EEPROM from further programming, and there is also a provision for "securing" the entire microcontroller to keep the contents of the microcontroller secret.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I recommend that you avoid doing anything with these features until you have the basic flash and/or EEPROM working reliably. If possible, avoid them completely, because errors in handling them hobble the microcontroller and are hard to debug.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hope this helps. Please tell me if anything is still confusing, or if you need more information.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;5:37 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; In the MC9S12DP256 there are two different memories that retain data when&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The terminology used is the result of historical accident, and not very&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The "flash" memory is an "Electrically Erasable Programmable Memory" or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; "EEPROM" that is optimized for fast block writing at the expense of erase -&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; write cycles. The "EEPROM" is a similar memory, but optimized for many&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The EEPROM - not flash - is what I was thinking about using.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Your compiler may provide library routines for writing to EEPROM or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It looks like the compiler I am using:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.gnu-m68hc11.org/" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.gnu-m68hc11.org/" target="test_blank"&gt;http://www.gnu-m68hc11.org/&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://stephane.carrez.free.fr/examples/persist.php%23persist" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://stephane.carrez.free.fr/examples/persist.php#persist" target="test_blank"&gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I recommend studying the Freescale AN2400/D, an application note that&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; describes flash and EEPROM and the usage considerations. At the end it&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; gives well commented examples of flash and EEPROM programming &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'll re-read it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; If your data will fit, it is much easier to use EEPROM than flash because&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I believe it will. I'm restructuring an array/struct, but it will contain the following data:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Year (char, 00-99)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Month (char, 1-12)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Day (char, 1-31)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;Count (int, 0-10000)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Hope this helps. Please tell me if anything is still confusing, or if you need&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; more information.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;My biggest problem isn't the programming (for now), it's trying to visualize the data storage. See, I'm used to directory structures (like in Windows), and I'm not an EE. So, writing to a specific location is very confusing for me. In addition, I'm relatively new to Hex/binary and other notations.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If I knew how to draw a visual map of the data, I think it would help me understand the whole memory location/addressing properly. I also need a good thorough primer on terminology used, I'll probably google this later today.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;11:10 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm confused about what you are confused by, but it sounds like C structures, arrays and indexing are not things that you are comfortable with yet.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Are you trying to code this problem in C style or C++ style?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If you are trying to program in C++ style, you will need to understand classes and templates to understand the "persistent" class template in the example you cite.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Try reading up on them again, and then try to answer the questions I ask below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; In the MC9S12DP256 there are two different memories that retain data when&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; power is off.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; The terminology used is the result of historical accident, and not very&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; intuitive.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; The "flash" memory is an "Electrically Erasable Programmable Memory" or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; "EEPROM" that is optimized for fast block writing at the expense of erase -&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; write cycles. The "EEPROM" is a similar memory, but optimized for many&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; erase-write cycles.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;The EEPROM - not flash - is what I was thinking about using.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; Your compiler may provide library routines for writing to EEPROM or&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; flash. Search the compiler and library documentation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;It looks like the compiler I am using:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;http://www.gnu-m68hc11.org/&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;My reading of this example is that the work of using EEPROM is all hidden in the C++ "template&amp;lt;class type&amp;gt; class persistent&amp;lt; type &amp;gt;", which is defined elsewhere.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; I recommend studying the Freescale AN2400/D, an application note that&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; describes flash and EEPROM and the usage considerations. At the end it&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; gives well commented examples of flash and EEPROM programming &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; functions in both C and assembler.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;I'll re-read it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; If your data will fit, it is much easier to use EEPROM than flash because&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; of the special considerations for flash memory usage I describe below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;I believe it will. I'm restructuring an array/struct, but it will contain&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;the following data:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I don't understand how you intend this. Can you explain why this item only should be an index?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Year (char, 00-99)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Month (char, 1-12)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Day (char, 1-31)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt;Count (int, 0-10000)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Do you have a problem understanding this C fragment?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;DATA_POINT SavedData[ 100 ] ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Hour = ThisHour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Year = ThisYear ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Month = ThisMonth ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i ].Day = ThisDay ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;SavedData[ i++ ].Count = ThisCount ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;| Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;+-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I think that you will find things a little easier to understand and program&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;if you re-arrange the item in the entry like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;This has the data in a logical order like the digits of a number. The most rapidly changing variables are at the end, and the least rapidly changing variables are at the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Thu Nov 10, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;1:51 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I'm confused about what you are confused by, but it sounds like C structures,&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; arrays and indexing are not things that you are comfortable with yet.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Are you trying to code this problem in C style or C++ style?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;C&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm comfortable with arrays (though I do not know the terminology properly), structs are something I was introduced to only recently.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;has a persistent storage example:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;http://stephane.carrez.free.fr/examples/persist.php#persist&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; My reading of this example is that the work of using EEPROM is all hidden&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; in the C++ "template&amp;lt;class type&amp;gt; class persistent&amp;lt; type &amp;gt;", which is&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; defined elsewhere.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Ok, sorry!&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;hour (char, 0-23) &amp;lt;- this is actually the index of the array/struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I don't understand how you intend this. Can you explain why this item only&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; should be an index?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I guess I wasn't clear. If I use an array, I mean to say the pointer/reference, ie:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;arrayData[hour]&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So the array is 24 rows long. As the day progresses, the array is written over from the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Do you have a problem understanding this C fragment?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; {&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; } DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; DATA_POINT SavedData[ 100 ] ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Hour = ThisHour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Year = ThisYear ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Month = ThisMonth ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i ].Day = ThisDay ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; SavedData[ i++ ].Count = ThisCount ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I'm pretty sure I understand it.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; | Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; +-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Not completely - is this just showing how the data is arranged?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; I think that you will find things a little easier to understand and program&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; if you re-arrange the item in the entry like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; {&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; char Hour ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; } DATA_POINT ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; This has the data in a logical order like the digits of a number. The most&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; rapidly changing variables are at the end, and the least rapidly changing&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; variables are at the beginning.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;That does make a bit more sense. However, I want to drop Hour:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;typedef struct&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Year ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Month ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;char Day ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;int Count ;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;} DATA_POINT datalog[datasize];&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I would get the current time, and use the hour value to locate my record:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;datalog[hour].Count = datalog[hour].Count + accumulated_pulses;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The array/struct is sent via serial port to a serial-&amp;gt;ethernet bridge (over 802.11b, existing implementation), and a computer will be taking the data in and determining when the counts occurred.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Did I confuse the issue further?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Thu Nov 10, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;2:36 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;As I understand it, you are accumulating a count, and every hour you want to record the count.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;As you say you will wrap around on the hour array, I gather that you expect &lt;/FONT&gt;&lt;FONT size="2"&gt;to be able to upload the array to the PC at least once per day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It seems to me that this will not deal with power failures too well.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The situations that I have in mind are:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The power fails for an hour or more starting at half past the hour. In this case the counts for at least two hours will be incorrect, but there is no provision for indicating this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It seems to me that in this case using the hour as the index in a table that is 24 entries long will give you yesterday's data in this case without any indication.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For some reason the upload fails to be recorded on some day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;In this case you would just miss data.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You haven't made clear exactly what the count is recording, and how you want to handle these cases.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The reason that I chose the format where the array index was just the serial number of the entry, was that this would make it clear when observations were missing, and by changing the recording interval you could either fill up the EEPROM with several days data or get finer resolution around a power failure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If this takes up too much space in EEPROM, you could pack the entries into an int taking full advantage of the limited range of the numbers.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Alternatively, you could treat the EEPROM as a log with different kinds of entries.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;For example a few times a day you could enter the date time and the interval between count records. The normal entry would be just the count. These would be the majority of the entries. When the microcontroller resets after a power failure, it could add a "reset" entry followed by the date time entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Instead of arranging for the microcontroller to know the date and time, you could just record the relative time since the last reset, modulo some suitable period, like a week. The PC program that processes the uploading can calculate the date of the entries by using the date &amp;amp; time of the upload as the date &amp;amp; time of the latest entry in the table, and calculating the date &amp;amp; time of the earlier entries backward form the last entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Could you write something more about what you mean by "visualizing the data"?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;A note below.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hope this helps.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;[snip]&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt; Do you have any problem understanding this diagram?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; &amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Hour[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Year[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Month[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Day[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Count[ 1 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Hour[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Year[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Month[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Day[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +------------+----------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; | Count[ 2 ] |&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; +-----------------------+&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;gt; &amp;gt; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;Not completely - is this just showing how the data is arranged?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Yes, I was trying to understand what you meant about having trouble "visualize the data"&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 16, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;4:38 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; As I understand it, you are accumulating a count, and every hour you want&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; to record the count.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Yes - and no.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It will record the counts every so often - minute, etc...:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Lets say for 11/20/2005, 13:00, 25 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I could still record the data every 15 minutes:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 2 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 5 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 20 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 13:00, 25 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;11/20/2005, 14:00, 1 pulses were recorded&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;On a power failure, it will run through an accumulation of the last count routine, and save the data to EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So the resolution is essentially 1 hours worth of data, but it is accumulated every 15 minutes or minute.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; As you say you will wrap around on the hour array, I gather that you expect&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; to be able to upload the array to the PC at least once per day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Actually, it will attempt to send data to the PC every 15 minutes, with the hope that the PC will be running 24/7. If the PC crashes, it would be very good to have more than 24 hours worth of data, in case the PC is not monitored exactly as I'm expecting it to be.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; It seems to me that this will not deal with power failures too well.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The situations that I have in mind are:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The power fails for an hour or more starting at half past the hour. In&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; this case the counts for at least two hours will be incorrect, but there is&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; no provision for indicating this.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;If the power fails, there is nothing to count. The last accumulation would be added up, and then the table will be written to EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; It seems to me that in this case using the hour as the index in a table that is 24 &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; entries long will give you yesterday's data in this case without any indication.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;No - the table will also have the day and month in it, and the computer can infer which row was earlier. However, I am rethinking this, as I may have to provide other information as well, which will require the table to be larger than I planned.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; For some reason the upload fails to be recorded on some day.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; In this case you would just miss data.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;This would be a problem, which is one thing I did not consider. Technically, the computer will always be on -&amp;gt; however, if it gets shut off, then there will be some trouble. I'll have to think about this problem a bit, thought it really won't have an impact on what I am doing. Increasing the table to 72 hours would address this situation.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; You haven't made clear exactly what the count is recording, and how you&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; want to handle these cases.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The count is recording the pulse of a magnet passing by a hall sensor, and time stamping it (using a DS1305).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; The reason that I chose the format where the array index was just the serial &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; number of the entry, was that this would make it clear when observations &lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; were missing, and by changing the recording interval you could either fill up the&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; EEPROM with several days data or get finer resolution around a power failure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I think I'll switch my thinking around to what you say here (ie, use the serial number of the entry). However, once a power failure hits, there will be no pulses (as they are tied to power consumption).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Alternatively, you could treat the EEPROM as a log with different kinds of entries.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hmm, right now the last 24-48 hours would be the most important data, 72 would give a bit of room for problems (if there is room in the EEPROM, I believe there is, haven't done the math). So, in a power failure, it writes the last 72 hours worth (72 rows worth) of data to the EEPROM.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Instead of arranging for the microcontroller to know the date and time, you&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; could just record the relative time since the last reset, modulo some&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; suitable period, like a week. The PC program that processes the uploading&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; can calculate the date of the entries by using the date &amp;amp; time of the&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; upload as the date &amp;amp; time of the latest entry in the table, and calculating&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; the date &amp;amp; time of the earlier entries backward form the last entry.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;Hmmm. At this point it's too late to try this, but I will give it some thought. I never liked the idea of the microcontroller knowing the date, as that means the microcontroller has to have the date set physically (keypad/LCD) or via serial -&amp;gt; I only have data coming out, no provision for data coming in via serial port. In a power failure, the DS1305 has enough power for 24 hours to keep the date and time, which can be increased.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Could you write something more about what you mean by "visualizing the data"?&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I was thinking of a map of the EEPROM, kinda like the one on page 19 of TechNote AN2400:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/app_note/AN2400.pdf&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;The graphic helps me understand what is being done inside the chip. (I believe it's for 'Flash EEPROM', not 'EEPROM')&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;It's like this: I tend to be a bit more visual in my thinking. So, I like to use Mathematica over matlab/octave, CAD programs are nice but I work just a bit quicker in Adobe&amp;nbsp;Illustrator, I like GUI's rather than Unix terminal(s). A TI-89 was a big step up from my TI-83 as the 89 had "Pretty Print" (it shows equations and fractions as you'd write them on paper).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;So, with memory, I read "bits, bytes, word, block" and have trouble imagining the structure and how the data is laid out and addressed. When someone says, "You can write from this address to that address" I'd like to be able to visually think of the data. I can't, and at the very most, have a serious amount of trouble. Or, when the instructions say, "You need to erase a sector from A to B", I don't know what I'm erasing, even if the code is clearly laid out on how to do the erasure.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Sun Nov 6, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;7:52 am &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;To store data so it is not lost during loss of power, you will need to write the data into the internal EEPROM of the S12DP256B device. Writing to the EEPROM is not done by simply writing to its memory locations, but is rather done by a special series of actions that finally writes the data in the EEPROM. This write action is slower that regular writes, so you would probably execute it only when you really need to. Also the EEPROM has a limited lifetime of typically 10,000 - 100,000 cycles of erase/program. This means that you don't want to write to a specific EEPROM location more than 10,000 as otherwise, it may wear off, and fail to store your data reliably. This also means you will need to write to the EEPROM only occasionally, or every several minutes to create a backup data (so if your system looses power, the data since the last backup that was stored in RAM is lost, but the last backup data from the EEPROM can be recovered).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;You can read more information on how to write to the EEPROM on the S12DP256B part, in the following Freescale document:&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf" rel="nofollow" target="_blank"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12EETS4KV2.pdf&lt;/A&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight: normal;"&gt;&lt;FONT size="2"&gt;Posted: Wed Nov 9, 2005&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;5:04 pm &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; To store data so it is not lost during loss of power, you will need to&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; write the data into the internal EEPROM of the S12DP256B device.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; Writing to the EEPROM is not done by simply writing to its memory&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; locations, but is rather done by a special series of actions that finally&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; writes the data in the EEPROM. This write action is slower that regular&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; writes, so you would probably execute it only when you really need to. Also&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; the EEPROM has a limited lifetime of typically 10,000 - 100,000 cycles of&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; erase/program. This means that you don't want to write to a specific EEPROM&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; location more than 10,000 as otherwise, it may wear off, and fail to store&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; your data reliably. This also means you will need to write to the EEPROM&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; only occasionally, or every several minutes to create a backup data (so if&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; your system looses power, the data since the last backup that was stored in&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;&amp;gt; RAM is lost, but the last backup data from the EEPROM can be recovered).&lt;/FONT&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="MARGIN: 0in 0in 0pt;"&gt;&lt;FONT size="2"&gt;I plan (tentatively!) to use a backup battery I'm working on to trigger a routine that will write the data, then stop the program. The backup battery (maxim sells several power management chips) will only need to power the chip for 20 minutes after power is out. However, I'm first trying to figure out writing to the EEPROM, which I will give App note AN2400/D and the link you posted a better read through.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Message Edited by khumphri on &lt;SPAN class="date_text"&gt;01-27-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:36 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2006 22:26:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Programming-help-needed-storing-data/m-p/124793#M205</guid>
      <dc:creator>khumphri</dc:creator>
      <dc:date>2006-01-27T22:26:01Z</dc:date>
    </item>
  </channel>
</rss>

