Write data to the PIO output register.
Gx6196WritePio (nHandle, ucData, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6196 board. |
ucData |
BYTE |
8 bits (0-255), each corresponds to a PIO channel. A bit that is set to 1 indicates that the PIO channel is set to output a high level. A bit that is set to 0 indicates that the PIO channel is set to output a low level. Low bit (0x1) indicates that channel 0 is set to output a high level and high bit 0x80 indicates that channel 7 is set to output a high level. |
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.
The following example enables the output on all PIO channels and then set PIO channels 0-2 to high and set channel 3-7 to low:
Gx6196SetPiotOutputEnable(Handle, 0xFF, &nStatus);
Gx6196WritePio(nHandle, 0x7, &nStatus);