V1.0.3 bug fixes and new CPU added
[fw/sdcc] / device / include / mcs51reg.h
1 /*-------------------------------------------------------------------------
2    Register Declarations for the mcs51 compatible microcontrollers
3
4    Written By -  Bela Torok / bela.torok@kssg.ch (November 2000)
5
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!
23
24
25    History:
26    --------
27    Version 1.0 Nov 2, 2000 - B. Torok  / bela.torok@kssg.ch
28    Initial release, supported microcontrollers:
29    8051, 8052, Atmel AT89C1051, AT89C2051, AT89C4051,
30    Infineon / Siemens SAB80515, SAB80535, SAB80515A
31
32    Version 1.0.1 (Nov 3, 2000)
33    SAB80515A definitions revised by Michael Schmitt / michael.schmitt@t-online.de
34
35    Version 1.0.2 (Nov 6, 2000)
36    T2CON bug corrected 8052 and SABX microcontrollers have different T2CONs
37    Support for for the Atmel AT89C52, AT80LV52, AT89C55, AT80LV55
38    Support for the Dallas DS80C320 and DS80C323 microcontrollers
39    microcontrollers - B. Torok / bela.torok@kssg.ch
40
41    Version 1.0.3 (Nov 7, 2000)
42    SAB80517 definitions added by Michael Schmitt / michael.schmitt@t-online.de
43    Dallas AT89S53 definitions added by B. Torok / bela.torok@kssg.ch
44    Dallas DS87C520 and DS83C520 definitions added by B. Torok / bela.torok@kssg.ch
45
46    Adding support for additional microcontrollers:
47    -----------------------------------------------
48
49    1. Make an entry with the inventory of the register set of
50       the microcontroller in the  "Describe microcontrollers" section.
51
52    2. If necessary add/modify entry(s) in the "Register definitions" section
53
54    3. If necessary add/modify entry(s) in the "Interrupt vectors" section
55
56    4. Make a step-by-step protocol of your modifications
57
58    5. Send the protocol and the modified file to me ( bela.torok@kssg.ch ).
59       I'm going to compile/verify changes made by different authors.
60
61
62    Microcontroller support:
63
64    Use one of the following options:
65
66    1. use #include <mcs51reg.h> in your program & define REG_XXXXXX in your makefile.
67
68    2. use following definitions prior the
69       #include <mcs51reg.h> line in your program:
70       e.g.:
71       #define MICROCONTROLLER_8052       -> 8052 type microcontroller
72       or
73       #define MICROCONTROLLER_AT89CX051  -> Atmel AT89C1051, AT89C2051 and AT89C4051 microcontrollers
74
75
76    Use only one of the following definitions!!!
77
78    Supported Microcontrollers:
79
80    No definition                8051
81    MICROCONTROLLER_8051         8051
82    MICROCONTROLLER_8052         8052
83    MICROCONTROLLER_AT89CX051    Atmel AT89C1051, AT89C2051 and AT89C4051
84    MICROCONTROLLER_AT89S53      Atmel AT89S53 microcontroller
85    MICROCONTROLLER_AT89X52      Atmel AT89C52 and AT80LV52 microcontrollers
86    MICROCONTROLLER_AT89X55      Atmel AT89C55 and AT80LV55 microcontrollers
87    MICROCONTROLLER_DS80C32X     Dallas DS80C320 and DS80C323 microcontrollers
88    MICROCONTROLLER_DS8XC520     Dallas DS87C520 and DS83C520 microcontrollers
89    MICROCONTROLLER_SAB80515     Infineon / Siemens SAB80515 & SAB80535
90    MICROCONTROLLER_SAB80515A    Infineon / Siemens SAB80515A
91    MICROCONTROLLER_SAB80517     Infineon / Siemens SAB80517
92
93 -----------------------------------------------------------------------*/
94
95
96 #ifndef HEADER_MCS51REG
97 #define HEADER_MCS51REG
98
99 //////////////////////////////////
100 ///  Describe microcontrollers ///
101 ///  (inventory of registers)  ///
102 //////////////////////////////////
103
104 // definitions for the 8051
105 #ifdef MICROCONTROLLER_8051
106 #ifdef MICROCONTROLLER_DEFINED
107 #define MCS51REG_ERROR
108 #endif
109 #ifndef MICROCONTROLLER_DEFINED
110 #define MICROCONTROLLER_DEFINED
111 #endif
112 #warning Selected HW: 8051
113 #define P0
114 #define SP
115 #define DPL
116 #define DPH
117 #define PCON
118 #define TCON
119 #define TMOD
120 #define TL0
121 #define TL1
122 #define TH0
123 #define TH1
124 #define P1
125 #define SCON
126 #define SBUF
127 #define P2
128 #define IE
129 #define P3
130 #define IP
131 #define PSW
132 #define ACC
133 #define B
134 #endif
135 // end of definitions for the 8051
136
137
138 // definitions for the 8052 microcontroller
139 #ifdef MICROCONTROLLER_8052
140 #ifdef MICROCONTROLLER_DEFINED
141 #define MCS51REG_ERROR
142 #endif
143 #ifndef MICROCONTROLLER_DEFINED
144 #define MICROCONTROLLER_DEFINED
145 #endif
146 #warning Selected HW: 8052
147 // 8051 register set
148 #define P0
149 #define SP
150 #define DPL
151 #define DPH
152 #define PCON
153 #define TCON
154 #define TMOD
155 #define TL0
156 #define TL1
157 #define TH0
158 #define TH1
159 #define P1
160 #define SCON
161 #define SBUF
162 #define P2
163 #define IE
164 #define P3
165 #define IP
166 #define PSW
167 #define ACC
168 #define B
169 // 8052 specific registers
170 #define IE_EXT_8052
171 #define T2CON
172 #define RCAP2L
173 #define RCAP2H
174 #define TL2
175 #define TH2
176 #endif
177 // end of definitions for the 8052 microcontroller
178
179
180 // definitionsons for the Atmel
181 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
182 #ifdef MICROCONTROLLER_AT89CX051
183 #ifdef MICROCONTROLLER_DEFINED
184 #define MCS51REG_ERROR
185 #endif
186 #ifndef MICROCONTROLLER_DEFINED
187 #define MICROCONTROLLER_DEFINED
188 #endif
189 #warning Selected HW: Atmel AT89Cx051
190 // 8051 register set without P0 & P2
191 #define SP
192 #define DPL
193 #define DPH
194 #define PCON
195 #define TCON
196 #define TMOD
197 #define TL0
198 #define TL1
199 #define TH0
200 #define TH1
201 #define P1
202 #define SCON
203 #define SBUF
204 #define IE
205 #define P3
206 #define IP
207 #define PSW
208 #define ACC
209 #define B
210 #endif
211 // end of definitionsons for the Atmel
212 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
213
214
215 // definitions for the Atmel AT89S53
216 #ifdef MICROCONTROLLER_AT89S53
217 #ifdef MICROCONTROLLER_DEFINED
218 #define MCS51REG_ERROR
219 #endif
220 #ifndef MICROCONTROLLER_DEFINED
221 #define MICROCONTROLLER_DEFINED
222 #endif
223 #warning Selected HW: AT89S53
224 // 8051 register set
225 #define P0
226 #define SP
227 #define DPL
228 #define DPH
229 #define PCON
230 #define TCON
231 #define TMOD
232 #define TL0
233 #define TL1
234 #define TH0
235 #define TH1
236 #define P1
237 #define SCON
238 #define SBUF
239 #define P2
240 #define IE
241 #define P3
242 #define IP
243 #define PSW
244 #define ACC
245 #define B
246 // 8052 specific registers
247 #define IE_EXT_8052
248 #define T2CON
249 #define RCAP2L
250 #define RCAP2H
251 #define TL2
252 #define TH2
253 // AT89S53 specific register
254 #define T2MOD
255 #define IP_EXT_AT89X52_55
256 #define SPCR
257 #define SPDR
258 #define SPSR
259 #define WCOM
260 #define DPL1
261 #define DPH1
262 #endif
263 // end of definitions for the Atmel AT89S53 microcontroller
264
265
266 // definitions for the Atmel AT89C52 and AT89LV52 microcontrollers
267 #ifdef MICROCONTROLLER_AT89X52
268 #ifdef MICROCONTROLLER_DEFINED
269 #define MCS51REG_ERROR
270 #endif
271 #ifndef MICROCONTROLLER_DEFINED
272 #define MICROCONTROLLER_DEFINED
273 #endif
274 #warning Selected HW: AT89C52 or AT89LV52
275 // 8051 register set
276 #define P0
277 #define SP
278 #define DPL
279 #define DPH
280 #define PCON
281 #define TCON
282 #define TMOD
283 #define TL0
284 #define TL1
285 #define TH0
286 #define TH1
287 #define P1
288 #define SCON
289 #define SBUF
290 #define P2
291 #define IE
292 #define P3
293 #define IP
294 #define PSW
295 #define ACC
296 #define B
297 // 8052 specific registers
298 #define IE_EXT_8052
299 #define T2CON
300 #define RCAP2L
301 #define RCAP2H
302 #define TL2
303 #define TH2
304 // AT89X52 specific register
305 #define T2MOD
306 #define IP_EXT_AT89X52_55
307 #endif
308 // end of definitions for the Atmel AT89C52 and AT89LV52 microcontrollers
309
310
311 // definitions for the Atmel AT89C55 and AT89LV55 microcontrollers
312 #ifdef MICROCONTROLLER_AT89X55
313 #ifdef MICROCONTROLLER_DEFINED
314 #define MCS51REG_ERROR
315 #endif
316 #ifndef MICROCONTROLLER_DEFINED
317 #define MICROCONTROLLER_DEFINED
318 #endif
319 #warning Selected HW: AT89C55 or AT89LV55
320 // 8051 register set
321 #define P0
322 #define SP
323 #define DPL
324 #define DPH
325 #define PCON
326 #define TCON
327 #define TMOD
328 #define TL0
329 #define TL1
330 #define TH0
331 #define TH1
332 #define P1
333 #define SCON
334 #define SBUF
335 #define P2
336 #define IE
337 #define P3
338 #define IP
339 #define PSW
340 #define ACC
341 #define B
342 // 8052 specific registers
343 #define IE_EXT_8052
344 #define T2CON
345 #define RCAP2L
346 #define RCAP2H
347 #define TL2
348 #define TH2
349 // AT89X52 specific register
350 #define T2MOD
351 #define IP_EXT_AT89X52_55
352 #endif
353 // end of definitions for the Atmel AT89C55 and AT89LV55 microcontrollers
354
355
356 // definitions for the Dallas DS80C320 and DS80C323 microcontrollers
357 #ifdef MICROCONTROLLER_DS80C32X
358 #ifdef MICROCONTROLLER_DEFINED
359 #define MCS51REG_ERROR
360 #endif
361 #ifndef MICROCONTROLLER_DEFINED
362 #define MICROCONTROLLER_DEFINED
363 #endif
364 #warning Selected HW: Dallas DS80C320 or DS80C323
365 // 8051 register set
366 #define P0
367 #define SP
368 #define DPL
369 #define DPH
370 #define PCON
371 #define TCON
372 #define TMOD
373 #define TL0
374 #define TL1
375 #define TH0
376 #define TH1
377 #define P1
378 #define SCON
379 #define SBUF
380 #define P2
381 #define IE
382 #define P3
383 #define IP
384 #define PSW
385 #define ACC
386 #define B
387 // 8052 specific registers
388 #define IE_EXT_80C320
389 #define T2CON
390 #define RCAP2L
391 #define RCAP2H
392 #define TL2
393 #define TH2
394 // DS80C320 specific register
395 #define P1_EXT_DS80C320
396 #define IP_EXT_DS80C320
397 #define PCON_EXT_DS8XCX2X
398 #define DPL1
399 #define DPH1
400 #define DPS
401 #define CKCON
402 #define EXIF_DS80C32X
403 #define SADDR0
404 #define SADDR1
405 #define SADEN0
406 #define SADEN1
407 #define SCON1
408 #define SBUF1
409 #define STATUS_DS80C32X
410 #define TA
411 #define T2MOD
412 #define WDCON
413 #define EIE
414 #define EIP
415 #endif
416 // end of definitions for the Dallas DS80C320 and DS80C323 microcontrollers
417
418
419 // definitions for the Dallas DS87C520 and DS83C520 microcontrollers
420 #ifdef MICROCONTROLLER_DS8XC520
421 #ifdef MICROCONTROLLER_DEFINED
422 #define MCS51REG_ERROR
423 #endif
424 #ifndef MICROCONTROLLER_DEFINED
425 #define MICROCONTROLLER_DEFINED
426 #endif
427 #warning Selected HW: Dallas DS87C520 or DS85C520
428 // 8051 register set
429 #define P0
430 #define SP
431 #define DPL
432 #define DPH
433 #define PCON
434 #define TCON
435 #define TMOD
436 #define TL0
437 #define TL1
438 #define TH0
439 #define TH1
440 #define P1
441 #define SCON
442 #define SBUF
443 #define P2
444 #define IE
445 #define P3
446 #define IP
447 #define PSW
448 #define ACC
449 #define B
450 // 8052 specific registers
451 #define IE_EXT_80C320
452 #define T2CON
453 #define RCAP2L
454 #define RCAP2H
455 #define TL2
456 #define TH2
457 // DS8XC520 specific registers
458 #define P1_EXT_DS80C320
459 #define IP_EXT_DS80C320
460 #define PCON_EXT_DS8XCX2X
461 #define DPL1
462 #define DPH1
463 #define DPS
464 #define CKCON
465 #define EXIF_DS8XC520
466 #define PMR
467 #define SADDR0
468 #define SADDR1
469 #define SADEN0
470 #define SADEN1
471 #define SCON1
472 #define SBUF1
473 #define STATUS_DS80C32X
474 #define TA
475 #define T2MOD
476 #define WDCON
477 #define ROMSIZE
478 #define WDCON
479 #define EIE
480 #define EIP
481 #endif
482 // end of definitions for the Dallas DS87C520 and DS83C520 microcontrollers
483
484
485 // definitions for the Infineon / Siemens SAB80515 & SAB80535
486 #ifdef MICROCONTROLLER_SAB80515
487 #ifdef MICROCONTROLLER_DEFINED
488 #define MCS51REG_ERROR
489 #endif
490 #ifndef MICROCONTROLLER_DEFINED
491 #define MICROCONTROLLER_DEFINED
492 #endif
493 #warning Selected HW: Infineon / Siemens SAB80515 & SAB80535
494 // 8051 register set without IP & PCON
495 #define P0
496 #define SP
497 #define DPL
498 #define DPH
499 #define TCON
500 #define TMOD
501 #define TL0
502 #define TL1
503 #define TH0
504 #define TH1
505 #define P1
506 #define SCON
507 #define SBUF
508 #define P2
509 #define IE
510 #define P3
511 #define PSW
512 #define ACC
513 #define B
514 // SAB80515 specific registers
515 #define IE_EXT_SAB80515X // Definitions for additional Bit registers
516 #define P1_EXT_SAB80515X // P1 alternate functions - SAB80515 specific
517 #define PCON_80515      // PCON - SAB80515 specific
518 #define IP0             // interrupt priority register - SAB80515 specific
519 #define IEN1            // interrupt enable register - SAB80515 specific
520 #define IRCON           // interrupt control register - SAB80515 specific
521 #define CCEN            // compare/capture enable register
522 #define CCL1            // compare/capture register 1, low byte
523 #define CCH1            // compare/capture register 1, high byte
524 #define CCL2            // compare/capture register 2, low byte
525 #define CCH2            // compare/capture register 2, high byte
526 #define CCL3            // compare/capture register 3, low byte
527 #define CCH3            // compare/capture register 3, high byte
528 #define T2CON_SABX
529 #define CRCL            // compare/reload/capture register, low byte
530 #define CRCH            // compare/reload/capture register, high byte
531 #define TL2
532 #define TH2
533 #define ADCON           // A/D-converter control register
534 #define ADDAT           // A/D-converter data register
535 #define DAPR_SAB80515   // D/A-converter program register
536 #define P4_SAB80515     // Port 4 - SAB80515 specific
537 #define P5_SAB80515     // Port 5 - SAB80515 specific
538 #endif
539 // end of definitions for the Infineon / Siemens SAB80515
540
541
542 // definitions for the Infineon / Siemens SAB80515A
543 #ifdef MICROCONTROLLER_SAB80515A
544 #ifdef MICROCONTROLLER_DEFINED
545 #define MCS51REG_ERROR
546 #endif
547 #ifndef MICROCONTROLLER_DEFINED
548 #define MICROCONTROLLER_DEFINED
549 #endif
550 #warning Selected HW: Infineon / Siemens SAB80515A
551 // 8051 register set without IP
552 #define P0
553 #define SP
554 #define DPL
555 #define DPH
556 #define PCON
557 #define TCON
558 #define TMOD
559 #define TL0
560 #define TL1
561 #define TH0
562 #define TH1
563 #define P1
564 #define SCON
565 #define SBUF
566 #define P2
567 #define IE
568 #define P3
569 #define PSW
570 #define ACC
571 #define B
572 // SAB80515A specific registers
573 #define IE_EXT_SAB80515X // Definitions for additional Bit registers
574 #define P1_EXT_SAB80515X // P1 alternate functions - SAB80515 specific
575 #define PCON_EXT_80515A  // Definitions for additional Bit registers
576 #define IP0             // interrupt priority register - SAB80515 specific
577 #define IP1             // interrupt priority register - SAB80515 specific
578 #define IEN1            // interrupt enable register - SAB80515 specific
579 #define IRCON           // interrupt control register - SAB80515 specific
580 #define CCEN            // compare/capture enable register
581 #define CCL1            // compare/capture register 1, low byte
582 #define CCH1            // compare/capture register 1, high byte
583 #define CCL2            // compare/capture register 2, low byte
584 #define CCH2            // compare/capture register 2, high byte
585 #define CCL3            // compare/capture register 3, low byte
586 #define CCH3            // compare/capture register 3, high byte
587 #define T2CON_SABX
588 #define CRCL            // compare/reload/capture register, low byte
589 #define CRCH            // compare/reload/capture register, high byte
590 #define TL2
591 #define TH2
592 #define ADCON0          // A/D-converter control register 0
593 #define ADDATH          // A/D data high byte
594 #define ADDATL          // A/D data low byte
595 #define ADCON1          // A/D-converter control register 1
596 #define SRELL           // Baudrate generator reload low
597 #define SYSCON          // XRAM Controller Access Control
598 #define SRELH           // Baudrate generator reload high
599 #define P4_SAB80515     // Port 4 - SAB80515 specific
600 #define P5_SAB80515     // Port 5 - SAB80515 specific
601 #define P6_SAB80515     // Port 6 - SAB80515 specific
602 #define XPAGE           // Page Address Register for Extended On-Chip RAM
603 #endif
604 // end of definitions for the Infineon / Siemens SAB80515A
605
606
607 // definitions for the Infineon / Siemens SAB80517
608 #ifdef MICROCONTROLLER_SAB80517
609 #ifdef MICROCONTROLLER_DEFINED
610 #define MCS51REG_ERROR
611 #endif
612 #ifndef MICROCONTROLLER_DEFINED
613 #define MICROCONTROLLER_DEFINED
614 #endif
615 #warning Selected HW: Infineon / Siemens SAB80517
616 // 8051 register set without IP, SCON & SBUF
617 #define P0
618 #define SP
619 #define DPL
620 #define DPH
621 #define PCON
622 #define TCON
623 #define TMOD
624 #define TL0
625 #define TL1
626 #define TH0
627 #define TH1
628 #define P1
629 // #define SCON
630 // #define SBUF
631 #define P2
632 #define IE
633 #define P3
634 #define PSW
635 #define ACC
636 #define B
637 // SAB80517 specific registers
638 #define IE_EXT_SAB80515X // Definitions for additional Bit registers
639 #define P1_EXT_SAB80515X // P1 alternate functions - SAB80515 specific
640 #define PCON_EXT_80515A  // Definitions for additional Bit registers
641 #define IP0             // interrupt priority register - SAB80517 specific
642 #define IP1             // interrupt priority register - SAB80517 specific
643 #define IEN1            // interrupt enable register - SAB80517 specific
644 #define IEN2_SAB80517   // interrupt enable register 2 - SAB80517 specific
645 #define IRCON           // interrupt control register - SAB80517 specific
646 #define CCEN            // compare/capture enable register
647 #define CCL1            // compare/capture register 1, low byte
648 #define CCH1            // compare/capture register 1, high byte
649 #define CCL2            // compare/capture register 2, low byte
650 #define CCH2            // compare/capture register 2, high byte
651 #define CCL3            // compare/capture register 3, low byte
652 #define CCH3            // compare/capture register 3, high byte
653 #define CCL4            // compare/capture register 4, low byte
654 #define CCH4            // compare/capture register 4, high byte
655 #define CC4EN           // compare/capture register 4 enable
656 #define CMEN            // compare enable register
657 #define CMH0            // compare register 0, high byte
658 #define CML0            // compare register 0, low byte
659 #define CMH1            // compare register 1, high byte
660 #define CML1            // compare register 1, low byte
661 #define CMH2            // compare register 2, high byte
662 #define CML2            // compare register 2, low byte
663 #define CMH3            // compare register 3, high byte
664 #define CML3            // compare register 3, low byte
665 #define CMH4            // compare register 4, high byte
666 #define CML4            // compare register 4, low byte
667 #define CMH5            // compare register 5, high byte
668 #define CML5            // compare register 5, low byte
669 #define CMH6            // compare register 6, high byte
670 #define CML6            // compare register 6, low byte
671 #define CMH7            // compare register 7, high byte
672 #define CML7            // compare register 7, low byte
673 #define CMSEL           // compare input select
674 #define T2CON_SABX
675 #define CRCL            // compare/reload/capture register, low byte
676 #define CRCH            // compare/reload/capture register, high byte
677 #define CTCON           // com.timer control register
678 #define CTRELH          // com.timer rel register high byte
679 #define CTRELL          // com.timer rel register low byte
680 #define TL2
681 #define TH2
682 #define ADCON0          // A/D-converter control register 0
683 #define ADCON1          // A/D-converter control register 1
684 #define ADDAT           // A/D-converter data register
685 #define DAPR_SAB80517   // D/A-converter program register
686 #define P4_SAB80515     // Port 4 - SAB80515 specific
687 #define P5_SAB80515     // Port 5 - SAB80515 specific
688 #define P6_SAB80517     // Port 6 - SAB80517 specific
689 #define P7_SAB80517     // Port 7 - SAB80517 specific
690 #define P8_SAB80517     // Port 8 - SAB80517 specific
691 #define DPSEL           // data pointer select register
692 #define ARCON           // Arithmetic Ctrl. Register
693 #define MD0             // MUL / DIV register 0
694 #define MD1             // MUL / DIV register 1
695 #define MD2             // MUL / DIV register 2
696 #define MD3             // MUL / DIV register 3
697 #define MD4             // MUL / DIV register 4
698 #define MD5             // MUL / DIV register 5
699 #define S0BUF           // serial 0 buffer register
700 #define S0CON           // serial 0 control register
701 #define S0RELH          // serial 0 reload register high byte
702 #define S0RELL          // serial 0 reload register low byte
703 #define S1BUF           // serial 0 buffer register
704 #define S1CON           // serial 0 control register
705 #define S1RELH          // serial 0 reload register high byte
706 #define S1RELL          // serial 0 reload register low byte
707 #define WDTH            // watchdog timer high byte
708 #define WDTL            // watchdog timer low byte
709 #define WDTREL          // watchdog timer reload register
710 #endif
711 // end of definitions for the Infineon / Siemens SAB80517
712
713
714 /////////////////////////////////////////////////////////
715 ///  don't specify microcontrollers below this line!  ///
716 /////////////////////////////////////////////////////////
717
718
719 // default microcontroller -> 8051
720 // use default if no microcontroller specified
721 #ifndef MICROCONTROLLER_DEFINED
722 #define MICROCONTROLLER_DEFINED
723 #warning //////////////////////////////////
724 #warning // No microcontroller defined!  //
725 #warning //////////////////////////////////
726 #warning Code will be generated for the
727 #warning 8051 (default) microcontroller.
728 #warning If you have another microcontroller
729 #warning define it in the makefile, or in the
730 #warning "C" source prior
731 #warning the #include <mcs51reg.h> statement.
732 #warning If you use a non supported
733 #warning microcontroller, mcs51reg.h can be
734 #warning easily extended to support your HW.
735 // 8051 register set
736 #define P0
737 #define SP
738 #define DPL
739 #define DPH
740 #define PCON
741 #define TCON
742 #define TMOD
743 #define TL0
744 #define TL1
745 #define TH0
746 #define TH1
747 #define P1
748 #define SCON
749 #define SBUF
750 #define P2
751 #define IE
752 #define P3
753 #define IP
754 #define PSW
755 #define ACC
756 #define B
757 #endif
758 // end of definitions for the default microcontroller
759
760
761 #ifdef MCS51REG_ERROR
762 #error Two or more microcontrollers defined!
763 #endif
764
765 ////////////////////////////////
766 ///  Register definitions    ///
767 ///  (In alphabetical order) ///
768 ////////////////////////////////
769
770 #ifdef ACC
771 #undef ACC
772 sfr at 0xE0 ACC  ;
773 #endif
774
775 #ifdef ADCON
776 #undef ADCON
777 sfr at 0xD8 ADCON   ; // A/D-converter control register SAB80515 specific
778 // Bit registers
779 sbit at 0xD8 MX0        ;
780 sbit at 0xD9 MX1        ;
781 sbit at 0xDA MX2        ;
782 sbit at 0xDB ADM        ;
783 sbit at 0xDC BSY        ;
784 sbit at 0xDE CLK        ;
785 sbit at 0xDF BD         ;
786 #endif
787
788 // ADCON0 ... Infineon / Siemens also called this register ADCON in the User Manual
789 #ifdef ADCON0
790 #undef ADCON0
791 sfr at 0xD8 ADCON0      ; // A/D-converter control register 0 SAB80515A &
792 // Bit registers          // SAB80517 specific
793 sbit at 0xD8 MX0        ;
794 sbit at 0xD9 MX1        ;
795 sbit at 0xDA MX2        ;
796 sbit at 0xDB ADM        ;
797 sbit at 0xDC BSY        ;
798 sbit at 0xDD ADEX       ;
799 sbit at 0xDE CLK        ;
800 sbit at 0xDF BD         ;
801 // Not directly accessible ADCON0
802 #define ADCON0_MX0      0x01
803 #define ADCON0_MX1      0x02
804 #define ADCON0_MX2      0x04
805 #define ADCON0_ADM      0x08
806 #define ADCON0_BSY      0x10
807 #define ADCON0_ADEX     0x20
808 #define ADCON0_CLK      0x40
809 #define ADCON0_BD       0x80
810 #endif
811
812 #ifdef ADCON1
813 #undef ADCON1
814 sfr at 0xDC ADCON1      ; // A/D-converter control register 1 SAB80515A & SAB80517 specific
815 // Not directly accessible ADCON1
816 #define ADCON1_MX0      0x01
817 #define ADCON1_MX1      0x02
818 #define ADCON1_MX2      0x04
819 #define ADCON1_ADCL     0x80
820 #endif
821
822 #ifdef ADDAT
823 #undef ADDAT
824 sfr at 0xD9 ADDAT   ; // A/D-converter data register SAB80515 specific
825 #endif
826
827 #ifdef ADDATH
828 #undef ADDATH
829 sfr at 0xD9 ADDATH      ; // A/D data high byte SAB80515A specific
830 #endif
831
832 #ifdef ADDATL
833 #undef ADDATL
834 sfr at 0xDA ADDATL      ; // A/D data low byte SAB80515A specific
835 #endif
836
837 #ifdef ARCON
838 #undef ARCON
839 sfr at 0xEF ARCON       ; // arithmetic control register SAB80517
840 #endif
841
842 #ifdef B
843 #undef B
844 sfr at 0xF0 B    ;
845 // Bit registers
846 sbit at 0xF0 BREG_F0        ;
847 sbit at 0xF1 BREG_F1        ;
848 sbit at 0xF2 BREG_F2        ;
849 sbit at 0xF3 BREG_F3        ;
850 sbit at 0xF4 BREG_F4        ;
851 sbit at 0xF5 BREG_F5        ;
852 sbit at 0xF6 BREG_F6        ;
853 sbit at 0xF7 BREG_F7        ;
854 #endif
855
856 #ifdef CC4EN
857 #undef CC4EN
858 sfr at 0xC9 CC4EN       ; // compare/capture 4 enable register SAB80517 specific
859 #endif
860
861 #ifdef CCEN
862 #undef CCEN
863 sfr at 0xC1 CCEN        ; // compare/capture enable register SAB80515 specific
864 #endif
865
866 #ifdef CCH1
867 #undef CCH1
868 sfr at 0xC3 CCH1        ; // compare/capture register 1, high byte SAB80515 specific
869 #endif
870
871 #ifdef CCH2
872 #undef CCH2
873 sfr at 0xC5 CCH2        ; // compare/capture register 2, high byte SAB80515 specific
874 #endif
875
876 #ifdef CCH3
877 #undef CCH3
878 sfr at 0xC7 CCH3        ; // compare/capture register 3, high byte SAB80515 specific
879 #endif
880
881 #ifdef CCH4
882 #undef CCH4
883 sfr at 0xCF CCH4        ; // compare/capture register 4, high byte SAB80515 specific
884 #endif
885
886 #ifdef CCL1
887 #undef CCL1
888 sfr at 0xC2 CCL1        ; // compare/capture register 1, low byte SAB80515 specific
889 #endif
890
891 #ifdef CCL2
892 #undef CCL2
893 sfr at 0xC4 CCL2        ; // compare/capture register 2, low byte SAB80515 specific
894 #endif
895
896 #ifdef CCL3
897 #undef CCL3
898 sfr at 0xC6 CCL3        ; // compare/capture register 3, low byte SAB80515 specific
899 #endif
900
901 #ifdef CCL4
902 #undef CCL4
903 sfr at 0xCE CCL4        ; // compare/capture register 4, low byte SAB80515 specific
904 #endif
905
906 #ifdef CKCON
907 #undef CKCON
908 sfr at 0x8E CKCON       ; // DS80C320 specific
909 // Not directly accessible Bits. DS80C320 specific
910 #define MD0    0x01
911 #define MD1    0x02
912 #define MD2    0x04
913 #define T0M    0x08
914 #define T1M    0x10
915 #define T2M    0x20
916 #define WD0    0x40
917 #define WD1    0x80
918 #endif
919
920 #ifdef CMEN
921 #undef CMEN
922 sfr at 0xF6 CMEN    ; // compare enable register SAB80517 specific
923 #endif
924
925 #ifdef CMH0
926 #undef CMH0
927 sfr at 0xD3 CMH0    ; // compare register 0 high byte SAB80517 specific
928 #endif
929
930 #ifdef CMH1
931 #undef CMH1
932 sfr at 0xD5 CMH1    ; // compare register 1 high byte SAB80517 specific
933 #endif
934
935 #ifdef CMH2
936 #undef CMH2
937 sfr at 0xD7 CMH2    ; // compare register 2 high byte SAB80517 specific
938 #endif
939
940 #ifdef CMH3
941 #undef CMH3
942 sfr at 0xE3 CMH3    ; // compare register 3 high byte SAB80517 specific
943 #endif
944
945 #ifdef CMH4
946 #undef CMH4
947 sfr at 0xE5 CMH4    ; // compare register 4 high byte SAB80517 specific
948 #endif
949
950 #ifdef CMH5
951 #undef CMH5
952 sfr at 0xE7 CMH5    ; // compare register 5 high byte SAB80517 specific
953 #endif
954
955 #ifdef CMH6
956 #undef CMH6
957 sfr at 0xF3 CMH6    ; // compare register 6 high byte SAB80517 specific
958 #endif
959
960 #ifdef CMH7
961 #undef CMH7
962 sfr at 0xF5 CMH7    ; // compare register 7 high byte SAB80517 specific
963 #endif
964
965 #ifdef CML0
966 #undef CML0
967 sfr at 0xD2 CML0    ; // compare register 0 low byte SAB80517 specific
968 #endif
969
970 #ifdef CML1
971 #undef CML1
972 sfr at 0xD4 CML1    ; // compare register 1 low byte SAB80517 specific
973 #endif
974
975 #ifdef CML2
976 #undef CML2
977 sfr at 0xD6 CML2    ; // compare register 2 low byte SAB80517 specific
978 #endif
979
980 #ifdef CML3
981 #undef CML3
982 sfr at 0xE2 CML3    ; // compare register 3 low byte SAB80517 specific
983 #endif
984
985 #ifdef CML4
986 #undef CML4
987 sfr at 0xE4 CML4    ; // compare register 4 low byte SAB80517 specific
988 #endif
989
990 #ifdef CML5
991 #undef CML5
992 sfr at 0xE6 CML5    ; // compare register 5 low byte SAB80517 specific
993 #endif
994
995 #ifdef CML6
996 #undef CML6
997 sfr at 0xF2 CML6    ; // compare register 6 low byte SAB80517 specific
998 #endif
999
1000 #ifdef CML7
1001 #undef CML7
1002 sfr at 0xF4 CML7    ; // compare register 7 low byte SAB80517 specific
1003 #endif
1004
1005 #ifdef CMSEL
1006 #undef CMSEL
1007 sfr at 0xF7 CMSEL   ; // compare input select SAB80517
1008 #endif
1009
1010 #ifdef CRCH
1011 #undef CRCH
1012 sfr at 0xCB CRCH    ; // compare/reload/capture register, high byte SAB80515 specific
1013 #endif
1014
1015 #ifdef CRCL
1016 #undef CRCL
1017 sfr at 0xCA CRCL    ; // compare/reload/capture register, low byte SAB80515 specific
1018 #endif
1019
1020 #ifdef CTCON
1021 #undef CTCON
1022 sfr at 0xE1 CTCON    ; // com.timer control register SAB80517
1023 #endif
1024
1025 #ifdef CTRELH
1026 #undef CTRELH
1027 sfr at 0xDF CTRELH  ; // com.timer rel register high byte SAB80517
1028 #endif
1029
1030 #ifdef CTRELL
1031 #undef CTRELL
1032 sfr at 0xDE CTRELL  ; // com.timer rel register low byte SAB80517
1033 #endif
1034
1035 #ifdef DAPR_SAB80515
1036 #undef DAPR_SAB80515
1037 sfr at 0xD8 DAPR    ; // D/A-converter program register SAB80515 specific
1038 #endif
1039
1040 #ifdef DAPR_SAB80517
1041 #undef DAPR_SAB80517
1042 sfr at 0xDA DAPR    ; // D/A-converter program register SAB80517 specific
1043 #endif
1044
1045 #ifdef DPH
1046 #undef DPH
1047 sfr at 0x83 DPH  ;
1048 sfr at 0x83 DP0H ;  // Alternate name for AT89S53
1049 #endif
1050
1051 #ifdef DPH1
1052 #undef DPH1
1053 sfr at 0x85 DPH1  ; // DS80C320 specific
1054 sfr at 0x85 DP1H  ; // Alternate name for AT89S53
1055 #endif
1056
1057 #ifdef DPL
1058 #undef DPL
1059 sfr at 0x82 DPL  ;  // Alternate name for AT89S53
1060 sfr at 0x82 DP0L ;
1061 #endif
1062
1063 #ifdef DPL1
1064 #undef DPL1
1065 sfr at 0x84 DPL1  ; // DS80C320 specific
1066 sfr at 0x84 DP1L  ; // Alternate name for AT89S53
1067 #endif
1068
1069 #ifdef DPS
1070 #undef DPS
1071 sfr at 0x86 DPS  ;
1072 // Not directly accessible DPS Bit. DS80C320 specific
1073 #define SEL_    0x01
1074 #endif
1075
1076 #ifdef DPSEL
1077 #undef DPSEL
1078 sfr at 0x92 DPSEL   ; // data pointer select register SAB80517
1079 #endif
1080
1081 #ifdef EXIF_DS80C32X
1082 #undef EXIF_DS80C32X
1083 sfr at 0x91 EXIF  ;
1084 // Not directly accessible EXIF Bits DS80C320 specific
1085 #define BGS    0x01
1086 #define RGSL   0x02
1087 #define RGMD   0x04
1088 #define IE2    0x10
1089 #define IE3    0x20
1090 #define IE4    0x40
1091 #define IE5    0x80
1092 #endif
1093
1094 #ifdef EXIF_DS8XC520
1095 #undef EXIF_DS8XC520
1096 sfr at 0x91 EXIF  ;
1097 // Not directly accessible EXIF Bits DS87C520 specific
1098 #define BGS    0x01
1099 #define RGSL   0x02
1100 #define RGMD   0x04
1101 #define XT_RG  0x08
1102 #define IE2    0x10
1103 #define IE3    0x20
1104 #define IE4    0x40
1105 #define IE5    0x80
1106 #endif
1107
1108 #ifdef EIE
1109 #undef EIE
1110 sfr at 0xE8 EIE  ;
1111 // Bit registers DS80C320 specific
1112 sbit at 0xE8 EX2    ;
1113 sbit at 0xE9 EX3    ;
1114 sbit at 0xEA EX4    ;
1115 sbit at 0xEB EX5    ;
1116 sbit at 0xEC EWDI   ;
1117 #endif
1118
1119 #ifdef EIP
1120 #undef EIP
1121 sfr at 0xE8 EIP  ;
1122 // Bit registers DS80C320 specific
1123 sbit at 0xF8 PX2    ;
1124 sbit at 0xF9 PX3    ;
1125 sbit at 0xFA PX4    ;
1126 sbit at 0xFB PX5    ;
1127 sbit at 0xFC PWDI   ;
1128 #endif
1129
1130 #ifdef IE
1131 #undef IE
1132 sfr at 0xA8 IE   ;
1133 // Bit registers
1134 sbit at 0xA8 EX0  ;
1135 sbit at 0xA9 ET0  ;
1136 sbit at 0xAA EX1  ;
1137 sbit at 0xAB ET1  ;
1138 sbit at 0xAC ES   ;
1139 sbit at 0xAF EA   ;
1140 #endif
1141
1142 #ifdef IE_EXT_8052
1143 #undef IE_EXT_8052
1144 // Additional bit register for the 8052 and compatible IE
1145 sbit at 0xAD ET2  ; // Enable timer2 interrupt
1146 #endif // IE
1147
1148 #ifdef IE_EXT_SAB80515X
1149 #undef IE_EXT_SAB80515X
1150 sfr at 0xA8 IEN0   ;
1151 // Additional bit register for the SAB80515 and compatible IE
1152 sbit at 0xAC ES0        ;
1153 sbit at 0xAD ET2        ; // Enable timer 2 overflow SAB80515 specific
1154 sbit at 0xAE WDT        ; // watchdog timer reset - SAB80515 specific
1155 sbit at 0xAF EAL        ; // EA as called by Infineon / Siemens
1156 #endif
1157
1158 #ifdef IEN1
1159 #undef IEN1
1160 sfr at 0xB8 IEN1        ; // interrupt enable register - SAB80515 specific
1161 // Bit registers
1162 sbit at 0xB8 EADC       ; // A/D converter interrupt enable
1163 sbit at 0xB9 EX2        ;
1164 sbit at 0xBA EX3        ;
1165 sbit at 0xBB EX4        ;
1166 sbit at 0xBC EX5        ;
1167 sbit at 0xBD EX6        ;
1168 sbit at 0xBE SWDT       ; // watchdog timer start/reset
1169 sbit at 0xBF EXEN2      ; // timer2 external reload interrupt enable
1170 #endif
1171
1172 #ifdef IEN2_SAB80517
1173 #undef IEN2_SAB80517
1174 sfr at 0x9A IEN2        ; // interrupt enable register 2 SAB80517
1175 #endif
1176
1177 #ifdef IP
1178 #undef IP
1179 sfr at 0xB8 IP   ;
1180 // Bit registers
1181 sbit at 0xB8 PX0  ;
1182 sbit at 0xB9 PT0  ;
1183 sbit at 0xBA PX1  ;
1184 sbit at 0xBB PT1  ;
1185 sbit at 0xBC PS   ;
1186 #endif
1187
1188 #ifdef IP_EXT_AT89X52_55
1189 #undef IP_EXT_AT89X52_55
1190 // Additional bit register for the AT89C52 and compatible
1191 sbit at 0xBD PT2        ;
1192 #endif
1193
1194 #ifdef IP_EXT_DS80C320
1195 #undef IP_EXT_DS80C320
1196 // Additional bit register for the DS80C320 and compatible
1197 sbit at 0xBD PT2        ;
1198 sbit at 0xBE PS1        ;
1199 #endif
1200
1201 #ifdef IP0
1202 #undef IP0
1203 sfr at 0xA9 IP0         ; // interrupt priority register SAB80515 specific
1204 // Not directly accessible IP1 bits
1205 #define IP0_0    0x01
1206 #define IP0_1    0x02
1207 #define IP0_2    0x04
1208 #define IP0_3    0x08
1209 #define IP0_4    0x10
1210 #define IP0_5    0x20
1211 #define WDTS     0x40
1212 #endif
1213
1214 #ifdef IP1
1215 #undef IP1
1216 sfr at 0xB9 IP1         ; // interrupt priority register SAB80515 specific
1217 // Not directly accessible IP1 bits
1218 #define IP1_0    0x01
1219 #define IP1_1    0x02
1220 #define IP1_2    0x04
1221 #define IP1_3    0x08
1222 #define IP1_4    0x10
1223 #define IP1_5    0x20
1224 #endif
1225
1226 #ifdef IRCON
1227 #undef IRCON
1228 sfr at 0xC0 IRCON       ; // interrupt control register - SAB80515 specific
1229 // Bit registers
1230 sbit at 0xC0 IADC       ; // A/D converter irq flag
1231 sbit at 0xC1 IEX2       ; // external interrupt edge detect flag
1232 sbit at 0xC2 IEX3       ;
1233 sbit at 0xC3 IEX4       ;
1234 sbit at 0xC4 IEX5       ;
1235 sbit at 0xC5 IEX6       ;
1236 sbit at 0xC6 TF2        ; // timer 2 owerflow flag
1237 sbit at 0xC7 EXF2       ; // timer2 reload flag
1238 #endif
1239
1240 #ifdef IRCON0
1241 #undef IRCON0
1242 sfr at 0xC0 IRCON0       ; // interrupt control register - SAB80515 specific
1243 // Bit registers
1244 sbit at 0xC0 IADC       ; // A/D converter irq flag
1245 sbit at 0xC1 IEX2       ; // external interrupt edge detect flag
1246 sbit at 0xC2 IEX3       ;
1247 sbit at 0xC3 IEX4       ;
1248 sbit at 0xC4 IEX5       ;
1249 sbit at 0xC5 IEX6       ;
1250 sbit at 0xC6 TF2        ; // timer 2 owerflow flag
1251 sbit at 0xC7 EXF2       ; // timer2 reload flag
1252 #endif
1253
1254 #ifdef IRCON1
1255 #undef IRCON1
1256 sfr at 0xD1 IRCON1      ; // interrupt control register - SAB80515 specific
1257 #endif
1258
1259 #ifdef MD0
1260 #undef MD0
1261 sfr at 0xE9 MD0         ; // MUL / DIV register 0 SAB80517
1262 #endif
1263
1264 #ifdef MD1
1265 #undef MD1
1266 sfr at 0xEA MD1         ; // MUL / DIV register 1 SAB80517
1267 #endif
1268
1269 #ifdef MD2
1270 #undef MD2
1271 sfr at 0xEB MD2         ; // MUL / DIV register 2 SAB80517
1272 #endif
1273
1274 #ifdef MD3
1275 #undef MD3
1276 sfr at 0xEC MD3         ; // MUL / DIV register 3 SAB80517
1277 #endif
1278
1279 #ifdef MD4
1280 #undef MD4
1281 sfr at 0xED MD4         ; // MUL / DIV register 4 SAB80517
1282 #endif
1283
1284 #ifdef MD5
1285 #undef MD5
1286 sfr at 0xEE MD5         ; // MUL / DIV register 5 SAB80517
1287 #endif
1288
1289 #ifdef P0
1290 #undef P0
1291 sfr at 0x80 P0   ;
1292 //  Bit Registers
1293 sbit at 0x80 P0_0 ;
1294 sbit at 0x81 P0_1 ;
1295 sbit at 0x82 P0_2 ;
1296 sbit at 0x83 P0_3 ;
1297 sbit at 0x84 P0_4 ;
1298 sbit at 0x85 P0_5 ;
1299 sbit at 0x86 P0_6 ;
1300 sbit at 0x87 P0_7 ;
1301 #endif
1302
1303 #ifdef P1
1304 #undef P1
1305 sfr at 0x90 P1   ;
1306 // Bit registers
1307 sbit at 0x90 P1_0 ;
1308 sbit at 0x91 P1_1 ;
1309 sbit at 0x92 P1_2 ;
1310 sbit at 0x93 P1_3 ;
1311 sbit at 0x94 P1_4 ;
1312 sbit at 0x95 P1_5 ;
1313 sbit at 0x96 P1_6 ;
1314 sbit at 0x97 P1_7 ;
1315 #ifdef T2MOD
1316 // P1 alternate functions
1317 sbit at 0x90 T2         ;
1318 sbit at 0x91 T2EX       ;
1319 #endif
1320 #endif
1321
1322 #ifdef P1_EXT_DS80C320
1323 #undef P1_EXT_DS80C320
1324 // P1 alternate functions
1325 sbit at 0x92 RXD1 ;
1326 sbit at 0x93 TXD1 ;
1327 sbit at 0x94 INT2 ;
1328 sbit at 0x95 INT3 ;
1329 sbit at 0x96 INT4 ;
1330 sbit at 0x97 INT5 ;
1331 #endif
1332
1333 #ifdef P1_EXT_SAB80515X
1334 sbit at 0x90 INT3_CC0   ; // P1 alternate functions - SAB80515 specific
1335 sbit at 0x91 INT4_CC1   ;
1336 sbit at 0x92 INT5_CC2   ;
1337 sbit at 0x93 INT6_CC3   ;
1338 sbit at 0x94 INT2       ;
1339 sbit at 0x95 T2EX       ;
1340 sbit at 0x96 CLKOUT     ;
1341 sbit at 0x97 T2         ;
1342 #endif
1343
1344 #ifdef P2
1345 #undef P2
1346 sfr at 0xA0 P2   ;
1347 // Bit registers
1348 sbit at 0xA0 P2_0 ;
1349 sbit at 0xA1 P2_1 ;
1350 sbit at 0xA2 P2_2 ;
1351 sbit at 0xA3 P2_3 ;
1352 sbit at 0xA4 P2_4 ;
1353 sbit at 0xA5 P2_5 ;
1354 sbit at 0xA6 P2_6 ;
1355 sbit at 0xA7 P2_7 ;
1356 #endif
1357
1358 #ifdef P3
1359 #undef P3
1360 sfr at 0xB0 P3   ;
1361 // Bit registers
1362 sbit at 0xB0 P3_0 ;
1363 sbit at 0xB1 P3_1 ;
1364 sbit at 0xB2 P3_2 ;
1365 sbit at 0xB3 P3_3 ;
1366 sbit at 0xB4 P3_4 ;
1367 sbit at 0xB5 P3_5 ;
1368 sbit at 0xB6 P3_6 ;
1369 sbit at 0xB7 P3_7 ;
1370 // alternate names
1371 sbit at 0xB0 RXD  ;
1372 sbit at 0xB1 TXD  ;
1373 sbit at 0xB2 INT0 ;
1374 sbit at 0xB3 INT1 ;
1375 sbit at 0xB4 T0   ;
1376 sbit at 0xB5 T1   ;
1377 sbit at 0xB6 WR   ;
1378 sbit at 0xB7 RD   ;
1379 #endif
1380
1381 #ifdef P4_SAB80515
1382 #undef P4_SAB80515
1383 sfr at 0xE8 P4          ; // Port 4 - SAB80515 & compatible microcontrollers
1384 // Bit registers
1385 sbit at 0xE8 P4_0       ;
1386 sbit at 0xE9 P4_1       ;
1387 sbit at 0xEA P4_2       ;
1388 sbit at 0xEB P4_3       ;
1389 sbit at 0xEC P4_4       ;
1390 sbit at 0xED P4_5       ;
1391 sbit at 0xEE P4_6       ;
1392 sbit at 0xEF P4_7       ;
1393 #endif
1394
1395 #ifdef P5_SAB80515
1396 #undef P5_SAB80515
1397 sfr at 0xF8 P5          ; // Port 5 - SAB80515 & compatible microcontrollers
1398 // Bit registers
1399 sbit at 0xF8 P5_0       ;
1400 sbit at 0xF9 P5_1       ;
1401 sbit at 0xFA P5_2       ;
1402 sbit at 0xFB P5_3       ;
1403 sbit at 0xFC P5_4       ;
1404 sbit at 0xFD P5_5       ;
1405 sbit at 0xFE P5_6       ;
1406 sbit at 0xFF P5_7       ;
1407 #endif
1408
1409 #ifdef P6_SAB80515
1410 #undef P6_SAB80515
1411 sfr at 0xDB P6          ; // Port 6 - SAB80515 & compatible microcontrollers
1412 #endif
1413
1414 #ifdef P6_SAB80517
1415 #undef P6_SAB80517
1416 sfr at 0xFA P6          ; // Port 6 - SAB80517 specific
1417 #endif
1418
1419 #ifdef P7_SAB80517
1420 #undef P7_SAB80517
1421 sfr at 0xDB P7          ; // Port 7 - SAB80517 specific
1422 #endif
1423
1424 #ifdef P8_SAB80517
1425 #undef P8_SAB80517
1426 sfr at 0xDD P8          ; // Port 6 - SAB80517 specific
1427 #endif
1428
1429 #ifdef PCON
1430 #undef PCON
1431 sfr at 0x87 PCON ;
1432 // Not directly accessible PCON bits
1433 #define IDL             0x01
1434 #define PD              0x02
1435 #define GF0             0x04
1436 #define GF1             0x08
1437 #define SMOD            0x80
1438 #endif
1439
1440 #ifdef PCON_80515
1441 #undef PCON_80515
1442 sfr at 0x87 PCON ;
1443 // Not directly accessible PCON bits
1444 #define SMOD    0x80
1445 #endif
1446
1447 #ifdef PCON_EXT_80515A
1448 #undef PCON_EXT_80515A
1449 // Not directly accessible PCON bits
1450 #define IDLE            0x01  ; same as IDL
1451 #define PDE             0x02  ; same as PD
1452 #define IDLS            0x20
1453 #define PDS             0x40
1454 // alternate names
1455 #define PCON_IDLE       0x01
1456 #define PCON_PDE        0x02
1457 #define PCON_GF0        0x04
1458 #define PCON_GF1        0x08
1459 #define PCON_IDLS       0x20
1460 #define PCON_PDS        0x40
1461 #define PCON_SMOD       0x80
1462 #endif
1463
1464 #ifdef PCON_EXT_DS8XCX2X
1465 #undef PCON_EXT_DS8XCX2X
1466 // Not directly accessible PCON bits
1467 #define SMOD0    0x40    // DS80C320, DS80C323, DS87C520, DS83C520
1468 #endif
1469
1470 #ifdef PMR
1471 #undef PMR
1472 sfr at 0xC4 PMR  ;   // DS87C520, DS83C520
1473 // Not directly accessible bits
1474 #define DME0    0x01
1475 #define DME1    0x02
1476 #define ALEOFF  0x04
1477 #define XTOFF   0x08
1478 #define SWB     0x20
1479 #define CD0     0x40
1480 #define CD1     0x80
1481 #endif
1482
1483 #ifdef PSW
1484 #undef PSW
1485 sfr at 0xD0 PSW  ;
1486 // Bit registers
1487 sbit at 0xD0 P    ;
1488 sbit at 0xD1 F1   ;
1489 sbit at 0xD2 OV   ;
1490 sbit at 0xD3 RS0  ;
1491 sbit at 0xD4 RS1  ;
1492 sbit at 0xD5 F0   ;
1493 sbit at 0xD6 AC   ;
1494 sbit at 0xD7 CY   ;
1495 #endif
1496
1497 #ifdef RCAP2H
1498 #undef RCAP2H
1499 sfr at 0xCB RCAP2H  ;
1500 #endif
1501
1502 #ifdef RCAP2L
1503 #undef RCAP2L
1504 sfr at 0xCA RCAP2L  ;
1505 #endif
1506
1507 #ifdef ROMSIZE
1508 #undef ROMSIZE
1509 sfr at 0xC2 ROMSIZE  ;   // DS87C520, DS83C520
1510 // Not directly accessible bits
1511 #define RSM0    0x01
1512 #define RSM1    0x02
1513 #define RSM2    0x04
1514 #endif
1515
1516 #ifdef S0BUF
1517 #undef S0BUF
1518 sfr at 0x99 S0BUF ; // serial channel 0 buffer register SAB80517 specific
1519 #endif
1520
1521 #ifdef S0CON
1522 #undef S0CON
1523 sfr at 0x98 S0CON ; // serial channel 0 control register SAB80517 specific
1524 #endif
1525
1526 #ifdef S0RELL
1527 #undef S0RELL
1528 sfr at 0xAA S0RELL ; // serial channel 0 reload register low byte SAB80517 specific
1529 #endif
1530
1531 #ifdef S0RELH
1532 #undef S0RELH
1533 sfr at 0xBA S0RELH ; // serial channel 0 reload register high byte SAB80517 specific
1534 #endif
1535
1536 #ifdef S1BUF
1537 #undef S1BUF
1538 sfr at 0x9C S1BUF ; // serial channel 1 buffer register SAB80517 specific
1539 #endif
1540
1541 #ifdef S1CON
1542 #undef S1CON
1543 sfr at 0x9B S1CON ; // serial channel 1 control register SAB80517 specific
1544 #endif
1545
1546 #ifdef S1RELL
1547 #undef S1RELL
1548 sfr at 0x9D S1RELL ; // serial channel 1 reload register low byte SAB80517 specific
1549 #endif
1550
1551 #ifdef S1RELH
1552 #undef S1RELH
1553 sfr at 0xBB S1RELH ; // serial channel 1 reload register high byte SAB80517 specific
1554 #endif
1555
1556 #ifdef SADDR0
1557 #undef SADDR0
1558 // DS80C320 specific
1559 sfr at 0xA9 SADDR0  ;
1560 #endif
1561
1562 #ifdef SADDR1
1563 #undef SADDR1
1564 // DS80C320 specific
1565 sfr at 0xAA SADDR1  ;
1566 #endif
1567
1568 #ifdef SADEN0
1569 #undef SADEN0
1570 // DS80C320 specific
1571 sfr at 0xB9 SADEN0  ;
1572 #endif
1573
1574 #ifdef SADEN1
1575 #undef SADEN1
1576 // DS80C320 specific
1577 sfr at 0xBA SADEN1  ;
1578 #endif
1579
1580 #ifdef SBUF
1581 #undef SBUF
1582 sfr at 0x99 SBUF ;
1583 #endif
1584
1585 #ifdef SBUF1
1586 #undef SBUF1
1587 // DS80C320 specific
1588 sfr at 0xC1 SBUF1 ;
1589 #endif
1590
1591 #ifdef SCON
1592 #undef SCON
1593 sfr at 0x98 SCON ;
1594 // Bit registers
1595 sbit at 0x98 RI   ;
1596 sbit at 0x99 TI   ;
1597 sbit at 0x9A RB8  ;
1598 sbit at 0x9B TB8  ;
1599 sbit at 0x9C REN  ;
1600 sbit at 0x9D SM2  ;
1601 sbit at 0x9E SM1  ;
1602 sbit at 0x9F SM0  ;
1603 #endif
1604
1605 #ifdef SCON1
1606 #undef SCON1
1607 // DS80C320 specific
1608 sfr at 0xC0 SCON1  ;
1609 // Bit registers
1610 sbit at 0xC8 RI_1         ;
1611 sbit at 0xC9 TI_1         ;
1612 sbit at 0xCA RB8_1        ;
1613 sbit at 0xCB TB8_1        ;
1614 sbit at 0xCC REN_1        ;
1615 sbit at 0xCD SM2_1        ;
1616 sbit at 0xCE SM1_1        ;
1617 sbit at 0xCF SM0_1        ;
1618 sbit at 0xCF FE_1         ;
1619 sbit at 0xCF SM0_FE_1     ;
1620 #endif
1621
1622 #ifdef SP
1623 #undef SP
1624 sfr at 0x81 SP   ;
1625 #endif
1626
1627 #ifdef SPCR
1628 #undef SPCR
1629 sfr at 0xD5 SPCR   ;   // AT89S53 specific
1630 // Not directly accesible bits
1631 #define SPR0 0x01
1632 #define SPR1 0x02
1633 #define CPHA 0x04
1634 #define CPOL 0x08
1635 #define MSTR 0x10
1636 #define DORD 0x20
1637 #define SPE  0x40
1638 #define SPIE 0x80
1639 #endif
1640
1641 #ifdef SPDR
1642 #undef SPDR
1643 sfr at 0x86 SPDR   ;   // AT89S53 specific
1644 // Not directly accesible bits
1645 #define SPD_0 0x01
1646 #define SPD_1 0x02
1647 #define SPD_2 0x04
1648 #define SPD_3 0x08
1649 #define SPD_4 0x10
1650 #define SPD_5 0x20
1651 #define SPD_6 0x40
1652 #define SPD_7 0x80
1653 #endif
1654
1655 #ifdef SPSR
1656 #undef SPSR
1657 sfr at 0xAA SPSR   ;   // AT89S53 specific
1658 // Not directly accesible bits
1659 #define SPIF 0x40
1660 #define WCOL 0x80
1661 #endif
1662
1663 #ifdef SRELH
1664 #undef SRELH
1665 sfr at 0xBA SRELH       ; // Baudrate generator reload high
1666 #endif
1667
1668 #ifdef SRELL
1669 #undef SRELL
1670 sfr at 0xAA SRELL       ; // Baudrate generator reload low
1671 #endif
1672
1673 #ifdef STATUS_DS80C32X
1674 #undef STATUS_DS80C32X
1675 // DS80C320 specific
1676 sfr at 0xC5 STATUS ;
1677 // Not directly accessible Bits. DS80C320 specific
1678 #define LIP  0x20
1679 #define HIP  0x40
1680 #define PIP  0x80
1681 #endif
1682
1683 #ifdef STATUS_DS8XC520
1684 #undef STATUS_DS8XC520
1685 sfr at 0xC5 STATUS ; // DS87C520 & DS83520specific
1686 // Not directly accessible Bits.
1687 #define SPRA0  0x01
1688 #define SPTA0  0x02
1689 #define SPTA1  0x04
1690 #define SPTA2  0x08
1691 #define XTUP   0x10
1692 #define LIP    0x20
1693 #define HIP    0x40
1694 #define PIP    0x80
1695 #endif
1696
1697 #ifdef SYSCON
1698 #undef SYSCON
1699 sfr at 0xB1 SYSCON      ; // XRAM Controller Access Control
1700 // SYSCON bits
1701 #define SYSCON_XMAP0    0x01
1702 #define SYSCON_XMAP1    0x02
1703 #define SYSCON_RMAP     0x10
1704 #define SYSCON_EALE     0x20
1705 #endif
1706
1707 #ifdef T2CON
1708 #undef T2CON
1709 sfr at 0xC8 T2CON ;
1710 // Definitions for the 8052 compatible microcontrollers.
1711 // Bit registers
1712 sbit at 0xC8 CP_RL2 ;
1713 sbit at 0xC9 C_T2   ;
1714 sbit at 0xCA TR2    ;
1715 sbit at 0xCB EXEN2  ;
1716 sbit at 0xCC TCLK   ;
1717 sbit at 0xCD RCLK   ;
1718 sbit at 0xCE EXF2   ;
1719 sbit at 0xCF TF2    ;
1720 // alternate names
1721 sbit at 0xC8 T2CON_0 ;
1722 sbit at 0xC9 T2CON_1 ;
1723 sbit at 0xCA T2CON_2 ;
1724 sbit at 0xCB T2CON_3 ;
1725 sbit at 0xCC T2CON_4 ;
1726 sbit at 0xCD T2CON_5 ;
1727 sbit at 0xCE T2CON_6 ;
1728 sbit at 0xCF T2CON_7 ;
1729 #endif
1730
1731 #ifdef T2CON_SABX
1732 #undef T2CON_SABX
1733 sfr at 0xC8 T2CON ;
1734 // Definitions for the Infineon / Siemens SAB80515, SAB80515A, SAB80517, SAB-C505 compatible
1735 // Microcontrollers.
1736 // Attention!
1737 // SAB-C505 has no I2FR
1738 // SAB-C504 has a 8052 style T2CON
1739 // SAB-C541 has no T2CON
1740 // Bit registers
1741 sbit at 0xC8 T2I0 ;
1742 sbit at 0xC9 T2I1 ;
1743 sbit at 0xCA T2CM ;
1744 sbit at 0xCB T2R0 ;
1745 sbit at 0xCC T2R1 ;
1746 #ifndef MICROCONTROLLER_SABC505
1747 sbit at 0xCD I2FR ;
1748 #endif
1749 sbit at 0xCE I3FR ;
1750 sbit at 0xCF T2PS ;
1751 // alternate names
1752 sbit at 0xC8 T2CON_0 ;
1753 sbit at 0xC9 T2CON_1 ;
1754 sbit at 0xCA T2CON_2 ;
1755 sbit at 0xCB T2CON_3 ;
1756 sbit at 0xCC T2CON_4 ;
1757 sbit at 0xCD T2CON_5 ;
1758 sbit at 0xCE T2CON_6 ;
1759 sbit at 0xCF T2CON_7 ;
1760 #endif
1761
1762 #ifdef T2MOD
1763 #undef T2MOD
1764 // Definitions for the timer/counter 2 of the Atmel 89x52 microcontroller
1765 sfr at 0xC9 T2MOD  ;
1766 // Not not directly accessible T2MOD bits
1767 #define DCEN            0x01
1768 #define T2OE            0x02
1769 // Alternate names
1770 #define DCEN_           0x01
1771 #define T2OE_           0x02
1772 #endif
1773
1774 #ifdef TA
1775 #undef TA
1776 // DS80C320 specific
1777 sfr at 0xC7 TA ;
1778 #endif
1779
1780 #ifdef TCON
1781 #undef TCON
1782 sfr at 0x88 TCON ;
1783 //  Bit registers
1784 sbit at 0x88 IT0  ;
1785 sbit at 0x89 IE0  ;
1786 sbit at 0x8A IT1  ;
1787 sbit at 0x8B IE1  ;
1788 sbit at 0x8C TR0  ;
1789 sbit at 0x8D TF0  ;
1790 sbit at 0x8E TR1  ;
1791 sbit at 0x8F TF1  ;
1792 #endif
1793
1794 #ifdef TH0
1795 #undef TH0
1796 sfr at 0x8C TH0  ;
1797 #endif
1798
1799 #ifdef TH1
1800 #undef TH1
1801 sfr at 0x8D TH1  ;
1802 #endif
1803
1804 #ifdef TH2
1805 #undef TH2
1806 sfr at 0xCD TH2     ;
1807 #endif
1808
1809 #ifdef TL0
1810 #undef TL0
1811 sfr at 0x8A TL0  ;
1812 #endif
1813
1814 #ifdef TL1
1815 #undef TL1
1816 sfr at 0x8B TL1  ;
1817 #endif
1818
1819 #ifdef TL2
1820 #undef TL2
1821 sfr at 0xCC TL2     ;
1822 #endif
1823
1824 #ifdef TMOD
1825 #undef TMOD
1826 sfr at 0x89 TMOD ;
1827 // Not directly accessible TMOD bits
1828 #define T0_M0           0x01
1829 #define T0_M1           0x02
1830 #define T0_CT           0x04
1831 #define T0_GATE         0x08
1832 #define T1_M0           0x10
1833 #define T1_M1           0x20
1834 #define T1_CT           0x40
1835 #define T1_GATE         0x80
1836
1837 #define T0_MASK         0x0F
1838 #define T1_MASK         0xF0
1839 #endif
1840
1841 #ifdef WCON
1842 #undef WCON
1843 sfr at 0x96 WCON   ;   // AT89S53 specific
1844 // Not directly accesible bits
1845 #define WDTEN  0x01
1846 #define WDTRST 0x02
1847 #define DPS    0x04
1848 #define PS0    0x20
1849 #define PS1    0x40
1850 #define PS2    0x80
1851 #endif
1852
1853 #ifdef WDCON
1854 #undef WDCON
1855 // DS80C320 specific
1856 sfr at 0xD8 WDCON ;
1857 // Not directly accessible bits
1858 #define RWT    0x01    /* Timed-Access protected */
1859 #define EWT    0x02    /* Timed-Access protected */
1860 #define WTRF   0x04
1861 #define WDIF   0x08    /* Timed-Access protected */
1862 #define PFI    0x10
1863 #define EPFI   0x20
1864 #define POR    0x40    /* Timed-Access protected */
1865 #define SMOD_1 0x80
1866 #endif
1867
1868 #ifdef WDTREL
1869 #undef WDTREL
1870 sfr at 0x86 WDTREL    ; // Watchdof Timer reload register
1871 #endif
1872
1873 #ifdef XPAGE
1874 #undef XPAGE
1875 sfr at 0x91 XPAGE     ; // Page Address Register for Extended On-Chip Ram - Infineon / Siemens SAB80515A specific
1876 #endif
1877
1878
1879 /////////////////////////
1880 /// Interrupt vectors ///
1881 /////////////////////////
1882
1883 // Interrupt numbers: address = (number * 8) + 3
1884 #define IE0_VECTOR      0       // 0x03 external interrupt 0
1885 #define TF0_VECTOR      1       // 0x0b timer 0
1886 #define IE1_VECTOR      2       // 0x13 external interrupt 1
1887 #define TF1_VECTOR      3       // 0x1b timer 1
1888 #define SI0_VECTOR      4       // 0x23 serial port 0
1889
1890 #ifdef MICROCONTROLLER_AT89X52
1891 #define TF2_VECTOR      5       /* 0x2B timer 2 */
1892 #define EX2_VECTOR      5       /* 0x2B external interrupt 2 */
1893 #endif
1894
1895 #ifdef MICROCONTROLLER_SAB80515
1896 #define TF2_VECTOR      5       // 0x2B timer 2
1897 #define EX2_VECTOR      5       // 0x2B external interrupt 2
1898
1899 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
1900 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
1901 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
1902 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
1903 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
1904 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
1905 #endif
1906
1907 #ifdef MICROCONTROLLER_SAB80515A
1908 #define TF2_VECTOR      5       // 0x2B timer 2
1909 #define EX2_VECTOR      5       // 0x2B external interrupt 2
1910
1911 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
1912 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
1913 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
1914 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
1915 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
1916 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
1917 #endif
1918
1919 #ifdef MICROCONTROLLER_SAB80517
1920 #define TF2_VECTOR      5       // 0x2B timer 2
1921 #define EX2_VECTOR      5       // 0x2B external interrupt 2
1922
1923 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
1924 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
1925 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
1926 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
1927 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
1928 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
1929                                 // 0x73 not used
1930                                 // 0x7B not used
1931 #define SI1_VECTOR     16       // 0x83 serial port 1
1932                                 // 0x8B not used
1933                                 // 0x93 not used
1934 #define COMPARE_VECTOR 19       // 0x9B compare
1935 #endif
1936
1937 #endif  // End of the header -> #ifndef MCS51REG_H