Python- define gain, range and index of AIN for T7 | LabJack
 

Python- define gain, range and index of AIN for T7

4 posts / 0 new
Last post
Nora
abbaszadeh@ovgu.de's picture
Python- define gain, range and index of AIN for T7

I have 8 analog inputs from a torque sensor with an input ranges of ±8 volts. How can i define the gain=1, Index=1 and range=±10 of AIN's of Labjack T7 in a python script? Is there any example for this purpose?

Thanks in Advance

LabJack Support
labjack support's picture
With the T7 you can break

With the T7 you can break most questions like this in to 2 parts:

1.  Determine what registers you need to write and read.  In this case Section 14 of the T7 Datasheet is a good place to look.  There are registers to configure each channel individually, but it sounds like you can just use the ALL registers to configure all analog inputs the same:

AIN_ALL_RANGE = 10    //Gain and Range are the inverse of each other.
AIN_ALL_RESOLUTION_INDEX = 1

For your readings, you can just read the AIN# registers (AIN0, AIN1, ..., etc.).

https://labjack.com/support/datasheets/t7/ain

2.  Now that you know what registers you need to write and read, use eWriteNames and eReadNames to do so.  There are examples calling these functions in the Python archive:

https://labjack.com/support/software/api/ljm/function-reference/multiple...

https://labjack.com/support/software/examples/ljm/python

Nora
abbaszadeh@ovgu.de's picture
Hello,

Hello,

Up to now, I was using 6 AIN and one digital for quadrature and everything runs well while streaming up to 1kHz, Gain 1, index 0.

I am very happy about the device and the measurements we do.

Now I changed the setup and added three more AIN which are less time critical. All streamings where succesfully done at first. After multiple scans, the Labjack T7 became very fast (stream rate was more took much less the 1s per scan) at same time multiple packages got lost, but the stream function did not report skipped values.

If I run with 20Hz everything works. Faster aquisition always shows this problem, but stochastically, and sometimes only 5 pkgs

sometimes 2 and so on are delievered or missed.

Is there a solution?

Can we switch some AIN to lower index which are less time critical? And if yes, how? what is the correct usage of this code:

 aNames = ["AIN_ALL_NEGATIVE_CH", "AIN_ALL_RANGE", "STREAM_SETTLING_US",
              "STREAM_RESOLUTION_INDEX"]
    aValues = [ljm.constants.GND, 10.0, 0, 0] #single-ended, +/-10V, 0 (default),
                                              #0 (default)
    ljm.eWriteNames(handle, len(aNames), aNames, aValues)

Thank you very much for your help.

 

LabJack Support
labjack support's picture
What do you mean "the Labjack

What do you mean "the Labjack T7 became very fast (stream rate was more took much less the 1s per scan)"? What was the ScanRate and ScansPerRead you passed in eStreamStart?

What do you mean when you say packages get lost? Do you mean -9999 is returned as data? If that's the case, here's what you need to do:

https://labjack.com/support/software/api/ljm/streaming-lots-of-9999-values

In regards to AIN configuration, see the following datasheet page, which describes the registers to configure AIN independently:

https://labjack.com/support/datasheets/t7/ain

For example, see "AIN#(0:13)_RANGE" for configuring the range of each AIN individually. (E.g. you'd use AIN0_RANGE and AIN1_RANGE to configure AIN0 and AIN1 independently.)