1 /*
2  * This declarations of the PIC18LF4458 MCU.
3  *
4  * This file is part of the GNU PIC library for SDCC, originally
5  * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
6  *
7  * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:24:03 UTC.
8  *
9  * SDCC is licensed under the GNU Public license (GPL) v2. Note that
10  * this license covers the code to the compiler and other executables,
11  * but explicitly does not cover any code or objects generated by sdcc.
12  *
13  * For pic device libraries and header files which are derived from
14  * Microchip header (.inc) and linker script (.lkr) files Microchip
15  * requires that "The header files should state that they are only to be
16  * used with authentic Microchip devices" which makes them incompatible
17  * with the GPL. Pic device libraries and header files are located at
18  * non-free/lib and non-free/include directories respectively.
19  * Sdcc should be run with the --use-non-free command line option in
20  * order to include non-free header files and libraries.
21  *
22  * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
23  */
24 
25 #ifndef __PIC18LF4458_H__
26 #define __PIC18LF4458_H__
27 
28 //==============================================================================
29 
30 //==============================================================================
31 //
32 //	Register Definitions
33 //
34 //==============================================================================
35 
36 extern __at(0x0F62) __sfr SPPDATA;
37 
38 //==============================================================================
39 //        SPPCFG Bits
40 
41 extern __at(0x0F63) __sfr SPPCFG;
42 
43 typedef union
44   {
45   struct
46     {
47     unsigned WS0                : 1;
48     unsigned WS1                : 1;
49     unsigned WS2                : 1;
50     unsigned WS3                : 1;
51     unsigned CLK1EN             : 1;
52     unsigned CSEN               : 1;
53     unsigned CLKCFG0            : 1;
54     unsigned CLKCFG1            : 1;
55     };
56 
57   struct
58     {
59     unsigned WS                 : 4;
60     unsigned                    : 4;
61     };
62 
63   struct
64     {
65     unsigned                    : 6;
66     unsigned CLKCFG             : 2;
67     };
68   } __SPPCFGbits_t;
69 
70 extern __at(0x0F63) volatile __SPPCFGbits_t SPPCFGbits;
71 
72 #define _WS0                    0x01
73 #define _WS1                    0x02
74 #define _WS2                    0x04
75 #define _WS3                    0x08
76 #define _CLK1EN                 0x10
77 #define _CSEN                   0x20
78 #define _CLKCFG0                0x40
79 #define _CLKCFG1                0x80
80 
81 //==============================================================================
82 
83 
84 //==============================================================================
85 //        SPPEPS Bits
86 
87 extern __at(0x0F64) __sfr SPPEPS;
88 
89 typedef union
90   {
91   struct
92     {
93     unsigned ADDR0              : 1;
94     unsigned ADDR1              : 1;
95     unsigned ADDR2              : 1;
96     unsigned ADDR3              : 1;
97     unsigned SPPBUSY            : 1;
98     unsigned                    : 1;
99     unsigned WRSPP              : 1;
100     unsigned RDSPP              : 1;
101     };
102 
103   struct
104     {
105     unsigned ADDR               : 4;
106     unsigned                    : 4;
107     };
108   } __SPPEPSbits_t;
109 
110 extern __at(0x0F64) volatile __SPPEPSbits_t SPPEPSbits;
111 
112 #define _ADDR0                  0x01
113 #define _ADDR1                  0x02
114 #define _ADDR2                  0x04
115 #define _ADDR3                  0x08
116 #define _SPPBUSY                0x10
117 #define _WRSPP                  0x40
118 #define _RDSPP                  0x80
119 
120 //==============================================================================
121 
122 
123 //==============================================================================
124 //        SPPCON Bits
125 
126 extern __at(0x0F65) __sfr SPPCON;
127 
128 typedef struct
129   {
130   unsigned SPPEN                : 1;
131   unsigned SPPOWN               : 1;
132   unsigned                      : 1;
133   unsigned                      : 1;
134   unsigned                      : 1;
135   unsigned                      : 1;
136   unsigned                      : 1;
137   unsigned                      : 1;
138   } __SPPCONbits_t;
139 
140 extern __at(0x0F65) volatile __SPPCONbits_t SPPCONbits;
141 
142 #define _SPPEN                  0x01
143 #define _SPPOWN                 0x02
144 
145 //==============================================================================
146 
147 extern __at(0x0F66) __sfr UFRM;
148 
149 //==============================================================================
150 //        UFRML Bits
151 
152 extern __at(0x0F66) __sfr UFRML;
153 
154 typedef struct
155   {
156   unsigned FRM0                 : 1;
157   unsigned FRM1                 : 1;
158   unsigned FRM2                 : 1;
159   unsigned FRM3                 : 1;
160   unsigned FRM4                 : 1;
161   unsigned FRM5                 : 1;
162   unsigned FRM6                 : 1;
163   unsigned FRM7                 : 1;
164   } __UFRMLbits_t;
165 
166 extern __at(0x0F66) volatile __UFRMLbits_t UFRMLbits;
167 
168 #define _FRM0                   0x01
169 #define _FRM1                   0x02
170 #define _FRM2                   0x04
171 #define _FRM3                   0x08
172 #define _FRM4                   0x10
173 #define _FRM5                   0x20
174 #define _FRM6                   0x40
175 #define _FRM7                   0x80
176 
177 //==============================================================================
178 
179 
180 //==============================================================================
181 //        UFRMH Bits
182 
183 extern __at(0x0F67) __sfr UFRMH;
184 
185 typedef struct
186   {
187   unsigned FRM8                 : 1;
188   unsigned FRM9                 : 1;
189   unsigned FRM10                : 1;
190   unsigned                      : 1;
191   unsigned                      : 1;
192   unsigned                      : 1;
193   unsigned                      : 1;
194   unsigned                      : 1;
195   } __UFRMHbits_t;
196 
197 extern __at(0x0F67) volatile __UFRMHbits_t UFRMHbits;
198 
199 #define _FRM8                   0x01
200 #define _FRM9                   0x02
201 #define _FRM10                  0x04
202 
203 //==============================================================================
204 
205 
206 //==============================================================================
207 //        UIR Bits
208 
209 extern __at(0x0F68) __sfr UIR;
210 
211 typedef struct
212   {
213   unsigned URSTIF               : 1;
214   unsigned UERRIF               : 1;
215   unsigned ACTVIF               : 1;
216   unsigned TRNIF                : 1;
217   unsigned IDLEIF               : 1;
218   unsigned STALLIF              : 1;
219   unsigned SOFIF                : 1;
220   unsigned                      : 1;
221   } __UIRbits_t;
222 
223 extern __at(0x0F68) volatile __UIRbits_t UIRbits;
224 
225 #define _URSTIF                 0x01
226 #define _UERRIF                 0x02
227 #define _ACTVIF                 0x04
228 #define _TRNIF                  0x08
229 #define _IDLEIF                 0x10
230 #define _STALLIF                0x20
231 #define _SOFIF                  0x40
232 
233 //==============================================================================
234 
235 
236 //==============================================================================
237 //        UIE Bits
238 
239 extern __at(0x0F69) __sfr UIE;
240 
241 typedef struct
242   {
243   unsigned URSTIE               : 1;
244   unsigned UERRIE               : 1;
245   unsigned ACTVIE               : 1;
246   unsigned TRNIE                : 1;
247   unsigned IDLEIE               : 1;
248   unsigned STALLIE              : 1;
249   unsigned SOFIE                : 1;
250   unsigned                      : 1;
251   } __UIEbits_t;
252 
253 extern __at(0x0F69) volatile __UIEbits_t UIEbits;
254 
255 #define _URSTIE                 0x01
256 #define _UERRIE                 0x02
257 #define _ACTVIE                 0x04
258 #define _TRNIE                  0x08
259 #define _IDLEIE                 0x10
260 #define _STALLIE                0x20
261 #define _SOFIE                  0x40
262 
263 //==============================================================================
264 
265 
266 //==============================================================================
267 //        UEIR Bits
268 
269 extern __at(0x0F6A) __sfr UEIR;
270 
271 typedef struct
272   {
273   unsigned PIDEF                : 1;
274   unsigned CRC5EF               : 1;
275   unsigned CRC16EF              : 1;
276   unsigned DFN8EF               : 1;
277   unsigned BTOEF                : 1;
278   unsigned                      : 1;
279   unsigned                      : 1;
280   unsigned BTSEF                : 1;
281   } __UEIRbits_t;
282 
283 extern __at(0x0F6A) volatile __UEIRbits_t UEIRbits;
284 
285 #define _PIDEF                  0x01
286 #define _CRC5EF                 0x02
287 #define _CRC16EF                0x04
288 #define _DFN8EF                 0x08
289 #define _BTOEF                  0x10
290 #define _BTSEF                  0x80
291 
292 //==============================================================================
293 
294 
295 //==============================================================================
296 //        UEIE Bits
297 
298 extern __at(0x0F6B) __sfr UEIE;
299 
300 typedef struct
301   {
302   unsigned PIDEE                : 1;
303   unsigned CRC5EE               : 1;
304   unsigned CRC16EE              : 1;
305   unsigned DFN8EE               : 1;
306   unsigned BTOEE                : 1;
307   unsigned                      : 1;
308   unsigned                      : 1;
309   unsigned BTSEE                : 1;
310   } __UEIEbits_t;
311 
312 extern __at(0x0F6B) volatile __UEIEbits_t UEIEbits;
313 
314 #define _PIDEE                  0x01
315 #define _CRC5EE                 0x02
316 #define _CRC16EE                0x04
317 #define _DFN8EE                 0x08
318 #define _BTOEE                  0x10
319 #define _BTSEE                  0x80
320 
321 //==============================================================================
322 
323 
324 //==============================================================================
325 //        USTAT Bits
326 
327 extern __at(0x0F6C) __sfr USTAT;
328 
329 typedef union
330   {
331   struct
332     {
333     unsigned                    : 1;
334     unsigned PPBI               : 1;
335     unsigned DIR                : 1;
336     unsigned ENDP0              : 1;
337     unsigned ENDP1              : 1;
338     unsigned ENDP2              : 1;
339     unsigned ENDP3              : 1;
340     unsigned                    : 1;
341     };
342 
343   struct
344     {
345     unsigned                    : 3;
346     unsigned ENDP               : 4;
347     unsigned                    : 1;
348     };
349   } __USTATbits_t;
350 
351 extern __at(0x0F6C) volatile __USTATbits_t USTATbits;
352 
353 #define _PPBI                   0x02
354 #define _DIR                    0x04
355 #define _ENDP0                  0x08
356 #define _ENDP1                  0x10
357 #define _ENDP2                  0x20
358 #define _ENDP3                  0x40
359 
360 //==============================================================================
361 
362 
363 //==============================================================================
364 //        UCON Bits
365 
366 extern __at(0x0F6D) __sfr UCON;
367 
368 typedef struct
369   {
370   unsigned                      : 1;
371   unsigned SUSPND               : 1;
372   unsigned RESUME               : 1;
373   unsigned USBEN                : 1;
374   unsigned PKTDIS               : 1;
375   unsigned SE0                  : 1;
376   unsigned PPBRST               : 1;
377   unsigned                      : 1;
378   } __UCONbits_t;
379 
380 extern __at(0x0F6D) volatile __UCONbits_t UCONbits;
381 
382 #define _SUSPND                 0x02
383 #define _RESUME                 0x04
384 #define _USBEN                  0x08
385 #define _PKTDIS                 0x10
386 #define _SE0                    0x20
387 #define _PPBRST                 0x40
388 
389 //==============================================================================
390 
391 
392 //==============================================================================
393 //        UADDR Bits
394 
395 extern __at(0x0F6E) __sfr UADDR;
396 
397 typedef union
398   {
399   struct
400     {
401     unsigned ADDR0              : 1;
402     unsigned ADDR1              : 1;
403     unsigned ADDR2              : 1;
404     unsigned ADDR3              : 1;
405     unsigned ADDR4              : 1;
406     unsigned ADDR5              : 1;
407     unsigned ADDR6              : 1;
408     unsigned                    : 1;
409     };
410 
411   struct
412     {
413     unsigned ADDR               : 7;
414     unsigned                    : 1;
415     };
416   } __UADDRbits_t;
417 
418 extern __at(0x0F6E) volatile __UADDRbits_t UADDRbits;
419 
420 #define _UADDR_ADDR0            0x01
421 #define _UADDR_ADDR1            0x02
422 #define _UADDR_ADDR2            0x04
423 #define _UADDR_ADDR3            0x08
424 #define _UADDR_ADDR4            0x10
425 #define _UADDR_ADDR5            0x20
426 #define _UADDR_ADDR6            0x40
427 
428 //==============================================================================
429 
430 
431 //==============================================================================
432 //        UCFG Bits
433 
434 extern __at(0x0F6F) __sfr UCFG;
435 
436 typedef union
437   {
438   struct
439     {
440     unsigned PPB0               : 1;
441     unsigned PPB1               : 1;
442     unsigned FSEN               : 1;
443     unsigned UTRDIS             : 1;
444     unsigned UPUEN              : 1;
445     unsigned                    : 1;
446     unsigned UOEMON             : 1;
447     unsigned UTEYE              : 1;
448     };
449 
450   struct
451     {
452     unsigned PPB                : 2;
453     unsigned                    : 6;
454     };
455   } __UCFGbits_t;
456 
457 extern __at(0x0F6F) volatile __UCFGbits_t UCFGbits;
458 
459 #define _PPB0                   0x01
460 #define _PPB1                   0x02
461 #define _FSEN                   0x04
462 #define _UTRDIS                 0x08
463 #define _UPUEN                  0x10
464 #define _UOEMON                 0x40
465 #define _UTEYE                  0x80
466 
467 //==============================================================================
468 
469 
470 //==============================================================================
471 //        UEP0 Bits
472 
473 extern __at(0x0F70) __sfr UEP0;
474 
475 typedef struct
476   {
477   unsigned EPSTALL              : 1;
478   unsigned EPINEN               : 1;
479   unsigned EPOUTEN              : 1;
480   unsigned EPCONDIS             : 1;
481   unsigned EPHSHK               : 1;
482   unsigned                      : 1;
483   unsigned                      : 1;
484   unsigned                      : 1;
485   } __UEP0bits_t;
486 
487 extern __at(0x0F70) volatile __UEP0bits_t UEP0bits;
488 
489 #define _EPSTALL                0x01
490 #define _EPINEN                 0x02
491 #define _EPOUTEN                0x04
492 #define _EPCONDIS               0x08
493 #define _EPHSHK                 0x10
494 
495 //==============================================================================
496 
497 
498 //==============================================================================
499 //        UEP1 Bits
500 
501 extern __at(0x0F71) __sfr UEP1;
502 
503 typedef struct
504   {
505   unsigned EPSTALL              : 1;
506   unsigned EPINEN               : 1;
507   unsigned EPOUTEN              : 1;
508   unsigned EPCONDIS             : 1;
509   unsigned EPHSHK               : 1;
510   unsigned                      : 1;
511   unsigned                      : 1;
512   unsigned                      : 1;
513   } __UEP1bits_t;
514 
515 extern __at(0x0F71) volatile __UEP1bits_t UEP1bits;
516 
517 #define _UEP1_EPSTALL           0x01
518 #define _UEP1_EPINEN            0x02
519 #define _UEP1_EPOUTEN           0x04
520 #define _UEP1_EPCONDIS          0x08
521 #define _UEP1_EPHSHK            0x10
522 
523 //==============================================================================
524 
525 
526 //==============================================================================
527 //        UEP2 Bits
528 
529 extern __at(0x0F72) __sfr UEP2;
530 
531 typedef struct
532   {
533   unsigned EPSTALL              : 1;
534   unsigned EPINEN               : 1;
535   unsigned EPOUTEN              : 1;
536   unsigned EPCONDIS             : 1;
537   unsigned EPHSHK               : 1;
538   unsigned                      : 1;
539   unsigned                      : 1;
540   unsigned                      : 1;
541   } __UEP2bits_t;
542 
543 extern __at(0x0F72) volatile __UEP2bits_t UEP2bits;
544 
545 #define _UEP2_EPSTALL           0x01
546 #define _UEP2_EPINEN            0x02
547 #define _UEP2_EPOUTEN           0x04
548 #define _UEP2_EPCONDIS          0x08
549 #define _UEP2_EPHSHK            0x10
550 
551 //==============================================================================
552 
553 
554 //==============================================================================
555 //        UEP3 Bits
556 
557 extern __at(0x0F73) __sfr UEP3;
558 
559 typedef struct
560   {
561   unsigned EPSTALL              : 1;
562   unsigned EPINEN               : 1;
563   unsigned EPOUTEN              : 1;
564   unsigned EPCONDIS             : 1;
565   unsigned EPHSHK               : 1;
566   unsigned                      : 1;
567   unsigned                      : 1;
568   unsigned                      : 1;
569   } __UEP3bits_t;
570 
571 extern __at(0x0F73) volatile __UEP3bits_t UEP3bits;
572 
573 #define _UEP3_EPSTALL           0x01
574 #define _UEP3_EPINEN            0x02
575 #define _UEP3_EPOUTEN           0x04
576 #define _UEP3_EPCONDIS          0x08
577 #define _UEP3_EPHSHK            0x10
578 
579 //==============================================================================
580 
581 
582 //==============================================================================
583 //        UEP4 Bits
584 
585 extern __at(0x0F74) __sfr UEP4;
586 
587 typedef struct
588   {
589   unsigned EPSTALL              : 1;
590   unsigned EPINEN               : 1;
591   unsigned EPOUTEN              : 1;
592   unsigned EPCONDIS             : 1;
593   unsigned EPHSHK               : 1;
594   unsigned                      : 1;
595   unsigned                      : 1;
596   unsigned                      : 1;
597   } __UEP4bits_t;
598 
599 extern __at(0x0F74) volatile __UEP4bits_t UEP4bits;
600 
601 #define _UEP4_EPSTALL           0x01
602 #define _UEP4_EPINEN            0x02
603 #define _UEP4_EPOUTEN           0x04
604 #define _UEP4_EPCONDIS          0x08
605 #define _UEP4_EPHSHK            0x10
606 
607 //==============================================================================
608 
609 
610 //==============================================================================
611 //        UEP5 Bits
612 
613 extern __at(0x0F75) __sfr UEP5;
614 
615 typedef struct
616   {
617   unsigned EPSTALL              : 1;
618   unsigned EPINEN               : 1;
619   unsigned EPOUTEN              : 1;
620   unsigned EPCONDIS             : 1;
621   unsigned EPHSHK               : 1;
622   unsigned                      : 1;
623   unsigned                      : 1;
624   unsigned                      : 1;
625   } __UEP5bits_t;
626 
627 extern __at(0x0F75) volatile __UEP5bits_t UEP5bits;
628 
629 #define _UEP5_EPSTALL           0x01
630 #define _UEP5_EPINEN            0x02
631 #define _UEP5_EPOUTEN           0x04
632 #define _UEP5_EPCONDIS          0x08
633 #define _UEP5_EPHSHK            0x10
634 
635 //==============================================================================
636 
637 
638 //==============================================================================
639 //        UEP6 Bits
640 
641 extern __at(0x0F76) __sfr UEP6;
642 
643 typedef struct
644   {
645   unsigned EPSTALL              : 1;
646   unsigned EPINEN               : 1;
647   unsigned EPOUTEN              : 1;
648   unsigned EPCONDIS             : 1;
649   unsigned EPHSHK               : 1;
650   unsigned                      : 1;
651   unsigned                      : 1;
652   unsigned                      : 1;
653   } __UEP6bits_t;
654 
655 extern __at(0x0F76) volatile __UEP6bits_t UEP6bits;
656 
657 #define _UEP6_EPSTALL           0x01
658 #define _UEP6_EPINEN            0x02
659 #define _UEP6_EPOUTEN           0x04
660 #define _UEP6_EPCONDIS          0x08
661 #define _UEP6_EPHSHK            0x10
662 
663 //==============================================================================
664 
665 
666 //==============================================================================
667 //        UEP7 Bits
668 
669 extern __at(0x0F77) __sfr UEP7;
670 
671 typedef struct
672   {
673   unsigned EPSTALL              : 1;
674   unsigned EPINEN               : 1;
675   unsigned EPOUTEN              : 1;
676   unsigned EPCONDIS             : 1;
677   unsigned EPHSHK               : 1;
678   unsigned                      : 1;
679   unsigned                      : 1;
680   unsigned                      : 1;
681   } __UEP7bits_t;
682 
683 extern __at(0x0F77) volatile __UEP7bits_t UEP7bits;
684 
685 #define _UEP7_EPSTALL           0x01
686 #define _UEP7_EPINEN            0x02
687 #define _UEP7_EPOUTEN           0x04
688 #define _UEP7_EPCONDIS          0x08
689 #define _UEP7_EPHSHK            0x10
690 
691 //==============================================================================
692 
693 
694 //==============================================================================
695 //        UEP8 Bits
696 
697 extern __at(0x0F78) __sfr UEP8;
698 
699 typedef struct
700   {
701   unsigned EPSTALL              : 1;
702   unsigned EPINEN               : 1;
703   unsigned EPOUTEN              : 1;
704   unsigned EPCONDIS             : 1;
705   unsigned EPHSHK               : 1;
706   unsigned                      : 1;
707   unsigned                      : 1;
708   unsigned                      : 1;
709   } __UEP8bits_t;
710 
711 extern __at(0x0F78) volatile __UEP8bits_t UEP8bits;
712 
713 #define _UEP8_EPSTALL           0x01
714 #define _UEP8_EPINEN            0x02
715 #define _UEP8_EPOUTEN           0x04
716 #define _UEP8_EPCONDIS          0x08
717 #define _UEP8_EPHSHK            0x10
718 
719 //==============================================================================
720 
721 
722 //==============================================================================
723 //        UEP9 Bits
724 
725 extern __at(0x0F79) __sfr UEP9;
726 
727 typedef struct
728   {
729   unsigned EPSTALL              : 1;
730   unsigned EPINEN               : 1;
731   unsigned EPOUTEN              : 1;
732   unsigned EPCONDIS             : 1;
733   unsigned EPHSHK               : 1;
734   unsigned                      : 1;
735   unsigned                      : 1;
736   unsigned                      : 1;
737   } __UEP9bits_t;
738 
739 extern __at(0x0F79) volatile __UEP9bits_t UEP9bits;
740 
741 #define _UEP9_EPSTALL           0x01
742 #define _UEP9_EPINEN            0x02
743 #define _UEP9_EPOUTEN           0x04
744 #define _UEP9_EPCONDIS          0x08
745 #define _UEP9_EPHSHK            0x10
746 
747 //==============================================================================
748 
749 
750 //==============================================================================
751 //        UEP10 Bits
752 
753 extern __at(0x0F7A) __sfr UEP10;
754 
755 typedef struct
756   {
757   unsigned EPSTALL              : 1;
758   unsigned EPINEN               : 1;
759   unsigned EPOUTEN              : 1;
760   unsigned EPCONDIS             : 1;
761   unsigned EPHSHK               : 1;
762   unsigned                      : 1;
763   unsigned                      : 1;
764   unsigned                      : 1;
765   } __UEP10bits_t;
766 
767 extern __at(0x0F7A) volatile __UEP10bits_t UEP10bits;
768 
769 #define _UEP10_EPSTALL          0x01
770 #define _UEP10_EPINEN           0x02
771 #define _UEP10_EPOUTEN          0x04
772 #define _UEP10_EPCONDIS         0x08
773 #define _UEP10_EPHSHK           0x10
774 
775 //==============================================================================
776 
777 
778 //==============================================================================
779 //        UEP11 Bits
780 
781 extern __at(0x0F7B) __sfr UEP11;
782 
783 typedef struct
784   {
785   unsigned EPSTALL              : 1;
786   unsigned EPINEN               : 1;
787   unsigned EPOUTEN              : 1;
788   unsigned EPCONDIS             : 1;
789   unsigned EPHSHK               : 1;
790   unsigned                      : 1;
791   unsigned                      : 1;
792   unsigned                      : 1;
793   } __UEP11bits_t;
794 
795 extern __at(0x0F7B) volatile __UEP11bits_t UEP11bits;
796 
797 #define _UEP11_EPSTALL          0x01
798 #define _UEP11_EPINEN           0x02
799 #define _UEP11_EPOUTEN          0x04
800 #define _UEP11_EPCONDIS         0x08
801 #define _UEP11_EPHSHK           0x10
802 
803 //==============================================================================
804 
805 
806 //==============================================================================
807 //        UEP12 Bits
808 
809 extern __at(0x0F7C) __sfr UEP12;
810 
811 typedef struct
812   {
813   unsigned EPSTALL              : 1;
814   unsigned EPINEN               : 1;
815   unsigned EPOUTEN              : 1;
816   unsigned EPCONDIS             : 1;
817   unsigned EPHSHK               : 1;
818   unsigned                      : 1;
819   unsigned                      : 1;
820   unsigned                      : 1;
821   } __UEP12bits_t;
822 
823 extern __at(0x0F7C) volatile __UEP12bits_t UEP12bits;
824 
825 #define _UEP12_EPSTALL          0x01
826 #define _UEP12_EPINEN           0x02
827 #define _UEP12_EPOUTEN          0x04
828 #define _UEP12_EPCONDIS         0x08
829 #define _UEP12_EPHSHK           0x10
830 
831 //==============================================================================
832 
833 
834 //==============================================================================
835 //        UEP13 Bits
836 
837 extern __at(0x0F7D) __sfr UEP13;
838 
839 typedef struct
840   {
841   unsigned EPSTALL              : 1;
842   unsigned EPINEN               : 1;
843   unsigned EPOUTEN              : 1;
844   unsigned EPCONDIS             : 1;
845   unsigned EPHSHK               : 1;
846   unsigned                      : 1;
847   unsigned                      : 1;
848   unsigned                      : 1;
849   } __UEP13bits_t;
850 
851 extern __at(0x0F7D) volatile __UEP13bits_t UEP13bits;
852 
853 #define _UEP13_EPSTALL          0x01
854 #define _UEP13_EPINEN           0x02
855 #define _UEP13_EPOUTEN          0x04
856 #define _UEP13_EPCONDIS         0x08
857 #define _UEP13_EPHSHK           0x10
858 
859 //==============================================================================
860 
861 
862 //==============================================================================
863 //        UEP14 Bits
864 
865 extern __at(0x0F7E) __sfr UEP14;
866 
867 typedef struct
868   {
869   unsigned EPSTALL              : 1;
870   unsigned EPINEN               : 1;
871   unsigned EPOUTEN              : 1;
872   unsigned EPCONDIS             : 1;
873   unsigned EPHSHK               : 1;
874   unsigned                      : 1;
875   unsigned                      : 1;
876   unsigned                      : 1;
877   } __UEP14bits_t;
878 
879 extern __at(0x0F7E) volatile __UEP14bits_t UEP14bits;
880 
881 #define _UEP14_EPSTALL          0x01
882 #define _UEP14_EPINEN           0x02
883 #define _UEP14_EPOUTEN          0x04
884 #define _UEP14_EPCONDIS         0x08
885 #define _UEP14_EPHSHK           0x10
886 
887 //==============================================================================
888 
889 
890 //==============================================================================
891 //        UEP15 Bits
892 
893 extern __at(0x0F7F) __sfr UEP15;
894 
895 typedef struct
896   {
897   unsigned EPSTALL              : 1;
898   unsigned EPINEN               : 1;
899   unsigned EPOUTEN              : 1;
900   unsigned EPCONDIS             : 1;
901   unsigned EPHSHK               : 1;
902   unsigned                      : 1;
903   unsigned                      : 1;
904   unsigned                      : 1;
905   } __UEP15bits_t;
906 
907 extern __at(0x0F7F) volatile __UEP15bits_t UEP15bits;
908 
909 #define _UEP15_EPSTALL          0x01
910 #define _UEP15_EPINEN           0x02
911 #define _UEP15_EPOUTEN          0x04
912 #define _UEP15_EPCONDIS         0x08
913 #define _UEP15_EPHSHK           0x10
914 
915 //==============================================================================
916 
917 
918 //==============================================================================
919 //        PORTA Bits
920 
921 extern __at(0x0F80) __sfr PORTA;
922 
923 typedef union
924   {
925   struct
926     {
927     unsigned RA0                : 1;
928     unsigned RA1                : 1;
929     unsigned RA2                : 1;
930     unsigned RA3                : 1;
931     unsigned RA4                : 1;
932     unsigned RA5                : 1;
933     unsigned RA6                : 1;
934     unsigned                    : 1;
935     };
936 
937   struct
938     {
939     unsigned AN0                : 1;
940     unsigned AN1                : 1;
941     unsigned AN2                : 1;
942     unsigned AN3                : 1;
943     unsigned T0CKI              : 1;
944     unsigned AN4                : 1;
945     unsigned OSC2               : 1;
946     unsigned                    : 1;
947     };
948 
949   struct
950     {
951     unsigned                    : 1;
952     unsigned                    : 1;
953     unsigned VREFM              : 1;
954     unsigned VREFP              : 1;
955     unsigned                    : 1;
956     unsigned LVDIN              : 1;
957     unsigned                    : 1;
958     unsigned                    : 1;
959     };
960 
961   struct
962     {
963     unsigned                    : 1;
964     unsigned                    : 1;
965     unsigned                    : 1;
966     unsigned                    : 1;
967     unsigned                    : 1;
968     unsigned HLVDIN             : 1;
969     unsigned                    : 1;
970     unsigned                    : 1;
971     };
972 
973   struct
974     {
975     unsigned RA                 : 7;
976     unsigned                    : 1;
977     };
978   } __PORTAbits_t;
979 
980 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
981 
982 #define _PORTA_RA0              0x01
983 #define _PORTA_AN0              0x01
984 #define _PORTA_RA1              0x02
985 #define _PORTA_AN1              0x02
986 #define _PORTA_RA2              0x04
987 #define _PORTA_AN2              0x04
988 #define _PORTA_VREFM            0x04
989 #define _PORTA_RA3              0x08
990 #define _PORTA_AN3              0x08
991 #define _PORTA_VREFP            0x08
992 #define _PORTA_RA4              0x10
993 #define _PORTA_T0CKI            0x10
994 #define _PORTA_RA5              0x20
995 #define _PORTA_AN4              0x20
996 #define _PORTA_LVDIN            0x20
997 #define _PORTA_HLVDIN           0x20
998 #define _PORTA_RA6              0x40
999 #define _PORTA_OSC2             0x40
1000 
1001 //==============================================================================
1002 
1003 
1004 //==============================================================================
1005 //        PORTB Bits
1006 
1007 extern __at(0x0F81) __sfr PORTB;
1008 
1009 typedef union
1010   {
1011   struct
1012     {
1013     unsigned RB0                : 1;
1014     unsigned RB1                : 1;
1015     unsigned RB2                : 1;
1016     unsigned RB3                : 1;
1017     unsigned RB4                : 1;
1018     unsigned RB5                : 1;
1019     unsigned RB6                : 1;
1020     unsigned RB7                : 1;
1021     };
1022 
1023   struct
1024     {
1025     unsigned INT0               : 1;
1026     unsigned INT1               : 1;
1027     unsigned INT2               : 1;
1028     unsigned                    : 1;
1029     unsigned                    : 1;
1030     unsigned PGM                : 1;
1031     unsigned PGC                : 1;
1032     unsigned PGD                : 1;
1033     };
1034 
1035   struct
1036     {
1037     unsigned INT                : 3;
1038     unsigned                    : 5;
1039     };
1040   } __PORTBbits_t;
1041 
1042 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
1043 
1044 #define _PORTB_RB0              0x01
1045 #define _PORTB_INT0             0x01
1046 #define _PORTB_RB1              0x02
1047 #define _PORTB_INT1             0x02
1048 #define _PORTB_RB2              0x04
1049 #define _PORTB_INT2             0x04
1050 #define _PORTB_RB3              0x08
1051 #define _PORTB_RB4              0x10
1052 #define _PORTB_RB5              0x20
1053 #define _PORTB_PGM              0x20
1054 #define _PORTB_RB6              0x40
1055 #define _PORTB_PGC              0x40
1056 #define _PORTB_RB7              0x80
1057 #define _PORTB_PGD              0x80
1058 
1059 //==============================================================================
1060 
1061 
1062 //==============================================================================
1063 //        PORTC Bits
1064 
1065 extern __at(0x0F82) __sfr PORTC;
1066 
1067 typedef union
1068   {
1069   struct
1070     {
1071     unsigned RC0                : 1;
1072     unsigned RC1                : 1;
1073     unsigned RC2                : 1;
1074     unsigned                    : 1;
1075     unsigned RC4                : 1;
1076     unsigned RC5                : 1;
1077     unsigned RC6                : 1;
1078     unsigned RC7                : 1;
1079     };
1080 
1081   struct
1082     {
1083     unsigned T1OSO              : 1;
1084     unsigned T1OSI              : 1;
1085     unsigned CCP1               : 1;
1086     unsigned                    : 1;
1087     unsigned                    : 1;
1088     unsigned                    : 1;
1089     unsigned TX                 : 1;
1090     unsigned RX                 : 1;
1091     };
1092 
1093   struct
1094     {
1095     unsigned T13CKI             : 1;
1096     unsigned                    : 1;
1097     unsigned P1A                : 1;
1098     unsigned                    : 1;
1099     unsigned                    : 1;
1100     unsigned                    : 1;
1101     unsigned CK                 : 1;
1102     unsigned                    : 1;
1103     };
1104   } __PORTCbits_t;
1105 
1106 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
1107 
1108 #define _PORTC_RC0              0x01
1109 #define _PORTC_T1OSO            0x01
1110 #define _PORTC_T13CKI           0x01
1111 #define _PORTC_RC1              0x02
1112 #define _PORTC_T1OSI            0x02
1113 #define _PORTC_RC2              0x04
1114 #define _PORTC_CCP1             0x04
1115 #define _PORTC_P1A              0x04
1116 #define _PORTC_RC4              0x10
1117 #define _PORTC_RC5              0x20
1118 #define _PORTC_RC6              0x40
1119 #define _PORTC_TX               0x40
1120 #define _PORTC_CK               0x40
1121 #define _PORTC_RC7              0x80
1122 #define _PORTC_RX               0x80
1123 
1124 //==============================================================================
1125 
1126 
1127 //==============================================================================
1128 //        PORTD Bits
1129 
1130 extern __at(0x0F83) __sfr PORTD;
1131 
1132 typedef union
1133   {
1134   struct
1135     {
1136     unsigned RD0                : 1;
1137     unsigned RD1                : 1;
1138     unsigned RD2                : 1;
1139     unsigned RD3                : 1;
1140     unsigned RD4                : 1;
1141     unsigned RD5                : 1;
1142     unsigned RD6                : 1;
1143     unsigned RD7                : 1;
1144     };
1145 
1146   struct
1147     {
1148     unsigned SPP0               : 1;
1149     unsigned SPP1               : 1;
1150     unsigned SPP2               : 1;
1151     unsigned SPP3               : 1;
1152     unsigned SPP4               : 1;
1153     unsigned SPP5               : 1;
1154     unsigned SPP6               : 1;
1155     unsigned SPP7               : 1;
1156     };
1157   } __PORTDbits_t;
1158 
1159 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
1160 
1161 #define _PORTD_RD0              0x01
1162 #define _PORTD_SPP0             0x01
1163 #define _PORTD_RD1              0x02
1164 #define _PORTD_SPP1             0x02
1165 #define _PORTD_RD2              0x04
1166 #define _PORTD_SPP2             0x04
1167 #define _PORTD_RD3              0x08
1168 #define _PORTD_SPP3             0x08
1169 #define _PORTD_RD4              0x10
1170 #define _PORTD_SPP4             0x10
1171 #define _PORTD_RD5              0x20
1172 #define _PORTD_SPP5             0x20
1173 #define _PORTD_RD6              0x40
1174 #define _PORTD_SPP6             0x40
1175 #define _PORTD_RD7              0x80
1176 #define _PORTD_SPP7             0x80
1177 
1178 //==============================================================================
1179 
1180 
1181 //==============================================================================
1182 //        PORTE Bits
1183 
1184 extern __at(0x0F84) __sfr PORTE;
1185 
1186 typedef union
1187   {
1188   struct
1189     {
1190     unsigned RE0                : 1;
1191     unsigned RE1                : 1;
1192     unsigned RE2                : 1;
1193     unsigned RE3                : 1;
1194     unsigned                    : 1;
1195     unsigned                    : 1;
1196     unsigned                    : 1;
1197     unsigned RDPU               : 1;
1198     };
1199 
1200   struct
1201     {
1202     unsigned CK1SPP             : 1;
1203     unsigned CK2SPP             : 1;
1204     unsigned OESPP              : 1;
1205     unsigned                    : 1;
1206     unsigned                    : 1;
1207     unsigned                    : 1;
1208     unsigned                    : 1;
1209     unsigned                    : 1;
1210     };
1211 
1212   struct
1213     {
1214     unsigned RE                 : 4;
1215     unsigned                    : 4;
1216     };
1217   } __PORTEbits_t;
1218 
1219 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
1220 
1221 #define _PORTE_RE0              0x01
1222 #define _PORTE_CK1SPP           0x01
1223 #define _PORTE_RE1              0x02
1224 #define _PORTE_CK2SPP           0x02
1225 #define _PORTE_RE2              0x04
1226 #define _PORTE_OESPP            0x04
1227 #define _PORTE_RE3              0x08
1228 #define _PORTE_RDPU             0x80
1229 
1230 //==============================================================================
1231 
1232 
1233 //==============================================================================
1234 //        LATA Bits
1235 
1236 extern __at(0x0F89) __sfr LATA;
1237 
1238 typedef union
1239   {
1240   struct
1241     {
1242     unsigned LATA0              : 1;
1243     unsigned LATA1              : 1;
1244     unsigned LATA2              : 1;
1245     unsigned LATA3              : 1;
1246     unsigned LATA4              : 1;
1247     unsigned LATA5              : 1;
1248     unsigned LATA6              : 1;
1249     unsigned                    : 1;
1250     };
1251 
1252   struct
1253     {
1254     unsigned LATA               : 7;
1255     unsigned                    : 1;
1256     };
1257   } __LATAbits_t;
1258 
1259 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
1260 
1261 #define _LATA0                  0x01
1262 #define _LATA1                  0x02
1263 #define _LATA2                  0x04
1264 #define _LATA3                  0x08
1265 #define _LATA4                  0x10
1266 #define _LATA5                  0x20
1267 #define _LATA6                  0x40
1268 
1269 //==============================================================================
1270 
1271 
1272 //==============================================================================
1273 //        LATB Bits
1274 
1275 extern __at(0x0F8A) __sfr LATB;
1276 
1277 typedef struct
1278   {
1279   unsigned LATB0                : 1;
1280   unsigned LATB1                : 1;
1281   unsigned LATB2                : 1;
1282   unsigned LATB3                : 1;
1283   unsigned LATB4                : 1;
1284   unsigned LATB5                : 1;
1285   unsigned LATB6                : 1;
1286   unsigned LATB7                : 1;
1287   } __LATBbits_t;
1288 
1289 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
1290 
1291 #define _LATB0                  0x01
1292 #define _LATB1                  0x02
1293 #define _LATB2                  0x04
1294 #define _LATB3                  0x08
1295 #define _LATB4                  0x10
1296 #define _LATB5                  0x20
1297 #define _LATB6                  0x40
1298 #define _LATB7                  0x80
1299 
1300 //==============================================================================
1301 
1302 
1303 //==============================================================================
1304 //        LATC Bits
1305 
1306 extern __at(0x0F8B) __sfr LATC;
1307 
1308 typedef struct
1309   {
1310   unsigned LATC0                : 1;
1311   unsigned LATC1                : 1;
1312   unsigned LATC2                : 1;
1313   unsigned                      : 1;
1314   unsigned                      : 1;
1315   unsigned                      : 1;
1316   unsigned LATC6                : 1;
1317   unsigned LATC7                : 1;
1318   } __LATCbits_t;
1319 
1320 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
1321 
1322 #define _LATC0                  0x01
1323 #define _LATC1                  0x02
1324 #define _LATC2                  0x04
1325 #define _LATC6                  0x40
1326 #define _LATC7                  0x80
1327 
1328 //==============================================================================
1329 
1330 
1331 //==============================================================================
1332 //        LATD Bits
1333 
1334 extern __at(0x0F8C) __sfr LATD;
1335 
1336 typedef struct
1337   {
1338   unsigned LATD0                : 1;
1339   unsigned LATD1                : 1;
1340   unsigned LATD2                : 1;
1341   unsigned LATD3                : 1;
1342   unsigned LATD4                : 1;
1343   unsigned LATD5                : 1;
1344   unsigned LATD6                : 1;
1345   unsigned LATD7                : 1;
1346   } __LATDbits_t;
1347 
1348 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
1349 
1350 #define _LATD0                  0x01
1351 #define _LATD1                  0x02
1352 #define _LATD2                  0x04
1353 #define _LATD3                  0x08
1354 #define _LATD4                  0x10
1355 #define _LATD5                  0x20
1356 #define _LATD6                  0x40
1357 #define _LATD7                  0x80
1358 
1359 //==============================================================================
1360 
1361 
1362 //==============================================================================
1363 //        LATE Bits
1364 
1365 extern __at(0x0F8D) __sfr LATE;
1366 
1367 typedef union
1368   {
1369   struct
1370     {
1371     unsigned LATE0              : 1;
1372     unsigned LATE1              : 1;
1373     unsigned LATE2              : 1;
1374     unsigned                    : 1;
1375     unsigned                    : 1;
1376     unsigned                    : 1;
1377     unsigned                    : 1;
1378     unsigned                    : 1;
1379     };
1380 
1381   struct
1382     {
1383     unsigned LATE               : 3;
1384     unsigned                    : 5;
1385     };
1386   } __LATEbits_t;
1387 
1388 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
1389 
1390 #define _LATE0                  0x01
1391 #define _LATE1                  0x02
1392 #define _LATE2                  0x04
1393 
1394 //==============================================================================
1395 
1396 
1397 //==============================================================================
1398 //        DDRA Bits
1399 
1400 extern __at(0x0F92) __sfr DDRA;
1401 
1402 typedef union
1403   {
1404   struct
1405     {
1406     unsigned TRISA0             : 1;
1407     unsigned TRISA1             : 1;
1408     unsigned TRISA2             : 1;
1409     unsigned TRISA3             : 1;
1410     unsigned TRISA4             : 1;
1411     unsigned TRISA5             : 1;
1412     unsigned TRISA6             : 1;
1413     unsigned                    : 1;
1414     };
1415 
1416   struct
1417     {
1418     unsigned RA0                : 1;
1419     unsigned RA1                : 1;
1420     unsigned RA2                : 1;
1421     unsigned RA3                : 1;
1422     unsigned RA4                : 1;
1423     unsigned RA5                : 1;
1424     unsigned RA6                : 1;
1425     unsigned                    : 1;
1426     };
1427 
1428   struct
1429     {
1430     unsigned RA                 : 7;
1431     unsigned                    : 1;
1432     };
1433 
1434   struct
1435     {
1436     unsigned TRISA              : 7;
1437     unsigned                    : 1;
1438     };
1439   } __DDRAbits_t;
1440 
1441 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
1442 
1443 #define _TRISA0                 0x01
1444 #define _RA0                    0x01
1445 #define _TRISA1                 0x02
1446 #define _RA1                    0x02
1447 #define _TRISA2                 0x04
1448 #define _RA2                    0x04
1449 #define _TRISA3                 0x08
1450 #define _RA3                    0x08
1451 #define _TRISA4                 0x10
1452 #define _RA4                    0x10
1453 #define _TRISA5                 0x20
1454 #define _RA5                    0x20
1455 #define _TRISA6                 0x40
1456 #define _RA6                    0x40
1457 
1458 //==============================================================================
1459 
1460 
1461 //==============================================================================
1462 //        TRISA Bits
1463 
1464 extern __at(0x0F92) __sfr TRISA;
1465 
1466 typedef union
1467   {
1468   struct
1469     {
1470     unsigned TRISA0             : 1;
1471     unsigned TRISA1             : 1;
1472     unsigned TRISA2             : 1;
1473     unsigned TRISA3             : 1;
1474     unsigned TRISA4             : 1;
1475     unsigned TRISA5             : 1;
1476     unsigned TRISA6             : 1;
1477     unsigned                    : 1;
1478     };
1479 
1480   struct
1481     {
1482     unsigned RA0                : 1;
1483     unsigned RA1                : 1;
1484     unsigned RA2                : 1;
1485     unsigned RA3                : 1;
1486     unsigned RA4                : 1;
1487     unsigned RA5                : 1;
1488     unsigned RA6                : 1;
1489     unsigned                    : 1;
1490     };
1491 
1492   struct
1493     {
1494     unsigned TRISA              : 7;
1495     unsigned                    : 1;
1496     };
1497 
1498   struct
1499     {
1500     unsigned RA                 : 7;
1501     unsigned                    : 1;
1502     };
1503   } __TRISAbits_t;
1504 
1505 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
1506 
1507 #define _TRISA_TRISA0           0x01
1508 #define _TRISA_RA0              0x01
1509 #define _TRISA_TRISA1           0x02
1510 #define _TRISA_RA1              0x02
1511 #define _TRISA_TRISA2           0x04
1512 #define _TRISA_RA2              0x04
1513 #define _TRISA_TRISA3           0x08
1514 #define _TRISA_RA3              0x08
1515 #define _TRISA_TRISA4           0x10
1516 #define _TRISA_RA4              0x10
1517 #define _TRISA_TRISA5           0x20
1518 #define _TRISA_RA5              0x20
1519 #define _TRISA_TRISA6           0x40
1520 #define _TRISA_RA6              0x40
1521 
1522 //==============================================================================
1523 
1524 
1525 //==============================================================================
1526 //        DDRB Bits
1527 
1528 extern __at(0x0F93) __sfr DDRB;
1529 
1530 typedef union
1531   {
1532   struct
1533     {
1534     unsigned TRISB0             : 1;
1535     unsigned TRISB1             : 1;
1536     unsigned TRISB2             : 1;
1537     unsigned TRISB3             : 1;
1538     unsigned TRISB4             : 1;
1539     unsigned TRISB5             : 1;
1540     unsigned TRISB6             : 1;
1541     unsigned TRISB7             : 1;
1542     };
1543 
1544   struct
1545     {
1546     unsigned RB0                : 1;
1547     unsigned RB1                : 1;
1548     unsigned RB2                : 1;
1549     unsigned RB3                : 1;
1550     unsigned RB4                : 1;
1551     unsigned RB5                : 1;
1552     unsigned RB6                : 1;
1553     unsigned RB7                : 1;
1554     };
1555   } __DDRBbits_t;
1556 
1557 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1558 
1559 #define _TRISB0                 0x01
1560 #define _RB0                    0x01
1561 #define _TRISB1                 0x02
1562 #define _RB1                    0x02
1563 #define _TRISB2                 0x04
1564 #define _RB2                    0x04
1565 #define _TRISB3                 0x08
1566 #define _RB3                    0x08
1567 #define _TRISB4                 0x10
1568 #define _RB4                    0x10
1569 #define _TRISB5                 0x20
1570 #define _RB5                    0x20
1571 #define _TRISB6                 0x40
1572 #define _RB6                    0x40
1573 #define _TRISB7                 0x80
1574 #define _RB7                    0x80
1575 
1576 //==============================================================================
1577 
1578 
1579 //==============================================================================
1580 //        TRISB Bits
1581 
1582 extern __at(0x0F93) __sfr TRISB;
1583 
1584 typedef union
1585   {
1586   struct
1587     {
1588     unsigned TRISB0             : 1;
1589     unsigned TRISB1             : 1;
1590     unsigned TRISB2             : 1;
1591     unsigned TRISB3             : 1;
1592     unsigned TRISB4             : 1;
1593     unsigned TRISB5             : 1;
1594     unsigned TRISB6             : 1;
1595     unsigned TRISB7             : 1;
1596     };
1597 
1598   struct
1599     {
1600     unsigned RB0                : 1;
1601     unsigned RB1                : 1;
1602     unsigned RB2                : 1;
1603     unsigned RB3                : 1;
1604     unsigned RB4                : 1;
1605     unsigned RB5                : 1;
1606     unsigned RB6                : 1;
1607     unsigned RB7                : 1;
1608     };
1609   } __TRISBbits_t;
1610 
1611 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1612 
1613 #define _TRISB_TRISB0           0x01
1614 #define _TRISB_RB0              0x01
1615 #define _TRISB_TRISB1           0x02
1616 #define _TRISB_RB1              0x02
1617 #define _TRISB_TRISB2           0x04
1618 #define _TRISB_RB2              0x04
1619 #define _TRISB_TRISB3           0x08
1620 #define _TRISB_RB3              0x08
1621 #define _TRISB_TRISB4           0x10
1622 #define _TRISB_RB4              0x10
1623 #define _TRISB_TRISB5           0x20
1624 #define _TRISB_RB5              0x20
1625 #define _TRISB_TRISB6           0x40
1626 #define _TRISB_RB6              0x40
1627 #define _TRISB_TRISB7           0x80
1628 #define _TRISB_RB7              0x80
1629 
1630 //==============================================================================
1631 
1632 
1633 //==============================================================================
1634 //        DDRC Bits
1635 
1636 extern __at(0x0F94) __sfr DDRC;
1637 
1638 typedef union
1639   {
1640   struct
1641     {
1642     unsigned TRISC0             : 1;
1643     unsigned TRISC1             : 1;
1644     unsigned TRISC2             : 1;
1645     unsigned                    : 1;
1646     unsigned                    : 1;
1647     unsigned                    : 1;
1648     unsigned TRISC6             : 1;
1649     unsigned TRISC7             : 1;
1650     };
1651 
1652   struct
1653     {
1654     unsigned RC0                : 1;
1655     unsigned RC1                : 1;
1656     unsigned RC2                : 1;
1657     unsigned                    : 1;
1658     unsigned                    : 1;
1659     unsigned                    : 1;
1660     unsigned RC6                : 1;
1661     unsigned RC7                : 1;
1662     };
1663   } __DDRCbits_t;
1664 
1665 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1666 
1667 #define _TRISC0                 0x01
1668 #define _RC0                    0x01
1669 #define _TRISC1                 0x02
1670 #define _RC1                    0x02
1671 #define _TRISC2                 0x04
1672 #define _RC2                    0x04
1673 #define _TRISC6                 0x40
1674 #define _RC6                    0x40
1675 #define _TRISC7                 0x80
1676 #define _RC7                    0x80
1677 
1678 //==============================================================================
1679 
1680 
1681 //==============================================================================
1682 //        TRISC Bits
1683 
1684 extern __at(0x0F94) __sfr TRISC;
1685 
1686 typedef union
1687   {
1688   struct
1689     {
1690     unsigned TRISC0             : 1;
1691     unsigned TRISC1             : 1;
1692     unsigned TRISC2             : 1;
1693     unsigned                    : 1;
1694     unsigned                    : 1;
1695     unsigned                    : 1;
1696     unsigned TRISC6             : 1;
1697     unsigned TRISC7             : 1;
1698     };
1699 
1700   struct
1701     {
1702     unsigned RC0                : 1;
1703     unsigned RC1                : 1;
1704     unsigned RC2                : 1;
1705     unsigned                    : 1;
1706     unsigned                    : 1;
1707     unsigned                    : 1;
1708     unsigned RC6                : 1;
1709     unsigned RC7                : 1;
1710     };
1711   } __TRISCbits_t;
1712 
1713 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1714 
1715 #define _TRISC_TRISC0           0x01
1716 #define _TRISC_RC0              0x01
1717 #define _TRISC_TRISC1           0x02
1718 #define _TRISC_RC1              0x02
1719 #define _TRISC_TRISC2           0x04
1720 #define _TRISC_RC2              0x04
1721 #define _TRISC_TRISC6           0x40
1722 #define _TRISC_RC6              0x40
1723 #define _TRISC_TRISC7           0x80
1724 #define _TRISC_RC7              0x80
1725 
1726 //==============================================================================
1727 
1728 
1729 //==============================================================================
1730 //        DDRD Bits
1731 
1732 extern __at(0x0F95) __sfr DDRD;
1733 
1734 typedef union
1735   {
1736   struct
1737     {
1738     unsigned TRISD0             : 1;
1739     unsigned TRISD1             : 1;
1740     unsigned TRISD2             : 1;
1741     unsigned TRISD3             : 1;
1742     unsigned TRISD4             : 1;
1743     unsigned TRISD5             : 1;
1744     unsigned TRISD6             : 1;
1745     unsigned TRISD7             : 1;
1746     };
1747 
1748   struct
1749     {
1750     unsigned RD0                : 1;
1751     unsigned RD1                : 1;
1752     unsigned RD2                : 1;
1753     unsigned RD3                : 1;
1754     unsigned RD4                : 1;
1755     unsigned RD5                : 1;
1756     unsigned RD6                : 1;
1757     unsigned RD7                : 1;
1758     };
1759   } __DDRDbits_t;
1760 
1761 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
1762 
1763 #define _TRISD0                 0x01
1764 #define _RD0                    0x01
1765 #define _TRISD1                 0x02
1766 #define _RD1                    0x02
1767 #define _TRISD2                 0x04
1768 #define _RD2                    0x04
1769 #define _TRISD3                 0x08
1770 #define _RD3                    0x08
1771 #define _TRISD4                 0x10
1772 #define _RD4                    0x10
1773 #define _TRISD5                 0x20
1774 #define _RD5                    0x20
1775 #define _TRISD6                 0x40
1776 #define _RD6                    0x40
1777 #define _TRISD7                 0x80
1778 #define _RD7                    0x80
1779 
1780 //==============================================================================
1781 
1782 
1783 //==============================================================================
1784 //        TRISD Bits
1785 
1786 extern __at(0x0F95) __sfr TRISD;
1787 
1788 typedef union
1789   {
1790   struct
1791     {
1792     unsigned TRISD0             : 1;
1793     unsigned TRISD1             : 1;
1794     unsigned TRISD2             : 1;
1795     unsigned TRISD3             : 1;
1796     unsigned TRISD4             : 1;
1797     unsigned TRISD5             : 1;
1798     unsigned TRISD6             : 1;
1799     unsigned TRISD7             : 1;
1800     };
1801 
1802   struct
1803     {
1804     unsigned RD0                : 1;
1805     unsigned RD1                : 1;
1806     unsigned RD2                : 1;
1807     unsigned RD3                : 1;
1808     unsigned RD4                : 1;
1809     unsigned RD5                : 1;
1810     unsigned RD6                : 1;
1811     unsigned RD7                : 1;
1812     };
1813   } __TRISDbits_t;
1814 
1815 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
1816 
1817 #define _TRISD_TRISD0           0x01
1818 #define _TRISD_RD0              0x01
1819 #define _TRISD_TRISD1           0x02
1820 #define _TRISD_RD1              0x02
1821 #define _TRISD_TRISD2           0x04
1822 #define _TRISD_RD2              0x04
1823 #define _TRISD_TRISD3           0x08
1824 #define _TRISD_RD3              0x08
1825 #define _TRISD_TRISD4           0x10
1826 #define _TRISD_RD4              0x10
1827 #define _TRISD_TRISD5           0x20
1828 #define _TRISD_RD5              0x20
1829 #define _TRISD_TRISD6           0x40
1830 #define _TRISD_RD6              0x40
1831 #define _TRISD_TRISD7           0x80
1832 #define _TRISD_RD7              0x80
1833 
1834 //==============================================================================
1835 
1836 
1837 //==============================================================================
1838 //        DDRE Bits
1839 
1840 extern __at(0x0F96) __sfr DDRE;
1841 
1842 typedef union
1843   {
1844   struct
1845     {
1846     unsigned TRISE0             : 1;
1847     unsigned TRISE1             : 1;
1848     unsigned TRISE2             : 1;
1849     unsigned                    : 1;
1850     unsigned                    : 1;
1851     unsigned                    : 1;
1852     unsigned                    : 1;
1853     unsigned                    : 1;
1854     };
1855 
1856   struct
1857     {
1858     unsigned RE0                : 1;
1859     unsigned RE1                : 1;
1860     unsigned RE2                : 1;
1861     unsigned                    : 1;
1862     unsigned                    : 1;
1863     unsigned                    : 1;
1864     unsigned                    : 1;
1865     unsigned                    : 1;
1866     };
1867 
1868   struct
1869     {
1870     unsigned RE                 : 3;
1871     unsigned                    : 5;
1872     };
1873 
1874   struct
1875     {
1876     unsigned TRISE              : 3;
1877     unsigned                    : 5;
1878     };
1879   } __DDREbits_t;
1880 
1881 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1882 
1883 #define _TRISE0                 0x01
1884 #define _RE0                    0x01
1885 #define _TRISE1                 0x02
1886 #define _RE1                    0x02
1887 #define _TRISE2                 0x04
1888 #define _RE2                    0x04
1889 
1890 //==============================================================================
1891 
1892 
1893 //==============================================================================
1894 //        TRISE Bits
1895 
1896 extern __at(0x0F96) __sfr TRISE;
1897 
1898 typedef union
1899   {
1900   struct
1901     {
1902     unsigned TRISE0             : 1;
1903     unsigned TRISE1             : 1;
1904     unsigned TRISE2             : 1;
1905     unsigned                    : 1;
1906     unsigned                    : 1;
1907     unsigned                    : 1;
1908     unsigned                    : 1;
1909     unsigned                    : 1;
1910     };
1911 
1912   struct
1913     {
1914     unsigned RE0                : 1;
1915     unsigned RE1                : 1;
1916     unsigned RE2                : 1;
1917     unsigned                    : 1;
1918     unsigned                    : 1;
1919     unsigned                    : 1;
1920     unsigned                    : 1;
1921     unsigned                    : 1;
1922     };
1923 
1924   struct
1925     {
1926     unsigned RE                 : 3;
1927     unsigned                    : 5;
1928     };
1929 
1930   struct
1931     {
1932     unsigned TRISE              : 3;
1933     unsigned                    : 5;
1934     };
1935   } __TRISEbits_t;
1936 
1937 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1938 
1939 #define _TRISE_TRISE0           0x01
1940 #define _TRISE_RE0              0x01
1941 #define _TRISE_TRISE1           0x02
1942 #define _TRISE_RE1              0x02
1943 #define _TRISE_TRISE2           0x04
1944 #define _TRISE_RE2              0x04
1945 
1946 //==============================================================================
1947 
1948 
1949 //==============================================================================
1950 //        OSCTUNE Bits
1951 
1952 extern __at(0x0F9B) __sfr OSCTUNE;
1953 
1954 typedef union
1955   {
1956   struct
1957     {
1958     unsigned TUN0               : 1;
1959     unsigned TUN1               : 1;
1960     unsigned TUN2               : 1;
1961     unsigned TUN3               : 1;
1962     unsigned TUN4               : 1;
1963     unsigned                    : 1;
1964     unsigned                    : 1;
1965     unsigned INTSRC             : 1;
1966     };
1967 
1968   struct
1969     {
1970     unsigned TUN                : 5;
1971     unsigned                    : 3;
1972     };
1973   } __OSCTUNEbits_t;
1974 
1975 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1976 
1977 #define _TUN0                   0x01
1978 #define _TUN1                   0x02
1979 #define _TUN2                   0x04
1980 #define _TUN3                   0x08
1981 #define _TUN4                   0x10
1982 #define _INTSRC                 0x80
1983 
1984 //==============================================================================
1985 
1986 
1987 //==============================================================================
1988 //        PIE1 Bits
1989 
1990 extern __at(0x0F9D) __sfr PIE1;
1991 
1992 typedef struct
1993   {
1994   unsigned TMR1IE               : 1;
1995   unsigned TMR2IE               : 1;
1996   unsigned CCP1IE               : 1;
1997   unsigned SSPIE                : 1;
1998   unsigned TXIE                 : 1;
1999   unsigned RCIE                 : 1;
2000   unsigned ADIE                 : 1;
2001   unsigned SPPIE                : 1;
2002   } __PIE1bits_t;
2003 
2004 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
2005 
2006 #define _TMR1IE                 0x01
2007 #define _TMR2IE                 0x02
2008 #define _CCP1IE                 0x04
2009 #define _SSPIE                  0x08
2010 #define _TXIE                   0x10
2011 #define _RCIE                   0x20
2012 #define _ADIE                   0x40
2013 #define _SPPIE                  0x80
2014 
2015 //==============================================================================
2016 
2017 
2018 //==============================================================================
2019 //        PIR1 Bits
2020 
2021 extern __at(0x0F9E) __sfr PIR1;
2022 
2023 typedef struct
2024   {
2025   unsigned TMR1IF               : 1;
2026   unsigned TMR2IF               : 1;
2027   unsigned CCP1IF               : 1;
2028   unsigned SSPIF                : 1;
2029   unsigned TXIF                 : 1;
2030   unsigned RCIF                 : 1;
2031   unsigned ADIF                 : 1;
2032   unsigned SPPIF                : 1;
2033   } __PIR1bits_t;
2034 
2035 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
2036 
2037 #define _TMR1IF                 0x01
2038 #define _TMR2IF                 0x02
2039 #define _CCP1IF                 0x04
2040 #define _SSPIF                  0x08
2041 #define _TXIF                   0x10
2042 #define _RCIF                   0x20
2043 #define _ADIF                   0x40
2044 #define _SPPIF                  0x80
2045 
2046 //==============================================================================
2047 
2048 
2049 //==============================================================================
2050 //        IPR1 Bits
2051 
2052 extern __at(0x0F9F) __sfr IPR1;
2053 
2054 typedef struct
2055   {
2056   unsigned TMR1IP               : 1;
2057   unsigned TMR2IP               : 1;
2058   unsigned CCP1IP               : 1;
2059   unsigned SSPIP                : 1;
2060   unsigned TXIP                 : 1;
2061   unsigned RCIP                 : 1;
2062   unsigned ADIP                 : 1;
2063   unsigned SPPIP                : 1;
2064   } __IPR1bits_t;
2065 
2066 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
2067 
2068 #define _TMR1IP                 0x01
2069 #define _TMR2IP                 0x02
2070 #define _CCP1IP                 0x04
2071 #define _SSPIP                  0x08
2072 #define _TXIP                   0x10
2073 #define _RCIP                   0x20
2074 #define _ADIP                   0x40
2075 #define _SPPIP                  0x80
2076 
2077 //==============================================================================
2078 
2079 
2080 //==============================================================================
2081 //        PIE2 Bits
2082 
2083 extern __at(0x0FA0) __sfr PIE2;
2084 
2085 typedef union
2086   {
2087   struct
2088     {
2089     unsigned CCP2IE             : 1;
2090     unsigned TMR3IE             : 1;
2091     unsigned HLVDIE             : 1;
2092     unsigned BCLIE              : 1;
2093     unsigned EEIE               : 1;
2094     unsigned USBIE              : 1;
2095     unsigned CMIE               : 1;
2096     unsigned OSCFIE             : 1;
2097     };
2098 
2099   struct
2100     {
2101     unsigned                    : 1;
2102     unsigned                    : 1;
2103     unsigned LVDIE              : 1;
2104     unsigned                    : 1;
2105     unsigned                    : 1;
2106     unsigned                    : 1;
2107     unsigned                    : 1;
2108     unsigned                    : 1;
2109     };
2110   } __PIE2bits_t;
2111 
2112 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
2113 
2114 #define _CCP2IE                 0x01
2115 #define _TMR3IE                 0x02
2116 #define _HLVDIE                 0x04
2117 #define _LVDIE                  0x04
2118 #define _BCLIE                  0x08
2119 #define _EEIE                   0x10
2120 #define _USBIE                  0x20
2121 #define _CMIE                   0x40
2122 #define _OSCFIE                 0x80
2123 
2124 //==============================================================================
2125 
2126 
2127 //==============================================================================
2128 //        PIR2 Bits
2129 
2130 extern __at(0x0FA1) __sfr PIR2;
2131 
2132 typedef union
2133   {
2134   struct
2135     {
2136     unsigned CCP2IF             : 1;
2137     unsigned TMR3IF             : 1;
2138     unsigned HLVDIF             : 1;
2139     unsigned BCLIF              : 1;
2140     unsigned EEIF               : 1;
2141     unsigned USBIF              : 1;
2142     unsigned CMIF               : 1;
2143     unsigned OSCFIF             : 1;
2144     };
2145 
2146   struct
2147     {
2148     unsigned                    : 1;
2149     unsigned                    : 1;
2150     unsigned LVDIF              : 1;
2151     unsigned                    : 1;
2152     unsigned                    : 1;
2153     unsigned                    : 1;
2154     unsigned                    : 1;
2155     unsigned                    : 1;
2156     };
2157   } __PIR2bits_t;
2158 
2159 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
2160 
2161 #define _CCP2IF                 0x01
2162 #define _TMR3IF                 0x02
2163 #define _HLVDIF                 0x04
2164 #define _LVDIF                  0x04
2165 #define _BCLIF                  0x08
2166 #define _EEIF                   0x10
2167 #define _USBIF                  0x20
2168 #define _CMIF                   0x40
2169 #define _OSCFIF                 0x80
2170 
2171 //==============================================================================
2172 
2173 
2174 //==============================================================================
2175 //        IPR2 Bits
2176 
2177 extern __at(0x0FA2) __sfr IPR2;
2178 
2179 typedef union
2180   {
2181   struct
2182     {
2183     unsigned CCP2IP             : 1;
2184     unsigned TMR3IP             : 1;
2185     unsigned HLVDIP             : 1;
2186     unsigned BCLIP              : 1;
2187     unsigned EEIP               : 1;
2188     unsigned USBIP              : 1;
2189     unsigned CMIP               : 1;
2190     unsigned OSCFIP             : 1;
2191     };
2192 
2193   struct
2194     {
2195     unsigned                    : 1;
2196     unsigned                    : 1;
2197     unsigned LVDIP              : 1;
2198     unsigned                    : 1;
2199     unsigned                    : 1;
2200     unsigned                    : 1;
2201     unsigned                    : 1;
2202     unsigned                    : 1;
2203     };
2204   } __IPR2bits_t;
2205 
2206 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
2207 
2208 #define _CCP2IP                 0x01
2209 #define _TMR3IP                 0x02
2210 #define _HLVDIP                 0x04
2211 #define _LVDIP                  0x04
2212 #define _BCLIP                  0x08
2213 #define _EEIP                   0x10
2214 #define _USBIP                  0x20
2215 #define _CMIP                   0x40
2216 #define _OSCFIP                 0x80
2217 
2218 //==============================================================================
2219 
2220 
2221 //==============================================================================
2222 //        EECON1 Bits
2223 
2224 extern __at(0x0FA6) __sfr EECON1;
2225 
2226 typedef struct
2227   {
2228   unsigned RD                   : 1;
2229   unsigned WR                   : 1;
2230   unsigned WREN                 : 1;
2231   unsigned WRERR                : 1;
2232   unsigned FREE                 : 1;
2233   unsigned                      : 1;
2234   unsigned CFGS                 : 1;
2235   unsigned EEPGD                : 1;
2236   } __EECON1bits_t;
2237 
2238 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
2239 
2240 #define _RD                     0x01
2241 #define _WR                     0x02
2242 #define _WREN                   0x04
2243 #define _WRERR                  0x08
2244 #define _FREE                   0x10
2245 #define _CFGS                   0x40
2246 #define _EEPGD                  0x80
2247 
2248 //==============================================================================
2249 
2250 extern __at(0x0FA7) __sfr EECON2;
2251 extern __at(0x0FA8) __sfr EEDATA;
2252 extern __at(0x0FA9) __sfr EEADR;
2253 
2254 //==============================================================================
2255 //        RCSTA Bits
2256 
2257 extern __at(0x0FAB) __sfr RCSTA;
2258 
2259 typedef union
2260   {
2261   struct
2262     {
2263     unsigned RX9D               : 1;
2264     unsigned OERR               : 1;
2265     unsigned FERR               : 1;
2266     unsigned ADDEN              : 1;
2267     unsigned CREN               : 1;
2268     unsigned SREN               : 1;
2269     unsigned RX9                : 1;
2270     unsigned SPEN               : 1;
2271     };
2272 
2273   struct
2274     {
2275     unsigned                    : 1;
2276     unsigned                    : 1;
2277     unsigned                    : 1;
2278     unsigned ADEN               : 1;
2279     unsigned                    : 1;
2280     unsigned                    : 1;
2281     unsigned                    : 1;
2282     unsigned                    : 1;
2283     };
2284   } __RCSTAbits_t;
2285 
2286 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
2287 
2288 #define _RX9D                   0x01
2289 #define _OERR                   0x02
2290 #define _FERR                   0x04
2291 #define _ADDEN                  0x08
2292 #define _ADEN                   0x08
2293 #define _CREN                   0x10
2294 #define _SREN                   0x20
2295 #define _RX9                    0x40
2296 #define _SPEN                   0x80
2297 
2298 //==============================================================================
2299 
2300 
2301 //==============================================================================
2302 //        TXSTA Bits
2303 
2304 extern __at(0x0FAC) __sfr TXSTA;
2305 
2306 typedef struct
2307   {
2308   unsigned TX9D                 : 1;
2309   unsigned TRMT                 : 1;
2310   unsigned BRGH                 : 1;
2311   unsigned SENDB                : 1;
2312   unsigned SYNC                 : 1;
2313   unsigned TXEN                 : 1;
2314   unsigned TX9                  : 1;
2315   unsigned CSRC                 : 1;
2316   } __TXSTAbits_t;
2317 
2318 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
2319 
2320 #define _TX9D                   0x01
2321 #define _TRMT                   0x02
2322 #define _BRGH                   0x04
2323 #define _SENDB                  0x08
2324 #define _SYNC                   0x10
2325 #define _TXEN                   0x20
2326 #define _TX9                    0x40
2327 #define _CSRC                   0x80
2328 
2329 //==============================================================================
2330 
2331 extern __at(0x0FAD) __sfr TXREG;
2332 extern __at(0x0FAE) __sfr RCREG;
2333 extern __at(0x0FAF) __sfr SPBRG;
2334 extern __at(0x0FB0) __sfr SPBRGH;
2335 
2336 //==============================================================================
2337 //        T3CON Bits
2338 
2339 extern __at(0x0FB1) __sfr T3CON;
2340 
2341 typedef union
2342   {
2343   struct
2344     {
2345     unsigned TMR3ON             : 1;
2346     unsigned TMR3CS             : 1;
2347     unsigned NOT_T3SYNC         : 1;
2348     unsigned T3CCP1             : 1;
2349     unsigned T3CKPS0            : 1;
2350     unsigned T3CKPS1            : 1;
2351     unsigned T3CCP2             : 1;
2352     unsigned RD16               : 1;
2353     };
2354 
2355   struct
2356     {
2357     unsigned                    : 1;
2358     unsigned                    : 1;
2359     unsigned T3SYNC             : 1;
2360     unsigned                    : 1;
2361     unsigned                    : 1;
2362     unsigned                    : 1;
2363     unsigned                    : 1;
2364     unsigned                    : 1;
2365     };
2366 
2367   struct
2368     {
2369     unsigned                    : 1;
2370     unsigned                    : 1;
2371     unsigned T3NSYNC            : 1;
2372     unsigned                    : 1;
2373     unsigned                    : 1;
2374     unsigned                    : 1;
2375     unsigned                    : 1;
2376     unsigned                    : 1;
2377     };
2378 
2379   struct
2380     {
2381     unsigned                    : 4;
2382     unsigned T3CKPS             : 2;
2383     unsigned                    : 2;
2384     };
2385   } __T3CONbits_t;
2386 
2387 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
2388 
2389 #define _T3CON_TMR3ON           0x01
2390 #define _T3CON_TMR3CS           0x02
2391 #define _T3CON_NOT_T3SYNC       0x04
2392 #define _T3CON_T3SYNC           0x04
2393 #define _T3CON_T3NSYNC          0x04
2394 #define _T3CON_T3CCP1           0x08
2395 #define _T3CON_T3CKPS0          0x10
2396 #define _T3CON_T3CKPS1          0x20
2397 #define _T3CON_T3CCP2           0x40
2398 #define _T3CON_RD16             0x80
2399 
2400 //==============================================================================
2401 
2402 extern __at(0x0FB2) __sfr TMR3;
2403 extern __at(0x0FB2) __sfr TMR3L;
2404 extern __at(0x0FB3) __sfr TMR3H;
2405 
2406 //==============================================================================
2407 //        CMCON Bits
2408 
2409 extern __at(0x0FB4) __sfr CMCON;
2410 
2411 typedef union
2412   {
2413   struct
2414     {
2415     unsigned CM0                : 1;
2416     unsigned CM1                : 1;
2417     unsigned CM2                : 1;
2418     unsigned CIS                : 1;
2419     unsigned C1INV              : 1;
2420     unsigned C2INV              : 1;
2421     unsigned C1OUT              : 1;
2422     unsigned C2OUT              : 1;
2423     };
2424 
2425   struct
2426     {
2427     unsigned CM                 : 3;
2428     unsigned                    : 5;
2429     };
2430   } __CMCONbits_t;
2431 
2432 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
2433 
2434 #define _CM0                    0x01
2435 #define _CM1                    0x02
2436 #define _CM2                    0x04
2437 #define _CIS                    0x08
2438 #define _C1INV                  0x10
2439 #define _C2INV                  0x20
2440 #define _C1OUT                  0x40
2441 #define _C2OUT                  0x80
2442 
2443 //==============================================================================
2444 
2445 
2446 //==============================================================================
2447 //        CVRCON Bits
2448 
2449 extern __at(0x0FB5) __sfr CVRCON;
2450 
2451 typedef union
2452   {
2453   struct
2454     {
2455     unsigned CVR0               : 1;
2456     unsigned CVR1               : 1;
2457     unsigned CVR2               : 1;
2458     unsigned CVR3               : 1;
2459     unsigned CVRSS              : 1;
2460     unsigned CVRR               : 1;
2461     unsigned CVROE              : 1;
2462     unsigned CVREN              : 1;
2463     };
2464 
2465   struct
2466     {
2467     unsigned                    : 1;
2468     unsigned                    : 1;
2469     unsigned                    : 1;
2470     unsigned                    : 1;
2471     unsigned CVREF              : 1;
2472     unsigned                    : 1;
2473     unsigned                    : 1;
2474     unsigned                    : 1;
2475     };
2476 
2477   struct
2478     {
2479     unsigned CVR                : 4;
2480     unsigned                    : 4;
2481     };
2482   } __CVRCONbits_t;
2483 
2484 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
2485 
2486 #define _CVR0                   0x01
2487 #define _CVR1                   0x02
2488 #define _CVR2                   0x04
2489 #define _CVR3                   0x08
2490 #define _CVRSS                  0x10
2491 #define _CVREF                  0x10
2492 #define _CVRR                   0x20
2493 #define _CVROE                  0x40
2494 #define _CVREN                  0x80
2495 
2496 //==============================================================================
2497 
2498 
2499 //==============================================================================
2500 //        CCP1AS Bits
2501 
2502 extern __at(0x0FB6) __sfr CCP1AS;
2503 
2504 typedef union
2505   {
2506   struct
2507     {
2508     unsigned PSSBD0             : 1;
2509     unsigned PSSBD1             : 1;
2510     unsigned PSSAC0             : 1;
2511     unsigned PSSAC1             : 1;
2512     unsigned ECCPAS0            : 1;
2513     unsigned ECCPAS1            : 1;
2514     unsigned ECCPAS2            : 1;
2515     unsigned ECCPASE            : 1;
2516     };
2517 
2518   struct
2519     {
2520     unsigned PSSBD              : 2;
2521     unsigned                    : 6;
2522     };
2523 
2524   struct
2525     {
2526     unsigned                    : 2;
2527     unsigned PSSAC              : 2;
2528     unsigned                    : 4;
2529     };
2530 
2531   struct
2532     {
2533     unsigned                    : 4;
2534     unsigned ECCPAS             : 3;
2535     unsigned                    : 1;
2536     };
2537   } __CCP1ASbits_t;
2538 
2539 extern __at(0x0FB6) volatile __CCP1ASbits_t CCP1ASbits;
2540 
2541 #define _PSSBD0                 0x01
2542 #define _PSSBD1                 0x02
2543 #define _PSSAC0                 0x04
2544 #define _PSSAC1                 0x08
2545 #define _ECCPAS0                0x10
2546 #define _ECCPAS1                0x20
2547 #define _ECCPAS2                0x40
2548 #define _ECCPASE                0x80
2549 
2550 //==============================================================================
2551 
2552 
2553 //==============================================================================
2554 //        ECCP1AS Bits
2555 
2556 extern __at(0x0FB6) __sfr ECCP1AS;
2557 
2558 typedef union
2559   {
2560   struct
2561     {
2562     unsigned PSSBD0             : 1;
2563     unsigned PSSBD1             : 1;
2564     unsigned PSSAC0             : 1;
2565     unsigned PSSAC1             : 1;
2566     unsigned ECCPAS0            : 1;
2567     unsigned ECCPAS1            : 1;
2568     unsigned ECCPAS2            : 1;
2569     unsigned ECCPASE            : 1;
2570     };
2571 
2572   struct
2573     {
2574     unsigned PSSBD              : 2;
2575     unsigned                    : 6;
2576     };
2577 
2578   struct
2579     {
2580     unsigned                    : 2;
2581     unsigned PSSAC              : 2;
2582     unsigned                    : 4;
2583     };
2584 
2585   struct
2586     {
2587     unsigned                    : 4;
2588     unsigned ECCPAS             : 3;
2589     unsigned                    : 1;
2590     };
2591   } __ECCP1ASbits_t;
2592 
2593 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
2594 
2595 #define _ECCP1AS_PSSBD0         0x01
2596 #define _ECCP1AS_PSSBD1         0x02
2597 #define _ECCP1AS_PSSAC0         0x04
2598 #define _ECCP1AS_PSSAC1         0x08
2599 #define _ECCP1AS_ECCPAS0        0x10
2600 #define _ECCP1AS_ECCPAS1        0x20
2601 #define _ECCP1AS_ECCPAS2        0x40
2602 #define _ECCP1AS_ECCPASE        0x80
2603 
2604 //==============================================================================
2605 
2606 
2607 //==============================================================================
2608 //        CCP1DEL Bits
2609 
2610 extern __at(0x0FB7) __sfr CCP1DEL;
2611 
2612 typedef union
2613   {
2614   struct
2615     {
2616     unsigned PDC0               : 1;
2617     unsigned PDC1               : 1;
2618     unsigned PDC2               : 1;
2619     unsigned PDC3               : 1;
2620     unsigned PDC4               : 1;
2621     unsigned PDC5               : 1;
2622     unsigned PDC6               : 1;
2623     unsigned PRSEN              : 1;
2624     };
2625 
2626   struct
2627     {
2628     unsigned PDC                : 7;
2629     unsigned                    : 1;
2630     };
2631   } __CCP1DELbits_t;
2632 
2633 extern __at(0x0FB7) volatile __CCP1DELbits_t CCP1DELbits;
2634 
2635 #define _PDC0                   0x01
2636 #define _PDC1                   0x02
2637 #define _PDC2                   0x04
2638 #define _PDC3                   0x08
2639 #define _PDC4                   0x10
2640 #define _PDC5                   0x20
2641 #define _PDC6                   0x40
2642 #define _PRSEN                  0x80
2643 
2644 //==============================================================================
2645 
2646 
2647 //==============================================================================
2648 //        ECCP1DEL Bits
2649 
2650 extern __at(0x0FB7) __sfr ECCP1DEL;
2651 
2652 typedef union
2653   {
2654   struct
2655     {
2656     unsigned PDC0               : 1;
2657     unsigned PDC1               : 1;
2658     unsigned PDC2               : 1;
2659     unsigned PDC3               : 1;
2660     unsigned PDC4               : 1;
2661     unsigned PDC5               : 1;
2662     unsigned PDC6               : 1;
2663     unsigned PRSEN              : 1;
2664     };
2665 
2666   struct
2667     {
2668     unsigned PDC                : 7;
2669     unsigned                    : 1;
2670     };
2671   } __ECCP1DELbits_t;
2672 
2673 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
2674 
2675 #define _ECCP1DEL_PDC0          0x01
2676 #define _ECCP1DEL_PDC1          0x02
2677 #define _ECCP1DEL_PDC2          0x04
2678 #define _ECCP1DEL_PDC3          0x08
2679 #define _ECCP1DEL_PDC4          0x10
2680 #define _ECCP1DEL_PDC5          0x20
2681 #define _ECCP1DEL_PDC6          0x40
2682 #define _ECCP1DEL_PRSEN         0x80
2683 
2684 //==============================================================================
2685 
2686 
2687 //==============================================================================
2688 //        BAUDCON Bits
2689 
2690 extern __at(0x0FB8) __sfr BAUDCON;
2691 
2692 typedef union
2693   {
2694   struct
2695     {
2696     unsigned ABDEN              : 1;
2697     unsigned WUE                : 1;
2698     unsigned                    : 1;
2699     unsigned BRG16              : 1;
2700     unsigned TXCKP              : 1;
2701     unsigned RXDTP              : 1;
2702     unsigned RCIDL              : 1;
2703     unsigned ABDOVF             : 1;
2704     };
2705 
2706   struct
2707     {
2708     unsigned                    : 1;
2709     unsigned                    : 1;
2710     unsigned                    : 1;
2711     unsigned                    : 1;
2712     unsigned SCKP               : 1;
2713     unsigned                    : 1;
2714     unsigned RCMT               : 1;
2715     unsigned                    : 1;
2716     };
2717   } __BAUDCONbits_t;
2718 
2719 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
2720 
2721 #define _ABDEN                  0x01
2722 #define _WUE                    0x02
2723 #define _BRG16                  0x08
2724 #define _TXCKP                  0x10
2725 #define _SCKP                   0x10
2726 #define _RXDTP                  0x20
2727 #define _RCIDL                  0x40
2728 #define _RCMT                   0x40
2729 #define _ABDOVF                 0x80
2730 
2731 //==============================================================================
2732 
2733 
2734 //==============================================================================
2735 //        BAUDCTL Bits
2736 
2737 extern __at(0x0FB8) __sfr BAUDCTL;
2738 
2739 typedef union
2740   {
2741   struct
2742     {
2743     unsigned ABDEN              : 1;
2744     unsigned WUE                : 1;
2745     unsigned                    : 1;
2746     unsigned BRG16              : 1;
2747     unsigned TXCKP              : 1;
2748     unsigned RXDTP              : 1;
2749     unsigned RCIDL              : 1;
2750     unsigned ABDOVF             : 1;
2751     };
2752 
2753   struct
2754     {
2755     unsigned                    : 1;
2756     unsigned                    : 1;
2757     unsigned                    : 1;
2758     unsigned                    : 1;
2759     unsigned SCKP               : 1;
2760     unsigned                    : 1;
2761     unsigned RCMT               : 1;
2762     unsigned                    : 1;
2763     };
2764   } __BAUDCTLbits_t;
2765 
2766 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
2767 
2768 #define _BAUDCTL_ABDEN          0x01
2769 #define _BAUDCTL_WUE            0x02
2770 #define _BAUDCTL_BRG16          0x08
2771 #define _BAUDCTL_TXCKP          0x10
2772 #define _BAUDCTL_SCKP           0x10
2773 #define _BAUDCTL_RXDTP          0x20
2774 #define _BAUDCTL_RCIDL          0x40
2775 #define _BAUDCTL_RCMT           0x40
2776 #define _BAUDCTL_ABDOVF         0x80
2777 
2778 //==============================================================================
2779 
2780 
2781 //==============================================================================
2782 //        CCP2CON Bits
2783 
2784 extern __at(0x0FBA) __sfr CCP2CON;
2785 
2786 typedef union
2787   {
2788   struct
2789     {
2790     unsigned CCP2M0             : 1;
2791     unsigned CCP2M1             : 1;
2792     unsigned CCP2M2             : 1;
2793     unsigned CCP2M3             : 1;
2794     unsigned DC2B0              : 1;
2795     unsigned DC2B1              : 1;
2796     unsigned                    : 1;
2797     unsigned                    : 1;
2798     };
2799 
2800   struct
2801     {
2802     unsigned CCP2M              : 4;
2803     unsigned                    : 4;
2804     };
2805 
2806   struct
2807     {
2808     unsigned                    : 4;
2809     unsigned DC2B               : 2;
2810     unsigned                    : 2;
2811     };
2812   } __CCP2CONbits_t;
2813 
2814 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
2815 
2816 #define _CCP2M0                 0x01
2817 #define _CCP2M1                 0x02
2818 #define _CCP2M2                 0x04
2819 #define _CCP2M3                 0x08
2820 #define _DC2B0                  0x10
2821 #define _DC2B1                  0x20
2822 
2823 //==============================================================================
2824 
2825 extern __at(0x0FBB) __sfr CCPR2;
2826 extern __at(0x0FBB) __sfr CCPR2L;
2827 extern __at(0x0FBC) __sfr CCPR2H;
2828 
2829 //==============================================================================
2830 //        CCP1CON Bits
2831 
2832 extern __at(0x0FBD) __sfr CCP1CON;
2833 
2834 typedef union
2835   {
2836   struct
2837     {
2838     unsigned CCP1M0             : 1;
2839     unsigned CCP1M1             : 1;
2840     unsigned CCP1M2             : 1;
2841     unsigned CCP1M3             : 1;
2842     unsigned DC1B0              : 1;
2843     unsigned DC1B1              : 1;
2844     unsigned P1M0               : 1;
2845     unsigned P1M1               : 1;
2846     };
2847 
2848   struct
2849     {
2850     unsigned CCP1M              : 4;
2851     unsigned                    : 4;
2852     };
2853 
2854   struct
2855     {
2856     unsigned                    : 4;
2857     unsigned DC1B               : 2;
2858     unsigned                    : 2;
2859     };
2860 
2861   struct
2862     {
2863     unsigned                    : 6;
2864     unsigned P1M                : 2;
2865     };
2866   } __CCP1CONbits_t;
2867 
2868 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2869 
2870 #define _CCP1M0                 0x01
2871 #define _CCP1M1                 0x02
2872 #define _CCP1M2                 0x04
2873 #define _CCP1M3                 0x08
2874 #define _DC1B0                  0x10
2875 #define _DC1B1                  0x20
2876 #define _P1M0                   0x40
2877 #define _P1M1                   0x80
2878 
2879 //==============================================================================
2880 
2881 
2882 //==============================================================================
2883 //        ECCP1CON Bits
2884 
2885 extern __at(0x0FBD) __sfr ECCP1CON;
2886 
2887 typedef union
2888   {
2889   struct
2890     {
2891     unsigned CCP1M0             : 1;
2892     unsigned CCP1M1             : 1;
2893     unsigned CCP1M2             : 1;
2894     unsigned CCP1M3             : 1;
2895     unsigned DC1B0              : 1;
2896     unsigned DC1B1              : 1;
2897     unsigned P1M0               : 1;
2898     unsigned P1M1               : 1;
2899     };
2900 
2901   struct
2902     {
2903     unsigned CCP1M              : 4;
2904     unsigned                    : 4;
2905     };
2906 
2907   struct
2908     {
2909     unsigned                    : 4;
2910     unsigned DC1B               : 2;
2911     unsigned                    : 2;
2912     };
2913 
2914   struct
2915     {
2916     unsigned                    : 6;
2917     unsigned P1M                : 2;
2918     };
2919   } __ECCP1CONbits_t;
2920 
2921 extern __at(0x0FBD) volatile __ECCP1CONbits_t ECCP1CONbits;
2922 
2923 #define _ECCP1CON_CCP1M0        0x01
2924 #define _ECCP1CON_CCP1M1        0x02
2925 #define _ECCP1CON_CCP1M2        0x04
2926 #define _ECCP1CON_CCP1M3        0x08
2927 #define _ECCP1CON_DC1B0         0x10
2928 #define _ECCP1CON_DC1B1         0x20
2929 #define _ECCP1CON_P1M0          0x40
2930 #define _ECCP1CON_P1M1          0x80
2931 
2932 //==============================================================================
2933 
2934 extern __at(0x0FBE) __sfr CCPR1;
2935 extern __at(0x0FBE) __sfr CCPR1L;
2936 extern __at(0x0FBF) __sfr CCPR1H;
2937 
2938 //==============================================================================
2939 //        ADCON2 Bits
2940 
2941 extern __at(0x0FC0) __sfr ADCON2;
2942 
2943 typedef union
2944   {
2945   struct
2946     {
2947     unsigned ADCS0              : 1;
2948     unsigned ADCS1              : 1;
2949     unsigned ADCS2              : 1;
2950     unsigned ACQT0              : 1;
2951     unsigned ACQT1              : 1;
2952     unsigned ACQT2              : 1;
2953     unsigned                    : 1;
2954     unsigned ADFM               : 1;
2955     };
2956 
2957   struct
2958     {
2959     unsigned ADCS               : 3;
2960     unsigned                    : 5;
2961     };
2962 
2963   struct
2964     {
2965     unsigned                    : 3;
2966     unsigned ACQT               : 3;
2967     unsigned                    : 2;
2968     };
2969   } __ADCON2bits_t;
2970 
2971 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2972 
2973 #define _ADCS0                  0x01
2974 #define _ADCS1                  0x02
2975 #define _ADCS2                  0x04
2976 #define _ACQT0                  0x08
2977 #define _ACQT1                  0x10
2978 #define _ACQT2                  0x20
2979 #define _ADFM                   0x80
2980 
2981 //==============================================================================
2982 
2983 
2984 //==============================================================================
2985 //        ADCON1 Bits
2986 
2987 extern __at(0x0FC1) __sfr ADCON1;
2988 
2989 typedef union
2990   {
2991   struct
2992     {
2993     unsigned PCFG0              : 1;
2994     unsigned PCFG1              : 1;
2995     unsigned PCFG2              : 1;
2996     unsigned PCFG3              : 1;
2997     unsigned VCFG0              : 1;
2998     unsigned VCFG1              : 1;
2999     unsigned                    : 1;
3000     unsigned                    : 1;
3001     };
3002 
3003   struct
3004     {
3005     unsigned PCFG               : 4;
3006     unsigned                    : 4;
3007     };
3008 
3009   struct
3010     {
3011     unsigned                    : 4;
3012     unsigned VCFG               : 2;
3013     unsigned                    : 2;
3014     };
3015   } __ADCON1bits_t;
3016 
3017 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
3018 
3019 #define _PCFG0                  0x01
3020 #define _PCFG1                  0x02
3021 #define _PCFG2                  0x04
3022 #define _PCFG3                  0x08
3023 #define _VCFG0                  0x10
3024 #define _VCFG1                  0x20
3025 
3026 //==============================================================================
3027 
3028 
3029 //==============================================================================
3030 //        ADCON0 Bits
3031 
3032 extern __at(0x0FC2) __sfr ADCON0;
3033 
3034 typedef union
3035   {
3036   struct
3037     {
3038     unsigned ADON               : 1;
3039     unsigned GO_NOT_DONE        : 1;
3040     unsigned CHS0               : 1;
3041     unsigned CHS1               : 1;
3042     unsigned CHS2               : 1;
3043     unsigned CHS3               : 1;
3044     unsigned                    : 1;
3045     unsigned                    : 1;
3046     };
3047 
3048   struct
3049     {
3050     unsigned                    : 1;
3051     unsigned GO_DONE            : 1;
3052     unsigned                    : 1;
3053     unsigned                    : 1;
3054     unsigned                    : 1;
3055     unsigned                    : 1;
3056     unsigned                    : 1;
3057     unsigned                    : 1;
3058     };
3059 
3060   struct
3061     {
3062     unsigned                    : 1;
3063     unsigned DONE               : 1;
3064     unsigned                    : 1;
3065     unsigned                    : 1;
3066     unsigned                    : 1;
3067     unsigned                    : 1;
3068     unsigned                    : 1;
3069     unsigned                    : 1;
3070     };
3071 
3072   struct
3073     {
3074     unsigned                    : 1;
3075     unsigned GO                 : 1;
3076     unsigned                    : 1;
3077     unsigned                    : 1;
3078     unsigned                    : 1;
3079     unsigned                    : 1;
3080     unsigned                    : 1;
3081     unsigned                    : 1;
3082     };
3083 
3084   struct
3085     {
3086     unsigned                    : 1;
3087     unsigned NOT_DONE           : 1;
3088     unsigned                    : 1;
3089     unsigned                    : 1;
3090     unsigned                    : 1;
3091     unsigned                    : 1;
3092     unsigned                    : 1;
3093     unsigned                    : 1;
3094     };
3095 
3096   struct
3097     {
3098     unsigned                    : 2;
3099     unsigned CHS                : 4;
3100     unsigned                    : 2;
3101     };
3102   } __ADCON0bits_t;
3103 
3104 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
3105 
3106 #define _ADON                   0x01
3107 #define _GO_NOT_DONE            0x02
3108 #define _GO_DONE                0x02
3109 #define _DONE                   0x02
3110 #define _GO                     0x02
3111 #define _NOT_DONE               0x02
3112 #define _CHS0                   0x04
3113 #define _CHS1                   0x08
3114 #define _CHS2                   0x10
3115 #define _CHS3                   0x20
3116 
3117 //==============================================================================
3118 
3119 extern __at(0x0FC3) __sfr ADRES;
3120 extern __at(0x0FC3) __sfr ADRESL;
3121 extern __at(0x0FC4) __sfr ADRESH;
3122 
3123 //==============================================================================
3124 //        SSPCON2 Bits
3125 
3126 extern __at(0x0FC5) __sfr SSPCON2;
3127 
3128 typedef struct
3129   {
3130   unsigned SEN                  : 1;
3131   unsigned RSEN                 : 1;
3132   unsigned PEN                  : 1;
3133   unsigned RCEN                 : 1;
3134   unsigned ACKEN                : 1;
3135   unsigned ACKDT                : 1;
3136   unsigned ACKSTAT              : 1;
3137   unsigned GCEN                 : 1;
3138   } __SSPCON2bits_t;
3139 
3140 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
3141 
3142 #define _SEN                    0x01
3143 #define _RSEN                   0x02
3144 #define _PEN                    0x04
3145 #define _RCEN                   0x08
3146 #define _ACKEN                  0x10
3147 #define _ACKDT                  0x20
3148 #define _ACKSTAT                0x40
3149 #define _GCEN                   0x80
3150 
3151 //==============================================================================
3152 
3153 
3154 //==============================================================================
3155 //        SSPCON1 Bits
3156 
3157 extern __at(0x0FC6) __sfr SSPCON1;
3158 
3159 typedef union
3160   {
3161   struct
3162     {
3163     unsigned SSPM0              : 1;
3164     unsigned SSPM1              : 1;
3165     unsigned SSPM2              : 1;
3166     unsigned SSPM3              : 1;
3167     unsigned CKP                : 1;
3168     unsigned SSPEN              : 1;
3169     unsigned SSPOV              : 1;
3170     unsigned WCOL               : 1;
3171     };
3172 
3173   struct
3174     {
3175     unsigned SSPM               : 4;
3176     unsigned                    : 4;
3177     };
3178   } __SSPCON1bits_t;
3179 
3180 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
3181 
3182 #define _SSPM0                  0x01
3183 #define _SSPM1                  0x02
3184 #define _SSPM2                  0x04
3185 #define _SSPM3                  0x08
3186 #define _CKP                    0x10
3187 #define _SSPEN                  0x20
3188 #define _SSPOV                  0x40
3189 #define _WCOL                   0x80
3190 
3191 //==============================================================================
3192 
3193 
3194 //==============================================================================
3195 //        SSPSTAT Bits
3196 
3197 extern __at(0x0FC7) __sfr SSPSTAT;
3198 
3199 typedef union
3200   {
3201   struct
3202     {
3203     unsigned BF                 : 1;
3204     unsigned UA                 : 1;
3205     unsigned R_NOT_W            : 1;
3206     unsigned S                  : 1;
3207     unsigned P                  : 1;
3208     unsigned D_NOT_A            : 1;
3209     unsigned CKE                : 1;
3210     unsigned SMP                : 1;
3211     };
3212 
3213   struct
3214     {
3215     unsigned                    : 1;
3216     unsigned                    : 1;
3217     unsigned R_W                : 1;
3218     unsigned I2C_START          : 1;
3219     unsigned I2C_STOP           : 1;
3220     unsigned D_A                : 1;
3221     unsigned                    : 1;
3222     unsigned                    : 1;
3223     };
3224 
3225   struct
3226     {
3227     unsigned                    : 1;
3228     unsigned                    : 1;
3229     unsigned I2C_READ           : 1;
3230     unsigned                    : 1;
3231     unsigned                    : 1;
3232     unsigned I2C_DAT            : 1;
3233     unsigned                    : 1;
3234     unsigned                    : 1;
3235     };
3236 
3237   struct
3238     {
3239     unsigned                    : 1;
3240     unsigned                    : 1;
3241     unsigned NOT_W              : 1;
3242     unsigned                    : 1;
3243     unsigned                    : 1;
3244     unsigned NOT_A              : 1;
3245     unsigned                    : 1;
3246     unsigned                    : 1;
3247     };
3248 
3249   struct
3250     {
3251     unsigned                    : 1;
3252     unsigned                    : 1;
3253     unsigned NOT_WRITE          : 1;
3254     unsigned                    : 1;
3255     unsigned                    : 1;
3256     unsigned NOT_ADDRESS        : 1;
3257     unsigned                    : 1;
3258     unsigned                    : 1;
3259     };
3260 
3261   struct
3262     {
3263     unsigned                    : 1;
3264     unsigned                    : 1;
3265     unsigned READ_WRITE         : 1;
3266     unsigned                    : 1;
3267     unsigned                    : 1;
3268     unsigned DATA_ADDRESS       : 1;
3269     unsigned                    : 1;
3270     unsigned                    : 1;
3271     };
3272 
3273   struct
3274     {
3275     unsigned                    : 1;
3276     unsigned                    : 1;
3277     unsigned R                  : 1;
3278     unsigned                    : 1;
3279     unsigned                    : 1;
3280     unsigned D                  : 1;
3281     unsigned                    : 1;
3282     unsigned                    : 1;
3283     };
3284   } __SSPSTATbits_t;
3285 
3286 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
3287 
3288 #define _BF                     0x01
3289 #define _UA                     0x02
3290 #define _R_NOT_W                0x04
3291 #define _R_W                    0x04
3292 #define _I2C_READ               0x04
3293 #define _NOT_W                  0x04
3294 #define _NOT_WRITE              0x04
3295 #define _READ_WRITE             0x04
3296 #define _R                      0x04
3297 #define _S                      0x08
3298 #define _I2C_START              0x08
3299 #define _P                      0x10
3300 #define _I2C_STOP               0x10
3301 #define _D_NOT_A                0x20
3302 #define _D_A                    0x20
3303 #define _I2C_DAT                0x20
3304 #define _NOT_A                  0x20
3305 #define _NOT_ADDRESS            0x20
3306 #define _DATA_ADDRESS           0x20
3307 #define _D                      0x20
3308 #define _CKE                    0x40
3309 #define _SMP                    0x80
3310 
3311 //==============================================================================
3312 
3313 extern __at(0x0FC8) __sfr SSPADD;
3314 extern __at(0x0FC9) __sfr SSPBUF;
3315 
3316 //==============================================================================
3317 //        T2CON Bits
3318 
3319 extern __at(0x0FCA) __sfr T2CON;
3320 
3321 typedef union
3322   {
3323   struct
3324     {
3325     unsigned T2CKPS0            : 1;
3326     unsigned T2CKPS1            : 1;
3327     unsigned TMR2ON             : 1;
3328     unsigned T2OUTPS0           : 1;
3329     unsigned T2OUTPS1           : 1;
3330     unsigned T2OUTPS2           : 1;
3331     unsigned T2OUTPS3           : 1;
3332     unsigned                    : 1;
3333     };
3334 
3335   struct
3336     {
3337     unsigned                    : 1;
3338     unsigned                    : 1;
3339     unsigned                    : 1;
3340     unsigned TOUTPS0            : 1;
3341     unsigned TOUTPS1            : 1;
3342     unsigned TOUTPS2            : 1;
3343     unsigned TOUTPS3            : 1;
3344     unsigned                    : 1;
3345     };
3346 
3347   struct
3348     {
3349     unsigned T2CKPS             : 2;
3350     unsigned                    : 6;
3351     };
3352 
3353   struct
3354     {
3355     unsigned                    : 3;
3356     unsigned TOUTPS             : 4;
3357     unsigned                    : 1;
3358     };
3359 
3360   struct
3361     {
3362     unsigned                    : 3;
3363     unsigned T2OUTPS            : 4;
3364     unsigned                    : 1;
3365     };
3366   } __T2CONbits_t;
3367 
3368 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
3369 
3370 #define _T2CKPS0                0x01
3371 #define _T2CKPS1                0x02
3372 #define _TMR2ON                 0x04
3373 #define _T2OUTPS0               0x08
3374 #define _TOUTPS0                0x08
3375 #define _T2OUTPS1               0x10
3376 #define _TOUTPS1                0x10
3377 #define _T2OUTPS2               0x20
3378 #define _TOUTPS2                0x20
3379 #define _T2OUTPS3               0x40
3380 #define _TOUTPS3                0x40
3381 
3382 //==============================================================================
3383 
3384 extern __at(0x0FCB) __sfr PR2;
3385 extern __at(0x0FCC) __sfr TMR2;
3386 
3387 //==============================================================================
3388 //        T1CON Bits
3389 
3390 extern __at(0x0FCD) __sfr T1CON;
3391 
3392 typedef union
3393   {
3394   struct
3395     {
3396     unsigned TMR1ON             : 1;
3397     unsigned TMR1CS             : 1;
3398     unsigned NOT_T1SYNC         : 1;
3399     unsigned T1OSCEN            : 1;
3400     unsigned T1CKPS0            : 1;
3401     unsigned T1CKPS1            : 1;
3402     unsigned T1RUN              : 1;
3403     unsigned RD16               : 1;
3404     };
3405 
3406   struct
3407     {
3408     unsigned                    : 1;
3409     unsigned                    : 1;
3410     unsigned T1SYNC             : 1;
3411     unsigned                    : 1;
3412     unsigned                    : 1;
3413     unsigned                    : 1;
3414     unsigned                    : 1;
3415     unsigned                    : 1;
3416     };
3417 
3418   struct
3419     {
3420     unsigned                    : 4;
3421     unsigned T1CKPS             : 2;
3422     unsigned                    : 2;
3423     };
3424   } __T1CONbits_t;
3425 
3426 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
3427 
3428 #define _TMR1ON                 0x01
3429 #define _TMR1CS                 0x02
3430 #define _NOT_T1SYNC             0x04
3431 #define _T1SYNC                 0x04
3432 #define _T1OSCEN                0x08
3433 #define _T1CKPS0                0x10
3434 #define _T1CKPS1                0x20
3435 #define _T1RUN                  0x40
3436 #define _RD16                   0x80
3437 
3438 //==============================================================================
3439 
3440 extern __at(0x0FCE) __sfr TMR1;
3441 extern __at(0x0FCE) __sfr TMR1L;
3442 extern __at(0x0FCF) __sfr TMR1H;
3443 
3444 //==============================================================================
3445 //        RCON Bits
3446 
3447 extern __at(0x0FD0) __sfr RCON;
3448 
3449 typedef union
3450   {
3451   struct
3452     {
3453     unsigned NOT_BOR            : 1;
3454     unsigned NOT_POR            : 1;
3455     unsigned NOT_PD             : 1;
3456     unsigned NOT_TO             : 1;
3457     unsigned NOT_RI             : 1;
3458     unsigned                    : 1;
3459     unsigned SBOREN             : 1;
3460     unsigned IPEN               : 1;
3461     };
3462 
3463   struct
3464     {
3465     unsigned BOR                : 1;
3466     unsigned POR                : 1;
3467     unsigned PD                 : 1;
3468     unsigned TO                 : 1;
3469     unsigned RI                 : 1;
3470     unsigned                    : 1;
3471     unsigned                    : 1;
3472     unsigned NOT_IPEN           : 1;
3473     };
3474   } __RCONbits_t;
3475 
3476 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
3477 
3478 #define _NOT_BOR                0x01
3479 #define _BOR                    0x01
3480 #define _NOT_POR                0x02
3481 #define _POR                    0x02
3482 #define _NOT_PD                 0x04
3483 #define _PD                     0x04
3484 #define _NOT_TO                 0x08
3485 #define _TO                     0x08
3486 #define _NOT_RI                 0x10
3487 #define _RI                     0x10
3488 #define _SBOREN                 0x40
3489 #define _IPEN                   0x80
3490 #define _NOT_IPEN               0x80
3491 
3492 //==============================================================================
3493 
3494 
3495 //==============================================================================
3496 //        WDTCON Bits
3497 
3498 extern __at(0x0FD1) __sfr WDTCON;
3499 
3500 typedef union
3501   {
3502   struct
3503     {
3504     unsigned SWDTEN             : 1;
3505     unsigned                    : 1;
3506     unsigned                    : 1;
3507     unsigned                    : 1;
3508     unsigned                    : 1;
3509     unsigned                    : 1;
3510     unsigned                    : 1;
3511     unsigned                    : 1;
3512     };
3513 
3514   struct
3515     {
3516     unsigned SWDTE              : 1;
3517     unsigned                    : 1;
3518     unsigned                    : 1;
3519     unsigned                    : 1;
3520     unsigned                    : 1;
3521     unsigned                    : 1;
3522     unsigned                    : 1;
3523     unsigned                    : 1;
3524     };
3525   } __WDTCONbits_t;
3526 
3527 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
3528 
3529 #define _SWDTEN                 0x01
3530 #define _SWDTE                  0x01
3531 
3532 //==============================================================================
3533 
3534 
3535 //==============================================================================
3536 //        HLVDCON Bits
3537 
3538 extern __at(0x0FD2) __sfr HLVDCON;
3539 
3540 typedef union
3541   {
3542   struct
3543     {
3544     unsigned HLVDL0             : 1;
3545     unsigned HLVDL1             : 1;
3546     unsigned HLVDL2             : 1;
3547     unsigned HLVDL3             : 1;
3548     unsigned HLVDEN             : 1;
3549     unsigned IRVST              : 1;
3550     unsigned                    : 1;
3551     unsigned VDIRMAG            : 1;
3552     };
3553 
3554   struct
3555     {
3556     unsigned LVDL0              : 1;
3557     unsigned LVDL1              : 1;
3558     unsigned LVDL2              : 1;
3559     unsigned LVDL3              : 1;
3560     unsigned LVDEN              : 1;
3561     unsigned IVRST              : 1;
3562     unsigned                    : 1;
3563     unsigned                    : 1;
3564     };
3565 
3566   struct
3567     {
3568     unsigned LVV0               : 1;
3569     unsigned LVV1               : 1;
3570     unsigned LVV2               : 1;
3571     unsigned LVV3               : 1;
3572     unsigned                    : 1;
3573     unsigned BGST               : 1;
3574     unsigned                    : 1;
3575     unsigned                    : 1;
3576     };
3577 
3578   struct
3579     {
3580     unsigned HLVDL              : 4;
3581     unsigned                    : 4;
3582     };
3583 
3584   struct
3585     {
3586     unsigned LVV                : 4;
3587     unsigned                    : 4;
3588     };
3589 
3590   struct
3591     {
3592     unsigned LVDL               : 4;
3593     unsigned                    : 4;
3594     };
3595   } __HLVDCONbits_t;
3596 
3597 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
3598 
3599 #define _HLVDL0                 0x01
3600 #define _LVDL0                  0x01
3601 #define _LVV0                   0x01
3602 #define _HLVDL1                 0x02
3603 #define _LVDL1                  0x02
3604 #define _LVV1                   0x02
3605 #define _HLVDL2                 0x04
3606 #define _LVDL2                  0x04
3607 #define _LVV2                   0x04
3608 #define _HLVDL3                 0x08
3609 #define _LVDL3                  0x08
3610 #define _LVV3                   0x08
3611 #define _HLVDEN                 0x10
3612 #define _LVDEN                  0x10
3613 #define _IRVST                  0x20
3614 #define _IVRST                  0x20
3615 #define _BGST                   0x20
3616 #define _VDIRMAG                0x80
3617 
3618 //==============================================================================
3619 
3620 
3621 //==============================================================================
3622 //        LVDCON Bits
3623 
3624 extern __at(0x0FD2) __sfr LVDCON;
3625 
3626 typedef union
3627   {
3628   struct
3629     {
3630     unsigned HLVDL0             : 1;
3631     unsigned HLVDL1             : 1;
3632     unsigned HLVDL2             : 1;
3633     unsigned HLVDL3             : 1;
3634     unsigned HLVDEN             : 1;
3635     unsigned IRVST              : 1;
3636     unsigned                    : 1;
3637     unsigned VDIRMAG            : 1;
3638     };
3639 
3640   struct
3641     {
3642     unsigned LVDL0              : 1;
3643     unsigned LVDL1              : 1;
3644     unsigned LVDL2              : 1;
3645     unsigned LVDL3              : 1;
3646     unsigned LVDEN              : 1;
3647     unsigned IVRST              : 1;
3648     unsigned                    : 1;
3649     unsigned                    : 1;
3650     };
3651 
3652   struct
3653     {
3654     unsigned LVV0               : 1;
3655     unsigned LVV1               : 1;
3656     unsigned LVV2               : 1;
3657     unsigned LVV3               : 1;
3658     unsigned                    : 1;
3659     unsigned BGST               : 1;
3660     unsigned                    : 1;
3661     unsigned                    : 1;
3662     };
3663 
3664   struct
3665     {
3666     unsigned LVV                : 4;
3667     unsigned                    : 4;
3668     };
3669 
3670   struct
3671     {
3672     unsigned LVDL               : 4;
3673     unsigned                    : 4;
3674     };
3675 
3676   struct
3677     {
3678     unsigned HLVDL              : 4;
3679     unsigned                    : 4;
3680     };
3681   } __LVDCONbits_t;
3682 
3683 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
3684 
3685 #define _LVDCON_HLVDL0          0x01
3686 #define _LVDCON_LVDL0           0x01
3687 #define _LVDCON_LVV0            0x01
3688 #define _LVDCON_HLVDL1          0x02
3689 #define _LVDCON_LVDL1           0x02
3690 #define _LVDCON_LVV1            0x02
3691 #define _LVDCON_HLVDL2          0x04
3692 #define _LVDCON_LVDL2           0x04
3693 #define _LVDCON_LVV2            0x04
3694 #define _LVDCON_HLVDL3          0x08
3695 #define _LVDCON_LVDL3           0x08
3696 #define _LVDCON_LVV3            0x08
3697 #define _LVDCON_HLVDEN          0x10
3698 #define _LVDCON_LVDEN           0x10
3699 #define _LVDCON_IRVST           0x20
3700 #define _LVDCON_IVRST           0x20
3701 #define _LVDCON_BGST            0x20
3702 #define _LVDCON_VDIRMAG         0x80
3703 
3704 //==============================================================================
3705 
3706 
3707 //==============================================================================
3708 //        OSCCON Bits
3709 
3710 extern __at(0x0FD3) __sfr OSCCON;
3711 
3712 typedef union
3713   {
3714   struct
3715     {
3716     unsigned SCS0               : 1;
3717     unsigned SCS1               : 1;
3718     unsigned IOFS               : 1;
3719     unsigned OSTS               : 1;
3720     unsigned IRCF0              : 1;
3721     unsigned IRCF1              : 1;
3722     unsigned IRCF2              : 1;
3723     unsigned IDLEN              : 1;
3724     };
3725 
3726   struct
3727     {
3728     unsigned                    : 1;
3729     unsigned                    : 1;
3730     unsigned FLTS               : 1;
3731     unsigned                    : 1;
3732     unsigned                    : 1;
3733     unsigned                    : 1;
3734     unsigned                    : 1;
3735     unsigned                    : 1;
3736     };
3737 
3738   struct
3739     {
3740     unsigned SCS                : 2;
3741     unsigned                    : 6;
3742     };
3743 
3744   struct
3745     {
3746     unsigned                    : 4;
3747     unsigned IRCF               : 3;
3748     unsigned                    : 1;
3749     };
3750   } __OSCCONbits_t;
3751 
3752 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
3753 
3754 #define _SCS0                   0x01
3755 #define _SCS1                   0x02
3756 #define _IOFS                   0x04
3757 #define _FLTS                   0x04
3758 #define _OSTS                   0x08
3759 #define _IRCF0                  0x10
3760 #define _IRCF1                  0x20
3761 #define _IRCF2                  0x40
3762 #define _IDLEN                  0x80
3763 
3764 //==============================================================================
3765 
3766 
3767 //==============================================================================
3768 //        T0CON Bits
3769 
3770 extern __at(0x0FD5) __sfr T0CON;
3771 
3772 typedef union
3773   {
3774   struct
3775     {
3776     unsigned T0PS0              : 1;
3777     unsigned T0PS1              : 1;
3778     unsigned T0PS2              : 1;
3779     unsigned PSA                : 1;
3780     unsigned T0SE               : 1;
3781     unsigned T0CS               : 1;
3782     unsigned T08BIT             : 1;
3783     unsigned TMR0ON             : 1;
3784     };
3785 
3786   struct
3787     {
3788     unsigned T0PS               : 3;
3789     unsigned                    : 5;
3790     };
3791   } __T0CONbits_t;
3792 
3793 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
3794 
3795 #define _T0PS0                  0x01
3796 #define _T0PS1                  0x02
3797 #define _T0PS2                  0x04
3798 #define _PSA                    0x08
3799 #define _T0SE                   0x10
3800 #define _T0CS                   0x20
3801 #define _T08BIT                 0x40
3802 #define _TMR0ON                 0x80
3803 
3804 //==============================================================================
3805 
3806 extern __at(0x0FD6) __sfr TMR0;
3807 extern __at(0x0FD6) __sfr TMR0L;
3808 extern __at(0x0FD7) __sfr TMR0H;
3809 
3810 //==============================================================================
3811 //        STATUS Bits
3812 
3813 extern __at(0x0FD8) __sfr STATUS;
3814 
3815 typedef struct
3816   {
3817   unsigned C                    : 1;
3818   unsigned DC                   : 1;
3819   unsigned Z                    : 1;
3820   unsigned OV                   : 1;
3821   unsigned N                    : 1;
3822   unsigned                      : 1;
3823   unsigned                      : 1;
3824   unsigned                      : 1;
3825   } __STATUSbits_t;
3826 
3827 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
3828 
3829 #define _C                      0x01
3830 #define _DC                     0x02
3831 #define _Z                      0x04
3832 #define _OV                     0x08
3833 #define _N                      0x10
3834 
3835 //==============================================================================
3836 
3837 extern __at(0x0FD9) __sfr FSR2L;
3838 extern __at(0x0FDA) __sfr FSR2H;
3839 extern __at(0x0FDB) __sfr PLUSW2;
3840 extern __at(0x0FDC) __sfr PREINC2;
3841 extern __at(0x0FDD) __sfr POSTDEC2;
3842 extern __at(0x0FDE) __sfr POSTINC2;
3843 extern __at(0x0FDF) __sfr INDF2;
3844 extern __at(0x0FE0) __sfr BSR;
3845 extern __at(0x0FE1) __sfr FSR1L;
3846 extern __at(0x0FE2) __sfr FSR1H;
3847 extern __at(0x0FE3) __sfr PLUSW1;
3848 extern __at(0x0FE4) __sfr PREINC1;
3849 extern __at(0x0FE5) __sfr POSTDEC1;
3850 extern __at(0x0FE6) __sfr POSTINC1;
3851 extern __at(0x0FE7) __sfr INDF1;
3852 extern __at(0x0FE8) __sfr WREG;
3853 extern __at(0x0FE9) __sfr FSR0L;
3854 extern __at(0x0FEA) __sfr FSR0H;
3855 extern __at(0x0FEB) __sfr PLUSW0;
3856 extern __at(0x0FEC) __sfr PREINC0;
3857 extern __at(0x0FED) __sfr POSTDEC0;
3858 extern __at(0x0FEE) __sfr POSTINC0;
3859 extern __at(0x0FEF) __sfr INDF0;
3860 
3861 //==============================================================================
3862 //        INTCON3 Bits
3863 
3864 extern __at(0x0FF0) __sfr INTCON3;
3865 
3866 typedef union
3867   {
3868   struct
3869     {
3870     unsigned INT1IF             : 1;
3871     unsigned INT2IF             : 1;
3872     unsigned                    : 1;
3873     unsigned INT1IE             : 1;
3874     unsigned INT2IE             : 1;
3875     unsigned                    : 1;
3876     unsigned INT1IP             : 1;
3877     unsigned INT2IP             : 1;
3878     };
3879 
3880   struct
3881     {
3882     unsigned INT1F              : 1;
3883     unsigned INT2F              : 1;
3884     unsigned                    : 1;
3885     unsigned INT1E              : 1;
3886     unsigned INT2E              : 1;
3887     unsigned                    : 1;
3888     unsigned INT1P              : 1;
3889     unsigned INT2P              : 1;
3890     };
3891   } __INTCON3bits_t;
3892 
3893 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
3894 
3895 #define _INT1IF                 0x01
3896 #define _INT1F                  0x01
3897 #define _INT2IF                 0x02
3898 #define _INT2F                  0x02
3899 #define _INT1IE                 0x08
3900 #define _INT1E                  0x08
3901 #define _INT2IE                 0x10
3902 #define _INT2E                  0x10
3903 #define _INT1IP                 0x40
3904 #define _INT1P                  0x40
3905 #define _INT2IP                 0x80
3906 #define _INT2P                  0x80
3907 
3908 //==============================================================================
3909 
3910 
3911 //==============================================================================
3912 //        INTCON2 Bits
3913 
3914 extern __at(0x0FF1) __sfr INTCON2;
3915 
3916 typedef union
3917   {
3918   struct
3919     {
3920     unsigned RBIP               : 1;
3921     unsigned                    : 1;
3922     unsigned TMR0IP             : 1;
3923     unsigned                    : 1;
3924     unsigned INTEDG2            : 1;
3925     unsigned INTEDG1            : 1;
3926     unsigned INTEDG0            : 1;
3927     unsigned NOT_RBPU           : 1;
3928     };
3929 
3930   struct
3931     {
3932     unsigned                    : 1;
3933     unsigned                    : 1;
3934     unsigned T0IP               : 1;
3935     unsigned                    : 1;
3936     unsigned                    : 1;
3937     unsigned                    : 1;
3938     unsigned                    : 1;
3939     unsigned RBPU               : 1;
3940     };
3941   } __INTCON2bits_t;
3942 
3943 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
3944 
3945 #define _RBIP                   0x01
3946 #define _TMR0IP                 0x04
3947 #define _T0IP                   0x04
3948 #define _INTEDG2                0x10
3949 #define _INTEDG1                0x20
3950 #define _INTEDG0                0x40
3951 #define _NOT_RBPU               0x80
3952 #define _RBPU                   0x80
3953 
3954 //==============================================================================
3955 
3956 
3957 //==============================================================================
3958 //        INTCON Bits
3959 
3960 extern __at(0x0FF2) __sfr INTCON;
3961 
3962 typedef union
3963   {
3964   struct
3965     {
3966     unsigned RBIF               : 1;
3967     unsigned INT0IF             : 1;
3968     unsigned TMR0IF             : 1;
3969     unsigned RBIE               : 1;
3970     unsigned INT0IE             : 1;
3971     unsigned TMR0IE             : 1;
3972     unsigned PEIE_GIEL          : 1;
3973     unsigned GIE_GIEH           : 1;
3974     };
3975 
3976   struct
3977     {
3978     unsigned                    : 1;
3979     unsigned INT0F              : 1;
3980     unsigned T0IF               : 1;
3981     unsigned                    : 1;
3982     unsigned INT0E              : 1;
3983     unsigned T0IE               : 1;
3984     unsigned PEIE               : 1;
3985     unsigned GIE                : 1;
3986     };
3987 
3988   struct
3989     {
3990     unsigned                    : 1;
3991     unsigned                    : 1;
3992     unsigned                    : 1;
3993     unsigned                    : 1;
3994     unsigned                    : 1;
3995     unsigned                    : 1;
3996     unsigned GIEL               : 1;
3997     unsigned GIEH               : 1;
3998     };
3999   } __INTCONbits_t;
4000 
4001 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
4002 
4003 #define _RBIF                   0x01
4004 #define _INT0IF                 0x02
4005 #define _INT0F                  0x02
4006 #define _TMR0IF                 0x04
4007 #define _T0IF                   0x04
4008 #define _RBIE                   0x08
4009 #define _INT0IE                 0x10
4010 #define _INT0E                  0x10
4011 #define _TMR0IE                 0x20
4012 #define _T0IE                   0x20
4013 #define _PEIE_GIEL              0x40
4014 #define _PEIE                   0x40
4015 #define _GIEL                   0x40
4016 #define _GIE_GIEH               0x80
4017 #define _GIE                    0x80
4018 #define _GIEH                   0x80
4019 
4020 //==============================================================================
4021 
4022 extern __at(0x0FF3) __sfr PROD;
4023 extern __at(0x0FF3) __sfr PRODL;
4024 extern __at(0x0FF4) __sfr PRODH;
4025 extern __at(0x0FF5) __sfr TABLAT;
4026 extern __at(0x0FF6) __sfr TBLPTR;
4027 extern __at(0x0FF6) __sfr TBLPTRL;
4028 extern __at(0x0FF7) __sfr TBLPTRH;
4029 extern __at(0x0FF8) __sfr TBLPTRU;
4030 extern __at(0x0FF9) __sfr PC;
4031 extern __at(0x0FF9) __sfr PCL;
4032 extern __at(0x0FFA) __sfr PCLATH;
4033 extern __at(0x0FFB) __sfr PCLATU;
4034 
4035 //==============================================================================
4036 //        STKPTR Bits
4037 
4038 extern __at(0x0FFC) __sfr STKPTR;
4039 
4040 typedef union
4041   {
4042   struct
4043     {
4044     unsigned STKPTR0            : 1;
4045     unsigned STKPTR1            : 1;
4046     unsigned STKPTR2            : 1;
4047     unsigned STKPTR3            : 1;
4048     unsigned STKPTR4            : 1;
4049     unsigned                    : 1;
4050     unsigned STKUNF             : 1;
4051     unsigned STKFUL             : 1;
4052     };
4053 
4054   struct
4055     {
4056     unsigned                    : 1;
4057     unsigned                    : 1;
4058     unsigned                    : 1;
4059     unsigned                    : 1;
4060     unsigned                    : 1;
4061     unsigned                    : 1;
4062     unsigned                    : 1;
4063     unsigned STKOVF             : 1;
4064     };
4065 
4066   struct
4067     {
4068     unsigned STKPTR             : 5;
4069     unsigned                    : 3;
4070     };
4071   } __STKPTRbits_t;
4072 
4073 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
4074 
4075 #define _STKPTR0                0x01
4076 #define _STKPTR1                0x02
4077 #define _STKPTR2                0x04
4078 #define _STKPTR3                0x08
4079 #define _STKPTR4                0x10
4080 #define _STKUNF                 0x40
4081 #define _STKFUL                 0x80
4082 #define _STKOVF                 0x80
4083 
4084 //==============================================================================
4085 
4086 extern __at(0x0FFD) __sfr TOS;
4087 extern __at(0x0FFD) __sfr TOSL;
4088 extern __at(0x0FFE) __sfr TOSH;
4089 extern __at(0x0FFF) __sfr TOSU;
4090 
4091 //==============================================================================
4092 //
4093 //        Configuration Bits
4094 //
4095 //==============================================================================
4096 
4097 #define __CONFIG1L              0x300000
4098 #define __CONFIG1H              0x300001
4099 #define __CONFIG2L              0x300002
4100 #define __CONFIG2H              0x300003
4101 #define __CONFIG3H              0x300005
4102 #define __CONFIG4L              0x300006
4103 #define __CONFIG5L              0x300008
4104 #define __CONFIG5H              0x300009
4105 #define __CONFIG6L              0x30000A
4106 #define __CONFIG6H              0x30000B
4107 #define __CONFIG7L              0x30000C
4108 #define __CONFIG7H              0x30000D
4109 
4110 //----------------------------- CONFIG1L Options -------------------------------
4111 
4112 #define _PLLDIV_1_1L            0xF8    // No prescale (4 MHz oscillator input drives PLL directly).
4113 #define _PLLDIV_2_1L            0xF9    // Divide by 2 (8 MHz oscillator input).
4114 #define _PLLDIV_3_1L            0xFA    // Divide by 3 (12 MHz oscillator input).
4115 #define _PLLDIV_4_1L            0xFB    // Divide by 4 (16 MHz oscillator input).
4116 #define _PLLDIV_5_1L            0xFC    // Divide by 5 (20 MHz oscillator input).
4117 #define _PLLDIV_6_1L            0xFD    // Divide by 6 (24 MHz oscillator input).
4118 #define _PLLDIV_10_1L           0xFE    // Divide by 10 (40 MHz oscillator input).
4119 #define _PLLDIV_12_1L           0xFF    // Divide by 12 (48 MHz oscillator input).
4120 #define _CPUDIV_OSC1_PLL2_1L    0xE7    // [Primary Oscillator Src: /1][96 MHz PLL Src: /2].
4121 #define _CPUDIV_OSC2_PLL3_1L    0xEF    // [Primary Oscillator Src: /2][96 MHz PLL Src: /3].
4122 #define _CPUDIV_OSC3_PLL4_1L    0xF7    // [Primary Oscillator Src: /3][96 MHz PLL Src: /4].
4123 #define _CPUDIV_OSC4_PLL6_1L    0xFF    // [Primary Oscillator Src: /4][96 MHz PLL Src: /6].
4124 #define _USBDIV_1_1L            0xDF    // USB clock source comes directly from the primary oscillator block with no postscale.
4125 #define _USBDIV_2_1L            0xFF    // USB clock source comes from the 96 MHz PLL divided by 2.
4126 
4127 //----------------------------- CONFIG1H Options -------------------------------
4128 
4129 #define _FOSC_XT_XT_1H          0xF0    // XT oscillator (XT).
4130 #define _FOSC_XTPLL_XT_1H       0xF2    // XT oscillator, PLL enabled (XTPLL).
4131 #define _FOSC_ECIO_EC_1H        0xF4    // EC oscillator, port function on RA6 (ECIO).
4132 #define _FOSC_EC_EC_1H          0xF5    // EC oscillator, CLKO function on RA6 (EC).
4133 #define _FOSC_ECPLLIO_EC_1H     0xF6    // EC oscillator, PLL enabled, port function on RA6 (ECPIO).
4134 #define _FOSC_ECPLL_EC_1H       0xF7    // EC oscillator, PLL enabled, CLKO function on RA6 (ECPLL).
4135 #define _FOSC_INTOSCIO_EC_1H    0xF8    // Internal oscillator, port function on RA6, EC used by USB (INTIO).
4136 #define _FOSC_INTOSC_EC_1H      0xF9    // Internal oscillator, CLKO function on RA6, EC used by USB (INTCKO).
4137 #define _FOSC_INTOSC_XT_1H      0xFA    // Internal oscillator, XT used by USB (INTXT).
4138 #define _FOSC_INTOSC_HS_1H      0xFB    // Internal oscillator, HS oscillator used by USB (INTHS).
4139 #define _FOSC_HS_1H             0xFC    // HS oscillator (HS).
4140 #define _FOSC_HSPLL_HS_1H       0xFE    // HS oscillator, PLL enabled (HSPLL).
4141 #define _FCMEN_OFF_1H           0xBF    // Fail-Safe Clock Monitor disabled.
4142 #define _FCMEN_ON_1H            0xFF    // Fail-Safe Clock Monitor enabled.
4143 #define _IESO_OFF_1H            0x7F    // Oscillator Switchover mode disabled.
4144 #define _IESO_ON_1H             0xFF    // Oscillator Switchover mode enabled.
4145 
4146 //----------------------------- CONFIG2L Options -------------------------------
4147 
4148 #define _PWRT_ON_2L             0xFE    // PWRT enabled.
4149 #define _PWRT_OFF_2L            0xFF    // PWRT disabled.
4150 #define _BOR_OFF_2L             0xF9    // Brown-out Reset disabled in hardware and software.
4151 #define _BOR_SOFT_2L            0xFB    // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
4152 #define _BOR_ON_ACTIVE_2L       0xFD    // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
4153 #define _BOR_ON_2L              0xFF    // Brown-out Reset enabled in hardware only (SBOREN is disabled).
4154 #define _BORV_0_2L              0xE7    // Maximum setting.
4155 #define _BORV_1_2L              0xEF
4156 #define _BORV_2_2L              0xF7
4157 #define _BORV_3_2L              0xFF    // Minimum setting.
4158 #define _VREGEN_OFF_2L          0xDF    // USB voltage regulator disabled.
4159 #define _VREGEN_ON_2L           0xFF    // USB voltage regulator enabled.
4160 
4161 //----------------------------- CONFIG2H Options -------------------------------
4162 
4163 #define _WDT_OFF_2H             0xFE    // WDT disabled (control is placed on the SWDTEN bit).
4164 #define _WDT_ON_2H              0xFF    // WDT enabled.
4165 #define _WDTPS_1_2H             0xE1    // 1:1.
4166 #define _WDTPS_2_2H             0xE3    // 1:2.
4167 #define _WDTPS_4_2H             0xE5    // 1:4.
4168 #define _WDTPS_8_2H             0xE7    // 1:8.
4169 #define _WDTPS_16_2H            0xE9    // 1:16.
4170 #define _WDTPS_32_2H            0xEB    // 1:32.
4171 #define _WDTPS_64_2H            0xED    // 1:64.
4172 #define _WDTPS_128_2H           0xEF    // 1:128.
4173 #define _WDTPS_256_2H           0xF1    // 1:256.
4174 #define _WDTPS_512_2H           0xF3    // 1:512.
4175 #define _WDTPS_1024_2H          0xF5    // 1:1024.
4176 #define _WDTPS_2048_2H          0xF7    // 1:2048.
4177 #define _WDTPS_4096_2H          0xF9    // 1:4096.
4178 #define _WDTPS_8192_2H          0xFB    // 1:8192.
4179 #define _WDTPS_16384_2H         0xFD    // 1:16384.
4180 #define _WDTPS_32768_2H         0xFF    // 1:32768.
4181 
4182 //----------------------------- CONFIG3H Options -------------------------------
4183 
4184 #define _CCP2MX_OFF_3H          0xFE    // CCP2 input/output is multiplexed with RB3.
4185 #define _CCP2MX_ON_3H           0xFF    // CCP2 input/output is multiplexed with RC1.
4186 #define _PBADEN_OFF_3H          0xFD    // PORTB<4:0> pins are configured as digital I/O on Reset.
4187 #define _PBADEN_ON_3H           0xFF    // PORTB<4:0> pins are configured as analog input channels on Reset.
4188 #define _LPT1OSC_OFF_3H         0xFB    // Timer1 configured for higher power operation.
4189 #define _LPT1OSC_ON_3H          0xFF    // Timer1 configured for low-power operation.
4190 #define _MCLRE_OFF_3H           0x7F    // RE3 input pin enabled; MCLR pin disabled.
4191 #define _MCLRE_ON_3H            0xFF    // MCLR pin enabled; RE3 input pin disabled.
4192 
4193 //----------------------------- CONFIG4L Options -------------------------------
4194 
4195 #define _STVREN_OFF_4L          0xFE    // Stack full/underflow will not cause Reset.
4196 #define _STVREN_ON_4L           0xFF    // Stack full/underflow will cause Reset.
4197 #define _LVP_OFF_4L             0xFB    // Single-Supply ICSP disabled.
4198 #define _LVP_ON_4L              0xFF    // Single-Supply ICSP enabled.
4199 #define _ICPRT_OFF_4L           0xDF    // ICPORT disabled.
4200 #define _ICPRT_ON_4L            0xFF    // ICPORT enabled.
4201 #define _XINST_OFF_4L           0xBF    // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
4202 #define _XINST_ON_4L            0xFF    // Instruction set extension and Indexed Addressing mode enabled.
4203 #define _DEBUG_ON_4L            0x7F    // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
4204 #define _DEBUG_OFF_4L           0xFF    // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
4205 
4206 //----------------------------- CONFIG5L Options -------------------------------
4207 
4208 #define _CP0_ON_5L              0xFE    // Block 0 (000800-001FFFh) is code-protected.
4209 #define _CP0_OFF_5L             0xFF    // Block 0 (000800-001FFFh) is not code-protected.
4210 #define _CP1_ON_5L              0xFD    // Block 1 (002000-003FFFh) is code-protected.
4211 #define _CP1_OFF_5L             0xFF    // Block 1 (002000-003FFFh) is not code-protected.
4212 #define _CP2_ON_5L              0xFB    // Block 2 (004000-005FFFh) is code-protected.
4213 #define _CP2_OFF_5L             0xFF    // Block 2 (004000-005FFFh) is not code-protected.
4214 
4215 //----------------------------- CONFIG5H Options -------------------------------
4216 
4217 #define _CPB_ON_5H              0xBF    // Boot block (000000-0007FFh) is code-protected.
4218 #define _CPB_OFF_5H             0xFF    // Boot block (000000-0007FFh) is not code-protected.
4219 #define _CPD_ON_5H              0x7F    // Data EEPROM is code-protected.
4220 #define _CPD_OFF_5H             0xFF    // Data EEPROM is not code-protected.
4221 
4222 //----------------------------- CONFIG6L Options -------------------------------
4223 
4224 #define _WRT0_ON_6L             0xFE    // Block 0 (000800-001FFFh) is write-protected.
4225 #define _WRT0_OFF_6L            0xFF    // Block 0 (000800-001FFFh) is not write-protected.
4226 #define _WRT1_ON_6L             0xFD    // Block 1 (002000-003FFFh) is write-protected.
4227 #define _WRT1_OFF_6L            0xFF    // Block 1 (002000-003FFFh) is not write-protected.
4228 #define _WRT2_ON_6L             0xFB    // Block 2 (004000-005FFFh) is write-protected.
4229 #define _WRT2_OFF_6L            0xFF    // Block 2 (004000-005FFFh) is not write-protected.
4230 
4231 //----------------------------- CONFIG6H Options -------------------------------
4232 
4233 #define _WRTC_ON_6H             0xDF    // Configuration registers (300000-3000FFh) are write-protected.
4234 #define _WRTC_OFF_6H            0xFF    // Configuration registers (300000-3000FFh) are not write-protected.
4235 #define _WRTB_ON_6H             0xBF    // Boot block (000000-0007FFh) is write-protected.
4236 #define _WRTB_OFF_6H            0xFF    // Boot block (000000-0007FFh) is not write-protected.
4237 #define _WRTD_ON_6H             0x7F    // Data EEPROM is write-protected.
4238 #define _WRTD_OFF_6H            0xFF    // Data EEPROM is not write-protected.
4239 
4240 //----------------------------- CONFIG7L Options -------------------------------
4241 
4242 #define _EBTR0_ON_7L            0xFE    // Block 0 (000800-001FFFh) is protected from table reads executed in other blocks.
4243 #define _EBTR0_OFF_7L           0xFF    // Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks.
4244 #define _EBTR1_ON_7L            0xFD    // Block 1 (002000-003FFFh) is protected from table reads executed in other blocks.
4245 #define _EBTR1_OFF_7L           0xFF    // Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks.
4246 #define _EBTR2_ON_7L            0xFB    // Block 2 (004000-005FFFh) is protected from table reads executed in other blocks.
4247 #define _EBTR2_OFF_7L           0xFF    // Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks.
4248 
4249 //----------------------------- CONFIG7H Options -------------------------------
4250 
4251 #define _EBTRB_ON_7H            0xBF    // Boot block (000000-0007FFh) is protected from table reads executed in other blocks.
4252 #define _EBTRB_OFF_7H           0xFF    // Boot block (000000-0007FFh) is not protected from table reads executed in other blocks.
4253 
4254 //==============================================================================
4255 
4256 #define __DEVID1                0x3FFFFE
4257 #define __DEVID2                0x3FFFFF
4258 
4259 #define __IDLOC0                0x200000
4260 #define __IDLOC1                0x200001
4261 #define __IDLOC2                0x200002
4262 #define __IDLOC3                0x200003
4263 #define __IDLOC4                0x200004
4264 #define __IDLOC5                0x200005
4265 #define __IDLOC6                0x200006
4266 #define __IDLOC7                0x200007
4267 
4268 #endif // #ifndef __PIC18LF4458_H__
4269