Reading in 1.5 kHz Square Wave

2 posts / 0 new
Last post
kfich
kfich's picture
Reading in 1.5 kHz Square Wave

I am trying to read in from 4 ports (and read out to two ports) enough data points to be able to graph a 1.5 kHz square wave. In theory with a rate of 40 ksamples per second I should be able to get four points per cycle, from 4 ports, at frequcies up to 2.5 kHz. In reality, the points stop being evenly spaced, and there is significant lagging for anything above 500 Hz. I've tried only reading in from two ports, and this did not improve the situation. Is there any other way I can get the data I want? I am working in python and starting from the example stream in/out code provided by Labjack.

LabJack Support
LabJack Support's picture
Hello! I'm trying to

Hello! I'm trying to understand your exact constraints and the issues you're seeing.

Does your stream out waveform loop?

What ScanRate are you using? What is the channel list? What are your stream out targets?

What do you mean by:

In reality, the points stop being evenly spaced, and there is significant lagging for anything above 500 Hz

This doesn't make sense to me because stream mode is hardware-timed, so sample collection timing is always consistent (or else stream would give a STREAM_SCAN_OVERLAP error). I'm wondering if the following section of stream documentation would be helpful for you:

https://labjack.com/support/datasheets/t-series/communication/stream-mode#stream-timing

There's also this section of the eStreamStart page which explains how to do low-latency streaming, if that's what you need to do:

https://labjack.com/support/software/api/ljm/function-reference/ljmestreamstart#low-latency

If neither of those sections are what you needed, I would suggest taking a look at the "How samples are moved from the device to your application" section of the eStreamStart page.