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.

PIC 18F Configuratin word

Status
Not open for further replies.

dayanpad

New Member
Dear All I used following configuration word for PIC18F4520 in assembly. But it is showing compiling errors. please advice correct format
I insert #INCLUDE <P18C4520.INC> also
__CONFIG _CONFIG1, LPSCEN_OFF_1 & RCRA6_OSC_1
__CONFIG _CONFIG2, BORV_25_2 & BOREN_ON_2 & PWRTEN_OFF_2
__CONFIG _CONFIG3, WDPS_128_3 & WDT_ON_3
__CONFIG _CONFIG5, CCP2MX_ON_5
__CONFIG _CONFIG6, SVTREN_ON_6

Can I use this format for PIC18F __CONFIG _CONFIG1, LPSCEN_OFF_1 & RCRA6_OSC_1


Please advice
Thanks in advance
 

MaxHeadRoom78

Well-Known Member
Most Helpful Member
Note that Microchip made a change in the CONFIG format a while ago, you can see it in the .INC or the template file of the chip you are using.

e.g.
Code:
;
;   IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
;              superseded by the CONFIG directive.  The following settings
;              are available for this device.
; Example CONFIG.
;
     CONFIG FOSC = INTIO67, FCMEN = OFF, IESO = OFF
     ;Setup CONFIG2L
     CONFIG PWRT = ON, BOREN = OFF, BORV = 18
     ;Setup CONFIG2H
     CONFIG WDTEN = OFF, WDTPS = 1
     ;Setup CONFIG3H
     CONFIG MCLRE = ON, HFOFST = OFF, LPT1OSC = OFF, PBADEN = OFF
     ;Setup CONFIG4L
     CONFIG CCP2MX = PORTBE, STVREN = OFF, LVP = OFF, XINST = OFF, DEBUG = OFF
     ;Setup CONFIG5L
     CONFIG CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF
     ;Setup CONFIG5H
     CONFIG CPB = OFF, CPD = OFF
     ;Setup CONFIG6L
     CONFIG EBTR0 = OFF
     ;Setup CONFIG6H
     CONFIG EBTR1 = OFF
     ;Setup CONFIG7L
     CONFIG EBTR2 = OFF
     ;Setup CONFIG7H
     CONFIG EBTR3 = OFF
Max.
 
Last edited:

Les Jones

Well-Known Member
Most Helpful Member
Look at the include file with a text editor and check that all the config commands can be found in the include file.
If you have said "#INCLUDE <P18C4520.INC>" it will not work as I don't think there is such a chip. (I suspect this is just a typo in your post.)
I don't understand your _CONFIGn (Where n = 1 to 6) I suspect you are trying to put in alternative configs. If this is so then put in all of the config lines and comment out all except the one you are using. This is an example from a program I wrote to run on a PIC18F2431
Code:
;********************************************************
;
;  DC motor speed controller
;
;  Device : PIC18F2431 
;********************************************************

  list  p=PIC18F2431
  include  P18F2431.inc

;  list  p=PIC18F4431
;  include  P18F4431.inc



; CONFIG OSC = HS, LVP = OFF, BORV = 27, BOREN = ON, PWRTEN = ON, WDTEN = OFF, PWMPIN = OFF ; 20 Mhz, 20 Mhz xtal
CONFIG OSC = HSPLL, LVP = OFF, BORV = 27, BOREN = ON, PWRTEN = ON, WDTEN = OFF, PWMPIN = OFF; 40 Mhz 10 Mhz xtal
;  errorlevel  -302  ;Suppress bank warning

;****************  Label Definitions  ********************

; ******** Constants **********
;BAUD_CONSTANT EQU d'259'   ;Constant for baud generator for 19200 baud 20 Mhz (20 Mhz xtal osc = HS)
BAUD_CONSTANT EQU d'520'   ;Constant for baud generator for 19200 baud 40 Mhz (10 Mhz xtal osc = HSPLL)

SPEED_CONSTANT_L EQU 0x00 ;Constant to divide pulse period into to give speed value Low byte
SPEED_CONSTANT_M EQU 0x00 ;  Middle byte
SPEED_CONSTANT_H EQU 0x04 ;  High byte
The ";" character is the character to ad a comment the the assembler that I use. (MPASM)

Les.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top