CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PROGRAMING WITH PICKIT2.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
DAVIDK
Guest







PROGRAMING WITH PICKIT2.
PostPosted: Thu Aug 13, 2009 6:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 11:59 am     Reply with quote

You need a continuous loop. You're missing that. See the following
post for an example of how to blink an LED:
http://www.ccsinfo.com/forum/viewtopic.php?t=38316&start=1
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 12:07 pm     Reply with quote

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. Laughing

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 Wink
davidK
Guest







thanks..
PostPosted: Sat Aug 15, 2009 11:01 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 15, 2009 3:23 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Sat Aug 15, 2009 11:58 pm     Reply with quote

'877A huh? Make sure you've got a pull-up resistor on the MCLR pin.

Rohit
davidk
Guest







PostPosted: Sun Aug 16, 2009 12:55 am     Reply with quote

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: 122
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Sun Aug 16, 2009 8:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Aug 16, 2009 1:22 pm     Reply with quote

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







PostPosted: Mon Aug 17, 2009 12:27 am     Reply with quote

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: 122
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Mon Aug 17, 2009 12:50 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group