Counters are used in Fanuc PLC ladder programs to count the sequences or events. There are many applications of counters in Fanuc PLC. For example, we use counters to know tool positions of ATC in the VMC machine, we get to know that the current tool and next tool to be called, these things we can do using counter instructions.
Here we use data such as preset value and count value to count the sequence of events. Assume that our preset value is set to 10 and counter starts counting from 1,2, 3,4…and then when the count value reaches a preset value (preset value is also known as current value) 10, then counter output bit gets ON. These values will be in BCD (Binary Coded Decimal) format or binary format. The value range for preset and current value will be 0 to 32767 for binary counter and 0 to 9999 for the BCD counter.
Functions of counters:
1. The counter output bit will get ON when the current value reaches the preset value and this preset value can be set on a counter screen or PLC ladder program.
2. The counter will give you a feature that you can choose counting value start from 0 or 1.
3. Counters can be used as a ring counter, means upon reaching preset value; count can be returned to an initial value by another count signal.
4. Counters are counted in up or down sequence.
Types of counters:
There are total four types of counters as shown below table:
|PLC counter instruction||Name|
|CTRD||Counter two bytes|
How the counter will work?
Refer to Picture 1, it shows basic counter PLC instruction. You can see parameters such as CNO, UP-DOWN, RST and ACT are used to set beginning count number, is counter up or down, counter reset, and activating counter instruction respectively. That’s why to enable these parameters smoothly; we use first contact and second contact of output coil address R50.0
You can select count value starting from ‘0’ and ‘1’, by sending value 0 or 1 to parameter CNO. You can do this by using first contact or second contact of output coil address R50.0. In Picture 1, we used first contact Read (NO) of R50.0; this will make the counter starts counting from value 1.
|When the status of input R50.0, 1||The counter begins counting value 0|
|When the status of input R50.0, 0||The counter begins counting value 1|
You can choose counter should start in up count or down count by sending value 0 or 1 to parameter UPD. You can do this by using first contact or second contact of output coil address R50.0. In Picture 1, we used first contact Read. Not (NC) of R50.0; this will make the counter starts counting in up direction count.
|When status of input R50.0, 1||The counter begins counting in down direction|
|When status of input R50.0, 0||The counter begins counting in up direction depends on 1 or 0 (if CNO=1 or 0)|
When you send 1 to RST, the counter current value will be reset to 0 or 1 (depends on CNO status 0 or 1)
When you press, X1.4 button, the counter will count one value, next if you press the second time, it will count another one.
Counter operating screen:
As shown in Picture 1, we used number 1 in counter instruction. It means the counter preset address for this PLC counter is C0000 as shown in Picture 2. We need to set preset value for the counter in this address and counter address C0002 is cumulative (current counting value) address. We can check count value in this address C0002.
|Counter Number in PLC Instruction||Respective counter address on CNC display |
(Refer to Picture 2)
Counter data types:
|Data type||The maximum value for Preset||The maximum value for Current|