newbie mistakes15 Aug 2007 I'm getting annoyed with the PIC business.
It's one thing to create a working assembler program and upload it to a PIC. Running the PIC on my experiment board (Velleman K8048) gives no problems, but when I plug the PIC onto a breadboard, it does absolutely nothing.
So how to debug this stuff ?
Well, the first thing I did was look at the toggles that activate parts of the PIC hardware. Toggles like "Select oscillator type". It seemed that I had this set to "_XT_OSC" which means a crystal oscillator. I didn't have that on my board. I replaced it with "_INTRC_OSC_NOCLKOUT", which makes the PIC use the internal oscillator and doesn't do anything with the CLKOUT pin.
This didn't work either.
The K8048 has 2 jumpers that link the 4MHz crystal to the PIC. I pulled those out and the PIC still ran fine.
So what is it now ? I thought I could just connect GND and +5V to the PIC and it would run ? No such luck...
After setting the oscillator type to "_INTRC_OSC_CLKOUT" to enable the CLKOUT pin, I couldn't see anything on that pin with an oscilloscope. I should have seen the generated clock on that pin.
I have no idea how to debug this. Maybe someone can lend me a hand ?
After a long time of searching, I was ready to throw something heavy at something fragile. Good thing I took a break to watch some "Band Of Brothers" DVD.
After that, I took another look at things. People have been telling me that all I needed to connect was the Vss (ground) and Vdd (+5V) pins.
I finally found this page:
After assembling and burning the above program, we are ready to
see it in action. The running circuit can be built in a jiffy - place +5V
on the VDD pin of the PIC (pin 14), connect Vss (pin 5) to circuit
ground, connect MCLR (pin 4) to +5V through a 2K resistor,
connect the LED between RB0 and Gnd with a current limiting
resistor of say 1K in series - and that's all.
Again, the MCLR pin surfaces. This time I actually tried to find what it was all about. The MCLR pin according to the 16F627 datasheet:
Master clear. When configured as MCLR, this
pin is an active low RESET to the device.
Voltage on MCLR/VPP must not exceed VDD
during normal device operation.
This means that, unless Vdd is set on the MCLR pin, my PIC was constantly being reset :)
After connecting the MCLR pin to +5V, my leds started to blink.
Yay for manuals !