Jump to content
  • 0

Help with Digital Pins?



I've got a couple of DAQ's in our lab that I'm trying to read and write to using Python. I'm working on the Omega OM-USB-1608G.

What I would like to do is set DIO0, DIO1, DIO2 and DIO3 to be input pins to read digital signals (just high/low) and then set DIO4, DIO5, DIO6 and DIO7 to be output signals high or low (I'm driving a couple of motors and those need to set motor direction). All on a 0 to 5V range.


My understanding from the documentation is that I need to set the configuration state of the pins for input/output using something like this:

ul.d_config_port(board_num ,  DigitalPortType.FIRSTPORTA, DigitalIODirection.IN)

ul.d_config_port(board_num ,  DigitalPortType.FIRSTPORTC, DigitalIODirection.OUT)


and then read/write to the pins using something like:

VariableValue = ul.d_in(board_num, DigitalPortType.FIRSTPORTA)

ul.d_out(board_num, DigitalPortType.FIRSTPORTC, data_value)


Unfortunately, this isn't working (probably something massively obviously). I've been bashing my head against the wall, and I'm SURE I've got something basic wrong. The error that i'm currently getting is from the first two lines, "DigitalPortType.FIRSTPORTA" part of the commands, isn't accepted. I've gone through "class DigitalPortType(IntEnum)" and tried everything there, but none of the values seem to be acceptable for my board except for AUXPORT.

Also, I have gone through the calibration steps in InstaCal and all the pins on my board are all working. I can use AUXPORT (the DIO0 pin) but it's the only one I can seem to do anything with. 

Any help here would be greatly appreciated. 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...