With the instruction :
setup_oscillator( 0x00000260 );
The PIC runs well at 4MHz
I think there is a bug in the 16LF18426.h file and others 16LF184XX.h files
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Oct 15, 2019 3:30 am
Yes, it's a bug in the .h file values. The 16F18426 data sheet shows
that 0x02 is the correct value for the OSCFRQ register to get 4 MHz.
I suspect that someone at CCS was typing in the oscillator table and
and they made a typo and skipped a value. This also caused all values
after that one to be wrong.
A work-around is to let the #use delay() statement set the frequency.
That works. It's using an internal table in the PIC database file.
(Though, I was led to believe that the .h files were auto-generated from
the internal database. I guess not always the case).
Don't put in any oscillator fuses when you use this method.
The #use delay(internal=4M) statement does it all.
Example:
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