Instruction Parameters
Supported PLC Series
| PLC-AES | PLC-FB | PLC-ES |
|---|---|---|
| ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| c | – | – | – | – | – | – | – | ✓ | – | – | – | ✓ | – | – | – |
| v | – | – | – | – | – | – | – | – | – | ✓ | – | – | ✓ | – | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | – |
| Carry | F11.2 | – |
Number of Steps
| Steps |
|---|
| 3 |
Operands
| Operand | Description |
|---|---|
| c | The first operand. Entries are only counter data registers. |
| v | The second operand. Entries are unsigned WORD data registers or constants. This is the value the counter contact, c, will energize at. The unsigned value range is 0 ~ 65,535 (216-1). The Hexadecimal value range is H0000 ~ HFFFF. Signed value entries will be treated as unsigned values. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by Z exceeds its range. The valid range of the data register Z is Z128 ~ Z1023 when using Function Block implementation. F11.0 turns ON when the value of the data register, CC, exceeds the range of 0 ~ 65,535 (unsigned).
Instruction Behavior
The CTU instruction behaves as follows:
- The data register C assigned to c is a BOOL data register.
- CS and CC express the detailed value of the data register C assigned to c.
- CC is a WORD data register used for the current count value of c.
- CS is a WORD data register used for the count setting value of c.
- The value of CS is equal to the value of v.
- CS and CC express the detailed value of the data register C assigned to c.
- The value of CC increases each time the instruction is energized.
- The counter contact c turns ON when the value of CC is equal to v.
- The counter contact c will remain ON as long as CC is equal to or greater than v.
- If the value CC is signed, the largest possible value is 32,767 (216). If the instruction energizes again, the value of CC will overflow to -32,768.
- If the value of CC is unsigned, the largest possible value is 65,535.
- If the instruction energizes again, nothing will happen.
- If the reset signal is energized, CC will reset to 0.
- The counter contact c will turn OFF.
- The counter contact c turns ON when the value of CC is equal to v.
- The counter contact assigned to c can be used as an A or B contact.
- When the counter contact meets the RST instruction, the contact is turned OFF (0), but the value of CC is maintained.
Ladder Diagram Examples
CTU

The CTU instruction starts from 0 and counts up to the largest value, 65,535 (unsigned). The count number is saved in a counter data register, CC. If the value of CC is greater than or equal to the value of v, the counter contact C energizes.

The initial value of the BOOL counter data register, C1.0, is 0. The initial value of the WORD current count data register, CC1.0, is 0. The initial value of the WORD set count data register, CS1.0, is 3.

When the contact, M0.0, is powered ON (1), the counter instruction counts up by 1, increasing the current count data register, CC1.0, to 1.


When the contact, M0.0, is powered ON (1) again, the counter instruction counts up by 1, increasing the current count data register, CC1.0, to 2.


When the contact, M0.0, is powered ON (1) again, the counter instruction counts up by 1, increasing the current count data register, CC1.0, to 3.

Since CC1.0 is greater than or equal to CS1.0, the BOOL counter data register, C1.0, is set to 1. As a result, the coil, Y1.0, is energized.


When the contact, M0.0, is powered ON (1) again, the counter instruction counts up by 1, increasing the current count data register, CC1.0, to 4.

Since CC1.0 is greater than or equal to CS1.0, the BOOL counter data register, C1.0, remains 1. As a result, the coil, Y1.0, remains energized.

When the contact, M0.1, is powered ON (1), the value the current count data register, CC1.0, resets to 0. Since CC1.0 is less than CS1.0, the BOOL counter data register, C1.0, is set to 0. As a result, the coil, Y1.0, is deenergized.

