GtDio6xStepSetSubroutineReturn

Applies To

GX5296, GX5961, GX5964, File

Purpose

Sets the Subroutine Return flag level for the specified Step

Syntax

GtDio6xStepSetSubroutineReturn (nHandle, lStep, bSubroutineReturn, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Session identifier:

     Board handle is used when communicating with the hardware. The Board handle session identifier is returned by calling GtDio6xInitialize or GtDio6xSetupInitialization.

     File handle is used when communicating with a file. The File handle session identifier is  returned by calling GtDio6xFileOpen.

lStep
LONG
Step Number to access 0-4095.
bSubroutineReturn
BOOL
Sets the Return from Subroutine flag:

0.    FALSE: Sequencer will not return from a subroutine after the selected sequence step has run.

1.    TRUE: Sequencer will return from a subroutine after the selected sequence step has run.

pnStatus
PSHORT
Returned status: 0 on success, negative value on failure.

Comments

This control allows the user to specify the Gosub Return flag. The gosub return flag is used to signal the last step of a subroutine, and is used with the GtDio6xStepSetControl API.

Normal sequence step execution proceeds sequentially until the step with the “Last Step” flag set true. Conditional and unconditional jumps and gosubs can be added to allow the user to modify sequence step execution order.

When the jump type is set to Gosub jump, Gosub jump saves the current step number and forces the next sequence step number to be replaced by the specified step number. The Gosub Return flag set true will force the sequence step number to be one more that the saved step number. For example, if step number 5 and 7 had a gosub to step 10 and step 13 has the gosub return flag set, then the step number sequence starting from 1 would be:

1, 2, 3, 4, 5, 10, 11, 12, 13, 6, 7, 10, 11, 12, 13, 8, 9, …

Example

The following example sets the Subroutine Return flag to Enabled for sequence step 5, and return the settings:

 

SHORT nSubroutineReturn;

SHORT nStatus;

 

GtDio6xStepSetSubroutineReturn(nHandle, 5, TRUE, &nStatus);

GtDio6xStepGetSubroutineReturn(nHandle, 5, &nSubroutineReturn, &nStatus);

 

See Also

GtDio6xStepGetSubroutineReturn, GtDio6xStepSetControl, GtDio6xStepGetControl, GtDio6xGetErrorString