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

877A Wont Run

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



Joined: 17 Mar 2008
Posts: 7
Location: Norcross, GA

View user's profile Send private message

877A Wont Run
PostPosted: Thu Mar 20, 2008 5:42 am     Reply with quote

Hi Guys,

I am new to CCS, I have just compiled a program for PIC16F877A and it works fine as long as it is connected through ICD. Whenever I supply 5V to PIC to run without ICD supply, It never runs...

Any Idea????

Will
Matro
Guest







PostPosted: Thu Mar 20, 2008 6:22 am     Reply with quote

Did you unplug the ICD or click on "Release reset"?
Which version of CCS are you using?
Have you got a "#FUSES NOLVP" in your code?

Matro
Will_Esan



Joined: 17 Mar 2008
Posts: 7
Location: Norcross, GA

View user's profile Send private message

PostPosted: Thu Mar 20, 2008 6:43 am     Reply with quote

Thanks for reply,

I am using 4.020

I am using following fuses
Code:

#include <16F877A.h>
#device adc=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES NOPUT                    //No 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=12000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)


Whenever I click on Release Reset PIC start working, It wont work without ICD.

Will
Matro
Guest







PostPosted: Thu Mar 20, 2008 7:44 am     Reply with quote

Please double-check that the MCLR pin of your PIC is pulled-up in its default state when it is powered by the power supply.

Matro.
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Thu Mar 20, 2008 8:10 am     Reply with quote

Maybe you have ICD=TRUE in your code either you placed it there or the CCS debugger put it there for you. Remove it if it is there and recompile without the debugger. Download and program your target chip directly without using the debugger to do the download. You should run ICD separately and choose the hex file or run ICD from within the CCS IDE if you use it. I assume your MCLR is setup ( 47k pullup) is good otherwise I doubt the debugger would run.
The debugger is not a passive thing. In order to debug code the code is first enhanced (ICD=true) by adding code to your code that will allow the debugger to control things. The enhanced code is downloaded to you target PIC chip and then the debugger takes over. Naturally without the debugger to control things this enhanced code will not run. This could be your issue. Compiling and downloading (programming) without the debug enhancement will allow normal operation of your code.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Mar 20, 2008 10:52 am     Reply with quote

Will didn't say so but he must be using MPLAB. Now in MPLAB there is a small gotcha that got me confused in the beginning: you can select what debugger tool and what programmer tool you want to use.

When you select the ICD2 as a debugger tool then this has the same effect as setting the directive 'ICD=TRUE' in your code. On programming the chip MPLAB will overrule the fuse settings in your hex file and activate the debug flag. Your PIC will only run when connected to the debugger.

If you want to program your PIC for standalone operation you will have to configure MPLAB to use your ICD2 as a programmer. Select menu 'Programmer/Select Programmer/ICD2'. It is not possible to have the same hardware active as debugger and programmer at the same time, MPLAB v7.40 and higher will disable the other function when you switch tasks.


People working with the CCS toolset have to set the 'ICD=TRUE' directive in their code in order to activate debugging. This requires recompiling code. In MPLAB you never use that directive, you just configure what hardware to use for debugging and programming (with the above mentioned confusion if you want to use the same device for both tasks). It's just another approach to the same problem.
Will_Esan



Joined: 17 Mar 2008
Posts: 7
Location: Norcross, GA

View user's profile Send private message

PostPosted: Fri Mar 21, 2008 6:53 am     Reply with quote

Yes I am using MPLAB. But I am not using ICD2 as debugger tool, I am using MPLAB SIM as debugger tool and it works fine. MCLR pin is also pulled up to default state.

Cant figure out where I went wrong
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 21, 2008 11:33 am     Reply with quote

What are you using for a programmer ?
Will_Esan



Joined: 17 Mar 2008
Posts: 7
Location: Norcross, GA

View user's profile Send private message

PostPosted: Mon Mar 24, 2008 1:40 am     Reply with quote

I am using MPLAB 7.60 and ICD2 as a programmer.
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