Fixed several pointer related bugs in the PIC port
[fw/sdcc] / src / regression / configword.c
1 /* configword.c - illustrates how the configuration word can
2  * be assigned */
3
4 unsigned char success=0;
5 unsigned char failures=0;
6 unsigned char dummy=0;
7
8 /* copied from 16f877.inc file supplied with gpasm */
9
10 #define _CP_ALL          0x0FCF
11 #define _CP_HALF         0x1FDF
12 #define _CP_UPPER_256    0x2FEF
13 #define _CP_OFF          0x3FFF
14 #define _DEBUG_ON        0x37FF
15 #define _DEBUG_OFF       0x3FFF
16 #define _WRT_ENABLE_ON   0x3FFF
17 #define _WRT_ENABLE_OFF  0x3DFF
18 #define _CPD_ON          0x3EFF
19 #define _CPD_OFF         0x3FFF
20 #define _LVP_ON          0x3FFF
21 #define _LVP_OFF         0x3F7F
22 #define _BODEN_ON        0x3FFF
23 #define _BODEN_OFF       0x3FBF
24 #define _PWRTE_OFF       0x3FFF
25 #define _PWRTE_ON        0x3FF7
26 #define _WDT_ON          0x3FFF
27 #define _WDT_OFF         0x3FFB
28 #define _LP_OSC          0x3FFC
29 #define _XT_OSC          0x3FFD
30 #define _HS_OSC          0x3FFE
31 #define _RC_OSC          0x3FFF
32
33 typedef unsigned int word;
34
35 word at 0x2007  CONFIG = _WDT_OFF & _PWRTE_ON;
36
37
38 /* to do -- write a test that puts the PIC to sleep,
39  * and verify that the WDT wakes it up */
40
41 void done()
42 {
43
44   dummy++;
45
46 }
47 void main(void)
48 {
49   dummy = 0;
50
51   success = failures;
52   done();
53 }