Pay attention when using the Keyence PLC timer instruction [TMR]
The timer instruction in a sequence program adds up the time while the input condition is ON, and when the set value is reached, the specified device turns ON. When you design a sequence program for a device, you are sure to use the timer instruction.
In this article, I will show an example of an actual failure using the timer instruction when I first used the combination of a Keyence PLC and a touch panel.
Contents
- 1 Create a sequence program with timer set values set directly inside the PLC
- 2 Incorrect: Create a sequence program with the timer's set value in the data register
- 3 Correct: Create a sequence program with the timer's set value in the data register
- 4 Summary of points to note when using timer commands in Keyence PLCs
Create a sequence program with timer set values set directly inside the PLC
First of all, here is an example of creating a sequence program that uses multiple timer instructions as in Mitsubishi and OMRON PLCs, and directly specifies numerical values inside the PLC.
There is no problem with this.
Incorrect: Create a sequence program with the timer's set value in the data register
This is an example of creating a sequence program that uses a data register to set the value of a timer instruction (incorrect example).
The set value of the timer is different from the actual set value
In order to set the timer setting to "10" for both T0 and T1, I transferred "10" to D0 and D1, but when I monitor them, they show completely different values.
This is the point where I failed.
Keyence PLC's timer instruction setting is specified as 2 words (32 bits)
Unlike when using a Mitsubishi or Omron PLC, when creating a sequence program using timer instructions with a Keyence PLC, it is important to note that the setting value is specified in 32 bits.
For example, if you set "10" in D0 and D1 to set the timer value to "10" for both T0 and T1, the timer setting for T0 will be "655370" because it uses two words (32 bits) in D0 and D1.
Correct: Create a sequence program with the timer's set value in the data register
Now that you know that the Keyence PLC uses 32 bits to set the timer, here is an example of creating a sequence program to set the timer value to "10" for both T0 and T1.
The set value of the timer is now the actual set value
When the timer set value for T0 was specified as D0 and D1, and the timer set value for T1 was specified as D2 and D3 in two words (32 bits), the timer set value was "10" for both T0 and T1.
Summary of points to note when using timer commands in Keyence PLCs
・The timer setting value is specified in 2 words (32 bits).
As long as you are aware of this, there is no problem, but if you have been using another company's PLC for a while and are using the Keyence PLC for the first time in a while, please remember the above cautions.
When creating a sequence program or touch panel data for not only the Keyence PLC but also other PLCs, you need to be careful about specifying the data size.
For example, when displaying the counted value on the touch panel, if the display specification on the touch panel is 16bit even though the PLC side is 32bit, if the count exceeds the value that can be expressed in 16bit (0 to 65535), a completely different value will be displayed.
This is a simple and elementary matter, but always be aware of the data size when designing sequence programs.