DioWriteCtrlCommand

Applies To

GX5280, GX5290, GX5290e, GX5295, File

Purpose

Write the control command parameters from to the specified step.

Syntax

DioWriteCtrlMemory (nHandle, dwStep, nOpCode, dwParam1, dwParam2, dwParam3, dwParam4, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
DIO or File board handle.
dwStep
DWORD
Vector Step number
nOpCode
SHORT
Operation code
dwParam1
DWORD
Parameter 1 (see comments for details)
dwParam2
DWORD
Parameter 2 (see comments for details)
dwParam3
DWORD
Parameter 3 (see comments for details)
dwParam4
DWORD
Parameter 4 (see comments for details)
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

The board must be in a HALT state before calling this function.

GX5281/GX5282:

The Operation code (nOpCode) can be one of the following:

Op Code #
Op Code constant
Description
0
DIO_COMMAND_NONE
No Operation code
7
DIO_COMMAND_PAUSE
Pause
8
DIO_COMMAND_HALT
Halt
1000
DIO_COMMAND_CLEAR_ALL
Clear all the control commands.

 

GX5283/GX5292/GX5293/GX5292e/GX5293e/GX5295:

The board must be in HALT state if the Op Code constant is either DIO_COMMAND_LOOP or DIO_COMMAND_CONTINUOUS_LOOP and the number of steps is less than 256.

The Operation code (nOpCode) can be one of the following:

Op Code #
Op Code constant
Description
0
DIO_COMMAND_NONE
No Operation code
3
DIO_COMMAND_LOOP
Loop specified number of times between two predefined steps.
dwParam1: Last step
dwParam2: Number of loops, min 2 max 4294967295 )
7
DIO_COMMAND_PAUSE
Pause
8
DIO_COMMAND_HALT
Halt
11
DIO_COMMAND_CONTINUOUS_LOOP
Loops Continuously between two predefined steps.
dwParam1: Last step
1000
DIO_COMMAND_CLEAR_ALL
Clear all the control commands.

 

Note: There must be at least 4 steps between PAUSE/HALT and LOOP/Continuous Loop commands.

E.g. having a loop command between steps 10 and 1024, a Pause/Halt command can only be inserted at steps 1026 and above.

When using DIO_COMMAND_LOOP or DIO_COMMAND_CONTINUOUS_LOOP commands the first and last steps are set on 32-bit boundaries, i.e. channels I/O vector data is always on boundaries of 32 bits. As a result when setting the I/O Channels configuration (width) sing DioSetupIOConfiguration function the loop command start and last steps need to be set according to the following guidelines:

*I/O channels (width)
First Step

Last Step

32
Any Even step number
Any Odd step number higher than First Ste
16
Any step number that when divided by 2 the integer part of the result is an even number. E.g. 5 is a valid first step number since when dividing by 2 the integer part is even number of 2, but 3 is invalid value since when dividing by 2 the integer part is 1 (not an even number).
Any step number that when divided by 2 the integer part of the result is an odd number. E.g. 1022 is a valid last step number since when dividing by 2 the integer part is an even number of 511, however 1024 is invalid value since when dividing by 2 the integer part is 512 (not an odd number).
8
Any step number that when divided by 4 the integer part of the result is an even number. E.g. 10 is a valid first step number since when dividing by 4 the integer part is even number of 2, but 6 is invalid value since when dividing by 4 the integer part is 1 (not an even number).
Any step number that when divided by 4 the integer part of the result is an odd number. E.g. 2044 is a valid last step number since when dividing by 4 the integer part is an even number of 511, however 2048 is invalid value since when dividing by 4 the integer part is 512 (not an odd number).
4
Any step number that when divided by 8 the integer part of the result is an even number.
Any step number that when divided by 8 the integer part of the result is an odd number.
2
Any step number that when divided by 16 the integer part of the result is an even number.
Any step number that when divided by 16 the integer part of the result is an odd number.
1
Any step number that when divided by 32 the integer part of the result is an even number.
Clear all the control commands.

 

Example

The following example inserts PAUSE command to step 100:

 

DioWriteCtrlCommand (nHandle, 100, DIO_COMMAND_PAUSE, NULL, NULL, NULL, NULL, &nStatus);

 

See Also

DioReadCtrlCommand, DioGetNextCtrlCommandStep, DioGetErrorString