# cbDIn()

Reads a digital input port.

Note that for some port types, such as 8255 ports, if the port is configured for DIGITALOUT, this function will provide readback of the last output value.

Refer to the "Digital Input/Output Hardware" topic for additional details on using the UL digital I/O functions.

## Function Prototype

C/C++

int cbDIn(int BoardNum, int PortType, unsigned short *DataValue)

Visual Basic

Function cbDIn(ByVal BoardNum&, ByVal PortType&, DataValue%) 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

The digital port to read. Some hardware allows readback of the state of the output using this function; refer to the board-specific information in the Universal Library User's Guide.

DataValue

The digital input value.

## Returns

- Error code or 0 if no errors
- DataValue – the digital input value.

## Notes

- Port size can vary. The return value is 0 to 232 –1 for a 32-bit port, 0 to 224 –1 for a 24-bit port, 0 to 65,535 for a 16-bit port, 0 to 255 for an 8-bit port, and 0 to 15 for a 4-bit port. To read a 32-bit port, use cbDIn32().
- Refer to the board-specific information for valid PortType values.