DSPRelated.com
Forums

using RTDX for huge data transferring

Started by ahmadagha23 October 9, 2005
hello
How can I exchange image data between host (MATLAB 7) and target
program on C6711 dsk?
My hoost and target codes for RTDX are as below this text. When the
amount of data to be transfered
is more than 1010 Byte, the MATLAB sends timeout error for reading
data from 'ochan';although I set the timeout00s.
Do you know Why? Is it because of parallel port? -------------------------------
THE HOST (MATLAB 7) CODES:
-------------------------

ccdsp('boardnum',0,'procnum',0);
configure(cc.rtdx,2048,4)
open(cc.rtdx,'ichan','w')
open(cc.rtdx,'ochan','r')
enable(cc.rtdx);
enable(cc.rtdx,'ichan');
set(cc.rtdx,'timeout',1000);
I=imread(['d:\image\1475.jpg']);
I1=rgb2gray(I);
I1%5*im2double(I1);
ui8=uint8(I1(1:1020));

if iswritable(cc.rtdx,'ichan'),
writemsg(cc.rtdx,'ichan', ui8)
end pause(9)
enable(cc.rtdx,'ochan');
num_of_msgs = msgcount(cc.rtdx,'ochan')
outdata = readmsg(cc.rtdx,'ochan', 'uint8')
disable(cc.rtdx,'ALL');
% DISABLE RTDX
disable(cc.rtdx);
% CLOSE channels
close(cc.rtdx,'ichan');
clear cc; % Call destructor ---------------------------------
--------------
THE TARGET APPLICATION CODE ON 6711DSK:(it is very similar to MATLAB
RTDX tutorial)
--

#include <rtdx.h> /*
RTDX_Data_Read */
#include <stdio.h> /*
printf */
#include "target.h" /*
TARGET_INITIALIZE */

#define MAX 1020

unsigned char recvd[MAX];

RTDX_CreateInputChannel(ichan); /* Channel to
receive data from */
RTDX_CreateOutputChannel(ochan); /* Channel to use to
write data */

void main( void )
{
int i,j;

TARGET_INITIALIZE(); /* target
specific RTDX init */

while ( !RTDX_isInputEnabled(&ichan) )
{/* wait for channel enable from MATLAB */}
RTDX_read( &ichan, recvd, sizeof(recvd) );
puts("\n\n Read Completed "); 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
*/ } while ( RTDX_isInputEnabled(&ichan) || RTDX_isOutputEnabled
(&ochan) )
{ /* wait for channel disable from MATLAB */ }
puts("\n\n Test Completed ");
while (1) {}
}