1 /*
2  * This declarations of the PIC18LF4520 MCU.
3  *
4  * This file is part of the GNU PIC library for SDCC, originally
5  * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
6  *
7  * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:24:03 UTC.
8  *
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.
12  *
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.
21  *
22  * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
23  */
24 
25 #ifndef __PIC18LF4520_H__
26 #define __PIC18LF4520_H__
27 
28 //==============================================================================
29 
30 //==============================================================================
31 //
32 //	Register Definitions
33 //
34 //==============================================================================
35 
36 
37 //==============================================================================
38 //        PORTA Bits
39 
40 extern __at(0x0F80) __sfr PORTA;
41 
42 typedef union
43   {
44   struct
45     {
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 RA7                : 1;
54     };
55 
56   struct
57     {
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 OSC1               : 1;
66     };
67 
68   struct
69     {
70     unsigned                    : 1;
71     unsigned                    : 1;
72     unsigned VREFN              : 1;
73     unsigned VREFP              : 1;
74     unsigned C1OUT              : 1;
75     unsigned SS                 : 1;
76     unsigned CLKO               : 1;
77     unsigned CLKI               : 1;
78     };
79 
80   struct
81     {
82     unsigned                    : 1;
83     unsigned                    : 1;
84     unsigned CVREF              : 1;
85     unsigned                    : 1;
86     unsigned                    : 1;
87     unsigned NOT_SS             : 1;
88     unsigned                    : 1;
89     unsigned                    : 1;
90     };
91 
92   struct
93     {
94     unsigned                    : 1;
95     unsigned                    : 1;
96     unsigned                    : 1;
97     unsigned                    : 1;
98     unsigned                    : 1;
99     unsigned LVDIN              : 1;
100     unsigned                    : 1;
101     unsigned                    : 1;
102     };
103 
104   struct
105     {
106     unsigned                    : 1;
107     unsigned                    : 1;
108     unsigned                    : 1;
109     unsigned                    : 1;
110     unsigned                    : 1;
111     unsigned HLVDIN             : 1;
112     unsigned                    : 1;
113     unsigned                    : 1;
114     };
115 
116   struct
117     {
118     unsigned                    : 1;
119     unsigned                    : 1;
120     unsigned                    : 1;
121     unsigned                    : 1;
122     unsigned                    : 1;
123     unsigned C2OUT              : 1;
124     unsigned                    : 1;
125     unsigned                    : 1;
126     };
127   } __PORTAbits_t;
128 
129 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
130 
131 #define _PORTA_RA0              0x01
132 #define _PORTA_AN0              0x01
133 #define _PORTA_RA1              0x02
134 #define _PORTA_AN1              0x02
135 #define _PORTA_RA2              0x04
136 #define _PORTA_AN2              0x04
137 #define _PORTA_VREFN            0x04
138 #define _PORTA_CVREF            0x04
139 #define _PORTA_RA3              0x08
140 #define _PORTA_AN3              0x08
141 #define _PORTA_VREFP            0x08
142 #define _PORTA_RA4              0x10
143 #define _PORTA_T0CKI            0x10
144 #define _PORTA_C1OUT            0x10
145 #define _PORTA_RA5              0x20
146 #define _PORTA_AN4              0x20
147 #define _PORTA_SS               0x20
148 #define _PORTA_NOT_SS           0x20
149 #define _PORTA_LVDIN            0x20
150 #define _PORTA_HLVDIN           0x20
151 #define _PORTA_C2OUT            0x20
152 #define _PORTA_RA6              0x40
153 #define _PORTA_OSC2             0x40
154 #define _PORTA_CLKO             0x40
155 #define _PORTA_RA7              0x80
156 #define _PORTA_OSC1             0x80
157 #define _PORTA_CLKI             0x80
158 
159 //==============================================================================
160 
161 
162 //==============================================================================
163 //        PORTB Bits
164 
165 extern __at(0x0F81) __sfr PORTB;
166 
167 typedef union
168   {
169   struct
170     {
171     unsigned RB0                : 1;
172     unsigned RB1                : 1;
173     unsigned RB2                : 1;
174     unsigned RB3                : 1;
175     unsigned RB4                : 1;
176     unsigned RB5                : 1;
177     unsigned RB6                : 1;
178     unsigned RB7                : 1;
179     };
180 
181   struct
182     {
183     unsigned INT0               : 1;
184     unsigned INT1               : 1;
185     unsigned INT2               : 1;
186     unsigned CCP2               : 1;
187     unsigned KBI0               : 1;
188     unsigned KBI1               : 1;
189     unsigned KBI2               : 1;
190     unsigned KBI3               : 1;
191     };
192 
193   struct
194     {
195     unsigned AN12               : 1;
196     unsigned AN10               : 1;
197     unsigned AN8                : 1;
198     unsigned AN9                : 1;
199     unsigned AN11               : 1;
200     unsigned PGM                : 1;
201     unsigned PGC                : 1;
202     unsigned PGD                : 1;
203     };
204 
205   struct
206     {
207     unsigned FLT0               : 1;
208     unsigned                    : 1;
209     unsigned                    : 1;
210     unsigned                    : 1;
211     unsigned                    : 1;
212     unsigned                    : 1;
213     unsigned                    : 1;
214     unsigned                    : 1;
215     };
216 
217   struct
218     {
219     unsigned INT                : 3;
220     unsigned                    : 5;
221     };
222 
223   struct
224     {
225     unsigned                    : 4;
226     unsigned KBI                : 4;
227     };
228   } __PORTBbits_t;
229 
230 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
231 
232 #define _PORTB_RB0              0x01
233 #define _PORTB_INT0             0x01
234 #define _PORTB_AN12             0x01
235 #define _PORTB_FLT0             0x01
236 #define _PORTB_RB1              0x02
237 #define _PORTB_INT1             0x02
238 #define _PORTB_AN10             0x02
239 #define _PORTB_RB2              0x04
240 #define _PORTB_INT2             0x04
241 #define _PORTB_AN8              0x04
242 #define _PORTB_RB3              0x08
243 #define _PORTB_CCP2             0x08
244 #define _PORTB_AN9              0x08
245 #define _PORTB_RB4              0x10
246 #define _PORTB_KBI0             0x10
247 #define _PORTB_AN11             0x10
248 #define _PORTB_RB5              0x20
249 #define _PORTB_KBI1             0x20
250 #define _PORTB_PGM              0x20
251 #define _PORTB_RB6              0x40
252 #define _PORTB_KBI2             0x40
253 #define _PORTB_PGC              0x40
254 #define _PORTB_RB7              0x80
255 #define _PORTB_KBI3             0x80
256 #define _PORTB_PGD              0x80
257 
258 //==============================================================================
259 
260 
261 //==============================================================================
262 //        PORTC Bits
263 
264 extern __at(0x0F82) __sfr PORTC;
265 
266 typedef union
267   {
268   struct
269     {
270     unsigned RC0                : 1;
271     unsigned RC1                : 1;
272     unsigned RC2                : 1;
273     unsigned RC3                : 1;
274     unsigned RC4                : 1;
275     unsigned RC5                : 1;
276     unsigned RC6                : 1;
277     unsigned RC7                : 1;
278     };
279 
280   struct
281     {
282     unsigned T1OSO              : 1;
283     unsigned T1OSI              : 1;
284     unsigned CCP1               : 1;
285     unsigned SCK                : 1;
286     unsigned SDI                : 1;
287     unsigned SDO                : 1;
288     unsigned TX                 : 1;
289     unsigned RX                 : 1;
290     };
291 
292   struct
293     {
294     unsigned T13CKI             : 1;
295     unsigned CCP2               : 1;
296     unsigned P1A                : 1;
297     unsigned SCL                : 1;
298     unsigned SDA                : 1;
299     unsigned                    : 1;
300     unsigned CK                 : 1;
301     unsigned                    : 1;
302     };
303 
304   struct
305     {
306     unsigned T1CKI              : 1;
307     unsigned                    : 1;
308     unsigned                    : 1;
309     unsigned                    : 1;
310     unsigned                    : 1;
311     unsigned                    : 1;
312     unsigned                    : 1;
313     unsigned                    : 1;
314     };
315   } __PORTCbits_t;
316 
317 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
318 
319 #define _PORTC_RC0              0x01
320 #define _PORTC_T1OSO            0x01
321 #define _PORTC_T13CKI           0x01
322 #define _PORTC_T1CKI            0x01
323 #define _PORTC_RC1              0x02
324 #define _PORTC_T1OSI            0x02
325 #define _PORTC_CCP2             0x02
326 #define _PORTC_RC2              0x04
327 #define _PORTC_CCP1             0x04
328 #define _PORTC_P1A              0x04
329 #define _PORTC_RC3              0x08
330 #define _PORTC_SCK              0x08
331 #define _PORTC_SCL              0x08
332 #define _PORTC_RC4              0x10
333 #define _PORTC_SDI              0x10
334 #define _PORTC_SDA              0x10
335 #define _PORTC_RC5              0x20
336 #define _PORTC_SDO              0x20
337 #define _PORTC_RC6              0x40
338 #define _PORTC_TX               0x40
339 #define _PORTC_CK               0x40
340 #define _PORTC_RC7              0x80
341 #define _PORTC_RX               0x80
342 
343 //==============================================================================
344 
345 
346 //==============================================================================
347 //        PORTD Bits
348 
349 extern __at(0x0F83) __sfr PORTD;
350 
351 typedef union
352   {
353   struct
354     {
355     unsigned RD0                : 1;
356     unsigned RD1                : 1;
357     unsigned RD2                : 1;
358     unsigned RD3                : 1;
359     unsigned RD4                : 1;
360     unsigned RD5                : 1;
361     unsigned RD6                : 1;
362     unsigned RD7                : 1;
363     };
364 
365   struct
366     {
367     unsigned PSP0               : 1;
368     unsigned PSP1               : 1;
369     unsigned PSP2               : 1;
370     unsigned PSP3               : 1;
371     unsigned PSP4               : 1;
372     unsigned PSP5               : 1;
373     unsigned PSP6               : 1;
374     unsigned PSP7               : 1;
375     };
376 
377   struct
378     {
379     unsigned                    : 1;
380     unsigned                    : 1;
381     unsigned                    : 1;
382     unsigned                    : 1;
383     unsigned                    : 1;
384     unsigned P1B                : 1;
385     unsigned P1C                : 1;
386     unsigned P1D                : 1;
387     };
388   } __PORTDbits_t;
389 
390 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
391 
392 #define _PORTD_RD0              0x01
393 #define _PORTD_PSP0             0x01
394 #define _PORTD_RD1              0x02
395 #define _PORTD_PSP1             0x02
396 #define _PORTD_RD2              0x04
397 #define _PORTD_PSP2             0x04
398 #define _PORTD_RD3              0x08
399 #define _PORTD_PSP3             0x08
400 #define _PORTD_RD4              0x10
401 #define _PORTD_PSP4             0x10
402 #define _PORTD_RD5              0x20
403 #define _PORTD_PSP5             0x20
404 #define _PORTD_P1B              0x20
405 #define _PORTD_RD6              0x40
406 #define _PORTD_PSP6             0x40
407 #define _PORTD_P1C              0x40
408 #define _PORTD_RD7              0x80
409 #define _PORTD_PSP7             0x80
410 #define _PORTD_P1D              0x80
411 
412 //==============================================================================
413 
414 
415 //==============================================================================
416 //        PORTE Bits
417 
418 extern __at(0x0F84) __sfr PORTE;
419 
420 typedef union
421   {
422   struct
423     {
424     unsigned RE0                : 1;
425     unsigned RE1                : 1;
426     unsigned RE2                : 1;
427     unsigned RE3                : 1;
428     unsigned                    : 1;
429     unsigned                    : 1;
430     unsigned                    : 1;
431     unsigned                    : 1;
432     };
433 
434   struct
435     {
436     unsigned RD                 : 1;
437     unsigned WR                 : 1;
438     unsigned CS                 : 1;
439     unsigned MCLR               : 1;
440     unsigned                    : 1;
441     unsigned                    : 1;
442     unsigned                    : 1;
443     unsigned                    : 1;
444     };
445 
446   struct
447     {
448     unsigned NOT_RD             : 1;
449     unsigned NOT_WR             : 1;
450     unsigned NOT_CS             : 1;
451     unsigned NOT_MCLR           : 1;
452     unsigned                    : 1;
453     unsigned                    : 1;
454     unsigned                    : 1;
455     unsigned                    : 1;
456     };
457 
458   struct
459     {
460     unsigned AN5                : 1;
461     unsigned AN6                : 1;
462     unsigned AN7                : 1;
463     unsigned VPP                : 1;
464     unsigned                    : 1;
465     unsigned                    : 1;
466     unsigned                    : 1;
467     unsigned                    : 1;
468     };
469 
470   struct
471     {
472     unsigned RE                 : 4;
473     unsigned                    : 4;
474     };
475   } __PORTEbits_t;
476 
477 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
478 
479 #define _PORTE_RE0              0x01
480 #define _PORTE_RD               0x01
481 #define _PORTE_NOT_RD           0x01
482 #define _PORTE_AN5              0x01
483 #define _PORTE_RE1              0x02
484 #define _PORTE_WR               0x02
485 #define _PORTE_NOT_WR           0x02
486 #define _PORTE_AN6              0x02
487 #define _PORTE_RE2              0x04
488 #define _PORTE_CS               0x04
489 #define _PORTE_NOT_CS           0x04
490 #define _PORTE_AN7              0x04
491 #define _PORTE_RE3              0x08
492 #define _PORTE_MCLR             0x08
493 #define _PORTE_NOT_MCLR         0x08
494 #define _PORTE_VPP              0x08
495 
496 //==============================================================================
497 
498 
499 //==============================================================================
500 //        LATA Bits
501 
502 extern __at(0x0F89) __sfr LATA;
503 
504 typedef struct
505   {
506   unsigned LATA0                : 1;
507   unsigned LATA1                : 1;
508   unsigned LATA2                : 1;
509   unsigned LATA3                : 1;
510   unsigned LATA4                : 1;
511   unsigned LATA5                : 1;
512   unsigned LATA6                : 1;
513   unsigned LATA7                : 1;
514   } __LATAbits_t;
515 
516 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
517 
518 #define _LATA0                  0x01
519 #define _LATA1                  0x02
520 #define _LATA2                  0x04
521 #define _LATA3                  0x08
522 #define _LATA4                  0x10
523 #define _LATA5                  0x20
524 #define _LATA6                  0x40
525 #define _LATA7                  0x80
526 
527 //==============================================================================
528 
529 
530 //==============================================================================
531 //        LATB Bits
532 
533 extern __at(0x0F8A) __sfr LATB;
534 
535 typedef struct
536   {
537   unsigned LATB0                : 1;
538   unsigned LATB1                : 1;
539   unsigned LATB2                : 1;
540   unsigned LATB3                : 1;
541   unsigned LATB4                : 1;
542   unsigned LATB5                : 1;
543   unsigned LATB6                : 1;
544   unsigned LATB7                : 1;
545   } __LATBbits_t;
546 
547 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
548 
549 #define _LATB0                  0x01
550 #define _LATB1                  0x02
551 #define _LATB2                  0x04
552 #define _LATB3                  0x08
553 #define _LATB4                  0x10
554 #define _LATB5                  0x20
555 #define _LATB6                  0x40
556 #define _LATB7                  0x80
557 
558 //==============================================================================
559 
560 
561 //==============================================================================
562 //        LATC Bits
563 
564 extern __at(0x0F8B) __sfr LATC;
565 
566 typedef struct
567   {
568   unsigned LATC0                : 1;
569   unsigned LATC1                : 1;
570   unsigned LATC2                : 1;
571   unsigned LATC3                : 1;
572   unsigned LATC4                : 1;
573   unsigned LATC5                : 1;
574   unsigned LATC6                : 1;
575   unsigned LATC7                : 1;
576   } __LATCbits_t;
577 
578 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
579 
580 #define _LATC0                  0x01
581 #define _LATC1                  0x02
582 #define _LATC2                  0x04
583 #define _LATC3                  0x08
584 #define _LATC4                  0x10
585 #define _LATC5                  0x20
586 #define _LATC6                  0x40
587 #define _LATC7                  0x80
588 
589 //==============================================================================
590 
591 
592 //==============================================================================
593 //        LATD Bits
594 
595 extern __at(0x0F8C) __sfr LATD;
596 
597 typedef struct
598   {
599   unsigned LATD0                : 1;
600   unsigned LATD1                : 1;
601   unsigned LATD2                : 1;
602   unsigned LATD3                : 1;
603   unsigned LATD4                : 1;
604   unsigned LATD5                : 1;
605   unsigned LATD6                : 1;
606   unsigned LATD7                : 1;
607   } __LATDbits_t;
608 
609 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
610 
611 #define _LATD0                  0x01
612 #define _LATD1                  0x02
613 #define _LATD2                  0x04
614 #define _LATD3                  0x08
615 #define _LATD4                  0x10
616 #define _LATD5                  0x20
617 #define _LATD6                  0x40
618 #define _LATD7                  0x80
619 
620 //==============================================================================
621 
622 
623 //==============================================================================
624 //        LATE Bits
625 
626 extern __at(0x0F8D) __sfr LATE;
627 
628 typedef union
629   {
630   struct
631     {
632     unsigned LATE0              : 1;
633     unsigned LATE1              : 1;
634     unsigned LATE2              : 1;
635     unsigned                    : 1;
636     unsigned                    : 1;
637     unsigned                    : 1;
638     unsigned                    : 1;
639     unsigned                    : 1;
640     };
641 
642   struct
643     {
644     unsigned LATE               : 3;
645     unsigned                    : 5;
646     };
647   } __LATEbits_t;
648 
649 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
650 
651 #define _LATE0                  0x01
652 #define _LATE1                  0x02
653 #define _LATE2                  0x04
654 
655 //==============================================================================
656 
657 
658 //==============================================================================
659 //        DDRA Bits
660 
661 extern __at(0x0F92) __sfr DDRA;
662 
663 typedef union
664   {
665   struct
666     {
667     unsigned TRISA0             : 1;
668     unsigned TRISA1             : 1;
669     unsigned TRISA2             : 1;
670     unsigned TRISA3             : 1;
671     unsigned TRISA4             : 1;
672     unsigned TRISA5             : 1;
673     unsigned TRISA6             : 1;
674     unsigned TRISA7             : 1;
675     };
676 
677   struct
678     {
679     unsigned RA0                : 1;
680     unsigned RA1                : 1;
681     unsigned RA2                : 1;
682     unsigned RA3                : 1;
683     unsigned RA4                : 1;
684     unsigned RA5                : 1;
685     unsigned RA6                : 1;
686     unsigned RA7                : 1;
687     };
688   } __DDRAbits_t;
689 
690 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
691 
692 #define _TRISA0                 0x01
693 #define _RA0                    0x01
694 #define _TRISA1                 0x02
695 #define _RA1                    0x02
696 #define _TRISA2                 0x04
697 #define _RA2                    0x04
698 #define _TRISA3                 0x08
699 #define _RA3                    0x08
700 #define _TRISA4                 0x10
701 #define _RA4                    0x10
702 #define _TRISA5                 0x20
703 #define _RA5                    0x20
704 #define _TRISA6                 0x40
705 #define _RA6                    0x40
706 #define _TRISA7                 0x80
707 #define _RA7                    0x80
708 
709 //==============================================================================
710 
711 
712 //==============================================================================
713 //        TRISA Bits
714 
715 extern __at(0x0F92) __sfr TRISA;
716 
717 typedef union
718   {
719   struct
720     {
721     unsigned TRISA0             : 1;
722     unsigned TRISA1             : 1;
723     unsigned TRISA2             : 1;
724     unsigned TRISA3             : 1;
725     unsigned TRISA4             : 1;
726     unsigned TRISA5             : 1;
727     unsigned TRISA6             : 1;
728     unsigned TRISA7             : 1;
729     };
730 
731   struct
732     {
733     unsigned RA0                : 1;
734     unsigned RA1                : 1;
735     unsigned RA2                : 1;
736     unsigned RA3                : 1;
737     unsigned RA4                : 1;
738     unsigned RA5                : 1;
739     unsigned RA6                : 1;
740     unsigned RA7                : 1;
741     };
742   } __TRISAbits_t;
743 
744 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
745 
746 #define _TRISA_TRISA0           0x01
747 #define _TRISA_RA0              0x01
748 #define _TRISA_TRISA1           0x02
749 #define _TRISA_RA1              0x02
750 #define _TRISA_TRISA2           0x04
751 #define _TRISA_RA2              0x04
752 #define _TRISA_TRISA3           0x08
753 #define _TRISA_RA3              0x08
754 #define _TRISA_TRISA4           0x10
755 #define _TRISA_RA4              0x10
756 #define _TRISA_TRISA5           0x20
757 #define _TRISA_RA5              0x20
758 #define _TRISA_TRISA6           0x40
759 #define _TRISA_RA6              0x40
760 #define _TRISA_TRISA7           0x80
761 #define _TRISA_RA7              0x80
762 
763 //==============================================================================
764 
765 
766 //==============================================================================
767 //        DDRB Bits
768 
769 extern __at(0x0F93) __sfr DDRB;
770 
771 typedef union
772   {
773   struct
774     {
775     unsigned TRISB0             : 1;
776     unsigned TRISB1             : 1;
777     unsigned TRISB2             : 1;
778     unsigned TRISB3             : 1;
779     unsigned TRISB4             : 1;
780     unsigned TRISB5             : 1;
781     unsigned TRISB6             : 1;
782     unsigned TRISB7             : 1;
783     };
784 
785   struct
786     {
787     unsigned RB0                : 1;
788     unsigned RB1                : 1;
789     unsigned RB2                : 1;
790     unsigned RB3                : 1;
791     unsigned RB4                : 1;
792     unsigned RB5                : 1;
793     unsigned RB6                : 1;
794     unsigned RB7                : 1;
795     };
796   } __DDRBbits_t;
797 
798 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
799 
800 #define _TRISB0                 0x01
801 #define _RB0                    0x01
802 #define _TRISB1                 0x02
803 #define _RB1                    0x02
804 #define _TRISB2                 0x04
805 #define _RB2                    0x04
806 #define _TRISB3                 0x08
807 #define _RB3                    0x08
808 #define _TRISB4                 0x10
809 #define _RB4                    0x10
810 #define _TRISB5                 0x20
811 #define _RB5                    0x20
812 #define _TRISB6                 0x40
813 #define _RB6                    0x40
814 #define _TRISB7                 0x80
815 #define _RB7                    0x80
816 
817 //==============================================================================
818 
819 
820 //==============================================================================
821 //        TRISB Bits
822 
823 extern __at(0x0F93) __sfr TRISB;
824 
825 typedef union
826   {
827   struct
828     {
829     unsigned TRISB0             : 1;
830     unsigned TRISB1             : 1;
831     unsigned TRISB2             : 1;
832     unsigned TRISB3             : 1;
833     unsigned TRISB4             : 1;
834     unsigned TRISB5             : 1;
835     unsigned TRISB6             : 1;
836     unsigned TRISB7             : 1;
837     };
838 
839   struct
840     {
841     unsigned RB0                : 1;
842     unsigned RB1                : 1;
843     unsigned RB2                : 1;
844     unsigned RB3                : 1;
845     unsigned RB4                : 1;
846     unsigned RB5                : 1;
847     unsigned RB6                : 1;
848     unsigned RB7                : 1;
849     };
850   } __TRISBbits_t;
851 
852 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
853 
854 #define _TRISB_TRISB0           0x01
855 #define _TRISB_RB0              0x01
856 #define _TRISB_TRISB1           0x02
857 #define _TRISB_RB1              0x02
858 #define _TRISB_TRISB2           0x04
859 #define _TRISB_RB2              0x04
860 #define _TRISB_TRISB3           0x08
861 #define _TRISB_RB3              0x08
862 #define _TRISB_TRISB4           0x10
863 #define _TRISB_RB4              0x10
864 #define _TRISB_TRISB5           0x20
865 #define _TRISB_RB5              0x20
866 #define _TRISB_TRISB6           0x40
867 #define _TRISB_RB6              0x40
868 #define _TRISB_TRISB7           0x80
869 #define _TRISB_RB7              0x80
870 
871 //==============================================================================
872 
873 
874 //==============================================================================
875 //        DDRC Bits
876 
877 extern __at(0x0F94) __sfr DDRC;
878 
879 typedef union
880   {
881   struct
882     {
883     unsigned TRISC0             : 1;
884     unsigned TRISC1             : 1;
885     unsigned TRISC2             : 1;
886     unsigned TRISC3             : 1;
887     unsigned TRISC4             : 1;
888     unsigned TRISC5             : 1;
889     unsigned TRISC6             : 1;
890     unsigned TRISC7             : 1;
891     };
892 
893   struct
894     {
895     unsigned RC0                : 1;
896     unsigned RC1                : 1;
897     unsigned RC2                : 1;
898     unsigned RC3                : 1;
899     unsigned RC4                : 1;
900     unsigned RC5                : 1;
901     unsigned RC6                : 1;
902     unsigned RC7                : 1;
903     };
904   } __DDRCbits_t;
905 
906 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
907 
908 #define _TRISC0                 0x01
909 #define _RC0                    0x01
910 #define _TRISC1                 0x02
911 #define _RC1                    0x02
912 #define _TRISC2                 0x04
913 #define _RC2                    0x04
914 #define _TRISC3                 0x08
915 #define _RC3                    0x08
916 #define _TRISC4                 0x10
917 #define _RC4                    0x10
918 #define _TRISC5                 0x20
919 #define _RC5                    0x20
920 #define _TRISC6                 0x40
921 #define _RC6                    0x40
922 #define _TRISC7                 0x80
923 #define _RC7                    0x80
924 
925 //==============================================================================
926 
927 
928 //==============================================================================
929 //        TRISC Bits
930 
931 extern __at(0x0F94) __sfr TRISC;
932 
933 typedef union
934   {
935   struct
936     {
937     unsigned TRISC0             : 1;
938     unsigned TRISC1             : 1;
939     unsigned TRISC2             : 1;
940     unsigned TRISC3             : 1;
941     unsigned TRISC4             : 1;
942     unsigned TRISC5             : 1;
943     unsigned TRISC6             : 1;
944     unsigned TRISC7             : 1;
945     };
946 
947   struct
948     {
949     unsigned RC0                : 1;
950     unsigned RC1                : 1;
951     unsigned RC2                : 1;
952     unsigned RC3                : 1;
953     unsigned RC4                : 1;
954     unsigned RC5                : 1;
955     unsigned RC6                : 1;
956     unsigned RC7                : 1;
957     };
958   } __TRISCbits_t;
959 
960 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
961 
962 #define _TRISC_TRISC0           0x01
963 #define _TRISC_RC0              0x01
964 #define _TRISC_TRISC1           0x02
965 #define _TRISC_RC1              0x02
966 #define _TRISC_TRISC2           0x04
967 #define _TRISC_RC2              0x04
968 #define _TRISC_TRISC3           0x08
969 #define _TRISC_RC3              0x08
970 #define _TRISC_TRISC4           0x10
971 #define _TRISC_RC4              0x10
972 #define _TRISC_TRISC5           0x20
973 #define _TRISC_RC5              0x20
974 #define _TRISC_TRISC6           0x40
975 #define _TRISC_RC6              0x40
976 #define _TRISC_TRISC7           0x80
977 #define _TRISC_RC7              0x80
978 
979 //==============================================================================
980 
981 
982 //==============================================================================
983 //        DDRD Bits
984 
985 extern __at(0x0F95) __sfr DDRD;
986 
987 typedef union
988   {
989   struct
990     {
991     unsigned TRISD0             : 1;
992     unsigned TRISD1             : 1;
993     unsigned TRISD2             : 1;
994     unsigned TRISD3             : 1;
995     unsigned TRISD4             : 1;
996     unsigned TRISD5             : 1;
997     unsigned TRISD6             : 1;
998     unsigned TRISD7             : 1;
999     };
1000 
1001   struct
1002     {
1003     unsigned RD0                : 1;
1004     unsigned RD1                : 1;
1005     unsigned RD2                : 1;
1006     unsigned RD3                : 1;
1007     unsigned RD4                : 1;
1008     unsigned RD5                : 1;
1009     unsigned RD6                : 1;
1010     unsigned RD7                : 1;
1011     };
1012   } __DDRDbits_t;
1013 
1014 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
1015 
1016 #define _TRISD0                 0x01
1017 #define _RD0                    0x01
1018 #define _TRISD1                 0x02
1019 #define _RD1                    0x02
1020 #define _TRISD2                 0x04
1021 #define _RD2                    0x04
1022 #define _TRISD3                 0x08
1023 #define _RD3                    0x08
1024 #define _TRISD4                 0x10
1025 #define _RD4                    0x10
1026 #define _TRISD5                 0x20
1027 #define _RD5                    0x20
1028 #define _TRISD6                 0x40
1029 #define _RD6                    0x40
1030 #define _TRISD7                 0x80
1031 #define _RD7                    0x80
1032 
1033 //==============================================================================
1034 
1035 
1036 //==============================================================================
1037 //        TRISD Bits
1038 
1039 extern __at(0x0F95) __sfr TRISD;
1040 
1041 typedef union
1042   {
1043   struct
1044     {
1045     unsigned TRISD0             : 1;
1046     unsigned TRISD1             : 1;
1047     unsigned TRISD2             : 1;
1048     unsigned TRISD3             : 1;
1049     unsigned TRISD4             : 1;
1050     unsigned TRISD5             : 1;
1051     unsigned TRISD6             : 1;
1052     unsigned TRISD7             : 1;
1053     };
1054 
1055   struct
1056     {
1057     unsigned RD0                : 1;
1058     unsigned RD1                : 1;
1059     unsigned RD2                : 1;
1060     unsigned RD3                : 1;
1061     unsigned RD4                : 1;
1062     unsigned RD5                : 1;
1063     unsigned RD6                : 1;
1064     unsigned RD7                : 1;
1065     };
1066   } __TRISDbits_t;
1067 
1068 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
1069 
1070 #define _TRISD_TRISD0           0x01
1071 #define _TRISD_RD0              0x01
1072 #define _TRISD_TRISD1           0x02
1073 #define _TRISD_RD1              0x02
1074 #define _TRISD_TRISD2           0x04
1075 #define _TRISD_RD2              0x04
1076 #define _TRISD_TRISD3           0x08
1077 #define _TRISD_RD3              0x08
1078 #define _TRISD_TRISD4           0x10
1079 #define _TRISD_RD4              0x10
1080 #define _TRISD_TRISD5           0x20
1081 #define _TRISD_RD5              0x20
1082 #define _TRISD_TRISD6           0x40
1083 #define _TRISD_RD6              0x40
1084 #define _TRISD_TRISD7           0x80
1085 #define _TRISD_RD7              0x80
1086 
1087 //==============================================================================
1088 
1089 
1090 //==============================================================================
1091 //        DDRE Bits
1092 
1093 extern __at(0x0F96) __sfr DDRE;
1094 
1095 typedef union
1096   {
1097   struct
1098     {
1099     unsigned TRISE0             : 1;
1100     unsigned TRISE1             : 1;
1101     unsigned TRISE2             : 1;
1102     unsigned                    : 1;
1103     unsigned PSPMODE            : 1;
1104     unsigned IBOV               : 1;
1105     unsigned OBF                : 1;
1106     unsigned IBF                : 1;
1107     };
1108 
1109   struct
1110     {
1111     unsigned RE0                : 1;
1112     unsigned RE1                : 1;
1113     unsigned RE2                : 1;
1114     unsigned                    : 1;
1115     unsigned                    : 1;
1116     unsigned                    : 1;
1117     unsigned                    : 1;
1118     unsigned                    : 1;
1119     };
1120 
1121   struct
1122     {
1123     unsigned RE                 : 3;
1124     unsigned                    : 5;
1125     };
1126 
1127   struct
1128     {
1129     unsigned TRISE              : 3;
1130     unsigned                    : 5;
1131     };
1132   } __DDREbits_t;
1133 
1134 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1135 
1136 #define _TRISE0                 0x01
1137 #define _RE0                    0x01
1138 #define _TRISE1                 0x02
1139 #define _RE1                    0x02
1140 #define _TRISE2                 0x04
1141 #define _RE2                    0x04
1142 #define _PSPMODE                0x10
1143 #define _IBOV                   0x20
1144 #define _OBF                    0x40
1145 #define _IBF                    0x80
1146 
1147 //==============================================================================
1148 
1149 
1150 //==============================================================================
1151 //        TRISE Bits
1152 
1153 extern __at(0x0F96) __sfr TRISE;
1154 
1155 typedef union
1156   {
1157   struct
1158     {
1159     unsigned TRISE0             : 1;
1160     unsigned TRISE1             : 1;
1161     unsigned TRISE2             : 1;
1162     unsigned                    : 1;
1163     unsigned PSPMODE            : 1;
1164     unsigned IBOV               : 1;
1165     unsigned OBF                : 1;
1166     unsigned IBF                : 1;
1167     };
1168 
1169   struct
1170     {
1171     unsigned RE0                : 1;
1172     unsigned RE1                : 1;
1173     unsigned RE2                : 1;
1174     unsigned                    : 1;
1175     unsigned                    : 1;
1176     unsigned                    : 1;
1177     unsigned                    : 1;
1178     unsigned                    : 1;
1179     };
1180 
1181   struct
1182     {
1183     unsigned TRISE              : 3;
1184     unsigned                    : 5;
1185     };
1186 
1187   struct
1188     {
1189     unsigned RE                 : 3;
1190     unsigned                    : 5;
1191     };
1192   } __TRISEbits_t;
1193 
1194 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1195 
1196 #define _TRISE_TRISE0           0x01
1197 #define _TRISE_RE0              0x01
1198 #define _TRISE_TRISE1           0x02
1199 #define _TRISE_RE1              0x02
1200 #define _TRISE_TRISE2           0x04
1201 #define _TRISE_RE2              0x04
1202 #define _TRISE_PSPMODE          0x10
1203 #define _TRISE_IBOV             0x20
1204 #define _TRISE_OBF              0x40
1205 #define _TRISE_IBF              0x80
1206 
1207 //==============================================================================
1208 
1209 
1210 //==============================================================================
1211 //        OSCTUNE Bits
1212 
1213 extern __at(0x0F9B) __sfr OSCTUNE;
1214 
1215 typedef union
1216   {
1217   struct
1218     {
1219     unsigned TUN0               : 1;
1220     unsigned TUN1               : 1;
1221     unsigned TUN2               : 1;
1222     unsigned TUN3               : 1;
1223     unsigned TUN4               : 1;
1224     unsigned                    : 1;
1225     unsigned PLLEN              : 1;
1226     unsigned INTSRC             : 1;
1227     };
1228 
1229   struct
1230     {
1231     unsigned TUN                : 5;
1232     unsigned                    : 3;
1233     };
1234   } __OSCTUNEbits_t;
1235 
1236 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1237 
1238 #define _TUN0                   0x01
1239 #define _TUN1                   0x02
1240 #define _TUN2                   0x04
1241 #define _TUN3                   0x08
1242 #define _TUN4                   0x10
1243 #define _PLLEN                  0x40
1244 #define _INTSRC                 0x80
1245 
1246 //==============================================================================
1247 
1248 
1249 //==============================================================================
1250 //        PIE1 Bits
1251 
1252 extern __at(0x0F9D) __sfr PIE1;
1253 
1254 typedef struct
1255   {
1256   unsigned TMR1IE               : 1;
1257   unsigned TMR2IE               : 1;
1258   unsigned CCP1IE               : 1;
1259   unsigned SSPIE                : 1;
1260   unsigned TXIE                 : 1;
1261   unsigned RCIE                 : 1;
1262   unsigned ADIE                 : 1;
1263   unsigned PSPIE                : 1;
1264   } __PIE1bits_t;
1265 
1266 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1267 
1268 #define _TMR1IE                 0x01
1269 #define _TMR2IE                 0x02
1270 #define _CCP1IE                 0x04
1271 #define _SSPIE                  0x08
1272 #define _TXIE                   0x10
1273 #define _RCIE                   0x20
1274 #define _ADIE                   0x40
1275 #define _PSPIE                  0x80
1276 
1277 //==============================================================================
1278 
1279 
1280 //==============================================================================
1281 //        PIR1 Bits
1282 
1283 extern __at(0x0F9E) __sfr PIR1;
1284 
1285 typedef struct
1286   {
1287   unsigned TMR1IF               : 1;
1288   unsigned TMR2IF               : 1;
1289   unsigned CCP1IF               : 1;
1290   unsigned SSPIF                : 1;
1291   unsigned TXIF                 : 1;
1292   unsigned RCIF                 : 1;
1293   unsigned ADIF                 : 1;
1294   unsigned PSPIF                : 1;
1295   } __PIR1bits_t;
1296 
1297 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1298 
1299 #define _TMR1IF                 0x01
1300 #define _TMR2IF                 0x02
1301 #define _CCP1IF                 0x04
1302 #define _SSPIF                  0x08
1303 #define _TXIF                   0x10
1304 #define _RCIF                   0x20
1305 #define _ADIF                   0x40
1306 #define _PSPIF                  0x80
1307 
1308 //==============================================================================
1309 
1310 
1311 //==============================================================================
1312 //        IPR1 Bits
1313 
1314 extern __at(0x0F9F) __sfr IPR1;
1315 
1316 typedef struct
1317   {
1318   unsigned TMR1IP               : 1;
1319   unsigned TMR2IP               : 1;
1320   unsigned CCP1IP               : 1;
1321   unsigned SSPIP                : 1;
1322   unsigned TXIP                 : 1;
1323   unsigned RCIP                 : 1;
1324   unsigned ADIP                 : 1;
1325   unsigned PSPIP                : 1;
1326   } __IPR1bits_t;
1327 
1328 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1329 
1330 #define _TMR1IP                 0x01
1331 #define _TMR2IP                 0x02
1332 #define _CCP1IP                 0x04
1333 #define _SSPIP                  0x08
1334 #define _TXIP                   0x10
1335 #define _RCIP                   0x20
1336 #define _ADIP                   0x40
1337 #define _PSPIP                  0x80
1338 
1339 //==============================================================================
1340 
1341 
1342 //==============================================================================
1343 //        PIE2 Bits
1344 
1345 extern __at(0x0FA0) __sfr PIE2;
1346 
1347 typedef union
1348   {
1349   struct
1350     {
1351     unsigned CCP2IE             : 1;
1352     unsigned TMR3IE             : 1;
1353     unsigned HLVDIE             : 1;
1354     unsigned BCLIE              : 1;
1355     unsigned EEIE               : 1;
1356     unsigned                    : 1;
1357     unsigned CMIE               : 1;
1358     unsigned OSCFIE             : 1;
1359     };
1360 
1361   struct
1362     {
1363     unsigned                    : 1;
1364     unsigned                    : 1;
1365     unsigned LVDIE              : 1;
1366     unsigned                    : 1;
1367     unsigned                    : 1;
1368     unsigned                    : 1;
1369     unsigned                    : 1;
1370     unsigned                    : 1;
1371     };
1372   } __PIE2bits_t;
1373 
1374 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1375 
1376 #define _CCP2IE                 0x01
1377 #define _TMR3IE                 0x02
1378 #define _HLVDIE                 0x04
1379 #define _LVDIE                  0x04
1380 #define _BCLIE                  0x08
1381 #define _EEIE                   0x10
1382 #define _CMIE                   0x40
1383 #define _OSCFIE                 0x80
1384 
1385 //==============================================================================
1386 
1387 
1388 //==============================================================================
1389 //        PIR2 Bits
1390 
1391 extern __at(0x0FA1) __sfr PIR2;
1392 
1393 typedef union
1394   {
1395   struct
1396     {
1397     unsigned CCP2IF             : 1;
1398     unsigned TMR3IF             : 1;
1399     unsigned HLVDIF             : 1;
1400     unsigned BCLIF              : 1;
1401     unsigned EEIF               : 1;
1402     unsigned                    : 1;
1403     unsigned CMIF               : 1;
1404     unsigned OSCFIF             : 1;
1405     };
1406 
1407   struct
1408     {
1409     unsigned                    : 1;
1410     unsigned                    : 1;
1411     unsigned LVDIF              : 1;
1412     unsigned                    : 1;
1413     unsigned                    : 1;
1414     unsigned                    : 1;
1415     unsigned                    : 1;
1416     unsigned                    : 1;
1417     };
1418   } __PIR2bits_t;
1419 
1420 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1421 
1422 #define _CCP2IF                 0x01
1423 #define _TMR3IF                 0x02
1424 #define _HLVDIF                 0x04
1425 #define _LVDIF                  0x04
1426 #define _BCLIF                  0x08
1427 #define _EEIF                   0x10
1428 #define _CMIF                   0x40
1429 #define _OSCFIF                 0x80
1430 
1431 //==============================================================================
1432 
1433 
1434 //==============================================================================
1435 //        IPR2 Bits
1436 
1437 extern __at(0x0FA2) __sfr IPR2;
1438 
1439 typedef union
1440   {
1441   struct
1442     {
1443     unsigned CCP2IP             : 1;
1444     unsigned TMR3IP             : 1;
1445     unsigned HLVDIP             : 1;
1446     unsigned BCLIP              : 1;
1447     unsigned EEIP               : 1;
1448     unsigned                    : 1;
1449     unsigned CMIP               : 1;
1450     unsigned OSCFIP             : 1;
1451     };
1452 
1453   struct
1454     {
1455     unsigned                    : 1;
1456     unsigned                    : 1;
1457     unsigned LVDIP              : 1;
1458     unsigned                    : 1;
1459     unsigned                    : 1;
1460     unsigned                    : 1;
1461     unsigned                    : 1;
1462     unsigned                    : 1;
1463     };
1464   } __IPR2bits_t;
1465 
1466 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1467 
1468 #define _CCP2IP                 0x01
1469 #define _TMR3IP                 0x02
1470 #define _HLVDIP                 0x04
1471 #define _LVDIP                  0x04
1472 #define _BCLIP                  0x08
1473 #define _EEIP                   0x10
1474 #define _CMIP                   0x40
1475 #define _OSCFIP                 0x80
1476 
1477 //==============================================================================
1478 
1479 
1480 //==============================================================================
1481 //        EECON1 Bits
1482 
1483 extern __at(0x0FA6) __sfr EECON1;
1484 
1485 typedef struct
1486   {
1487   unsigned RD                   : 1;
1488   unsigned WR                   : 1;
1489   unsigned WREN                 : 1;
1490   unsigned WRERR                : 1;
1491   unsigned FREE                 : 1;
1492   unsigned                      : 1;
1493   unsigned CFGS                 : 1;
1494   unsigned EEPGD                : 1;
1495   } __EECON1bits_t;
1496 
1497 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1498 
1499 #define _RD                     0x01
1500 #define _WR                     0x02
1501 #define _WREN                   0x04
1502 #define _WRERR                  0x08
1503 #define _FREE                   0x10
1504 #define _CFGS                   0x40
1505 #define _EEPGD                  0x80
1506 
1507 //==============================================================================
1508 
1509 extern __at(0x0FA7) __sfr EECON2;
1510 extern __at(0x0FA8) __sfr EEDATA;
1511 extern __at(0x0FA9) __sfr EEADR;
1512 
1513 //==============================================================================
1514 //        RCSTA Bits
1515 
1516 extern __at(0x0FAB) __sfr RCSTA;
1517 
1518 typedef union
1519   {
1520   struct
1521     {
1522     unsigned RX9D               : 1;
1523     unsigned OERR               : 1;
1524     unsigned FERR               : 1;
1525     unsigned ADDEN              : 1;
1526     unsigned CREN               : 1;
1527     unsigned SREN               : 1;
1528     unsigned RX9                : 1;
1529     unsigned SPEN               : 1;
1530     };
1531 
1532   struct
1533     {
1534     unsigned                    : 1;
1535     unsigned                    : 1;
1536     unsigned                    : 1;
1537     unsigned ADEN               : 1;
1538     unsigned                    : 1;
1539     unsigned                    : 1;
1540     unsigned                    : 1;
1541     unsigned                    : 1;
1542     };
1543   } __RCSTAbits_t;
1544 
1545 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1546 
1547 #define _RX9D                   0x01
1548 #define _OERR                   0x02
1549 #define _FERR                   0x04
1550 #define _ADDEN                  0x08
1551 #define _ADEN                   0x08
1552 #define _CREN                   0x10
1553 #define _SREN                   0x20
1554 #define _RX9                    0x40
1555 #define _SPEN                   0x80
1556 
1557 //==============================================================================
1558 
1559 
1560 //==============================================================================
1561 //        TXSTA Bits
1562 
1563 extern __at(0x0FAC) __sfr TXSTA;
1564 
1565 typedef struct
1566   {
1567   unsigned TX9D                 : 1;
1568   unsigned TRMT                 : 1;
1569   unsigned BRGH                 : 1;
1570   unsigned SENDB                : 1;
1571   unsigned SYNC                 : 1;
1572   unsigned TXEN                 : 1;
1573   unsigned TX9                  : 1;
1574   unsigned CSRC                 : 1;
1575   } __TXSTAbits_t;
1576 
1577 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1578 
1579 #define _TX9D                   0x01
1580 #define _TRMT                   0x02
1581 #define _BRGH                   0x04
1582 #define _SENDB                  0x08
1583 #define _SYNC                   0x10
1584 #define _TXEN                   0x20
1585 #define _TX9                    0x40
1586 #define _CSRC                   0x80
1587 
1588 //==============================================================================
1589 
1590 extern __at(0x0FAD) __sfr TXREG;
1591 extern __at(0x0FAE) __sfr RCREG;
1592 extern __at(0x0FAF) __sfr SPBRG;
1593 extern __at(0x0FB0) __sfr SPBRGH;
1594 
1595 //==============================================================================
1596 //        T3CON Bits
1597 
1598 extern __at(0x0FB1) __sfr T3CON;
1599 
1600 typedef union
1601   {
1602   struct
1603     {
1604     unsigned TMR3ON             : 1;
1605     unsigned TMR3CS             : 1;
1606     unsigned NOT_T3SYNC         : 1;
1607     unsigned T3CCP1             : 1;
1608     unsigned T3CKPS0            : 1;
1609     unsigned T3CKPS1            : 1;
1610     unsigned T3CCP2             : 1;
1611     unsigned RD16               : 1;
1612     };
1613 
1614   struct
1615     {
1616     unsigned                    : 1;
1617     unsigned                    : 1;
1618     unsigned T3SYNC             : 1;
1619     unsigned                    : 1;
1620     unsigned                    : 1;
1621     unsigned                    : 1;
1622     unsigned                    : 1;
1623     unsigned                    : 1;
1624     };
1625 
1626   struct
1627     {
1628     unsigned                    : 4;
1629     unsigned T3CKPS             : 2;
1630     unsigned                    : 2;
1631     };
1632   } __T3CONbits_t;
1633 
1634 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1635 
1636 #define _T3CON_TMR3ON           0x01
1637 #define _T3CON_TMR3CS           0x02
1638 #define _T3CON_NOT_T3SYNC       0x04
1639 #define _T3CON_T3SYNC           0x04
1640 #define _T3CON_T3CCP1           0x08
1641 #define _T3CON_T3CKPS0          0x10
1642 #define _T3CON_T3CKPS1          0x20
1643 #define _T3CON_T3CCP2           0x40
1644 #define _T3CON_RD16             0x80
1645 
1646 //==============================================================================
1647 
1648 extern __at(0x0FB2) __sfr TMR3;
1649 extern __at(0x0FB2) __sfr TMR3L;
1650 extern __at(0x0FB3) __sfr TMR3H;
1651 
1652 //==============================================================================
1653 //        CMCON Bits
1654 
1655 extern __at(0x0FB4) __sfr CMCON;
1656 
1657 typedef union
1658   {
1659   struct
1660     {
1661     unsigned CM0                : 1;
1662     unsigned CM1                : 1;
1663     unsigned CM2                : 1;
1664     unsigned CIS                : 1;
1665     unsigned C1INV              : 1;
1666     unsigned C2INV              : 1;
1667     unsigned C1OUT              : 1;
1668     unsigned C2OUT              : 1;
1669     };
1670 
1671   struct
1672     {
1673     unsigned CM                 : 3;
1674     unsigned                    : 5;
1675     };
1676   } __CMCONbits_t;
1677 
1678 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1679 
1680 #define _CM0                    0x01
1681 #define _CM1                    0x02
1682 #define _CM2                    0x04
1683 #define _CIS                    0x08
1684 #define _C1INV                  0x10
1685 #define _C2INV                  0x20
1686 #define _C1OUT                  0x40
1687 #define _C2OUT                  0x80
1688 
1689 //==============================================================================
1690 
1691 
1692 //==============================================================================
1693 //        CVRCON Bits
1694 
1695 extern __at(0x0FB5) __sfr CVRCON;
1696 
1697 typedef union
1698   {
1699   struct
1700     {
1701     unsigned CVR0               : 1;
1702     unsigned CVR1               : 1;
1703     unsigned CVR2               : 1;
1704     unsigned CVR3               : 1;
1705     unsigned CVRSS              : 1;
1706     unsigned CVRR               : 1;
1707     unsigned CVROE              : 1;
1708     unsigned CVREN              : 1;
1709     };
1710 
1711   struct
1712     {
1713     unsigned CVR                : 4;
1714     unsigned                    : 4;
1715     };
1716   } __CVRCONbits_t;
1717 
1718 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1719 
1720 #define _CVR0                   0x01
1721 #define _CVR1                   0x02
1722 #define _CVR2                   0x04
1723 #define _CVR3                   0x08
1724 #define _CVRSS                  0x10
1725 #define _CVRR                   0x20
1726 #define _CVROE                  0x40
1727 #define _CVREN                  0x80
1728 
1729 //==============================================================================
1730 
1731 
1732 //==============================================================================
1733 //        ECCP1AS Bits
1734 
1735 extern __at(0x0FB6) __sfr ECCP1AS;
1736 
1737 typedef union
1738   {
1739   struct
1740     {
1741     unsigned PSSBD0             : 1;
1742     unsigned PSSBD1             : 1;
1743     unsigned PSSAC0             : 1;
1744     unsigned PSSAC1             : 1;
1745     unsigned ECCPAS0            : 1;
1746     unsigned ECCPAS1            : 1;
1747     unsigned ECCPAS2            : 1;
1748     unsigned ECCPASE            : 1;
1749     };
1750 
1751   struct
1752     {
1753     unsigned PSSBD              : 2;
1754     unsigned                    : 6;
1755     };
1756 
1757   struct
1758     {
1759     unsigned                    : 2;
1760     unsigned PSSAC              : 2;
1761     unsigned                    : 4;
1762     };
1763 
1764   struct
1765     {
1766     unsigned                    : 4;
1767     unsigned ECCPAS             : 3;
1768     unsigned                    : 1;
1769     };
1770   } __ECCP1ASbits_t;
1771 
1772 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1773 
1774 #define _PSSBD0                 0x01
1775 #define _PSSBD1                 0x02
1776 #define _PSSAC0                 0x04
1777 #define _PSSAC1                 0x08
1778 #define _ECCPAS0                0x10
1779 #define _ECCPAS1                0x20
1780 #define _ECCPAS2                0x40
1781 #define _ECCPASE                0x80
1782 
1783 //==============================================================================
1784 
1785 
1786 //==============================================================================
1787 //        ECCPAS Bits
1788 
1789 extern __at(0x0FB6) __sfr ECCPAS;
1790 
1791 typedef union
1792   {
1793   struct
1794     {
1795     unsigned PSSBD0             : 1;
1796     unsigned PSSBD1             : 1;
1797     unsigned PSSAC0             : 1;
1798     unsigned PSSAC1             : 1;
1799     unsigned ECCPAS0            : 1;
1800     unsigned ECCPAS1            : 1;
1801     unsigned ECCPAS2            : 1;
1802     unsigned ECCPASE            : 1;
1803     };
1804 
1805   struct
1806     {
1807     unsigned PSSBD              : 2;
1808     unsigned                    : 6;
1809     };
1810 
1811   struct
1812     {
1813     unsigned                    : 2;
1814     unsigned PSSAC              : 2;
1815     unsigned                    : 4;
1816     };
1817 
1818   struct
1819     {
1820     unsigned                    : 4;
1821     unsigned ECCPAS             : 3;
1822     unsigned                    : 1;
1823     };
1824   } __ECCPASbits_t;
1825 
1826 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1827 
1828 #define _ECCPAS_PSSBD0          0x01
1829 #define _ECCPAS_PSSBD1          0x02
1830 #define _ECCPAS_PSSAC0          0x04
1831 #define _ECCPAS_PSSAC1          0x08
1832 #define _ECCPAS_ECCPAS0         0x10
1833 #define _ECCPAS_ECCPAS1         0x20
1834 #define _ECCPAS_ECCPAS2         0x40
1835 #define _ECCPAS_ECCPASE         0x80
1836 
1837 //==============================================================================
1838 
1839 
1840 //==============================================================================
1841 //        ECCP1DEL Bits
1842 
1843 extern __at(0x0FB7) __sfr ECCP1DEL;
1844 
1845 typedef union
1846   {
1847   struct
1848     {
1849     unsigned PDC0               : 1;
1850     unsigned PDC1               : 1;
1851     unsigned PDC2               : 1;
1852     unsigned PDC3               : 1;
1853     unsigned PDC4               : 1;
1854     unsigned PDC5               : 1;
1855     unsigned PDC6               : 1;
1856     unsigned PRSEN              : 1;
1857     };
1858 
1859   struct
1860     {
1861     unsigned PDC                : 7;
1862     unsigned                    : 1;
1863     };
1864   } __ECCP1DELbits_t;
1865 
1866 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1867 
1868 #define _PDC0                   0x01
1869 #define _PDC1                   0x02
1870 #define _PDC2                   0x04
1871 #define _PDC3                   0x08
1872 #define _PDC4                   0x10
1873 #define _PDC5                   0x20
1874 #define _PDC6                   0x40
1875 #define _PRSEN                  0x80
1876 
1877 //==============================================================================
1878 
1879 
1880 //==============================================================================
1881 //        PWM1CON Bits
1882 
1883 extern __at(0x0FB7) __sfr PWM1CON;
1884 
1885 typedef union
1886   {
1887   struct
1888     {
1889     unsigned PDC0               : 1;
1890     unsigned PDC1               : 1;
1891     unsigned PDC2               : 1;
1892     unsigned PDC3               : 1;
1893     unsigned PDC4               : 1;
1894     unsigned PDC5               : 1;
1895     unsigned PDC6               : 1;
1896     unsigned PRSEN              : 1;
1897     };
1898 
1899   struct
1900     {
1901     unsigned PDC                : 7;
1902     unsigned                    : 1;
1903     };
1904   } __PWM1CONbits_t;
1905 
1906 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1907 
1908 #define _PWM1CON_PDC0           0x01
1909 #define _PWM1CON_PDC1           0x02
1910 #define _PWM1CON_PDC2           0x04
1911 #define _PWM1CON_PDC3           0x08
1912 #define _PWM1CON_PDC4           0x10
1913 #define _PWM1CON_PDC5           0x20
1914 #define _PWM1CON_PDC6           0x40
1915 #define _PWM1CON_PRSEN          0x80
1916 
1917 //==============================================================================
1918 
1919 
1920 //==============================================================================
1921 //        BAUDCON Bits
1922 
1923 extern __at(0x0FB8) __sfr BAUDCON;
1924 
1925 typedef union
1926   {
1927   struct
1928     {
1929     unsigned ABDEN              : 1;
1930     unsigned WUE                : 1;
1931     unsigned                    : 1;
1932     unsigned BRG16              : 1;
1933     unsigned TXCKP              : 1;
1934     unsigned RXDTP              : 1;
1935     unsigned RCIDL              : 1;
1936     unsigned ABDOVF             : 1;
1937     };
1938 
1939   struct
1940     {
1941     unsigned                    : 1;
1942     unsigned                    : 1;
1943     unsigned                    : 1;
1944     unsigned                    : 1;
1945     unsigned SCKP               : 1;
1946     unsigned                    : 1;
1947     unsigned RCMT               : 1;
1948     unsigned                    : 1;
1949     };
1950   } __BAUDCONbits_t;
1951 
1952 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1953 
1954 #define _ABDEN                  0x01
1955 #define _WUE                    0x02
1956 #define _BRG16                  0x08
1957 #define _TXCKP                  0x10
1958 #define _SCKP                   0x10
1959 #define _RXDTP                  0x20
1960 #define _RCIDL                  0x40
1961 #define _RCMT                   0x40
1962 #define _ABDOVF                 0x80
1963 
1964 //==============================================================================
1965 
1966 
1967 //==============================================================================
1968 //        BAUDCTL Bits
1969 
1970 extern __at(0x0FB8) __sfr BAUDCTL;
1971 
1972 typedef union
1973   {
1974   struct
1975     {
1976     unsigned ABDEN              : 1;
1977     unsigned WUE                : 1;
1978     unsigned                    : 1;
1979     unsigned BRG16              : 1;
1980     unsigned TXCKP              : 1;
1981     unsigned RXDTP              : 1;
1982     unsigned RCIDL              : 1;
1983     unsigned ABDOVF             : 1;
1984     };
1985 
1986   struct
1987     {
1988     unsigned                    : 1;
1989     unsigned                    : 1;
1990     unsigned                    : 1;
1991     unsigned                    : 1;
1992     unsigned SCKP               : 1;
1993     unsigned                    : 1;
1994     unsigned RCMT               : 1;
1995     unsigned                    : 1;
1996     };
1997   } __BAUDCTLbits_t;
1998 
1999 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
2000 
2001 #define _BAUDCTL_ABDEN          0x01
2002 #define _BAUDCTL_WUE            0x02
2003 #define _BAUDCTL_BRG16          0x08
2004 #define _BAUDCTL_TXCKP          0x10
2005 #define _BAUDCTL_SCKP           0x10
2006 #define _BAUDCTL_RXDTP          0x20
2007 #define _BAUDCTL_RCIDL          0x40
2008 #define _BAUDCTL_RCMT           0x40
2009 #define _BAUDCTL_ABDOVF         0x80
2010 
2011 //==============================================================================
2012 
2013 
2014 //==============================================================================
2015 //        CCP2CON Bits
2016 
2017 extern __at(0x0FBA) __sfr CCP2CON;
2018 
2019 typedef union
2020   {
2021   struct
2022     {
2023     unsigned CCP2M0             : 1;
2024     unsigned CCP2M1             : 1;
2025     unsigned CCP2M2             : 1;
2026     unsigned CCP2M3             : 1;
2027     unsigned CCP2Y              : 1;
2028     unsigned CCP2X              : 1;
2029     unsigned                    : 1;
2030     unsigned                    : 1;
2031     };
2032 
2033   struct
2034     {
2035     unsigned                    : 1;
2036     unsigned                    : 1;
2037     unsigned                    : 1;
2038     unsigned                    : 1;
2039     unsigned DC2B0              : 1;
2040     unsigned DC2B1              : 1;
2041     unsigned                    : 1;
2042     unsigned                    : 1;
2043     };
2044 
2045   struct
2046     {
2047     unsigned CCP2M              : 4;
2048     unsigned                    : 4;
2049     };
2050 
2051   struct
2052     {
2053     unsigned                    : 4;
2054     unsigned DC2B               : 2;
2055     unsigned                    : 2;
2056     };
2057   } __CCP2CONbits_t;
2058 
2059 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
2060 
2061 #define _CCP2M0                 0x01
2062 #define _CCP2M1                 0x02
2063 #define _CCP2M2                 0x04
2064 #define _CCP2M3                 0x08
2065 #define _CCP2Y                  0x10
2066 #define _DC2B0                  0x10
2067 #define _CCP2X                  0x20
2068 #define _DC2B1                  0x20
2069 
2070 //==============================================================================
2071 
2072 extern __at(0x0FBB) __sfr CCPR2;
2073 extern __at(0x0FBB) __sfr CCPR2L;
2074 extern __at(0x0FBC) __sfr CCPR2H;
2075 
2076 //==============================================================================
2077 //        CCP1CON Bits
2078 
2079 extern __at(0x0FBD) __sfr CCP1CON;
2080 
2081 typedef union
2082   {
2083   struct
2084     {
2085     unsigned CCP1M0             : 1;
2086     unsigned CCP1M1             : 1;
2087     unsigned CCP1M2             : 1;
2088     unsigned CCP1M3             : 1;
2089     unsigned CCP1Y              : 1;
2090     unsigned CCP1X              : 1;
2091     unsigned P1M0               : 1;
2092     unsigned P1M1               : 1;
2093     };
2094 
2095   struct
2096     {
2097     unsigned                    : 1;
2098     unsigned                    : 1;
2099     unsigned                    : 1;
2100     unsigned                    : 1;
2101     unsigned DC1B0              : 1;
2102     unsigned DC1B1              : 1;
2103     unsigned                    : 1;
2104     unsigned                    : 1;
2105     };
2106 
2107   struct
2108     {
2109     unsigned CCP1M              : 4;
2110     unsigned                    : 4;
2111     };
2112 
2113   struct
2114     {
2115     unsigned                    : 4;
2116     unsigned DC1B               : 2;
2117     unsigned                    : 2;
2118     };
2119 
2120   struct
2121     {
2122     unsigned                    : 6;
2123     unsigned P1M                : 2;
2124     };
2125   } __CCP1CONbits_t;
2126 
2127 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2128 
2129 #define _CCP1M0                 0x01
2130 #define _CCP1M1                 0x02
2131 #define _CCP1M2                 0x04
2132 #define _CCP1M3                 0x08
2133 #define _CCP1Y                  0x10
2134 #define _DC1B0                  0x10
2135 #define _CCP1X                  0x20
2136 #define _DC1B1                  0x20
2137 #define _P1M0                   0x40
2138 #define _P1M1                   0x80
2139 
2140 //==============================================================================
2141 
2142 extern __at(0x0FBE) __sfr CCPR1;
2143 extern __at(0x0FBE) __sfr CCPR1L;
2144 extern __at(0x0FBF) __sfr CCPR1H;
2145 
2146 //==============================================================================
2147 //        ADCON2 Bits
2148 
2149 extern __at(0x0FC0) __sfr ADCON2;
2150 
2151 typedef union
2152   {
2153   struct
2154     {
2155     unsigned ADCS0              : 1;
2156     unsigned ADCS1              : 1;
2157     unsigned ADCS2              : 1;
2158     unsigned ACQT0              : 1;
2159     unsigned ACQT1              : 1;
2160     unsigned ACQT2              : 1;
2161     unsigned                    : 1;
2162     unsigned ADFM               : 1;
2163     };
2164 
2165   struct
2166     {
2167     unsigned ADCS               : 3;
2168     unsigned                    : 5;
2169     };
2170 
2171   struct
2172     {
2173     unsigned                    : 3;
2174     unsigned ACQT               : 3;
2175     unsigned                    : 2;
2176     };
2177   } __ADCON2bits_t;
2178 
2179 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2180 
2181 #define _ADCS0                  0x01
2182 #define _ADCS1                  0x02
2183 #define _ADCS2                  0x04
2184 #define _ACQT0                  0x08
2185 #define _ACQT1                  0x10
2186 #define _ACQT2                  0x20
2187 #define _ADFM                   0x80
2188 
2189 //==============================================================================
2190 
2191 
2192 //==============================================================================
2193 //        ADCON1 Bits
2194 
2195 extern __at(0x0FC1) __sfr ADCON1;
2196 
2197 typedef union
2198   {
2199   struct
2200     {
2201     unsigned PCFG0              : 1;
2202     unsigned PCFG1              : 1;
2203     unsigned PCFG2              : 1;
2204     unsigned PCFG3              : 1;
2205     unsigned VCFG0              : 1;
2206     unsigned VCFG1              : 1;
2207     unsigned                    : 1;
2208     unsigned                    : 1;
2209     };
2210 
2211   struct
2212     {
2213     unsigned PCFG               : 4;
2214     unsigned                    : 4;
2215     };
2216 
2217   struct
2218     {
2219     unsigned                    : 4;
2220     unsigned VCFG               : 2;
2221     unsigned                    : 2;
2222     };
2223   } __ADCON1bits_t;
2224 
2225 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2226 
2227 #define _PCFG0                  0x01
2228 #define _PCFG1                  0x02
2229 #define _PCFG2                  0x04
2230 #define _PCFG3                  0x08
2231 #define _VCFG0                  0x10
2232 #define _VCFG1                  0x20
2233 
2234 //==============================================================================
2235 
2236 
2237 //==============================================================================
2238 //        ADCON0 Bits
2239 
2240 extern __at(0x0FC2) __sfr ADCON0;
2241 
2242 typedef union
2243   {
2244   struct
2245     {
2246     unsigned ADON               : 1;
2247     unsigned GO_NOT_DONE        : 1;
2248     unsigned CHS0               : 1;
2249     unsigned CHS1               : 1;
2250     unsigned CHS2               : 1;
2251     unsigned CHS3               : 1;
2252     unsigned                    : 1;
2253     unsigned                    : 1;
2254     };
2255 
2256   struct
2257     {
2258     unsigned                    : 1;
2259     unsigned GO                 : 1;
2260     unsigned                    : 1;
2261     unsigned                    : 1;
2262     unsigned                    : 1;
2263     unsigned                    : 1;
2264     unsigned                    : 1;
2265     unsigned                    : 1;
2266     };
2267 
2268   struct
2269     {
2270     unsigned                    : 1;
2271     unsigned DONE               : 1;
2272     unsigned                    : 1;
2273     unsigned                    : 1;
2274     unsigned                    : 1;
2275     unsigned                    : 1;
2276     unsigned                    : 1;
2277     unsigned                    : 1;
2278     };
2279 
2280   struct
2281     {
2282     unsigned                    : 1;
2283     unsigned NOT_DONE           : 1;
2284     unsigned                    : 1;
2285     unsigned                    : 1;
2286     unsigned                    : 1;
2287     unsigned                    : 1;
2288     unsigned                    : 1;
2289     unsigned                    : 1;
2290     };
2291 
2292   struct
2293     {
2294     unsigned                    : 1;
2295     unsigned GO_DONE            : 1;
2296     unsigned                    : 1;
2297     unsigned                    : 1;
2298     unsigned                    : 1;
2299     unsigned                    : 1;
2300     unsigned                    : 1;
2301     unsigned                    : 1;
2302     };
2303 
2304   struct
2305     {
2306     unsigned                    : 2;
2307     unsigned CHS                : 4;
2308     unsigned                    : 2;
2309     };
2310   } __ADCON0bits_t;
2311 
2312 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2313 
2314 #define _ADON                   0x01
2315 #define _GO_NOT_DONE            0x02
2316 #define _GO                     0x02
2317 #define _DONE                   0x02
2318 #define _NOT_DONE               0x02
2319 #define _GO_DONE                0x02
2320 #define _CHS0                   0x04
2321 #define _CHS1                   0x08
2322 #define _CHS2                   0x10
2323 #define _CHS3                   0x20
2324 
2325 //==============================================================================
2326 
2327 extern __at(0x0FC3) __sfr ADRES;
2328 extern __at(0x0FC3) __sfr ADRESL;
2329 extern __at(0x0FC4) __sfr ADRESH;
2330 
2331 //==============================================================================
2332 //        SSPCON2 Bits
2333 
2334 extern __at(0x0FC5) __sfr SSPCON2;
2335 
2336 typedef union
2337   {
2338   struct
2339     {
2340     unsigned SEN                : 1;
2341     unsigned RSEN               : 1;
2342     unsigned PEN                : 1;
2343     unsigned RCEN               : 1;
2344     unsigned ACKEN              : 1;
2345     unsigned ACKDT              : 1;
2346     unsigned ACKSTAT            : 1;
2347     unsigned GCEN               : 1;
2348     };
2349 
2350   struct
2351     {
2352     unsigned                    : 1;
2353     unsigned ADMSK1             : 1;
2354     unsigned ADMSK2             : 1;
2355     unsigned ADMSK3             : 1;
2356     unsigned ADMSK4             : 1;
2357     unsigned ADMSK5             : 1;
2358     unsigned                    : 1;
2359     unsigned                    : 1;
2360     };
2361   } __SSPCON2bits_t;
2362 
2363 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2364 
2365 #define _SEN                    0x01
2366 #define _RSEN                   0x02
2367 #define _ADMSK1                 0x02
2368 #define _PEN                    0x04
2369 #define _ADMSK2                 0x04
2370 #define _RCEN                   0x08
2371 #define _ADMSK3                 0x08
2372 #define _ACKEN                  0x10
2373 #define _ADMSK4                 0x10
2374 #define _ACKDT                  0x20
2375 #define _ADMSK5                 0x20
2376 #define _ACKSTAT                0x40
2377 #define _GCEN                   0x80
2378 
2379 //==============================================================================
2380 
2381 
2382 //==============================================================================
2383 //        SSPCON1 Bits
2384 
2385 extern __at(0x0FC6) __sfr SSPCON1;
2386 
2387 typedef union
2388   {
2389   struct
2390     {
2391     unsigned SSPM0              : 1;
2392     unsigned SSPM1              : 1;
2393     unsigned SSPM2              : 1;
2394     unsigned SSPM3              : 1;
2395     unsigned CKP                : 1;
2396     unsigned SSPEN              : 1;
2397     unsigned SSPOV              : 1;
2398     unsigned WCOL               : 1;
2399     };
2400 
2401   struct
2402     {
2403     unsigned SSPM               : 4;
2404     unsigned                    : 4;
2405     };
2406   } __SSPCON1bits_t;
2407 
2408 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2409 
2410 #define _SSPM0                  0x01
2411 #define _SSPM1                  0x02
2412 #define _SSPM2                  0x04
2413 #define _SSPM3                  0x08
2414 #define _CKP                    0x10
2415 #define _SSPEN                  0x20
2416 #define _SSPOV                  0x40
2417 #define _WCOL                   0x80
2418 
2419 //==============================================================================
2420 
2421 
2422 //==============================================================================
2423 //        SSPSTAT Bits
2424 
2425 extern __at(0x0FC7) __sfr SSPSTAT;
2426 
2427 typedef union
2428   {
2429   struct
2430     {
2431     unsigned BF                 : 1;
2432     unsigned UA                 : 1;
2433     unsigned R_NOT_W            : 1;
2434     unsigned S                  : 1;
2435     unsigned P                  : 1;
2436     unsigned D_NOT_A            : 1;
2437     unsigned CKE                : 1;
2438     unsigned SMP                : 1;
2439     };
2440 
2441   struct
2442     {
2443     unsigned                    : 1;
2444     unsigned                    : 1;
2445     unsigned R                  : 1;
2446     unsigned                    : 1;
2447     unsigned                    : 1;
2448     unsigned D                  : 1;
2449     unsigned                    : 1;
2450     unsigned                    : 1;
2451     };
2452 
2453   struct
2454     {
2455     unsigned                    : 1;
2456     unsigned                    : 1;
2457     unsigned NOT_W              : 1;
2458     unsigned                    : 1;
2459     unsigned                    : 1;
2460     unsigned NOT_A              : 1;
2461     unsigned                    : 1;
2462     unsigned                    : 1;
2463     };
2464 
2465   struct
2466     {
2467     unsigned                    : 1;
2468     unsigned                    : 1;
2469     unsigned R_W                : 1;
2470     unsigned                    : 1;
2471     unsigned                    : 1;
2472     unsigned D_A                : 1;
2473     unsigned                    : 1;
2474     unsigned                    : 1;
2475     };
2476 
2477   struct
2478     {
2479     unsigned                    : 1;
2480     unsigned                    : 1;
2481     unsigned NOT_WRITE          : 1;
2482     unsigned                    : 1;
2483     unsigned                    : 1;
2484     unsigned NOT_ADDRESS        : 1;
2485     unsigned                    : 1;
2486     unsigned                    : 1;
2487     };
2488   } __SSPSTATbits_t;
2489 
2490 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2491 
2492 #define _BF                     0x01
2493 #define _UA                     0x02
2494 #define _R_NOT_W                0x04
2495 #define _R                      0x04
2496 #define _NOT_W                  0x04
2497 #define _R_W                    0x04
2498 #define _NOT_WRITE              0x04
2499 #define _S                      0x08
2500 #define _P                      0x10
2501 #define _D_NOT_A                0x20
2502 #define _D                      0x20
2503 #define _NOT_A                  0x20
2504 #define _D_A                    0x20
2505 #define _NOT_ADDRESS            0x20
2506 #define _CKE                    0x40
2507 #define _SMP                    0x80
2508 
2509 //==============================================================================
2510 
2511 extern __at(0x0FC8) __sfr SSPADD;
2512 extern __at(0x0FC9) __sfr SSPBUF;
2513 
2514 //==============================================================================
2515 //        T2CON Bits
2516 
2517 extern __at(0x0FCA) __sfr T2CON;
2518 
2519 typedef union
2520   {
2521   struct
2522     {
2523     unsigned T2CKPS0            : 1;
2524     unsigned T2CKPS1            : 1;
2525     unsigned TMR2ON             : 1;
2526     unsigned T2OUTPS0           : 1;
2527     unsigned T2OUTPS1           : 1;
2528     unsigned T2OUTPS2           : 1;
2529     unsigned T2OUTPS3           : 1;
2530     unsigned                    : 1;
2531     };
2532 
2533   struct
2534     {
2535     unsigned                    : 1;
2536     unsigned                    : 1;
2537     unsigned                    : 1;
2538     unsigned TOUTPS0            : 1;
2539     unsigned TOUTPS1            : 1;
2540     unsigned TOUTPS2            : 1;
2541     unsigned TOUTPS3            : 1;
2542     unsigned                    : 1;
2543     };
2544 
2545   struct
2546     {
2547     unsigned T2CKPS             : 2;
2548     unsigned                    : 6;
2549     };
2550 
2551   struct
2552     {
2553     unsigned                    : 3;
2554     unsigned T2OUTPS            : 4;
2555     unsigned                    : 1;
2556     };
2557 
2558   struct
2559     {
2560     unsigned                    : 3;
2561     unsigned TOUTPS             : 4;
2562     unsigned                    : 1;
2563     };
2564   } __T2CONbits_t;
2565 
2566 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2567 
2568 #define _T2CKPS0                0x01
2569 #define _T2CKPS1                0x02
2570 #define _TMR2ON                 0x04
2571 #define _T2OUTPS0               0x08
2572 #define _TOUTPS0                0x08
2573 #define _T2OUTPS1               0x10
2574 #define _TOUTPS1                0x10
2575 #define _T2OUTPS2               0x20
2576 #define _TOUTPS2                0x20
2577 #define _T2OUTPS3               0x40
2578 #define _TOUTPS3                0x40
2579 
2580 //==============================================================================
2581 
2582 extern __at(0x0FCB) __sfr PR2;
2583 extern __at(0x0FCC) __sfr TMR2;
2584 
2585 //==============================================================================
2586 //        T1CON Bits
2587 
2588 extern __at(0x0FCD) __sfr T1CON;
2589 
2590 typedef union
2591   {
2592   struct
2593     {
2594     unsigned TMR1ON             : 1;
2595     unsigned TMR1CS             : 1;
2596     unsigned NOT_T1SYNC         : 1;
2597     unsigned T1OSCEN            : 1;
2598     unsigned T1CKPS0            : 1;
2599     unsigned T1CKPS1            : 1;
2600     unsigned T1RUN              : 1;
2601     unsigned RD16               : 1;
2602     };
2603 
2604   struct
2605     {
2606     unsigned                    : 1;
2607     unsigned                    : 1;
2608     unsigned T1SYNC             : 1;
2609     unsigned                    : 1;
2610     unsigned                    : 1;
2611     unsigned                    : 1;
2612     unsigned                    : 1;
2613     unsigned                    : 1;
2614     };
2615 
2616   struct
2617     {
2618     unsigned                    : 4;
2619     unsigned T1CKPS             : 2;
2620     unsigned                    : 2;
2621     };
2622   } __T1CONbits_t;
2623 
2624 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2625 
2626 #define _TMR1ON                 0x01
2627 #define _TMR1CS                 0x02
2628 #define _NOT_T1SYNC             0x04
2629 #define _T1SYNC                 0x04
2630 #define _T1OSCEN                0x08
2631 #define _T1CKPS0                0x10
2632 #define _T1CKPS1                0x20
2633 #define _T1RUN                  0x40
2634 #define _RD16                   0x80
2635 
2636 //==============================================================================
2637 
2638 extern __at(0x0FCE) __sfr TMR1;
2639 extern __at(0x0FCE) __sfr TMR1L;
2640 extern __at(0x0FCF) __sfr TMR1H;
2641 
2642 //==============================================================================
2643 //        RCON Bits
2644 
2645 extern __at(0x0FD0) __sfr RCON;
2646 
2647 typedef union
2648   {
2649   struct
2650     {
2651     unsigned NOT_BOR            : 1;
2652     unsigned NOT_POR            : 1;
2653     unsigned NOT_PD             : 1;
2654     unsigned NOT_TO             : 1;
2655     unsigned NOT_RI             : 1;
2656     unsigned                    : 1;
2657     unsigned SBOREN             : 1;
2658     unsigned IPEN               : 1;
2659     };
2660 
2661   struct
2662     {
2663     unsigned BOR                : 1;
2664     unsigned POR                : 1;
2665     unsigned PD                 : 1;
2666     unsigned TO                 : 1;
2667     unsigned RI                 : 1;
2668     unsigned                    : 1;
2669     unsigned                    : 1;
2670     unsigned                    : 1;
2671     };
2672   } __RCONbits_t;
2673 
2674 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2675 
2676 #define _NOT_BOR                0x01
2677 #define _BOR                    0x01
2678 #define _NOT_POR                0x02
2679 #define _POR                    0x02
2680 #define _NOT_PD                 0x04
2681 #define _PD                     0x04
2682 #define _NOT_TO                 0x08
2683 #define _TO                     0x08
2684 #define _NOT_RI                 0x10
2685 #define _RI                     0x10
2686 #define _SBOREN                 0x40
2687 #define _IPEN                   0x80
2688 
2689 //==============================================================================
2690 
2691 
2692 //==============================================================================
2693 //        WDTCON Bits
2694 
2695 extern __at(0x0FD1) __sfr WDTCON;
2696 
2697 typedef union
2698   {
2699   struct
2700     {
2701     unsigned SWDTEN             : 1;
2702     unsigned                    : 1;
2703     unsigned                    : 1;
2704     unsigned                    : 1;
2705     unsigned                    : 1;
2706     unsigned                    : 1;
2707     unsigned                    : 1;
2708     unsigned                    : 1;
2709     };
2710 
2711   struct
2712     {
2713     unsigned SWDTE              : 1;
2714     unsigned                    : 1;
2715     unsigned                    : 1;
2716     unsigned                    : 1;
2717     unsigned                    : 1;
2718     unsigned                    : 1;
2719     unsigned                    : 1;
2720     unsigned                    : 1;
2721     };
2722   } __WDTCONbits_t;
2723 
2724 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2725 
2726 #define _SWDTEN                 0x01
2727 #define _SWDTE                  0x01
2728 
2729 //==============================================================================
2730 
2731 
2732 //==============================================================================
2733 //        HLVDCON Bits
2734 
2735 extern __at(0x0FD2) __sfr HLVDCON;
2736 
2737 typedef union
2738   {
2739   struct
2740     {
2741     unsigned HLVDL0             : 1;
2742     unsigned HLVDL1             : 1;
2743     unsigned HLVDL2             : 1;
2744     unsigned HLVDL3             : 1;
2745     unsigned HLVDEN             : 1;
2746     unsigned IVRST              : 1;
2747     unsigned                    : 1;
2748     unsigned VDIRMAG            : 1;
2749     };
2750 
2751   struct
2752     {
2753     unsigned LVDL0              : 1;
2754     unsigned LVDL1              : 1;
2755     unsigned LVDL2              : 1;
2756     unsigned LVDL3              : 1;
2757     unsigned LVDEN              : 1;
2758     unsigned IRVST              : 1;
2759     unsigned                    : 1;
2760     unsigned                    : 1;
2761     };
2762 
2763   struct
2764     {
2765     unsigned LVV0               : 1;
2766     unsigned LVV1               : 1;
2767     unsigned LVV2               : 1;
2768     unsigned LVV3               : 1;
2769     unsigned                    : 1;
2770     unsigned BGST               : 1;
2771     unsigned                    : 1;
2772     unsigned                    : 1;
2773     };
2774 
2775   struct
2776     {
2777     unsigned LVDL               : 4;
2778     unsigned                    : 4;
2779     };
2780 
2781   struct
2782     {
2783     unsigned HLVDL              : 4;
2784     unsigned                    : 4;
2785     };
2786 
2787   struct
2788     {
2789     unsigned LVV                : 4;
2790     unsigned                    : 4;
2791     };
2792   } __HLVDCONbits_t;
2793 
2794 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2795 
2796 #define _HLVDL0                 0x01
2797 #define _LVDL0                  0x01
2798 #define _LVV0                   0x01
2799 #define _HLVDL1                 0x02
2800 #define _LVDL1                  0x02
2801 #define _LVV1                   0x02
2802 #define _HLVDL2                 0x04
2803 #define _LVDL2                  0x04
2804 #define _LVV2                   0x04
2805 #define _HLVDL3                 0x08
2806 #define _LVDL3                  0x08
2807 #define _LVV3                   0x08
2808 #define _HLVDEN                 0x10
2809 #define _LVDEN                  0x10
2810 #define _IVRST                  0x20
2811 #define _IRVST                  0x20
2812 #define _BGST                   0x20
2813 #define _VDIRMAG                0x80
2814 
2815 //==============================================================================
2816 
2817 
2818 //==============================================================================
2819 //        LVDCON Bits
2820 
2821 extern __at(0x0FD2) __sfr LVDCON;
2822 
2823 typedef union
2824   {
2825   struct
2826     {
2827     unsigned HLVDL0             : 1;
2828     unsigned HLVDL1             : 1;
2829     unsigned HLVDL2             : 1;
2830     unsigned HLVDL3             : 1;
2831     unsigned HLVDEN             : 1;
2832     unsigned IVRST              : 1;
2833     unsigned                    : 1;
2834     unsigned VDIRMAG            : 1;
2835     };
2836 
2837   struct
2838     {
2839     unsigned LVDL0              : 1;
2840     unsigned LVDL1              : 1;
2841     unsigned LVDL2              : 1;
2842     unsigned LVDL3              : 1;
2843     unsigned LVDEN              : 1;
2844     unsigned IRVST              : 1;
2845     unsigned                    : 1;
2846     unsigned                    : 1;
2847     };
2848 
2849   struct
2850     {
2851     unsigned LVV0               : 1;
2852     unsigned LVV1               : 1;
2853     unsigned LVV2               : 1;
2854     unsigned LVV3               : 1;
2855     unsigned                    : 1;
2856     unsigned BGST               : 1;
2857     unsigned                    : 1;
2858     unsigned                    : 1;
2859     };
2860 
2861   struct
2862     {
2863     unsigned LVDL               : 4;
2864     unsigned                    : 4;
2865     };
2866 
2867   struct
2868     {
2869     unsigned LVV                : 4;
2870     unsigned                    : 4;
2871     };
2872 
2873   struct
2874     {
2875     unsigned HLVDL              : 4;
2876     unsigned                    : 4;
2877     };
2878   } __LVDCONbits_t;
2879 
2880 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2881 
2882 #define _LVDCON_HLVDL0          0x01
2883 #define _LVDCON_LVDL0           0x01
2884 #define _LVDCON_LVV0            0x01
2885 #define _LVDCON_HLVDL1          0x02
2886 #define _LVDCON_LVDL1           0x02
2887 #define _LVDCON_LVV1            0x02
2888 #define _LVDCON_HLVDL2          0x04
2889 #define _LVDCON_LVDL2           0x04
2890 #define _LVDCON_LVV2            0x04
2891 #define _LVDCON_HLVDL3          0x08
2892 #define _LVDCON_LVDL3           0x08
2893 #define _LVDCON_LVV3            0x08
2894 #define _LVDCON_HLVDEN          0x10
2895 #define _LVDCON_LVDEN           0x10
2896 #define _LVDCON_IVRST           0x20
2897 #define _LVDCON_IRVST           0x20
2898 #define _LVDCON_BGST            0x20
2899 #define _LVDCON_VDIRMAG         0x80
2900 
2901 //==============================================================================
2902 
2903 
2904 //==============================================================================
2905 //        OSCCON Bits
2906 
2907 extern __at(0x0FD3) __sfr OSCCON;
2908 
2909 typedef union
2910   {
2911   struct
2912     {
2913     unsigned SCS0               : 1;
2914     unsigned SCS1               : 1;
2915     unsigned IOFS               : 1;
2916     unsigned OSTS               : 1;
2917     unsigned IRCF0              : 1;
2918     unsigned IRCF1              : 1;
2919     unsigned IRCF2              : 1;
2920     unsigned IDLEN              : 1;
2921     };
2922 
2923   struct
2924     {
2925     unsigned                    : 1;
2926     unsigned                    : 1;
2927     unsigned FLTS               : 1;
2928     unsigned                    : 1;
2929     unsigned                    : 1;
2930     unsigned                    : 1;
2931     unsigned                    : 1;
2932     unsigned                    : 1;
2933     };
2934 
2935   struct
2936     {
2937     unsigned SCS                : 2;
2938     unsigned                    : 6;
2939     };
2940 
2941   struct
2942     {
2943     unsigned                    : 4;
2944     unsigned IRCF               : 3;
2945     unsigned                    : 1;
2946     };
2947   } __OSCCONbits_t;
2948 
2949 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2950 
2951 #define _SCS0                   0x01
2952 #define _SCS1                   0x02
2953 #define _IOFS                   0x04
2954 #define _FLTS                   0x04
2955 #define _OSTS                   0x08
2956 #define _IRCF0                  0x10
2957 #define _IRCF1                  0x20
2958 #define _IRCF2                  0x40
2959 #define _IDLEN                  0x80
2960 
2961 //==============================================================================
2962 
2963 
2964 //==============================================================================
2965 //        T0CON Bits
2966 
2967 extern __at(0x0FD5) __sfr T0CON;
2968 
2969 typedef union
2970   {
2971   struct
2972     {
2973     unsigned T0PS0              : 1;
2974     unsigned T0PS1              : 1;
2975     unsigned T0PS2              : 1;
2976     unsigned PSA                : 1;
2977     unsigned T0SE               : 1;
2978     unsigned T0CS               : 1;
2979     unsigned T08BIT             : 1;
2980     unsigned TMR0ON             : 1;
2981     };
2982 
2983   struct
2984     {
2985     unsigned                    : 1;
2986     unsigned                    : 1;
2987     unsigned                    : 1;
2988     unsigned T0PS3              : 1;
2989     unsigned                    : 1;
2990     unsigned                    : 1;
2991     unsigned T016BIT            : 1;
2992     unsigned                    : 1;
2993     };
2994 
2995   struct
2996     {
2997     unsigned T0PS               : 4;
2998     unsigned                    : 4;
2999     };
3000   } __T0CONbits_t;
3001 
3002 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
3003 
3004 #define _T0PS0                  0x01
3005 #define _T0PS1                  0x02
3006 #define _T0PS2                  0x04
3007 #define _PSA                    0x08
3008 #define _T0PS3                  0x08
3009 #define _T0SE                   0x10
3010 #define _T0CS                   0x20
3011 #define _T08BIT                 0x40
3012 #define _T016BIT                0x40
3013 #define _TMR0ON                 0x80
3014 
3015 //==============================================================================
3016 
3017 extern __at(0x0FD6) __sfr TMR0;
3018 extern __at(0x0FD6) __sfr TMR0L;
3019 extern __at(0x0FD7) __sfr TMR0H;
3020 
3021 //==============================================================================
3022 //        STATUS Bits
3023 
3024 extern __at(0x0FD8) __sfr STATUS;
3025 
3026 typedef struct
3027   {
3028   unsigned C                    : 1;
3029   unsigned DC                   : 1;
3030   unsigned Z                    : 1;
3031   unsigned OV                   : 1;
3032   unsigned N                    : 1;
3033   unsigned                      : 1;
3034   unsigned                      : 1;
3035   unsigned                      : 1;
3036   } __STATUSbits_t;
3037 
3038 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
3039 
3040 #define _C                      0x01
3041 #define _DC                     0x02
3042 #define _Z                      0x04
3043 #define _OV                     0x08
3044 #define _N                      0x10
3045 
3046 //==============================================================================
3047 
3048 extern __at(0x0FD9) __sfr FSR2L;
3049 extern __at(0x0FDA) __sfr FSR2H;
3050 extern __at(0x0FDB) __sfr PLUSW2;
3051 extern __at(0x0FDC) __sfr PREINC2;
3052 extern __at(0x0FDD) __sfr POSTDEC2;
3053 extern __at(0x0FDE) __sfr POSTINC2;
3054 extern __at(0x0FDF) __sfr INDF2;
3055 extern __at(0x0FE0) __sfr BSR;
3056 extern __at(0x0FE1) __sfr FSR1L;
3057 extern __at(0x0FE2) __sfr FSR1H;
3058 extern __at(0x0FE3) __sfr PLUSW1;
3059 extern __at(0x0FE4) __sfr PREINC1;
3060 extern __at(0x0FE5) __sfr POSTDEC1;
3061 extern __at(0x0FE6) __sfr POSTINC1;
3062 extern __at(0x0FE7) __sfr INDF1;
3063 extern __at(0x0FE8) __sfr WREG;
3064 extern __at(0x0FE9) __sfr FSR0L;
3065 extern __at(0x0FEA) __sfr FSR0H;
3066 extern __at(0x0FEB) __sfr PLUSW0;
3067 extern __at(0x0FEC) __sfr PREINC0;
3068 extern __at(0x0FED) __sfr POSTDEC0;
3069 extern __at(0x0FEE) __sfr POSTINC0;
3070 extern __at(0x0FEF) __sfr INDF0;
3071 
3072 //==============================================================================
3073 //        INTCON3 Bits
3074 
3075 extern __at(0x0FF0) __sfr INTCON3;
3076 
3077 typedef union
3078   {
3079   struct
3080     {
3081     unsigned INT1IF             : 1;
3082     unsigned INT2IF             : 1;
3083     unsigned                    : 1;
3084     unsigned INT1IE             : 1;
3085     unsigned INT2IE             : 1;
3086     unsigned                    : 1;
3087     unsigned INT1IP             : 1;
3088     unsigned INT2IP             : 1;
3089     };
3090 
3091   struct
3092     {
3093     unsigned INT1F              : 1;
3094     unsigned INT2F              : 1;
3095     unsigned                    : 1;
3096     unsigned INT1E              : 1;
3097     unsigned INT2E              : 1;
3098     unsigned                    : 1;
3099     unsigned INT1P              : 1;
3100     unsigned INT2P              : 1;
3101     };
3102   } __INTCON3bits_t;
3103 
3104 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
3105 
3106 #define _INT1IF                 0x01
3107 #define _INT1F                  0x01
3108 #define _INT2IF                 0x02
3109 #define _INT2F                  0x02
3110 #define _INT1IE                 0x08
3111 #define _INT1E                  0x08
3112 #define _INT2IE                 0x10
3113 #define _INT2E                  0x10
3114 #define _INT1IP                 0x40
3115 #define _INT1P                  0x40
3116 #define _INT2IP                 0x80
3117 #define _INT2P                  0x80
3118 
3119 //==============================================================================
3120 
3121 
3122 //==============================================================================
3123 //        INTCON2 Bits
3124 
3125 extern __at(0x0FF1) __sfr INTCON2;
3126 
3127 typedef union
3128   {
3129   struct
3130     {
3131     unsigned RBIP               : 1;
3132     unsigned                    : 1;
3133     unsigned TMR0IP             : 1;
3134     unsigned                    : 1;
3135     unsigned INTEDG2            : 1;
3136     unsigned INTEDG1            : 1;
3137     unsigned INTEDG0            : 1;
3138     unsigned NOT_RBPU           : 1;
3139     };
3140 
3141   struct
3142     {
3143     unsigned                    : 1;
3144     unsigned                    : 1;
3145     unsigned                    : 1;
3146     unsigned                    : 1;
3147     unsigned                    : 1;
3148     unsigned                    : 1;
3149     unsigned                    : 1;
3150     unsigned RBPU               : 1;
3151     };
3152   } __INTCON2bits_t;
3153 
3154 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
3155 
3156 #define _RBIP                   0x01
3157 #define _TMR0IP                 0x04
3158 #define _INTEDG2                0x10
3159 #define _INTEDG1                0x20
3160 #define _INTEDG0                0x40
3161 #define _NOT_RBPU               0x80
3162 #define _RBPU                   0x80
3163 
3164 //==============================================================================
3165 
3166 
3167 //==============================================================================
3168 //        INTCON Bits
3169 
3170 extern __at(0x0FF2) __sfr INTCON;
3171 
3172 typedef union
3173   {
3174   struct
3175     {
3176     unsigned RBIF               : 1;
3177     unsigned INT0IF             : 1;
3178     unsigned TMR0IF             : 1;
3179     unsigned RBIE               : 1;
3180     unsigned INT0IE             : 1;
3181     unsigned TMR0IE             : 1;
3182     unsigned PEIE_GIEL          : 1;
3183     unsigned GIE_GIEH           : 1;
3184     };
3185 
3186   struct
3187     {
3188     unsigned                    : 1;
3189     unsigned INT0F              : 1;
3190     unsigned T0IF               : 1;
3191     unsigned                    : 1;
3192     unsigned INT0E              : 1;
3193     unsigned T0IE               : 1;
3194     unsigned PEIE               : 1;
3195     unsigned GIE                : 1;
3196     };
3197 
3198   struct
3199     {
3200     unsigned                    : 1;
3201     unsigned                    : 1;
3202     unsigned                    : 1;
3203     unsigned                    : 1;
3204     unsigned                    : 1;
3205     unsigned                    : 1;
3206     unsigned GIEL               : 1;
3207     unsigned GIEH               : 1;
3208     };
3209   } __INTCONbits_t;
3210 
3211 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3212 
3213 #define _RBIF                   0x01
3214 #define _INT0IF                 0x02
3215 #define _INT0F                  0x02
3216 #define _TMR0IF                 0x04
3217 #define _T0IF                   0x04
3218 #define _RBIE                   0x08
3219 #define _INT0IE                 0x10
3220 #define _INT0E                  0x10
3221 #define _TMR0IE                 0x20
3222 #define _T0IE                   0x20
3223 #define _PEIE_GIEL              0x40
3224 #define _PEIE                   0x40
3225 #define _GIEL                   0x40
3226 #define _GIE_GIEH               0x80
3227 #define _GIE                    0x80
3228 #define _GIEH                   0x80
3229 
3230 //==============================================================================
3231 
3232 extern __at(0x0FF3) __sfr PROD;
3233 extern __at(0x0FF3) __sfr PRODL;
3234 extern __at(0x0FF4) __sfr PRODH;
3235 extern __at(0x0FF5) __sfr TABLAT;
3236 extern __at(0x0FF6) __sfr TBLPTR;
3237 extern __at(0x0FF6) __sfr TBLPTRL;
3238 extern __at(0x0FF7) __sfr TBLPTRH;
3239 extern __at(0x0FF8) __sfr TBLPTRU;
3240 extern __at(0x0FF9) __sfr PC;
3241 extern __at(0x0FF9) __sfr PCL;
3242 extern __at(0x0FFA) __sfr PCLATH;
3243 extern __at(0x0FFB) __sfr PCLATU;
3244 
3245 //==============================================================================
3246 //        STKPTR Bits
3247 
3248 extern __at(0x0FFC) __sfr STKPTR;
3249 
3250 typedef union
3251   {
3252   struct
3253     {
3254     unsigned SP0                : 1;
3255     unsigned SP1                : 1;
3256     unsigned SP2                : 1;
3257     unsigned SP3                : 1;
3258     unsigned SP4                : 1;
3259     unsigned                    : 1;
3260     unsigned STKUNF             : 1;
3261     unsigned STKFUL             : 1;
3262     };
3263 
3264   struct
3265     {
3266     unsigned                    : 1;
3267     unsigned                    : 1;
3268     unsigned                    : 1;
3269     unsigned                    : 1;
3270     unsigned                    : 1;
3271     unsigned                    : 1;
3272     unsigned                    : 1;
3273     unsigned STKOVF             : 1;
3274     };
3275 
3276   struct
3277     {
3278     unsigned SP                 : 5;
3279     unsigned                    : 3;
3280     };
3281   } __STKPTRbits_t;
3282 
3283 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3284 
3285 #define _SP0                    0x01
3286 #define _SP1                    0x02
3287 #define _SP2                    0x04
3288 #define _SP3                    0x08
3289 #define _SP4                    0x10
3290 #define _STKUNF                 0x40
3291 #define _STKFUL                 0x80
3292 #define _STKOVF                 0x80
3293 
3294 //==============================================================================
3295 
3296 extern __at(0x0FFD) __sfr TOS;
3297 extern __at(0x0FFD) __sfr TOSL;
3298 extern __at(0x0FFE) __sfr TOSH;
3299 extern __at(0x0FFF) __sfr TOSU;
3300 
3301 //==============================================================================
3302 //
3303 //        Configuration Bits
3304 //
3305 //==============================================================================
3306 
3307 #define __CONFIG1H              0x300001
3308 #define __CONFIG2L              0x300002
3309 #define __CONFIG2H              0x300003
3310 #define __CONFIG3H              0x300005
3311 #define __CONFIG4L              0x300006
3312 #define __CONFIG5L              0x300008
3313 #define __CONFIG5H              0x300009
3314 #define __CONFIG6L              0x30000A
3315 #define __CONFIG6H              0x30000B
3316 #define __CONFIG7L              0x30000C
3317 #define __CONFIG7H              0x30000D
3318 
3319 //----------------------------- CONFIG1H Options -------------------------------
3320 
3321 #define _OSC_LP_1H              0xF0    // LP oscillator.
3322 #define _OSC_XT_1H              0xF1    // XT oscillator.
3323 #define _OSC_HS_1H              0xF2    // HS oscillator.
3324 #define _OSC_RC_1H              0xF3    // External RC oscillator, CLKO function on RA6.
3325 #define _OSC_EC_1H              0xF4    // EC oscillator, CLKO function on RA6.
3326 #define _OSC_ECIO6_1H           0xF5    // EC oscillator, port function on RA6.
3327 #define _OSC_HSPLL_1H           0xF6    // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3328 #define _OSC_RCIO6_1H           0xF7    // External RC oscillator, port function on RA6.
3329 #define _OSC_INTIO67_1H         0xF8    // Internal oscillator block, port function on RA6 and RA7.
3330 #define _OSC_INTIO7_1H          0xF9    // Internal oscillator block, CLKO function on RA6, port function on RA7.
3331 #define _FCMEN_OFF_1H           0xBF    // Fail-Safe Clock Monitor disabled.
3332 #define _FCMEN_ON_1H            0xFF    // Fail-Safe Clock Monitor enabled.
3333 #define _IESO_OFF_1H            0x7F    // Oscillator Switchover mode disabled.
3334 #define _IESO_ON_1H             0xFF    // Oscillator Switchover mode enabled.
3335 
3336 //----------------------------- CONFIG2L Options -------------------------------
3337 
3338 #define _PWRT_ON_2L             0xFE    // PWRT enabled.
3339 #define _PWRT_OFF_2L            0xFF    // PWRT disabled.
3340 #define _BOREN_OFF_2L           0xF9    // Brown-out Reset disabled in hardware and software.
3341 #define _BOREN_ON_2L            0xFB    // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3342 #define _BOREN_NOSLP_2L         0xFD    // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3343 #define _BOREN_SBORDIS_2L       0xFF    // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3344 #define _BORV_0_2L              0xE7    // Maximum setting.
3345 #define _BORV_1_2L              0xEF
3346 #define _BORV_2_2L              0xF7
3347 #define _BORV_3_2L              0xFF    // Minimum setting.
3348 
3349 //----------------------------- CONFIG2H Options -------------------------------
3350 
3351 #define _WDT_OFF_2H             0xFE    // WDT disabled (control is placed on the SWDTEN bit).
3352 #define _WDT_ON_2H              0xFF    // WDT enabled.
3353 #define _WDTPS_1_2H             0xE1    // 1:1.
3354 #define _WDTPS_2_2H             0xE3    // 1:2.
3355 #define _WDTPS_4_2H             0xE5    // 1:4.
3356 #define _WDTPS_8_2H             0xE7    // 1:8.
3357 #define _WDTPS_16_2H            0xE9    // 1:16.
3358 #define _WDTPS_32_2H            0xEB    // 1:32.
3359 #define _WDTPS_64_2H            0xED    // 1:64.
3360 #define _WDTPS_128_2H           0xEF    // 1:128.
3361 #define _WDTPS_256_2H           0xF1    // 1:256.
3362 #define _WDTPS_512_2H           0xF3    // 1:512.
3363 #define _WDTPS_1024_2H          0xF5    // 1:1024.
3364 #define _WDTPS_2048_2H          0xF7    // 1:2048.
3365 #define _WDTPS_4096_2H          0xF9    // 1:4096.
3366 #define _WDTPS_8192_2H          0xFB    // 1:8192.
3367 #define _WDTPS_16384_2H         0xFD    // 1:16384.
3368 #define _WDTPS_32768_2H         0xFF    // 1:32768.
3369 
3370 //----------------------------- CONFIG3H Options -------------------------------
3371 
3372 #define _CCP2MX_PORTBE_3H       0xFE    // CCP2 input/output is multiplexed with RB3.
3373 #define _CCP2MX_PORTC_3H        0xFF    // CCP2 input/output is multiplexed with RC1.
3374 #define _PBADEN_OFF_3H          0xFD    // PORTB<4:0> pins are configured as digital I/O on Reset.
3375 #define _PBADEN_ON_3H           0xFF    // PORTB<4:0> pins are configured as analog input channels on Reset.
3376 #define _LPT1OSC_OFF_3H         0xFB    // Timer1 configured for higher power operation.
3377 #define _LPT1OSC_ON_3H          0xFF    // Timer1 configured for low-power operation.
3378 #define _MCLRE_OFF_3H           0x7F    // RE3 input pin enabled; MCLR disabled.
3379 #define _MCLRE_ON_3H            0xFF    // MCLR pin enabled; RE3 input pin disabled.
3380 
3381 //----------------------------- CONFIG4L Options -------------------------------
3382 
3383 #define _STVREN_OFF_4L          0xFE    // Stack full/underflow will not cause Reset.
3384 #define _STVREN_ON_4L           0xFF    // Stack full/underflow will cause Reset.
3385 #define _LVP_OFF_4L             0xFB    // Single-Supply ICSP disabled.
3386 #define _LVP_ON_4L              0xFF    // Single-Supply ICSP enabled.
3387 #define _XINST_OFF_4L           0xBF    // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3388 #define _XINST_ON_4L            0xFF    // Instruction set extension and Indexed Addressing mode enabled.
3389 #define _DEBUG_ON_4L            0x7F    // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3390 #define _DEBUG_OFF_4L           0xFF    // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3391 
3392 //----------------------------- CONFIG5L Options -------------------------------
3393 
3394 #define _CP0_ON_5L              0xFE    // Block 0 (000800-001FFFh) code-protected.
3395 #define _CP0_OFF_5L             0xFF    // Block 0 (000800-001FFFh) not code-protected.
3396 #define _CP1_ON_5L              0xFD    // Block 1 (002000-003FFFh) code-protected.
3397 #define _CP1_OFF_5L             0xFF    // Block 1 (002000-003FFFh) not code-protected.
3398 #define _CP2_ON_5L              0xFB    // Block 2 (004000-005FFFh) code-protected.
3399 #define _CP2_OFF_5L             0xFF    // Block 2 (004000-005FFFh) not code-protected.
3400 #define _CP3_ON_5L              0xF7    // Block 3 (006000-007FFFh) code-protected.
3401 #define _CP3_OFF_5L             0xFF    // Block 3 (006000-007FFFh) not code-protected.
3402 
3403 //----------------------------- CONFIG5H Options -------------------------------
3404 
3405 #define _CPB_ON_5H              0xBF    // Boot block (000000-0007FFh) code-protected.
3406 #define _CPB_OFF_5H             0xFF    // Boot block (000000-0007FFh) not code-protected.
3407 #define _CPD_ON_5H              0x7F    // Data EEPROM code-protected.
3408 #define _CPD_OFF_5H             0xFF    // Data EEPROM not code-protected.
3409 
3410 //----------------------------- CONFIG6L Options -------------------------------
3411 
3412 #define _WRT0_ON_6L             0xFE    // Block 0 (000800-001FFFh) write-protected.
3413 #define _WRT0_OFF_6L            0xFF    // Block 0 (000800-001FFFh) not write-protected.
3414 #define _WRT1_ON_6L             0xFD    // Block 1 (002000-003FFFh) write-protected.
3415 #define _WRT1_OFF_6L            0xFF    // Block 1 (002000-003FFFh) not write-protected.
3416 #define _WRT2_ON_6L             0xFB    // Block 2 (004000-005FFFh) write-protected.
3417 #define _WRT2_OFF_6L            0xFF    // Block 2 (004000-005FFFh) not write-protected.
3418 #define _WRT3_ON_6L             0xF7    // Block 3 (006000-007FFFh) write-protected.
3419 #define _WRT3_OFF_6L            0xFF    // Block 3 (006000-007FFFh) not write-protected.
3420 
3421 //----------------------------- CONFIG6H Options -------------------------------
3422 
3423 #define _WRTC_ON_6H             0xDF    // Configuration registers (300000-3000FFh) write-protected.
3424 #define _WRTC_OFF_6H            0xFF    // Configuration registers (300000-3000FFh) not write-protected.
3425 #define _WRTB_ON_6H             0xBF    // Boot block (000000-0007FFh) write-protected.
3426 #define _WRTB_OFF_6H            0xFF    // Boot block (000000-0007FFh) not write-protected.
3427 #define _WRTD_ON_6H             0x7F    // Data EEPROM write-protected.
3428 #define _WRTD_OFF_6H            0xFF    // Data EEPROM not write-protected.
3429 
3430 //----------------------------- CONFIG7L Options -------------------------------
3431 
3432 #define _EBTR0_ON_7L            0xFE    // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
3433 #define _EBTR0_OFF_7L           0xFF    // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
3434 #define _EBTR1_ON_7L            0xFD    // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
3435 #define _EBTR1_OFF_7L           0xFF    // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
3436 #define _EBTR2_ON_7L            0xFB    // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
3437 #define _EBTR2_OFF_7L           0xFF    // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
3438 #define _EBTR3_ON_7L            0xF7    // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
3439 #define _EBTR3_OFF_7L           0xFF    // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
3440 
3441 //----------------------------- CONFIG7H Options -------------------------------
3442 
3443 #define _EBTRB_ON_7H            0xBF    // Boot block (000000-0007FFh) protected from table reads executed in other blocks.
3444 #define _EBTRB_OFF_7H           0xFF    // Boot block (000000-0007FFh) not protected from table reads executed in other blocks.
3445 
3446 //==============================================================================
3447 
3448 #define __DEVID1                0x3FFFFE
3449 #define __DEVID2                0x3FFFFF
3450 
3451 #define __IDLOC0                0x200000
3452 #define __IDLOC1                0x200001
3453 #define __IDLOC2                0x200002
3454 #define __IDLOC3                0x200003
3455 #define __IDLOC4                0x200004
3456 #define __IDLOC5                0x200005
3457 #define __IDLOC6                0x200006
3458 #define __IDLOC7                0x200007
3459 
3460 #endif // #ifndef __PIC18LF4520_H__
3461