Difference between edge trigger and Level Trigger

Source: Internet
Author: User

Difference between edge trigger and Level Trigger
Of course it's different.
Level Trigger is triggered during high or low-level persistence,
Edge trigger is triggered from high to low or from low to high.
Follow-up:
I always think it is triggered when the level is a value. Which of the following issues does edge trigger solve?
Answer:
Edge triggering generally takes a short time, while edge triggering generally takes us-level triggering. The response must be fast, while level triggering only requires high and low. There is no time requirement, for example, if it is always low within 10 s, it is also triggered,
For example, it is best to use edge trigger to interrupt timing or counting, and the Level Trigger error will be very large. Level Trigger is generally used for simple alarm and switch (time requirement is not high)
Category:
Level Trigger is to do the specified thing only when the level is high,
Edge trigger refers to a high-level conversion to a low-level conversion, or a flip conversion. This conversion process triggers an action.
The rising edge, as the name suggests, is the moment when the low-level to the high-level conversion, such
_______
____/. In this figure, the/part is the rising edge,

______
\ _____. In this figure, the \ part is the descent edge.


The level is the voltage, the high level is the high voltage, and the low level is the low voltage.
High-level triggering is triggered when the voltage is high.
Edge triggering is triggered when the voltage changes from high to low or from low to high.
The rising edge is triggered when the voltage changes from low to high.
The descent edge is triggered when the voltage changes from high to low.


Edge trigger: the rising edge and the falling edge, which have been learned during the learning of digital power. In short, it is the moment when the level changes.

Level Trigger: generally refers to the low level, that is, the whole time after the level changes to low.

If it is triggered by a descent edge, it is triggered when the transition from high to low levels. Low-level persistence occurs only once.

If it is triggered at a low level, the interruption remains valid during the low level. If the program is exited before the level is restored, the program is interrupted again after the system exits. As long as you do not exit, it will not be triggered repeatedly. My approach is to disable the interrupt before exiting, and enable it when it is available later. ,

 

 

For example, check the buttons in the External Interrupt 1.
Void isr_int1 (void) interrupt 2
{

If (! Int1) // int1 is external interrupt 1, int1 = P3 ^ 3.
{
Delayms (10); // you can add an animation here to prevent errors caused by key jitter.
If (! Int1)
While (! Int1); // wait for the button to release
{
L1 =! L1;
}
}
. Although there is a loss effect.
However, we do not recommend that you use an external interrupt to detect the buttons.
When you press S2 or S3, the interrupted service subprogram has been executed. Delayed jitter is not feasible. Only hardware jitter is used. In practical applications, int1 and int0 are connected with stable digital signals, rather than the keys that generate interference digital signals. If conditions are met, the hardware will shake off.

External interruptions are used to detect peripherals that require high response speed (microseconds), and the operation time of buttons is greater than 40 milliseconds. You can test it.
Although there are still many development board buttons on the interrupt, it is only to verify whether it is easy to use, do not do this on the product.
Do not use a latency of 10 ms for re-detection. The latency of 10 ms is a waste of controller resources. It is very valuable for the microcontroller to know the time.
During the key detection, we recommend that you set a 10 ms timer interrupt as the clock cycle and set a flag in the interrupt.
In the main cycle of the program, the system detects the clock cycle mark, clears the mark after detecting the mark, scans the button, records the current button status, compares the result with the last detected result, and records the same number of times, if the same button is detected three times in a row, confirm that the button is pressed.
This not only ensures the accuracy of keys, but also occupies a small amount of time resources of the microcontroller, slightly increasing the point program space, in the single chip microcomputer human-machine interface system, it should be the most cost-effective.

Difference between edge trigger and Level Trigger

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.