I'm using a 12F683 and have been setting FOSC = INTOSCIO and everything is fine.
Then I changed things (extra info included, the only other thing I changed was the freq from 4MHz to 1MHz):
#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#define _XTAL_FREQ 1000000
#pragma config FOSC = INTOSC
This is so I can output the clock.
Now I get this error:
683_Shift_Reg.c:14:: error: (1363) unknown configuration setting/register (FOSC = INTOSC) used
Could I please have a clue as to where to look for the right command, cheers.
Set _XTAL_FREQ back to 4MHz?
Or:
Use your IDE to seach through the "library" code & header files for "_XTAL_FREQ" and how it is used.
It's likely that dependent on different ranges of values different settings are chosen, and the settings for 1MHz apparently do not agree with FOSC = INTOSC.
You can of course also search for those macro names.
Look in pic/dat/cfgdata/12f683.cfgdata-
INTOSCCLK is probably what you are looking for (or a couple other name variations).
cv007 is of course correct with INTOSCCLK
The way I would have found this is:
From the MPLABX IDE Select:
- Production
- Set Configuration Bits
- to the right of field FOSC select the down arrow
- choose from the drop-down list
Either "Generate Source Code To Output" and copy/paste the resulting output to your code window, or manually edit as you prefer
Probably I misunderstand. Do you want intosc out using the internal oscillator or a crystal?
The setting for 1MHz is b'0100xxxx' in the OSCCON register if using the internal oscillator. If using a crystal, it doesn't matter. Then in configuration, you need to define INTOSCIO or INTOSC and so forth.
Thank you all very much.
I wanted to output the internal oscillator. It wasn't the freq that was the problem, thanks, see below.
Thank you, the command: INTOSCCLK worked perfectly.
I had completely forgotten about the "Set Config Bits" pull-downs. I generally copy all that stuff from previous projects and alter the things I need to, hence my INTOSC error. I will use that in future, thank you.
Interestingly, I looked in the file, 12f683.cfgdata and found:
CVALUE:5:INTOSCCLK,_INTOSC,_INTRC_OSC_CLKOUT:INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
Of course, INTOSCCLK worked but, for fun, I tried: _INTOSC.
This output the clock at the expected freq but instead of being a nice, sharp square wave, it's edges were curved like you get when there is lots of capacitance around.
When I went back to INTOSCCLK it was the nice, sharp wave again.
Not a problem, just interesting.