View previous topic :: View next topic |
Author |
Message |
Will_Esan
Joined: 17 Mar 2008 Posts: 7 Location: Norcross, GA
|
877A Wont Run |
Posted: Thu Mar 20, 2008 5:42 am |
|
|
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
|
|
Posted: Thu Mar 20, 2008 6:22 am |
|
|
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
|
|
Posted: Thu Mar 20, 2008 6:43 am |
|
|
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
|
|
Posted: Thu Mar 20, 2008 7:44 am |
|
|
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
|
|
Posted: Thu Mar 20, 2008 8:10 am |
|
|
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
|
|
Posted: Thu Mar 20, 2008 10:52 am |
|
|
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
|
|
Posted: Fri Mar 21, 2008 6:53 am |
|
|
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
|
|
Posted: Fri Mar 21, 2008 11:33 am |
|
|
What are you using for a programmer ? |
|
|
Will_Esan
Joined: 17 Mar 2008 Posts: 7 Location: Norcross, GA
|
|
Posted: Mon Mar 24, 2008 1:40 am |
|
|
I am using MPLAB 7.60 and ICD2 as a programmer. |
|
|
|