In microBasic PRO, I selectet new project, selected 18f4520, set project settings 8Mhz, in Edit Project selected "INT RC-CLKOUT on RA6,Port on RA7". The freq to read at RA6 is the feq used devided by 4 and I get 250hz, that is the pic runs at 1Mhz.
If I add the following in Main
OSCCON.B6 = 1
OSCCON.B5 = 1
OSCCON.B4 = 1
I get 2Mhz at A6, that is 8Mhz devided by 4
( OSCCON settings from page 32 on Data Sheet of Pic)
Did I miss something in Edit Project or are the config word send to PIC by
microBasic PRO wrong?
This OSCCON register workaround did take quite a bit of time for me and a lot of reading in the datasheets
18f4520 internal osc not running at 8Mhz with microBasic PRO
Bits 6-4 (IRCF2:IRCF0: Internal Oscillator Frequency Select bits) of the OSCCON register set the frequency - 1Mhz is the default. What you did is correct. Edit Project only sets the config bits of the MCU - see Section 23 of the data sheet (CONFIG1H register).
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
professional grade tools for FREE!!!
Hi,
You should consider MCU frequency setting as a place where you can tell the compiler what frequency you are going to use in your project, so when it does internal calculations for Delays and baud rates and other settings, it can do it precisely. Lots of calculations in PIC compilers are done by IDE, so you wouldn't waste your precious RAM on these devices due to memory and stack restrictions.
Best regards,
Aleksandar
You should consider MCU frequency setting as a place where you can tell the compiler what frequency you are going to use in your project, so when it does internal calculations for Delays and baud rates and other settings, it can do it precisely. Lots of calculations in PIC compilers are done by IDE, so you wouldn't waste your precious RAM on these devices due to memory and stack restrictions.
Best regards,
Aleksandar
Web Department Manager