Summary of Siemens PLC along pulse instructions

S7-1200CPU provides four edge pulse instructions for users to use, namely: scan operand signal edge instruction, set operand at signal edge instruction, scan RLO signal edge instruction, and detect signal edge instruction.

The moment when the signal is from 0--1 is called the rising edge, and the moment when the signal is from 1--0 is called the falling edge. Whether it is a rising edge or a falling edge, in the PLC program, it is only connected for the length of one scan cycle.

1. Scan operand signal edge instruction

rising edge command

When it is detected that the signal of M0.7 changes from 0 to 1, Q0.6 is set. In the program, M1000.0 is called the edge storage bit , which is used to store the state of M0.7 in the last scan cycle.

PLC judges whether there is any change by comparing the current state of M0.7 with the result of the last cycle state.

If the status bit of the last cycle is 0 (that is, M1000.0=0), and the current status of M0.7 is 1, it means that a rising edge signal is generated, and the rising edge contact command is turned on. The same is true for the falling edge command.

Falling edge command

2. The instruction to set the operand on the edge of the signal

The instruction with P in the middle of the coil instruction is called the "set operand at the rising edge of the signal" instruction, and the instruction with N in the middle of the coil instruction is called the "set operand at the falling edge of the signal" instruction.

 M10.1 stores the result of the last logic operation. When the result of this logic operation is compared with the last time, if the last result is 0 (that is, M10.1=0), and this time the result is 1, it means that there is a rise At this time, M10.0 will remain on for one scan period, and M10.0 will be off at any other time.

Note: The output result of Q0.6 is affected by the result of logic operation, if the result of logic operation is 0, then Q0.6 is off; if the result of logic operation is 1, then Q0.6 is on.

3. Scan the signal edge command of RLO

P_TRIG is the command to scan the rising edge of the RLO signal, and N_TRIG is the command to scan the falling edge of the RLO signal.

 M200.0 and M200.1 respectively store the logic operation results of the previous scan cycle, and CLK is the input terminal.

4. Detection signal edge instruction

R_TRIG and F_TRIG, this instruction is an FB block, and needs to be assigned a background DB block when used.

 CLK is the input terminal of the logic operation result of this time, and the last logic operation result of the instruction is stored in the "Stat_Bit" variable of the background DB block of the instruction.

Guess you like

Origin blog.csdn.net/viixin/article/details/130438356