Why does onchange in init section doesn't work?
I've a simply basic script. The script has an init function where there is an onchange event, if a tag changes value, program jumps to a label. But when the tag changes its value, the code in the label is not executed (the code in the label works good with the ontimer function).
ONCHANGE Tag0@,"goto MyLabel"
Why the code doesn't work? where I 'm wrong?
-
@Massimo_Borroni
You simply have a syntax error in your onchange. Inside of the onchange you are passing a reference to the tag value (specified by the @ symbol) but not the actual tag address. When using an onchange you would format it as:
ONCHANGE "Tag0", "GOTO MyLabel"
Note, the only difference is I dropped the @ in the tag name and wrapped it in " marks.
0 -
We have a similar simple script but for ONTIMER which update tag values to a remote ewon. Under the init section it is
TSET 1, 10
ONTIMER 1, "GOTO UpdateRemote"it has worked before but now we keep getting the error:
label/function not found(27): Goto ewon init_section.
0 -
Can you send me a backup.tar file of this device with the support files checkbox enabled in eBuddy?
0 -
The problem has been solved. We deleted the whole program and imported the previous one. The error has since disappeared.
Thank you
0 -
Ok thanks for the update
0 -
I'm having an issue where the ONCHANGE does not work for some reason when changing the tag value. Any ideas for what I'm doing wrong?
Thank you!
This code is in a separate section.
0 -
Can you remove the CLS from the from the command. It could be that the CLS is clearing the screen before the print command is shown.
Is the Tag a boolean value?
0 -
@Kevin_hms,
Found my issue: I was forcing the tag value to change in the command screen, but was using "TPLC_testDataLoggTriggerIN" instead of "TPLC_testDataLoggTriggerIN@"
0 -
Hello Nick,
Excellent! I am glad it was a simple resolution.
0
Please sign in to leave a comment.
Comments
9 comments