Jump to content
  • 0

USB-1024LS python programming


Travis Hunter

Question

I am trying to assign half of the DAQ to input and half to output. it seems as though i could choose port A and port CL as input and Port B and port CH as outputs. i saw on another question that all ports are port number 10 yet in the documentation it says they follow the normal 10=A 11=B 12=CL and 13=CH so in python i used these numbers to assign each port but then on use it seems as though i need to use 10 on all pins 0-23. how do i correctly assign different functions to the pins if they use the same port number?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Use the enumerations as follows:

Python for Windows:

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

ul.d_config_port(DigitalPortType.FIRSTPORTB, DigitalIODirection.OUT)

ul.d_config_port(DigitalPortType.FIRSTPORTCL, DigitalIODirection.IN)

ul.d_config_port(DigitalPortType.FIRSTPORTCH, DigitalIODirection.OUT)

Python for Linux

dio_device.d_config_port(DigitalPortType.FIRSTPORTA, DigitalDirection.INPUT)

dio_device.d_config_port(DigitalPortType.FIRSTPORTB, DigitalDirection.OUTPUT)

dio_device.d_config_port(DigitalPortType.FIRSTPORTCL, DigitalDirection.INPUT)

dioi_device.d_config_port(DigitalPortType.FIRSTPORTCH, DigitalDirection.OUTPUT)

 

Link to comment
Share on other sites

  • 0
On 12/22/2022 at 3:21 PM, JRys said:

Use the enumerations as follows:

Python for Windows:

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

ul.d_config_port(DigitalPortType.FIRSTPORTB, DigitalIODirection.OUT)

ul.d_config_port(DigitalPortType.FIRSTPORTCL, DigitalIODirection.IN)

ul.d_config_port(DigitalPortType.FIRSTPORTCH, DigitalIODirection.OUT)

Python for Linux

dio_device.d_config_port(DigitalPortType.FIRSTPORTA, DigitalDirection.INPUT)

dio_device.d_config_port(DigitalPortType.FIRSTPORTB, DigitalDirection.OUTPUT)

dio_device.d_config_port(DigitalPortType.FIRSTPORTCL, DigitalDirection.INPUT)

dioi_device.d_config_port(DigitalPortType.FIRSTPORTCH, DigitalDirection.OUTPUT)

 

i can use this when configuring the ports but that port also needs to be provided in d_bit_in and d_bit_out calls though using DigitalPortType.FIRSTPORTA doesnt give a valid port number.

Link to comment
Share on other sites

  • 0

When using d_bit_in or d_bit_out, use only FIRSTPORTA and bit numbers 0...23. For example, if FIRSTPORTA is input and FIRSTPORTB is output, use d_bit_in with FIRSTPORTA and bit numbers 0..7. For output, use d_bit_out and FIRSTPORTA but use bit numbers 8..15. 

John

Link to comment
Share on other sites

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...