Go Down

Topic: Random interrupt  (Read 143 times) previous topic - next topic


Am using a MC14490 debounce eliminators'  for switch press. And the switch press trigger  external interrupt. The program works fine but there is random interrupt trigger ,during power on.

int MyPin = 6 ;
int Led =13;
volatile int State = 1;

void setup() {
pinMode(Led, OUTPUT);
attachInterrupt(digitalPinToInterrupt(MyPin), Blink, CHANGE);
void loop() {
digitalWrite(Led, State); // turn the LED on (HIGH is the voltage level)
void Blink () {
State = !State;

I assume the debounce would eliminatior would take care of noise trigger . I assume wrong. Any suggestions


I suggest you clear the interrrupt flag register that applies to the pin 6 external interrupt before you attach the interrupt to it in Setup().  You'll have to check the datasheet for how to do that.  And it wouldn't hurt to excute the same command as part of the ISR (although that may happen automatically for external interrupts - I don't remember).

Also, do  you intend that the state should change when the button is pressed and when it is released?  In other words, do you want CHANGE or just FALLING?


According to the MC14490 datasheet page 1

"NOTE: Immediately after powerup, the outputs of the MC14490 are in indeterminate states."

Sounds like an invitation for random interrupt signals at start-up.

I am curious, why do you use the MC14490 instead of using software?

Go Up