Hi,
The .inc file Joe is referring to is located in the PBP directory - it's not the one in the MPASM directory. If you open it up you'll see something like this: (this is for another PIC though)
Code:
LIST
LIST p = 18F4220, r = dec, w = -302, f = inhx32
INCLUDE "P18F4220.INC" ; MPASM Header
__CONFIG _CONFIG1H, _XT_OSC_1H
__CONFIG _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _CCP2MX_ON_3H
__CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
It's these __CONFIG lines you're supposed to comment out in order to have them in your program OR you can edit them to suit your need in the .inc file directly but make sure you back up the original.
The file you're looking at (from the MPASM directory) is what defines names for the various CONFIG-settings (and everything else in the PIC) and it is what shows you WHICH cofig bits are available and in which CONFIG-word they are for that particular PIC.
As you can see, the .inc file from the MPASM directory is included in the project BY the .inc file in the PBP-directory (the line INCLUDE "P18F4220.INC" ; MPASM Header. It does this in order to allow you to, in your program, use "names" like PORTD, TRISD, TMR0 instead of the actual memory adress for the particular register.
Here's a part of the file you quoted earlier:
Code:
;----- CONFIG2H Options --------------------------------------------------
_WDTEN_OFF_2H EQU H'FE' ; WDT is controlled by SWDTEN bit of the WDTCON register
_WDTEN_ON_2H EQU H'FF' ; WDT is always enabled. SWDTEN bit has no effect.
_WDTPS_1_2H EQU H'E1' ; 1:1
_WDTPS_2_2H EQU H'E3' ; 1:2
_WDTPS_4_2H EQU H'E5' ; 1:4
_WDTPS_8_2H EQU H'E7' ; 1:8
This shows you the names for the "config options" available in the CONFIG2H word, so if you want to enable the Watchdog timer and set its prescaler to 1:4 you do:
Code:
@ __CONFIG _CONFIG2H, __WDTEN_ON2H & _WDTPS_4_2H
Now, this IS a confusing subject and it comes up here a lot. I usually use a bootloader and seldom mess with the CONFIG fuses in the program so I'm not very confident with it either but I hope I haven't screwed up my explanation, if I have I'm sure someone will jump in and straighten it out.
/Henrik.
Bookmarks