User`s guide

2 Automa tion Interface
and exit the program, or respond in s ome way. When you are writing or
reading data to your processor in a script or M-le, checking the status of
the channels can help you avoid errors during execution.
As your application runs you may nd it helpful to display progress
messages. In this case, the program directed MATLAB software to print a
message as it reads the data from the p rocessor by adding the function
disp('writing to processor...')
Function cc.rtdx.writemsg('ichan', int16(indata)) results in 20
messages stored on the processor. He re’s how.
When you write
indata to the processor, the following code running on the
processor takes your input data from
ichan, adds one to the values and
copiesthedatatomemory:
while ( !RTDX_isInputEnabled(&ichan) )
{/* wait for channel enable from MATLAB */}
RTDX_read( &ichan, recvd, sizeof(recvd) );
puts("\n\n Read Completed ");
for (j=1; j<=20; j++) {
for (i=0; i<MAX; i++) {
recvd[i] +=1;
}
while ( !RTDX_isOutputEnabled(&ochan) )
{ /* wait for channel enable from MATLAB */ }
RTDX_write( &ochan, recvd, sizeof(recvd) );
while ( RTDX_writing != NULL )
{ /* wait for data xfer INTERRUPT DRIVEN for C6000 */ }
}
Program int16_rtdx.c contains this source code. You can nd the le in a
folder in the
..\tidemos\rtdxtutorial directory.
5 Type the following to check the number of available messages to read from
the processor.
num_of_msgs = cc.rtdx.msgcount('ochan');
2-34