CYCLIC
Cyclic execution of a function.
WebVue support - Yes.
Mode |
Mnemonic |
Syntax |
0 | ADD | 3 |
1 | ADDPROG | 1 |
2 | ADDPROG_EX | 1 |
5 | DEL | 1, 3 |
6 | DELALL | 2 |
7 | DEL_EX | 1 |
8 | ADDPROGBYID | 4 |
9 | DELBYID | 5 |
10 | TRACE | 6 |
From version 8.2 of the software, the instruction ADDPROG is identical to ADD.
Syntax 1
IntVal = CYCLIC(Mode, Delay, ProgName, Branch, Function [, Farg [, ActivBit]]) ;
Return type: INTEGER.
Argument |
Meaning |
Delay |
The delay in seconds between each activation of the program. Type INTEGER. The maximum delay is 2 x 106 or about 20 days. |
ProgName |
The name of the program that contains the function. Type STR. |
Branch |
The branch to pass to the called function. Type STR. A null string may be used to indicate no branch. |
Function |
The function that is to be run from the specified program. Type STR. A null string may be used to indicate no function (i.e. just to run the program). |
Farg |
Optional. A string of 2,047 characters maximum used to pass The arguments can be retrieved from the function using the verb GETARG. |
Activbit |
Optional. The name of the bit or alarm variable, if there is one, that enables the event. Type STR. |
Execution
Mode |
Mnemonic |
Action |
1 |
ADDPROG |
Add a cyclic action for a function. You can create several cyclic action for the same function with different values for delay. If an existing cyclic action has the same values for Delay, ProgName, Branch andFunction, it is overwritten. If the name of a function is not specified then the MAIN function is executed. |
2 |
ADDPROG_EX |
Add a cyclic action for a function. |
|
|
Like mode 1, except that the fields Farg and ActivBit can be used to distinguish between cyclic actions that are otherwise identical. It is possible to create more than one cyclic action for the same function as long as one of the properties Delay, Branch, Farg or ActivBit are different. |
5 |
DEL |
Delete an existing cyclic action for a function. The value of the fields Delay, ProgName, Branch and Function must match the original values. If Delay is 0 then all existing cyclics calling Function are deleted. If Farg and ActivBit are not specified then all cyclics calling Function are deleted. |
7 |
DEL_EX |
Delete an existing cyclic action for a function. If called with Delay = 0, then deletes all cyclic functions calling the function Function in program ProgName with branch Branch (behaves the same as the DEL mode by ignoring the Farg and ActivBit passed as parameters at the time of creation of the cyclic). If called with a Delay different from 0 then it only deletes the cyclic function calling the function Function in program ProgName with branch Branch with the Delay, Farg and ActivBit passed as arguments. If no such cyclic function exists, an error is returned. |
|
|
Return: 1 if successful, else 0. |
The program must be pre-loaded (PRELOAD) to be run. It must not contain a SUB MAIN.
The use of DELAY within a function called cyclically may produce unpredictable results and should be avoided.
Syntax 2
IntVal = CYCLIC(Mode[,DellAllMode]);
Return type: INTEGER.
Argument |
Meaning |
DellAllMode |
Optional argument to indicate which cyclics should be deleted, temporary created by program and/or permanent cyclics created by configuration. Type: INTEGER. 1 = Delete temporary cyclics only (default value), |
Execution
Mode |
Mnemonic |
Action |
6 |
DELALL |
Delete all cyclic functions. |
|
|
Return: Always 1. |
The program must be pre-loaded.
A cyclic action cannot be changed once it is running. It must be stopped and re-programmed.
The use of DELAY within a function called cyclically may produce unpredictable results and should be avoided.
Syntax 3
IntVal = CYCLIC(Mode, Delay, ProgName, Branch, Function, Farg, ActivBit);
Return type: INTEGER.
Argument |
Meaning |
Delay |
The delay in seconds between each activation of the program. Type INTEGER. The maximum delay is 2 x 106 or about 20 days. |
ProgName |
The name of the program that contains the function. Type STR. |
Branch |
The database branch to pass to the called function. Type STR. A null string may be used to indicate no branch. |
Function |
The function that is to be run from the specified program. Type STR. A null string may be used to indicate no function (i.e. just to run the program). |
Farg |
A string of 2,047 characters maximum used to pass from 1 to 8 arguments (separated by a comma ",") to the function. The arguments can be retrieved from the function using the verb GETARG. |
Activbit |
The name of the bit or alarm variable, if there is one, that enables the event. Type STR. |
Execution
Mode |
Mnemonic |
Action |
0 |
ADD |
Add a cyclic action for a function. |
5 |
DEL |
Delete an existing cyclic action for a function. The values of the fields must match the original values, as in Syntax 1 above. |
|
|
Return: 1 if successful, else 0. |
From version 8.2 onwards, modes ADD and ADDPROG behave the same.
Syntax 4
IntVal = CYCLIC(Mode, Name, Description, ServerListName, Delay, ProgName, Branch, Function, [Farg[, FactiveBit]]);
Return type: INTEGER.
Argument |
Meaning |
Name | The ID of the cyclic action that will appear in the Name field in the Application Explorer. Type STR. |
Description | A description of the cyclic action that will appear in the Description field in the Application Explorer. Type STR. |
ServerListName | The name of a Server List from the network configuration. The cyclic will only be active if the station appears in the list. Can be a null string in which case the cyclic will be active on all stations. Type STR. |
Delay |
The delay in seconds between each activation of the program. Type INTEGER. The maximum delay is 2 x 106 or about 20 days. |
ProgName |
The name of the program that contains the function. Type STR. |
Branch |
The database branch to pass to the called function. Type STR. A null string may be used to indicate no branch. |
Function |
The function that is to be run from the specified program. Type STR. A null string may be used to indicate no function (i.e. just to run the program). |
Farg |
A string of 2,047 characters maximum used to pass from 1 to 8 arguments (separated by a comma ",") to the function The arguments can be retrieved from the function using the verb GETARG. |
Activbit |
The name of the bit or alarm variable, if there is one, that enables the event. Type STR. |
Execution
Mode |
Mnemonic |
Action |
8 |
ADDPROGBYID |
Add a cyclic action for a function using the supplied name, description and server list. |
|
|
Return: 1 if successful, else 0. |
Syntax 5
IntVal = CYCLIC(Mode, Name);
Return type: INTEGER.
Argument |
Meaning |
Name | The name of a cyclic action as seen in configuration. |
Execution
Mode |
Mnemonic |
Action |
9 |
DELBYID |
Delete the named cyclic action. |
|
|
Return: 1 if successful, else 0. |
Syntax 6
IntVal = CYCLIC(Mode, SubMode);
Return type: INTEGER.
Argument |
Meaning |
SubMode |
Either "ON" or "OFF". Type STR. |
Execution
Mode |
Mnemonic |
Action |
10 | TRACE |
Activate ("ON") or deactivate ("OFF") diagnostic messages. Trace message appear in the Event Window (F7) and are generated each time a CYCLIC is added or deleted. Return: always 1 if successful, else 0. |
Trace message example
[SV.Cyclics] The traces are activated
[SV.Cyclics] AddCyclicAction name=CyclicAction2713 program=TryCyclic.svb function=Func1 branch= arg= period=60000ms
[SV.Cyclics] DeleteCyclicAction name=CyclicAction2713 program=TryCyclic.svb function=Func1 branch= arg= period=60000ms
Example
For an example, select the Example link above.