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