1 /*-------------------------------------------------------------------------
2 p89v66x.h - This header allows to use the microcontroler NXP
3 (formerly Philips) p89v66x where x stands for 0,2,4.
5 Copyright (C) 2008, 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 http://www.standardics.nxp.com/products/80c51/datasheet/p89v660.p89v662.p89v664.pdf
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
84 SFR(CCAPM1
, 0xC3); // Module 1 Mode
92 SFR(CCAPM2
, 0xC4); // Module 2 Mode
100 SFR(CCAPM3
, 0xC5); // Module 3 Mode
108 SFR(CCAPM4
, 0xC6); // Module 4 Mode
123 SFR(CCON
, 0xC0); // PCA Counter Control
131 SFR(CH
, 0xF9); // PCA Counter High
132 SFR(CL
, 0xE9); // PCA Counter Low
133 SFR(CMOD
, 0xC1); // PCA Counter Mode
139 SFR(DPH
, 0x83); // Data Pointer High
140 SFR(DPL
, 0x82); // Data Pointer Low
141 SFR(IEN0
, 0xA8); // Interrupt Enable 0
150 SFR(IEN1
, 0xE8); // Interrupt Enable 1
154 SFR(IP0
, 0xB8); // Interrupt Priority 0
163 SFR(IP0H
, 0xB7); // Interrupt Priority 0 High
172 SFR(IP1
, 0x91); // Interrupt Priority 1
175 SFR(IP1H
, 0x92); // Interrupt Priority 1 High
178 SFR(P0
, 0x80); // Port 0
195 SFR(P1
, 0x90); // Port 1
196 SBIT(T1_CEX4
, 0x90, 7);
198 SBIT(T0_CEX3
, 0x90, 6);
212 SFR(P2
, 0xA0); // Port 2
229 SFR(P3
, 0xB0); // Port 3
246 SFR(P4
, 0xA1); // Port 3
257 SFR(PCON
, 0x87); // Power Control
265 SFR(PSW
, 0xD0); // Program Status Word
274 SFR(RCAP2H
, 0xCB); // Timer 2 Capture High
275 SFR(RCAP2L
, 0xCA); // Timer 2 Capture Low
276 SFR(S0CON
, 0x98); // Serial Control
277 SBIT(SM0_FE
,0x98, 7);
285 SFR(S0BUF
, 0x99); // Serial Data Buffer
286 SFR(SADDR
, 0xA9); // I2C Slave Address
287 SFR(SADEN
, 0xB9); // I2C Slave Address Mask
288 SFR(SPCR
, 0xD5); // SPI Control Register
297 /* SBIT(SPIE, 0x80, 7); // SPCR is not bit addressable, not yet at least, according to the manual.
304 SBIT(SPR0, 0x80, 0);*/
305 SFR(SPSR
, 0xAA); // SPI Configuration Register
308 SFR(SPDAT
, 0x86); // SPI Data
309 SFR(SP
, 0x81); // Stack Pointer
310 SFR(S1DAT
, 0xDA); // I2C Serial 1 Data
311 SFR(S1ADR
, 0xDB); // I2C Serial 1 Address
320 SFR(S1STA
, 0xD9); // I2C Serial 1 Status
325 #define SC0 0x08 // Only write 0 to the lowest three bits
326 SFR(S1CON
, 0xD8); // I2C Serial 1 Control
335 SFR(S2DAT
, 0xE2); // I2C Serial 1 Data
336 SFR(S2ADR
, 0xE3); // I2C Serial 1 Address
345 SFR(S2STA
, 0xE1); // I2C Serial 1 Status
350 #define SC20 0x08 // Only write 0 to the lowest three bits
351 SFR(S2CON
, 0xF8); // I2C Serial 1 Control
353 SBIT(ENS21
, 0xF8, 6);
360 SFR(TCON
, 0x88); // Timer Control
369 SFR(T2CON
, 0xC8); // Timer 2 Control
374 SBIT(EXEN2
, 0xC8, 3);
377 SBIT(CP_RL2
, 0xC8, 0);
378 SFR(T2MOD
, 0xC9); // Timer 2 Mode Control
382 SFR(TH0
, 0x8C); // Timer High 0
383 SFR(TH1
, 0x8D); // Timer High 1
384 SFR(TH2
, 0xCD); // Timer High 2
385 SFR(TL0
, 0x8A); // Timer Low 0
386 SFR(TL1
, 0x8B); // Timer Low 1
387 SFR(TL2
, 0xCC); // Timer Low 2
388 SFR(TMOD
, 0x89); // Timer Mode
397 SFR(WDTRST
, 0xA6); // Watchdog Timer Reset
399 #endif //__P89V66X_H__