LabJack U6 Low Level Function | LabJack
 

LabJack U6 Low Level Function

2 posts / 0 new
Last post
xyz123
xyz123's picture
LabJack U6 Low Level Function

Hi,

    I'm trying to set up FIO2 as an input channel (reads from a lever switch) but it will become an output channel every time a state is written to ports.

   The configuration I have now is FIO0, FIO1, FIO3, EIO0-7, CIO0 as output and FIO4-7 are two timers and two counter.

    Here is a test using Labjack Python Library:

>>> import u6

>>> d = u6.U6()

>>> d.getFeedback(u6.PortDirRead())

[{'CIO': 1, 'FIO': 11, 'EIO': 255}]

>>> d.getFeedback(u6.PortStateRead())

[{'CIO': 14, 'FIO': 244, 'EIO': 255}]

>>> d.getFeedback(u6.BitStateWrite(2,0))

[None]

>>> d.getFeedback(u6.PortStateRead())

[{'CIO': 14, 'FIO': 240, 'EIO': 255}]

>>> d.getFeedback(u6.PortDirRead())

[{'CIO': 1, 'FIO': 15, 'EIO': 255}]

LabJack Support
labjack support's picture
BitStateWrite will force the

BitStateWrite will force the line to an output. PortStateWrite will do the same for the lines you are updating, and you can choose what lines to update with the WriteMask setting. By default the u6 module's PortStateWrite updates all digital lines, so set the WriteMask for FIO2 to 0. For example:

#State and WriteMask are [FIO, EIO, CIO]
#Setting only FIO0, FIO1, FIO3, EIO0-7, CIO0 to output-high.
#State/WriteMask = [b00001011 = d11, b11111111 = d255, b0001 = 1]
d.getFeedback(u6.PortStateWrite(State = [11, 255, 1], WriteMask = [11, 255, 1]))