Filter löschen
Filter löschen

Problem with the number of successive serial commands (fprintf())

1 Ansicht (letzte 30 Tage)
Mo
Mo am 28 Mär. 2013
Hi,
I am having a problem with the number of successive serial commands (fprintf())sent through a USB serial port. I am doing a project where I have to send a number of commands to move two stepper motors into specified coordinates. The motion controller I am using is a JAF motion controller (<http://www.jafmotion.co.uk/)>.
The code below is executed after pressing a button on a MATLAB GUI:
if true
s = serial(COM4);
fopen(s);
fprintf(s, '-3262 -1920;');
fprintf(s,'PD4000;');
fprintf(s, '-5234 -1231;');
fprintf(s,'PD4000;');
fprintf(s, '-5123 -5122;');
fprintf(s,'PD4000;');
fprintf(s, '-9872 -1221;');
fprintf(s,'PD4000;');
fprintf(s, '-5123 -7272;');
fprintf(s,'PD4000;');
...
fclose(s);
end
The numbers inside the brackets are the coordinate system specified by JAF.
The problem is that the stepper motors only move to a particular point (Say -5123, -5122) and then stop. Any number of successive fprintf() commands below 16 seem to work but any fprintf() statements after the 16th one don't do anything.
I am pretty sure this is a software problem, not hardware. I have tried changing the input and output buffer sizes to 1024 (default is 512) but no effect.
Any ideas why this is happening?
Thanks a lot !
Regards,
Mo

Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by