pyAPIUSBP

Previous topic

pyAPIUSBP.DIO - Digital Input/Output Units

This Page

Quick Link

Download

pyAPIUSBP

pyAPIUSBP.bitlist2dec(bitlist)[source]

Convert list of I/O status to decimal value. See also dec2bitlist().

Example: pyAPIUSBP.bitlist2dec([1,0,0,0,0,0,0,0]) -> 1 pyAPIUSBP.bitlist2dec([1,0,1,0,1,0,0,0]) -> 21

Parameters:val (int) – A list of I/O status.
Returns:Integer
pyAPIUSBP.dec2bitlist(val, fill=8)[source]

Convert decimal value to a list of I/O status. See also bitlist2dec().

Example: dec2bitlist(1,8) -> [1, 0, 0, 0, 0, 0, 0, 0] dec2bitlist(21,8) -> [1, 0, 1, 0, 1, 0, 0, 0]

Parameters:
  • val (int) – Logical output bit number.
  • fill (int) – Length of the returned list. Default value is 8.
Returns:

List of I/O status.