View previous topic :: View next topic |
Author |
Message |
sapy44
Joined: 01 Feb 2004 Posts: 19 Location: Cedar Rapids, IA
|
can't create stand alone programs for the 16F877A |
Posted: Tue Feb 03, 2004 1:59 pm |
|
|
Hello again all,
I'm new to PIC programming abd have run into a snag. I was working through the exercise booklet that comes with the CCS beginers development kit.
It seems to be that by removing the #device ICD=TRUE statement, the complier will generate the program as a stand alone program. No ICD required to start the program, it should just run after a reset.
So when I remove this statement from the program header, it seems the program runs up to the first line of C code and then stops. I've verified this by changing the first line of code to light up the different color LEDs. In each case it lit up the LED, but then locked up.
I've also noticed that even though the ICD is not supposed to be fuctioning I can still use it to start and stop the program succesfully after reconnecting it.
Have any of you had a similar problem ? What do you all think might the problem, and how would you suggest I fix it ? Any inputs would be appreciated. |
|
|
jj Guest
|
|
Posted: Wed Feb 04, 2004 9:53 am |
|
|
Do you have the correct oscillator options set for your stand alone board?
Also have you tied MCLR up to Vdd. |
|
|
sapy44
Joined: 01 Feb 2004 Posts: 19 Location: Cedar Rapids, IA
|
|
Posted: Wed Feb 04, 2004 11:26 pm |
|
|
Yes my clock settings are correct. The MCLR pin is held hight through an onboard pull-up. The issue probably lies in the compilier. Any thoughts ?[/quote] |
|
|
Guest
|
|
Posted: Thu Feb 05, 2004 12:33 am |
|
|
Check your configuration bits both with ICD=TRUE set and without, most likley your missing NOLVP in your fuses statement. |
|
|
sapy44
Joined: 01 Feb 2004 Posts: 19 Location: Cedar Rapids, IA
|
still not working |
Posted: Thu Feb 05, 2004 8:09 am |
|
|
I read in an earlier post that removing the IC=TRUE line may cause the the improper fuses from being set. In my program however the #fuses derrective is on it's own seperate line. Therefore removing the ICD=TRUE statement should not affect it. I think the root cause must be something else. Anyt thooughs or insights would be appreciated. |
|
|
Guest
|
Assume nothing |
Posted: Thu Feb 05, 2004 9:40 am |
|
|
Check the configuration bits in your hex file anyway. Especially NOLVP. |
|
|
jamesjl
Joined: 22 Sep 2003 Posts: 52 Location: UK
|
|
Posted: Fri Feb 06, 2004 4:55 am |
|
|
V3.183 had a bug with the fuses. Make sure you are using V3.184 and all the fuses issues will be OK.
Jason. |
|
|
Al
Joined: 13 Nov 2003 Posts: 28 Location: Belfast
|
|
Posted: Fri Feb 06, 2004 5:26 am |
|
|
I noticed you said that you could still run it from the ICD - try disconnecting the ICD cable from the PIC after you have downloaded the firmware, then power cycle your PIC.
Are you using I/O statements?
Did you have #use rs232(debugger); if so you may need to change it to something like below , as you cannot output to the debugger in stand alone mode.
#use rs232(baud=4800, parity=N, bits=8, xmit=PIN_C6, rcv=PIN_C7)
Another thing worth checking is that you have removed any I/O statements such as printf, putc, getc etc, which you may have used while working in debug mode, which you don't now need. _________________ Alan Murray |
|
|
Bill Turnip Guest
|
Stand alone |
Posted: Sat Feb 07, 2004 2:20 pm |
|
|
I had similar problems. It seems that when I program my parts for stand-alone mode using the ICD, the configuration settings in my code are "overruled" by the settings of the ICD programmer.
Simple test: Leave the "ICD = True" statement in your code, but program your part with the ICD "Enable debug" option selected, and then try again with this option unselected. See if the part toggles from stand-alone mode to ICD debug mode. Mine did.
HTH,
Bill |
|
|
sapy44
Joined: 01 Feb 2004 Posts: 19 Location: Cedar Rapids, IA
|
found out what was wrong |
Posted: Sun Feb 08, 2004 3:44 am |
|
|
After talking to CCS I've found the solution to the problem. Bascially I was going by what the exercise booklet said to do. They said to remove the ICD=TRUE derective and then recompile the program with the ICD debug window opened and in automatic reload mode after compile.
For some still unknown reason the program still loads up with the debug feature on.
CCS said to remove the ICD=TRUE line and recompile. Then to use the ICD tool, not the debugger, to load up the new program. This seems to do the trick. It works fine after that.
So there you have it. Still not sure why it doesn't work in the one mode. But thanks for all the advice. |
|
|
|