Part 2
Example 2
The following task is to be performed in example 2. The value for motor speed is to be stored at a frequency of 1 Hz and forwarded to a threshold switch for evaluation.
To achieve this, it is first necessary to generate the measuring pulse of 1 Hz. A timer configured in the following way can be used for this purpose:
- Time 0.5 s, level-operated
- Restart not possible with timer running
If the inverted output of the timer is now fed back to its input, the timer will be restarted again immediately after the set time has expired. The AND combination inserted in the feedback in the example makes possible the switching on and switching off of the "clock-pulse generator". In this way, clock pulses with a frequency of up to 25 Hz can be generated.
However, the frequency of the clock pulse generated in this way is still too high (2 Hz) and the duty factor does not yet correspond to 50 % (see the clock pulse characteristics in the top block diagram of the example).
This clock pulse characteristic would be fully adequate to operate an edge-operate PLC block as this does not require a 50 % duty factor. However, if this signal is also to be used to, for example, make a lamp connected to a discrete output flash at a certain frequency (like in the example), it is essential to change the duty factor. An edge- operated D flip-flop which feeds its inverted output back to its data input can be used for this purpose. The output is "toggled" every time a signal edge arrives which, in the case of 2 signal edges arriving per second, has the effect of generating a cycle with a frequency of 1 Hz and 50-% duty cycle.
This clock pulse is placed on a D flip-flop (also edge-operated), at the data input of which the motor speed is applied. Since the flip-flops of the PLC can also process 16-bit values, the applied engine speed is read in, stored and applied at the output of the D flip-flop once every second.
The downstream threshold switch is set to the thresholds 1000 rpm, 2000 rpm and 3000 rpm, which are in turn placed on discrete outputs, and activates the respective outputs depending on the engine speed applied.
Example 2, assignment of discrete inputs and outputs
236 Signal "Permanent LOW" at input "RESET/Clock"
237 Signal "Engine speed in rpm"
262 Signal "Input 07 (analog)"
263 Signal "Permanent LOW"
265 Signal "PLC output: group 2, flip-flop 2 inverted"
266 Signal "PLC output: group 2, timer" clocked
267 Signal "PLC output: group 2, flip-flop 1" clocked
269 Signal "PLC output: group 1, flip-flop 2"
270 Signal "PLC output: Group 2, logic block 1"
271 No output signal
272 Signal "PLC output: group 2, flip-flop 1 inverted"
273 Signal "Output 12"
274 Signal "Output 17"
275 Signal "Output 18"
276 Signal "Output 19"
FF_1 Flip-flop 1
FF_2 Flip-flop 2
G_1 Group 1
G_2 Group 2
LB_1 Logic block 1
SS_1 Threshold switch 1
TB_1 Timer 1