[Rung 0] Title=Program to count higher than the 32,767 count overflow limit of a Ladder Counter instruction - by P. Ferry, Phonetics, Inc. Comment=One-Shot increment Counter N,0 when Input 0 closes 0=3|0|RungNode 1=6|0|XIC|I,0,0||Pulse or Switch 2=3|0|RungNode 3=11|0|OSR|B,0,0|| 4=3|0|RungNode 5=15|0|CTU|N,0,5,32767|Up Counter N,0| 6=3|0|RungNode [Rung 1] Title=Increment Counter N,1 when Counter N,0 Preset value is reached Comment=Counter N,1 keeps track of how many times Counter N,0 has reached is Preset value 0=3|0|RungNode 1=6|0|XIC|N,0,2|Counter N,0|hits Preset 2=3|0|RungNode 3=15|0|CTU|N,1,5,0|Up Counter N,1| 4=3|0|RungNode [Rung 2] Title=Reset Counter N,0 back to 0 when N,0 Preset value is reached Comment= 0=3|0|RungNode 1=6|0|XIC|N,0,2|Counter N,0|hits Preset 2=3|0|RungNode 3=17|0|RES|N,0,0|Reset N,0 count|to 0 4=3|0|RungNode [Rung 3] Title=The counter values and presets must be copied to Ladder variables to convert them to floating point format. Comment=This will allow the Multiply and Add functions to provide results greater than 32,767. 0=3|0|RungNode 1=28|0|MOV|IFZ,N,0,5,V,0,0|Move Count 0|Prset to V,0 2=3|0|RungNode [Rung 4] Title= Comment= 0=3|0|RungNode 1=28|0|MOV|IFZ,N,0,6,V,1,0|Move Count 0|Value to V,1 2=3|0|RungNode [Rung 5] Title= Comment= 0=3|0|RungNode 1=28|0|MOV|IFZ,N,1,6,V,2,0|Move Count 1|Value to V,2 2=3|0|RungNode [Rung 6] Title=Set V,3,0 equal to the number of times Counter N,0 has reached its Preset Value (V,2,0) x N,0's Preset Value (V,0,0) Comment=V,3,0 is the running sum of all the counts of previous runs of Counter N,0 0=3|0|RungNode 1=26|0|MUL|FFF,V,0,0,V,2,0,V,3,0|Calculate old|total 2=3|0|RungNode [Rung 7] Title=Calculate the total count by adding the current value of Counter N,0 (V,1,0) to the sum of previous runs of Counter N,0 (V,3,0) Comment=V,4,0 is the overall total count 0=3|0|RungNode 1=24|0|ADD|FFF,V,1,0,V,3,0,V,4,0|Add old total|2 current count 2=3|0|RungNode