How STOP int- interruption At some point

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
YSRAHMED
Posts: 4
Joined: Mon Feb 26, 2018 8:46 am
Contact:

How STOP int- interruption At some point

Post by YSRAHMED »

Gooood Day
I was connect Buzzer to B7 (pic16f877a )
so
I was connect pushbutton to D1 (as normal open pointes in sensor )
when
pushbutton is on -----> feed D1 with 0 ------> Buzzer Run :P
so
{ I using int B0 for Mute Buzzer(INT-interruption ) };
so
{ I was use Delay(10s )-----> for test the Mute Buzzer by interruption };
how :?:
{ can I stop the interruption at once When removing the BUZZER cause :?:

:D :D :D

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How STOP int- interruption At some point

Post by Benj »

Hello,

If your using a fixed delay then you can't really stop half way through even using an interrupt, unless you reset the chip or midify the program counter you will still be inside the delay when you leave the interrupt.

Instead of using a 10 second delay why not loop 100 times using a while icon and a 100ms delay. This way you can do additional checks in the loop to allow you to bail out early if needed.

Post Reply