User`s guide

regwrite
Reading and Writing Register Values
Register variables can be difcult to read and write because the
registers which hold their value are n ot dedicated to storing just the
variable values.
Registers are used as temporary storage locations at any time during
execution. When this temporary storage process occurs, the value of the
variable is temporarily stored somew here on the stack and returned
later. Therefore, getting the values of register variables during program
execution may return unexpected answers.
Values that you write to register variables during intermediate times in
program operation may not get reected in the reg ister.
This is true for any local variables as well.
Onewaytoseethisistowritealineofcodethatusesthevariableand
see if result is consistent.
register int a = 100;
int b;
...
b=a+2;
Reading the register assigned to a may return an incorrect value for a
but if b returns the expected 102 result, nothing is wrong with the code
or Embedded IDE Link CC software.
Examples To write a new value to the PC register on a C5xxx family processor,
enter
regwrite(cc,'pc',hex2dec('100'),'binary')
specifying that you are writing the value 256 (the decimal value of
0x100) to register
pc as binary data.
To write a 64- b it value to a regi ster pair, such as B 1: B0, the followin g
syntax species the value as a string, repres entation, and processor
registers.
7-133