How can I do to erase an unwanted pending interrupt? Interrupt generated by an interruptable pin...I use a Flite09 and its datasheet says: ''To clear an unwanted pending interrupt by software, the sensitivity bits in the EICR register must be modified.'' And this is my simple code: ''bset EICR,#7 bres EICR,#7 iret'' As just the program exit from interrupt routine,it come back in it because pending interrupt has not cleared....Why?? Thanks a lot for your help!!
I keep EICR bit6 equal to ''1'',then the sensitivity changes from ''Rising and falling edge'' to ''Rising edge only''.The level of port B0 is always low and when a rising spike happens,then the interrupt occurs correctly....when the interrupt routine ends,the port B0 level is perfectly low and I don't understand cannot clear the interrupt pending!!! I checked the port B0 level with an oscilloscope and there aren't hardware problem,it's only a pending interrupt not cleared correctly!!!
my only idea - if we rule out a hardware error - is, that the falling edge of your ''spike'' appeares after you've been modifiing the flag. But I see: it must take effect between ''bres EICR,#7'' and ''iret'' .... BTW: why do you select sensitivity on both edges and not only on the rising one? WoRo
Thanx for your help,but the falling edge of my spike appears before (many ms before!!) critical point :between ''bres EICR,#7'' and ''iret''...Oscilloscope says so...
I select sensitivity on both edges and I change it immediately only for clear pending interrupts....in main code,the sensitivity is always ''only rising edge''....only at end of interrupt routine I change and re-change it for reasons described above. Thanx however WoRo