Hello,
I have been trying to use the T7 Pro with the MUX80 and two CB37s. I have set up a CB37 with the X3 slot of the MUX80 to make differential measurements for thermocouples. I have my postive and negative leads attached to AIN0-4 and AIN8-12 locally on the X3 CB37, which is to say they are connected to AIN48-52 and AIN56-60, as directed on the MUX80 data sheet for differential measurements.
https://labjack.com/support/datasheets/accessories/mux80
However, I continue to get an error returned when specifying the negative channel:
labjack.ljm.ljm.LJMError: Address 41048, LJM library error code 2373 AIN_NEGATIVE_CHANNEL_INVALID.
I am not sure what is wrong with my code, as 41048 is the registry address for the AIN48 negative channel. I have posted my (python) code below - any help is appreciated.
# Setup AIN for T-type TC
# Set TC type
aAddresses['AIN#_EF_INDEX'] = [] # [Set TC type address]
aDataTypes['AIN#_EF_INDEX'] = [] # [Set TC type as int]
aValues['AIN#_EF_INDEX'] = [] # [Set TC type, 24 for T-type]
# Set negative channel
aAddresses['AIN#_NEGATIVE_CH'] = [] # [Set TC negative channel for differential measurement]
aDataTypes['AIN#_NEGATIVE_CH'] = [] # [Set TC negative channel type as int]
aValues['AIN#_NEGATIVE_CH'] = [] # [Set TC negative channel, AIN(n+8)]
TC_AINp = 48
TC_AINn = TC_AINp+8
numTC = 5
for i in range(numTC):
aAddresses['AIN#_EF_INDEX'].append(9000+2*(i+TC_AINp))
aDataTypes['AIN#_EF_INDEX'].append(ljm.constants.UINT32)
aValues['AIN#_EF_INDEX'].append(24)
aAddresses['AIN#_NEGATIVE_CH'].append(41000+i+TC_AINp)
aDataTypes['AIN#_NEGATIVE_CH'].append(ljm.constants.UINT16)
aValues['AIN#_NEGATIVE_CH'].append(2*(i+TC_AINn))
ljm.eWriteAddresses(handle, numTC, aAddresses['AIN#_EF_INDEX'], aDataTypes['AIN#_EF_INDEX'], aValues['AIN#_EF_INDEX'])
ljm.eWriteAddresses(handle, numTC, aAddresses['AIN#_NEGATIVE_CH'], aDataTypes['AIN#_NEGATIVE_CH'], aValues['AIN#_NEGATIVE_CH'])
I'm not a Python expert, but you want to set the negative channel for AIN48 to AIN56, you want to write:
AIN48_NEGATIVE_CH = 56
Which would translate to writing a value of 56 to address 41048.
If you're still stuck, let us know and this will get marked for a Python expert.
Thanks for the reply.
I am under the impression that I am doing that with the lines:
aAddresses['AIN#_NEGATIVE_CH'].append(41000+i+TC_AINp) ;
aDataTypes['AIN#_NEGATIVE_CH'].append(ljm.constants.UINT16);
aValues['AIN#_NEGATIVE_CH'].append(2*(i+TC_AINn)),
and
ljm.eWriteAddresses(handle, numTC, aAddresses['AIN#_NEGATIVE_CH'], aDataTypes['AIN#_NEGATIVE_CH'], aValues['AIN#_NEGATIVE_CH']),
since TC_AINp = 48 and TC_AINn = 56. I've also used this script to read a single CB37 board, so I am a bit confused as to what is wrong.
aValues['AIN#_NEGATIVE_CH'] is [112, 114, 116, 118, 120], which are invalid negative channels for AIN48-52. For valid negative channels [56, 57, 58, 59, 60], change:
aValues['AIN#_NEGATIVE_CH'].append(2*(i+TC_AINn))
To:
aValues['AIN#_NEGATIVE_CH'].append(i+TC_AINn)
Also, for clarification, with AIN#_NEGATIVE_CH you set the negative channel number, and not the negative channel's register address.
Thanks, your correction worked. I wasn't aware AIN#_NEGATIVE_CH was pointing to the channel number instead of the register address, although I probably should have known that given the name.