Gx5641SetChannelTTLPortDirection

Purpose

Sets the specified channel TTL Port Direction.

Syntax

Gx5641SetChannelTTLPortDirection (nHandle, nChannel, nDirection, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX5641 board.
nChannel
SHORT
Channel range is: GX5641_FIRST_CHANNEL (0) to GX5641_LAST_CHANNEL (63).
nDirection
SHORT
The channel TTL Port Direction can be as follows:
0. GX5641_CHANNEL_PORT_INPUT – channel port is set as input.
1. GX5641_CHANNEL_PORT_OUTPUT – channel port is set as output.
pnStatus

 

PSHORT
Returned status: 0 on success, negative number on failure.

Comments

For protection, by default all channels are disabled after power-up and reset. The channels can be enabled and or disabled by calling Gx5641SetChannelOutputState.

Note: The channel should be set to Static I/O mode prior calling this function by calling Gx5641SetChannelMode otherwise the function returns an error.

Example

The following example sets channel 0 TTL Port Direction to output:

 

Gx5641SetChannelTTLPortDirection (nHandle, 0, GX5641_CHANNEL_PORT_OUTPUT, &nStatus);

 

See Also

Gx5641GetChannelTTLPortDirection, Gx5641SetChannelTTLPort, Gx5641SetChannelMode, GxPioGetErrorString