Streaming Digital Data with External Trigger


Recommended Posts

I want to setup the LabJack UE9 to do the following:

1) Use an external 1kHz trigger for streaming

2) Capture all digital inputs (Chans 193 & 194) on falling edge of trigger

3) Capture the system timer running at 750kHz, lower 32-bits (Chans 200 & 224) on falling edge of trigger

4) Log the data to a file

Attached is the CTL file I have so far.

Two problems I'm having:

1) Timer fields are always 0

2) The amount of data captured in the file is indicating the data rate is only about 100Hz, not 1kHz.

Thanks for your help,

Jon

UE9_Stream_Digital_Timestamp_withTimerLoopback.ctl

Link to comment
Share on other sites

There are two separate issues here:

1) Timer fields are always 0

There are two issues here: 1st, you initialize timer 0 to mode 10 and then reinitialize it to your other mode. I think you want to put a 1 for channel in your AddRequest() line. Also, there is a firmware issue because the timer used to trigger the stream overrides the system timer and so even once you change that, you'll simply get the same number over. The LabJack guys have fixed this and posted a beta firmware update at:

http://www.labjack.com/files/firmware/ue9/beta/ I'll leave it to them to comment on this.

2) The amount of data captured in the file is indicating the data rate is only about 100Hz, not 1kHz.

Just to recap from a different post: When doing external triggering DAQFactory is unable to determine the exact time of the trigger. This is because the data comes in in blocks of 16, so except for the last point, it has no idea what the other times are. In fact, it doesn't really pay attention to the fact that you are external triggering, and simply assumes you are sampling at whatever stream rate you specified. In your case, you didn't specify any, so it used the default 100hz rate. So, all your data is spaced at 100hz. This is why Jon is reading the system timer: to get the actual data point time.

Now the effect on logging: since you data is being spaced at 100hz, but the real data is around 1khz, the data being logged quickly gets assigned times that are in the future. Because of the way Logging Sets work to align data, this will cause the future data to queue up in memory until that future time arrives or you stop the logging set, which is why it appears not to work.

The solution: if you are doing external triggering, send the LabJack the normal stream frequency command: LJ_chSTREAM_SCAN_FREQUENCY, before setting up the rest of streaming. The value you should set to should be larger than the fastest possible stream rate. This will ensure that all the data remains in the past.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.