1 /*-------------------------------------------------------------------------
2 P89LPC925.h - Register Declarations for NXP P89LPC924 and P89LPC925
3 (Based on datasheet Rev. 03 - 15 December 2004)
5 Copyright (C) 2007, Jesus Calvino-Fraga / jesusc at ece.ubc.ca
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING. If not, write to the
19 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 As a special exception, if you link this library with other files,
23 some of which are compiled with SDCC, to produce an executable,
24 this library does not by itself cause the resulting executable to
25 be covered by the GNU General Public License. This exception does
26 not however invalidate any other reasons why the executable file
27 might be covered by the GNU General Public License.
28 -------------------------------------------------------------------------*/
30 #ifndef REG_P89LPC925_H
31 #define REG_P89LPC925_H
35 SFR(ACC
, 0xE0); // Accumulator
45 SFR(ADCON1
, 0x97); // A/D control register 1
55 SFR(ADINS
, 0xA3); // A/D input select
61 SFR(ADMODA
, 0xC0); // A/D mode register A
67 SFR(ADMODB
, 0xA1); // A/D mode register B
74 SFR(AD1BH
, 0xC4); // A/D_1 boundary high register
76 SFR(AD1BL
, 0xBC); // A/D_1 boundary low register
78 SFR(AD1DAT0
, 0xD5); // A/D_1 data register 0
80 SFR(AD1DAT1
, 0xD6); // A/D_1 data register 1
82 SFR(AD1DAT2
, 0xD7); // A/D_1 data register 2
84 SFR(AD1DAT3
, 0xF5); // A/D_1 data register 3
86 SFR(AUXR1
, 0xA2); // Auxiliary function register
94 SFR(B
, 0xF0); // B register
104 SFR(BRGR0
, 0xBE); // Baud rate generator rate LOW
106 SFR(BRGR1
, 0xBF); // Baud rate generator rate HIGH
108 SFR(BRGCON
, 0xBD); // Baud rate generator control
112 SFR(CMP1
, 0xAC); // Comparator1 control register
120 SFR(CMP2
, 0xAD); // Comparator2 control register
128 SFR(DIVM
, 0x95); // CPU clock divide-by-M control
130 SFR(DPH
, 0x83); // Data pointer HIGH
132 SFR(DPL
, 0x82); // Data pointer LOW
134 SFR(FMADRH
, 0xE7); // Program Flash address HIGH
136 SFR(FMADRL
, 0xE6); // Program Flash address LOW
138 SFR(FMCON
, 0xE4); // Program Flash control (Read)
145 SFR(FMCON
, 0xE4); // Program Flash control (Write)
155 SFR(FMDATA
, 0xE5); // Program Flash data
157 SFR(I2ADR
, 0xDB); // I2C slave address register
167 SFR(I2CON
, 0xD8); // I2C control register
173 SBIT(CRSEL
, 0xD8, 0);
175 SFR(I2DAT
, 0xDA); // I2C data register
177 SFR(I2SCLH
, 0xDD); // Serial clock generator/SCL duty cycle register HIGH
179 SFR(I2SCLL
, 0xDC); // Serial clock generator/SCL duty cycle register LOW
181 SFR(I2STAT
, 0xD9); // I2C status register
188 SFR(IEN0
, 0xA8); // Interrupt enable 0
190 SBIT(EWDRT
, 0xA8, 6);
199 SFR(IEN1
, 0xE8); // Interrupt enable 1
206 SFR(IP0
, 0xB8); // Interrupt priority 0
207 SBIT(PWDRT
, 0xB8, 6);
216 SFR(IP0H
, 0xB7); // Interrupt priority 0 HIGH
226 SFR(IP1
, 0xF8); // Interrupt priority 1
233 SFR(IP1H
, 0xF7); // Interrupt priority 1 HIGH
240 SFR(KBCON
, 0x94); // Keypad control register
241 #define PATN_SEL 0x02 //Pattern Matching Polarity selection
242 #define KBIF 0x01 // Keypad Interrupt Flag
244 SFR(KBMASK
, 0x86); // Keypad interrupt register mask
246 SFR(KBPATN
, 0x93); // Keypad pattern register
248 SFR(P0
, 0x80); // Port 0
257 //P0 alternate pin functions
259 SBIT(CMP_1
, 0x80, 6); //Should be CMP1 but there is SFR with that name
260 SBIT(CMPREF
, 0x80, 5);
261 SBIT(CIN1A
, 0x80, 4);
262 SBIT(CIN1B
, 0x80, 3);
263 SBIT(CIN2A
, 0x80, 2);
264 SBIT(CIN2B
, 0x80, 1);
265 SBIT(CMP_2
, 0x80, 0); //Should be CMP2 but there is SFR with that name
266 //More P0 alternate pin functions
276 SFR(P1
, 0x90); // Port 1
285 //P1 alternate pin functions
295 SFR(P3
, 0xB0); // Port 3
298 SBIT(XTAL1
, 0xB0, 1);
299 SBIT(XTAL2
, 0xB0, 0);
301 SFR(P0M1
, 0x84); // Port0 output mode1
311 SFR(P0M2
, 0x85); // Port0 output mode2
321 SFR(P1M1
, 0x91); // Port1 output mode1
330 SFR(P1M2
, 0x92); // Port1 output mode2
339 SFR(P3M1
, 0xB1); // Port3 output mode1
343 SFR(P3M2
, 0xB2); // Port3 output mode2
347 SFR(PCON
, 0x87); // Power control register
357 SFR(PCONA
, 0xB5); // Power control register A
364 SFR(PSW
, 0xD0); // Program status word
374 SFR(PT0AD
, 0xF6); // Port0 digital input disable
381 SFR(RSTSRC
, 0xDF); // Reset source register
389 SFR(RTCCON
, 0xD1); // Real-time clock control
396 SFR(RTCH
, 0xD2); // Real-time clock register HIGH
398 SFR(RTCL
, 0xD3); // Real-time clock register LOW
400 SFR(SADDR
, 0xA9); // Serial port address register
402 SFR(SADEN
, 0xB9); // Serial port address enable
404 SFR(SBUF
, 0x99); // Serial Port data buffer register
406 SFR(SCON
, 0x98); // Serial port control
417 SFR(SSTAT
, 0xBA); // Serial port extended status register
427 SFR(SP
, 0x81); // Stack pointer
429 SFR(TAMOD
, 0x8F); // Timer0 and 1 auxiliary mode
433 SFR(TCON
, 0x88); // Timer0 and 1 control
443 SFR(TH0
, 0x8C); // Timer0 HIGH
445 SFR(TH1
, 0x8D); // Timer 1 HIGH
447 SFR(TL0
, 0x8A); // Timer 0 LOW
449 SFR(TL1
, 0x8B); // Timer 1 LOW
451 SFR(TMOD
, 0x89); // Timer0 and 1 mode
461 SFR(TRIM
, 0x96); // Internal oscillator trim register
471 SFR(WDCON
, 0xA7); // Watchdog control register
472 #define PRE2 0x80 //Watchdog Prescaler Tap Select bit 2
473 #define PRE1 0x40 //Watchdog Prescaler Tap Select bit 1
474 #define PRE0 0x20 //Watchdog Prescaler Tap Select bit 0
475 #define WDRUN 0x04 //Watchdog Run Control
476 #define WDTOF 0x02 //Watchdog Timer Time-Out Flag
477 #define WDCLK 0x01 //Watchdog input clock select
479 SFR(WDL
, 0xC1); // Watchdog load
481 SFR(WFEED1
, 0xC2); // Watchdog feed 1
483 SFR(WFEED2
, 0xC3); // Watchdog feed 2
485 #endif /*REG_P89LPC925_H*/