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

Gettting the status of Digital I/O ports on UE9


  • Please log in to reply
2 replies to this topic

#1 Paul Oberlin

Paul Oberlin
  • Members
  • 6 posts

Posted 28 June 2012 - 08:19 AM

I am trying to determine what the states of the lab jack pins are (input, output-high, output-low) when my application starts. This is important because those states will persist if my program is killed and restarted. I couldn't find this explained in the labjack192.pdf file. In section 4.3.5, there is a LJ_ioGET_DIGITAL_BIT_STATE that can be used as a parameter to AddRequest, but I don't find any documentation on what this means, nor on how to interpret the returned values from GetResult from this request. Any help would be appreciated, thanks.

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 June 2012 - 08:42 AM

You are on the right track. Section 4.3.5 of the UE9 User's Guide lists 4 iotypes that let you read the direction and state of digital i/o without changing them:

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

LJ_ioGET_DIGITAL_BIT_DIR
LJ_ioGET_DIGITAL_BIT_STATE
LJ_ioGET_DIGITAL_PORT_DIR	//x1 is number of bits.
LJ_ioGET_DIGITAL_PORT_STATE  //x1 is number of bits.

You use them just like the other iotypes as shown in the pseudocode at the end of Section 4.3.5. So if you do an Add/Go/Get or an eGet with LJ_ioGET_DIGITAL_BIT_DIR, you will get back a value of 0 for input and 1 for output. With LJ_ioGET_DIGITAL_BIT_STATE you will get back a 0 for low and 1 for high.

Note that when you use LJ_ioGET_DIGITAL_BIT_STATE or LJ_ioGET_DIGITAL_PORT_STATE on a line set to output, it leaves it set as output, but it is doing an actual state read based on the voltage(s) on the pin(s). So if you set a line to output-high, but then something external is driving it low, it might read low.

#3 Paul Oberlin

Paul Oberlin
  • Members
  • 6 posts

Posted 09 July 2012 - 03:22 PM

I am trying to determine what the states of the lab jack pins are (input, output-high, output-low) when my application starts. This is important because those states will persist if my program is killed and restarted. I couldn't find this explained in the labjack192.pdf file. In section 4.3.5, there is a LJ_ioGET_DIGITAL_BIT_STATE that can be used as a parameter to AddRequest, but I don't find any documentation on what this means, nor on how to interpret the returned values from GetResult from this request.

Any help would be appreciated, thanks.



Thanks, that worked perfectly.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users