Page 1 of 1
Pic12F1840 running Slow
Posted: Sun Jun 16, 2024 9:29 pm
by Alan_37
Hello
I have a problem with PIC12F1840 using the internal oscillator .
in the datasheet it states that the internal OSC frequency is from 31Khz to 32Mhz
but in the fuse config there are no settings to set the frequency of the internal OSC
The MCU is running only at 32Khz anyone know how do I make it run at 32Mhz please ?
Re: Pic12F1840 running Slow
Posted: Sun Jun 16, 2024 10:05 pm
by kersing
Usually there is a register with a name like osccon to configure the oscillator. Have you checked the
internal oscillator helper component?
Re: Pic12F1840 running Slow
Posted: Sun Jun 16, 2024 10:18 pm
by chipfryer27
Hi
I don't have that chip to try, but I think you will need to refer to the datasheet regarding the oscillator module configurations and / or device configurations, then include a C-Block icon containing the required code to set.
Flowcode has a great little helper called IntOsc Helper (Component Libraries > Runtime > IntOsc Helper )
Insert a C-Code block as your very first icon.
In this you set the desired frequency and the helper generates the required code. Copy this code into your C-Block.
It generated OSCCON = 0xF0; in my test but do check the bits are correct. Simply paste the generated code into the C-Block and you "should" be good. Remember to set clock speed under Other Options to match.
Regards
Edit....
Seems Kersing replied as I was typing

Re: Pic12F1840 running Slow
Posted: Sun Jun 16, 2024 11:29 pm
by Alan_37
HI , chipfryer27
OSCCON = 0xF0; worked perfectly now running at 32Mhz , thanks so much for you quick replay .
Did not know about the internal OSC helper I will check it out thanks Kersing .
Regards
Alan