Jump to content
  • 0

MCC USB-1024LS (MCCULW python package) no input support for Ports B and C


Nihaal

Question

Hi I'm trying to write a program in python that takes in the input from the DIO port B0(pin 32), when I do this it gives me an error.

Below is the Pinout for the MC USB-1024LS DAQ device.

DAQPinouts.png.330574747b80dc3d7f5f26bc93c5af8e.png

 I downloaded the MCCULW package(v1.0.0) using pip from the MCCDAQ GitHub.

image.thumb.png.cfde85e7ed1ee5988081be0204d28253.png

These are the packages I imported;

image.png.57b6a58402f0735f4bdd90f628e36116.png

When I configure the port as PORT A with Pin A0 (pin 21), it works alright [port_name = DigitalPortType.FIRSTPORTA], but as soon as I configure the port as PORT B[port_name = DigitalPortType.FIRSTPORTB] with Pin B0 (pin 32), it gives me "Error 11: Invalid digital port number". 

Attaching screenshot of code for DigitalPortType.FIRSTPORTA and DigitalPortType.FIRSTPORTB below.

image.thumb.png.b20e61718bcf17d5fe67858da3a5167e.png

 

image.thumb.png.504557fd36de886c760f318286056d6d.png

My guess is that FIRSTPORTB  is not the correct way to configure Port B on the board.
Also attaching the enum class that I imported to call those functions below;

image.thumb.png.8d9555d42ebba8ab31413c7e6786c641.png

To check if Port B is not supported by the hardware, I tested it with DAQami application by Digilent, and the output is as expected [I used a switch and toggled the input to High and Low]. Below is the screenshot for that as well.
image.thumb.png.6d84e9c41064b82691435219b23cfba1.png

Could someone help me out on this?
 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Your code is failing not because FirstPortB is used with d_config_port to designate the direction but because you then read it with d_bit_in. Both d_bit_in and d_bit_out use FirstPortA exclusively with bit numbers from 0 to 23. On the other hand, d_in and d_out use FirstPortA, B, CL, and CH. 

Link to comment
Share on other sites

  • 0

Hi,
Thank you for your reply.
So would you recommend switching "d_bit_in" with "d_in" and "d_bit_out" with "d_out"?
Where can I find documentation for the MCCULW library?

Best 
Nihaal

Link to comment
Share on other sites

  • 0

d_out and d_in are 8-bit operations whereas d_out_bit and d_in_bit are 1-bit operations. It's up to you to determine which is best based on your software design. If I can make one recommendation, set port directions early in your init function and don't change them later. This is because the configuration will reset the port value. Documentation can be found here. In the help, search on USB-1024LS to get to the device page.

Link to comment
Share on other sites

  • 0

Hi, that makes sense.
For my program, I first take the output (high signal) and then once that's sent out, another device sends a High Signal back to the USB-1024LS device(input).
So I can't really initialize it once as it keeps changing based on the states.
When I do test it, it fails and doesn't give me expected results, also the voltage increases to 3.3V instead of going down to 0V
What would a good way to fix/initialize this be?
image.png.d367944f82afd98fa0ad4bba62bd8c88.png

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