DioWriteIOPinsValue

Applies To

GC5050, GX5050, GX5055, GX5150, GX5280, GX5290, GX5290e, GX5295

Purpose

Write new value to output pin values.

Syntax

DioWriteIOPinsValue (nHandle, dwValue, pnStatus)

Parameters

Name

Type

Comments

nHandle

SHORT

DIO board handle.

dwValue

DWORD

Data to write to the outputs.

pnStatus

PSHORT

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

Comments

GC5050, GX5050, GX5150, GX5280:

     This function only sets the outputs lines and does not change the loaded vector. In case the direction was changed from output to input while in HALT or PAUSE, output lines are set to Tri-state and writing is disabled.

     A subsequent RUN state will overwrite the I/O value set by this function.

     Since the output values are written only to the output driver, there is no way to read those values back. Calling DioReadIOPinsValue following this function will return an error since the board needs to be in input mode. However, input mode bypasses the output drivers.

     The board direction must be set to output prior calling this function.

     The board must be in the HALT or PAUSE state for the user to write to the I/O lines.

GX5055:

     This function only sets the outputs lines and does no change the loaded vector. In case the direction was changed from output to input while in HALT or PAUSE, output lines are set to Tri-state and writing is disabled.

     A subsequent RUN state will overwrite the I/O value set by this function.

     Since the output values are written only to the output driver, there is no way to read those values back. Calling DioReadIOPinsValue following this function will return an error since the board needs to be in input mode. However, input mode bypasses the output drivers.

     Each channel’s direction can be set independently by calling DioSetupIOPinsStaticDirection prior calling this function.

     The board must be in the HALT or PAUSE state for the user to write to the I/O lines.

GX5290/GX5290e:

     The board may be in HALT or PAUSE state.

     When in this Static I/O mode of writing to the I/O pins data, the channels direction are set according to the DioSetupChannelsOutputStates, i.e. bit high is direction is output, bit low direction is input.

GX5295:

     The board may be in a HALT state.

     When in this Static I/O mode of writing to the I/O pins data, the channels direction are set according to the direction memory settings for that specified step number. I.e. bit low, direction is output, bit high direction is input. The user can change the each channel direction in static mode by calling DioSetupIOPinsStaticDirection API.

     This function only sets the outputs lines and does not change the loaded vector content. In case the direction was changed from output to input while in HALT or PAUSE, output lines are set to Tri-state and writing is disabled.

     A subsequent ARM command will restore the I/O settings (directions and levels).

     Each channel’s direction can be set independently by calling DioSetupIOPinsStaticDirection prior to calling this function.

Example

The following example writes 0xAA55AA55 to the I/O pins:

 

SHORT nStatus;

DioWriteIOPinsValue (nHandle, 0x55AA, &nStatus);

 

See Also

DioReadIOPinsValue, DioSetupIOPinsStaticDirection, DioReadIoPinsValidity, DioGetErrorString