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

Posts: 4
Joined: Mon Feb 26, 2018 8:46 am

How STOP int- interruption At some point

Postby YSRAHMED » Mon Feb 26, 2018 9:51 am

Gooood Day
I was connect Buzzer to B7 (pic16f877a )
I was connect pushbutton to D1 (as normal open pointes in sensor )
pushbutton is on -----> feed D1 with 0 ------> Buzzer Run :P
{ I using int B0 for Mute Buzzer(INT-interruption ) };
{ 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
Matrix Staff
Posts: 14790
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4752 times
Been thanked: 4358 times

Re: How STOP int- interruption At some point

Postby Benj » Mon Feb 26, 2018 11:03 am


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.