pyAPIUSBP

Previous topic

pyAPIUSBP.AIO - Analog/Digital Input/Output Units

Next topic

pyAPIUSBP

This Page

Quick Link

Download

pyAPIUSBP.DIO - Digital Input/Output Units

class pyAPIUSBP.DIO.DIO(deviceName)[source]
echoBackBit(bitNo)[source]

This method reads status of a logical output bit. If your device has 4 output ports (each port has 8 bit output), logical output bit is 0 to 31.

Parameters:bitNo (int) – Logical output bit number.
Returns:Status of the bit (0 or 1).
echoBackByte(portNo)[source]

This method reads status of a logical output port.

Parameters:portNo (int) – Logical output port number. The first port of the device is 0, and the following ports are 1, 2, 3... Use getMaxPorts() to query how many ports your device has.
Returns:Status of the port (0-255).
echoBackMultiBit(bitList)[source]

This method reads status of multiple logical input bits.

Parameters:bitList (int) – List of logical input bit numbers.
Returns:List of status each logical bit.
echoBackMultiByte(portList)[source]

This method reads status of multiple logical input ports.

Parameters:portList (int) – List of logical input port numbers.
Returns:List of status each logical port.
getErrorString(code)[source]

This method translates error code to error string.

Parameters:code (int) – Error code of Contec API-USBP DIO functions.
getMaxPorts()[source]

This method returns number of available ports.

inputBit(bitNo)[source]

This method reads a logical input bit. If your device has 4 input ports (each port has 8 bit input), logical input bit is 0 to 31.

Parameters:bitNo (int) – Logical input bit number.
Returns:Data (0 or 1).
inputByte(portNo)[source]

This method reads 1 byte data from a logical input port.

Parameters:portNo (int) – Logical input port number. The first port of the device is 0, and the following ports are 1, 2, 3... Use getMaxPorts() to query how many ports your device has.
Returns:Data (0-255).
inputMultiBit(bitList)[source]

This method reads data from multiple logical input bits.

Parameters:bitList (int) – List of logical input bit numbers.
Returns:List of data read from each logical bit.
inputMultiByte(portList)[source]

This method reads data from multiple logical input ports.

Parameters:portList (int) – List of logical input port numbers.
Returns:List of data read from each logical port.
outputBit(bitNo, data)[source]

This method writes 0 or 1 to a logical output bit. If your device has 4 output ports (each port has 8 bit output), logical output bit is 0 to 31.

Parameters:
  • bitNo (int) – Logical output bit number.
  • data (int) – Data to be written. Note that the value must be 0 or 1.
outputByte(portNo, data)[source]

This method writes 1 byte data to a logical output port.

Parameters:
  • portNo (int) – Logical output port number. The first port of the device is 0, and the following ports are 1, 2, 3... Use getMaxPorts() to query how many ports your device has.
  • data (int) – Data to be written. Note that the value must be between 0 to 255 (unsigned byte).
outputMultiBit(bitList, data)[source]

This method writes data to multiple logical output bits.

Parameters:
  • bitList – List of logical output bit numbers.
  • data – List of data to be written to each output bit.
outputMultiByte(portList, data)[source]

This method writes data to multiple logical output ports.

Parameters:
  • portList – List of logical output port numbers.
  • data – List of data to be written to each output port.
reset()[source]

This method resets device.

pyAPIUSBP.DIO.queryDioDeviceName()[source]

Query names of available DIO devices.

Returns:A list of device name and product name. For example, if two DIO-0808TY-USBs are available whose device names are DIO000 and DIO001, following list is returned. [[‘DIO000’, ‘DIO-0808TY-USB’], [‘DIO001’, ‘DIO-0808TY-USB’]]