4e701117ec332b89628cd6b216c345813a097d2e
[fw/sdcc] / device / include / pic / pic12f629.h
1 //
2 // Register Declarations for Microchip 12F629 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 P12F629_H
23 #define P12F629_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 GPIO_ADDR       0x0005
34 #define PCLATH_ADDR     0x000A
35 #define INTCON_ADDR     0x000B
36 #define PIR1_ADDR       0x000C
37 #define TMR1L_ADDR      0x000E
38 #define TMR1H_ADDR      0x000F
39 #define T1CON_ADDR      0x0010
40 #define CMCON_ADDR      0x0019
41 #define OPTION_REG_ADDR 0x0081
42 #define TRISIO_ADDR     0x0085
43 #define PIE1_ADDR       0x008C
44 #define PCON_ADDR       0x008E
45 #define OSCCAL_ADDR     0x0090
46 #define WPU_ADDR        0x0095
47 #define IOCB_ADDR       0x0096
48 #define IOC_ADDR        0x0096
49 #define VRCON_ADDR      0x0099
50 #define EEDATA_ADDR     0x009A
51 #define EEDAT_ADDR      0x009A
52 #define EEADR_ADDR      0x009B
53 #define EECON1_ADDR     0x009C
54 #define EECON2_ADDR     0x009D
55
56 //
57 // Memory organization.
58 //
59
60
61
62 //         LIST
63 // P12F629.INC  Standard Header File, Version 1.04    Microchip Technology, Inc.
64 //         NOLIST
65
66 // This header file defines configurations, registers, and other useful bits of
67 // information for the PIC12F629 microcontroller.  These names are taken to match 
68 // the data sheets as closely as possible.  
69
70 // Note that the processor must be selected before this file is 
71 // included.  The processor may be selected the following ways:
72
73 //       1. Command line switch:
74 //               C:\ MPASM MYFILE.ASM /PIC12F629
75 //       2. LIST directive in the source file
76 //               LIST   P=PIC12F629
77 //       3. Processor Type entry in the MPASM full-screen interface
78
79 //==========================================================================
80 //
81 //       Revision History
82 //
83 //==========================================================================
84 //1.04  07/01/02 Updated configuration bit names
85 //1.03  05/10/02 Added IOC register
86 //1.02  02/28/02 Updated per datasheet
87 //1.01  01/31/02 Updated per datasheet
88 //1.00   08/24/01 Original
89
90 //==========================================================================
91 //
92 //       Verify Processor
93 //
94 //==========================================================================
95
96 //        IFNDEF __12F629
97 //            MESSG "Processor-header file mismatch.  Verify selected processor."
98 //         ENDIF
99
100 //==========================================================================
101 //
102 //       Register Definitions
103 //
104 //==========================================================================
105
106 #define W                    0x0000
107 #define F                    0x0001
108
109 //----- Register Files------------------------------------------------------
110
111 extern __sfr  __at (INDF_ADDR)                    INDF;
112 extern __sfr  __at (TMR0_ADDR)                    TMR0;
113 extern __sfr  __at (PCL_ADDR)                     PCL;
114 extern __sfr  __at (STATUS_ADDR)                  STATUS;
115 extern __sfr  __at (FSR_ADDR)                     FSR;
116 extern __sfr  __at (GPIO_ADDR)                    GPIO;
117
118 extern __sfr  __at (PCLATH_ADDR)                  PCLATH;
119 extern __sfr  __at (INTCON_ADDR)                  INTCON;
120 extern __sfr  __at (PIR1_ADDR)                    PIR1;
121
122 extern __sfr  __at (TMR1L_ADDR)                   TMR1L;                
123 extern __sfr  __at (TMR1H_ADDR)                   TMR1H;                
124 extern __sfr  __at (T1CON_ADDR)                   T1CON;                
125
126 extern __sfr  __at (CMCON_ADDR)                   CMCON;                
127
128 extern __sfr  __at (OPTION_REG_ADDR)              OPTION_REG;
129
130 extern __sfr  __at (TRISIO_ADDR)                  TRISIO;
131
132 extern __sfr  __at (PIE1_ADDR)                    PIE1;
133
134 extern __sfr  __at (PCON_ADDR)                    PCON;
135
136 extern __sfr  __at (OSCCAL_ADDR)                  OSCCAL;
137
138 extern __sfr  __at (WPU_ADDR)                     WPU;
139 extern __sfr  __at (IOCB_ADDR)                    IOCB;
140 extern __sfr  __at (IOC_ADDR)                     IOC;
141
142 extern __sfr  __at (VRCON_ADDR)                   VRCON;
143 extern __sfr  __at (EEDATA_ADDR)                  EEDATA;       
144 extern __sfr  __at (EEDAT_ADDR)                   EEDAT;        
145 extern __sfr  __at (EEADR_ADDR)                   EEADR;        
146 extern __sfr  __at (EECON1_ADDR)                  EECON1;
147 extern __sfr  __at (EECON2_ADDR)                  EECON2;
148
149 //----- STATUS Bits --------------------------------------------------------
150
151
152 //----- GPIO Bits --------------------------------------------------------
153
154
155
156
157 //----- INTCON Bits --------------------------------------------------------
158
159
160 //----- PIR1 Bits ----------------------------------------------------------
161
162
163 //----- T1CON Bits ---------------------------------------------------------
164
165
166 //----- COMCON Bits --------------------------------------------------------
167
168
169 //----- OPTION Bits --------------------------------------------------------
170
171
172 //----- PIE1 Bits ----------------------------------------------------------
173
174
175 //----- PCON Bits ----------------------------------------------------------
176
177
178 //----- OSCCAL Bits --------------------------------------------------------
179
180
181 //----- IOCB Bits --------------------------------------------------------
182
183
184 //----- IOC Bits --------------------------------------------------------
185
186
187 //----- VRCON Bits ---------------------------------------------------------
188
189
190 //----- EECON1 -------------------------------------------------------------
191
192
193 //==========================================================================
194 //
195 //       RAM Definition
196 //
197 //==========================================================================
198
199 //         __MAXRAM H'FF'
200 //         __BADRAM H'06'-H'09', H'0D', H'11'-H'18', H'1A'-H'1F', H'60'-H'7F'
201 //         __BADRAM H'86'-H'89', H'8D', H'8F', H'91'-H'94', H'97'-H'98', H'9E'-H'9F', H'E0'-H'FF'
202
203 //==========================================================================
204 //
205 //       Configuration Bits
206 //
207 //==========================================================================
208
209 #define _CPD_ON              0x3EFF
210 #define _CPD_OFF             0x3FFF
211 #define _CP_ON               0x3F7F
212 #define _CP_OFF              0x3FFF
213 #define _BODEN_ON            0x3FFF
214 #define _BODEN_OFF           0x3FBF
215 #define _MCLRE_ON            0x3FFF
216 #define _MCLRE_OFF           0x3FDF
217 #define _PWRTE_OFF           0x3FFF
218 #define _PWRTE_ON            0x3FEF
219 #define _WDT_ON              0x3FFF
220 #define _WDT_OFF             0x3FF7
221 #define _LP_OSC              0x3FF8
222 #define _XT_OSC              0x3FF9
223 #define _HS_OSC              0x3FFA
224 #define _EC_OSC              0x3FFB
225 #define _INTRC_OSC_NOCLKOUT  0x3FFC
226 #define _INTRC_OSC_CLKOUT    0x3FFD
227 #define _EXTRC_OSC_NOCLKOUT  0x3FFE
228 #define _EXTRC_OSC_CLKOUT    0x3FFF
229
230 //         LIST
231
232 // ----- CMCON bits --------------------
233 typedef union {
234   struct {
235     unsigned char CM0:1;
236     unsigned char CM1:1;
237     unsigned char CM2:1;
238     unsigned char CIS:1;
239     unsigned char CINV:1;
240     unsigned char :1;
241     unsigned char COUT:1;
242     unsigned char :1;
243   };
244 } __CMCON_bits_t;
245 extern volatile __CMCON_bits_t __at(CMCON_ADDR) CMCON_bits;
246
247 #define CM0                  CMCON_bits.CM0
248 #define CM1                  CMCON_bits.CM1
249 #define CM2                  CMCON_bits.CM2
250 #define CIS                  CMCON_bits.CIS
251 #define CINV                 CMCON_bits.CINV
252 #define COUT                 CMCON_bits.COUT
253
254 // ----- EECON1 bits --------------------
255 typedef union {
256   struct {
257     unsigned char RD:1;
258     unsigned char WR:1;
259     unsigned char WREN:1;
260     unsigned char WRERR:1;
261     unsigned char :1;
262     unsigned char :1;
263     unsigned char :1;
264     unsigned char :1;
265   };
266 } __EECON1_bits_t;
267 extern volatile __EECON1_bits_t __at(EECON1_ADDR) EECON1_bits;
268
269 #define RD                   EECON1_bits.RD
270 #define WR                   EECON1_bits.WR
271 #define WREN                 EECON1_bits.WREN
272 #define WRERR                EECON1_bits.WRERR
273
274 // ----- GPIO bits --------------------
275 typedef union {
276   struct {
277     unsigned char GP0:1;
278     unsigned char GP1:1;
279     unsigned char GP2:1;
280     unsigned char GP3:1;
281     unsigned char GP4:1;
282     unsigned char GP5:1;
283     unsigned char :1;
284     unsigned char :1;
285   };
286   struct {
287     unsigned char GPIO0:1;
288     unsigned char GPIO1:1;
289     unsigned char GPIO2:1;
290     unsigned char GPIO3:1;
291     unsigned char GPIO4:1;
292     unsigned char GPIO5:1;
293     unsigned char :1;
294     unsigned char :1;
295   };
296 } __GPIO_bits_t;
297 extern volatile __GPIO_bits_t __at(GPIO_ADDR) GPIO_bits;
298
299 #define GP0                  GPIO_bits.GP0
300 #define GPIO0                GPIO_bits.GPIO0
301 #define GP1                  GPIO_bits.GP1
302 #define GPIO1                GPIO_bits.GPIO1
303 #define GP2                  GPIO_bits.GP2
304 #define GPIO2                GPIO_bits.GPIO2
305 #define GP3                  GPIO_bits.GP3
306 #define GPIO3                GPIO_bits.GPIO3
307 #define GP4                  GPIO_bits.GP4
308 #define GPIO4                GPIO_bits.GPIO4
309 #define GP5                  GPIO_bits.GP5
310 #define GPIO5                GPIO_bits.GPIO5
311
312 // ----- INTCON bits --------------------
313 typedef union {
314   struct {
315     unsigned char GPIF:1;
316     unsigned char INTF:1;
317     unsigned char T0IF:1;
318     unsigned char GPIE:1;
319     unsigned char INTE:1;
320     unsigned char T0IE:1;
321     unsigned char PEIE:1;
322     unsigned char GIE:1;
323   };
324 } __INTCON_bits_t;
325 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
326
327 #define GPIF                 INTCON_bits.GPIF
328 #define INTF                 INTCON_bits.INTF
329 #define T0IF                 INTCON_bits.T0IF
330 #define GPIE                 INTCON_bits.GPIE
331 #define INTE                 INTCON_bits.INTE
332 #define T0IE                 INTCON_bits.T0IE
333 #define PEIE                 INTCON_bits.PEIE
334 #define GIE                  INTCON_bits.GIE
335
336 // ----- IOC bits --------------------
337 typedef union {
338   struct {
339     unsigned char IOC0:1;
340     unsigned char IOC1:1;
341     unsigned char IOC2:1;
342     unsigned char IOC3:1;
343     unsigned char IOC4:1;
344     unsigned char IOC5:1;
345     unsigned char :1;
346     unsigned char :1;
347   };
348 } __IOC_bits_t;
349 extern volatile __IOC_bits_t __at(IOC_ADDR) IOC_bits;
350
351 #define IOC0                 IOC_bits.IOC0
352 #define IOC1                 IOC_bits.IOC1
353 #define IOC2                 IOC_bits.IOC2
354 #define IOC3                 IOC_bits.IOC3
355 #define IOC4                 IOC_bits.IOC4
356 #define IOC5                 IOC_bits.IOC5
357
358 // ----- IOCB bits --------------------
359 typedef union {
360   struct {
361     unsigned char IOCB0:1;
362     unsigned char IOCB1:1;
363     unsigned char IOCB2:1;
364     unsigned char IOCB3:1;
365     unsigned char IOCB4:1;
366     unsigned char IOCB5:1;
367     unsigned char :1;
368     unsigned char :1;
369   };
370 } __IOCB_bits_t;
371 extern volatile __IOCB_bits_t __at(IOCB_ADDR) IOCB_bits;
372
373 #define IOCB0                IOCB_bits.IOCB0
374 #define IOCB1                IOCB_bits.IOCB1
375 #define IOCB2                IOCB_bits.IOCB2
376 #define IOCB3                IOCB_bits.IOCB3
377 #define IOCB4                IOCB_bits.IOCB4
378 #define IOCB5                IOCB_bits.IOCB5
379
380 // ----- OPTION_REG bits --------------------
381 typedef union {
382   struct {
383     unsigned char PS0:1;
384     unsigned char PS1:1;
385     unsigned char PS2:1;
386     unsigned char PSA:1;
387     unsigned char T0SE:1;
388     unsigned char T0CS:1;
389     unsigned char INTEDG:1;
390     unsigned char NOT_GPPU:1;
391   };
392 } __OPTION_REG_bits_t;
393 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
394
395 #define PS0                  OPTION_REG_bits.PS0
396 #define PS1                  OPTION_REG_bits.PS1
397 #define PS2                  OPTION_REG_bits.PS2
398 #define PSA                  OPTION_REG_bits.PSA
399 #define T0SE                 OPTION_REG_bits.T0SE
400 #define T0CS                 OPTION_REG_bits.T0CS
401 #define INTEDG               OPTION_REG_bits.INTEDG
402 #define NOT_GPPU             OPTION_REG_bits.NOT_GPPU
403
404 // ----- OSCCAL bits --------------------
405 typedef union {
406   struct {
407     unsigned char :1;
408     unsigned char :1;
409     unsigned char CAL0:1;
410     unsigned char CAL1:1;
411     unsigned char CAL2:1;
412     unsigned char CAL3:1;
413     unsigned char CAL4:1;
414     unsigned char CAL5:1;
415   };
416 } __OSCCAL_bits_t;
417 extern volatile __OSCCAL_bits_t __at(OSCCAL_ADDR) OSCCAL_bits;
418
419 #define CAL0                 OSCCAL_bits.CAL0
420 #define CAL1                 OSCCAL_bits.CAL1
421 #define CAL2                 OSCCAL_bits.CAL2
422 #define CAL3                 OSCCAL_bits.CAL3
423 #define CAL4                 OSCCAL_bits.CAL4
424 #define CAL5                 OSCCAL_bits.CAL5
425
426 // ----- PCON bits --------------------
427 typedef union {
428   struct {
429     unsigned char NOT_BOD:1;
430     unsigned char NOT_POR:1;
431     unsigned char :1;
432     unsigned char :1;
433     unsigned char :1;
434     unsigned char :1;
435     unsigned char :1;
436     unsigned char :1;
437   };
438 } __PCON_bits_t;
439 extern volatile __PCON_bits_t __at(PCON_ADDR) PCON_bits;
440
441 #define NOT_BOD              PCON_bits.NOT_BOD
442 #define NOT_POR              PCON_bits.NOT_POR
443
444 // ----- PIE1 bits --------------------
445 typedef union {
446   struct {
447     unsigned char T1IE:1;
448     unsigned char :1;
449     unsigned char :1;
450     unsigned char CMIE:1;
451     unsigned char :1;
452     unsigned char :1;
453     unsigned char ADIE:1;
454     unsigned char EEIE:1;
455   };
456   struct {
457     unsigned char TMR1IE:1;
458     unsigned char :1;
459     unsigned char :1;
460     unsigned char :1;
461     unsigned char :1;
462     unsigned char :1;
463     unsigned char :1;
464     unsigned char :1;
465   };
466 } __PIE1_bits_t;
467 extern volatile __PIE1_bits_t __at(PIE1_ADDR) PIE1_bits;
468
469 #define T1IE                 PIE1_bits.T1IE
470 #define TMR1IE               PIE1_bits.TMR1IE
471 #define CMIE                 PIE1_bits.CMIE
472 #define ADIE                 PIE1_bits.ADIE
473 #define EEIE                 PIE1_bits.EEIE
474
475 // ----- PIR1 bits --------------------
476 typedef union {
477   struct {
478     unsigned char T1IF:1;
479     unsigned char :1;
480     unsigned char :1;
481     unsigned char CMIF:1;
482     unsigned char :1;
483     unsigned char :1;
484     unsigned char ADIF:1;
485     unsigned char EEIF:1;
486   };
487   struct {
488     unsigned char TMR1IF:1;
489     unsigned char :1;
490     unsigned char :1;
491     unsigned char :1;
492     unsigned char :1;
493     unsigned char :1;
494     unsigned char :1;
495     unsigned char :1;
496   };
497 } __PIR1_bits_t;
498 extern volatile __PIR1_bits_t __at(PIR1_ADDR) PIR1_bits;
499
500 #define T1IF                 PIR1_bits.T1IF
501 #define TMR1IF               PIR1_bits.TMR1IF
502 #define CMIF                 PIR1_bits.CMIF
503 #define ADIF                 PIR1_bits.ADIF
504 #define EEIF                 PIR1_bits.EEIF
505
506 // ----- STATUS bits --------------------
507 typedef union {
508   struct {
509     unsigned char C:1;
510     unsigned char DC:1;
511     unsigned char Z:1;
512     unsigned char NOT_PD:1;
513     unsigned char NOT_TO:1;
514     unsigned char RP0:1;
515     unsigned char RP1:1;
516     unsigned char IRP:1;
517   };
518 } __STATUS_bits_t;
519 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
520
521 #define C                    STATUS_bits.C
522 #define DC                   STATUS_bits.DC
523 #define Z                    STATUS_bits.Z
524 #define NOT_PD               STATUS_bits.NOT_PD
525 #define NOT_TO               STATUS_bits.NOT_TO
526 #define RP0                  STATUS_bits.RP0
527 #define RP1                  STATUS_bits.RP1
528 #define IRP                  STATUS_bits.IRP
529
530 // ----- T1CON bits --------------------
531 typedef union {
532   struct {
533     unsigned char TMR1ON:1;
534     unsigned char TMR1CS:1;
535     unsigned char NOT_T1SYNC:1;
536     unsigned char T1OSCEN:1;
537     unsigned char T1CKPS0:1;
538     unsigned char T1CKPS1:1;
539     unsigned char TMR1GE:1;
540     unsigned char :1;
541   };
542 } __T1CON_bits_t;
543 extern volatile __T1CON_bits_t __at(T1CON_ADDR) T1CON_bits;
544
545 #define TMR1ON               T1CON_bits.TMR1ON
546 #define TMR1CS               T1CON_bits.TMR1CS
547 #define NOT_T1SYNC           T1CON_bits.NOT_T1SYNC
548 #define T1OSCEN              T1CON_bits.T1OSCEN
549 #define T1CKPS0              T1CON_bits.T1CKPS0
550 #define T1CKPS1              T1CON_bits.T1CKPS1
551 #define TMR1GE               T1CON_bits.TMR1GE
552
553 // ----- VRCON bits --------------------
554 typedef union {
555   struct {
556     unsigned char VR0:1;
557     unsigned char VR1:1;
558     unsigned char VR2:1;
559     unsigned char VR3:1;
560     unsigned char :1;
561     unsigned char VRR:1;
562     unsigned char :1;
563     unsigned char VREN:1;
564   };
565 } __VRCON_bits_t;
566 extern volatile __VRCON_bits_t __at(VRCON_ADDR) VRCON_bits;
567
568 #define VR0                  VRCON_bits.VR0
569 #define VR1                  VRCON_bits.VR1
570 #define VR2                  VRCON_bits.VR2
571 #define VR3                  VRCON_bits.VR3
572 #define VRR                  VRCON_bits.VRR
573 #define VREN                 VRCON_bits.VREN
574
575 #endif