필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Mo
Mo 2013년 3월 28일
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개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by