Next: 4.5.5 Linking and Assembling
Up: 4.5 The PIC14 port
Previous: 4.5.3 Interrupt Code
Contents
Index
Configuration bits (also known as fuses) can be configured using `__code'
and `__at' modifiers. Possible options should be ANDed
and can be found in your processor header file. Example for PIC16F88:
-
- #include <pic16f88.h> //Contains config addresses and options
#include <stdint.h> //Needed for uint16_t
static __code uint16_t __at (_CONFIG1) configword1 = _INTRC_IO &
_CP_ALL & _WDT_OFF & [...];
static __code uint16_t __at (_CONFIG2) configword2 = [...];
Although data type is ignored if the address (__at()) refers
to a config word location, using a type large enough for the configuration
word (uint16_t in this case) is recommended to prevent changes
in the compiler (implicit, early range check and enforcement) from
breaking the definition.
If your processor header file doesn't contain config addresses you
can declare it manually or use a literal address:
-
- static __code uint16_t __at (0x2007) configword1 = _INTRC_IO &
_CP_ALL & _WDT_OFF & [...];
2012-04-04