Shunlongwei Co Ltd.

Shunlongwei Co. ltd.

IGBT Module / LCD Display Distributor

Customer Service
+86-755-8273 2562

Can the rising edge instruction be realized by simple programming?

Posted on: 11/12/2021

The rising instruction is a simple instruction, and it is a common basic instruction like the normally open and normally closed instructions. In the past, when using S7-200, I basically didn’t pay too much attention to the rising edge instruction, because at that time I didn’t need to allocate the edge memory by myself. Now every time I use the rising edge instruction in the S7-1200, I need to allocate the edge memory by myself. I feel really uncomfortable in programming. From this I began to wonder if there is any shortcut, and I thought, “Isn’t it just a simple rising edge instruction. Do you compare the status of a scan cycle with the current status?”. (The program below is optimized by referring to the forum netizens!)

program:First create an FB block and add a few lines of SCL code inside.

Test 1:Call the FB block program in the main program OB1 as follows, the test effect is normal, and the variable rising edge trigger is normal!

Test two:Also call the FB block program in the main program as follows,

step one:When M30.2 is set to 1, the test is normal, and the rising edge triggers normally.

Step two:When M30.2 is set to 0, then M30.0 is set to 1, and M30.2 is set to 1 after an interval of more than one scan period. At this time, a rising edge is suddenly triggered. The result is that the test failed!

Step 1: Same as step 2 of test two, first set M30.2 to 0, then set M30.0 to 1, and set M30.0 to 1 after an interval of more than one scan period. This is not the case of test two. Condition.

Summarize:In test three, regardless of whether M30.2 is 1, the state of edge memory M30.3 changes with the state of M30.0. In the second test, when the state of M30.2 is 0, the edge memory in the FB block does not change with M30.0 and remains unchanged!

The result obtained through the above test is that the FB block editing program cannot replace the rising edge instruction of the system.