4015b5e26ace970d8f2a5c69265b590e92a54373
[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 V1.7
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 __data __at (INDF_ADDR) volatile char      INDF;
112 extern __sfr  __at (TMR0_ADDR)                    TMR0;
113 extern __data __at (PCL_ADDR) volatile char       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 //----- CMCON 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 // ----- GPIO bits --------------------
255 typedef union {
256   struct {
257     unsigned char GP0:1;
258     unsigned char GP1:1;
259     unsigned char GP2:1;
260     unsigned char GP3:1;
261     unsigned char GP4:1;
262     unsigned char GP5:1;
263     unsigned char :1;
264     unsigned char :1;
265   };
266   struct {
267     unsigned char GPIO0:1;
268     unsigned char GPIO1:1;
269     unsigned char GPIO2:1;
270     unsigned char GPIO3:1;
271     unsigned char GPIO4:1;
272     unsigned char GPIO5:1;
273     unsigned char :1;
274     unsigned char :1;
275   };
276 } __GPIO_bits_t;
277 extern volatile __GPIO_bits_t __at(GPIO_ADDR) GPIO_bits;
278
279 #define GP0                  GPIO_bits.GP0
280 #define GPIO0                GPIO_bits.GPIO0
281 #define GP1                  GPIO_bits.GP1
282 #define GPIO1                GPIO_bits.GPIO1
283 #define GP2                  GPIO_bits.GP2
284 #define GPIO2                GPIO_bits.GPIO2
285 #define GP3                  GPIO_bits.GP3
286 #define GPIO3                GPIO_bits.GPIO3
287 #define GP4                  GPIO_bits.GP4
288 #define GPIO4                GPIO_bits.GPIO4
289 #define GP5                  GPIO_bits.GP5
290 #define GPIO5                GPIO_bits.GPIO5
291
292 // ----- INTCON bits --------------------
293 typedef union {
294   struct {
295     unsigned char GPIF:1;
296     unsigned char INTF:1;
297     unsigned char T0IF:1;
298     unsigned char GPIE:1;
299     unsigned char INTE:1;
300     unsigned char T0IE:1;
301     unsigned char PEIE:1;
302     unsigned char GIE:1;
303   };
304 } __INTCON_bits_t;
305 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
306
307 #define GPIF                 INTCON_bits.GPIF
308 #define INTF                 INTCON_bits.INTF
309 #define T0IF                 INTCON_bits.T0IF
310 #define GPIE                 INTCON_bits.GPIE
311 #define INTE                 INTCON_bits.INTE
312 #define T0IE                 INTCON_bits.T0IE
313 #define PEIE                 INTCON_bits.PEIE
314 #define GIE                  INTCON_bits.GIE
315
316 // ----- IOC bits --------------------
317 typedef union {
318   struct {
319     unsigned char IOC0:1;
320     unsigned char IOC1:1;
321     unsigned char IOC2:1;
322     unsigned char IOC3:1;
323     unsigned char IOC4:1;
324     unsigned char IOC5:1;
325     unsigned char :1;
326     unsigned char :1;
327   };
328 } __IOC_bits_t;
329 extern volatile __IOC_bits_t __at(IOC_ADDR) IOC_bits;
330
331 #define IOC0                 IOC_bits.IOC0
332 #define IOC1                 IOC_bits.IOC1
333 #define IOC2                 IOC_bits.IOC2
334 #define IOC3                 IOC_bits.IOC3
335 #define IOC4                 IOC_bits.IOC4
336 #define IOC5                 IOC_bits.IOC5
337
338 // ----- IOCB bits --------------------
339 typedef union {
340   struct {
341     unsigned char IOCB0:1;
342     unsigned char IOCB1:1;
343     unsigned char IOCB2:1;
344     unsigned char IOCB3:1;
345     unsigned char IOCB4:1;
346     unsigned char IOCB5:1;
347     unsigned char :1;
348     unsigned char :1;
349   };
350 } __IOCB_bits_t;
351 extern volatile __IOCB_bits_t __at(IOCB_ADDR) IOCB_bits;
352
353 #define IOCB0                IOCB_bits.IOCB0
354 #define IOCB1                IOCB_bits.IOCB1
355 #define IOCB2                IOCB_bits.IOCB2
356 #define IOCB3                IOCB_bits.IOCB3
357 #define IOCB4                IOCB_bits.IOCB4
358 #define IOCB5                IOCB_bits.IOCB5
359
360 // ----- OPTION_REG bits --------------------
361 typedef union {
362   struct {
363     unsigned char PS0:1;
364     unsigned char PS1:1;
365     unsigned char PS2:1;
366     unsigned char PSA:1;
367     unsigned char T0SE:1;
368     unsigned char T0CS:1;
369     unsigned char INTEDG:1;
370     unsigned char NOT_GPPU:1;
371   };
372 } __OPTION_REG_bits_t;
373 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
374
375 #define PS0                  OPTION_REG_bits.PS0
376 #define PS1                  OPTION_REG_bits.PS1
377 #define PS2                  OPTION_REG_bits.PS2
378 #define PSA                  OPTION_REG_bits.PSA
379 #define T0SE                 OPTION_REG_bits.T0SE
380 #define T0CS                 OPTION_REG_bits.T0CS
381 #define INTEDG               OPTION_REG_bits.INTEDG
382 #define NOT_GPPU             OPTION_REG_bits.NOT_GPPU
383
384 // ----- OSCCAL bits --------------------
385 typedef union {
386   struct {
387     unsigned char :1;
388     unsigned char :1;
389     unsigned char CAL0:1;
390     unsigned char CAL1:1;
391     unsigned char CAL2:1;
392     unsigned char CAL3:1;
393     unsigned char CAL4:1;
394     unsigned char CAL5:1;
395   };
396 } __OSCCAL_bits_t;
397 extern volatile __OSCCAL_bits_t __at(OSCCAL_ADDR) OSCCAL_bits;
398
399 #define CAL0                 OSCCAL_bits.CAL0
400 #define CAL1                 OSCCAL_bits.CAL1
401 #define CAL2                 OSCCAL_bits.CAL2
402 #define CAL3                 OSCCAL_bits.CAL3
403 #define CAL4                 OSCCAL_bits.CAL4
404 #define CAL5                 OSCCAL_bits.CAL5
405
406 // ----- PCON bits --------------------
407 typedef union {
408   struct {
409     unsigned char NOT_BOD:1;
410     unsigned char NOT_POR:1;
411     unsigned char :1;
412     unsigned char :1;
413     unsigned char :1;
414     unsigned char :1;
415     unsigned char :1;
416     unsigned char :1;
417   };
418 } __PCON_bits_t;
419 extern volatile __PCON_bits_t __at(PCON_ADDR) PCON_bits;
420
421 #define NOT_BOD              PCON_bits.NOT_BOD
422 #define NOT_POR              PCON_bits.NOT_POR
423
424 // ----- PIE1 bits --------------------
425 typedef union {
426   struct {
427     unsigned char T1IE:1;
428     unsigned char :1;
429     unsigned char :1;
430     unsigned char CMIE:1;
431     unsigned char :1;
432     unsigned char :1;
433     unsigned char ADIE:1;
434     unsigned char EEIE:1;
435   };
436   struct {
437     unsigned char TMR1IE:1;
438     unsigned char :1;
439     unsigned char :1;
440     unsigned char :1;
441     unsigned char :1;
442     unsigned char :1;
443     unsigned char :1;
444     unsigned char :1;
445   };
446 } __PIE1_bits_t;
447 extern volatile __PIE1_bits_t __at(PIE1_ADDR) PIE1_bits;
448
449 #define T1IE                 PIE1_bits.T1IE
450 #define TMR1IE               PIE1_bits.TMR1IE
451 #define CMIE                 PIE1_bits.CMIE
452 #define ADIE                 PIE1_bits.ADIE
453 #define EEIE                 PIE1_bits.EEIE
454
455 // ----- PIR1 bits --------------------
456 typedef union {
457   struct {
458     unsigned char T1IF:1;
459     unsigned char :1;
460     unsigned char :1;
461     unsigned char CMIF:1;
462     unsigned char :1;
463     unsigned char :1;
464     unsigned char ADIF:1;
465     unsigned char EEIF:1;
466   };
467   struct {
468     unsigned char TMR1IF:1;
469     unsigned char :1;
470     unsigned char :1;
471     unsigned char :1;
472     unsigned char :1;
473     unsigned char :1;
474     unsigned char :1;
475     unsigned char :1;
476   };
477 } __PIR1_bits_t;
478 extern volatile __PIR1_bits_t __at(PIR1_ADDR) PIR1_bits;
479
480 #define T1IF                 PIR1_bits.T1IF
481 #define TMR1IF               PIR1_bits.TMR1IF
482 #define CMIF                 PIR1_bits.CMIF
483 #define ADIF                 PIR1_bits.ADIF
484 #define EEIF                 PIR1_bits.EEIF
485
486 // ----- STATUS bits --------------------
487 typedef union {
488   struct {
489     unsigned char C:1;
490     unsigned char DC:1;
491     unsigned char Z:1;
492     unsigned char NOT_PD:1;
493     unsigned char NOT_TO:1;
494     unsigned char RP0:1;
495     unsigned char RP1:1;
496     unsigned char IRP:1;
497   };
498 } __STATUS_bits_t;
499 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
500
501 #define C                    STATUS_bits.C
502 #define DC                   STATUS_bits.DC
503 #define Z                    STATUS_bits.Z
504 #define NOT_PD               STATUS_bits.NOT_PD
505 #define NOT_TO               STATUS_bits.NOT_TO
506 #define RP0                  STATUS_bits.RP0
507 #define RP1                  STATUS_bits.RP1
508 #define IRP                  STATUS_bits.IRP
509
510 // ----- T1CON bits --------------------
511 typedef union {
512   struct {
513     unsigned char TMR1ON:1;
514     unsigned char TMR1CS:1;
515     unsigned char NOT_T1SYNC:1;
516     unsigned char T1OSCEN:1;
517     unsigned char T1CKPS0:1;
518     unsigned char T1CKPS1:1;
519     unsigned char TMR1GE:1;
520     unsigned char :1;
521   };
522 } __T1CON_bits_t;
523 extern volatile __T1CON_bits_t __at(T1CON_ADDR) T1CON_bits;
524
525 #define TMR1ON               T1CON_bits.TMR1ON
526 #define TMR1CS               T1CON_bits.TMR1CS
527 #define NOT_T1SYNC           T1CON_bits.NOT_T1SYNC
528 #define T1OSCEN              T1CON_bits.T1OSCEN
529 #define T1CKPS0              T1CON_bits.T1CKPS0
530 #define T1CKPS1              T1CON_bits.T1CKPS1
531 #define TMR1GE               T1CON_bits.TMR1GE
532
533 // ----- VRCON bits --------------------
534 typedef union {
535   struct {
536     unsigned char VR0:1;
537     unsigned char VR1:1;
538     unsigned char VR2:1;
539     unsigned char VR3:1;
540     unsigned char :1;
541     unsigned char VRR:1;
542     unsigned char :1;
543     unsigned char VREN:1;
544   };
545   struct {
546     unsigned char RD:1;
547     unsigned char WR:1;
548     unsigned char WREN:1;
549     unsigned char WRERR:1;
550     unsigned char :1;
551     unsigned char :1;
552     unsigned char :1;
553     unsigned char :1;
554   };
555 } __VRCON_bits_t;
556 extern volatile __VRCON_bits_t __at(VRCON_ADDR) VRCON_bits;
557
558 #define VR0                  VRCON_bits.VR0
559 #define RD                   VRCON_bits.RD
560 #define VR1                  VRCON_bits.VR1
561 #define WR                   VRCON_bits.WR
562 #define VR2                  VRCON_bits.VR2
563 #define WREN                 VRCON_bits.WREN
564 #define VR3                  VRCON_bits.VR3
565 #define WRERR                VRCON_bits.WRERR
566 #define VRR                  VRCON_bits.VRR
567 #define VREN                 VRCON_bits.VREN
568
569 #endif