MATLAB Link for Code Composer Studio Development Tools | ![]() ![]() |
Determine if MATLAB can write to the specified memory block
Syntax
Description
iswritable(cc,address,'
returns 1 if MATLAB can write to the memory block defined by the datatype
'
,count)
address
, count
, and datatype
input arguments on the processor referred to by cc
. When the processor cannot write to any portion of the specified memory block, iswritable
returns 0. Notice that you use the same memory block specification for this function as you use for the write function. The data block being tested begins at the memory location defined by address
. count
determines the number of values to write. datatype
defines the format of data stored in the memory block. iswritable
uses the datatype
parameter to determine the number of bytes to write per stored value. For details about each input parameter, read the following descriptions.
address
-- iswritable
uses address
to define the beginning of the memory block to write to. 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 the memory location without the page value.
To specify the address in hexadecimal format, enter the address property value as a string. iswritable
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 writable. To assure parallel structure with write
, count
can be a vector to define multidimensional data blocks. This function always tests a block of data whose size is the total number of elements in matrix specified by the input vector. If count
is the vector [10 10 10]
iswritable
writes 1000 values (10*10*10) to the target processor. For a 2-dimensional matrix defined with count
as
iswritable
writes 30 values to the processor.
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. iswritable
supports the following data types:
iswritable(cc,address,'
datatype
'
)
returns 1 if the processor referred to by cc
can write to the memory block defined by the address
, and count
input arguments. When the processor cannot write any portion of the specified memory block, iswritable
returns 0. Notice that you use the same memory block specification for this function as you use for the write function. The data block tested begins at the memory location defined by address
. When you omit the count
option, count
defaults to one.
Like the isreadable
, read
, and write
functions, iswritable
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 iswritable
function is very useful. Use iswritable
to check that the channel to which you are writing to is indeed configured properly.
cc = ccsdsp; rx = cc.rtdx; % Define read and write channels to the target linked by cc. open(rx,'ichannel','r'); open(rx,'ochannel','w'); enable(rx,'ochannel'); enable(rx,'ichannel'); iswritable(rx,'ochannel') ans= 1 iswritable(rx,'ichannel') ans= 0
Now that your script knows that it can write to 'ichannel
', it proceeds to write messages as required.
See Also
hex2dec
, iswritable
, read
![]() | isvisible | list | ![]() |