fe3c80be69afe285deb398a7b729d2677625266a
[fw/sdcc] / device / include / pic / pic16c71.h
1 //
2 // Register Declarations for Microchip 16C71 Processor
3 //
4 //
5 // This header file was automatically generated by:
6 //
7 //      inc2h.pl V4585
8 //
9 //      Copyright (c) 2002, Kevin L. Pauba, All Rights Reserved
10 //
11 //      SDCC is licensed under the GNU Public license (GPL) v2.  Note that
12 //      this license covers the code to the compiler and other executables,
13 //      but explicitly does not cover any code or objects generated by sdcc.
14 //      We have not yet decided on a license for the run time libraries, but
15 //      it will not put any requirements on code linked against it. See:
16 // 
17 //      http://www.gnu.org/copyleft/gpl/html
18 //
19 //      See http://sdcc.sourceforge.net/ for the latest information on sdcc.
20 //
21 // 
22 #ifndef P16C71_H
23 #define P16C71_H
24
25 //
26 // Register addresses.
27 //
28 #define INDF_ADDR       0x0000
29 #define TMR0_ADDR       0x0001
30 #define PCL_ADDR        0x0002
31 #define STATUS_ADDR     0x0003
32 #define FSR_ADDR        0x0004
33 #define PORTA_ADDR      0x0005
34 #define PORTB_ADDR      0x0006
35 #define ADCON0_ADDR     0x0008
36 #define ADRES_ADDR      0x0009
37 #define PCLATH_ADDR     0x000A
38 #define INTCON_ADDR     0x000B
39 #define OPTION_REG_ADDR 0x0081
40 #define TRISA_ADDR      0x0085
41 #define TRISB_ADDR      0x0086
42 #define ADCON1_ADDR     0x0088
43
44 //
45 // Memory organization.
46 //
47
48
49
50 //         LIST
51 // P16C71.INC  Standard Header File, Version 1.00    Microchip Technology, Inc.
52 //         NOLIST
53
54 // This header file defines configurations, registers, and other useful bits of
55 // information for the PIC16C71 microcontroller.  These names are taken to match 
56 // the data sheets as closely as possible.  
57
58 // Note that the processor must be selected before this file is 
59 // included.  The processor may be selected the following ways:
60
61 //       1. Command line switch:
62 //               C:\ MPASM MYFILE.ASM /PIC16C71
63 //       2. LIST directive in the source file
64 //               LIST   P=PIC16C71
65 //       3. Processor Type entry in the MPASM full-screen interface
66
67 //==========================================================================
68 //
69 //       Revision History
70 //
71 //==========================================================================
72
73 //Rev:   Date:    Reason:
74
75 //1.00   10/31/95 Initial Release
76
77 //==========================================================================
78 //
79 //       Verify Processor
80 //
81 //==========================================================================
82
83 //        IFNDEF __16C71
84 //            MESSG "Processor-header file mismatch.  Verify selected processor."
85 //         ENDIF
86
87 //==========================================================================
88 //
89 //       Register Definitions
90 //
91 //==========================================================================
92
93 #define W                    0x0000
94 #define F                    0x0001
95
96 //----- Register Files------------------------------------------------------
97
98 extern __sfr  __at (INDF_ADDR)                    INDF;
99 extern __sfr  __at (TMR0_ADDR)                    TMR0;
100 extern __sfr  __at (PCL_ADDR)                     PCL;
101 extern __sfr  __at (STATUS_ADDR)                  STATUS;
102 extern __sfr  __at (FSR_ADDR)                     FSR;
103 extern __sfr  __at (PORTA_ADDR)                   PORTA;
104 extern __sfr  __at (PORTB_ADDR)                   PORTB;
105 extern __sfr  __at (ADCON0_ADDR)                  ADCON0;
106 extern __sfr  __at (ADRES_ADDR)                   ADRES;
107 extern __sfr  __at (PCLATH_ADDR)                  PCLATH;
108 extern __sfr  __at (INTCON_ADDR)                  INTCON;
109
110 extern __sfr  __at (OPTION_REG_ADDR)              OPTION_REG;
111 extern __sfr  __at (TRISA_ADDR)                   TRISA;
112 extern __sfr  __at (TRISB_ADDR)                   TRISB;
113 extern __sfr  __at (ADCON1_ADDR)                  ADCON1;
114
115 //----- STATUS Bits --------------------------------------------------------
116
117
118 //----- ADCON0 Bits --------------------------------------------------------
119
120
121 //----- INTCON Bits --------------------------------------------------------
122
123
124 //----- OPTION Bits --------------------------------------------------------
125
126
127 //----- ADCON1 Bits --------------------------------------------------------
128
129
130 //==========================================================================
131 //
132 //       RAM Definition
133 //
134 //==========================================================================
135
136 //         __MAXRAM H'AF'
137 //         __BADRAM H'07', H'30'-H'7F', H'87'
138
139 //==========================================================================
140 //
141 //       Configuration Bits
142 //
143 //==========================================================================
144
145 #define _CP_ON               0x3FEF
146 #define _CP_OFF              0x3FFF
147 #define _PWRTE_ON            0x3FFF
148 #define _PWRTE_OFF           0x3FF7
149 #define _WDT_ON              0x3FFF
150 #define _WDT_OFF             0x3FFB
151 #define _LP_OSC              0x3FFC
152 #define _XT_OSC              0x3FFD
153 #define _HS_OSC              0x3FFE
154 #define _RC_OSC              0x3FFF
155
156 //         LIST
157
158 // ----- ADCON0 bits --------------------
159 typedef union {
160   struct {
161     unsigned char ADON:1;
162     unsigned char ADIF:1;
163     unsigned char GO:1;
164     unsigned char CHS0:1;
165     unsigned char CHS1:1;
166     unsigned char :1;
167     unsigned char ADCS0:1;
168     unsigned char ADCS1:1;
169   };
170   struct {
171     unsigned char :1;
172     unsigned char :1;
173     unsigned char NOT_DONE:1;
174     unsigned char :1;
175     unsigned char :1;
176     unsigned char :1;
177     unsigned char :1;
178     unsigned char :1;
179   };
180   struct {
181     unsigned char :1;
182     unsigned char :1;
183     unsigned char GO_DONE:1;
184     unsigned char :1;
185     unsigned char :1;
186     unsigned char :1;
187     unsigned char :1;
188     unsigned char :1;
189   };
190 } __ADCON0_bits_t;
191 extern volatile __ADCON0_bits_t __at(ADCON0_ADDR) ADCON0_bits;
192
193 #define ADON                 ADCON0_bits.ADON
194 #define ADIF                 ADCON0_bits.ADIF
195 #define GO                   ADCON0_bits.GO
196 #define NOT_DONE             ADCON0_bits.NOT_DONE
197 #define GO_DONE              ADCON0_bits.GO_DONE
198 #define CHS0                 ADCON0_bits.CHS0
199 #define CHS1                 ADCON0_bits.CHS1
200 #define ADCS0                ADCON0_bits.ADCS0
201 #define ADCS1                ADCON0_bits.ADCS1
202
203 // ----- ADCON1 bits --------------------
204 typedef union {
205   struct {
206     unsigned char PCFG0:1;
207     unsigned char PCFG1:1;
208     unsigned char :1;
209     unsigned char :1;
210     unsigned char :1;
211     unsigned char :1;
212     unsigned char :1;
213     unsigned char :1;
214   };
215 } __ADCON1_bits_t;
216 extern volatile __ADCON1_bits_t __at(ADCON1_ADDR) ADCON1_bits;
217
218 #define PCFG0                ADCON1_bits.PCFG0
219 #define PCFG1                ADCON1_bits.PCFG1
220
221 // ----- INTCON bits --------------------
222 typedef union {
223   struct {
224     unsigned char RBIF:1;
225     unsigned char INTF:1;
226     unsigned char T0IF:1;
227     unsigned char RBIE:1;
228     unsigned char INTE:1;
229     unsigned char T0IE:1;
230     unsigned char ADIE:1;
231     unsigned char GIE:1;
232   };
233 } __INTCON_bits_t;
234 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
235
236 #define RBIF                 INTCON_bits.RBIF
237 #define INTF                 INTCON_bits.INTF
238 #define T0IF                 INTCON_bits.T0IF
239 #define RBIE                 INTCON_bits.RBIE
240 #define INTE                 INTCON_bits.INTE
241 #define T0IE                 INTCON_bits.T0IE
242 #define ADIE                 INTCON_bits.ADIE
243 #define GIE                  INTCON_bits.GIE
244
245 // ----- OPTION_REG bits --------------------
246 typedef union {
247   struct {
248     unsigned char PS0:1;
249     unsigned char PS1:1;
250     unsigned char PS2:1;
251     unsigned char PSA:1;
252     unsigned char T0SE:1;
253     unsigned char T0CS:1;
254     unsigned char INTEDG:1;
255     unsigned char NOT_RBPU:1;
256   };
257 } __OPTION_REG_bits_t;
258 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
259
260 #define PS0                  OPTION_REG_bits.PS0
261 #define PS1                  OPTION_REG_bits.PS1
262 #define PS2                  OPTION_REG_bits.PS2
263 #define PSA                  OPTION_REG_bits.PSA
264 #define T0SE                 OPTION_REG_bits.T0SE
265 #define T0CS                 OPTION_REG_bits.T0CS
266 #define INTEDG               OPTION_REG_bits.INTEDG
267 #define NOT_RBPU             OPTION_REG_bits.NOT_RBPU
268
269 // ----- PORTA bits --------------------
270 typedef union {
271   struct {
272     unsigned char RA0:1;
273     unsigned char RA1:1;
274     unsigned char RA2:1;
275     unsigned char RA3:1;
276     unsigned char RA4:1;
277     unsigned char RA5:1;
278     unsigned char :1;
279     unsigned char :1;
280   };
281 } __PORTA_bits_t;
282 extern volatile __PORTA_bits_t __at(PORTA_ADDR) PORTA_bits;
283
284 #define RA0                  PORTA_bits.RA0
285 #define RA1                  PORTA_bits.RA1
286 #define RA2                  PORTA_bits.RA2
287 #define RA3                  PORTA_bits.RA3
288 #define RA4                  PORTA_bits.RA4
289 #define RA5                  PORTA_bits.RA5
290
291 // ----- PORTB bits --------------------
292 typedef union {
293   struct {
294     unsigned char RB0:1;
295     unsigned char RB1:1;
296     unsigned char RB2:1;
297     unsigned char RB3:1;
298     unsigned char RB4:1;
299     unsigned char RB5:1;
300     unsigned char RB6:1;
301     unsigned char RB7:1;
302   };
303 } __PORTB_bits_t;
304 extern volatile __PORTB_bits_t __at(PORTB_ADDR) PORTB_bits;
305
306 #define RB0                  PORTB_bits.RB0
307 #define RB1                  PORTB_bits.RB1
308 #define RB2                  PORTB_bits.RB2
309 #define RB3                  PORTB_bits.RB3
310 #define RB4                  PORTB_bits.RB4
311 #define RB5                  PORTB_bits.RB5
312 #define RB6                  PORTB_bits.RB6
313 #define RB7                  PORTB_bits.RB7
314
315 // ----- STATUS bits --------------------
316 typedef union {
317   struct {
318     unsigned char C:1;
319     unsigned char DC:1;
320     unsigned char Z:1;
321     unsigned char NOT_PD:1;
322     unsigned char NOT_TO:1;
323     unsigned char RP0:1;
324     unsigned char RP1:1;
325     unsigned char IRP:1;
326   };
327 } __STATUS_bits_t;
328 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
329
330 #define C                    STATUS_bits.C
331 #define DC                   STATUS_bits.DC
332 #define Z                    STATUS_bits.Z
333 #define NOT_PD               STATUS_bits.NOT_PD
334 #define NOT_TO               STATUS_bits.NOT_TO
335 #define RP0                  STATUS_bits.RP0
336 #define RP1                  STATUS_bits.RP1
337 #define IRP                  STATUS_bits.IRP
338
339 // ----- TRISA bits --------------------
340 typedef union {
341   struct {
342     unsigned char TRISA0:1;
343     unsigned char TRISA1:1;
344     unsigned char TRISA2:1;
345     unsigned char TRISA3:1;
346     unsigned char TRISA4:1;
347     unsigned char TRISA5:1;
348     unsigned char :1;
349     unsigned char :1;
350   };
351 } __TRISA_bits_t;
352 extern volatile __TRISA_bits_t __at(TRISA_ADDR) TRISA_bits;
353
354 #define TRISA0               TRISA_bits.TRISA0
355 #define TRISA1               TRISA_bits.TRISA1
356 #define TRISA2               TRISA_bits.TRISA2
357 #define TRISA3               TRISA_bits.TRISA3
358 #define TRISA4               TRISA_bits.TRISA4
359 #define TRISA5               TRISA_bits.TRISA5
360
361 // ----- TRISB bits --------------------
362 typedef union {
363   struct {
364     unsigned char TRISB0:1;
365     unsigned char TRISB1:1;
366     unsigned char TRISB2:1;
367     unsigned char TRISB3:1;
368     unsigned char TRISB4:1;
369     unsigned char TRISB5:1;
370     unsigned char TRISB6:1;
371     unsigned char TRISB7:1;
372   };
373 } __TRISB_bits_t;
374 extern volatile __TRISB_bits_t __at(TRISB_ADDR) TRISB_bits;
375
376 #define TRISB0               TRISB_bits.TRISB0
377 #define TRISB1               TRISB_bits.TRISB1
378 #define TRISB2               TRISB_bits.TRISB2
379 #define TRISB3               TRISB_bits.TRISB3
380 #define TRISB4               TRISB_bits.TRISB4
381 #define TRISB5               TRISB_bits.TRISB5
382 #define TRISB6               TRISB_bits.TRISB6
383 #define TRISB7               TRISB_bits.TRISB7
384
385 #endif