Pic12F1840 running Slow

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Alan_37
Posts: 186
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 54 times
Been thanked: 26 times

Pic12F1840 running Slow

Post 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 ?

kersing
Valued Contributor
Posts: 193
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 79 times
Been thanked: 64 times

Re: Pic12F1840 running Slow

Post by kersing »

Usually there is a register with a name like osccon to configure the oscillator. Have you checked the internal oscillator helper component?

chipfryer27
Valued Contributor
Posts: 1685
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: Pic12F1840 running Slow

Post 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 :)

Alan_37
Posts: 186
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 54 times
Been thanked: 26 times

Re: Pic12F1840 running Slow

Post 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

Post Reply