Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f442.h
blob3d44abe9d7802ab762623ebea0c6afd0f9477a92
1 /*
2 * This declarations of the PIC18F442 MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:42 UTC.
9 * SDCC is licensed under the GNU Public license (GPL) v2. Note that
10 * this license covers the code to the compiler and other executables,
11 * but explicitly does not cover any code or objects generated by sdcc.
13 * For pic device libraries and header files which are derived from
14 * Microchip header (.inc) and linker script (.lkr) files Microchip
15 * requires that "The header files should state that they are only to be
16 * used with authentic Microchip devices" which makes them incompatible
17 * with the GPL. Pic device libraries and header files are located at
18 * non-free/lib and non-free/include directories respectively.
19 * Sdcc should be run with the --use-non-free command line option in
20 * order to include non-free header files and libraries.
22 * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
25 #ifndef __PIC18F442_H__
26 #define __PIC18F442_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // PORTA Bits
40 extern __at(0x0F80) __sfr PORTA;
42 typedef union
44 struct
46 unsigned RA0 : 1;
47 unsigned RA1 : 1;
48 unsigned RA2 : 1;
49 unsigned RA3 : 1;
50 unsigned RA4 : 1;
51 unsigned RA5 : 1;
52 unsigned RA6 : 1;
53 unsigned : 1;
56 struct
58 unsigned AN0 : 1;
59 unsigned AN1 : 1;
60 unsigned AN2 : 1;
61 unsigned AN3 : 1;
62 unsigned T0CKI : 1;
63 unsigned AN4 : 1;
64 unsigned OSC2 : 1;
65 unsigned : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned VREFM : 1;
73 unsigned VREFP : 1;
74 unsigned : 1;
75 unsigned SS : 1;
76 unsigned CLKO : 1;
77 unsigned : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned LVDIN : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned RA : 7;
95 unsigned : 1;
97 } __PORTAbits_t;
99 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
101 #define _PORTA_RA0 0x01
102 #define _PORTA_AN0 0x01
103 #define _PORTA_RA1 0x02
104 #define _PORTA_AN1 0x02
105 #define _PORTA_RA2 0x04
106 #define _PORTA_AN2 0x04
107 #define _PORTA_VREFM 0x04
108 #define _PORTA_RA3 0x08
109 #define _PORTA_AN3 0x08
110 #define _PORTA_VREFP 0x08
111 #define _PORTA_RA4 0x10
112 #define _PORTA_T0CKI 0x10
113 #define _PORTA_RA5 0x20
114 #define _PORTA_AN4 0x20
115 #define _PORTA_SS 0x20
116 #define _PORTA_LVDIN 0x20
117 #define _PORTA_RA6 0x40
118 #define _PORTA_OSC2 0x40
119 #define _PORTA_CLKO 0x40
121 //==============================================================================
124 //==============================================================================
125 // PORTB Bits
127 extern __at(0x0F81) __sfr PORTB;
129 typedef union
131 struct
133 unsigned RB0 : 1;
134 unsigned RB1 : 1;
135 unsigned RB2 : 1;
136 unsigned RB3 : 1;
137 unsigned RB4 : 1;
138 unsigned RB5 : 1;
139 unsigned RB6 : 1;
140 unsigned RB7 : 1;
143 struct
145 unsigned INT0 : 1;
146 unsigned INT1 : 1;
147 unsigned INT2 : 1;
148 unsigned CCP2 : 1;
149 unsigned : 1;
150 unsigned PGM : 1;
151 unsigned PGC : 1;
152 unsigned PGD : 1;
155 struct
157 unsigned : 1;
158 unsigned : 1;
159 unsigned : 1;
160 unsigned CCP2A : 1;
161 unsigned : 1;
162 unsigned : 1;
163 unsigned : 1;
164 unsigned : 1;
167 struct
169 unsigned INT : 3;
170 unsigned : 5;
172 } __PORTBbits_t;
174 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
176 #define _PORTB_RB0 0x01
177 #define _PORTB_INT0 0x01
178 #define _PORTB_RB1 0x02
179 #define _PORTB_INT1 0x02
180 #define _PORTB_RB2 0x04
181 #define _PORTB_INT2 0x04
182 #define _PORTB_RB3 0x08
183 #define _PORTB_CCP2 0x08
184 #define _PORTB_CCP2A 0x08
185 #define _PORTB_RB4 0x10
186 #define _PORTB_RB5 0x20
187 #define _PORTB_PGM 0x20
188 #define _PORTB_RB6 0x40
189 #define _PORTB_PGC 0x40
190 #define _PORTB_RB7 0x80
191 #define _PORTB_PGD 0x80
193 //==============================================================================
196 //==============================================================================
197 // PORTC Bits
199 extern __at(0x0F82) __sfr PORTC;
201 typedef union
203 struct
205 unsigned RC0 : 1;
206 unsigned RC1 : 1;
207 unsigned RC2 : 1;
208 unsigned RC3 : 1;
209 unsigned RC4 : 1;
210 unsigned RC5 : 1;
211 unsigned RC6 : 1;
212 unsigned RC7 : 1;
215 struct
217 unsigned T1OSO : 1;
218 unsigned T1OSI : 1;
219 unsigned CCP1 : 1;
220 unsigned SCK : 1;
221 unsigned SDI : 1;
222 unsigned SDO : 1;
223 unsigned TX : 1;
224 unsigned RX : 1;
227 struct
229 unsigned T1CKI : 1;
230 unsigned CCP2 : 1;
231 unsigned : 1;
232 unsigned SCL : 1;
233 unsigned SDA : 1;
234 unsigned : 1;
235 unsigned CK : 1;
236 unsigned : 1;
238 } __PORTCbits_t;
240 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
242 #define _PORTC_RC0 0x01
243 #define _PORTC_T1OSO 0x01
244 #define _PORTC_T1CKI 0x01
245 #define _PORTC_RC1 0x02
246 #define _PORTC_T1OSI 0x02
247 #define _PORTC_CCP2 0x02
248 #define _PORTC_RC2 0x04
249 #define _PORTC_CCP1 0x04
250 #define _PORTC_RC3 0x08
251 #define _PORTC_SCK 0x08
252 #define _PORTC_SCL 0x08
253 #define _PORTC_RC4 0x10
254 #define _PORTC_SDI 0x10
255 #define _PORTC_SDA 0x10
256 #define _PORTC_RC5 0x20
257 #define _PORTC_SDO 0x20
258 #define _PORTC_RC6 0x40
259 #define _PORTC_TX 0x40
260 #define _PORTC_CK 0x40
261 #define _PORTC_RC7 0x80
262 #define _PORTC_RX 0x80
264 //==============================================================================
267 //==============================================================================
268 // PORTD Bits
270 extern __at(0x0F83) __sfr PORTD;
272 typedef union
274 struct
276 unsigned RD0 : 1;
277 unsigned RD1 : 1;
278 unsigned RD2 : 1;
279 unsigned RD3 : 1;
280 unsigned RD4 : 1;
281 unsigned RD5 : 1;
282 unsigned RD6 : 1;
283 unsigned RD7 : 1;
286 struct
288 unsigned PSP0 : 1;
289 unsigned PSP1 : 1;
290 unsigned PSP2 : 1;
291 unsigned PSP3 : 1;
292 unsigned PSP4 : 1;
293 unsigned PSP5 : 1;
294 unsigned PSP6 : 1;
295 unsigned PSP7 : 1;
297 } __PORTDbits_t;
299 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
301 #define _PORTD_RD0 0x01
302 #define _PORTD_PSP0 0x01
303 #define _PORTD_RD1 0x02
304 #define _PORTD_PSP1 0x02
305 #define _PORTD_RD2 0x04
306 #define _PORTD_PSP2 0x04
307 #define _PORTD_RD3 0x08
308 #define _PORTD_PSP3 0x08
309 #define _PORTD_RD4 0x10
310 #define _PORTD_PSP4 0x10
311 #define _PORTD_RD5 0x20
312 #define _PORTD_PSP5 0x20
313 #define _PORTD_RD6 0x40
314 #define _PORTD_PSP6 0x40
315 #define _PORTD_RD7 0x80
316 #define _PORTD_PSP7 0x80
318 //==============================================================================
321 //==============================================================================
322 // PORTE Bits
324 extern __at(0x0F84) __sfr PORTE;
326 typedef union
328 struct
330 unsigned RE0 : 1;
331 unsigned RE1 : 1;
332 unsigned RE2 : 1;
333 unsigned : 1;
334 unsigned : 1;
335 unsigned : 1;
336 unsigned : 1;
337 unsigned : 1;
340 struct
342 unsigned AN5 : 1;
343 unsigned AN6 : 1;
344 unsigned AN7 : 1;
345 unsigned : 1;
346 unsigned : 1;
347 unsigned : 1;
348 unsigned : 1;
349 unsigned : 1;
352 struct
354 unsigned RD : 1;
355 unsigned WR : 1;
356 unsigned CS : 1;
357 unsigned : 1;
358 unsigned : 1;
359 unsigned : 1;
360 unsigned : 1;
361 unsigned : 1;
364 struct
366 unsigned RE : 3;
367 unsigned : 5;
369 } __PORTEbits_t;
371 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
373 #define _PORTE_RE0 0x01
374 #define _PORTE_AN5 0x01
375 #define _PORTE_RD 0x01
376 #define _PORTE_RE1 0x02
377 #define _PORTE_AN6 0x02
378 #define _PORTE_WR 0x02
379 #define _PORTE_RE2 0x04
380 #define _PORTE_AN7 0x04
381 #define _PORTE_CS 0x04
383 //==============================================================================
386 //==============================================================================
387 // LATA Bits
389 extern __at(0x0F89) __sfr LATA;
391 typedef union
393 struct
395 unsigned LATA0 : 1;
396 unsigned LATA1 : 1;
397 unsigned LATA2 : 1;
398 unsigned LATA3 : 1;
399 unsigned LATA4 : 1;
400 unsigned LATA5 : 1;
401 unsigned LATA6 : 1;
402 unsigned : 1;
405 struct
407 unsigned LATA : 7;
408 unsigned : 1;
410 } __LATAbits_t;
412 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
414 #define _LATA0 0x01
415 #define _LATA1 0x02
416 #define _LATA2 0x04
417 #define _LATA3 0x08
418 #define _LATA4 0x10
419 #define _LATA5 0x20
420 #define _LATA6 0x40
422 //==============================================================================
425 //==============================================================================
426 // LATB Bits
428 extern __at(0x0F8A) __sfr LATB;
430 typedef struct
432 unsigned LATB0 : 1;
433 unsigned LATB1 : 1;
434 unsigned LATB2 : 1;
435 unsigned LATB3 : 1;
436 unsigned LATB4 : 1;
437 unsigned LATB5 : 1;
438 unsigned LATB6 : 1;
439 unsigned LATB7 : 1;
440 } __LATBbits_t;
442 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
444 #define _LATB0 0x01
445 #define _LATB1 0x02
446 #define _LATB2 0x04
447 #define _LATB3 0x08
448 #define _LATB4 0x10
449 #define _LATB5 0x20
450 #define _LATB6 0x40
451 #define _LATB7 0x80
453 //==============================================================================
456 //==============================================================================
457 // LATC Bits
459 extern __at(0x0F8B) __sfr LATC;
461 typedef struct
463 unsigned LATC0 : 1;
464 unsigned LATC1 : 1;
465 unsigned LATC2 : 1;
466 unsigned LATC3 : 1;
467 unsigned LATC4 : 1;
468 unsigned LATC5 : 1;
469 unsigned LATC6 : 1;
470 unsigned LATC7 : 1;
471 } __LATCbits_t;
473 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
475 #define _LATC0 0x01
476 #define _LATC1 0x02
477 #define _LATC2 0x04
478 #define _LATC3 0x08
479 #define _LATC4 0x10
480 #define _LATC5 0x20
481 #define _LATC6 0x40
482 #define _LATC7 0x80
484 //==============================================================================
487 //==============================================================================
488 // LATD Bits
490 extern __at(0x0F8C) __sfr LATD;
492 typedef struct
494 unsigned LATD0 : 1;
495 unsigned LATD1 : 1;
496 unsigned LATD2 : 1;
497 unsigned LATD3 : 1;
498 unsigned LATD4 : 1;
499 unsigned LATD5 : 1;
500 unsigned LATD6 : 1;
501 unsigned LATD7 : 1;
502 } __LATDbits_t;
504 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
506 #define _LATD0 0x01
507 #define _LATD1 0x02
508 #define _LATD2 0x04
509 #define _LATD3 0x08
510 #define _LATD4 0x10
511 #define _LATD5 0x20
512 #define _LATD6 0x40
513 #define _LATD7 0x80
515 //==============================================================================
518 //==============================================================================
519 // LATE Bits
521 extern __at(0x0F8D) __sfr LATE;
523 typedef union
525 struct
527 unsigned LATE0 : 1;
528 unsigned LATE1 : 1;
529 unsigned LATE2 : 1;
530 unsigned : 1;
531 unsigned : 1;
532 unsigned : 1;
533 unsigned : 1;
534 unsigned : 1;
537 struct
539 unsigned LATE : 3;
540 unsigned : 5;
542 } __LATEbits_t;
544 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
546 #define _LATE0 0x01
547 #define _LATE1 0x02
548 #define _LATE2 0x04
550 //==============================================================================
553 //==============================================================================
554 // DDRA Bits
556 extern __at(0x0F92) __sfr DDRA;
558 typedef union
560 struct
562 unsigned TRISA0 : 1;
563 unsigned TRISA1 : 1;
564 unsigned TRISA2 : 1;
565 unsigned TRISA3 : 1;
566 unsigned TRISA4 : 1;
567 unsigned TRISA5 : 1;
568 unsigned TRISA6 : 1;
569 unsigned : 1;
572 struct
574 unsigned RA0 : 1;
575 unsigned RA1 : 1;
576 unsigned RA2 : 1;
577 unsigned RA3 : 1;
578 unsigned RA4 : 1;
579 unsigned RA5 : 1;
580 unsigned RA6 : 1;
581 unsigned : 1;
584 struct
586 unsigned RA : 7;
587 unsigned : 1;
590 struct
592 unsigned TRISA : 7;
593 unsigned : 1;
595 } __DDRAbits_t;
597 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
599 #define _TRISA0 0x01
600 #define _RA0 0x01
601 #define _TRISA1 0x02
602 #define _RA1 0x02
603 #define _TRISA2 0x04
604 #define _RA2 0x04
605 #define _TRISA3 0x08
606 #define _RA3 0x08
607 #define _TRISA4 0x10
608 #define _RA4 0x10
609 #define _TRISA5 0x20
610 #define _RA5 0x20
611 #define _TRISA6 0x40
612 #define _RA6 0x40
614 //==============================================================================
617 //==============================================================================
618 // TRISA Bits
620 extern __at(0x0F92) __sfr TRISA;
622 typedef union
624 struct
626 unsigned TRISA0 : 1;
627 unsigned TRISA1 : 1;
628 unsigned TRISA2 : 1;
629 unsigned TRISA3 : 1;
630 unsigned TRISA4 : 1;
631 unsigned TRISA5 : 1;
632 unsigned TRISA6 : 1;
633 unsigned : 1;
636 struct
638 unsigned RA0 : 1;
639 unsigned RA1 : 1;
640 unsigned RA2 : 1;
641 unsigned RA3 : 1;
642 unsigned RA4 : 1;
643 unsigned RA5 : 1;
644 unsigned RA6 : 1;
645 unsigned : 1;
648 struct
650 unsigned RA : 7;
651 unsigned : 1;
654 struct
656 unsigned TRISA : 7;
657 unsigned : 1;
659 } __TRISAbits_t;
661 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
663 #define _TRISA_TRISA0 0x01
664 #define _TRISA_RA0 0x01
665 #define _TRISA_TRISA1 0x02
666 #define _TRISA_RA1 0x02
667 #define _TRISA_TRISA2 0x04
668 #define _TRISA_RA2 0x04
669 #define _TRISA_TRISA3 0x08
670 #define _TRISA_RA3 0x08
671 #define _TRISA_TRISA4 0x10
672 #define _TRISA_RA4 0x10
673 #define _TRISA_TRISA5 0x20
674 #define _TRISA_RA5 0x20
675 #define _TRISA_TRISA6 0x40
676 #define _TRISA_RA6 0x40
678 //==============================================================================
681 //==============================================================================
682 // DDRB Bits
684 extern __at(0x0F93) __sfr DDRB;
686 typedef union
688 struct
690 unsigned TRISB0 : 1;
691 unsigned TRISB1 : 1;
692 unsigned TRISB2 : 1;
693 unsigned TRISB3 : 1;
694 unsigned TRISB4 : 1;
695 unsigned TRISB5 : 1;
696 unsigned TRISB6 : 1;
697 unsigned TRISB7 : 1;
700 struct
702 unsigned RB0 : 1;
703 unsigned RB1 : 1;
704 unsigned RB2 : 1;
705 unsigned RB3 : 1;
706 unsigned RB4 : 1;
707 unsigned RB5 : 1;
708 unsigned RB6 : 1;
709 unsigned RB7 : 1;
712 struct
714 unsigned : 1;
715 unsigned : 1;
716 unsigned : 1;
717 unsigned CCP2 : 1;
718 unsigned : 1;
719 unsigned : 1;
720 unsigned : 1;
721 unsigned : 1;
723 } __DDRBbits_t;
725 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
727 #define _TRISB0 0x01
728 #define _RB0 0x01
729 #define _TRISB1 0x02
730 #define _RB1 0x02
731 #define _TRISB2 0x04
732 #define _RB2 0x04
733 #define _TRISB3 0x08
734 #define _RB3 0x08
735 #define _CCP2 0x08
736 #define _TRISB4 0x10
737 #define _RB4 0x10
738 #define _TRISB5 0x20
739 #define _RB5 0x20
740 #define _TRISB6 0x40
741 #define _RB6 0x40
742 #define _TRISB7 0x80
743 #define _RB7 0x80
745 //==============================================================================
748 //==============================================================================
749 // TRISB Bits
751 extern __at(0x0F93) __sfr TRISB;
753 typedef union
755 struct
757 unsigned TRISB0 : 1;
758 unsigned TRISB1 : 1;
759 unsigned TRISB2 : 1;
760 unsigned TRISB3 : 1;
761 unsigned TRISB4 : 1;
762 unsigned TRISB5 : 1;
763 unsigned TRISB6 : 1;
764 unsigned TRISB7 : 1;
767 struct
769 unsigned RB0 : 1;
770 unsigned RB1 : 1;
771 unsigned RB2 : 1;
772 unsigned RB3 : 1;
773 unsigned RB4 : 1;
774 unsigned RB5 : 1;
775 unsigned RB6 : 1;
776 unsigned RB7 : 1;
779 struct
781 unsigned : 1;
782 unsigned : 1;
783 unsigned : 1;
784 unsigned CCP2 : 1;
785 unsigned : 1;
786 unsigned : 1;
787 unsigned : 1;
788 unsigned : 1;
790 } __TRISBbits_t;
792 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
794 #define _TRISB_TRISB0 0x01
795 #define _TRISB_RB0 0x01
796 #define _TRISB_TRISB1 0x02
797 #define _TRISB_RB1 0x02
798 #define _TRISB_TRISB2 0x04
799 #define _TRISB_RB2 0x04
800 #define _TRISB_TRISB3 0x08
801 #define _TRISB_RB3 0x08
802 #define _TRISB_CCP2 0x08
803 #define _TRISB_TRISB4 0x10
804 #define _TRISB_RB4 0x10
805 #define _TRISB_TRISB5 0x20
806 #define _TRISB_RB5 0x20
807 #define _TRISB_TRISB6 0x40
808 #define _TRISB_RB6 0x40
809 #define _TRISB_TRISB7 0x80
810 #define _TRISB_RB7 0x80
812 //==============================================================================
815 //==============================================================================
816 // DDRC Bits
818 extern __at(0x0F94) __sfr DDRC;
820 typedef union
822 struct
824 unsigned TRISC0 : 1;
825 unsigned TRISC1 : 1;
826 unsigned TRISC2 : 1;
827 unsigned TRISC3 : 1;
828 unsigned TRISC4 : 1;
829 unsigned TRISC5 : 1;
830 unsigned TRISC6 : 1;
831 unsigned TRISC7 : 1;
834 struct
836 unsigned RC0 : 1;
837 unsigned RC1 : 1;
838 unsigned RC2 : 1;
839 unsigned RC3 : 1;
840 unsigned RC4 : 1;
841 unsigned RC5 : 1;
842 unsigned RC6 : 1;
843 unsigned RC7 : 1;
846 struct
848 unsigned : 1;
849 unsigned CCP2 : 1;
850 unsigned : 1;
851 unsigned : 1;
852 unsigned : 1;
853 unsigned : 1;
854 unsigned : 1;
855 unsigned : 1;
857 } __DDRCbits_t;
859 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
861 #define _DDRC_TRISC0 0x01
862 #define _DDRC_RC0 0x01
863 #define _DDRC_TRISC1 0x02
864 #define _DDRC_RC1 0x02
865 #define _DDRC_CCP2 0x02
866 #define _DDRC_TRISC2 0x04
867 #define _DDRC_RC2 0x04
868 #define _DDRC_TRISC3 0x08
869 #define _DDRC_RC3 0x08
870 #define _DDRC_TRISC4 0x10
871 #define _DDRC_RC4 0x10
872 #define _DDRC_TRISC5 0x20
873 #define _DDRC_RC5 0x20
874 #define _DDRC_TRISC6 0x40
875 #define _DDRC_RC6 0x40
876 #define _DDRC_TRISC7 0x80
877 #define _DDRC_RC7 0x80
879 //==============================================================================
882 //==============================================================================
883 // TRISC Bits
885 extern __at(0x0F94) __sfr TRISC;
887 typedef union
889 struct
891 unsigned TRISC0 : 1;
892 unsigned TRISC1 : 1;
893 unsigned TRISC2 : 1;
894 unsigned TRISC3 : 1;
895 unsigned TRISC4 : 1;
896 unsigned TRISC5 : 1;
897 unsigned TRISC6 : 1;
898 unsigned TRISC7 : 1;
901 struct
903 unsigned RC0 : 1;
904 unsigned RC1 : 1;
905 unsigned RC2 : 1;
906 unsigned RC3 : 1;
907 unsigned RC4 : 1;
908 unsigned RC5 : 1;
909 unsigned RC6 : 1;
910 unsigned RC7 : 1;
913 struct
915 unsigned : 1;
916 unsigned CCP2 : 1;
917 unsigned : 1;
918 unsigned : 1;
919 unsigned : 1;
920 unsigned : 1;
921 unsigned : 1;
922 unsigned : 1;
924 } __TRISCbits_t;
926 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
928 #define _TRISC_TRISC0 0x01
929 #define _TRISC_RC0 0x01
930 #define _TRISC_TRISC1 0x02
931 #define _TRISC_RC1 0x02
932 #define _TRISC_CCP2 0x02
933 #define _TRISC_TRISC2 0x04
934 #define _TRISC_RC2 0x04
935 #define _TRISC_TRISC3 0x08
936 #define _TRISC_RC3 0x08
937 #define _TRISC_TRISC4 0x10
938 #define _TRISC_RC4 0x10
939 #define _TRISC_TRISC5 0x20
940 #define _TRISC_RC5 0x20
941 #define _TRISC_TRISC6 0x40
942 #define _TRISC_RC6 0x40
943 #define _TRISC_TRISC7 0x80
944 #define _TRISC_RC7 0x80
946 //==============================================================================
949 //==============================================================================
950 // DDRD Bits
952 extern __at(0x0F95) __sfr DDRD;
954 typedef union
956 struct
958 unsigned TRISD0 : 1;
959 unsigned TRISD1 : 1;
960 unsigned TRISD2 : 1;
961 unsigned TRISD3 : 1;
962 unsigned TRISD4 : 1;
963 unsigned TRISD5 : 1;
964 unsigned TRISD6 : 1;
965 unsigned TRISD7 : 1;
968 struct
970 unsigned RD0 : 1;
971 unsigned RD1 : 1;
972 unsigned RD2 : 1;
973 unsigned RD3 : 1;
974 unsigned RD4 : 1;
975 unsigned RD5 : 1;
976 unsigned RD6 : 1;
977 unsigned RD7 : 1;
979 } __DDRDbits_t;
981 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
983 #define _TRISD0 0x01
984 #define _RD0 0x01
985 #define _TRISD1 0x02
986 #define _RD1 0x02
987 #define _TRISD2 0x04
988 #define _RD2 0x04
989 #define _TRISD3 0x08
990 #define _RD3 0x08
991 #define _TRISD4 0x10
992 #define _RD4 0x10
993 #define _TRISD5 0x20
994 #define _RD5 0x20
995 #define _TRISD6 0x40
996 #define _RD6 0x40
997 #define _TRISD7 0x80
998 #define _RD7 0x80
1000 //==============================================================================
1003 //==============================================================================
1004 // TRISD Bits
1006 extern __at(0x0F95) __sfr TRISD;
1008 typedef union
1010 struct
1012 unsigned TRISD0 : 1;
1013 unsigned TRISD1 : 1;
1014 unsigned TRISD2 : 1;
1015 unsigned TRISD3 : 1;
1016 unsigned TRISD4 : 1;
1017 unsigned TRISD5 : 1;
1018 unsigned TRISD6 : 1;
1019 unsigned TRISD7 : 1;
1022 struct
1024 unsigned RD0 : 1;
1025 unsigned RD1 : 1;
1026 unsigned RD2 : 1;
1027 unsigned RD3 : 1;
1028 unsigned RD4 : 1;
1029 unsigned RD5 : 1;
1030 unsigned RD6 : 1;
1031 unsigned RD7 : 1;
1033 } __TRISDbits_t;
1035 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
1037 #define _TRISD_TRISD0 0x01
1038 #define _TRISD_RD0 0x01
1039 #define _TRISD_TRISD1 0x02
1040 #define _TRISD_RD1 0x02
1041 #define _TRISD_TRISD2 0x04
1042 #define _TRISD_RD2 0x04
1043 #define _TRISD_TRISD3 0x08
1044 #define _TRISD_RD3 0x08
1045 #define _TRISD_TRISD4 0x10
1046 #define _TRISD_RD4 0x10
1047 #define _TRISD_TRISD5 0x20
1048 #define _TRISD_RD5 0x20
1049 #define _TRISD_TRISD6 0x40
1050 #define _TRISD_RD6 0x40
1051 #define _TRISD_TRISD7 0x80
1052 #define _TRISD_RD7 0x80
1054 //==============================================================================
1057 //==============================================================================
1058 // DDRE Bits
1060 extern __at(0x0F96) __sfr DDRE;
1062 typedef union
1064 struct
1066 unsigned TRISE0 : 1;
1067 unsigned TRISE1 : 1;
1068 unsigned TRISE2 : 1;
1069 unsigned : 1;
1070 unsigned PSPMODE : 1;
1071 unsigned IBOV : 1;
1072 unsigned OBF : 1;
1073 unsigned IBF : 1;
1076 struct
1078 unsigned RE0 : 1;
1079 unsigned RE1 : 1;
1080 unsigned RE2 : 1;
1081 unsigned : 1;
1082 unsigned : 1;
1083 unsigned : 1;
1084 unsigned : 1;
1085 unsigned : 1;
1088 struct
1090 unsigned RE : 3;
1091 unsigned : 5;
1094 struct
1096 unsigned TRISE : 3;
1097 unsigned : 5;
1099 } __DDREbits_t;
1101 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1103 #define _TRISE0 0x01
1104 #define _RE0 0x01
1105 #define _TRISE1 0x02
1106 #define _RE1 0x02
1107 #define _TRISE2 0x04
1108 #define _RE2 0x04
1109 #define _PSPMODE 0x10
1110 #define _IBOV 0x20
1111 #define _OBF 0x40
1112 #define _IBF 0x80
1114 //==============================================================================
1117 //==============================================================================
1118 // TRISE Bits
1120 extern __at(0x0F96) __sfr TRISE;
1122 typedef union
1124 struct
1126 unsigned TRISE0 : 1;
1127 unsigned TRISE1 : 1;
1128 unsigned TRISE2 : 1;
1129 unsigned : 1;
1130 unsigned PSPMODE : 1;
1131 unsigned IBOV : 1;
1132 unsigned OBF : 1;
1133 unsigned IBF : 1;
1136 struct
1138 unsigned RE0 : 1;
1139 unsigned RE1 : 1;
1140 unsigned RE2 : 1;
1141 unsigned : 1;
1142 unsigned : 1;
1143 unsigned : 1;
1144 unsigned : 1;
1145 unsigned : 1;
1148 struct
1150 unsigned RE : 3;
1151 unsigned : 5;
1154 struct
1156 unsigned TRISE : 3;
1157 unsigned : 5;
1159 } __TRISEbits_t;
1161 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1163 #define _TRISE_TRISE0 0x01
1164 #define _TRISE_RE0 0x01
1165 #define _TRISE_TRISE1 0x02
1166 #define _TRISE_RE1 0x02
1167 #define _TRISE_TRISE2 0x04
1168 #define _TRISE_RE2 0x04
1169 #define _TRISE_PSPMODE 0x10
1170 #define _TRISE_IBOV 0x20
1171 #define _TRISE_OBF 0x40
1172 #define _TRISE_IBF 0x80
1174 //==============================================================================
1177 //==============================================================================
1178 // PIE1 Bits
1180 extern __at(0x0F9D) __sfr PIE1;
1182 typedef struct
1184 unsigned TMR1IE : 1;
1185 unsigned TMR2IE : 1;
1186 unsigned CCP1IE : 1;
1187 unsigned SSPIE : 1;
1188 unsigned TXIE : 1;
1189 unsigned RCIE : 1;
1190 unsigned ADIE : 1;
1191 unsigned PSPIE : 1;
1192 } __PIE1bits_t;
1194 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1196 #define _TMR1IE 0x01
1197 #define _TMR2IE 0x02
1198 #define _CCP1IE 0x04
1199 #define _SSPIE 0x08
1200 #define _TXIE 0x10
1201 #define _RCIE 0x20
1202 #define _ADIE 0x40
1203 #define _PSPIE 0x80
1205 //==============================================================================
1208 //==============================================================================
1209 // PIR1 Bits
1211 extern __at(0x0F9E) __sfr PIR1;
1213 typedef struct
1215 unsigned TMR1IF : 1;
1216 unsigned TMR2IF : 1;
1217 unsigned CCP1IF : 1;
1218 unsigned SSPIF : 1;
1219 unsigned TXIF : 1;
1220 unsigned RCIF : 1;
1221 unsigned ADIF : 1;
1222 unsigned PSPIF : 1;
1223 } __PIR1bits_t;
1225 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1227 #define _TMR1IF 0x01
1228 #define _TMR2IF 0x02
1229 #define _CCP1IF 0x04
1230 #define _SSPIF 0x08
1231 #define _TXIF 0x10
1232 #define _RCIF 0x20
1233 #define _ADIF 0x40
1234 #define _PSPIF 0x80
1236 //==============================================================================
1239 //==============================================================================
1240 // IPR1 Bits
1242 extern __at(0x0F9F) __sfr IPR1;
1244 typedef struct
1246 unsigned TMR1IP : 1;
1247 unsigned TMR2IP : 1;
1248 unsigned CCP1IP : 1;
1249 unsigned SSPIP : 1;
1250 unsigned TXIP : 1;
1251 unsigned RCIP : 1;
1252 unsigned ADIP : 1;
1253 unsigned PSPIP : 1;
1254 } __IPR1bits_t;
1256 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1258 #define _TMR1IP 0x01
1259 #define _TMR2IP 0x02
1260 #define _CCP1IP 0x04
1261 #define _SSPIP 0x08
1262 #define _TXIP 0x10
1263 #define _RCIP 0x20
1264 #define _ADIP 0x40
1265 #define _PSPIP 0x80
1267 //==============================================================================
1270 //==============================================================================
1271 // PIE2 Bits
1273 extern __at(0x0FA0) __sfr PIE2;
1275 typedef struct
1277 unsigned CCP2IE : 1;
1278 unsigned TMR3IE : 1;
1279 unsigned LVDIE : 1;
1280 unsigned BCLIE : 1;
1281 unsigned EEIE : 1;
1282 unsigned : 1;
1283 unsigned : 1;
1284 unsigned : 1;
1285 } __PIE2bits_t;
1287 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1289 #define _CCP2IE 0x01
1290 #define _TMR3IE 0x02
1291 #define _LVDIE 0x04
1292 #define _BCLIE 0x08
1293 #define _EEIE 0x10
1295 //==============================================================================
1298 //==============================================================================
1299 // PIR2 Bits
1301 extern __at(0x0FA1) __sfr PIR2;
1303 typedef struct
1305 unsigned CCP2IF : 1;
1306 unsigned TMR3IF : 1;
1307 unsigned LVDIF : 1;
1308 unsigned BCLIF : 1;
1309 unsigned EEIF : 1;
1310 unsigned : 1;
1311 unsigned : 1;
1312 unsigned : 1;
1313 } __PIR2bits_t;
1315 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1317 #define _CCP2IF 0x01
1318 #define _TMR3IF 0x02
1319 #define _LVDIF 0x04
1320 #define _BCLIF 0x08
1321 #define _EEIF 0x10
1323 //==============================================================================
1326 //==============================================================================
1327 // IPR2 Bits
1329 extern __at(0x0FA2) __sfr IPR2;
1331 typedef struct
1333 unsigned CCP2IP : 1;
1334 unsigned TMR3IP : 1;
1335 unsigned LVDIP : 1;
1336 unsigned BCLIP : 1;
1337 unsigned EEIP : 1;
1338 unsigned : 1;
1339 unsigned : 1;
1340 unsigned : 1;
1341 } __IPR2bits_t;
1343 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1345 #define _CCP2IP 0x01
1346 #define _TMR3IP 0x02
1347 #define _LVDIP 0x04
1348 #define _BCLIP 0x08
1349 #define _EEIP 0x10
1351 //==============================================================================
1354 //==============================================================================
1355 // EECON1 Bits
1357 extern __at(0x0FA6) __sfr EECON1;
1359 typedef struct
1361 unsigned RD : 1;
1362 unsigned WR : 1;
1363 unsigned WREN : 1;
1364 unsigned WRERR : 1;
1365 unsigned FREE : 1;
1366 unsigned : 1;
1367 unsigned CFGS : 1;
1368 unsigned EEPGD : 1;
1369 } __EECON1bits_t;
1371 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1373 #define _RD 0x01
1374 #define _WR 0x02
1375 #define _WREN 0x04
1376 #define _WRERR 0x08
1377 #define _FREE 0x10
1378 #define _CFGS 0x40
1379 #define _EEPGD 0x80
1381 //==============================================================================
1383 extern __at(0x0FA7) __sfr EECON2;
1384 extern __at(0x0FA8) __sfr EEDATA;
1385 extern __at(0x0FA9) __sfr EEADR;
1387 //==============================================================================
1388 // RCSTA Bits
1390 extern __at(0x0FAB) __sfr RCSTA;
1392 typedef union
1394 struct
1396 unsigned RX9D : 1;
1397 unsigned OERR : 1;
1398 unsigned FERR : 1;
1399 unsigned ADDEN : 1;
1400 unsigned CREN : 1;
1401 unsigned SREN : 1;
1402 unsigned RX9 : 1;
1403 unsigned SPEN : 1;
1406 struct
1408 unsigned RCD8 : 1;
1409 unsigned : 1;
1410 unsigned : 1;
1411 unsigned : 1;
1412 unsigned : 1;
1413 unsigned : 1;
1414 unsigned RC8_9 : 1;
1415 unsigned : 1;
1418 struct
1420 unsigned : 1;
1421 unsigned : 1;
1422 unsigned : 1;
1423 unsigned : 1;
1424 unsigned : 1;
1425 unsigned : 1;
1426 unsigned NOT_RC8 : 1;
1427 unsigned : 1;
1430 struct
1432 unsigned : 1;
1433 unsigned : 1;
1434 unsigned : 1;
1435 unsigned : 1;
1436 unsigned : 1;
1437 unsigned : 1;
1438 unsigned RC9 : 1;
1439 unsigned : 1;
1441 } __RCSTAbits_t;
1443 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1445 #define _RX9D 0x01
1446 #define _RCD8 0x01
1447 #define _OERR 0x02
1448 #define _FERR 0x04
1449 #define _ADDEN 0x08
1450 #define _CREN 0x10
1451 #define _SREN 0x20
1452 #define _RX9 0x40
1453 #define _RC8_9 0x40
1454 #define _NOT_RC8 0x40
1455 #define _RC9 0x40
1456 #define _SPEN 0x80
1458 //==============================================================================
1461 //==============================================================================
1462 // TXSTA Bits
1464 extern __at(0x0FAC) __sfr TXSTA;
1466 typedef union
1468 struct
1470 unsigned TX9D : 1;
1471 unsigned TRMT : 1;
1472 unsigned BRGH : 1;
1473 unsigned : 1;
1474 unsigned SYNC : 1;
1475 unsigned TXEN : 1;
1476 unsigned TX9 : 1;
1477 unsigned CSRC : 1;
1480 struct
1482 unsigned TXD8 : 1;
1483 unsigned : 1;
1484 unsigned : 1;
1485 unsigned : 1;
1486 unsigned : 1;
1487 unsigned : 1;
1488 unsigned TX8_9 : 1;
1489 unsigned : 1;
1492 struct
1494 unsigned : 1;
1495 unsigned : 1;
1496 unsigned : 1;
1497 unsigned : 1;
1498 unsigned : 1;
1499 unsigned : 1;
1500 unsigned NOT_TX8 : 1;
1501 unsigned : 1;
1503 } __TXSTAbits_t;
1505 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1507 #define _TX9D 0x01
1508 #define _TXD8 0x01
1509 #define _TRMT 0x02
1510 #define _BRGH 0x04
1511 #define _SYNC 0x10
1512 #define _TXEN 0x20
1513 #define _TX9 0x40
1514 #define _TX8_9 0x40
1515 #define _NOT_TX8 0x40
1516 #define _CSRC 0x80
1518 //==============================================================================
1520 extern __at(0x0FAD) __sfr TXREG;
1521 extern __at(0x0FAE) __sfr RCREG;
1522 extern __at(0x0FAF) __sfr SPBRG;
1524 //==============================================================================
1525 // T3CON Bits
1527 extern __at(0x0FB1) __sfr T3CON;
1529 typedef union
1531 struct
1533 unsigned TMR3ON : 1;
1534 unsigned TMR3CS : 1;
1535 unsigned NOT_T3SYNC : 1;
1536 unsigned T3CCP1 : 1;
1537 unsigned T3CKPS0 : 1;
1538 unsigned T3CKPS1 : 1;
1539 unsigned T3CCP2 : 1;
1540 unsigned RD16 : 1;
1543 struct
1545 unsigned : 1;
1546 unsigned : 1;
1547 unsigned T3SYNC : 1;
1548 unsigned : 1;
1549 unsigned : 1;
1550 unsigned : 1;
1551 unsigned : 1;
1552 unsigned : 1;
1555 struct
1557 unsigned : 1;
1558 unsigned : 1;
1559 unsigned T3INSYNC : 1;
1560 unsigned : 1;
1561 unsigned : 1;
1562 unsigned : 1;
1563 unsigned : 1;
1564 unsigned : 1;
1567 struct
1569 unsigned : 4;
1570 unsigned T3CKPS : 2;
1571 unsigned : 2;
1573 } __T3CONbits_t;
1575 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1577 #define _T3CON_TMR3ON 0x01
1578 #define _T3CON_TMR3CS 0x02
1579 #define _T3CON_NOT_T3SYNC 0x04
1580 #define _T3CON_T3SYNC 0x04
1581 #define _T3CON_T3INSYNC 0x04
1582 #define _T3CON_T3CCP1 0x08
1583 #define _T3CON_T3CKPS0 0x10
1584 #define _T3CON_T3CKPS1 0x20
1585 #define _T3CON_T3CCP2 0x40
1586 #define _T3CON_RD16 0x80
1588 //==============================================================================
1590 extern __at(0x0FB2) __sfr TMR3;
1591 extern __at(0x0FB2) __sfr TMR3L;
1592 extern __at(0x0FB3) __sfr TMR3H;
1594 //==============================================================================
1595 // CCP2CON Bits
1597 extern __at(0x0FBA) __sfr CCP2CON;
1599 typedef union
1601 struct
1603 unsigned CCP2M0 : 1;
1604 unsigned CCP2M1 : 1;
1605 unsigned CCP2M2 : 1;
1606 unsigned CCP2M3 : 1;
1607 unsigned DC2B0 : 1;
1608 unsigned DC2B1 : 1;
1609 unsigned : 1;
1610 unsigned : 1;
1613 struct
1615 unsigned : 1;
1616 unsigned : 1;
1617 unsigned : 1;
1618 unsigned : 1;
1619 unsigned CCP2Y : 1;
1620 unsigned CCP2X : 1;
1621 unsigned : 1;
1622 unsigned : 1;
1625 struct
1627 unsigned : 1;
1628 unsigned : 1;
1629 unsigned : 1;
1630 unsigned : 1;
1631 unsigned : 1;
1632 unsigned DCCPX : 1;
1633 unsigned : 1;
1634 unsigned : 1;
1637 struct
1639 unsigned CCP2M : 4;
1640 unsigned : 4;
1643 struct
1645 unsigned : 4;
1646 unsigned DC2B : 2;
1647 unsigned : 2;
1649 } __CCP2CONbits_t;
1651 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1653 #define _CCP2M0 0x01
1654 #define _CCP2M1 0x02
1655 #define _CCP2M2 0x04
1656 #define _CCP2M3 0x08
1657 #define _DC2B0 0x10
1658 #define _CCP2Y 0x10
1659 #define _DC2B1 0x20
1660 #define _CCP2X 0x20
1661 #define _DCCPX 0x20
1663 //==============================================================================
1665 extern __at(0x0FBB) __sfr CCPR2;
1666 extern __at(0x0FBB) __sfr CCPR2L;
1667 extern __at(0x0FBC) __sfr CCPR2H;
1669 //==============================================================================
1670 // CCP1CON Bits
1672 extern __at(0x0FBD) __sfr CCP1CON;
1674 typedef union
1676 struct
1678 unsigned CCP1M0 : 1;
1679 unsigned CCP1M1 : 1;
1680 unsigned CCP1M2 : 1;
1681 unsigned CCP1M3 : 1;
1682 unsigned DC1B0 : 1;
1683 unsigned DC1B1 : 1;
1684 unsigned : 1;
1685 unsigned : 1;
1688 struct
1690 unsigned : 1;
1691 unsigned : 1;
1692 unsigned : 1;
1693 unsigned : 1;
1694 unsigned CCP1Y : 1;
1695 unsigned CCP1X : 1;
1696 unsigned : 1;
1697 unsigned : 1;
1700 struct
1702 unsigned CCP1M : 4;
1703 unsigned : 4;
1706 struct
1708 unsigned : 4;
1709 unsigned DC1B : 2;
1710 unsigned : 2;
1712 } __CCP1CONbits_t;
1714 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1716 #define _CCP1M0 0x01
1717 #define _CCP1M1 0x02
1718 #define _CCP1M2 0x04
1719 #define _CCP1M3 0x08
1720 #define _DC1B0 0x10
1721 #define _CCP1Y 0x10
1722 #define _DC1B1 0x20
1723 #define _CCP1X 0x20
1725 //==============================================================================
1727 extern __at(0x0FBE) __sfr CCPR1;
1728 extern __at(0x0FBE) __sfr CCPR1L;
1729 extern __at(0x0FBF) __sfr CCPR1H;
1731 //==============================================================================
1732 // ADCON1 Bits
1734 extern __at(0x0FC1) __sfr ADCON1;
1736 typedef union
1738 struct
1740 unsigned PCFG0 : 1;
1741 unsigned PCFG1 : 1;
1742 unsigned PCFG2 : 1;
1743 unsigned PCFG3 : 1;
1744 unsigned : 1;
1745 unsigned : 1;
1746 unsigned ADCS2 : 1;
1747 unsigned ADFM : 1;
1750 struct
1752 unsigned PCFG : 4;
1753 unsigned : 4;
1755 } __ADCON1bits_t;
1757 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1759 #define _PCFG0 0x01
1760 #define _PCFG1 0x02
1761 #define _PCFG2 0x04
1762 #define _PCFG3 0x08
1763 #define _ADCS2 0x40
1764 #define _ADFM 0x80
1766 //==============================================================================
1769 //==============================================================================
1770 // ADCON0 Bits
1772 extern __at(0x0FC2) __sfr ADCON0;
1774 typedef union
1776 struct
1778 unsigned ADON : 1;
1779 unsigned : 1;
1780 unsigned GO_NOT_DONE : 1;
1781 unsigned CHS0 : 1;
1782 unsigned CHS1 : 1;
1783 unsigned CHS2 : 1;
1784 unsigned ADCS0 : 1;
1785 unsigned ADCS1 : 1;
1788 struct
1790 unsigned : 1;
1791 unsigned : 1;
1792 unsigned GO : 1;
1793 unsigned : 1;
1794 unsigned : 1;
1795 unsigned : 1;
1796 unsigned : 1;
1797 unsigned : 1;
1800 struct
1802 unsigned : 1;
1803 unsigned : 1;
1804 unsigned NOT_DONE : 1;
1805 unsigned : 1;
1806 unsigned : 1;
1807 unsigned : 1;
1808 unsigned : 1;
1809 unsigned : 1;
1812 struct
1814 unsigned : 1;
1815 unsigned : 1;
1816 unsigned DONE : 1;
1817 unsigned : 1;
1818 unsigned : 1;
1819 unsigned : 1;
1820 unsigned : 1;
1821 unsigned : 1;
1824 struct
1826 unsigned : 1;
1827 unsigned : 1;
1828 unsigned GO_DONE : 1;
1829 unsigned : 1;
1830 unsigned : 1;
1831 unsigned : 1;
1832 unsigned : 1;
1833 unsigned : 1;
1836 struct
1838 unsigned : 3;
1839 unsigned CHS : 3;
1840 unsigned : 2;
1843 struct
1845 unsigned : 6;
1846 unsigned ADCS : 2;
1848 } __ADCON0bits_t;
1850 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1852 #define _ADON 0x01
1853 #define _GO_NOT_DONE 0x04
1854 #define _GO 0x04
1855 #define _NOT_DONE 0x04
1856 #define _DONE 0x04
1857 #define _GO_DONE 0x04
1858 #define _CHS0 0x08
1859 #define _CHS1 0x10
1860 #define _CHS2 0x20
1861 #define _ADCS0 0x40
1862 #define _ADCS1 0x80
1864 //==============================================================================
1866 extern __at(0x0FC3) __sfr ADRES;
1867 extern __at(0x0FC3) __sfr ADRESL;
1868 extern __at(0x0FC4) __sfr ADRESH;
1870 //==============================================================================
1871 // SSPCON2 Bits
1873 extern __at(0x0FC5) __sfr SSPCON2;
1875 typedef struct
1877 unsigned SEN : 1;
1878 unsigned RSEN : 1;
1879 unsigned PEN : 1;
1880 unsigned RCEN : 1;
1881 unsigned ACKEN : 1;
1882 unsigned ACKDT : 1;
1883 unsigned ACKSTAT : 1;
1884 unsigned GCEN : 1;
1885 } __SSPCON2bits_t;
1887 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1889 #define _SEN 0x01
1890 #define _RSEN 0x02
1891 #define _PEN 0x04
1892 #define _RCEN 0x08
1893 #define _ACKEN 0x10
1894 #define _ACKDT 0x20
1895 #define _ACKSTAT 0x40
1896 #define _GCEN 0x80
1898 //==============================================================================
1901 //==============================================================================
1902 // SSPCON1 Bits
1904 extern __at(0x0FC6) __sfr SSPCON1;
1906 typedef union
1908 struct
1910 unsigned SSPM0 : 1;
1911 unsigned SSPM1 : 1;
1912 unsigned SSPM2 : 1;
1913 unsigned SSPM3 : 1;
1914 unsigned CKP : 1;
1915 unsigned SSPEN : 1;
1916 unsigned SSPOV : 1;
1917 unsigned WCOL : 1;
1920 struct
1922 unsigned SSPM : 4;
1923 unsigned : 4;
1925 } __SSPCON1bits_t;
1927 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1929 #define _SSPM0 0x01
1930 #define _SSPM1 0x02
1931 #define _SSPM2 0x04
1932 #define _SSPM3 0x08
1933 #define _CKP 0x10
1934 #define _SSPEN 0x20
1935 #define _SSPOV 0x40
1936 #define _WCOL 0x80
1938 //==============================================================================
1941 //==============================================================================
1942 // SSPSTAT Bits
1944 extern __at(0x0FC7) __sfr SSPSTAT;
1946 typedef union
1948 struct
1950 unsigned BF : 1;
1951 unsigned UA : 1;
1952 unsigned R_NOT_W : 1;
1953 unsigned S : 1;
1954 unsigned P : 1;
1955 unsigned D_NOT_A : 1;
1956 unsigned CKE : 1;
1957 unsigned SMP : 1;
1960 struct
1962 unsigned : 1;
1963 unsigned : 1;
1964 unsigned I2C_READ : 1;
1965 unsigned I2C_START : 1;
1966 unsigned I2C_STOP : 1;
1967 unsigned I2C_DATA : 1;
1968 unsigned : 1;
1969 unsigned : 1;
1972 struct
1974 unsigned : 1;
1975 unsigned : 1;
1976 unsigned R : 1;
1977 unsigned : 1;
1978 unsigned : 1;
1979 unsigned D : 1;
1980 unsigned : 1;
1981 unsigned : 1;
1984 struct
1986 unsigned : 1;
1987 unsigned : 1;
1988 unsigned READ_WRITE : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1991 unsigned DATA_ADDRESS : 1;
1992 unsigned : 1;
1993 unsigned : 1;
1996 struct
1998 unsigned : 1;
1999 unsigned : 1;
2000 unsigned NOT_WRITE : 1;
2001 unsigned : 1;
2002 unsigned : 1;
2003 unsigned NOT_ADDRESS : 1;
2004 unsigned : 1;
2005 unsigned : 1;
2008 struct
2010 unsigned : 1;
2011 unsigned : 1;
2012 unsigned NOT_W : 1;
2013 unsigned : 1;
2014 unsigned : 1;
2015 unsigned NOT_A : 1;
2016 unsigned : 1;
2017 unsigned : 1;
2020 struct
2022 unsigned : 1;
2023 unsigned : 1;
2024 unsigned R_W : 1;
2025 unsigned : 1;
2026 unsigned : 1;
2027 unsigned D_A : 1;
2028 unsigned : 1;
2029 unsigned : 1;
2032 struct
2034 unsigned : 1;
2035 unsigned : 1;
2036 unsigned : 1;
2037 unsigned : 1;
2038 unsigned : 1;
2039 unsigned I2C_DAT : 1;
2040 unsigned : 1;
2041 unsigned : 1;
2043 } __SSPSTATbits_t;
2045 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2047 #define _BF 0x01
2048 #define _UA 0x02
2049 #define _R_NOT_W 0x04
2050 #define _I2C_READ 0x04
2051 #define _R 0x04
2052 #define _READ_WRITE 0x04
2053 #define _NOT_WRITE 0x04
2054 #define _NOT_W 0x04
2055 #define _R_W 0x04
2056 #define _S 0x08
2057 #define _I2C_START 0x08
2058 #define _P 0x10
2059 #define _I2C_STOP 0x10
2060 #define _D_NOT_A 0x20
2061 #define _I2C_DATA 0x20
2062 #define _D 0x20
2063 #define _DATA_ADDRESS 0x20
2064 #define _NOT_ADDRESS 0x20
2065 #define _NOT_A 0x20
2066 #define _D_A 0x20
2067 #define _I2C_DAT 0x20
2068 #define _CKE 0x40
2069 #define _SMP 0x80
2071 //==============================================================================
2073 extern __at(0x0FC8) __sfr SSPADD;
2074 extern __at(0x0FC9) __sfr SSPBUF;
2076 //==============================================================================
2077 // T2CON Bits
2079 extern __at(0x0FCA) __sfr T2CON;
2081 typedef union
2083 struct
2085 unsigned T2CKPS0 : 1;
2086 unsigned T2CKPS1 : 1;
2087 unsigned TMR2ON : 1;
2088 unsigned TOUTPS0 : 1;
2089 unsigned TOUTPS1 : 1;
2090 unsigned TOUTPS2 : 1;
2091 unsigned TOUTPS3 : 1;
2092 unsigned : 1;
2095 struct
2097 unsigned T2CKPS : 2;
2098 unsigned : 6;
2101 struct
2103 unsigned : 3;
2104 unsigned TOUTPS : 4;
2105 unsigned : 1;
2107 } __T2CONbits_t;
2109 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2111 #define _T2CKPS0 0x01
2112 #define _T2CKPS1 0x02
2113 #define _TMR2ON 0x04
2114 #define _TOUTPS0 0x08
2115 #define _TOUTPS1 0x10
2116 #define _TOUTPS2 0x20
2117 #define _TOUTPS3 0x40
2119 //==============================================================================
2121 extern __at(0x0FCB) __sfr PR2;
2122 extern __at(0x0FCC) __sfr TMR2;
2124 //==============================================================================
2125 // T1CON Bits
2127 extern __at(0x0FCD) __sfr T1CON;
2129 typedef union
2131 struct
2133 unsigned TMR1ON : 1;
2134 unsigned TMR1CS : 1;
2135 unsigned NOT_T1SYNC : 1;
2136 unsigned T1OSCEN : 1;
2137 unsigned T1CKPS0 : 1;
2138 unsigned T1CKPS1 : 1;
2139 unsigned : 1;
2140 unsigned RD16 : 1;
2143 struct
2145 unsigned : 1;
2146 unsigned : 1;
2147 unsigned T1SYNC : 1;
2148 unsigned : 1;
2149 unsigned : 1;
2150 unsigned : 1;
2151 unsigned : 1;
2152 unsigned : 1;
2155 struct
2157 unsigned : 1;
2158 unsigned : 1;
2159 unsigned T1INSYNC : 1;
2160 unsigned : 1;
2161 unsigned : 1;
2162 unsigned : 1;
2163 unsigned : 1;
2164 unsigned : 1;
2167 struct
2169 unsigned : 4;
2170 unsigned T1CKPS : 2;
2171 unsigned : 2;
2173 } __T1CONbits_t;
2175 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2177 #define _TMR1ON 0x01
2178 #define _TMR1CS 0x02
2179 #define _NOT_T1SYNC 0x04
2180 #define _T1SYNC 0x04
2181 #define _T1INSYNC 0x04
2182 #define _T1OSCEN 0x08
2183 #define _T1CKPS0 0x10
2184 #define _T1CKPS1 0x20
2185 #define _RD16 0x80
2187 //==============================================================================
2189 extern __at(0x0FCE) __sfr TMR1;
2190 extern __at(0x0FCE) __sfr TMR1L;
2191 extern __at(0x0FCF) __sfr TMR1H;
2193 //==============================================================================
2194 // RCON Bits
2196 extern __at(0x0FD0) __sfr RCON;
2198 typedef union
2200 struct
2202 unsigned NOT_BOR : 1;
2203 unsigned NOT_POR : 1;
2204 unsigned NOT_PD : 1;
2205 unsigned NOT_TO : 1;
2206 unsigned NOT_RI : 1;
2207 unsigned : 1;
2208 unsigned : 1;
2209 unsigned IPEN : 1;
2212 struct
2214 unsigned BOR : 1;
2215 unsigned POR : 1;
2216 unsigned PD : 1;
2217 unsigned TO : 1;
2218 unsigned RI : 1;
2219 unsigned : 1;
2220 unsigned : 1;
2221 unsigned NOT_IPEN : 1;
2223 } __RCONbits_t;
2225 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2227 #define _NOT_BOR 0x01
2228 #define _BOR 0x01
2229 #define _NOT_POR 0x02
2230 #define _POR 0x02
2231 #define _NOT_PD 0x04
2232 #define _PD 0x04
2233 #define _NOT_TO 0x08
2234 #define _TO 0x08
2235 #define _NOT_RI 0x10
2236 #define _RI 0x10
2237 #define _IPEN 0x80
2238 #define _NOT_IPEN 0x80
2240 //==============================================================================
2243 //==============================================================================
2244 // WDTCON Bits
2246 extern __at(0x0FD1) __sfr WDTCON;
2248 typedef union
2250 struct
2252 unsigned SWDTEN : 1;
2253 unsigned : 1;
2254 unsigned : 1;
2255 unsigned : 1;
2256 unsigned : 1;
2257 unsigned : 1;
2258 unsigned : 1;
2259 unsigned : 1;
2262 struct
2264 unsigned SWDTE : 1;
2265 unsigned : 1;
2266 unsigned : 1;
2267 unsigned : 1;
2268 unsigned : 1;
2269 unsigned : 1;
2270 unsigned : 1;
2271 unsigned : 1;
2273 } __WDTCONbits_t;
2275 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2277 #define _SWDTEN 0x01
2278 #define _SWDTE 0x01
2280 //==============================================================================
2283 //==============================================================================
2284 // LVDCON Bits
2286 extern __at(0x0FD2) __sfr LVDCON;
2288 typedef union
2290 struct
2292 unsigned LVDL0 : 1;
2293 unsigned LVDL1 : 1;
2294 unsigned LVDL2 : 1;
2295 unsigned LVDL3 : 1;
2296 unsigned LVDEN : 1;
2297 unsigned IRVST : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2302 struct
2304 unsigned LVDL : 4;
2305 unsigned : 4;
2307 } __LVDCONbits_t;
2309 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2311 #define _LVDL0 0x01
2312 #define _LVDL1 0x02
2313 #define _LVDL2 0x04
2314 #define _LVDL3 0x08
2315 #define _LVDEN 0x10
2316 #define _IRVST 0x20
2318 //==============================================================================
2321 //==============================================================================
2322 // OSCCON Bits
2324 extern __at(0x0FD3) __sfr OSCCON;
2326 typedef struct
2328 unsigned SCS : 1;
2329 unsigned : 1;
2330 unsigned : 1;
2331 unsigned : 1;
2332 unsigned : 1;
2333 unsigned : 1;
2334 unsigned : 1;
2335 unsigned : 1;
2336 } __OSCCONbits_t;
2338 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2340 #define _SCS 0x01
2342 //==============================================================================
2345 //==============================================================================
2346 // T0CON Bits
2348 extern __at(0x0FD5) __sfr T0CON;
2350 typedef union
2352 struct
2354 unsigned T0PS0 : 1;
2355 unsigned T0PS1 : 1;
2356 unsigned T0PS2 : 1;
2357 unsigned PSA : 1;
2358 unsigned T0SE : 1;
2359 unsigned T0CS : 1;
2360 unsigned T08BIT : 1;
2361 unsigned TMR0ON : 1;
2364 struct
2366 unsigned T0PS : 3;
2367 unsigned : 5;
2369 } __T0CONbits_t;
2371 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2373 #define _T0PS0 0x01
2374 #define _T0PS1 0x02
2375 #define _T0PS2 0x04
2376 #define _PSA 0x08
2377 #define _T0SE 0x10
2378 #define _T0CS 0x20
2379 #define _T08BIT 0x40
2380 #define _TMR0ON 0x80
2382 //==============================================================================
2384 extern __at(0x0FD6) __sfr TMR0;
2385 extern __at(0x0FD6) __sfr TMR0L;
2386 extern __at(0x0FD7) __sfr TMR0H;
2388 //==============================================================================
2389 // STATUS Bits
2391 extern __at(0x0FD8) __sfr STATUS;
2393 typedef struct
2395 unsigned C : 1;
2396 unsigned DC : 1;
2397 unsigned Z : 1;
2398 unsigned OV : 1;
2399 unsigned N : 1;
2400 unsigned : 1;
2401 unsigned : 1;
2402 unsigned : 1;
2403 } __STATUSbits_t;
2405 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2407 #define _C 0x01
2408 #define _DC 0x02
2409 #define _Z 0x04
2410 #define _OV 0x08
2411 #define _N 0x10
2413 //==============================================================================
2415 extern __at(0x0FD9) __sfr FSR2L;
2416 extern __at(0x0FDA) __sfr FSR2H;
2417 extern __at(0x0FDB) __sfr PLUSW2;
2418 extern __at(0x0FDC) __sfr PREINC2;
2419 extern __at(0x0FDD) __sfr POSTDEC2;
2420 extern __at(0x0FDE) __sfr POSTINC2;
2421 extern __at(0x0FDF) __sfr INDF2;
2422 extern __at(0x0FE0) __sfr BSR;
2423 extern __at(0x0FE1) __sfr FSR1L;
2424 extern __at(0x0FE2) __sfr FSR1H;
2425 extern __at(0x0FE3) __sfr PLUSW1;
2426 extern __at(0x0FE4) __sfr PREINC1;
2427 extern __at(0x0FE5) __sfr POSTDEC1;
2428 extern __at(0x0FE6) __sfr POSTINC1;
2429 extern __at(0x0FE7) __sfr INDF1;
2430 extern __at(0x0FE8) __sfr WREG;
2431 extern __at(0x0FE9) __sfr FSR0L;
2432 extern __at(0x0FEA) __sfr FSR0H;
2433 extern __at(0x0FEB) __sfr PLUSW0;
2434 extern __at(0x0FEC) __sfr PREINC0;
2435 extern __at(0x0FED) __sfr POSTDEC0;
2436 extern __at(0x0FEE) __sfr POSTINC0;
2437 extern __at(0x0FEF) __sfr INDF0;
2439 //==============================================================================
2440 // INTCON3 Bits
2442 extern __at(0x0FF0) __sfr INTCON3;
2444 typedef union
2446 struct
2448 unsigned INT1IF : 1;
2449 unsigned INT2IF : 1;
2450 unsigned : 1;
2451 unsigned INT1IE : 1;
2452 unsigned INT2IE : 1;
2453 unsigned : 1;
2454 unsigned INT1IP : 1;
2455 unsigned INT2IP : 1;
2458 struct
2460 unsigned INT1F : 1;
2461 unsigned INT2F : 1;
2462 unsigned : 1;
2463 unsigned INT1E : 1;
2464 unsigned INT2E : 1;
2465 unsigned : 1;
2466 unsigned INT1P : 1;
2467 unsigned INT2P : 1;
2469 } __INTCON3bits_t;
2471 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2473 #define _INT1IF 0x01
2474 #define _INT1F 0x01
2475 #define _INT2IF 0x02
2476 #define _INT2F 0x02
2477 #define _INT1IE 0x08
2478 #define _INT1E 0x08
2479 #define _INT2IE 0x10
2480 #define _INT2E 0x10
2481 #define _INT1IP 0x40
2482 #define _INT1P 0x40
2483 #define _INT2IP 0x80
2484 #define _INT2P 0x80
2486 //==============================================================================
2489 //==============================================================================
2490 // INTCON2 Bits
2492 extern __at(0x0FF1) __sfr INTCON2;
2494 typedef union
2496 struct
2498 unsigned RBIP : 1;
2499 unsigned : 1;
2500 unsigned TMR0IP : 1;
2501 unsigned : 1;
2502 unsigned INTEDG2 : 1;
2503 unsigned INTEDG1 : 1;
2504 unsigned INTEDG0 : 1;
2505 unsigned NOT_RBPU : 1;
2508 struct
2510 unsigned : 1;
2511 unsigned : 1;
2512 unsigned T0IP : 1;
2513 unsigned : 1;
2514 unsigned : 1;
2515 unsigned : 1;
2516 unsigned : 1;
2517 unsigned RBPU : 1;
2519 } __INTCON2bits_t;
2521 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2523 #define _RBIP 0x01
2524 #define _TMR0IP 0x04
2525 #define _T0IP 0x04
2526 #define _INTEDG2 0x10
2527 #define _INTEDG1 0x20
2528 #define _INTEDG0 0x40
2529 #define _NOT_RBPU 0x80
2530 #define _RBPU 0x80
2532 //==============================================================================
2535 //==============================================================================
2536 // INTCON Bits
2538 extern __at(0x0FF2) __sfr INTCON;
2540 typedef union
2542 struct
2544 unsigned RBIF : 1;
2545 unsigned INT0IF : 1;
2546 unsigned TMR0IF : 1;
2547 unsigned RBIE : 1;
2548 unsigned INT0IE : 1;
2549 unsigned TMR0IE : 1;
2550 unsigned PEIE_GIEL : 1;
2551 unsigned GIE_GIEH : 1;
2554 struct
2556 unsigned : 1;
2557 unsigned INT0F : 1;
2558 unsigned T0IF : 1;
2559 unsigned : 1;
2560 unsigned INT0E : 1;
2561 unsigned T0IE : 1;
2562 unsigned PEIE : 1;
2563 unsigned GIE : 1;
2566 struct
2568 unsigned : 1;
2569 unsigned : 1;
2570 unsigned : 1;
2571 unsigned : 1;
2572 unsigned : 1;
2573 unsigned : 1;
2574 unsigned GIEL : 1;
2575 unsigned GIEH : 1;
2577 } __INTCONbits_t;
2579 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2581 #define _RBIF 0x01
2582 #define _INT0IF 0x02
2583 #define _INT0F 0x02
2584 #define _TMR0IF 0x04
2585 #define _T0IF 0x04
2586 #define _RBIE 0x08
2587 #define _INT0IE 0x10
2588 #define _INT0E 0x10
2589 #define _TMR0IE 0x20
2590 #define _T0IE 0x20
2591 #define _PEIE_GIEL 0x40
2592 #define _PEIE 0x40
2593 #define _GIEL 0x40
2594 #define _GIE_GIEH 0x80
2595 #define _GIE 0x80
2596 #define _GIEH 0x80
2598 //==============================================================================
2601 //==============================================================================
2602 // INTCON1 Bits
2604 extern __at(0x0FF2) __sfr INTCON1;
2606 typedef union
2608 struct
2610 unsigned RBIF : 1;
2611 unsigned INT0IF : 1;
2612 unsigned TMR0IF : 1;
2613 unsigned RBIE : 1;
2614 unsigned INT0IE : 1;
2615 unsigned TMR0IE : 1;
2616 unsigned PEIE_GIEL : 1;
2617 unsigned GIE_GIEH : 1;
2620 struct
2622 unsigned : 1;
2623 unsigned INT0F : 1;
2624 unsigned T0IF : 1;
2625 unsigned : 1;
2626 unsigned INT0E : 1;
2627 unsigned T0IE : 1;
2628 unsigned PEIE : 1;
2629 unsigned GIE : 1;
2632 struct
2634 unsigned : 1;
2635 unsigned : 1;
2636 unsigned : 1;
2637 unsigned : 1;
2638 unsigned : 1;
2639 unsigned : 1;
2640 unsigned GIEL : 1;
2641 unsigned GIEH : 1;
2643 } __INTCON1bits_t;
2645 extern __at(0x0FF2) volatile __INTCON1bits_t INTCON1bits;
2647 #define _INTCON1_RBIF 0x01
2648 #define _INTCON1_INT0IF 0x02
2649 #define _INTCON1_INT0F 0x02
2650 #define _INTCON1_TMR0IF 0x04
2651 #define _INTCON1_T0IF 0x04
2652 #define _INTCON1_RBIE 0x08
2653 #define _INTCON1_INT0IE 0x10
2654 #define _INTCON1_INT0E 0x10
2655 #define _INTCON1_TMR0IE 0x20
2656 #define _INTCON1_T0IE 0x20
2657 #define _INTCON1_PEIE_GIEL 0x40
2658 #define _INTCON1_PEIE 0x40
2659 #define _INTCON1_GIEL 0x40
2660 #define _INTCON1_GIE_GIEH 0x80
2661 #define _INTCON1_GIE 0x80
2662 #define _INTCON1_GIEH 0x80
2664 //==============================================================================
2666 extern __at(0x0FF3) __sfr PROD;
2667 extern __at(0x0FF3) __sfr PRODL;
2668 extern __at(0x0FF4) __sfr PRODH;
2669 extern __at(0x0FF5) __sfr TABLAT;
2670 extern __at(0x0FF6) __sfr TBLPTR;
2671 extern __at(0x0FF6) __sfr TBLPTRL;
2672 extern __at(0x0FF7) __sfr TBLPTRH;
2673 extern __at(0x0FF8) __sfr TBLPTRU;
2674 extern __at(0x0FF9) __sfr PC;
2675 extern __at(0x0FF9) __sfr PCL;
2676 extern __at(0x0FFA) __sfr PCLATH;
2677 extern __at(0x0FFB) __sfr PCLATU;
2679 //==============================================================================
2680 // STKPTR Bits
2682 extern __at(0x0FFC) __sfr STKPTR;
2684 typedef union
2686 struct
2688 unsigned STKPTR0 : 1;
2689 unsigned STKPTR1 : 1;
2690 unsigned STKPTR2 : 1;
2691 unsigned STKPTR3 : 1;
2692 unsigned STKPTR4 : 1;
2693 unsigned : 1;
2694 unsigned STKUNF : 1;
2695 unsigned STKFUL : 1;
2698 struct
2700 unsigned SP0 : 1;
2701 unsigned SP1 : 1;
2702 unsigned SP2 : 1;
2703 unsigned SP3 : 1;
2704 unsigned SP4 : 1;
2705 unsigned : 1;
2706 unsigned : 1;
2707 unsigned STKOVF : 1;
2710 struct
2712 unsigned SP : 5;
2713 unsigned : 3;
2716 struct
2718 unsigned STKPTR : 5;
2719 unsigned : 3;
2721 } __STKPTRbits_t;
2723 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2725 #define _STKPTR0 0x01
2726 #define _SP0 0x01
2727 #define _STKPTR1 0x02
2728 #define _SP1 0x02
2729 #define _STKPTR2 0x04
2730 #define _SP2 0x04
2731 #define _STKPTR3 0x08
2732 #define _SP3 0x08
2733 #define _STKPTR4 0x10
2734 #define _SP4 0x10
2735 #define _STKUNF 0x40
2736 #define _STKFUL 0x80
2737 #define _STKOVF 0x80
2739 //==============================================================================
2741 extern __at(0x0FFD) __sfr TOS;
2742 extern __at(0x0FFD) __sfr TOSL;
2743 extern __at(0x0FFE) __sfr TOSH;
2744 extern __at(0x0FFF) __sfr TOSU;
2746 //==============================================================================
2748 // Configuration Bits
2750 //==============================================================================
2752 #define __CONFIG1H 0x300001
2753 #define __CONFIG2L 0x300002
2754 #define __CONFIG2H 0x300003
2755 #define __CONFIG3H 0x300005
2756 #define __CONFIG4L 0x300006
2757 #define __CONFIG5L 0x300008
2758 #define __CONFIG5H 0x300009
2759 #define __CONFIG6L 0x30000A
2760 #define __CONFIG6H 0x30000B
2761 #define __CONFIG7L 0x30000C
2762 #define __CONFIG7H 0x30000D
2764 //----------------------------- CONFIG1H Options -------------------------------
2766 #define _LP_OSC 0xF8 // LP oscillator.
2767 #define _LP_OSC_1H 0xF8 // LP oscillator.
2768 #define _XT_OSC 0xF9 // XT oscillator.
2769 #define _XT_OSC_1H 0xF9 // XT oscillator.
2770 #define _HS_OSC 0xFA // HS oscillator.
2771 #define _HS_OSC_1H 0xFA // HS oscillator.
2772 #define _RC_OSC 0xFB // RC oscillator.
2773 #define _RC_OSC_1H 0xFB // RC oscillator.
2774 #define _EC_OSC 0xFC // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2775 #define _EC_OSC_1H 0xFC // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2776 #define _ECIO_OSC 0xFD // EC oscillator w/ OSC2 configured as RA6.
2777 #define _ECIO_OSC_1H 0xFD // EC oscillator w/ OSC2 configured as RA6.
2778 #define _HSPLL_OSC 0xFE // HS oscillator with PLL enabled/Clock frequency = (4 x FOSC).
2779 #define _HSPLL_OSC_1H 0xFE // HS oscillator with PLL enabled/Clock frequency = (4 x FOSC).
2780 #define _RCIO_OSC 0xFF // RC oscillator w/ OSC2 configured as RA6.
2781 #define _RCIO_OSC_1H 0xFF // RC oscillator w/ OSC2 configured as RA6.
2782 #define _OSCS_ON_1H 0xDF // Oscillator system clock switch option is enabled (oscillator switching is enabled).
2783 #define _OSCS_OFF_1H 0xFF // Oscillator system clock switch option is disabled (main oscillator is source).
2785 //----------------------------- CONFIG2L Options -------------------------------
2787 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2788 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2789 #define _BOR_OFF_2L 0xFD // Brown-out Reset disabled.
2790 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled.
2791 #define _BORV_45_2L 0xF3 // VBOR set to 4.5V.
2792 #define _BORV_42_2L 0xF7 // VBOR set to 4.2V.
2793 #define _BORV_27_2L 0xFB // VBOR set to 2.7V.
2794 #define _BORV_20 0xFF // VBOR set to 2.0V.
2795 #define _BORV_20_2L 0xFF // VBOR set to 2.0V.
2797 //----------------------------- CONFIG2H Options -------------------------------
2799 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2800 #define _WDT_ON_2H 0xFF // WDT enabled.
2801 #define _WDTPS_1_2H 0xF1 // 1:1.
2802 #define _WDTPS_2_2H 0xF3 // 1:2.
2803 #define _WDTPS_4_2H 0xF5 // 1:4.
2804 #define _WDTPS_8_2H 0xF7 // 1:8.
2805 #define _WDTPS_16_2H 0xF9 // 1:16.
2806 #define _WDTPS_32_2H 0xFB // 1:32.
2807 #define _WDTPS_64_2H 0xFD // 1:64.
2808 #define _WDTPS_128_2H 0xFF // 1:128.
2810 //----------------------------- CONFIG3H Options -------------------------------
2812 #define _CCP2MX_OFF 0xFE // CCP2 input/output is multiplexed with RB3.
2813 #define _CCP2MX_OFF_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2814 #define _CCP2MX_ON 0xFF // CCP2 input/output is multiplexed with RC1.
2815 #define _CCP2MX_ON_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2817 //----------------------------- CONFIG4L Options -------------------------------
2819 #define _STVR_OFF_4L 0xFE // Stack Full/Underflow will not cause RESET.
2820 #define _STVR_ON_4L 0xFF // Stack Full/Underflow will cause RESET.
2821 #define _LVP_OFF_4L 0xFB // Low Voltage ICSP disabled.
2822 #define _LVP_ON_4L 0xFF // Low Voltage ICSP enabled.
2823 #define _DEBUG_ON_4L 0x7F // Background Debugger enabled. RB6 and RB7 are dedicated to In-Circuit Debug.
2824 #define _DEBUG_OFF_4L 0xFF // Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
2826 //----------------------------- CONFIG5L Options -------------------------------
2828 #define _CP0_ON_5L 0xFE // Block 0 (000200-001FFFh) code protected.
2829 #define _CP0_OFF_5L 0xFF // Block 0 (000200-001FFFh) not code protected.
2830 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code protected.
2831 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code protected.
2833 //----------------------------- CONFIG5H Options -------------------------------
2835 #define _CPB_ON_5H 0xBF // Boot Block (000000-0001FFh) code protected.
2836 #define _CPB_OFF_5H 0xFF // Boot Block (000000-0001FFh) not code protected.
2837 #define _CPD_ON_5H 0x7F // Data EEPROM code protected.
2838 #define _CPD_OFF_5H 0xFF // Data EEPROM not code protected.
2840 //----------------------------- CONFIG6L Options -------------------------------
2842 #define _WRT0_ON_6L 0xFE // Block 0 (000200-001FFFh) write protected.
2843 #define _WRT0_OFF_6L 0xFF // Block 0 (000200-001FFFh) not write protected.
2844 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write protected.
2845 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write protected.
2847 //----------------------------- CONFIG6H Options -------------------------------
2849 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write protected.
2850 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write protected.
2851 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0001FFh) write protected.
2852 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0001FFh) not write protected.
2853 #define _WRTD_ON_6H 0x7F // Data EEPROM write protected.
2854 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write protected.
2856 //----------------------------- CONFIG7L Options -------------------------------
2858 #define _EBTR0_ON_7L 0xFE // Block 0 (000200-001FFFh) protected from Table Reads executed in other blocks.
2859 #define _EBTR0_OFF_7L 0xFF // Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks.
2860 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from Table Reads executed in other blocks.
2861 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks.
2863 //----------------------------- CONFIG7H Options -------------------------------
2865 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0001FFh) protected from Table Reads executed in other blocks.
2866 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks.
2868 //==============================================================================
2870 #define __DEVID1 0x3FFFFE
2871 #define __DEVID2 0x3FFFFF
2873 #define __IDLOC0 0x200000
2874 #define __IDLOC1 0x200001
2875 #define __IDLOC2 0x200002
2876 #define __IDLOC3 0x200003
2877 #define __IDLOC4 0x200004
2878 #define __IDLOC5 0x200005
2879 #define __IDLOC6 0x200006
2880 #define __IDLOC7 0x200007
2882 #endif // #ifndef __PIC18F442_H__