MATLAB: Problem in sending serial data to monochromator controller

serial port communication

I have a AMS DCB-241 Stepper motor controller controlling the Monochromator's grating motion.
I am trying to automate this system with MATLAB, i am using serial communication port USB-SIN11 adapter cable to connect computer to the controller.
With the propitiatory software commands like ex. '-1000' (move the grating to 1000nm clockwise), '+1000' move the grating to 0th positing anticlock wise) 'V=1000' (slew speed 1000 steps/s) etc…
When i send these commands through the Matlab code, Controller is NOT responding by moving the stepper motor in the monochormator.
Can you please help me out in resolving ths issue? Is there a problem with the code?
Kindly do the needful and oblige.
Here is the mat lab code i wrote:
s1 = serial ('com3', 'BaudRate', 9600, 'DataBits', 8);
fprintf (s1, 'i=50');
fprintf (s1, 'k=100,100');
fprintf (s1, 'v=1000');
fprintf (s1, '-8908');
pause (20);
fprintf (s1, '-213');
pause (10);
fprintf (s1, '-240');
pause (10);
fprintf (s1, '-133');
pause (10);
fprintf (s1, '+9494');
pause (20);
Thanks in advance

Best Answer

  • The documentation for the device indicates that you need to set hardware flow control.
    I also see that it needs a Terminator of CR. At the moment I do not see documented what the default terminator is, so it would be best to specify it specifically
    'Terminator', 'CR'