Problem with the number of successive serial commands (fprintf())
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!