Jump to content

Question

Posted

Hello, I'm just getting started with using the mcculw Python library to interact with a USB-1408FS DAQ - my apologies if this is a naive question.

I'm working through the examples, but I don't understand how to write to multiple digital output channels, for example: setting Port A Channel 0 and Port A Channel 1 to both be 0xFF. 

Using the digital_out.py as an example, `dio.port_info` contains two ports.

  • If I execute `ul.d_out(board_num, dio.port_info[0].type, 0xFF)`, then Port A Channel 0 is set to +5V. 
  • `ul.d_out(board_num, dio.port_info[1].type, 0xFF)`, then Port B Channel 0 is set to +5V.

Fundamentally, my question is - how do I set Port A Channel 1 to +5V?

2 answers to this question

Recommended Posts

  • 0
Posted

It is easier to use d_bit_out instead. When using d_bit_out or d_bit_in, use FirstPortA exclusively. These functions write or read individual channels. I modified digital_out.py to use d_bit_out and attached it below. It configures both ports as output and sets each bit individually. Notice the bit numbers are 0 - 15. PortB are bits 8-15. Configuring the ports resets their state, so configure them early in your program before you read or write them. 

digital_out.py

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