Jump to content
  • 0

Beyond the Python Examples for Digital Outputs


Redzed

Question

7 answers to this question

Recommended Posts

  • 0
15 hours ago, JRys said:

What Universal Library function do you use? If it is DBitOut of DBitIn, the port type is always FirstPortA (DigitalPortType.FirstPortA), and the bit numbers are 0 - 95.

image.png

In the example ULDO02.py what would you change if bit 90 was to be an output? If the port to configure is all FIRSTPORTA then the only update would be to change the value of bit_num. When the bit is changed to 90 an exception occurs.

image.png.0f20484768fc8030d4d7ad492b86b823.png

image.png.2f6c48f397e7f61d97f84081bbacb852.png

Edited by Redzed
Link to comment
Share on other sites

  • 0

ULDIO2.py uses tKinter to create the GUI panel and display the status of the bits. If you know how to use tKinter, you could modify the panel to include 96 bits instead of eight. How to use tKinter, however, is outside the scope of this forum.

 

Link to comment
Share on other sites

  • 0
21 hours ago, JRys said:

ULDIO2.py uses tKinter to create the GUI panel and display the status of the bits. If you know how to use tKinter, you could modify the panel to include 96 bits instead of eight. How to use tKinter, however, is outside the scope of this forum.

 

tKinter is not part of my original question. The scope of my question pertains to the Measurement Computing Hardware accessed by a Measurement Computing provided Example ULDO02.py.

The basis of my inquiry is for an example ( a UI example) that accesses a different port other than the first port.

If this is an impossible ask then that needs to be stated. Deflecting the discussion is not desirable.

Link to comment
Share on other sites

  • 0
On 10/12/2023 at 2:57 PM, JRys said:

ULDIO2.py uses tKinter to create the GUI panel and display the status of the bits. If you know how to use tKinter, you could modify the panel to include 96 bits instead of eight. How to use tKinter, however, is outside the scope of this forum.

 

Some testing was performed to demonstrate that either the documentation for d_bit_out is inaccurate or there is information missing to configure the port for digital output.

"For devices with both types of digital ports, set PortType to either DigitalPortType.FIRSTPORTA or DigitalPortType.AUXPORT, depending on which digital inputs you wish to read."

DigitalPortType.FIRSTPORTA was set to configure the port according to the above statement.

ul.d_config_port(self.board_num, self.port.type, DigitalIODirection.OUT)

and Bits 0 to 7 were successfully operated by: 

ul.d_bit_out(self.board_num, self.port.type, bit_num, bit_value)

to change the state of the bit.

Going beyond bit 7 to bit 8 generates an error.  ->The port type was still configured to FIRSTPORTA which should allow bits 0 to 95 to be operated by ul.d_bit_out().

The next step was to attempt to control bit 8 with the port configured for FIRSTPORTB and bit_num was set to 0 and run a second time set to 8.

This also generates errors.

Each bit was tested individually and the port information was also verified by: print(self.port.type.name)

The available ports were also scanned. There is no AUXPORT to validate the DigitalPortType.AUXPORT portion of the statement.

0    FIRSTPORTA

1    FIRSTPORTB

2    FIRSTPORTC

3    FIRSTPORTCH

4    SECONDPORTA

5    SECONDPORTB

6    SECONDPORTCL

7    SECONDPORTCH

8    THIRDPORTA

9    THIRDPORTB

10    THIRDPORTCL

11    THIRDPORTCH

12    FOURTHPORTA

13    FOURTHPORTB

14    FOURTHPORTCL

15    FOURTHPORTCH

Below is the UL Help page:

image.png.a81afdbdff5664cac473cf60635f0d01.png

So without knowing additional information the 96 channel data logger is reduced to 8 channels of output instead of the advertised 96 channels of DIO.

tKinter was not mentioned. This inquiry is in scope.

One additional note: If you refer to the list of ports above FIRSTPORTC should be FIRSTPORTCL.

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