DioReadCtrlCommand

Applies To

GX5280, GX5290, GX5290e, GX5295, File

Purpose

Read the control command parameters from the specified step.

Syntax

DioReadCtrlCommand (nHandle, dwStep, pnOpCode, pdwParam1, pdwParam2, pdwParam3, pdwParam4, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
DIO or File board handle.
dwStep
DWORD
Vector Step number
pnOpCode
PSHORT
Operation code
pdwParam1
PDWORD
Parameter 1 (see comments for details)
pwParam2
PDWORD
Parameter 2 (see comments for details)
pdwParam3
PDWORD
Parameter 3 (see comments for details)
pwParam4
PDWORD
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 (pnOpCode) 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/GX5291/GX5292/GX5293/GX5291e/GX5292e/GX5293e/GX5295:

The Operation code (pnOpCode) 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.
pdwParam1: Last step
pdwParam2: Number of loops
7
DIO_COMMAND_PAUSE
Pause
8
DIO_COMMAND_HALT
Halt
11
DIO_COMMAND_CONTINUOUS_LOOP
Loops Continuously between two predefined steps.
pdwParam1: Last step
1000
DIO_COMMAND_CLEAR_ALL
Clear all the control commands.

 

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.
Any step number that when divided by 32 the integer part of the result is an odd number.

Example

The following example reads the control command parameters from step number 100:

 

SHORT nOpCode;

DWORD dwParam1, dwParam2, dwParam3, dwParam4;

DioReadCtrlCommand (nHandle, 100, &nOpCode, &dwParam1, &dwParam2, &dwParam3, &dwParam4, &nStatus);

 

See Also

DioWriteCtrlCommand , DioGetNextCtrlCommandStep, DioGetErrorString