|NI-DAQmx 18.6 Help|
|NI-DAQmx 19.0 Help|
|NI-DAQmx 19.1 Help|
You typically use an integer format to read or write entire ports. In integer format, each digital channel you read or write must fit into one integer. For example, if the largest channel in a task consists of one 8-line port, you can use the 8-bit, 16-bit, or 32-bit format. If you have more than one 8-line port or a port with more than eight lines in any channel within a task, you must use the 32-bit format.
Each byte in the integer maps to a port in the channel, in the order in which you added the ports to the channel. The least significant byte maps to the first port added to the channel, with all unused bytes zeroed out. Therefore, if a channel contains two 8-line ports, port0 and port1, and you added port0 to the channel before port1, the channel uses a 32-bit representation:
Within a particular byte, each bit in the integer maps to a line in the corresponding port. NI-DAQmx orders the bits by line number, with the least significant bit mapping to the lowest line number. Therefore, with these values assigned to the lines in the channel, you might get the following:
The 32-bit binary representation of the channel is the following:
with an integer value of 38836.
If you specify only certain lines in a port to read or write, the full length of the integer is still used, but all unused bits are zeroed out. Therefore, the following lines and values:
yield the following 8-bit representation:
with an integer value of 9.