
Bar (Customer) asked a question.
How to reset a high speed counter using ladder logic and a software reset and not a discrete input reset. (Change $HsCtrTmr1.EdgeReset with a C0 or timer output for example)?
I would like to change the accumulator value back to 0 for a high speed counter using a software input in the ladder diagram and not a discrete input using hardware. For example an output from a timer.
From Chapter 3a Counters, Reset Input it states that this can be done using the "structure fields". Can the structure fields be changed using some instruction in Ladder?
"In addition to this hardware reset input, there is a software reset available that is performed through the structure fields named $HsCtrTmr1.EdgeReset or the $HsCtrTmr1.LevelReset."
Thanks for any help!
Just use a the Timer .Done bit contact driving an OUT coil to either the .EdgeReset or the .LevelReset member of the HS Counter instance structure member.
The difference between the two behaviors is the Edge version will reset the counter when T0.Done bit goes from OFF to ON. If it stays on for a long time, the counter will still count up from 0.
The Level version will keep the counter at 0 as long as that .LevelReset member is ON.
Use either/or.
You might play with it in a Data View before writing any logic. Write a 1 to HSCntr .EdgeReset, then a 0. Write a 1 to .LevelReset, then a 0. See how the accumulator behaves before deciding on the logic.
I actually need help with the specifics of that:
"driving an OUT coil to either the .EdgeReset or the .LevelReset member of the HS Counter instance structure member."
How is a High Speed Structure member controlled in Ladder. What is the ladder instruction to do so? HSCNT does not have any inputs and I can't seem to find another instruction in the "High Speed/Axis" instruction toolbox . I looked in the help under "structure members" which lists all of them, but does not say how to work with them in ladder. Thanks for you help with this!
It's a basic ladder rung.
First understand which behavior you want. Level or Edge "reset"?
That will help. Like Imentioned, play around with it in Data View before writing any code. Put the Data View in Edit mode and then turn the
$HsCtrTmr1.ResetEdge on and off and on and off
and also
$HsCtrTmr1.LevelEdge on and off and on and off
Then describe in words how/when you want it to reset (stay reset?). No logic. Just words.
I would like to use the .EdgeReset option. I would like to adjust a proportional control valve in steps, record the accumulating value from a flow meter for that step (This is connected to the high speed input), reset the accumulator to 0 in the counter, open the valve some more, record etc. View in trend view. I will probably just use 3 timer outputs (10s, 20s, 30s) and reset it at those time points.
I cannot write any code because I do not know the instruction to modify a structure member, specifically $HsCtrTmr1.ResetEdge with a basic ladder rung.
Thanks
It looks like I am looking for the "SET" instruction and the bit is located under "Memory-> Specialty-> $HsCtrTmr1"
If you use SET, then you also have to have logic to drive a RST instruction. It needs to be ON for AT LEAST 1 PLC SCAN (the bottom of I/O scan logic needs to see it ON - it's NOT an interrupt - that's what the X's are for - this is a SOFTWARE reset), so I would put the RST rung ABOVE the SET rung.I got that wrong. You are CORRECT in that you should SET the .EdgeReset bit. You do NOT need to RST it. The PLC firmware RSTs the .EdgeReset bit when it actually resets the accumulator.