Synchronizing Stream In and Command/Response data in Labview. | LabJack
 

Synchronizing Stream In and Command/Response data in Labview.

3 posts / 0 new
Last post
Parker Stenberg
Parker Stenberg's picture
Synchronizing Stream In and Command/Response data in Labview.

I'm reading 16 AIN Channels, and 2 DIO_EF_A_F. The Stream rate is 1kS/s. I'm not concerned with the sample rate of the command/response, that can be much slower.
My question is, is there any way to synchronize the two sets of data and save it to a log file? 
I'm trying to log motor direction/rotations, along with analog sensor data.
I want to log the Command/Response data so it corresponds to the Streamed data.
All my attempts have resulted in a huge difference in the timing and recording.
I'd rather not log two separate files, but I may have too. TDMS, .dat, .csv, I don't care.

My code is a modified version of the LJStreamM V1.04.vi with a command response loop added.

Labview 2015 64bit

File Attachment: 
LabJack Support
labjack support's picture
There are some methods to do

There are some methods to do decent synchronization, but the best and simplest solution is to read DIO#_EF_READ_A rather than DIO#_EF_READ_F as you can read the former as part of your stream:

https://labjack.com/support/datasheets/t7/communication/stream-mode

So you will have a scan with 20 channels such as:

AIN0
AIN1
.
.
.
AIN14
AIN15
DIO0_EF_READ_A
STREAM_DATA_CAPTURE_16
DIO1_EF_READ_A
STREAM_DATA_CAPTURE_16

Parker Stenberg
Parker Stenberg's picture
Got it. That simplifies

Got it. That simplifies things immensely!

One recommendation, in the "LJstreamUD add data to file" vi, 8 digits of precision is a bit excessive for my application.
I've modified it to be a Config value as well.