4 |
Up Counter
The Up Counter turns on an output when the count reaches a specified value (from 0 to 65535 if a register is used to load the counter, or 0 to 32676 if a constant is used). The output remains on only as long as the count is equal to the specified value. If the count increases past the specified value, the output goes back to 0.
To program a counter function, enter two inputs (in the example below, I1, and I2), and two parameters (R1 and 5 in the example).
The first input increments the count value. In this example, each time the Positive Transition contact transitions on, the count total stored in R1 goes up by 1. The second input to the counter resets the count total (here, in R1) to 0. It also deactivates the output coil.
The first parameter of the Up Counter is a register containing a value that is being incremented (usually, by an input in the application program). Register R1, used in this example, is not a ªretentiveº register; it is cleared if power goes off. If the current count value should be saved with the power off, use a register from R385 to R500.
The second parameter is the counter total. If this number should always be the same, you can enter it directly, as shown in the example. Or, if you want to be able to change the counter total, instead enter a register from R385 to R500 as the second parameter for the timer (see the example Down Counter).
Programming Software Instructions
If you are using the programming software, refer to the instructions on page
Example and HHP Instructions
46128
I1
"
I2
Ladder Diagram
C1
R1
UPCTR
5
|
| |
START | F1 | I1 |
START |
| I2 |
CNTR | F1 | R1 |
|
| 5 |
OUT |
| C1 |
Timing Diagram
Input I1
Input I2
Register R1
1
0
5
4 3
2
1
0
Each time input I1 transitions on, the content of register R1 is incremented. When it reaches 5, output coil C1 activates.
Input I2 is used to reset counter R1 to 0. It also deactivates coil C1.
Coil C1
Micro PLC Programmer's Guide ± April 1994 |