Problem with Matlab and SSC-32

Hi,

I have a frustrating problem that is really costing me quite a lot of time to solve it. I am basically trying to move a servo controller from Matlab by using SSC 32. I am using a Serial to USB converter and Matlab 2009b 64bit. Also the following command is used:

clc
clear all
obj = serial(‘COM7’)
set(obj, ‘Terminator’, ‘CR’)
set(obj, ‘BaudRate’,115200,‘DataBits’,8,‘Parity’,‘none’,‘StopBits’,1)
obj.FlowControl = ‘none’
fopen(obj);

fprintf(obj,’#0P1500’)

fclose(obj)

I am basically just initializing the COM port and the serial setting, and then sending a text to the SSC-32 to control the servo accordingly.

My problem is this, sometimes it works, sometimes it doesn’t lol. I just changed the Serial to USB cable, installed its drivers and I was pleased that it worked like a charm, since I thought the problem was from the old cable. But I was wrong since it only worked for a while and then it just stopped. The signal is being received by the SSC-32 since the green light lights up when ever I run the program, but the servo motor does not move. Also the green light does not always light up when I run the program.

When ever I try to control the servo motor from the Lynx Term it always communicates without a problem but whenever I use Matlab, it either works or it doesn’t :imp: .

anyone had similar problems etc… ?

Thanks

This is a new one. Historically others using matlab have stated it either works or it doesn’t. Most of the time it’s just forgetting the baud rate jumpers or the CR to make the SSC-32 act on the commands.

Here’s an idea. PC’s do not share serial ports, whether RS-232 or USB, the PC can only allow one program to “have” the serial port at a time. This is normally done when the program is started.

If you have Lynxterm open and it grabbed the serial port. No other program started after LynxTerm can have access to it. So you must close LynxTerm so it will release the serial port for matlab to have access to it. Is this the sort of problem you are seeing?

Have you tried adding a CR or LF? Not sure why it should be intermittent, 'tho.

Alan KM6VV