![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| New Member | I am slowly building an start/ finish beam break gate for a timer. I have setup a couple of the bits that I think I need, PWM for IR beam, Piezo buzzer to signal the start/ stop, now I wanted to test the break by using a button rather than the IR receiver just. But the event is triggered when my finger goes anywhere near the button or its pull up resistor, I don't have a chance to press it. If I use a long plastic object to press the switch it works fine. Other projects I have created with switches work fine. So why does my finger not the switch trigger the event and how can I fix it? I think I narrowed it down to be something to do with TMR1 as when I comment out that code the button works fine to turn the buzzer on when I hold the button down. Rough circuit diagram and code attached. I have set it up on a breadboard with 5v regulator. |
| | |
| | (permalink) |
| Experienced Member | Try giving supply through batteries & see also did you place decoupling capacitors very closer to the PIC power rails?Also the original code is to detect the IR beam but when you testing with a button you need to add button DEBOUNCE coding as well.
__________________ Gayan Forum Supporter Last edited by Gayan Soyza; 7th August 2007 at 11:05 AM. |
| | |
| | (permalink) |
| New Member | I have a 100nf and 10nf capacitor around the 5v regulator, thats it. I will lookup decoupling capacitors and give that a go. I can add debounce, but that does not stop my button from being magic. |
| | |
| | (permalink) |
| Experienced Member | Even though your asm file shows MCLRE_OFF, the PIC is behaving like MCLR is floating - randomly resetting due to stray electric induced by your fingers. try pulling it up to +5V via a 10K resistor. Some PICs don't like both internal MCLR and INT OSC, Decoupling caps are always a good idea. Debouncing a switch is necessary if you are using the edge to initiate something. If you are just using the level to turn on or off the peizo, then it's not really an issue. I would debounce it as a matter of course but I doubt that's your problem. |
| | |
| | (permalink) |
| Experienced Member | make sure the pin is in digital mode too, as porta on most pics defaults to analog.
__________________ If you don't have a planet, what good are gold bars? want to contact me directly? gmail gordonthree check out my project website: http://projects.dimension-x.net Favorite numbers: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 |
| | |
| | (permalink) |
| Experienced Member | Not sure what PIC you're using but if it's one that has a LVP pin then I suspect you need to disable Low Voltage Programming option in the config fuses. I got those same type symptoms long ago when I left LVP enabled but left the actual LVP pin floating... |
| | |
| | (permalink) |
| New Member | Philba; the PIC is not resetting, it works just as I want apart from the swtich is my finger. justDIY; I have disabled the analog comparators Mike; I am using a PIC16F628a. I will look into turning off LVP pin. Further investigation shows that if I have the switch miles away from the PIC it works fine, but if I put my finger anywhere near the pull-up resistor it triggers? I have put decoupling caps in. |
| | |
| | (permalink) |
| New Member | I have tried all pins both porta and b. Same story. |
| | |
| | (permalink) | ||
| Experienced Member | Quote:
Quote:
Does the false triggering happen every time? Have you tried to discharge static electricity from your body before pushing the button? Hopefully you won't have that issue when you'll place the IR receiver. Good luck with your project. | ||
| | |
| | (permalink) |
| Experienced Member | it sure sounds like your pull-up resistor isn't doing its job and the input gate is floating. A floating gate is very sensitive, exactly like you describe. try a stronger pull-up, like 1000 ohms.
__________________ If you don't have a planet, what good are gold bars? want to contact me directly? gmail gordonthree check out my project website: http://projects.dimension-x.net Favorite numbers: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 |
| | |
| | (permalink) |
| Experienced Member | The 16F628A does have LVP capability. Have you tried grounding the PGM pin or turning off the LVP enable in the config fuses yet? |
| | |
| | (permalink) |
| Experienced Member | his source code has LVP turned off. (assuming that source is what was used to builf the .hex). Verify your configuration settings (aka fuses) in your programmer. Make sure LVP is off, internal mclr, INTOSC and so on. something is floating. you need to find it. With the power off, I would measure between the input pin and +5. If it doesn't measure very close to your resistor value, verify the connections and perhaps replace the resistor. if that checks out, put a 10K pullup on MCLR. |
| | |
| | (permalink) |
| New Member | OK one at a time here. ENG1; Thankyou for wishing me luck, I feel I need lots of that at the moment, it seems so stupid. Yes it happens everytime, and now I have replaced the button with an IR receiver TSOP1738, it still happens (I put my finger just infront of the IR receiver) and it triggers the buzzer. And no its not being triggered by an actual beam break. JustDIY; Now I am confused, Gayan said go higher and you are saying lower. The pull up resistor I am using is 10,000ohms, the only higher one I have is 100,000ohms, which is probably too high. Mike; LVP is turned off on the fuses. I have not tried grounding LVP pin or MCLR yet. Will try tonight if my wife will let me (I am spending too much time trying to sort this out) Philba; Will try that all out, does that mean reading the hex code to see if the fuses have been set correctly? Thanks again for all your suggestions. Last edited by jimfraseruk; 10th August 2007 at 10:26 AM. |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| odd project, 1 button adds a light 1 button takes a light away with sound. | KevinAlaska | Electronic Projects Design/Ideas/Reviews | 15 | 6th June 2007 04:38 AM |
| 1 Hour Timer PIC 16F628A (Set Button) | Suraj143 | Micro Controllers | 11 | 26th April 2007 03:54 AM |
| button midi keyboard | jjjjjj | General Electronics Chat | 2 | 20th March 2006 04:10 PM |
| Push Button On/Off power to PIC | eblc1388 | Micro Controllers | 8 | 17th February 2006 01:31 PM |