1 /*-------------------------------------------------------------------------
2 p89c66x.h - This header allows to use the microcontroler Philips P89c66x
3 with the compiler SDCC.
5 Copyright (C), 2007 Gudjon I. Gudjonsson <gudjon AT gudjon.org>
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 /*-------------------------------------------------------------------------
31 The registered are ordered in the same way as in the NXP data sheet
32 P89C660_662_664_3.PDF, see http://www.nxp.com
33 -------------------------------------------------------------------------*/
40 SFR(ACC
, 0xE0); // Accumulator
49 SFR(AUXR
, 0x8E); // Auxiliary
52 SFR(AUXR1
, 0xA2); // Auxiliary 1
57 SFR(B
, 0xF0); // B register
66 SFR(CCAP0H
, 0xFA); // Module 0 Capture High
67 SFR(CCAP1H
, 0xFB); // Module 1 Capture High
68 SFR(CCAP2H
, 0xFC); // Module 2 Capture High
69 SFR(CCAP3H
, 0xFD); // Module 3 Capture High
70 SFR(CCAP4H
, 0xFE); // Module 4 Capture High
71 SFR(CCAP0L
, 0xEA); // Module 0 Capture Low
72 SFR(CCAP1L
, 0xEB); // Module 1 Capture Low
73 SFR(CCAP2L
, 0xEC); // Module 2 Capture Low
74 SFR(CCAP3L
, 0xED); // Module 3 Capture Low
75 SFR(CCAP4L
, 0xEE); // Module 4 Capture Low
76 SFR(CCAPM0
, 0xC2); // Module 0 Mode
77 SFR(CCAPM1
, 0xC3); // Module 1 Mode
78 SFR(CCAPM2
, 0xC4); // Module 2 Mode
79 SFR(CCAPM3
, 0xC5); // Module 3 Mode
80 SFR(CCAPM4
, 0xC6); // Module 4 Mode
88 SFR(CCON
, 0xC0); // PCA Counter Control
96 SFR(CH
, 0xF9); // PCA Counter High
97 SFR(CL
, 0xE9); // PCA Counter Low
98 SFR(CMOD
, 0xC1); // PCA Counter Mode
104 SFR(DPH
, 0x83); // Data Pointer High
105 SFR(DPL
, 0x82); // Data Pointer Low
106 SFR(IEN0
, 0xA8); // Interrupt Enable 0
115 SFR(IEN1
, 0xE8); // Interrupt Enable 1
117 SFR(IP
, 0xB8); // Interrupt Priority
126 SFR(IPH
, 0xB7); // Interrupt Priority High
135 SFR(P0
, 0x80); // Port 0
152 SFR(P1
, 0x90); // Port 1
153 SBIT(T1_CEX4
, 0x90, 7);
155 SBIT(T0_CEX3
, 0x90, 6);
169 SFR(P2
, 0xA0); // Port 2
186 SFR(P3
, 0xB0); // Port 3
203 SFR(PCON
, 0x87); // Power Control
211 SFR(PSW
, 0xD0); // Program Status Word
220 SFR(RCAP2H
, 0xCB); // Timer 2 Capture High
221 SFR(RCAP2L
, 0xCA); // Timer 2 Capture Low
222 SFR(SADDR
, 0xA9); // I2C Slave Address
223 SFR(SADEN
, 0xB9); // I2C Slave Address Mask
224 SFR(S0BUF
, 0x99); // Serial Data Buffer
225 SFR(S0CON
, 0x98); // Serial Control
226 SBIT(SM0_FE
, 0x98, 7);
234 SFR(SP
, 0x81); // Stack Pointer
235 SFR(S1DAT
, 0xDA); // I2C Serial 1 Data
236 SFR(S1IST
, 0xDC); // I2C Serial 1 Internal Status
237 SFR(S1ADR
, 0xDB); // I2C Serial 1 Address
239 SFR(S1STA
, 0xD9); // I2C Serial 1 Status
245 SFR(S1CON
, 0xD8); // I2C Serial 1 Control
254 SFR(TCON
, 0x88); // Timer Control
263 SFR(T2CON
, 0xC8); // Timer 2 Control
268 SBIT(EXEN2
, 0xC8, 3);
271 SBIT(CP_RL2
, 0xC8, 0);
272 SFR(T2MOD
, 0xC9); // Timer 2 Mode Control
275 SFR(TH0
, 0x8C); // Timer High 0
276 SFR(TH1
, 0x8D); // Timer High 1
277 SFR(TH2
, 0xCD); // Timer High 2
278 SFR(TL0
, 0x8A); // Timer Low 0
279 SFR(TL1
, 0x8B); // Timer Low 1
280 SFR(TL2
, 0xCC); // Timer Low 2
281 SFR(TMOD
, 0x89); // Timer Mode
290 SFR(WDTRST
, 0xA6); // Watchdog Timer Reset