User`s guide
2 Automa tion Interface
MATLAB software returns the new values for idatv.
idatv =
1234
h Use restart to reset the program counter for your program to the
beginning. Enter the following com mand at the prompt:
restart(cc);
4 Embedded IDE Link CC offers more functions for reading and writing
data to your processor. These functions let you read and write data to
the processor registers:
regread and regwrite. They let you change
variable values on the processor in real time. The functions behave slightly
differently depending on your processor. Select one of the following
procedures to demonstrate
regread and regwrite foryourprocessor.
C5xxx processor family — Most registers are memory-mapped and
available using
read and write. However, the PC register is not mem ory
mapped. To access this register, use the special functions —
regread
and regwrite. The following comm ands demonstrate how to use these
functions to read and write to the PC register.
a To read the value stored in register PC, enter the following command
at the prompt to indicate to MATLAB software the data type to read.
The input string
binary indicates that the PC register contains a value
stored as an unsigned binary integer.
cc.regread('PC','binary')
MATLAB software displays
ans =
33824
b To w rite a new value to the PC register, enter the following command.
This time, the
binary inputargumenttellsMATLABsoftwaretowrite
the value to the processor as an unsigned b inary integer. Notice that you
used
hex2dec to convert the hexadecimal string to decimal.
cc.regwrite('PC',hex2dec('100'),'binary')
2-18