I have encountered an issue with a script I created for a button to reset an alarm. Initially, I wrote the following script:
import time
system.tag.write("[default]IS15_Overheight_Rst_PB", 1)
time.sleep(1)
system.tag.write("[default]IS15_Overheight_Rst_PB", 0)
After running this script, the normally open contact remained pressed, and the tag continued to force a value of "1", despite the script having completed. I attempted to resolve the issue by deleting the script and the tag, but the problem persisted.
In an attempt to fix this, I recreated the tag under a different path and adjusted the script as follows:
Now, the new tag appears locked and continues to force the "1" on my PLC. Could you provide guidance on how to resolve this issue and ensure that tags do not continue to enforce unwanted values after script execution?
This has been discussed many times on the forum. You can't rely on web-based HMI to turn off the tag and the use of sleep() is an indication that your logic is bad. You shouldn't use it.
Instead,
Have the button set a bit in the PLC.
Have the PLC reset the bit when the task is done.
Have the Perspective indication tied to the PLC bit.
import time
system.tag.write("[default]IS15_Overheight_Rst_PB", 1)
time.sleep(1)
system.tag.write("[default]IS15_Overheight_Rst_PB", 0)
i deleted and but still having the same issue it keep, then i added the tag again and still showing 1 when is suppose to be "zero" i want to put everything back the way it was can you please help me with this?
sorry for the misunderstanding. but, after i did the script and deleted everything i try to bring back the same tag. the value is set two 1 when is supposed to be zero. i enable read-write and still have the same issue. who do i disable the script?
Disable or delete the script wherever you created it. You said it was on a button so that would be in the button's Configure Events. (Right-click on the button → Configure Events.)
I did it and I delete the script and then delete the tag and save the changes and still is showing 1. I brought back the tag again and it goes automatically to 1. the value is stuck in 1.
that happend exactly after i did the script. so can i just download the most recent backup on my plc and that might fix this issue. I heard from a coworker that doing the momentary button might latch the plc. he told me he saw it in the post office with panelview. please advice?