Redzed Posted October 11, 2023 Share Posted October 11, 2023 Has anyone gone beyond the first 8 bits for digital outputs in Python? I currently can only get the first port to operate without generating an exception. I am using a USB-DIO96H. Thanks. Link to comment Share on other sites More sharing options...
0 DAQman Posted October 11, 2023 Share Posted October 11, 2023 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. Link to comment Share on other sites More sharing options...
0 Redzed Posted October 12, 2023 Author Share Posted October 12, 2023 (edited) 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. 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. Edited October 12, 2023 by Redzed Link to comment Share on other sites More sharing options...
0 DAQman Posted October 12, 2023 Share Posted October 12, 2023 Please look at the attached script for an example of using ul.d_config_port and ul.d_bit_out to configure the port direction and update individual IO lines. digital_out.py Link to comment Share on other sites More sharing options...
0 Redzed Posted October 12, 2023 Author Share Posted October 12, 2023 Can the same thing be accomplished using the example ULDO02.py? The UI app? That is the question. Thank you. Link to comment Share on other sites More sharing options...
0 DAQman Posted October 12, 2023 Share Posted October 12, 2023 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 More sharing options...
0 Redzed Posted October 13, 2023 Author Share Posted October 13, 2023 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 More sharing options...
0 Redzed Posted October 14, 2023 Author Share Posted October 14, 2023 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: 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 More sharing options...
Question
Redzed
Has anyone gone beyond the first 8 bits for digital outputs in Python? I currently can only get the first port to operate without generating an exception. I am using a USB-DIO96H.
Thanks.
Link to comment
Share on other sites
7 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 accountSign in
Already have an account? Sign in here.
Sign In Now