Python example for differential input needed | LabJack
 

Python example for differential input needed

5 posts / 0 new
Last post
Chuck Z
czalinski's picture
Python example for differential input needed

I have example code that shows configuring for single ended inputs:

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

So what is the constant to use to specify differential?

And then do I just read the even numbered channels?

I think the LabJack example code could use at least one example of measuring differential input. Or maybe there is something and I couldn't find it.

LabJack Support
labjack support's picture
The NEGATIVE_CH registers for

The NEGATIVE_CH registers for single-ended and differential configuration are documented here in the datasheet:

https://labjack.com/support/datasheets/t-series/ain#differential

So what is the constant to use to specify differential?

For AIN_ALL_NEGATIVE_CH, set it to 1 for all analog inputs to be differential. There is no constant in LJM like with GND. For individual analog input configuration, use AIN#(0:13)_NEGATIVE_CH registers.

And then do I just read the even numbered channels?

Yes, you read the even channels for the differential voltage. For example, reading from AIN2 is the AIN2-AIN3 differential.

Chuck Z
czalinski's picture
Sorry, still a bit confused

Sorry, still a bit confused about setting the negative channel. I'll get specific with an example. Assume I have a Mux80.

Need

* Read AIN64 as single-ended

* Read AIN48 as differential

To achieve this

* Set AIN64_NEGATIVE_CH to 199 (which means GND)

* Set AIN48_NEGATIVE_CH to ???

I want it to be AIN56 per the specifications.

Do I write 56 to explicitly say 56?

Or do I write 1 and then the T7 knows it is 56?

Chuck Z
czalinski's picture
Sorry, I could use more

Sorry, I could use more clarification. I am using a Mux80.

If I want to read AIN48 as differential, what do I set AIN48_NEGATIVE_CH to be?

Do I explicitly set it to 56 to say AIN56 is the negative channel?

Or do I set it to 1 and the T7 inherently knows AIN56 is the negative channel?

LabJack Support
labjack support's picture
To set AIN48 to differential,

To set AIN48 to differential, set the negative channel ( AIN48_NEGATIVE_CH ) to 56.

 

When using the AIN_ALL_NEGATIVE_CH  register, a value of 1 will automatically set all AINs to the appropriate negative channel.