1 /*--------------------------------------------------------------------------
4 This header allows to use the microcontrolers NXP (formerly Philips)
7 Copyright (c) 2008 Gudjon I. Gudjonsson <gudjon AT gudjon.org>
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 This library 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 GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA
23 The registered are ordered in the same way as in the NXP data sheet:
24 http://www.standardics.nxp.com/products/lpc900/datasheet/p89lpc933.p89lpc934.p89lpc935.p89lpc936.pdf
27 --------------------------------------------------------------------------*/
28 #ifndef __P89LPC933_4_H__
29 #define __P89LPC933_4_H__
33 SFR(ACC, 0xE0); // Accumulator
42 SFR(ADCON0, 0x8E); // A/D control register 0
44 SFR(ADCON1, 0x97); // A/D control register 1
53 SFR(ADINS, 0xA3); // A/D input select
58 SFR(ADMODA, 0xC0); // A/D mode register A
60 SBIT(BURST1, 0xC0, 6);
63 SFR(ADMODB, 0xA1); // A/D mode register B
70 SFR(AD0DAT3, 0xF4); // A/D_0 data register 3
71 SFR(AD1BH, 0xC4); // A/D_1 boundary high register
72 SFR(AD1BL, 0xBC); // A/D_1 boundary low register
73 SFR(AD1DAT0, 0xD5); // A/D_1 data register 0
74 SFR(AD1DAT1, 0xD6); // A/D_1 data register 1
75 SFR(AD1DAT2, 0xD7); // A/D_1 data register 2
76 SFR(AD1DAT3, 0xF5); // A/D_1 data register 3
77 SFR(AUXR1, 0xA2); // Auxilary function register
82 #define SRST 0x08 // Bit 2 is always 0
84 SFR(B, 0xF0); // B register
93 SFR(BRGR0, 0xBE); // Baud rate generator rate low
94 SFR(BRGR1, 0xBF); // Baud rate generator rate high
95 SFR(BRGCON, 0xBD); // Baud rate generator control
98 SFR(CMP1, 0xAC); // Comparator 1 control register
105 SFR(CMP2, 0xAD); // Comparator 2 control register
112 SFR(DIVM, 0x95); // CPU clock divide-by-M control
113 SFR(DPH, 0x83); // Data Pointer High
114 SFR(DPL, 0x82); // Data Pointer Low
115 SFR(FMADRH, 0xE7); // Program flash address high
116 SFR(FMADRL, 0xE6); // Program flash address low
118 // Program flash control (Read)
124 // Program flash control (Write)
133 SFR(FMDATA, 0xE5); // Program flash data
134 SFR(I2ADR, 0xDB); // I2C slave address register
143 SFR(I2CON, 0xD8); // I2C control register
149 SBIT(CRSEL, 0xD8, 0);
150 SFR(I2DAT, 0xDA); // I2C data register
151 SFR(I2SCLH, 0xDD); // I2C serial clock generator/SCL duty cycle register high
152 SFR(I2SCLL, 0xDC); // I2C serial clock generator/SCL duty cycle register low
153 SFR(I2STAT, 0xD9); // I2C status register
158 #define STA_0 0x08 // Only write 0 to the lowest three bits
159 SFR(ICRAH, 0xAB); // Input capture A register high
160 SFR(ICRAL, 0xAA); // Input capture A register low
161 SFR(ICRBH, 0xAF); // Input capture B register high
162 SFR(ICRBL, 0xAE); // Input capture B register low
163 SFR(IEN0, 0xA8); // Interrupt Enable 0
165 SBIT(EWDRT, 0xA8, 6);
167 SBIT(ES_ESR, 0xA8, 4);
172 SFR(IEN1, 0xE8); // Interrupt Enable 1
179 SFR(IP0, 0xB8); // Interrupt Priority 0
180 SBIT(PWDRT, 0xB8, 6);
182 SBIT(PS_PSR, 0xB8, 4);
187 SFR(IP0H, 0xB7); // Interrupt Priority 0 high
190 #define PSH_PSRH 0x10
195 SFR(IP1, 0xF8); // Interrupt Priority 1
202 SFR(IP1H, 0xF7); // Interrupt Priority 1 High
209 SFR(KBCON, 0x94); // Keypad control register
210 #define PATN_SEL 0x02
212 SFR(KBMASK, 0x86); // Keypad interrupt mask register
213 SFR(KBPATN, 0x93); // Keypad pattern register
214 SFR(P0, 0x80); // Port 0
219 SBIT(CMP_1, 0x80, 6); // Renamed, not to conflict with the CMP1 register
222 SBIT(CMPREF,0x80, 5);
225 SBIT(CIN1A, 0x80, 4);
228 SBIT(CIN1B, 0x80, 3);
231 SBIT(CIN2A, 0x80, 2);
234 SBIT(CIN2B, 0x80, 1);
237 SBIT(CMP_2, 0x80, 0); // Renamed, not to conflict with the CMP2 register
239 SFR(P1, 0x90); // Port 1
256 SFR(P2, 0xA0); // Port 2
260 SBIT(SPICLK, 0xA0, 5);
269 SFR(P3, 0xB0); // Port 3
280 SFR(P0M1, 0x84); // Port 0 output mode 1
289 SFR(P0M2, 0x85); // Port 0 output mode 2
298 SFR(P1M1, 0x91); // Port 1 output mode 1
306 SFR(P1M2, 0x92); // Port 1 output mode 2
314 SFR(P2M1, 0xA4); // Port 2 output mode 1
323 SFR(P2M2, 0xA5); // Port 2 output mode 2
332 SFR(P3M1, 0xB1); // Port 3 output mode 1
335 SFR(P3M2, 0xB2); // Port 3 output mode 2
338 SFR(PCON, 0x87); // Power control register
347 SFR(PCONA, 0xB5); // Power control register A
354 SFR(PSW, 0xD0); // Program Status Word
363 SFR(PT0AD, 0xF6); // Port 0 digital input disable
369 SFR(RSTSRC, 0xDF); // Reset source register
376 SFR(RTCCON, 0xD1); // Real-time clock control
382 SFR(RTCH, 0xD2); // Real-time clock register high
383 SFR(RTCL, 0xD3); // Real-time clock register low
384 SFR(SADDR, 0xA9); // Serial port address register
385 SFR(SADEN, 0xB9); // Serial port address enable
386 SFR(SBUF, 0x99); // Serial port data buffer register
387 SFR(SCON, 0x98); // Serial port control
388 SBIT(SM0_FE, 0x98, 7);
396 SFR(SSTAT, 0xBA); // Serial port extended status register
405 SFR(SP, 0x81); // Stack Pointer
406 SFR(SPCTL, 0xE2); // SPI control register
415 SFR(SPSTAT, 0xE1); // SPI status register
418 SFR(SPDAT, 0xE3); // SPI data register
419 SFR(TAMOD, 0x8F); // Timer 0 and 1 auxiliary mode
422 SFR(TCON, 0x88); // Timer 0 and 1 control
431 SFR(TH0, 0x8C); // Timer 0 high
432 SFR(TH1, 0x8D); // Timer 1 high
433 SFR(TL0, 0x8A); // Timer 0 low
434 SFR(TL1, 0x8B); // Timer 1 low
435 SFR(TMOD, 0x89); // Timer 0 and 1 mode
444 SFR(TRIM, 0x96); // Internal oscillator trim register
453 SFR(WDCON, 0xA7); // Watchdog control register
460 SFR(WDL, 0xC1); // Watchdog load
461 SFR(WFEED1, 0xC2); // Watchdog feed 1
462 SFR(WFEED2, 0xC3); // Watchdog feed 2
463 #endif // __P89LPC933_4_H__