Counter
CTU (UP Counter) Instruction : Variable configuration
Variable Name | I/O | Type | Device |
FLAG | Input | Bit | Operating bit for UP Counter |
OFFSET | Input | Word | Write Index register number (0~15) |
SETTING | Input | Word | Write Counter set value (CS) |
RESET | Input | Bit | Counter reset bit |
OUTPUT | Output | Bit | It will be turned ON, if FLAG bit is turned ON and OFF as Setting counter. |
-RESET : COUNTER is not cleared automatically. It must be cleared by RESET bit.
CTU (UP Counter) Instruction : Function Block scan program
Before using Index register, save OFFSET value in Index register (R device).
Set OFFSET variable value into R0
UP Counter is turned ON, Counter will be increased. (If RESET bit is ON, counter will be cleared)
If it is turned On and Off as assigned counter at SETTING, OUTPUT will be turned ON.
Counter in Scan program
If you use Counter in Function Block, F10(Application Instruction) is recommended to check ON Delay or OFF Delay. For example, if M00 bit is turned On and Off 5times (5th ON time), M10 bit will be turned ON.
Monitoring
After a Function Block is downloaded to CPU and it is turned to RUN mode, the function block appears monitoring mode as below. Even though the function block is running, Counter will not work if M00 is OFF.
If M00 bit is turned On 5th time, OUTPUT (M10) will be turned ON.
The Counter device value is shown as below.
If RESET bit (M05) is turned ON, the counter value is cleared.
After cleared, Counter device value is shown as below.