flex_set_port_direction

NI-Motion Functions

flex_set_port_direction

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Set I/O Port Direction

Usage

status = flex_set_port_direction(u8 boardID, u8 port, u16 directionMap);

Purpose

Sets the direction of a general-purpose I/O port as input or output.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
port u8 general-purpose I/O port to control
directionMap u16 port direction control

Parameter Discussion

port is the general-purpose I/O port (NIMC_IO_PORT1 through NIMC_IO_PORT8) to control. Refer to 73xx Controller General-Purpose I/O Port IDs for general-purpose I/O port resource IDs.

directionMap is the bitmap of directions for the bits in the I/O port:

D15 ... D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
XXX ... XXX XXX Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0

For D0 through D7:
   1 = Input (default)
   0 = Output

Using This Function

This function configures the bits in a general-purpose I/O port as input or output. After setting the direction, use the Read I/O Port function to read the port, the Set I/O Port MOMO function to write to the port, and the Set I/O Port Polarity function to set the polarity of each bit in the port to active high or active low.

Note  The direction of bits in the RTSI software port (NIMC_RTSI_PORT) is controlled with the Select Signal function.