* .version: bumped version to 2.5.6 (pic14 ABI changed)
[fw/sdcc] / device / include / pic / pic16f84a.h
1 //
2 // Register Declarations for Microchip 16F84A Processor
3 //
4 //
5 // This header file was automatically generated by:
6 //
7 //      inc2h.pl V1.6
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 P16F84A_H
23 #define P16F84A_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 EEDATA_ADDR     0x0008
36 #define EEADR_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 EECON1_ADDR     0x0088
43 #define EECON2_ADDR     0x0089
44
45 //
46 // Memory organization.
47 //
48
49 #pragma memmap INDF_ADDR INDF_ADDR SFR 0x000    // INDF
50 #pragma memmap TMR0_ADDR TMR0_ADDR SFR 0x000    // TMR0
51 #pragma memmap PCL_ADDR PCL_ADDR SFR 0x000      // PCL
52 #pragma memmap STATUS_ADDR STATUS_ADDR SFR 0x000        // STATUS
53 #pragma memmap FSR_ADDR FSR_ADDR SFR 0x000      // FSR
54 #pragma memmap PORTA_ADDR PORTA_ADDR SFR 0x000  // PORTA
55 #pragma memmap PORTB_ADDR PORTB_ADDR SFR 0x000  // PORTB
56 #pragma memmap EEDATA_ADDR EEDATA_ADDR SFR 0x000        // EEDATA
57 #pragma memmap EEADR_ADDR EEADR_ADDR SFR 0x000  // EEADR
58 #pragma memmap PCLATH_ADDR PCLATH_ADDR SFR 0x000        // PCLATH
59 #pragma memmap INTCON_ADDR INTCON_ADDR SFR 0x000        // INTCON
60 #pragma memmap OPTION_REG_ADDR OPTION_REG_ADDR SFR 0x000        // OPTION_REG
61 #pragma memmap TRISA_ADDR TRISA_ADDR SFR 0x000  // TRISA
62 #pragma memmap TRISB_ADDR TRISB_ADDR SFR 0x000  // TRISB
63 #pragma memmap EECON1_ADDR EECON1_ADDR SFR 0x000        // EECON1
64 #pragma memmap EECON2_ADDR EECON2_ADDR SFR 0x000        // EECON2
65
66
67 //         LIST
68 // P16F84A.INC  Standard Header File, Version 2.00    Microchip Technology, Inc.
69 //         NOLIST
70
71 // This header file defines configurations, registers, and other useful bits of
72 // information for the PIC16F84 microcontroller.  These names are taken to match 
73 // the data sheets as closely as possible.  
74
75 // Note that the processor must be selected before this file is 
76 // included.  The processor may be selected the following ways:
77
78 //       1. Command line switch:
79 //               C:\ MPASM MYFILE.ASM /PIC16F84A
80 //       2. LIST directive in the source file
81 //               LIST   P=PIC16F84A
82 //       3. Processor Type entry in the MPASM full-screen interface
83
84 //==========================================================================
85 //
86 //       Revision History
87 //
88 //==========================================================================
89
90 //Rev:   Date:    Reason:
91
92 //1.00   2/15/99 Initial Release
93
94 //==========================================================================
95 //
96 //       Verify Processor
97 //
98 //==========================================================================
99
100 //        IFNDEF __16F84A
101 //            MESSG "Processor-header file mismatch.  Verify selected processor."
102 //         ENDIF
103
104 //==========================================================================
105 //
106 //       Register Definitions
107 //
108 //==========================================================================
109
110 #define W                    0x0000
111 #define F                    0x0001
112
113 //----- Register Files------------------------------------------------------
114
115 extern data __at (INDF_ADDR) volatile char      INDF;
116 extern sfr  __at (TMR0_ADDR)                    TMR0;
117 extern data __at (PCL_ADDR) volatile char       PCL;
118 extern sfr  __at (STATUS_ADDR)                  STATUS;
119 extern sfr  __at (FSR_ADDR)                     FSR;
120 extern sfr  __at (PORTA_ADDR)                   PORTA;
121 extern sfr  __at (PORTB_ADDR)                   PORTB;
122 extern sfr  __at (EEDATA_ADDR)                  EEDATA;
123 extern sfr  __at (EEADR_ADDR)                   EEADR;
124 extern sfr  __at (PCLATH_ADDR)                  PCLATH;
125 extern sfr  __at (INTCON_ADDR)                  INTCON;
126
127 extern sfr  __at (OPTION_REG_ADDR)              OPTION_REG;
128 extern sfr  __at (TRISA_ADDR)                   TRISA;
129 extern sfr  __at (TRISB_ADDR)                   TRISB;
130 extern sfr  __at (EECON1_ADDR)                  EECON1;
131 extern sfr  __at (EECON2_ADDR)                  EECON2;
132
133 //----- STATUS Bits --------------------------------------------------------
134
135
136 //----- INTCON Bits --------------------------------------------------------
137
138
139 //----- OPTION Bits ----------------------------------------------------
140
141
142 //----- EECON1 Bits --------------------------------------------------------
143
144
145 //==========================================================================
146 //
147 //       RAM Definition
148 //
149 //==========================================================================
150
151 //         __MAXRAM H'CF'
152 //         __BADRAM H'07', H'50'-H'7F', H'87'
153
154 //==========================================================================
155 //
156 //       Configuration Bits
157 //
158 //==========================================================================
159
160 #define _CP_ON               0x000F
161 #define _CP_OFF              0x3FFF
162 #define _PWRTE_ON            0x3FF7
163 #define _PWRTE_OFF           0x3FFF
164 #define _WDT_ON              0x3FFF
165 #define _WDT_OFF             0x3FFB
166 #define _LP_OSC              0x3FFC
167 #define _XT_OSC              0x3FFD
168 #define _HS_OSC              0x3FFE
169 #define _RC_OSC              0x3FFF
170
171 //         LIST
172
173 // ----- EECON1 bits --------------------
174 typedef union {
175   struct {
176     unsigned char RD:1;
177     unsigned char WR:1;
178     unsigned char WREN:1;
179     unsigned char WRERR:1;
180     unsigned char EEIF:1;
181     unsigned char :1;
182     unsigned char :1;
183     unsigned char :1;
184   };
185 } __EECON1_bits_t;
186 extern volatile __EECON1_bits_t __at(EECON1_ADDR) EECON1_bits;
187
188 #define RD                   EECON1_bits.RD
189 #define WR                   EECON1_bits.WR
190 #define WREN                 EECON1_bits.WREN
191 #define WRERR                EECON1_bits.WRERR
192 #define EEIF                 EECON1_bits.EEIF
193
194 // ----- INTCON bits --------------------
195 typedef union {
196   struct {
197     unsigned char RBIF:1;
198     unsigned char INTF:1;
199     unsigned char T0IF:1;
200     unsigned char RBIE:1;
201     unsigned char INTE:1;
202     unsigned char T0IE:1;
203     unsigned char EEIE:1;
204     unsigned char GIE:1;
205   };
206 } __INTCON_bits_t;
207 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
208
209 #define RBIF                 INTCON_bits.RBIF
210 #define INTF                 INTCON_bits.INTF
211 #define T0IF                 INTCON_bits.T0IF
212 #define RBIE                 INTCON_bits.RBIE
213 #define INTE                 INTCON_bits.INTE
214 #define T0IE                 INTCON_bits.T0IE
215 #define EEIE                 INTCON_bits.EEIE
216 #define GIE                  INTCON_bits.GIE
217
218 // ----- OPTION_REG bits --------------------
219 typedef union {
220   struct {
221     unsigned char PS0:1;
222     unsigned char PS1:1;
223     unsigned char PS2:1;
224     unsigned char PSA:1;
225     unsigned char T0SE:1;
226     unsigned char T0CS:1;
227     unsigned char INTEDG:1;
228     unsigned char NOT_RBPU:1;
229   };
230 } __OPTION_REG_bits_t;
231 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
232
233 #define PS0                  OPTION_REG_bits.PS0
234 #define PS1                  OPTION_REG_bits.PS1
235 #define PS2                  OPTION_REG_bits.PS2
236 #define PSA                  OPTION_REG_bits.PSA
237 #define T0SE                 OPTION_REG_bits.T0SE
238 #define T0CS                 OPTION_REG_bits.T0CS
239 #define INTEDG               OPTION_REG_bits.INTEDG
240 #define NOT_RBPU             OPTION_REG_bits.NOT_RBPU
241
242 // ----- STATUS bits --------------------
243 typedef union {
244   struct {
245     unsigned char C:1;
246     unsigned char DC:1;
247     unsigned char Z:1;
248     unsigned char NOT_PD:1;
249     unsigned char NOT_TO:1;
250     unsigned char RP0:1;
251     unsigned char RP1:1;
252     unsigned char IRP:1;
253   };
254 } __STATUS_bits_t;
255 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
256
257 #define C                    STATUS_bits.C
258 #define DC                   STATUS_bits.DC
259 #define Z                    STATUS_bits.Z
260 #define NOT_PD               STATUS_bits.NOT_PD
261 #define NOT_TO               STATUS_bits.NOT_TO
262 #define RP0                  STATUS_bits.RP0
263 #define RP1                  STATUS_bits.RP1
264 #define IRP                  STATUS_bits.IRP
265
266 #endif