StartMain Statement

Executes the main function from a background task.

This command is for the experienced user and you need to understand the command specification before use.

Syntax
StartMain mainFuncname

Parameters

mainFuncname
Specifies the name of the main function to be executed (main to main63).

Description
To execute StartMain, you need to set the [Enable advanced task commands] preference in the [Setup]-[System Configuration]-[Controller]-[Preferences] page.

If a task is executed using the Xqt statement from a background task, the executed task becomes a background task. With StartMain, you can execute the main function as a non-background task from a background task.

If you have already executed the main function or execute StartMain from a non-background task, an error occurs.

CAUTION

When executing StartMain command from a program, you must understand the command specification and confirm that the system has the proper conditions for this command. Improper use such as continuous execution of a command within a loop may deteriorate the system safety.

See Also
Xqt

StartMain Statement Example

Function bgmain

    :
  If Sw(StartMainSwitch) = On And Sw(ErrSwitch) = Off Then
    StartMain main
  EndIf
    :

Fend