MATLAB Link for Code Composer Studio Development Tools | ![]() ![]() |
Return a value from a specified target processor register
Syntax
reg = regread(cc,'regname','represent',timeout) reg = regread(cc,'regname','represent') reg = regread(cc,'regname')
Description
reg = regread(cc,'regname','represent',timeout)
reads the data value in the regname
register of the target processor and returns the value in reg
as a double-precision value. For convenience, regread
converts each return value to the MATLAB double
datatype independent of the datatype defined by represent. Making this conversion lets you manipulate the data in MATLAB. String regname
specifies the name of the source register on the target. Link cc
defines the target to read from. Valid entries for regname
depend on your target processor. Register names are not case-sensitive -- a0
is the same as A0
. For example, the TMS320C6xxx processor family provides the following register names that are valid entries for regname
:
Other processors provide other register sets. Refer to the documentation for your target processor to determine the registers for the processor.
Note
Use read (called a direct memory read) to read memory-mapped registers. For the TMS320C5xxx processor family, register PC is memory mapped and thus available using read , not regread . Use regread to read from all other registers.
|
The represent
input argument defines the format of the data stored in regname
. Input argument represent
takes one of three input strings:
To limit the time that regread
spends transferring data from the target processor, the optional argument timeout
tells the data transfer process to stop after timeout
seconds. timeout
is defined as the number of seconds allowed to complete the read operation. You might find this useful for limiting prolonged data transfer operations. If you omit the timeout
option in the syntax, regread
defaults to the global timeout defined in cc
.
reg = regread(cc,'regname','represent')
reads the data value in the regname
register of the target processor and returns the value in reg
as a double-precision value. String regname
specifies the name of the source register on the target. Link cc
defines the target to read from. For convenience, regread
converts each return value to the MATLAB double
datatype independent of the datatype defined by represent. Making this conversion lets you manipulate the data in MATLAB. The represent
input argument defines the format of the data stored in regname
.
reg = regread(cc,'regname')
reads the data value in the regname
register of the target processor and returns the value in reg
. String regname
specifies the name of the source register on the target. Link cc
defines the target to read from. For convenience, regread
converts each return value to the MATLAB double
datatype independent of the datatype of the source. Making this conversion lets you manipulate the data in MATLAB.
Examples
For the C5xxx processor family, most registers are memory-mapped and consequently are available using read
and write
. However, the PC register is not memory-mapped. The following command demonstrates how to read the PC register. To identify the target, cc
is a link for CCS IDE.
To tell MATLAB what datatype you are reading, the string binary
indicates that the PC
register contains a value stored as an unsigned binary integer.
For processors in the C6xxx family, regread
lets you access processor registers directly. To read the value in general purpose register A0, type the following function.
treg
now contains the two's complement representation of the value in A0
.
Now read the value stored in register B2 as an unsigned binary integer, by typing
See Also
read
, regwrite
, write
![]() | readnumeric | regwrite | ![]() |