View previous topic :: View next topic |
Author |
Message |
nailuy
Joined: 21 Sep 2010 Posts: 159
|
12F509 oscillator selection v5.047 |
Posted: Sat Dec 12, 2015 6:50 am |
|
|
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: 19550
|
|
Posted: Sat Dec 12, 2015 9:42 am |
|
|
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
|
|
Posted: Sat Dec 12, 2015 2:54 pm |
|
|
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: 19550
|
|
Posted: Sat Dec 12, 2015 3:23 pm |
|
|
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. |
|
|
|