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

can't create stand alone programs for the 16F877A

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



Joined: 01 Feb 2004
Posts: 19
Location: Cedar Rapids, IA

View user's profile Send private message MSN Messenger

can't create stand alone programs for the 16F877A
PostPosted: Tue Feb 03, 2004 1:59 pm     Reply with quote

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







PostPosted: Wed Feb 04, 2004 9:53 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Wed Feb 04, 2004 11:26 pm     Reply with quote

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








PostPosted: Thu Feb 05, 2004 12:33 am     Reply with quote

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

View user's profile Send private message MSN Messenger

still not working
PostPosted: Thu Feb 05, 2004 8:09 am     Reply with quote

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
PostPosted: Thu Feb 05, 2004 9:40 am     Reply with quote

Check the configuration bits in your hex file anyway. Especially NOLVP.
jamesjl



Joined: 22 Sep 2003
Posts: 52
Location: UK

View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger

PostPosted: Fri Feb 06, 2004 4:55 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 06, 2004 5:26 am     Reply with quote

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
PostPosted: Sat Feb 07, 2004 2:20 pm     Reply with quote

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

View user's profile Send private message MSN Messenger

found out what was wrong
PostPosted: Sun Feb 08, 2004 3:44 am     Reply with quote

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