## Digital Input/Output Hardware

### Basic signed integers

When reading or writing ports that are 16-bits wide, be aware of the following issue using signed integers, as you are forced to do when using Basic:

- With some devices, the AUXPORT digital ports are set up as one 16-bit port. When using cbDOut() or DOut(), the digital values are written as a single 16-bit word. Using signed integers, writing values above 0111 1111 1111 1111 (32,767 decimal) can be confusing. The next increment, 1000 0000 0000 0000 has a decimal value of –32,768. Using signed integers, this is the value that you would use for turning on the MSB only. The value for all bits on is –1. Keep this in mind if you are using Basic, since Basic does not supply unsigned integers (values from 0 to 65,536).

To maximize the performance of the digital I/O function calls, refer to the 82C55 data sheet (82C55A.pdf) in the Documents subdirectory where the UL is installed (C:\Program files\Measurement Computing\DAQ by default). You can also refer to the 8536 data sheet, although this document is not installed with the Universal Library.

### Digital ports and corresponding bit numbers (82C55-based hardware and emulations)

The following table lists the port numbers and corresponding bit numbers that are set by the digital I/O functions for hardware designed with the 82C55 chip or 82C55 emulation.

cbDConfigPort() port reference | cbDIn(), cbDOut() port reference | Values | cbDBitIn(), cbDBitOut() port reference | Bit Number
FIRSTPORTA | FIRSTPORTA | 0-255 | FIRSTPORTA | 0 to 7
FIRSTPORTB | FIRSTPORTB | 0-255 | FIRSTPORTA | 8 to 15
FIRSTPORTCL | FIRSTPORTCL | 0-15 | FIRSTPORTA | 16 to 19
FIRSTPORTCH | FIRSTPORTCH | 0-15 | FIRSTPORTA | 20 to 23
SECONDPORTA | SECONDPORTA | 0-255 | FIRSTPORTA | 24 to 31
SECONDPORTB | SECONDPORTB | 0-255 | FIRSTPORTA | 32 to 39
SECONDPORTCL | SECONDPORTCL | 0-15 | FIRSTPORTA | 40 to 43
SECONDPORTCH | SECONDPORTCH | 0-15 | FIRSTPORTA | 44 to 47
THIRDPORTA | THIRDPORTA | 0-255 | FIRSTPORTA | 48 to 55
THIRDPORTB | THIRDPORTB | 0-255 | FIRSTPORTA | 56 to 63
THIRDPORTCL | THIRDPORTCL | 0-15 | FIRSTPORTA | 64 to 67
THIRDPORTCH | THIRDPORTCH | 0-15 | FIRSTPORTA | 68 to 71
FOURTHPORTA | FOURTHPORTA | 0-255 | FIRSTPORTA | 72 to 79
FOURTHPORTB | FOURTHPORTB | 0-255 | FIRSTPORTA | 80 to 87
FOURTHPORTCL | FOURTHPORTCL | 0-15 | FIRSTPORTA | 88 to 91
FOURTHPORTCH | FOURTHPORTCH | 0-15 | FIRSTPORTA | 92 to 95
FIFTHPORTA | FIFTHPORTA | 0-255 | FIRSTPORTA | 96 to 103
FIFTHPORTB | FIFTHPORTB | 0-255 | FIRSTPORTA | 104 to 111
FIFTHPORTCL | FIFTHPORTCL | 0-15 | FIRSTPORTA | 112 to 115
FIFTHPORTCH | FIFTHPORTCH | 0-15 | FIRSTPORTA | 116 to 119
SIXTHPORTA | SIXTHPORTA | 0-255 | FIRSTPORTA | 120 to 127
SIXTHPORTB | SIXTHPORTB | 0-255 | FIRSTPORTA | 128 to 135
SIXTHPORTCL | SIXTHPORTCL | 0-15 | FIRSTPORTA | 136 to 139
SIXTHPORTCH | SIXTHPORTCH | 0-15 | FIRSTPORTA | 140 to 143
SEVENTHPORTA | SEVENTHPORTA | 0-255 | FIRSTPORTA | 144 to 151
SEVENTHPORTB | SEVENTHPORTB | 0-255 | FIRSTPORTA | 152 to 159
SEVENTHPORTCL | SEVENTHPORTCL | 0-15 | FIRSTPORTA | 160 to 163
SEVENTHPORTCH | SEVENTHPORTCH | 0-15 | FIRSTPORTA | 164 to 167
EIGHTHPORTA | EIGHTHPORTA | 0-255 | FIRSTPORTA | 168 to 175
EIGHTHPORTB | EIGHTHPORTB | 0-255 | FIRSTPORTA | 176 to 183
EIGHTHPORTCL | EIGHTHPORTCL | 0-15 | FIRSTPORTA | 184 to 187
EIGHTHPORTCH | EIGHTHPORTCH | 0-15 | FIRSTPORTA | 188 to 191

### Notes

- For devices that support AUXPORT, in general only bit numbers 0 to 7 apply. Refer to board-specific information for details on the number of bits your hardware supports.
- For devices that support synchronous I/O scanning, such as the USB-2500 Series, PORTC is configured as one 8-bit port (PORTCH and PORTCL are not supported). Refer to board-specific information for details on which ports are supported by your hardware.