|
|
View previous topic :: View next topic |
Author |
Message |
Regular Guy
Joined: 04 Jun 2017 Posts: 110
|
Programming PIC 18F14K50 With MPLAB IPE and PICKit 3 |
Posted: Thu Oct 05, 2017 12:50 pm |
|
|
Does the CCS C compiler set the internal oscillator?
That is when you just select the device and then compile.
Does the include file change if you are selecting different programmers in the
compiler?
Seems like it would if you select E3 mini board.
That uses external oscillator.
We want to use internal oscillator and a breadboard. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1346
|
|
Posted: Fri Oct 06, 2017 7:43 am |
|
|
I can't comment on the IPE program (maybe ask about that on the microchip forums), but I can on the CCS compiler at least.
The CCS compiler normally does exactly what you tell it to do. If you specify the internal oscillator (either by the fuses or the clock statement), barring any bugs, it will set the internal oscillator. If you don't specify, it will set the chip defaults (again, barring any bugs), which are specified by microchip. Normally the default is some sort of internal oscillator.
CCS doesn't have different headers based on programmers that I am aware of.
That said, I don't know what IPE does or if it changes files around. If it does, it does it outside of what CCS does.
I don't have your chip, but I commonly use PIC24 family chips, so I will use those as an example:
If I want to specify the internal oscillator, I normally have to do something like:
#FUSES NOPR //turns off the external oscillator/crystal circuit
#FUSES FRC //selects the standard internal oscillator.
alternately, on newer versions of the compiler, I can configure it using the clock statement:
#use delay(clock=8MHz, internal=8MHz) //uses the internal clock at 8 MHz
specifying the clock value tells the compiler how to do calculations, and specifying it as internal tells the compiler which fuses to set and any divides/multiplies need to get to the frequency.
#use delay(clock=8MHz) //compiler assumes the clock is 8MHz, but uses default settings...could be wrong
so summary of some example clock configs:
Relies on the FUSES to select the correct clock
Code: |
#FUSES NOPR //turns off the external oscillator/crystal circuit
#FUSES FRC //selects the standard internal oscillator.
#use delay(clock=8MHz)
|
Relies on the clock statement only
Code: |
#use delay(clock=8MHz, internal=8MHz)
|
Relies only on clock statement, also uses PLL (at 4x)
Code: |
#use delay(clock=32MHz, internal=8MHz)
|
Remember that all of these are PIC24 examples. PIC18 chips may be a bit different. |
|
|
Regular Guy
Joined: 04 Jun 2017 Posts: 110
|
|
Posted: Fri Oct 06, 2017 5:09 pm |
|
|
Here's 18F14K50 config section.
CONFIG CPUDIV = NOCLKDIV, USBDIV = OFF, FOSC = IRC, PLLEN = OFF
CONFIG PCLKEN = OFF, FCMEN = OFF, IESO = OFF, PWRTEN = OFF, BOREN = OFF
CONFIG BORV = 19, WDTEN = OFF, WDTPS = 1, MCLRE = OFF, HFOFST = OFF
CONFIG STVREN = OFF, LVP = OFF, BBSIZ = OFF, XINST = OFF, CP0 = OFF
CONFIG CP1 = OFF, CPB = OFF, CPD = OFF, WRT0 = OFF, WRTB = OFF
CONFIG WRTC = OFF, WRTD = OFF, EBTR0 = OFF, EBTR1 = OFF, EBTRB = OFF
It is quite a bit different than 16F.
So I will hold off before taking that on. |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|