cbDBitIn()

Reads the state of a single digital input bit.

This function treats all of the DIO ports of a particular type on a board as a single port. It lets you read the state of any individual bit within this port. Note that with some port types, such as 8255 ports, if the port is configured for DIGITALOUT, cbDBitIn provides readback of the last output value.

Refer to the "Digital Input/Output Hardware" topic for additional information about the UL digital I/O functions.

Function Prototype

C/C++

int cbDBitIn(int BoardNum, int PortType, int BitNum, unsigned short *BitValue)

Visual Basic

Function cbDBitIn Lib(ByVal BoardNum&, ByVal PortType&, ByVal BitNum&, BitValue%) As Long

Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99.

PortType

There are three general types of digital ports — ports that are programmable as input or output, ports that are fixed input or output, and ports for which each bit may be programmed as input or output. For the first of these types, set PortType to FIRSTPORTA. For the latter two types, set PortType to AUXPORT. For devices with both types of digital ports, set PortType to either FIRSTPORTA or AUXPORT, depending on which digital inputs you wish to read.

BitNum

Specifies the bit number within the single large port.

BitValue

Placeholder for the return value of the bit. Value will be 0 (logic low) or 1 (logic high). Logic high does not necessarily mean 5 V – refer to the device hardware user guide for chip input specifications.

Returns