Here is some information on using the F88 internal oscillator.
The F88 internal clock uses two modes, a default 31.25Khz clock and a configurable one that can go up to 8Mhz.
The 31.25khz clock can be used as is by setting the clock setting to INTRC as Port IO or INTRC as Clock out.
In Flowcode set the Clock speed to 31250 (31.25Khz).
The configurable INTRC requires a bit more work as you need to set some registers for it to work.
The register you need to set is called osccon.
There are two bits to consider - the speed and the settings.
The speed is 0-7 giving 31.25KHz to 8MHz e.g. 7 = 8MHz.
For the settings I used E - 1: OSTS as primary, 1: IOFS stable, 10: INTRC as system clock. It worked for me so should be ok in general, but you may need different settings depending on precisely what you are doing.
Adding the two nibbles together in Hex format gives you the C code
osccon = 0x7E; // Set INTRC to 8MHZ
osccon = 0x5E; // Set INTRC to 2MHz
Note osccon is lowercase.
You will need to add this to Flowcode in a C Code Icon right at the start of the program.
In addition check that the Flowcode clock setting matches the speed (e.g. 8000000 for 8MHz).
Also check the PPP config and set the following:
Fail safe Clock monitoring = enabled.
Internal External switch over mode = enabled.
Info taken from PIC16F88 datasheet section 4.6.3
REGISTER 4-2: OSCCON: OSCILLATOR CONTROL REGISTER (ADDRESS 8Fh)
Bit 7 6 5 4 3 2 1 0
Not used IRCF2 IRCF1 IRCF0 OSTS IOFS SCS1 SCS0
bit 7 Unimplemented: Read as β€0β€™
bit 6-4 IRCF<2:0>: Internal RC Oscillator Frequency Select bits
000 = 31.25 kHz
001 = 125 kHz
010 = 250 kHz
011 = 500 kHz
100 = 1 MHz
101 = 2 MHz
110 = 4 MHz
111 = 8 MHz
bit 3 OSTS: Oscillator Start-up Time-out Status bit(1)
1 = Device is running from the primary system clock
0 = Device is running from T1OSC or INTRC as a secondary system clock
Note 1: Bit resets to β€0β€™ with Two-Speed Start-up mode and LP, XT or HS selected as the oscillator mode.
bit 2 IOFS: INTOSC Frequency Stable bit
1 = Frequency is stable
0 = Frequency is not stable
bit 1-0 SCS<1:0>: Oscillator Mode Select bits
00 = Oscillator mode defined by FOSC<2:0>
01 = T1OSC is used for system clock
10 = Internal RC is used for system clock
11 = Reserved
For questions and comments on programming in general. And for any items that don't fit into the forums below.
1 post • Page 1 of 1