Hello, I have been trying to get the value of a Boolean Tag to turn on momentarily when String changes in the text field. I have tried out couple scripts on property change handler of the Text Field but none seem to work. Any help is appreciated.
What is the real problem you are trying to solve? There may be a much better way to achieve your goal.
What action is the boolean tag going to trigger?
What I'm trying to achieve is, everytime the string in Partname updates, I want to energize a reset tag on the PLC.
Why not do that in the PLC? It would be much more reliable.
It would be more reliable to get it done in PLC but I don't have much PLC experience. How would I look for changes in the String's tag through PLC.
That depends on where the string is coming from. Does the PLC have the string value in memory?
If it does then,
- If changed then turn on
Reset OneShotin the PLC. Use that to reset whatever has to be reset.
prevPartName = PartName.
What type of PLC?
Its an AB compactLogix 1769.
Assuming that you have a String type tag that is storing this information then you would just compare for a change in the value using a NEQ and then MOV the current value into a LastValue Tag.
Copy and paste this into a rung, and replace the tag names with the relevant references.
NEQ LastPartName PartName BST OTE PartNameChange NXB MOV PartName LastPartName BND
This will turn on the PartNameChange Bit for 1 scan, if you need it on longer than that you can utilize an OTL, OTU, and TON to reset the bit after some delay.
OK, but what are the BST, NXB and BND operations?
Here is an example where the name change will set the bool. You can reset the bool with a button. It just uses a property change script.
If you want the bool to auto reset after a period of time, that is possible, but I didn't show that in the attached example.
To test make sure to put in preview mode.
PartName.zip (2.8 KB)
They're the branch instructions and will be explained in the Logix5000 / Studio5000 help files. When you paste in the code it will be converted to ladder logic and the meaning should be obvious.
As @transistor said, those create a branch on the rung.
BST = Branch Start (instructions following this will be on the top rung)
NXB = Next Branch (Add one at the start of each new branch)
BND = Branch End
It will look basically like this: