isreadable

Determine whether MATLAB® software can read specified memory block

Syntax

isreadable(cc,address,'datatype',count)
isreadable(cc,address,'datatype')
isreadable(rx,'channel')

Description

isreadable(cc,address,'datatype',count) returns 1 if the processor referred to by 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. 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.

addressisreadable 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.

When 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, ticcs sets the page to 0 at creation if you omit the page property as an input argument. For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using the memory location without the page value.

Examples of Address Property Values

Property ValueAddress TypeInterpretation

'1F'

String

Location is 31 decimal on the page referred to by cc.page

10

Decimal

Address is 10 decimal on the page referred to by cc.page

[18,1]

Vector

Address location 10 decimal on memory page 1 (cc.page = 1)

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 software data type. The total memory block size is derived from the value of count and the datatype you specify. datatype determines how many bytes to check for each memory value. isreadable supports the following data types:

datatype StringNumber of Bytes/ValueDescription

'double'

 

Double-precision floating point values

'int8'

 

Signed 8-bit integers

'int16'

 

Signed 16-bit integers

'int32'

 

Signed 32-bit integers

'single'

 

Single-precision floating point data

'uint8'

 

Unsigned 8-bit integers

'uint16'

 

Unsigned 16-bit integers

'uint32'

 

Unsigned 32-bit integers

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 are address spaces 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 the MATLAB environment 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 = ticcs;
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

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS
 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS