Acquiring data from NI Daq and serial port simultaneously
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello I am using NiDaq card and serial port for data acquisition. I want to Acquire data from NI Daq and serial port simultaneously. Please answer
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Oct. de 2011
The NiDaq card probably has some buffering on board, so if you were to start the NiDaq data collection and then were to do some data collection from the serial card, and then were to receive the buffered data from the NiDaq card, then the data will have been sampled simultaneously.
Acquiring the data from the two devices simultaneously is much more difficult, and is not possible with the hardware found on most systems. Acquiring data from the serial port normally requires one processor interrupt per byte, and you cannot have two different processor interrupts happening simultaneously. The work around here is to use a high speed serial card that has its own local interrupts and buffers the serial data and DMA's it to main memory: in theory multiple DMA's can happen simultaneously (but users do not often have any control about which DMA''s are going on.) This approach presumes, of course, that the NiDaq card also has DMA, which I have not researched.
Now, acquiring data from two sources simultaneously has nothing to do with getting synchronized samples from the two source. You would have a hope of getting synchronized samples from two data acquisition cards (or channels) by using the sample trigger signal for both, but Alas, since serial ports are asynchronous beasts, getting synchronized information through one of them is near hopeless.
When I see a question like this, unless the author has been very specific, I tend to think that what the author really wants is for the two signals to be time-stamped so that the information from the two sources can be brought in to alignment. Many NiDaq cards are able to time-stamp the data they acquire with a fairly decent precision. Unfortunately, time-stamping serial port data is very approximate at best... unless you can convince the device generating the serial data to construct time-stamps and send them as part of the data, and the clocks on the NiDaq and the remote serial device need to be aligned.
My recommendation would be to avoid this kind of problem if possible. It is almost always better to use multiple channels on the data acquisition card (NiDaq) if you need synchronization.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Acquisition Toolbox Supported Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!