Gx5731SetPortWord

Purpose

Writes a specific word of data to a port.

Syntax

Gx5731SetPortWord (nHandle, nPort, nWord, wValue, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX5731 board.

nPort

SHORT
Digital I/O port number: 0-6.

nWord

SHORT
Port word number: 0-1. Where 0 is for the port low order word (bytes 0 and 1) and 1 for the high order word (bytes 2 and 3).

wValue

WORD
Port word value: 0 to 65,535 (0-0xFFFF). Where bit 0 corresponds to channel 0 and bit 15 to channel 15.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Each digital I/O port contains two words. Each word contains two bytes or 16 channels. Set the word byte directions to output before using this function.

Example

The following example writes 0x5 (bit 16 and 19 hi and bit 17, 18, 20-23 to low state) to port 1, byte 2 value:

 

Gx5731GetPortWord (nHandle, 1, 2, 0x5, &nStatus);

 

 

See Also

Gx5731GetPortWord, Gx5731SetPortBit, Gx5731SetPortByte, Gx5731SetPort