Azzera filtri
Azzera filtri

send data continuously

3 visualizzazioni (ultimi 30 giorni)
Paskah Nainggolan
Paskah Nainggolan il 14 Giu 2011
how to send data every 10 millisecond continuously with serial communication? thanx

Risposta accettata

Gerd
Gerd il 17 Giu 2011
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 Commenti
Walter Roberson
Walter Roberson il 17 Giu 2011
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 il 20 Giu 2011
Thanx Mr Gerd

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 14 Giu 2011
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 Commenti
Paskah Nainggolan
Paskah Nainggolan il 17 Giu 2011
serial device involved
Walter Roberson
Walter Roberson il 17 Giu 2011
Please note that if any USB device is installed, times of 10 millisecond will require special configuration or special programming.

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by