We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
i cant disable external interrupt, i enabled exint0 in main, and in different function i want to use disable this interrupt and enable again there is three bit related extrenal interrupt: EX0=0 //disable exint0 EX0=1 //enable exint0 IT0=0 //level mode IT0=1 //falling edge mode IE0 : interrupt flag (automaticly cleared by hardware when interrupt serviced) in main:
IT0=1; EX0=1; EA=1;//enable interrupts
in function:
EX0=0;//disable external interrupt drawpic();// continue 5 second IE0=0; EX0=1;//enable external intrerrupt
but when drawing picture external interrupt continue to coming, where is the problem?
what I GUESS you are missing is (per "the bible") if an event happens that normally would cause an interrupt while interrupts are disable, thhat interrupt will happen as soon as interrupts are enable.
Look at the mechanism (using t0 as an example: t0 overflow, in itself, does NOT cause an interrupt it set TF0, nothing else. TF0 DOES cause an interrupt if and when the interrupt is enabled. Enabling T0 interrupt does NOT reset TF0. so, if TF0 is set, at the time you enable (all or) the T0 interrupt the T0ISR will be entered.
Erik