User`s guide
write
Writing Negative Values
Writing a negative value causes the data written to be saturated
because
char is unsigned on the process or. Hence, a 0 (a NU LL) is
written instead. A wa rning resultsaswell,asthisexampleshows.
cc = ticcs;
ff = createobj(cc,'g_char'); % Where g_char is in the code.
write(ff,-100);
Warning: Underflow: Saturation was required to fit the data into
an addressable unit.
When you try to read the data you w rote, the character being read is
0 (NU LL) — so there seems to be nothing returned by the
read function.
You can demonstrate this by the following code, after w riting a negative
valueasshowninthepreviousexample.
readnumeric(x)
ans =
0
read(x) % Reads the NULL character.
ans = % Apparently nothing is returned.
double(read(x)) % Read the numeric equivalent of NULL.
ans = % Again, appears not to return a value.
Examples The following examples demonstrate how to use write. cc is a ticcs
object.
Connect to a p rocessor and write data to it. In this example, CCS IDE
recognizes one b oard having one p roces sor.
cc = ticcs;
cc.visible(1);
write(cc,'50',1:250);
mem = read(cc,0,'double',50) % Returns 50 values as a column
% vector in mem.
7-162