PDA

View Full Version : Interrupt Button Wiring Question



elec_mech
- 7th June 2005, 18:06
Hello! I have been playing with interrupts for a few weeks now with great success (thanks to all you and the information on this forum), but I have now hit a wall. I am using a simple N.O. switch to activate an interrupt. It works wonderfully if I feed GND to the RB0 pin through a 10K resistor and hook the other end of the switch to 5V through a 100 ohm resitor. Graphically,

o RB0
|
| 10K
/\/\/\/\----------------GND
|
\ N.O.
| 100
|------------/\/\/\/\-------5V

Due to design constraints, I need to pull it low to activate.
Graphically,

o RB0
|
| 1K-10K
/\/\/\/\---------5V
|
\ N.O.
|
|---------------GND


Unfortunately, this does nothing. Works great for regular button commands, just not for an interrupt. I've also tried activating the interrupt on both the rising and falling edges to no avail.

I get the impression the interrupt likes seeing a high signal normally. I don't know how to tell it to like a normally low signal though. I've also gone through the datasheet often, though not with a fine-tooth comb.

Anyone have any ideas? Any help is appreciated. Thanks!

Dave
- 7th June 2005, 22:51
elec_mech, I would lower the resistance of the pullup to about 4.7k to about 1k. if you have a meter, read the voltage at the micro pin and see if it is switching between 1/4 and 3/4 vcc.

Dave Purola,
N8NTA

elec_mech
- 8th June 2005, 12:15
Well, I had gone down as low as 1K with no luck, but I took your advice and checked the voltage going to the pin. With the 1K I read about 2.8V, which is just above the 2.5V limit. On a side note, I checked the voltage on the pin referenced to ground with nothing connected to the pin and read 1.56V. I have no clue why this is, especially since the pin is set as an input and its initial state is programmed to be low.

Anyways, since 2.8V was on the hairy edge, I tried two 1K's in parallel (500 ohms) and read about 3.2V. When I tried this, everything worked beautifully! Thanks for the advice Dave! I feel a little silly for not looking harder at the voltages on the pin earlier, but this is a learning experience. Thanks again!

-Tony

Dave
- 8th June 2005, 12:25
elec_mech, I still beleive there is something wrong with your setup because if the pin is programmed as an input, 10k ohms should pull it all the way up to + 5 volts and with that resistor in place putting a 1k ohm resistor to ground from the same pin should result in a voltage of about .3 volts or less.

Dave Purola,
N8NTA