Gx5732GetPortBit

Purpose

Reads a port bit value.

Syntax

Gx5732GetPortBit (nHandle, nPort, nBit, pucValue, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX5732 board.
nPort
SHORT
Digital I/O port number:
0. GX5732_PORT0: Port 0.
1. GX5732_PORT1: Port 1.
2. GX5732_PORT2: Port 2.
3. GX5732_PORT3: Port 3.
4. GX5732_PORT4: Port 4.
5. GX5732_PORT5: Port 5.
6. GX5732_PORT6: Port 6.
nBit
SHORT
Port bit number: 0-31. Where 0 is used for low order bit and 31 for the high order bit.
pucValue
PBYTE
Returned channel value: 0 for low state and 1 for hi state.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Use the Gx5732SetPortBit to write data to the port bit when in Output direction.

Example

The following example reads port 1, bit 30 value:

 

SHORT nStatus;

BYTE ucValue;

Gx5732GetPortBit(nHandle, GX5732_PORT1, 30, &ucValue, &nStatus);

 

See Also

Gx5732SetPortBit, Gx5732GetPortByte, Gx5732GetPortWord, Gx5732GetPort