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

dspic30f programming problem

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



Joined: 09 Dec 2012
Posts: 14

View user's profile Send private message

dspic30f programming problem
PostPosted: Mon Mar 11, 2013 3:21 am     Reply with quote

I'm having a problem with dspic30f6014a programming. I have edited the code using CCS compiler PCW v4.104. When I import the hex file into MPLAB IDE v8.83, I get the following message:
" The configuration bits in the file are invalid and may cause problems if programmed.
Do you want to set them to their default value?
Please note that you will need to either rebuild the file or export memory again to correct the file.
Config Field : FOSFPR "

I tried to change the configuration bits manually from MPLAB "Configure" menu but the problem is still exist. Any help please ? The C code for configuration is:
Code:
#include <30f6014a.h>
#device adc=10
#fuses XT_PLL8, NOWDT, NOBROWNOUT, NOPUT
#use delay(clock=58.9824M,oscillator=7.3728M)
#use rs232(baud=9600,parity=N,UART1,bits=8)
#include <math.h>
Ttelmah



Joined: 11 Mar 2010
Posts: 19350

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 4:25 am     Reply with quote

I'd suspect the problem is coming from one thing overriding another.
Your 'clock', and 'oscillator' frequencies are not exactly 8* each other. Now if I try your combination of fuses and clock settings, the compiler 'baulks' and the fuses are wrong in the file. However simplify slightly, and:
Code:

#include <30F6014A.h>
#FUSES WPSA8,WPSB1,XT_PLL8, NOCKSFSM, NOWDT, PUT,NOBROWNOUT
#use delay(clock=58982400)

and the fuses look acceptable.

Load this into MPLAB, and it doesn't complain.
I'd always say use the PUT with a crystal, unless you are using the dual speed startup.

'oscillator=X', will select EC, not XT. 'crystal=X' would be the right selection, but only use the 'double' selection if you want the compiler to try to select the PLL. Given you have selected it yourself, just put the final clock rate.


Best Wishes
AbuSaleh



Joined: 09 Dec 2012
Posts: 14

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 4:45 am     Reply with quote

Thank you Ttelmah for your quick reply. I have copied your code to my program, but when I compile it by CCS I get the following error:
Error 111 : Unknown keyword in #FUSES "PUT"

What do you think the problem is ?

Thanx
AbuSaleh



Joined: 09 Dec 2012
Posts: 14

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 5:13 am     Reply with quote

Hi Ttelmah !
I went to the PCW pull down menu VIEW | Valid fuses and it showed all fuses with their descriptions. Regarding PUT fuse there are 3 types; PUT4, PUT16 and PUT64. And in the description it says that the numbers 4, 16 and 64 mean 4ms, 16ms and 64ms, respectively, but I dont know which one to choose. Any suggestions ?

Thanx
Ttelmah



Joined: 11 Mar 2010
Posts: 19350

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 5:29 am     Reply with quote

Depends how long your crystal needs to settle, but 4mSec should be plenty. If you don't specify 'NOPUT' (which is what I did), it defaults to PUT64.

Best Wishes
AbuSaleh



Joined: 09 Dec 2012
Posts: 14

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 1:00 pm     Reply with quote

Thanks alot !
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