I am trying to store calibration data generated during program execution in Flash Program Memory of a Pic16F1519. Language = MPASM Programmer = ICD3
The datasheet has an example for writing to Flash Memory (Example 11-3) which states:
The point of my confusion is whether DATA_ADDR contains an address or data? Where is DATA_ADDR defined? (Steps #3 and 4 seem clear.) If defined, can it be in General Purpose Ram or must it be in Common Ram? Or, is it really a duplicate of the address in ADDRH/L? NB: I intend to save the calibration data near the end of program memory, as recommended by Microchip.
A simple example in Assembly would be most appreciated, but even something clarifying what it is would be helpful. Also, does the endian comment refer to the byte order or the bit order? I assume grammatically, it refers to the byte order.
John
The datasheet has an example for writing to Flash Memory (Example 11-3) which states:
I have spent two hours searching for a clear meaning of "DATA_ADDR." The only reference to it in the entire data sheet is in this example. Moreover, Google returns mostly hits to other datasheets with the same example. There is no reference to it in the example of how to read the data.; This write routine assumes the following:
; 1. 64 bytes of data are loaded, starting at the address in DATA_ADDR
; 2. Each word of data to be written is made up of two adjacent bytes in DATA_ADDR,
; stored in little endian format
; 3. A valid starting address (the least significant bits = 00000) is loaded in ADDRH:ADDRL
; 4. ADDRH and ADDRL are located in shared data memory 0x70 - 0x7F (common RAM)
The point of my confusion is whether DATA_ADDR contains an address or data? Where is DATA_ADDR defined? (Steps #3 and 4 seem clear.) If defined, can it be in General Purpose Ram or must it be in Common Ram? Or, is it really a duplicate of the address in ADDRH/L? NB: I intend to save the calibration data near the end of program memory, as recommended by Microchip.
A simple example in Assembly would be most appreciated, but even something clarifying what it is would be helpful. Also, does the endian comment refer to the byte order or the bit order? I assume grammatically, it refers to the byte order.
John


