Home > other >  How to interrupt delay function
How to interrupt delay function

Time:10-22

Wrote a bluetooth alarm with single-chip computer, mobile phone client constantly send bluetooth module strings, program is
Void main ()
{
If (q3==0)//q3 is RXD
{
Beep ();
//the alarm}
The else
{
Q1=0;//q1 is led lights
Delay_ms (5000);
}
}
But I found that don't stop hair do not work, it will ring at the end of the 5 seconds then not ring under a
Then I thought of several solutions
1. Let the new signal in can interrupt the operation of the delay
2. Using the interrupt function, but I will not use the
And give some Suggestions, here

CodePudding user response:

My way is voltage monitoring pin

CodePudding user response:

Delay set a variable in a function as a judge, control of the variable out of circulation.
  • Related