View previous topic :: View next topic |
Author |
Message |
DAVIDK Guest
|
PROGRAMING WITH PICKIT2. |
Posted: Thu Aug 13, 2009 6:04 am |
|
|
Hi
I don't know if this forum is the right for that,
I use a pickit2 programmer to program pics that fit to my board.
Now I am trying to program pic16f877 with this programmer and the software can identify the pic, but after burn I can't see a led blink.
I heard that people had problems with this PIC and this programmer.
Code: |
#include <16F877A.h>
#fuses HS,NOPROTECT,NOLVP,NOWDT
#use delay(clock=20000000)
VOID MAIN()
{
output_high(pin_d1);
delay_ms(2000);
output_low(pin_d1);
delay_ms(2000);
} |
If you know why I can't see the led please tell me.
Thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Thu Aug 13, 2009 12:07 pm |
|
|
I use pickit2 all the time. And didn't have problems with programming of PIC-s .... when the functioning was in question I was the main source of good or bad behaviour.
Try with this code:
Code: | #include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock=20000000)
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while (1)
{
output_toggle(pin_d1);
delay_ms(1000);
}
} |
And report back |
|
|
davidK Guest
|
thanks.. |
Posted: Sat Aug 15, 2009 11:01 am |
|
|
I will try this one.
The code I posted was wrong because I forgot the while(1) but it didn't work anyway, for some other reason.
I heard of many people having problems programing with pickit 2 the 16f877.
I know there is some issue about the power supply, and that he needs to get the power from outside ? I wired the pgc and pgd and all others but failed.
bungee, do you have the connections to this pic ?? |
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Sat Aug 15, 2009 3:23 pm |
|
|
I'm using my own universal ZIF connector with PICKit2 (works with ICD2 also) and I have no programming issues whatsoever.
Currently I do not possess any 16F877 that I could run it for test.
My universal ZIF connector can be used at will and schematics and pcb in eagle format can be found here: https://sites.google.com/site/bungeesite |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Sat Aug 15, 2009 11:58 pm |
|
|
'877A huh? Make sure you've got a pull-up resistor on the MCLR pin.
Rohit |
|
|
davidk Guest
|
|
Posted: Sun Aug 16, 2009 12:55 am |
|
|
Its just not working !!
I can't program this pic with the pickit2 !
I have a pull up.
I connected the vcc vpp pgc pgd and gnd. and the programer says that it programs successfuly ! So what is this pic problem ! I have spent hours on that and after program the led is just off ! The c code is the one that someone gave me in this post.
Tried also to ground the pgd or power it.
I can see on the net that so many people facing a problem with this 16f877.
Don't know what else to do. |
|
|
Jerson
Joined: 31 Jul 2009 Posts: 125 Location: Bombay, India
|
|
Posted: Sun Aug 16, 2009 8:46 am |
|
|
Are you using a crystal (XT) or a resonator(HS)?
Also, MCLR ought to connect to the PICKIT2. Pickit2 has 5 connections
VDD,GND, MCLR, PGC, PGD. I have all 5 connect to the PIC for it to program. _________________ Regards
Jerson Fernandes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 16, 2009 1:22 pm |
|
|
How do you propose that we can fix it ? This is the CCS forum, not the
Microchip Programmer forum. Here's the link for that:
http://www.microchip.com/forums/tt.aspx?forumid=15
Read the two "sticky" threads at the top of that forum. It's obvious that
having the latest firmware is very important for the Pickit 2.
My advice is, if the Pickit 2 doesn't work with your PIC, then buy another
PIC that it does work with (a different type than 16F877). Check the
Microchip chip forum to make sure there are no complaints about the
Pickit 2 working with your new type of PIC, before you buy it. |
|
|
davidk Guest
|
|
Posted: Mon Aug 17, 2009 12:27 am |
|
|
to Jerson : i use internal osc.(hs) . is that a problem?
to pcm programer: i can see that most of the questions in this forum are hardware so i cant see any problem.
take a look, MOST of the problems are hardware. even you answer them.
but thank you anyway. |
|
|
Jerson
Joined: 31 Jul 2009 Posts: 125 Location: Bombay, India
|
|
Posted: Mon Aug 17, 2009 12:50 am |
|
|
David
I'm not sure as I haven't used a 877 till now. A quick check on the datasheet suggested to use the 887 which I have used. The 887 has an internal RC oscillator.
If you still want to stick with the 877, I suggest you use a crystal and set the oscillator type to XT. Or, if you use a resonator, set the type to HS.
Regards _________________ Regards
Jerson Fernandes |
|
|
|