go to single .html
[fw/sdcc] / device / include / at89x1051.h
1 /*-------------------------------------------------------------------------
2   Register Declarations for ATMEL 89c1051 Processors    
3   
4    Written By - Bernd Bartmann 
5     Bernd.Bartmann@picard.isdn.cs.tu-berlin.de (1999)
6     based on reg51.h by Sandeep Dutta sandeep.dutta@usa.net
7     KEIL C compatible definitions are included
8     
9    This program is free software; you can redistribute it and/or modify it
10    under the terms of the GNU General Public License as published by the
11    Free Software Foundation; either version 2, or (at your option) any
12    later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22    
23    In other words, you are welcome to use, share and improve this program.
24    You are forbidden to forbid anyone else to use, share and improve
25    what you give them.   Help stamp out software-hoarding!  
26 -------------------------------------------------------------------------*/
27
28 #ifndef AT891051_H
29 #define AT891051_H
30
31 #warning This file (at89x1051.h) is obsolete, use include <at89x051.h> !
32
33 /* BYTE addressable registers */
34 sfr at 0x81 SP          ;
35 sfr at 0x82 DPL         ;
36 sfr at 0x83 DPH         ;
37 sfr at 0x87 PCON        ;
38 sfr at 0x88 TCON        ;
39 sfr at 0x89 TMOD        ;
40 sfr at 0x8A TL0         ;
41 sfr at 0x8C TH0         ;
42 sfr at 0x90 P1          ;
43 sfr at 0xA8 IE          ;
44 sfr at 0xB0 P3          ;
45 sfr at 0xB8 IP          ;
46 sfr at 0xD0 PSW         ;
47 sfr at 0xE0 ACC         ;
48 sfr at 0xE0 A           ;
49 sfr at 0xF0 B           ;
50
51
52 /* BIT addressable registers */
53 /* TCON */
54 sbit at 0x88 IT0        ;
55 sbit at 0x89 IE0        ;
56 sbit at 0x8A IT1        ;
57 sbit at 0x8B IE1        ;
58 sbit at 0x8C TR0        ;
59 sbit at 0x8D TF0        ;
60 sbit at 0x8E TR1        ;
61 sbit at 0x8F TF1        ;
62
63 /* P1 */
64 sbit at 0x90 P1_0       ;
65 sbit at 0x91 P1_1       ;
66 sbit at 0x92 P1_2       ;
67 sbit at 0x93 P1_3       ;
68 sbit at 0x94 P1_4       ;
69 sbit at 0x95 P1_5       ;
70 sbit at 0x96 P1_6       ;
71 sbit at 0x97 P1_7       ;
72
73 sbit at 0x90 AIN0       ;
74 sbit at 0x91 AIN1       ;
75
76 /* IE */
77 sbit at 0xA8 EX0        ;
78 sbit at 0xA9 ET0        ;
79 sbit at 0xAA EX1        ;
80 sbit at 0xAF EA         ;
81
82 /* P3 */
83 sbit at 0xB0 P3_0       ;
84 sbit at 0xB1 P3_1       ;
85 sbit at 0xB2 P3_2       ;
86 sbit at 0xB3 P3_3       ;
87 sbit at 0xB4 P3_4       ;
88 sbit at 0xB5 P3_5       ;
89 sbit at 0xB7 P3_7       ;
90
91 sbit at 0xB2 INT0       ;
92 sbit at 0xB3 INT1       ;
93 sbit at 0xB4 T0         ;
94 sbit at 0xB6 AOUT       ;
95
96 /* IP */ 
97 sbit at 0xB8 PX0        ;
98 sbit at 0xB9 PT0        ;
99 sbit at 0xBA PX1        ;
100 sbit at 0xBB PT1        ;
101 sbit at 0xBC PS         ;
102
103 /* PSW */
104 sbit at 0xD0 P          ;
105 sbit at 0xD1 FL         ;
106 sbit at 0xD2 OV         ;
107 sbit at 0xD3 RS0        ;
108 sbit at 0xD4 RS1        ;
109 sbit at 0xD5 F0         ;
110 sbit at 0xD6 AC         ;
111 sbit at 0xD7 CY         ;
112
113
114 /* BIT definitions for bits that are not directly accessible */
115 /* PCON bits */
116 #define IDL             0x01
117 #define STOP            0x02
118 #define EWT             0x04
119 #define EPFW            0x08
120 #define WTR             0x10
121 #define PFW             0x20
122 #define POR             0x40
123 #define SMOD            0x80
124
125 #define IDL_            0x01
126 #define STOP_           0x02
127 #define EWT_            0x04
128 #define EPFW_           0x08
129 #define WTR_            0x10
130 #define PFW_            0x20
131 #define POR_            0x40
132 #define SMOD_           0x80
133
134 /* TMOD bits */
135 #define M0_0            0x01
136 #define M1_0            0x02
137 #define C_T0            0x04
138 #define GATE0           0x08
139 #define M0_1            0x10
140 #define M1_1            0x20
141 #define C_T1            0x40
142 #define GATE1           0x80
143
144 #define M0_0_           0x01
145 #define M1_0_           0x02
146 #define C_T0_           0x04
147 #define GATE0_          0x08
148 #define M0_1_           0x10
149 #define M1_1_           0x20
150 #define C_T1_           0x40
151 #define GATE1_          0x80
152
153 #define T0_M0           0x01
154 #define T0_M1           0x02
155 #define T0_CT           0x04
156 #define T0_GATE         0x08
157 #define T1_M0           0x10
158 #define T1_M1           0x20
159 #define T1_CT           0x40
160 #define T1_GATE         0x80
161
162 #define T0_M0_          0x01
163 #define T0_M1_          0x02
164 #define T0_CT_          0x04
165 #define T0_GATE_        0x08
166 #define T1_M0_          0x10
167 #define T1_M1_          0x20
168 #define T1_CT_          0x40
169 #define T1_GATE_        0x80
170
171 #define T0_MASK         0x0F
172 #define T1_MASK         0xF0
173
174 #define T0_MASK_        0x0F
175 #define T1_MASK_        0xF0
176
177
178 /* Interrupt numbers: address = (number * 8) + 3 */
179 #define IE0_VECTOR      0       /* 0x03 external interrupt 0 */
180 #define TF0_VECTOR      1       /* 0x0b timer 0 */
181 #define IE1_VECTOR      2       /* 0x13 external interrupt 1 */
182  
183 #endif
184
185