Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

U3 LabJackException 9001, incorrect number of bytes from device


  • Please log in to reply
1 reply to this topic

#1 alexetch

alexetch
  • Members
  • 5 posts

Posted 10 April 2013 - 06:18 AM

After issues with the U12 I am now investigating a Raspberry Pi with 2 U3s, one LV and one HV For some reason the LV throws an error when using readRegister() LabJackException: Got incorrect number of bytes from device. Expected 13 bytes, got 9 bytes. The packet recieved was: [131, 127, 0, 0, 0, 3, 0, 131, 3] the HV is fine. in excerpt below d is my LV and f is my HV >>> f.configU3() {'TimerClockConfig': 2, 'TimerClockDivisor': 256, 'LocalID': 2, 'SerialNumber': 320051637, 'CIOState': 0, 'TimerCounterMask': 64, 'DAC1Enable': 1, 'EIODirection': 0, 'DeviceName': 'U3-HV', 'FIODirection': 0, 'FirmwareVersion': '1.44', 'CIODirection': 0, 'DAC0': 0, 'DAC1': 0, 'EIOAnalog': 0, 'CompatibilityOptions': 0, 'EIOState': 0, 'HardwareVersion': '1.30', 'FIOAnalog': 15, 'VersionInfo': 18, 'FIOState': 0, 'BootloaderVersion': '0.27', 'ProductID': 3} >>> f.readRegister(0) 1.3973121643066406 >>> d.configU3() {'TimerClockConfig': 2, 'TimerClockDivisor': 256, 'LocalID': 1, 'SerialNumber': 320054487, 'CIOState': 0, 'TimerCounterMask': 64, 'DAC1Enable': 1, 'EIODirection': 0, 'DeviceName': 'U3-LV', 'FIODirection': 0, 'FirmwareVersion': '1.44', 'CIODirection': 0, 'DAC0': 0, 'DAC1': 0, 'EIOAnalog': 0, 'CompatibilityOptions': 0, 'EIOState': 0, 'HardwareVersion': '1.30', 'FIOAnalog': 0, 'VersionInfo': 2, 'FIOState': 0, 'BootloaderVersion': '0.27', 'ProductID': 3} >>> d.readRegister(0) Traceback (most recent call last): File "<pyshell#27>", line 1, in <module> d.readRegister(0) File "/usr/local/lib/python2.7/dist-packages/LabJackPython.py", line 377, in readRegister return self._parseReadRegisterResponse(response, numBytes, addr, format, numReg) File "/usr/local/lib/python2.7/dist-packages/LabJackPython.py", line 408, in _parseReadRegisterResponse raise LabJackException(9001, "Got incorrect number of bytes from device. Expected %s bytes, got %s bytes. The packet recieved was: %s" % (numBytes, len(response),response)) LabJackException: Got incorrect number of bytes from device. Expected 13 bytes, got 9 bytes. The packet recieved was: [131, 127, 0, 0, 0, 3, 0, 131, 3] >>> I see the same error with the LV if it is the only U3 connected I see the same successful operation with the HV if it is the only U3 conected what could be causing the error? cheers Alex

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 10 April 2013 - 12:23 PM

The Modbus response is indicating an "illegal data value" error. Your U3-LV has the FIO0/AIN0 line configured as a digital line by default (indicated by the returned "'FIOAnalog': 0"), so most likely you are trying to read an analog input on a line configured as digital. Try this config call first then the Modbus call:

d.configIO(FIOAnalog=15) #Setting FIO0-3 to analog inputs (d15 = b00001111)

Note that configIO sets/reads the current settings on your U3 and configU3 sets/reads the power up defaults. Look here for details on the FIOAnalog and other configIO parameters:

http://labjack.com/s...ers-guide/5.2.3


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users