As known about the S counters that the max allowed number to count is 999.
Write a PLC program to count more than 999 counts for one counter.
Note: the best practice to learn the PLC programming is to start writing the PLC program, take your time before you review the answer.
Inputs & outputs
I0.0: count up
I0.1: preset value
PLC Count values higher than 999
Network 01
There is a counter C0 and there is a count up contact I0.0, whenever a positive edge detected from the count up bit the counter value MW0 is increased by one.
A preset value is loaded the PV of the counter to ease the simulation process, where when the preset contact I0.1 is pressed for one time the counter value is loaded by 997.
Whenever the counter reaches 999 counts 2 things happen.
The reset memory bit M10.0 is energized and resets the counter to zero.
Then a value of 1 is added to the MW2 so that to count the number of each time the counter reaches the maximum counts 999.
Network 02
Multiply MW2 by 999 so that every time the counter reaches the maximum a 999 counts is added to MW4.
For example if the counter reached the maximum counts twice then the counts value in MW4 is 1998.
Network 03
Add the MW4 to the current counts value of the counter gives the real counter counts calculated so far.
Comments
Post a Comment