I could not understand how to insert an RTM function inside my FB motor control so that I have an individual hourmeter for each motor.
A solution presented by "RClem" that uses the CPU clock seems pretty cool.
Why not use a TONR to store the operating time?
Per the Siemens help file :
Introduction
The CPUs have a specific quantity of runtime meters (refer to the technical specifications of your CPUs).
If your CPU is equipped with 16-bit runtime meters, you can set, start, stop, and read them with the "SET_RTM", "CTRL_RTM" and "READ_RTM" instructions.
If your CPU is equipped with 32-bit runtime meters, you can set, start, stop or read them with the "RTM" instruction.
Note
You can also use the "SET_RTM", "CTRL_RTM" and "READ_RTM" instructions for the 32-bit runtime meters. In this case, however, the runtime meters operate in the same way as 16-bit runtime meters (range of values: 0 to 32767 hours).
See also: Data record of the partial list extract with SZL-ID W#16#0132 index W#16#000B.
Application
You can use a runtime meter for a variety of applications:
For measuring the runtime of the CPU
For measuring the runtime of controlled equipment or connected devices.
Characteristics of the runtime meter
When it is started, the runtime meter begins to count starting at the last recorded value. If you want it to start at a different initial value, you must explicitly specify this value ("SET_RTM" or "RTM" with MODE=4). If the CPU changes to STOP mode, or you stop the runtime meter, the CPU records the current value of the runtime meter. When a warm restart or a cold restart of the CPU is executed, the runtime meter must be restarted ("CTRL_RTM" or "RTM" with MODE=1).
The runtime meters are reset to "0" following an update of the operating system or following a CPU reset to the factory state.
Range of values
CPU with 16-bit runtime meters: 0 to 32 767 hours
CPU with 32-bit runtime meters: 0 to (2E31) -1 hours = 2,147,483,647 hours