send data continuously

조회 수: 4 (최근 30일)
Paskah Nainggolan
Paskah Nainggolan 2011년 6월 14일
how to send data every 10 millisecond continuously with serial communication? thanx

채택된 답변

Gerd
Gerd 2011년 6월 17일
Hi Paskah,
you can use timers in Matlab to send continously data to your serial device.
t = timer ;
set(t,'ExecutionMode','fixedRate');
set(t,'Period',0.01);
set(t,'TimerFcn',{@mytimer_serial, handles});
start(t)
In the mytimer_serial function you can fire the command to the serial line. But please be careful about the precision as Walter already stated.
Gerd
  댓글 수: 2
Walter Roberson
Walter Roberson 2011년 6월 17일
Yes, the timer period will be _approximately_ 0.01 seconds.
I see Gerd has specified fixedRate, which is probably what you want. For more information on the choices, please see
http://www.mathworks.com/help/techdoc/matlab_prog/f9-39719.html
Paskah Nainggolan
Paskah Nainggolan 2011년 6월 20일
Thanx Mr Gerd

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 6월 14일
What precision do you need on the 10 milliseconds?
Is there a USB / serial device involved in this, or is it a directly connected serial port?
  댓글 수: 2
Paskah Nainggolan
Paskah Nainggolan 2011년 6월 17일
serial device involved
Walter Roberson
Walter Roberson 2011년 6월 17일
Please note that if any USB device is installed, times of 10 millisecond will require special configuration or special programming.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Counter and Timer Input and Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by