DSPRelated.com
Forums

RTDX with Matlab 2009b and CCS V4.2

Started by xzranger August 18, 2011
Dear friends,

I was trying to use the follow matlab code to open the RTDX channel, but it failed.

%%DM37XX RTDX PC side Matlab code
h = actxserver('RTDX');
% Open rtdx read channel
status = invoke(h,'Open','ochan','R');

% Find how many messages available in read buffer
% RTDX seems to keep read values in the buffer, so
% need to read just the latest one
[status,nummsgs] = invoke(h,'GetNumMsgs');

% Fast forward to latest message
status = invoke(h,'Seek',nummsgs);

% Read from read channel
[status, values] = invoke(h,'ReadI2');

% Close channel
status = invoke(h,'Close');

The matlab said,

??? Error using ==> actxserver at 91
Server creation failed. Invalid ProgID 'RTDX'

Error in ==> PC_RTDX at 2
h = actxserver('RTDX');

I also try the another way
%% RTDX
clc;
cc = ccsdsp;
rtdx_ochan = cc.rtdx;
open( rtdx_ochan, 'ochan', 'r' );
timeout_msg = 'Timeout';
NOMOREDATAMSG = 'No more data is available!';
errmsg = NaN;
while ( isempty( findstr( timeout_msg , errmsg ) ) )
try
% read data
data = readmsg( rtdx_ochan, 'ochan', 'int32' );
% display data
disp( data );
catch
errmsg = lasterr;
disp( NOMOREDATAMSG );
break;
end
end

close( rtdx_ochan, 'ochan');

It fail again.

??? Cannot start CCS application (COM error code: 0x80040154). Verify that your CCS software is installed and configured properly.

Error in ==> ticcs>Connect2App_CheckIdeVersion at 163
hccs.Connect(1);

Error in ==> ticcs at 58
hccs = Connect2App_CheckIdeVersion;

Error in ==> ccsdsp at 56
h = ticcs(varargin{:});

Error in ==> MATLAB_RTDX at 3
cc = ccsdsp;

The DSP code I used is as follow. I send it in my SWI, which will be trigged in 1Hz by a timer, I just do RTDX_Write 1 time and then halt it by a breakpoint.
#define TIMER_VECID 14u
#define BUFFER_SIZE 128

extern cregister unsigned int CSR;
extern cregister unsigned int IER;
UINT8 gaucTestBuffer[BUFFER_SIZE];
UINT8 gucStatus = 0;

void Timer5_ISR()
{
SWI_post(&SWI0);
LOG_printf(&trace, "Timer Tick and Tock!");
}
void Timer5_SWI()
{
gucStatus = RTDX_write(&ochan, gaucTestBuffer, BUFFER_SIZE * sizeof(UINT8));

if(0 == gucStatus)
{
LOG_printf(&trace, "Error occur when write to RTDX !");
}
}
void main()
{
UINT16 i;

for(i = 0; i < BUFFER_SIZE; i++)
{
gaucTestBuffer[i] = i;
}

CSR |= 1;
IER |= 1 << TIMER_VECID;

RTDX_enableOutput(&ochan);
}

Can anyone give me some advise?

Best regards!