Timeline for Strange pin behavior with pic16f88
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 26, 2012 at 16:56 | vote | accept | a sandwhich | ||
Aug 26, 2012 at 16:53 | comment | added | a sandwhich | Everything is working correctly now, I think I know what has been happening now. I set it to use the internal oscillator with the config bit FOSC_INTOSCIO. I increased the wait loop to loop 500 times, and I get a little more than a second between each blink. When I put it down to fifty it blinks much more rapidly. | |
Aug 26, 2012 at 1:13 | comment | added | Oli Glaser | If you have an external 20 MHz crystal, then yes, you can set it to this. If not then use the 8MHz internal oscillator. You can turn the LVP off if not using it, yes, and it may stop what you are seeing (but the pin should be set to an output anyway) I advise having a thorough read of the datasheet, all the information about configuration (oscillator, reset, LVP, etc) is in there. | |
Aug 26, 2012 at 0:56 | comment | added | a sandwhich | Alright, thank you. So I should append LVP_OFF to the config, and what should I set the oscilator to? The mcu is rated at 20 mhz, is that an acceptable value? | |
Aug 26, 2012 at 0:33 | comment | added | Oli Glaser | I mention the correct header and config bits as your Wait routine as shown should not last for 1/3rd of a second (should be more like a few tens of microseconds) Make sure you have the oscillator set correctly in the config bits. | |
Aug 26, 2012 at 0:31 | comment | added | Oli Glaser | Hard to say exactly, but it's probably due to it floating (set to input) and the changing of value causing some issue. It could be that you have LVP (Low Voltage Programming) set and it enters into programming mode. Make sure you have the correct header and config declarations, and set all unused pins to output (high or low) to prevent floating related issues. | |
Aug 26, 2012 at 0:18 | comment | added | a sandwhich | That works well, thanks. I am noticing that if I touch pin 9 (RB3/PGM/CCP1) with my finger the led will hold on and then go off. After about 5 seconds it will turn back on. What is happening there? | |
Aug 25, 2012 at 23:19 | comment | added | Oli Glaser | It's up to you, if you don't need to be able to externally reset the micro (e.g. button press) then turning it off and saving a couple of components is an option. Microchips have many app notes on these subjects, I'd have a search on their site and do a bit of reading. | |
Aug 25, 2012 at 23:06 | comment | added | a sandwhich | Which is better/safer/smarter for the mcu, keeping mclr off in the config, or keeping it on and keeping the resistor there. What is usually done? | |
Aug 25, 2012 at 22:58 | comment | added | Oli Glaser | It will work intermittently when it's not there due to the very high impedance of the CMOS input - just touching it with your hand will make a difference when it's floating. If the part is held in reset (MCLR actually pulled to ground rather than floating) then the main oscillator is shut down and the part "sleeps" (very low power consumption) Turning MCLR off will make the pin state irrelevant, yes. | |
Aug 25, 2012 at 22:52 | comment | added | a sandwhich | So I need to keep that 10kΩ resistor there permanently? It seemed to work ok when that wasn't there. What does being held in reset do? Would putting _MCLRE_OFF in the config portion of the program fix this? | |
Aug 25, 2012 at 22:44 | history | answered | Oli Glaser | CC BY-SA 3.0 |