Hi,
There IS a standard, basic, working most of the time configuration fuse setting already setup for each and every chip that the compiler supports. You don't have to set them in your code if the default is OK.
If you wan't to see how they "work" and what they are simply open the .inc file for the specific target you're compiling for, it's located in the root of the PBP folder. For the 16F886 the fileneme is 16F866.INC and looks like this:
Code:
NOLIST
ifdef PM_USED
LIST
include 'M16F88x.INC' ; PM header
device pic16F886, intrc_osc_noclkout, wdt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F886, r = dec, w = -302
INCLUDE "P16F886.INC" ; MPASM Header
__config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST
Now, the @ DEVICE statement is used when you're using PM as the assembler and the __CONFIG (note two underscores) is used when you're using MPASM as the assembler. If you're Win7 you can't use PM which means you're using MPASM which means @ DEVICE is the wrong "command".
In order to find out the "names" of the various fuses go to your MPASM folder and open the P16F886.INC file, at the end of that file you'll find this:
Code:
;==========================================================================
;
; Configuration Bits
;
;==========================================================================
_CONFIG1 EQU H'2007'
_CONFIG2 EQU H'2008'
;----- Configuration Word1 ------------------------------------------------
_DEBUG_ON EQU H'1FFF'
_DEBUG_OFF EQU H'3FFF'
_LVP_ON EQU H'3FFF'
_LVP_OFF EQU H'2FFF'
_FCMEN_ON EQU H'3FFF'
_FCMEN_OFF EQU H'37FF'
_IESO_ON EQU H'3FFF'
_IESO_OFF EQU H'3BFF'
_BOR_ON EQU H'3FFF'
_BOR_NSLEEP EQU H'3EFF'
_BOR_SBODEN EQU H'3DFF'
_BOR_OFF EQU H'3CFF'
_CPD_ON EQU H'3F7F'
_CPD_OFF EQU H'3FFF'
_CP_ON EQU H'3FBF'
_CP_OFF EQU H'3FFF'
_MCLRE_ON EQU H'3FFF'
_MCLRE_OFF EQU H'3FDF'
_PWRTE_ON EQU H'3FEF'
_PWRTE_OFF EQU H'3FFF'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FF7'
_LP_OSC EQU H'3FF8'
_XT_OSC EQU H'3FF9'
_HS_OSC EQU H'3FFA'
_EC_OSC EQU H'3FFB'
_INTRC_OSC_NOCLKOUT EQU H'3FFC'
_INTRC_OSC_CLKOUT EQU H'3FFD'
_EXTRC_OSC_NOCLKOUT EQU H'3FFE'
_EXTRC_OSC_CLKOUT EQU H'3FFF'
_INTOSCIO EQU H'3FFC'
_INTOSC EQU H'3FFD'
_EXTRCIO EQU H'3FFE'
_EXTRC EQU H'3FFF'
;----- Configuration Word2 ------------------------------------------------
_WRT_OFF EQU H'3FFF' ; No prog memmory write protection
_WRT_256 EQU H'3DFF' ; First 256 prog memmory write protected
_WRT_1FOURTH EQU H'3BFF' ; First quarter prog memmory write protected
_WRT_HALF EQU H'39FF' ; First half memmory write protected
_BOR21V EQU H'3EFF'
_BOR40V EQU H'3FFF'
So, to change the CONFIG fuses you have two options:
1) Edit the 16F866.INC file in the PBP folder to have the CONFIG you want/need. Do make a backup of the original file first.
2) Comment out the CONFIG from the 16F866.INC file and instead put them in your code.
/Henrik.
Bookmarks