Gx5731GetPortBit

Purpose

Reads a port bit value.

Syntax

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

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX5731 board.
nPort
SHORT
Digital I/O port numbers are as follow:
  • Digital I/O port numbers 3-6.
  • Any port number 0 to 2 that has no I/O module installed.
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 Gx5731SetPortBit 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;

 

Gx5731GetPort (nHandle, 1, 30, &ucValue, &nStatus);

 

See Also

Gx5731SetPortBit, Gx5731GetPortByte, Gx5731GetPortWord, Gx5731GetPort