A macro specified in the htc.h header file is used to set device Configuration Words for PIC18 MCUs:
__CONFIG(n,x);
where
n |
Configuration register number. |
x |
Expression representing the value to which the specified Configuration bits will be set. May be literal but usually represented by a macro or macros ANDed together. |
Macros are specified in the device header file (*.h
) that
is located in the Windows OS default directory:
C:\Program Files\HI-TECH Software\PICC\vx.xx\include
where vx.xx
is the version number of the compiler.
Macro case should match what is in the relevant header. For
htc.c
, __CONFIG()
is correct but
__config()
is not.
In “HI-TECH C Tools for the PIC18 MCU Family,” see “Configuration Fuses.”
PICC-18 Example
#include <htc.h>
//Oscillator switch enabled, RC oscillator with OSC2 as I/O pin.
__CONFIG(1, LP);
//Watch Dog Timer enable, Watch Dog Timer PostScaler count - 1:128
__CONFIG(2, WDTEN & WDTPS128);