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 CCS Technical Support

12F509 oscillator selection v5.047

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



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

12F509 oscillator selection v5.047
PostPosted: Sat Dec 12, 2015 6:50 am     Reply with quote

Hy.
I have problems to select oscillator:
I try
#FUSES INTRC and he is on XT oscillator
#FUSES RC and he is on XT oscillator

and on old compiler v4.140 works perfect selection of oscillator
same code only changed version of compiler.
somebody know how to solve this problem?
thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sat Dec 12, 2015 9:42 am     Reply with quote

INTRC selects it correctly.

The only reason it "wouldn't" would probably be a syntax error in the clock statement. So:
Code:

#include <12F509.h>
#fuses INTRC
#use delay(CRYSTAL=4MHz)


Would select XT, not the internal RC, since the 'crystal' setting would override the INTRC setting.
'RC' is for an _external_ RC oscillator.

Code:

#include <12F509.h>
#fuses INTRC
#use delay(CLOCK=4MHz)


Merrily selects the internal RC oscillator, as does:
Code:

#include <12F509.h>
#use delay(INTERNAL=4MHz)


Standard comment, look at the lend of the listing file. You can see exactly what fuses the compiler is generating:
Code:

Configuration Fuses:
   Word  1: 001A   INTRC NOWDT NOPROTECT MCLR
nailuy



Joined: 21 Sep 2010
Posts: 159

View user's profile Send private message

PostPosted: Sat Dec 12, 2015 2:54 pm     Reply with quote

Yes Telmah is working.
Thank you.
PS
Where I find this information.
on help it isn't at #use delay this informations.
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sat Dec 12, 2015 3:23 pm     Reply with quote

Er. It is.....

From the manual:
Quote:

#USE DELAY (options))

Options may be any of the following separated by commas:

clock=speed speed is a constant 1-100000000 (1 hz to 100 mhz). This number can contains commas. This number also supports the following denominations: M, MHZ, K, KHZ. This specifies the clock the CPU runs at. Depending on the PIC this is 2 or 4 times the instruction rate. This directive is not needed if the following type=speed is used and there is no frequency multiplication or division.

type=speed type defines what kind of clock you are using, and the following values are valid: oscillator, osc (same as oscillator), crystal, xtal (same as crystal), internal, int (same as internal) or rc. The compiler will automatically set the oscillator configuration bits based upon your defined type. If you specified internal, the compiler will also automatically set the internal oscillator to the defined speed. Configuration fuses are modified when this option is used. Speed is the input frequency.


Also though, look at the examples. EX_8pin.c for example.
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