a709ff358f0e9264b2b200e0c4f71862fc143e8c
[fw/sdcc] / device / include / mcs51 / P89LPC922.h
1 /*------------------------------------------------------------------//--------\r
2 P89LPC922.H\r
3 (English)\r
4 This header allows to use the microcontroler Philips P89LPC922\r
5 with the compiler SDCC.\r
6 \r
7 Copyright (c) 2005 Omar Espinosa--e-mail: opiedrahita2003 AT yahoo.com.\r
8 \r
9    This library is free software; you can redistribute it and/or\r
10    modify it under the terms of the GNU Lesser General Public\r
11    License as published by the Free Software Foundation; either\r
12    version 2.1 of the License, or (at your option) any later version.\r
13 \r
14    This library is distributed in the hope that it will be useful,\r
15    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
17    Lesser General Public License for more details.\r
18 \r
19    You should have received a copy of the GNU Lesser General Public\r
20    License along with this library; if not, write to the Free Software\r
21    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
22 \r
23 (Spanish-EspaƱol)\r
24 Archivo encabezador para el ucontrolador Philips P89LPC922.\r
25 Derechos de copy (DC) 2005.  OMAR ESPINOSA P.  E-mail: opiedrahita2003 AT yahoo.com\r
26 Uso libre\r
27 //------------------------------------------------------------------//--//------*/\r
28 #ifndef __REG922_H__\r
29 #define __REG922_H__\r
30 \r
31 //*  BYTE Registers  *//\r
32 __sfr __at (0x80) P0     ;\r
33 __sfr __at (0x90) P1     ;\r
34 __sfr __at (0xB0) P3     ;\r
35 __sfr __at (0xD0) PSW    ;\r
36 __sfr __at (0xE0) ACC    ;\r
37 __sfr __at (0xF0) B      ;\r
38 __sfr __at (0x81) SP     ;\r
39 __sfr __at (0x82) DPL    ;\r
40 __sfr __at (0x83) DPH    ;\r
41 __sfr __at (0x87) PCON   ;\r
42 __sfr __at (0x88) TCON   ;\r
43 __sfr __at (0x89) TMOD   ;\r
44 __sfr __at (0x8A) TL0    ;\r
45 __sfr __at (0x8B) TL1    ;\r
46 __sfr __at (0x8B) TH0    ;\r
47 __sfr __at (0x8D) TH1    ;\r
48 __sfr __at (0xA8) IEN0   ;\r
49 __sfr __at (0xB8) IP0    ;\r
50 __sfr __at (0x98) SCON   ;\r
51 __sfr __at (0x99) SBUF   ;\r
52 \r
53 \r
54 __sfr __at (0xA2) AUXR1  ;\r
55 __sfr __at (0xA9) SADDR  ;\r
56 __sfr __at (0xB9) SADEN  ;\r
57 __sfr __at (0xBE) BRGR0  ;\r
58 __sfr __at (0xBF) BRGR1  ;\r
59 __sfr __at (0xBD) BRGCON ;\r
60 __sfr __at (0xAC) CMP1   ;\r
61 __sfr __at (0xAD) CMP2   ;\r
62 __sfr __at (0x95) DIVM   ;\r
63 __sfr __at (0xE7) FMADRH ;\r
64 __sfr __at (0xE6) FMADRL ;\r
65 __sfr __at (0xE4) FMCON  ;\r
66 __sfr __at (0xE5) FMDATA ;\r
67 __sfr __at (0xDB) I2ADR  ;\r
68 __sfr __at (0xD8) I2CON  ;\r
69 __sfr __at (0xDA) I2DAT  ;\r
70 __sfr __at (0xDD) I2SCLH ;\r
71 __sfr __at (0xDC) I2SCLL ;\r
72 __sfr __at (0xD9) I2STAT ;\r
73 __sfr __at (0xF8) IP1    ;\r
74 __sfr __at (0xF7) IP1H   ;\r
75 __sfr __at (0x94) KBCON  ;\r
76 __sfr __at (0x86) KBMASK ;\r
77 __sfr __at (0x93) KBPATN ;\r
78 __sfr __at (0x84) P0M1   ;\r
79 __sfr __at (0x85) P0M2   ;\r
80 __sfr __at (0x91) P1M1   ;\r
81 __sfr __at (0x92) P1M2   ;\r
82 __sfr __at (0xB1) P3M1   ;\r
83 __sfr __at (0xB2) P3M2   ;\r
84 __sfr __at (0xB5) PCONA  ;\r
85 __sfr __at (0xF6) PT0AD  ;\r
86 __sfr __at (0xDF) RSTSRC ;\r
87 __sfr __at (0xD1) RTCCON ;\r
88 __sfr __at (0xD2) RTCH   ;\r
89 __sfr __at (0xD3) RTCL   ;\r
90 __sfr __at (0xBA) SSTAT  ;\r
91 __sfr __at (0x8F) TAMOD  ;\r
92 __sfr __at (0x96) TRIM   ;\r
93 __sfr __at (0xA7) WDCON  ;\r
94 __sfr __at (0xC1) WDL    ;\r
95 __sfr __at (0xC2) WFEED1 ;\r
96 __sfr __at (0xC3) WFEED2 ;\r
97 __sfr __at (0xB7) IP0H   ;\r
98 __sfr __at (0xE8) IEN1   ;\r
99 \r
100 /*  BIT Registers  */\r
101 /*  PSW   */\r
102 __sbit __at (0xD0) PSW_0   ;\r
103 __sbit __at (0xD1) PSW_1   ;\r
104 __sbit __at (0xD2) PSW_2   ;\r
105 __sbit __at (0xD3) PSW_3   ;\r
106 __sbit __at (0xD4) PSW_4   ;\r
107 __sbit __at (0xD5) PSW_5   ;\r
108 __sbit __at (0xD6) PSW_6   ;\r
109 __sbit __at (0xD7) PSW_7   ;\r
110 \r
111 #define CY    PSW_7\r
112 #define AC    PSW_6\r
113 #define F0    PSW_5\r
114 #define RS1   PSW_4\r
115 #define RS0   PSW_3\r
116 #define OV    PSW_2\r
117 #define F1    PSW_1\r
118 #define P     PSW_0\r
119 \r
120 /*  TCON  */\r
121 __sbit __at (0x8F) TCON_7  ;\r
122 __sbit __at (0x8E) TCON_6  ;\r
123 __sbit __at (0x8D) TCON_5  ;\r
124 __sbit __at (0x8C) TCON_4  ;\r
125 __sbit __at (0x8B) TCON_3  ;\r
126 __sbit __at (0x8A) TCON_2  ;\r
127 __sbit __at (0x89) TCON_1  ;\r
128 __sbit __at (0x88) TCON_0  ;\r
129 \r
130 #define TF1   TCON_7\r
131 #define TR1   TCON_6\r
132 #define TF0   TCON_5\r
133 #define TR0   TCON_4\r
134 #define IE1   TCON_3\r
135 #define IT1   TCON_2\r
136 #define IE0   TCON_1\r
137 #define IT0   TCON_0\r
138 \r
139 /*  IEN0   */\r
140 __sbit __at (0xAF) IEN0_7  ;\r
141 __sbit __at (0xAE) IEN0_6  ;\r
142 __sbit __at (0xAD) IEN0_5  ;\r
143 __sbit __at (0xAC) IEN0_4  ;\r
144 __sbit __at (0xAB) IEN0_3  ;\r
145 __sbit __at (0xAA) IEN0_2  ;\r
146 __sbit __at (0xA9) IEN0_1  ;\r
147 __sbit __at (0xA8) IEN0_0  ;\r
148 \r
149 #define EA    IEN0_7\r
150 #define EWDRT IEN0_6\r
151 #define EBO   IEN0_5\r
152 #define ES    IEN0_4    // alternatively "ESR"\r
153 #define ESR   IEN0_4\r
154 #define ET1   IEN0_3\r
155 #define EX1   IEN0_2\r
156 #define ET0   IEN0_1\r
157 #define EX0   IEN0_0\r
158 \r
159 /*  IEN1   */\r
160 __sbit __at (0xEA) IEN1_2  ;\r
161 __sbit __at (0xE9) IEN1_1  ;\r
162 __sbit __at (0xE8) IEN1_0  ;\r
163 \r
164 #define EC    IEN1_2\r
165 #define EKBI  IEN1_1\r
166 #define EI2C  IEN1_0\r
167 \r
168 /*  IP1   */\r
169 __sbit __at (0xFE) IP1_6   ;\r
170 __sbit __at (0xFA) IP1_2   ;\r
171 __sbit __at (0xF9) IP1_1   ;\r
172 __sbit __at (0xF8) IP1_0   ;\r
173 \r
174 #define PST   IP1_6\r
175 #define PC    IP1_2\r
176 #define PKBI  IP1_1\r
177 #define PI2C  IP1_0\r
178 \r
179 /*  IP0   */\r
180 __sbit __at (0xBE) IP0_6   ;\r
181 __sbit __at (0xBD) IP0_5   ;\r
182 __sbit __at (0xBC) IP0_4   ; // alternatively "PSR"\r
183 __sbit __at (0xBB) IP0_3   ;\r
184 __sbit __at (0xBA) IP0_2   ;\r
185 __sbit __at (0xB9) IP0_1   ;\r
186 __sbit __at (0xB8) IP0_0   ;\r
187 \r
188 #define PWDRT IP0_6\r
189 #define PBO   IP0_5\r
190 #define PS    IP0_4      // alternatively "PSR"\r
191 #define PSR   IP0_4\r
192 #define PT1   IP0_3\r
193 #define PX1   IP0_2\r
194 #define PT0   IP0_1\r
195 #define PX0   IP0_0\r
196 \r
197 /*  SCON  */\r
198 __sbit __at (0x98) SCON_0  ;\r
199 __sbit __at (0x99) SCON_1  ;\r
200 __sbit __at (0x9A) SCON_2  ;\r
201 __sbit __at (0x9B) SCON_3  ;\r
202 __sbit __at (0x9C) SCON_4  ;\r
203 __sbit __at (0x9D) SCON_5  ;\r
204 __sbit __at (0x9E) SCON_6  ;\r
205 __sbit __at (0x9F) SCON_7  ;\r
206 \r
207 #define SM0   SCON_7  // alternatively "FE"\r
208 #define FE    SCON_7\r
209 #define SM1   SCON_6\r
210 #define SM2   SCON_5\r
211 #define REN   SCON_4\r
212 #define TB8   SCON_3\r
213 #define RB8   SCON_2\r
214 #define TI    SCON_1\r
215 #define RI    SCON_0\r
216 \r
217 /*  I2CON  */\r
218 __sbit __at (0xDE) I2CON_6 ;\r
219 __sbit __at (0xDD) I2CON_5 ;\r
220 __sbit __at (0xDC) I2CON_4 ;\r
221 __sbit __at (0xDB) I2CON_3 ;\r
222 __sbit __at (0xDA) I2CON_2 ;\r
223 __sbit __at (0xD8) I2CON_0 ;\r
224 \r
225 #define I2EN  I2CON_6\r
226 #define STA   I2CON_5\r
227 #define STO   I2CON_4\r
228 #define SI    I2CON_3\r
229 #define AA    I2CON_2\r
230 #define CRSEL I2CON_0\r
231 \r
232 /*  P0    */\r
233 __sbit __at (0x80) P0_0    ;\r
234 __sbit __at (0x81) P0_1    ;\r
235 __sbit __at (0x82) P0_2    ;\r
236 __sbit __at (0x83) P0_3    ;\r
237 __sbit __at (0x84) P0_4    ;\r
238 __sbit __at (0x85) P0_5    ;\r
239 __sbit __at (0x86) P0_6    ;\r
240 __sbit __at (0x87) P0_7    ;\r
241 \r
242 #define KB7   P0_7   // alternatively "T1"\r
243 #define T1    P0_7\r
244 #define KB6   P0_6   // alternatively "CMP1"\r
245 #define CMP1  P0_6\r
246 #define KB5   P0_5\r
247 #define KB4   P0_4\r
248 #define KB3   P0_3\r
249 #define KB2   P0_2\r
250 #define KB1   P0_1\r
251 #define KB0   P0_0   // alternatively "CMP2"\r
252 #define CMP2  P0_0\r
253 \r
254 /*  P1  */\r
255 __sbit __at (0x90) P1_0    ;\r
256 __sbit __at (0x91) P1_1    ;\r
257 __sbit __at (0x92) P1_2    ;\r
258 __sbit __at (0x93) P1_3    ;\r
259 __sbit __at (0x94) P1_4    ;\r
260 __sbit __at (0x95) P1_5    ;\r
261 __sbit __at (0x96) P1_6    ;\r
262 __sbit __at (0x97) P1_7    ;\r
263 \r
264 #define RST   P1_5\r
265 #define INT1  P1_4\r
266 #define INT0  P1_3   // alternatively "SDA"\r
267 #define SDA   P1_3\r
268 #define T0    P1_2   // alternatively "SCL"\r
269 #define SCL   P1_2\r
270 #define RxD   P1_1\r
271 #define TxD   P1_0\r
272 \r
273 /*  P3  */\r
274 __sbit __at (0xB0)  P3_0   ;\r
275 __sbit __at (0xB1)  P3_1   ;\r
276 \r
277 #define XTAL1 P3_1\r
278 #define XTAL2 P3_0\r
279 \r
280 #endif\r