Home  >  Support  >  Support Forum  >  How to safely read/write from UserBlock for RCM4100
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to safely read/write from UserBlock for RCM4100

0 votes
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)
asked Jul 17, 2014 in Rabbit Software by DBurghard New to the Community (2 points)

Please log in or register to answer this question.

3 Answers

0 votes
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
answered Jul 18, 2014 by MargaretK Veteran of the Digi Community (541 points)
0 votes
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.
answered Jul 18, 2014 by DBurghard New to the Community (2 points)
0 votes
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.
answered Jul 18, 2014 by trooper2 Veteran of the Digi Community (578 points)
Contact a Digi expert and get started today! CONTACT US