Labjack T7 stream and trigger problem | LabJack
 

Labjack T7 stream and trigger problem

8 posts / 0 new
Last post
T7labjackUser
gaubry's picture
Labjack T7 stream and trigger problem

Dear Labjack users,

I am using a labjack T7 with usb port and I am doing a stream acquisition on AIN0, AIN1, AIN13 and DIO0. The acquisition should look like this:

In red, AIN0, in green AIN1, in blue FIO0. AIN13 is shown on the bottom plot. (The second pannel just shows AIN1 as a function of AIN0)

Here is how it sometimes looks like:

Obviously, the trigger was not done properly: by defining

    #3 enables a rising or falling edge to trigger stream

    aValues = [2000, 3]

    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

I would have expected to trigger only on rising edge. This is the case most of the time, but sometime it isn't... Am I doing something wrong?

Even worse! From time to time I get something like this. AIN13 seems to have the data of AIN0, FIO0 something that looks like AIN1...

Could you tell me if I am doing something wrong? Or is it a bug from the Labjack T7?

Best,

G.

PS: Here is my python code:

aScanListNames = ["AIN0","AIN1","AIN13"]

aScanListNames.append("FIO_STATE")

numAddresses = len(aScanListNames)

aScanList = ljm.namesToAddresses(numAddresses, aScanListNames)[0]

scanRate = 10000

scansPerRead = int(1.*scanRate)

ain=np.zeros((numAddresses,scansPerRead))

try:

    # Configure the analog inputs' negative channel, range, settling time and

    # resolution.

    # Note when streaming, negative channels and ranges can be configured for

    # individual analog inputs, but the stream has only one settling time and

    # resolution.

    aNames = ["AIN_ALL_NEGATIVE_CH", "AIN_ALL_RANGE", "STREAM_SETTLING_US",

              "STREAM_RESOLUTION_INDEX"]

    #AIN_ALL_RANGE=Valid values/ranges: 0.0=Default=> +/-10V, 10.0=> +/-10V, 1.0=> +/-1V, 0.1=> +/-0.1V, or 0.01=> +/-0.01V.

    aValues = [ljm.constants.GND, 10.0, 0, 0] #single-ended, +/-10V, 0 (default),

                                              #0 (default)

    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

    aNames = ["DIO0_EF_ENABLE"]

    #1 Disable DIO0_EF

    aValues = [0]

    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

    aNames = ["STREAM_TRIGGER_INDEX", "DIO0_EF_INDEX"]

    #2000 sets DIO0 / FIO0 as the stream trigger

    #0 Clear any previous DIO0_EF settings

    #3 enables a rising or falling edge to trigger stream

    aValues = [2000, 3]

    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

    aNames = ["DIO0_EF_ENABLE"]

    #1 Enable DIO0_EF

    aValues = [1]

    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

    # Configure and start stream

    scanRate = ljm.eStreamStart(handle, scansPerRead, numAddresses, aScanList, scanRate)

    i = 1

    while i <= MAX_REQUESTS:

        try:

            ret = ljm.eStreamRead(handle)

        except:

            print("oups...")

        data = ret[0]

        #deinterlace the data

        for j in range(numAddresses):

            ain[j,:]=data[j::numAddresses]   

        i += 1

    #print("Stop Stream")

    ljm.eStreamStop(handle)

except ljm.LJMError:

    ljme = sys.exc_info()[1]

    print(ljme)

except Exception:

    e = sys.exc_info()[1]

    print(e)

LabJack Support
labjack support's picture
We're putting together a test

We're putting together a test to try to reproduce what you are seeing. 

LabJack Support
labjack support's picture
Our test ran for 2500

Our test ran for 2500 iterations with only positive edge triggers.

Let's start by making sure we are on the same versions. Use Kipling to update your T7 to firmware 1.0242. and update to the latest driver: https://labjack.com/support/software/installers

Do you still get the same issues after updating versions?

T7labjackUser
gaubry's picture
Dear LabJack Support,

Dear LabJack Support,

Thanks a lot for your answer. Updating the firmware from 1.0225 (Stable version) to 1.0242 (beta) solves one problem: the horrible acquisition (last figure on my first plot), but it still sometimes trigger on the falling edge.

To let you test my code, I've included a minimal example. Just run acquisition.py in a python 3 console. You need to have mylabkack.py in the same directory.

Best,

G.

LabJack Support
labjack support's picture
Thank you for the python code

Thank you for the python code. We will look into running it.

Do I understand correctly that the blue line is the trigger and it varies between 0 and 1 volts?

T7labjackUser
gaubry's picture
Dear Labjack support,

Dear Labjack support,

Thanks a lot for you support. I could not work on this project these last days, therefore my late reply. Sorry about that.

As you can see on the attached picture, the trigger signal goes from about 0 to almost 4V. Isn't it enough for the Labjack?

Best,

G.

LabJack Support
labjack support's picture
4 V is enough to cross the

4 V is enough to cross the logic thresholds. Our test was using a 3.3 V signal to trigger the stream.

LabJack Support
labjack support's picture
I had a hard time getting

I had a hard time getting your program to run. I must have had the wrong version of one of the dependencies. After simplifying things quite a bit I created a test that attempts to reproduce the incorrect edge trigger.

To run the test connect AIN0 to FIO0 and FIO2 (all three shorted together.) Then run acquisition_test.py