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