I am trying to set all the flexible inputs (FIs) to analog and read voltage. I am using a U6 since it has the voltage capability. Need > 3.5 volts. I found examples for python and the U3, but when I mimic those commands for a U6 I get errors. This is what I have that works for U3. What should I do for the U6?
import time
import numpy
import scipy
import u3, time
from datetime import datetime
import time
timestamp =(datetime.now())
d = u3.U3()
print d.configU3()
print d.getCalibrationData()
d.configIO(FIOAnalog= 255 )
print d.configU3()
print d.getCalibrationData()
input0 = (d.getAIN(0))
input1 = (d.getAIN(1))
input2 = (d.getAIN(2))
input3 = (d.getAIN(3))
input4 = (d.getAIN(4))
input5 = (d.getAIN(5))
print timestamp, input0, input1, input2, input3, input4, input5
This Does Not work for U6
import time
import numpy
import scipy
import u6, time
from datetime import datetime
import time
timestamp =(datetime.now())
d = u6.U6()
print d.configU6()
print d.getCalibrationData()
d.writeRegister(50590, 15)
print d.configU6()
print d.getCalibrationData()
input0 = (d.getAIN(0))
input1 = (d.getAIN(1))
input2 = (d.getAIN(2))
input3 = (d.getAIN(3))
input4 = (d.getAIN(4))
input5 = (d.getAIN(5))
print timestamp, input0, input1, input2, input3, input4, input5
It says AIN not valid, if I try FIO(x) it says illegal analog command on digital line
Thanks for your help
I tried the U6 code you posted and it was running without error when I tested with a U6. Does your code differ than the one above, or can you provide the exact error message you are getting including the line of code causing the error?
To troubleshoot, first make sure you have the latest version of LabJackPython installed from our site or GitHub. Also, see if power cycling your U6 helps.
Regarding your code more and the U6 in general, the U6 does not share analog input and FIO/EIO digital lines like on the U3, so calls like "d.writeRegister(50590, 15)" and "d.configIO(FIOAnalog= 255)" do not apply to the U6. The U6 has 14 user accessible analog inputs (0-13) which are always analog inputs, and 20 digital I/O (FIO/EIO/CIO/MIO) lines.
getAIN for the U6 is documented here (note that channel 14 is the internal temperature sensor) in the code and can also be accessed with the Python help function:
https://github.com/labjack/LabJackPython/blob/master/src/u6.py#L1394