×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 17542200, Entry date: 05/21/2012
(3)
Rate

In STEP 7 Micro/WIN, how can you evaluate unlimited rising and falling edges in main programs or subprogram?

  • Entry
  • Associated product(s)

Description
Using the library below you can make unlimited edge evaluations. Normally, the CPU supports only 256 edge evaluations - see Entry ID: 8804150. This program routine can also be used in subprograms. Normally the CPU does not support this - see Entry ID: 7115899.
The library includes two program routines, one each for rising edge and falling edge evaluation +.


Fig. 1: Library folder

Rising edge


Fig. 2: Rising edge subprogram call

Parameter Variable type Explanation
EN BOOL Must always be high (1)
Input BOOL Signal input, with a change (0->1) the output is activated for 1 cycle
Memory BOOL Temporary memory
Output BOOL Signal output
Table 1: Explanation of rising edge parameters

Function
If there is a status change from 0->1 (rising edge) at the signal input (Input), then the signal output (Output) is set for one cycle.
The memory bit stores this status. In order to recognize an edge again, the signal input (Input) must pass through zero. This resets the memory bit.


Fig. 3: Rising edge time diagram

Falling edge


Fig. 4: Falling edge subprogram call

Parameter Variable type Explanation
EN BOOL Must always be high (1)
Input BOOL Signal input, with a change (1->0) the output is activated for 1 cycle
Memory BOOL Temporary memory
Output BOOL Signal output
Table 2: Explanation of falling edge parameters

Function
If there is a status change from 1->0 (falling edge) at the signal input (Input), then the signal output (Output) is set for one cycle.
The memory bit stores this status. In order to recognize an edge again, the signal input (Input) must be reset to high in a cycle. This resets the memory bit.


Fig. 5: Falling edge time diagram

Rising and falling edge (block: Edge_detect)


Fig. 6: Subprogram call of Edge_detect block
 

Parameter Variable type Explanation
EN [BOOL] ENABLE: Enabling of the function, must always be TRUE (1)
IN [BOOL] Signal input, with a rising edge (0->1) or falling edge (1->0) "OUT" is set for one cycle
Memory [BOOL] Temporary memory
OUT [BOOL] Signal output
Table 3: Parameters of Edge_detect

Function
If there is a status change from 0->1 (rising edge) or from 1->0 (falling edge) at the signal input "IN", then the signal output "OUT" is set for one cycle. The memory bit stores the current status of the "IN" signal.


Fig. 7: Edge_detect signal diagram

The STEP 7 Micro/WIN library as archive file
Copy the "rising_falling_edge.exe" file into a separate directory and then start the file with a double-click. The STEP 7 Micro/WIN library is then unpacked. You can then integrate the library, which can be used in version V3.2.4.27 and higher of STEP 7 Micro/WIN, into your S7-200 project. The download includes two subprograms.

Note

  • Information about inserting libraries in STEP 7 Micro/WIN is available in Entry ID: 16689345

rising_falling_edge.exe ( 30 KB )  

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.