Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC18F's (Wheres the CONFIG words?)

Status
Not open for further replies.

kylemaes

Banned
Hey guys,

Im just wondering where the Config words are I cannot find them in the datasheet or anywhere. Also in high-tech c compiler, the config is
Code:
__CONFIG(/*****CONFIGBITS*****/);
I dont know what goes in there and im pretty sure im supposed to use CONFIG1,CONFIG2 etc..

The exact PIC im using is from my fake PICKIT2 a PIC18F2550 (Not actually out of the programmer). I bought it to use its USB feature but cant even get it to compile basic blinking led so gonna need help! Thankyou guys so much for helping me :p
 
Last edited:
They are set by doing,

__CONFIG(4,DEBUGEN & LVPDIS);

etc.

And you will find all the values in Appendix D of the HiTech manual.

Mike.
 
Thankyou so much :p

I have just moved on to C18 programming language as it is more common. Thankyou for the quick and usefull reply I will still use HTC on 16f and lower PICS!
 
Kyle, in C18 you can find the configs in the C18 libraries. It has a list of the settings and what they mean/do. If you know what you want to set, but don't know what to type in, you can go to Configure-->Configuration Bits in MPLAB. This will give you a list of what you can set.

Regards,
Der Strom
 
For C18, Microchip supplied a document that contained config settings (attached). However, they no longer maintain this document so the newer chips aren't in there.

Mike.
 

Attachments

  • C18_Config_Settings_51537e.pdf
    2.9 MB · Views: 292
Everything works swell on my PIC except interrupts but im getting help on that. Thankyou everyone for being a great help here is my massive config. (You dont need all the offs I think)

Code:
#pragma config  PLLDIV = 1, CPUDIV = OSC1_PLL2, USBDIV = 1, FOSC = HS, FCMEN = OFF, IESO = OFF
#pragma config  PWRT = ON,  BOR = OFF, VREGEN = OFF, WDT = OFF, PBADEN = OFF,  LPT1OSC = OFF,  MCLRE = OFF
#pragma config  STVREN = OFF,  LVP = OFF, DEBUG = OFF
 
On the contrary, be explicit. Write them all

Using ALL the "offs" is good help to you.

That way you will never have a minimal doubt of what setting you have for every bit in the initial configuration.

Forcing you to do that will reduce your chances of error. This way, unless your are an idiot, you will not neglect one.

Code:
  Processor 18F4431
  LIST  B=4, C=80, MM=ON, R=DEC, ST=ON, T=OFF

  INCLUDE "P18F4431.INC"
;------------------------------------------------------------------------------
  CONFIG  OSC =HSPLL  ,FCMEN =OFF   ,IESO =OFF    ,PWRTEN =OFF    ,BOREN =OFF
  CONFIG  BORV =27    ,WDTEN =OFF   ,WINEN =OFF   ,WDPS =1        ,T1OSCMX =OFF
  CONFIG  HPOL =HIGH  ,LPOL =LOW    ,PWMPIN =ON   ,MCLRE =ON      ,EXCLKMX =RC3
  CONFIG  PWM4MX =RB5 ,SSPMX =RC7   ,FLTAMX =RC1  ,STVREN =ON     ,LVP =OFF             
  CONFIG  DEBUG =OFF  ,CP0 =OFF     ,CP1 =OFF     ,CP2 =OFF       ,CP3 =OFF             
  CONFIG  CPB =OFF    ,CPD =OFF     ,WRT0 =OFF    ,WRT1 =OFF      ,WRT2 =OFF            
  CONFIG  WRT3 =OFF   ,WRTB =OFF    ,WRTC =ON     ,WRTD =OFF      ,EBTR0 =OFF           
  CONFIG  EBTR1 =OFF  ,EBTR2 =OFF   ,EBTR3 =OFF   ,EBTRB =OFF 
;-----------------------------------------------
 
Using ALL the "offs" is good help to you.

That way you will never have a minimal doubt of what setting you have for every bit in the initial configuration.

Forcing you to do that will reduce your chances of error. This way, unless your are an idiot, you will not neglect one.

Code:
  Processor 18F4431
  LIST  B=4, C=80, MM=ON, R=DEC, ST=ON, T=OFF

  INCLUDE "P18F4431.INC"
;------------------------------------------------------------------------------
  CONFIG  OSC =HSPLL  ,FCMEN =OFF   ,IESO =OFF    ,PWRTEN =OFF    ,BOREN =OFF
  CONFIG  BORV =27    ,WDTEN =OFF   ,WINEN =OFF   ,WDPS =1        ,T1OSCMX =OFF
  CONFIG  HPOL =HIGH  ,LPOL =LOW    ,PWMPIN =ON   ,MCLRE =ON      ,EXCLKMX =RC3
  CONFIG  PWM4MX =RB5 ,SSPMX =RC7   ,FLTAMX =RC1  ,STVREN =ON     ,LVP =OFF             
  CONFIG  DEBUG =OFF  ,CP0 =OFF     ,CP1 =OFF     ,CP2 =OFF       ,CP3 =OFF             
  CONFIG  CPB =OFF    ,CPD =OFF     ,WRT0 =OFF    ,WRT1 =OFF      ,WRT2 =OFF            
  CONFIG  WRT3 =OFF   ,WRTB =OFF    ,WRTC =ON     ,WRTD =OFF      ,EBTR0 =OFF           
  CONFIG  EBTR1 =OFF  ,EBTR2 =OFF   ,EBTR3 =OFF   ,EBTRB =OFF 
;-----------------------------------------------

I don't think you have to write them all. I never do. I usually only have to write 3 or 4. The only ones you have to change are the ones that you want to be different from the default. For example, the WDT defaults to ON, and in most cases you want it to be OFF, so there's one you'll have to set. Another one you'll have to change is the OSC, unless you plan to use the default oscillator. But you do not need to type them all out unless you're changing every single one from its default
 
Status
Not open for further replies.

Latest threads

Back
Top