Each attribute in the configuration table below has two or more possible values associated with it.
e.g. the watchdog attribute (labelled field H ) has the possible values
one and only one of these values must be specified when configuring the CPU
- CFG_WDT_ON
- CFG_WDT_OFF
The 16f874a CPU has 9 configuration attributes (labelled field A to I in the table below). The attributes specific to the 16f874a CPU are defined in the file hwreg-p16f874a.h To correctly configure the 16f874a CPU each attribute must be set to a valid value. This is done by using one "pragma cpu_config" statement per attribute. A valid configuration for 16f874a would look like:
e.g. include "hwreg-p16f874a.h" pragma cpu_config CFG_CP_ALL pragma cpu_config CFG_WRT_OFF pragma cpu_config CFG_DEBUG_ON pragma cpu_config CFG_CPD_ON pragma cpu_config CFG_LVP_ON pragma cpu_config CFG_BODEN_ON pragma cpu_config CFG_PWRTE_ON pragma cpu_config CFG_WDT_ON pragma cpu_config CFG_RC_OSCNOTE: All attributes for a given processor must be specified, attributes for different processors may not be mixed.
Field Attribute XCSB value Description A Program Memory Code Protect CFG_CP_ALL code protect all program memory CFG_CP_OFF do not code protect any program memory B Program memory write protect CFG_WRT_OFF No prog memmory write protection CFG_WRT_256 First 256 prog memmory write protected CFG_WRT_1FOURTH First quarter prog memmory write protected CFG_WRT_HALF First half memmory write protected C In Circuit Debugging CFG_DEBUG_ON In Circuit Debugger disabled
CFG_DEBUG_OFF In Circuit Debugger enabled
D Data EEPROM code protect CFG_CPD_ON Data EEPROM is code protected CFG_CPD_OFF Data EEPROM is not protected E Low Voltage In-Circuit Programming CFG_LVP_ON Low Voltage in-circuit serial Programming enabled
CFG_LVP_OFF Low Voltage in-circuit serial Programming disabled
F Brown-Out Reset CFG_BODEN_ON Brown-Out Reset enabled CFG_BODEN_OFF Brown-Out Reset disabled G Power-Up Timer CFG_PWRTE_ON power-up timer enable CFG_PWRTE_OFF power-up timer disable H Watchdog timer CFG_WDT_ON watchdog timer enable CFG_WDT_OFF watchdog timer disable I Oscillator CFG_RC_OSC Resistor Capacitor (RC) oscillator CFG_HS_OSC High Speed Crystal / Resonator (HS) oscillator CFG_XT_OSC Crystal / Resonator (XT) oscillator CFG_LP_OSC Low Power Crystal (LP) oscillator