MATLAB Link for Code Composer Studio Development Tools | ![]() ![]() |
Determine if MATLAB can read the specified memory block
Syntax
Description
isreadable(cc,address,'
returns 1 if the processor referred to by datatype
'
,count)
cc
can read the memory block defined by the address
, count
, and datatype
input arguments. When the processor cannot read any portion of the specified memory block, isreadable
returns 0. Notice that you use the same memory block specification for this function as you use for the read function. The data block being tested begins at the memory location defined by address
. count
determines the number of values to be read. datatype
defines the format of data stored in the memory block. isreadable
uses the datatype
string to determine the number of bytes to read per stored value. For details about each input parameter, read the following descriptions.
address
-- isreadable
uses address
to define the beginning of the memory block to read. You provide values for address as either decimal or hexadecimal representations of a memory location in the target processor. The full address at a memory location consists of two parts: the offset and the memory page, entered as a vector [location
, page
], a string, or a decimal value. In cases where the processor has only one memory page, as is true for many digital signal processors, the page portion of the memory address is 0. By default, ccsdsp
sets the page to 0
at creation if you omit the page property as an input argument to set the page parameter.
For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using just the memory location without the page value.
To specify the address in hexadecimal format, enter the address
property value as a string. isreadable
interprets the string as the hexadecimal representation of the desired memory location. To convert the hex value to a decimal value, the function uses hex2dec
. Note that when you use the string option to enter the address as a hex value, you cannot specify the memory page. For string input, the memory page defaults to the page specified by cc(page)
.
count
-- a numeric scalar or vector that defines the number of datatype
values to test for being readable. To assure parallel structure with read
, count
can be a vector to define multidimensional data blocks. This function always tests a block of data whose size is the product of the dimensions of the input vector.
datatype
--
a string that represents a MATLAB data type. The total memory block size is derived from the value of count
and the specified datatype
. datatype
determines how many bytes to check for each memory value. isreadable
supports the following data types:
Like the iswritable
, write
, and read
functions, isreadable
checks for valid address values. Illegal address values would be any address space larger than the available space for the processor--232 for the C6xxx processor family and 216 for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
isreadable(cc,address,'
datatype
'
)
returns 1 if the processor referred to by cc
can read the memory block defined by the address
, and 'datatype'
input arguments. When the processor cannot read any portion of the specified memory block, isreadable
returns 0. Notice that you use the same memory block specification for this function as you use for the read function. The data block being tested begins at the memory location defined by address
. When you omit the count
option, count
defaults to one.
isreadable(rx,'channel')
returns a 1 when the RTDX channel specified by the string 'channel'
, associated with link rx
, is configured for 'read
' operation. When 'channel
' is not configured for reading, isreadable
returns 0.
Like the iswritable
, read
, and write
functions, isreadable
checks for valid address values. Illegal address values would be any address space larger than the available space for the processor--232 for the C6xxx processor family and 216 for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
Examples
When you write scripts to run models in MATLAB and CCS IDE, the isreadable
function is very useful. Use isreadable
to check that the channel from which you are reading is configured properly.
cc = ccsdsp; rx = cc.rtdx; % Define read and write channels to the target linked by cc. open(rx,'ichannel','r');s open(rx,'ochannel','w'); enable(rx,'ochannel'); enable(rx,'ichannel'); isreadable(rx,'ochannel') ans= 0 isreadable(rx,'ichannel') ans= 1
Now that your script knows that it can read from 'ichannel
', it proceeds to read messages as required.
See Also
hex2dec
, iswritable
, read
![]() | isenabled | isrtdxcapable | ![]() |