Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sensitivity of interrupts in PIC circuit

Status
Not open for further replies.

NewGeek

New Member
I got my LCD to display some characters (with the help of others) and the code has some interrupt routines in it that cause the display to change on interrupt.
The weird thing is that to trigger an interrupt all I have to do is wave my hand over the breadboard like a magician!
I know it sounds crazy but its true and it happens every time.
Any ideas?
 
I assume you're talking about an interrupt from one of the interrupt pins?

Did you hook anything up to the interrupt pin, or did you leave it floating at any time without the PortB pullups enabled?

If you have left it floating, it is not surprising at all to get spurious change detection. In fact, it is impossible to avoid.
 
Yes on pin from portB. its connected to a momentary switch. I cant even get my finger to the switch without it triggering. Enabling pull-ups? how? Im new at this.
Thanks
 
Ok I figured how to enable the pullups, but I still dont really know what they are or why they are needed. (I dont have my datasheet in front of me)
 
The momentary switch will connect the pin to 5V or gnd when pressed, depending on how you wired it. When it's not being pressed, what's the voltage on the pin? Totally unknown... the static charge will tend to retain the last voltage, but any noise that comes in will immediately change the voltage on the pin.

You never leave a digital input floating. You can enable the whole port's internal pullups, or you can add an external 10k resistor. Note the internal pullups MUST be used with a switch wired between the pin and gnd, not between the pin and 5V. Otherwise the pin will be read as high with the button pressed or not.
 
Thanks! I understand that.
So what if you want to use a switch to set a pin high? Do you just put a resistor in series with the switch? (actually I just remembered, I think a saw a schematic like that) Perhaps Ive answered my own question.
 
NewGeek said:
Thanks! I understand that.
So what if you want to use a switch to set a pin high? Do you just put a resistor in series with the switch? (actually I just remembered, I think a saw a schematic like that) Perhaps Ive answered my own question.

In that case you use a 'pull down' resistor, check my tutorials, the 'hardware extras' section shows both examples.
 
Make sure /MCLR (pin 1) is tied to +V through a resistor. This pin left floating (or not tied high internally depending on the PIC) can also cause the problem you are describing.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top