I’m using an RCM4100 or RCM4200. I have an array of 100 floating point user setpoint numbers that I would like to store in the User Block area. This is my first program with this type of processor. I currently have my array assigned as Protected, but if the battery gets changed, this information has to be reset. How do I safely set up the User Block to know where I can read and write these values? I don’t know how to choose the address offset to store the data. These are the only numbers I need to back up in Flash. (I’m using Dynamic C 10.72)
User Block - Recommended method for storing non-file data. Factory-stored calibration constants live
in the User block for boards with analog I/O. Space here is limited to as small as (8Ksizeof(
SysIDBlock)) bytes, or less if there are calibration constants. For specific information
about the User block on your board, open the sample programs userblock_info.c and/or
idblock_report.c. The latter program will print, among other things, the location of the
User block.
You might want to consider using the battery backed SRAM
Thank you for the information. I am already using the battery backed SRAM, but thought I could improve my code by storing some things where even a battery change would not affect it. I could be more selective on which items I must store. All 100 registers are not absolutely needed. Probably less than half of them. I’ll run the examples and see what I find.
Each float is 4 bytes, so an array of 100 is only 400 bytes. That should be fine in the normally 8KB UserBlock.
In the writeUserBlock() and writeUserBlockArray() functions, the first parameter is the address offset to write to. You can use 0 as the offset for the first float and go from there. Offset 0 gets you past the calibration constants, if any.