PDA

View Full Version : I Just Can't Get it to Blink - 16F628



Spindle
- 29th May 2005, 05:47
Hey guys and gals,

I have been working none stop for the last 3 days trying to get my pic to just blink an led. The pic is a 16F628. I am using the 18 pin prototyping board from http://www.dhmicro.com/prod_r18i.html I think I have hooked up everything correctly. No caps are blown. I am using the T0-220 v-reg so I can source more than 100milliamps. Anyways Here is my code. I am using Pic Basic Pro and the Epic Programmer. This is to flash the led on PORTB.4 and I am trying to use the internal oscillator.

@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT ' system clock options
@ DEVICE pic16F628, WDT_ON ' watchdog timer
@ DEVICE pic16F628, PWRT_ON ' power-on timer
@ DEVICE pic16F628, MCLR_OFF ' master clear options (internal)
@ DEVICE pic16F628, BOD_ON ' brown-out detect
@ DEVICE pic16F628, LVP_OFF ' low-voltage programming
@ DEVICE pic16F628, CPD_OFF ' data memory code Protect
@ DEVICE pic16F628, PROTECT_OFF ' program code protection


TRISB.4 = 0


LED VAR PORTB.4 ' alias PORTB.4 to LED

loop: High LED ' turn on LED connected to PORTB.4
Pause 500 ' delay for .5 seconds

Low LED ' turn off LED connected to PORTB.4
Pause 500 ' delay for .5 seconds

GoTo loop ' loop and blink LED forever

End


Thanks in advanced

Melanie
- 29th May 2005, 10:05
The program is good... so, have you wired it up correctly? Done something silly like put the LED in the wrong-way around? Got +5v on the right pin? Checked you've paid your electric bill?

sinoteq
- 29th May 2005, 14:09
I think Melanie is on to something, check +5V supply. If jumper JU2 (close to the ISCP connector in the Board Schematics) is missing things will not start. If it is missing programming will work but when you remove the Epic, +5V will not go to the PIC. Guess it is time to bring out the old voltmeter.

Spindle
- 29th May 2005, 17:41
I want to thank you both! The program was correct as Melanie stated and thanks sinoteq for looking at the schematic. Since I didn't want to use the boards ICSP for programming the pic I didn't even read that part of the document or look at that part of the schematic. All that was needed was two little jumpers! one of them being JU2 and the other a jumper for a diode. Thanks again!

Dwayne
- 31st May 2005, 15:54
Hello Melanie,

MM>Checked you've paid your electric bill?<<

I do enjoy your humor...