![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hi, I'm new to the forums and haven't done much browsing around. But I've got a problem and I hope you can help me. I've been trying, in vain, to program a PIC16F872 using Picc. First, my MPLAB says I don't have "PCM" installed, so it won't compile but I got around that by getting the CCS PICC Compiler. Soooo, I throw my code into that, compile a .hex file, import that to MPLAB, hit program, and all seems to work right. Until I apply power to the circuit, however... at which point nothing happens. I've checked and rechecked the wiring, and the only thing that seems dubious is the clock (I'm using one of those two-pronged crystal oscillators and I'm a little confused over the placement of the capacitors). If anyone could help me out by telling me how to wire that chip up or giving me just some simple sample code to test out, it would be much appreciated. Or, if it's a problem with how I'm sending code to the microcontroller, perhaps that could be fixed too? Any help is appreciated, though... and thank you in advance | |
| |
| | (permalink) |
| You don't mention what programmer you are using?. But for a minimum PIC circuit, you could check my tutorial hardware, the 16F876 board should be identical to what you need. | |
| |
| | (permalink) |
| Sorry about that.... I'm using Microchip's Picstart Pro EDIT: Maybe it could be the clock setup, 'cause I've checked and rechecked my fuses and code. When using a 2-pronged oscillator (dunno how else to put it, those 2-legged silver cans), I have to use capacitors too, right? What setup does that need? Last edited by MatrixPhreak; 5th December 2007 at 11:24 PM. | |
| |
| | (permalink) | |
| Quote:
osc.jpg
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||
| |
| | (permalink) |
| Ok, I've gone and gotten the recommended capacitor values specifically as the datasheet tells me. I've wired everything like the datasheet tells me, with just a few questions. the MCLR/Vpp pin should be tied to +5V, right? Does anyone have a full schematic of just a simple LED blinking board? I've basically devolved to simply trying to blink this LED as a test. Any sort of schematic or working sample picc code for the PIC16F872 would be veeerrrryyy helpful for debugging and fixing my setup. I'm using the CCS Picc compiler to compile my C code, and MPLAB 7.6 to send the .hex to my mcu. I'm programming through the Microchip Picstart Plus (not upgraded yet). I can provide my current code, if that'll help. I'm using an 8MHz crystal oscillator, if that makes a difference. | |
| |
| | (permalink) |
| - can you readback your program from the chip? - got your oscillator selection programmed right? - if you're not sure about the external osc, use external rc, which might be simpler. | |
| |
| | (permalink) |
| 1- I've checked that a few times, and the program is always read successfully. 2- 8MHz should be HS, right? 'cause that's what the datasheet says and that's what I've set it as. 3- I've been thinking about that. For RC, what's a good value for the capacitor, and what do I set for #use DELAY in my code? All the datasheet tells me is >20pF for the capacitance, but how does increasing the capacitance change the startup time or the clock speed? I'd like a little more information about the RC mode, if anyone can provide. | |
| |
| | (permalink) | |||
| Quote:
Quote:
Quote:
But who cares! The important thing is that they blink the LED, so you can confirm that your PIC and circuit are working.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||||
| |
| | (permalink) | |
| Quote:
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||
| |
| | (permalink) |
| Well, I got back from Rat Shack, happy as a clam to have some new capacitors when, lo and behold... My conversion was off in my head, and thinking .022uF = 22pF turns out to be a mistake and it would seem my clock problems continue. It looked like, the only capacitor they carried in the pF scale was rated 100pF. I might've missed over something lower, but I'm not sure. How much of a problem would it be to use 100pF in place of a 15pF≤x≤33pF recommended cap? would it be a problem? And if so, how well would a 100pF cap work in an RC setup, where it's only recommended to be >20pF? | |
| |
| | (permalink) | |
| Quote:
The 'metal can with 2 leads' is a crystal, and it probably won't start up with 100pF. Don't confuse a crystal oscillator with an RC, they are very different. With an RC osc. the cap charges through the resistor, so using a cap which is five times as large, would take five times as long to charge. I don't think you have told us what PIC you are using; some have internal oscillators, which don't need anything other than configuration, and may be a better choice for you. | ||
| |
| | (permalink) | |
| Quote:
And I've said my PIC twice in this thread, once at the very beginning and once a post or two down from there. But I'll restate: I am trying to program a PIC16F872. I'm checking through the datasheet right now, but I don't think it supports internal oscillation; however, if anyone knows otherwise and can help me through it, it'd be easier than digging through the PDF over and over again. | ||
| |
| | (permalink) |
| Geesh MatrixPhreak, you don't need to be nasty. The guy was just trying to help. He doesn't necessarily know how much you know or don't know. Better to err on the side of newbieness just in case, so you don't have to go over it twice. Lighten up, dude!
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | |
| |
| | (permalink) | ||
| I didn't mean to be condescending, there is no need to get defensive; I was trying to help you. When you said: Quote:
Quote:
If you don't have access to components other than mail order, you might try an RC circuit. Microchip recommends charging a greater than 20pF cap through a minimum 3k resistor. If all you have is a 100pF, you could charge it through a 3k resistor which would give you an idea that your cct. was working. Last edited by BeeBop; 7th December 2007 at 10:16 PM. | |||
| |
| | (permalink) |
| Thanks, futz! | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Question about Inchworm+ | Quan | Micro Controllers | 54 | 28th October 2007 01:21 AM |
| my first 16F88 has me stumped | Hank Fletcher | Micro Controllers | 15 | 3rd August 2007 04:22 PM |
| Debugging 877A with MPLAB | williB | Micro Controllers | 10 | 7th May 2007 04:53 PM |
| Some Question About Inchworm | Ayne | Micro Controllers | 29 | 7th March 2007 04:08 AM |
| HT PICC + MPLAB | i2c2k | Micro Controllers | 0 | 10th April 2004 09:54 AM |