Read from PIO channels.
Gx6196ReadPio (nHandle, pucData, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6196 board. |
pucData |
PBYTE |
Returned 8 bits (0-255), each corresponds to a PIO channel. If a bit is set to 1, it indicates that the input to the PIO channel is high. If a bit is set to 0, it indicates that the input to the PIO channel is low. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
A channel’s output must be enabled before it can drive a logic level. This function reads back the actual logic levels present on the PIO pins.
The following example reads back the PIO channels input logic levels:
BYTE ucPioReadBack;
Gx6196ReadPio(nHandle, &ucPioReadBack, &nStatus);
if (ucPioReadBack & 0x2)
printf(“Channel 1 output is high”);