1 /*
2  * This declarations of the PIC18LF252 MCU.
3  *
4  * This file is part of the GNU PIC library for SDCC, originally
5  * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
6  *
7  * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:58 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 __PIC18LF252_H__
26 #define __PIC18LF252_H__
27 
28 //==============================================================================
29 
30 //==============================================================================
31 //
32 //	Register Definitions
33 //
34 //==============================================================================
35 
36 
37 //==============================================================================
38 //        PORTA Bits
39 
40 extern __at(0x0F80) __sfr PORTA;
41 
42 typedef union
43   {
44   struct
45     {
46     unsigned RA0                : 1;
47     unsigned RA1                : 1;
48     unsigned RA2                : 1;
49     unsigned RA3                : 1;
50     unsigned RA4                : 1;
51     unsigned RA5                : 1;
52     unsigned RA6                : 1;
53     unsigned                    : 1;
54     };
55 
56   struct
57     {
58     unsigned AN0                : 1;
59     unsigned AN1                : 1;
60     unsigned AN2                : 1;
61     unsigned AN3                : 1;
62     unsigned T0CKI              : 1;
63     unsigned AN4                : 1;
64     unsigned OSC2               : 1;
65     unsigned                    : 1;
66     };
67 
68   struct
69     {
70     unsigned                    : 1;
71     unsigned                    : 1;
72     unsigned VREFM              : 1;
73     unsigned VREFP              : 1;
74     unsigned                    : 1;
75     unsigned SS                 : 1;
76     unsigned CLKO               : 1;
77     unsigned                    : 1;
78     };
79 
80   struct
81     {
82     unsigned                    : 1;
83     unsigned                    : 1;
84     unsigned                    : 1;
85     unsigned                    : 1;
86     unsigned                    : 1;
87     unsigned LVDIN              : 1;
88     unsigned                    : 1;
89     unsigned                    : 1;
90     };
91 
92   struct
93     {
94     unsigned RA                 : 7;
95     unsigned                    : 1;
96     };
97   } __PORTAbits_t;
98 
99 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
100 
101 #define _PORTA_RA0              0x01
102 #define _PORTA_AN0              0x01
103 #define _PORTA_RA1              0x02
104 #define _PORTA_AN1              0x02
105 #define _PORTA_RA2              0x04
106 #define _PORTA_AN2              0x04
107 #define _PORTA_VREFM            0x04
108 #define _PORTA_RA3              0x08
109 #define _PORTA_AN3              0x08
110 #define _PORTA_VREFP            0x08
111 #define _PORTA_RA4              0x10
112 #define _PORTA_T0CKI            0x10
113 #define _PORTA_RA5              0x20
114 #define _PORTA_AN4              0x20
115 #define _PORTA_SS               0x20
116 #define _PORTA_LVDIN            0x20
117 #define _PORTA_RA6              0x40
118 #define _PORTA_OSC2             0x40
119 #define _PORTA_CLKO             0x40
120 
121 //==============================================================================
122 
123 
124 //==============================================================================
125 //        PORTB Bits
126 
127 extern __at(0x0F81) __sfr PORTB;
128 
129 typedef union
130   {
131   struct
132     {
133     unsigned RB0                : 1;
134     unsigned RB1                : 1;
135     unsigned RB2                : 1;
136     unsigned RB3                : 1;
137     unsigned RB4                : 1;
138     unsigned RB5                : 1;
139     unsigned RB6                : 1;
140     unsigned RB7                : 1;
141     };
142 
143   struct
144     {
145     unsigned INT0               : 1;
146     unsigned INT1               : 1;
147     unsigned INT2               : 1;
148     unsigned CCP2               : 1;
149     unsigned                    : 1;
150     unsigned PGM                : 1;
151     unsigned PGC                : 1;
152     unsigned PGD                : 1;
153     };
154 
155   struct
156     {
157     unsigned                    : 1;
158     unsigned                    : 1;
159     unsigned                    : 1;
160     unsigned CCP2A              : 1;
161     unsigned                    : 1;
162     unsigned                    : 1;
163     unsigned                    : 1;
164     unsigned                    : 1;
165     };
166 
167   struct
168     {
169     unsigned INT                : 3;
170     unsigned                    : 5;
171     };
172   } __PORTBbits_t;
173 
174 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
175 
176 #define _PORTB_RB0              0x01
177 #define _PORTB_INT0             0x01
178 #define _PORTB_RB1              0x02
179 #define _PORTB_INT1             0x02
180 #define _PORTB_RB2              0x04
181 #define _PORTB_INT2             0x04
182 #define _PORTB_RB3              0x08
183 #define _PORTB_CCP2             0x08
184 #define _PORTB_CCP2A            0x08
185 #define _PORTB_RB4              0x10
186 #define _PORTB_RB5              0x20
187 #define _PORTB_PGM              0x20
188 #define _PORTB_RB6              0x40
189 #define _PORTB_PGC              0x40
190 #define _PORTB_RB7              0x80
191 #define _PORTB_PGD              0x80
192 
193 //==============================================================================
194 
195 
196 //==============================================================================
197 //        PORTC Bits
198 
199 extern __at(0x0F82) __sfr PORTC;
200 
201 typedef union
202   {
203   struct
204     {
205     unsigned RC0                : 1;
206     unsigned RC1                : 1;
207     unsigned RC2                : 1;
208     unsigned RC3                : 1;
209     unsigned RC4                : 1;
210     unsigned RC5                : 1;
211     unsigned RC6                : 1;
212     unsigned RC7                : 1;
213     };
214 
215   struct
216     {
217     unsigned T1OSO              : 1;
218     unsigned T1OSI              : 1;
219     unsigned CCP1               : 1;
220     unsigned SCK                : 1;
221     unsigned SDI                : 1;
222     unsigned SDO                : 1;
223     unsigned TX                 : 1;
224     unsigned RX                 : 1;
225     };
226 
227   struct
228     {
229     unsigned T1CKI              : 1;
230     unsigned CCP2               : 1;
231     unsigned                    : 1;
232     unsigned SCL                : 1;
233     unsigned SDA                : 1;
234     unsigned                    : 1;
235     unsigned CK                 : 1;
236     unsigned                    : 1;
237     };
238   } __PORTCbits_t;
239 
240 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
241 
242 #define _PORTC_RC0              0x01
243 #define _PORTC_T1OSO            0x01
244 #define _PORTC_T1CKI            0x01
245 #define _PORTC_RC1              0x02
246 #define _PORTC_T1OSI            0x02
247 #define _PORTC_CCP2             0x02
248 #define _PORTC_RC2              0x04
249 #define _PORTC_CCP1             0x04
250 #define _PORTC_RC3              0x08
251 #define _PORTC_SCK              0x08
252 #define _PORTC_SCL              0x08
253 #define _PORTC_RC4              0x10
254 #define _PORTC_SDI              0x10
255 #define _PORTC_SDA              0x10
256 #define _PORTC_RC5              0x20
257 #define _PORTC_SDO              0x20
258 #define _PORTC_RC6              0x40
259 #define _PORTC_TX               0x40
260 #define _PORTC_CK               0x40
261 #define _PORTC_RC7              0x80
262 #define _PORTC_RX               0x80
263 
264 //==============================================================================
265 
266 
267 //==============================================================================
268 //        LATA Bits
269 
270 extern __at(0x0F89) __sfr LATA;
271 
272 typedef union
273   {
274   struct
275     {
276     unsigned LATA0              : 1;
277     unsigned LATA1              : 1;
278     unsigned LATA2              : 1;
279     unsigned LATA3              : 1;
280     unsigned LATA4              : 1;
281     unsigned LATA5              : 1;
282     unsigned LATA6              : 1;
283     unsigned                    : 1;
284     };
285 
286   struct
287     {
288     unsigned LATA               : 7;
289     unsigned                    : 1;
290     };
291   } __LATAbits_t;
292 
293 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
294 
295 #define _LATA0                  0x01
296 #define _LATA1                  0x02
297 #define _LATA2                  0x04
298 #define _LATA3                  0x08
299 #define _LATA4                  0x10
300 #define _LATA5                  0x20
301 #define _LATA6                  0x40
302 
303 //==============================================================================
304 
305 
306 //==============================================================================
307 //        LATB Bits
308 
309 extern __at(0x0F8A) __sfr LATB;
310 
311 typedef struct
312   {
313   unsigned LATB0                : 1;
314   unsigned LATB1                : 1;
315   unsigned LATB2                : 1;
316   unsigned LATB3                : 1;
317   unsigned LATB4                : 1;
318   unsigned LATB5                : 1;
319   unsigned LATB6                : 1;
320   unsigned LATB7                : 1;
321   } __LATBbits_t;
322 
323 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
324 
325 #define _LATB0                  0x01
326 #define _LATB1                  0x02
327 #define _LATB2                  0x04
328 #define _LATB3                  0x08
329 #define _LATB4                  0x10
330 #define _LATB5                  0x20
331 #define _LATB6                  0x40
332 #define _LATB7                  0x80
333 
334 //==============================================================================
335 
336 
337 //==============================================================================
338 //        LATC Bits
339 
340 extern __at(0x0F8B) __sfr LATC;
341 
342 typedef struct
343   {
344   unsigned LATC0                : 1;
345   unsigned LATC1                : 1;
346   unsigned LATC2                : 1;
347   unsigned LATC3                : 1;
348   unsigned LATC4                : 1;
349   unsigned LATC5                : 1;
350   unsigned LATC6                : 1;
351   unsigned LATC7                : 1;
352   } __LATCbits_t;
353 
354 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
355 
356 #define _LATC0                  0x01
357 #define _LATC1                  0x02
358 #define _LATC2                  0x04
359 #define _LATC3                  0x08
360 #define _LATC4                  0x10
361 #define _LATC5                  0x20
362 #define _LATC6                  0x40
363 #define _LATC7                  0x80
364 
365 //==============================================================================
366 
367 
368 //==============================================================================
369 //        DDRA Bits
370 
371 extern __at(0x0F92) __sfr DDRA;
372 
373 typedef union
374   {
375   struct
376     {
377     unsigned TRISA0             : 1;
378     unsigned TRISA1             : 1;
379     unsigned TRISA2             : 1;
380     unsigned TRISA3             : 1;
381     unsigned TRISA4             : 1;
382     unsigned TRISA5             : 1;
383     unsigned TRISA6             : 1;
384     unsigned                    : 1;
385     };
386 
387   struct
388     {
389     unsigned RA0                : 1;
390     unsigned RA1                : 1;
391     unsigned RA2                : 1;
392     unsigned RA3                : 1;
393     unsigned RA4                : 1;
394     unsigned RA5                : 1;
395     unsigned RA6                : 1;
396     unsigned                    : 1;
397     };
398 
399   struct
400     {
401     unsigned RA                 : 7;
402     unsigned                    : 1;
403     };
404 
405   struct
406     {
407     unsigned TRISA              : 7;
408     unsigned                    : 1;
409     };
410   } __DDRAbits_t;
411 
412 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
413 
414 #define _TRISA0                 0x01
415 #define _RA0                    0x01
416 #define _TRISA1                 0x02
417 #define _RA1                    0x02
418 #define _TRISA2                 0x04
419 #define _RA2                    0x04
420 #define _TRISA3                 0x08
421 #define _RA3                    0x08
422 #define _TRISA4                 0x10
423 #define _RA4                    0x10
424 #define _TRISA5                 0x20
425 #define _RA5                    0x20
426 #define _TRISA6                 0x40
427 #define _RA6                    0x40
428 
429 //==============================================================================
430 
431 
432 //==============================================================================
433 //        TRISA Bits
434 
435 extern __at(0x0F92) __sfr TRISA;
436 
437 typedef union
438   {
439   struct
440     {
441     unsigned TRISA0             : 1;
442     unsigned TRISA1             : 1;
443     unsigned TRISA2             : 1;
444     unsigned TRISA3             : 1;
445     unsigned TRISA4             : 1;
446     unsigned TRISA5             : 1;
447     unsigned TRISA6             : 1;
448     unsigned                    : 1;
449     };
450 
451   struct
452     {
453     unsigned RA0                : 1;
454     unsigned RA1                : 1;
455     unsigned RA2                : 1;
456     unsigned RA3                : 1;
457     unsigned RA4                : 1;
458     unsigned RA5                : 1;
459     unsigned RA6                : 1;
460     unsigned                    : 1;
461     };
462 
463   struct
464     {
465     unsigned RA                 : 7;
466     unsigned                    : 1;
467     };
468 
469   struct
470     {
471     unsigned TRISA              : 7;
472     unsigned                    : 1;
473     };
474   } __TRISAbits_t;
475 
476 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
477 
478 #define _TRISA_TRISA0           0x01
479 #define _TRISA_RA0              0x01
480 #define _TRISA_TRISA1           0x02
481 #define _TRISA_RA1              0x02
482 #define _TRISA_TRISA2           0x04
483 #define _TRISA_RA2              0x04
484 #define _TRISA_TRISA3           0x08
485 #define _TRISA_RA3              0x08
486 #define _TRISA_TRISA4           0x10
487 #define _TRISA_RA4              0x10
488 #define _TRISA_TRISA5           0x20
489 #define _TRISA_RA5              0x20
490 #define _TRISA_TRISA6           0x40
491 #define _TRISA_RA6              0x40
492 
493 //==============================================================================
494 
495 
496 //==============================================================================
497 //        DDRB Bits
498 
499 extern __at(0x0F93) __sfr DDRB;
500 
501 typedef union
502   {
503   struct
504     {
505     unsigned TRISB0             : 1;
506     unsigned TRISB1             : 1;
507     unsigned TRISB2             : 1;
508     unsigned TRISB3             : 1;
509     unsigned TRISB4             : 1;
510     unsigned TRISB5             : 1;
511     unsigned TRISB6             : 1;
512     unsigned TRISB7             : 1;
513     };
514 
515   struct
516     {
517     unsigned RB0                : 1;
518     unsigned RB1                : 1;
519     unsigned RB2                : 1;
520     unsigned RB3                : 1;
521     unsigned RB4                : 1;
522     unsigned RB5                : 1;
523     unsigned RB6                : 1;
524     unsigned RB7                : 1;
525     };
526 
527   struct
528     {
529     unsigned                    : 1;
530     unsigned                    : 1;
531     unsigned                    : 1;
532     unsigned CCP2               : 1;
533     unsigned                    : 1;
534     unsigned                    : 1;
535     unsigned                    : 1;
536     unsigned                    : 1;
537     };
538   } __DDRBbits_t;
539 
540 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
541 
542 #define _TRISB0                 0x01
543 #define _RB0                    0x01
544 #define _TRISB1                 0x02
545 #define _RB1                    0x02
546 #define _TRISB2                 0x04
547 #define _RB2                    0x04
548 #define _TRISB3                 0x08
549 #define _RB3                    0x08
550 #define _CCP2                   0x08
551 #define _TRISB4                 0x10
552 #define _RB4                    0x10
553 #define _TRISB5                 0x20
554 #define _RB5                    0x20
555 #define _TRISB6                 0x40
556 #define _RB6                    0x40
557 #define _TRISB7                 0x80
558 #define _RB7                    0x80
559 
560 //==============================================================================
561 
562 
563 //==============================================================================
564 //        TRISB Bits
565 
566 extern __at(0x0F93) __sfr TRISB;
567 
568 typedef union
569   {
570   struct
571     {
572     unsigned TRISB0             : 1;
573     unsigned TRISB1             : 1;
574     unsigned TRISB2             : 1;
575     unsigned TRISB3             : 1;
576     unsigned TRISB4             : 1;
577     unsigned TRISB5             : 1;
578     unsigned TRISB6             : 1;
579     unsigned TRISB7             : 1;
580     };
581 
582   struct
583     {
584     unsigned RB0                : 1;
585     unsigned RB1                : 1;
586     unsigned RB2                : 1;
587     unsigned RB3                : 1;
588     unsigned RB4                : 1;
589     unsigned RB5                : 1;
590     unsigned RB6                : 1;
591     unsigned RB7                : 1;
592     };
593 
594   struct
595     {
596     unsigned                    : 1;
597     unsigned                    : 1;
598     unsigned                    : 1;
599     unsigned CCP2               : 1;
600     unsigned                    : 1;
601     unsigned                    : 1;
602     unsigned                    : 1;
603     unsigned                    : 1;
604     };
605   } __TRISBbits_t;
606 
607 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
608 
609 #define _TRISB_TRISB0           0x01
610 #define _TRISB_RB0              0x01
611 #define _TRISB_TRISB1           0x02
612 #define _TRISB_RB1              0x02
613 #define _TRISB_TRISB2           0x04
614 #define _TRISB_RB2              0x04
615 #define _TRISB_TRISB3           0x08
616 #define _TRISB_RB3              0x08
617 #define _TRISB_CCP2             0x08
618 #define _TRISB_TRISB4           0x10
619 #define _TRISB_RB4              0x10
620 #define _TRISB_TRISB5           0x20
621 #define _TRISB_RB5              0x20
622 #define _TRISB_TRISB6           0x40
623 #define _TRISB_RB6              0x40
624 #define _TRISB_TRISB7           0x80
625 #define _TRISB_RB7              0x80
626 
627 //==============================================================================
628 
629 
630 //==============================================================================
631 //        DDRC Bits
632 
633 extern __at(0x0F94) __sfr DDRC;
634 
635 typedef union
636   {
637   struct
638     {
639     unsigned TRISC0             : 1;
640     unsigned TRISC1             : 1;
641     unsigned TRISC2             : 1;
642     unsigned TRISC3             : 1;
643     unsigned TRISC4             : 1;
644     unsigned TRISC5             : 1;
645     unsigned TRISC6             : 1;
646     unsigned TRISC7             : 1;
647     };
648 
649   struct
650     {
651     unsigned RC0                : 1;
652     unsigned RC1                : 1;
653     unsigned RC2                : 1;
654     unsigned RC3                : 1;
655     unsigned RC4                : 1;
656     unsigned RC5                : 1;
657     unsigned RC6                : 1;
658     unsigned RC7                : 1;
659     };
660 
661   struct
662     {
663     unsigned                    : 1;
664     unsigned CCP2               : 1;
665     unsigned                    : 1;
666     unsigned                    : 1;
667     unsigned                    : 1;
668     unsigned                    : 1;
669     unsigned                    : 1;
670     unsigned                    : 1;
671     };
672   } __DDRCbits_t;
673 
674 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
675 
676 #define _DDRC_TRISC0            0x01
677 #define _DDRC_RC0               0x01
678 #define _DDRC_TRISC1            0x02
679 #define _DDRC_RC1               0x02
680 #define _DDRC_CCP2              0x02
681 #define _DDRC_TRISC2            0x04
682 #define _DDRC_RC2               0x04
683 #define _DDRC_TRISC3            0x08
684 #define _DDRC_RC3               0x08
685 #define _DDRC_TRISC4            0x10
686 #define _DDRC_RC4               0x10
687 #define _DDRC_TRISC5            0x20
688 #define _DDRC_RC5               0x20
689 #define _DDRC_TRISC6            0x40
690 #define _DDRC_RC6               0x40
691 #define _DDRC_TRISC7            0x80
692 #define _DDRC_RC7               0x80
693 
694 //==============================================================================
695 
696 
697 //==============================================================================
698 //        TRISC Bits
699 
700 extern __at(0x0F94) __sfr TRISC;
701 
702 typedef union
703   {
704   struct
705     {
706     unsigned TRISC0             : 1;
707     unsigned TRISC1             : 1;
708     unsigned TRISC2             : 1;
709     unsigned TRISC3             : 1;
710     unsigned TRISC4             : 1;
711     unsigned TRISC5             : 1;
712     unsigned TRISC6             : 1;
713     unsigned TRISC7             : 1;
714     };
715 
716   struct
717     {
718     unsigned RC0                : 1;
719     unsigned RC1                : 1;
720     unsigned RC2                : 1;
721     unsigned RC3                : 1;
722     unsigned RC4                : 1;
723     unsigned RC5                : 1;
724     unsigned RC6                : 1;
725     unsigned RC7                : 1;
726     };
727 
728   struct
729     {
730     unsigned                    : 1;
731     unsigned CCP2               : 1;
732     unsigned                    : 1;
733     unsigned                    : 1;
734     unsigned                    : 1;
735     unsigned                    : 1;
736     unsigned                    : 1;
737     unsigned                    : 1;
738     };
739   } __TRISCbits_t;
740 
741 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
742 
743 #define _TRISC_TRISC0           0x01
744 #define _TRISC_RC0              0x01
745 #define _TRISC_TRISC1           0x02
746 #define _TRISC_RC1              0x02
747 #define _TRISC_CCP2             0x02
748 #define _TRISC_TRISC2           0x04
749 #define _TRISC_RC2              0x04
750 #define _TRISC_TRISC3           0x08
751 #define _TRISC_RC3              0x08
752 #define _TRISC_TRISC4           0x10
753 #define _TRISC_RC4              0x10
754 #define _TRISC_TRISC5           0x20
755 #define _TRISC_RC5              0x20
756 #define _TRISC_TRISC6           0x40
757 #define _TRISC_RC6              0x40
758 #define _TRISC_TRISC7           0x80
759 #define _TRISC_RC7              0x80
760 
761 //==============================================================================
762 
763 
764 //==============================================================================
765 //        PIE1 Bits
766 
767 extern __at(0x0F9D) __sfr PIE1;
768 
769 typedef struct
770   {
771   unsigned TMR1IE               : 1;
772   unsigned TMR2IE               : 1;
773   unsigned CCP1IE               : 1;
774   unsigned SSPIE                : 1;
775   unsigned TXIE                 : 1;
776   unsigned RCIE                 : 1;
777   unsigned ADIE                 : 1;
778   unsigned                      : 1;
779   } __PIE1bits_t;
780 
781 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
782 
783 #define _TMR1IE                 0x01
784 #define _TMR2IE                 0x02
785 #define _CCP1IE                 0x04
786 #define _SSPIE                  0x08
787 #define _TXIE                   0x10
788 #define _RCIE                   0x20
789 #define _ADIE                   0x40
790 
791 //==============================================================================
792 
793 
794 //==============================================================================
795 //        PIR1 Bits
796 
797 extern __at(0x0F9E) __sfr PIR1;
798 
799 typedef struct
800   {
801   unsigned TMR1IF               : 1;
802   unsigned TMR2IF               : 1;
803   unsigned CCP1IF               : 1;
804   unsigned SSPIF                : 1;
805   unsigned TXIF                 : 1;
806   unsigned RCIF                 : 1;
807   unsigned ADIF                 : 1;
808   unsigned                      : 1;
809   } __PIR1bits_t;
810 
811 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
812 
813 #define _TMR1IF                 0x01
814 #define _TMR2IF                 0x02
815 #define _CCP1IF                 0x04
816 #define _SSPIF                  0x08
817 #define _TXIF                   0x10
818 #define _RCIF                   0x20
819 #define _ADIF                   0x40
820 
821 //==============================================================================
822 
823 
824 //==============================================================================
825 //        IPR1 Bits
826 
827 extern __at(0x0F9F) __sfr IPR1;
828 
829 typedef struct
830   {
831   unsigned TMR1IP               : 1;
832   unsigned TMR2IP               : 1;
833   unsigned CCP1IP               : 1;
834   unsigned SSPIP                : 1;
835   unsigned TXIP                 : 1;
836   unsigned RCIP                 : 1;
837   unsigned ADIP                 : 1;
838   unsigned                      : 1;
839   } __IPR1bits_t;
840 
841 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
842 
843 #define _TMR1IP                 0x01
844 #define _TMR2IP                 0x02
845 #define _CCP1IP                 0x04
846 #define _SSPIP                  0x08
847 #define _TXIP                   0x10
848 #define _RCIP                   0x20
849 #define _ADIP                   0x40
850 
851 //==============================================================================
852 
853 
854 //==============================================================================
855 //        PIE2 Bits
856 
857 extern __at(0x0FA0) __sfr PIE2;
858 
859 typedef struct
860   {
861   unsigned CCP2IE               : 1;
862   unsigned TMR3IE               : 1;
863   unsigned LVDIE                : 1;
864   unsigned BCLIE                : 1;
865   unsigned EEIE                 : 1;
866   unsigned                      : 1;
867   unsigned                      : 1;
868   unsigned                      : 1;
869   } __PIE2bits_t;
870 
871 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
872 
873 #define _CCP2IE                 0x01
874 #define _TMR3IE                 0x02
875 #define _LVDIE                  0x04
876 #define _BCLIE                  0x08
877 #define _EEIE                   0x10
878 
879 //==============================================================================
880 
881 
882 //==============================================================================
883 //        PIR2 Bits
884 
885 extern __at(0x0FA1) __sfr PIR2;
886 
887 typedef struct
888   {
889   unsigned CCP2IF               : 1;
890   unsigned TMR3IF               : 1;
891   unsigned LVDIF                : 1;
892   unsigned BCLIF                : 1;
893   unsigned EEIF                 : 1;
894   unsigned                      : 1;
895   unsigned                      : 1;
896   unsigned                      : 1;
897   } __PIR2bits_t;
898 
899 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
900 
901 #define _CCP2IF                 0x01
902 #define _TMR3IF                 0x02
903 #define _LVDIF                  0x04
904 #define _BCLIF                  0x08
905 #define _EEIF                   0x10
906 
907 //==============================================================================
908 
909 
910 //==============================================================================
911 //        IPR2 Bits
912 
913 extern __at(0x0FA2) __sfr IPR2;
914 
915 typedef struct
916   {
917   unsigned CCP2IP               : 1;
918   unsigned TMR3IP               : 1;
919   unsigned LVDIP                : 1;
920   unsigned BCLIP                : 1;
921   unsigned EEIP                 : 1;
922   unsigned                      : 1;
923   unsigned                      : 1;
924   unsigned                      : 1;
925   } __IPR2bits_t;
926 
927 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
928 
929 #define _CCP2IP                 0x01
930 #define _TMR3IP                 0x02
931 #define _LVDIP                  0x04
932 #define _BCLIP                  0x08
933 #define _EEIP                   0x10
934 
935 //==============================================================================
936 
937 
938 //==============================================================================
939 //        EECON1 Bits
940 
941 extern __at(0x0FA6) __sfr EECON1;
942 
943 typedef struct
944   {
945   unsigned RD                   : 1;
946   unsigned WR                   : 1;
947   unsigned WREN                 : 1;
948   unsigned WRERR                : 1;
949   unsigned FREE                 : 1;
950   unsigned                      : 1;
951   unsigned CFGS                 : 1;
952   unsigned EEPGD                : 1;
953   } __EECON1bits_t;
954 
955 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
956 
957 #define _RD                     0x01
958 #define _WR                     0x02
959 #define _WREN                   0x04
960 #define _WRERR                  0x08
961 #define _FREE                   0x10
962 #define _CFGS                   0x40
963 #define _EEPGD                  0x80
964 
965 //==============================================================================
966 
967 extern __at(0x0FA7) __sfr EECON2;
968 extern __at(0x0FA8) __sfr EEDATA;
969 extern __at(0x0FA9) __sfr EEADR;
970 
971 //==============================================================================
972 //        RCSTA Bits
973 
974 extern __at(0x0FAB) __sfr RCSTA;
975 
976 typedef union
977   {
978   struct
979     {
980     unsigned RX9D               : 1;
981     unsigned OERR               : 1;
982     unsigned FERR               : 1;
983     unsigned ADDEN              : 1;
984     unsigned CREN               : 1;
985     unsigned SREN               : 1;
986     unsigned RX9                : 1;
987     unsigned SPEN               : 1;
988     };
989 
990   struct
991     {
992     unsigned RCD8               : 1;
993     unsigned                    : 1;
994     unsigned                    : 1;
995     unsigned                    : 1;
996     unsigned                    : 1;
997     unsigned                    : 1;
998     unsigned RC8_9              : 1;
999     unsigned                    : 1;
1000     };
1001 
1002   struct
1003     {
1004     unsigned                    : 1;
1005     unsigned                    : 1;
1006     unsigned                    : 1;
1007     unsigned                    : 1;
1008     unsigned                    : 1;
1009     unsigned                    : 1;
1010     unsigned NOT_RC8            : 1;
1011     unsigned                    : 1;
1012     };
1013 
1014   struct
1015     {
1016     unsigned                    : 1;
1017     unsigned                    : 1;
1018     unsigned                    : 1;
1019     unsigned                    : 1;
1020     unsigned                    : 1;
1021     unsigned                    : 1;
1022     unsigned RC9                : 1;
1023     unsigned                    : 1;
1024     };
1025   } __RCSTAbits_t;
1026 
1027 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1028 
1029 #define _RX9D                   0x01
1030 #define _RCD8                   0x01
1031 #define _OERR                   0x02
1032 #define _FERR                   0x04
1033 #define _ADDEN                  0x08
1034 #define _CREN                   0x10
1035 #define _SREN                   0x20
1036 #define _RX9                    0x40
1037 #define _RC8_9                  0x40
1038 #define _NOT_RC8                0x40
1039 #define _RC9                    0x40
1040 #define _SPEN                   0x80
1041 
1042 //==============================================================================
1043 
1044 
1045 //==============================================================================
1046 //        TXSTA Bits
1047 
1048 extern __at(0x0FAC) __sfr TXSTA;
1049 
1050 typedef union
1051   {
1052   struct
1053     {
1054     unsigned TX9D               : 1;
1055     unsigned TRMT               : 1;
1056     unsigned BRGH               : 1;
1057     unsigned                    : 1;
1058     unsigned SYNC               : 1;
1059     unsigned TXEN               : 1;
1060     unsigned TX9                : 1;
1061     unsigned CSRC               : 1;
1062     };
1063 
1064   struct
1065     {
1066     unsigned TXD8               : 1;
1067     unsigned                    : 1;
1068     unsigned                    : 1;
1069     unsigned                    : 1;
1070     unsigned                    : 1;
1071     unsigned                    : 1;
1072     unsigned TX8_9              : 1;
1073     unsigned                    : 1;
1074     };
1075 
1076   struct
1077     {
1078     unsigned                    : 1;
1079     unsigned                    : 1;
1080     unsigned                    : 1;
1081     unsigned                    : 1;
1082     unsigned                    : 1;
1083     unsigned                    : 1;
1084     unsigned NOT_TX8            : 1;
1085     unsigned                    : 1;
1086     };
1087   } __TXSTAbits_t;
1088 
1089 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1090 
1091 #define _TX9D                   0x01
1092 #define _TXD8                   0x01
1093 #define _TRMT                   0x02
1094 #define _BRGH                   0x04
1095 #define _SYNC                   0x10
1096 #define _TXEN                   0x20
1097 #define _TX9                    0x40
1098 #define _TX8_9                  0x40
1099 #define _NOT_TX8                0x40
1100 #define _CSRC                   0x80
1101 
1102 //==============================================================================
1103 
1104 extern __at(0x0FAD) __sfr TXREG;
1105 extern __at(0x0FAE) __sfr RCREG;
1106 extern __at(0x0FAF) __sfr SPBRG;
1107 
1108 //==============================================================================
1109 //        T3CON Bits
1110 
1111 extern __at(0x0FB1) __sfr T3CON;
1112 
1113 typedef union
1114   {
1115   struct
1116     {
1117     unsigned TMR3ON             : 1;
1118     unsigned TMR3CS             : 1;
1119     unsigned NOT_T3SYNC         : 1;
1120     unsigned T3CCP1             : 1;
1121     unsigned T3CKPS0            : 1;
1122     unsigned T3CKPS1            : 1;
1123     unsigned T3CCP2             : 1;
1124     unsigned RD16               : 1;
1125     };
1126 
1127   struct
1128     {
1129     unsigned                    : 1;
1130     unsigned                    : 1;
1131     unsigned T3SYNC             : 1;
1132     unsigned                    : 1;
1133     unsigned                    : 1;
1134     unsigned                    : 1;
1135     unsigned                    : 1;
1136     unsigned                    : 1;
1137     };
1138 
1139   struct
1140     {
1141     unsigned                    : 1;
1142     unsigned                    : 1;
1143     unsigned T3INSYNC           : 1;
1144     unsigned                    : 1;
1145     unsigned                    : 1;
1146     unsigned                    : 1;
1147     unsigned                    : 1;
1148     unsigned                    : 1;
1149     };
1150 
1151   struct
1152     {
1153     unsigned                    : 4;
1154     unsigned T3CKPS             : 2;
1155     unsigned                    : 2;
1156     };
1157   } __T3CONbits_t;
1158 
1159 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1160 
1161 #define _T3CON_TMR3ON           0x01
1162 #define _T3CON_TMR3CS           0x02
1163 #define _T3CON_NOT_T3SYNC       0x04
1164 #define _T3CON_T3SYNC           0x04
1165 #define _T3CON_T3INSYNC         0x04
1166 #define _T3CON_T3CCP1           0x08
1167 #define _T3CON_T3CKPS0          0x10
1168 #define _T3CON_T3CKPS1          0x20
1169 #define _T3CON_T3CCP2           0x40
1170 #define _T3CON_RD16             0x80
1171 
1172 //==============================================================================
1173 
1174 extern __at(0x0FB2) __sfr TMR3;
1175 extern __at(0x0FB2) __sfr TMR3L;
1176 extern __at(0x0FB3) __sfr TMR3H;
1177 
1178 //==============================================================================
1179 //        CCP2CON Bits
1180 
1181 extern __at(0x0FBA) __sfr CCP2CON;
1182 
1183 typedef union
1184   {
1185   struct
1186     {
1187     unsigned CCP2M0             : 1;
1188     unsigned CCP2M1             : 1;
1189     unsigned CCP2M2             : 1;
1190     unsigned CCP2M3             : 1;
1191     unsigned DC2B0              : 1;
1192     unsigned DC2B1              : 1;
1193     unsigned                    : 1;
1194     unsigned                    : 1;
1195     };
1196 
1197   struct
1198     {
1199     unsigned                    : 1;
1200     unsigned                    : 1;
1201     unsigned                    : 1;
1202     unsigned                    : 1;
1203     unsigned CCP2Y              : 1;
1204     unsigned CCP2X              : 1;
1205     unsigned                    : 1;
1206     unsigned                    : 1;
1207     };
1208 
1209   struct
1210     {
1211     unsigned                    : 1;
1212     unsigned                    : 1;
1213     unsigned                    : 1;
1214     unsigned                    : 1;
1215     unsigned                    : 1;
1216     unsigned DCCPX              : 1;
1217     unsigned                    : 1;
1218     unsigned                    : 1;
1219     };
1220 
1221   struct
1222     {
1223     unsigned CCP2M              : 4;
1224     unsigned                    : 4;
1225     };
1226 
1227   struct
1228     {
1229     unsigned                    : 4;
1230     unsigned DC2B               : 2;
1231     unsigned                    : 2;
1232     };
1233   } __CCP2CONbits_t;
1234 
1235 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1236 
1237 #define _CCP2M0                 0x01
1238 #define _CCP2M1                 0x02
1239 #define _CCP2M2                 0x04
1240 #define _CCP2M3                 0x08
1241 #define _DC2B0                  0x10
1242 #define _CCP2Y                  0x10
1243 #define _DC2B1                  0x20
1244 #define _CCP2X                  0x20
1245 #define _DCCPX                  0x20
1246 
1247 //==============================================================================
1248 
1249 extern __at(0x0FBB) __sfr CCPR2;
1250 extern __at(0x0FBB) __sfr CCPR2L;
1251 extern __at(0x0FBC) __sfr CCPR2H;
1252 
1253 //==============================================================================
1254 //        CCP1CON Bits
1255 
1256 extern __at(0x0FBD) __sfr CCP1CON;
1257 
1258 typedef union
1259   {
1260   struct
1261     {
1262     unsigned CCP1M0             : 1;
1263     unsigned CCP1M1             : 1;
1264     unsigned CCP1M2             : 1;
1265     unsigned CCP1M3             : 1;
1266     unsigned DC1B0              : 1;
1267     unsigned DC1B1              : 1;
1268     unsigned                    : 1;
1269     unsigned                    : 1;
1270     };
1271 
1272   struct
1273     {
1274     unsigned                    : 1;
1275     unsigned                    : 1;
1276     unsigned                    : 1;
1277     unsigned                    : 1;
1278     unsigned CCP1Y              : 1;
1279     unsigned CCP1X              : 1;
1280     unsigned                    : 1;
1281     unsigned                    : 1;
1282     };
1283 
1284   struct
1285     {
1286     unsigned CCP1M              : 4;
1287     unsigned                    : 4;
1288     };
1289 
1290   struct
1291     {
1292     unsigned                    : 4;
1293     unsigned DC1B               : 2;
1294     unsigned                    : 2;
1295     };
1296   } __CCP1CONbits_t;
1297 
1298 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1299 
1300 #define _CCP1M0                 0x01
1301 #define _CCP1M1                 0x02
1302 #define _CCP1M2                 0x04
1303 #define _CCP1M3                 0x08
1304 #define _DC1B0                  0x10
1305 #define _CCP1Y                  0x10
1306 #define _DC1B1                  0x20
1307 #define _CCP1X                  0x20
1308 
1309 //==============================================================================
1310 
1311 extern __at(0x0FBE) __sfr CCPR1;
1312 extern __at(0x0FBE) __sfr CCPR1L;
1313 extern __at(0x0FBF) __sfr CCPR1H;
1314 
1315 //==============================================================================
1316 //        ADCON1 Bits
1317 
1318 extern __at(0x0FC1) __sfr ADCON1;
1319 
1320 typedef union
1321   {
1322   struct
1323     {
1324     unsigned PCFG0              : 1;
1325     unsigned PCFG1              : 1;
1326     unsigned PCFG2              : 1;
1327     unsigned PCFG3              : 1;
1328     unsigned                    : 1;
1329     unsigned                    : 1;
1330     unsigned ADCS2              : 1;
1331     unsigned ADFM               : 1;
1332     };
1333 
1334   struct
1335     {
1336     unsigned PCFG               : 4;
1337     unsigned                    : 4;
1338     };
1339   } __ADCON1bits_t;
1340 
1341 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1342 
1343 #define _PCFG0                  0x01
1344 #define _PCFG1                  0x02
1345 #define _PCFG2                  0x04
1346 #define _PCFG3                  0x08
1347 #define _ADCS2                  0x40
1348 #define _ADFM                   0x80
1349 
1350 //==============================================================================
1351 
1352 
1353 //==============================================================================
1354 //        ADCON0 Bits
1355 
1356 extern __at(0x0FC2) __sfr ADCON0;
1357 
1358 typedef union
1359   {
1360   struct
1361     {
1362     unsigned ADON               : 1;
1363     unsigned                    : 1;
1364     unsigned GO_NOT_DONE        : 1;
1365     unsigned CHS0               : 1;
1366     unsigned CHS1               : 1;
1367     unsigned CHS2               : 1;
1368     unsigned ADCS0              : 1;
1369     unsigned ADCS1              : 1;
1370     };
1371 
1372   struct
1373     {
1374     unsigned                    : 1;
1375     unsigned                    : 1;
1376     unsigned GO                 : 1;
1377     unsigned                    : 1;
1378     unsigned                    : 1;
1379     unsigned                    : 1;
1380     unsigned                    : 1;
1381     unsigned                    : 1;
1382     };
1383 
1384   struct
1385     {
1386     unsigned                    : 1;
1387     unsigned                    : 1;
1388     unsigned NOT_DONE           : 1;
1389     unsigned                    : 1;
1390     unsigned                    : 1;
1391     unsigned                    : 1;
1392     unsigned                    : 1;
1393     unsigned                    : 1;
1394     };
1395 
1396   struct
1397     {
1398     unsigned                    : 1;
1399     unsigned                    : 1;
1400     unsigned DONE               : 1;
1401     unsigned                    : 1;
1402     unsigned                    : 1;
1403     unsigned                    : 1;
1404     unsigned                    : 1;
1405     unsigned                    : 1;
1406     };
1407 
1408   struct
1409     {
1410     unsigned                    : 1;
1411     unsigned                    : 1;
1412     unsigned GO_DONE            : 1;
1413     unsigned                    : 1;
1414     unsigned                    : 1;
1415     unsigned                    : 1;
1416     unsigned                    : 1;
1417     unsigned                    : 1;
1418     };
1419 
1420   struct
1421     {
1422     unsigned                    : 3;
1423     unsigned CHS                : 3;
1424     unsigned                    : 2;
1425     };
1426 
1427   struct
1428     {
1429     unsigned                    : 6;
1430     unsigned ADCS               : 2;
1431     };
1432   } __ADCON0bits_t;
1433 
1434 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1435 
1436 #define _ADON                   0x01
1437 #define _GO_NOT_DONE            0x04
1438 #define _GO                     0x04
1439 #define _NOT_DONE               0x04
1440 #define _DONE                   0x04
1441 #define _GO_DONE                0x04
1442 #define _CHS0                   0x08
1443 #define _CHS1                   0x10
1444 #define _CHS2                   0x20
1445 #define _ADCS0                  0x40
1446 #define _ADCS1                  0x80
1447 
1448 //==============================================================================
1449 
1450 extern __at(0x0FC3) __sfr ADRES;
1451 extern __at(0x0FC3) __sfr ADRESL;
1452 extern __at(0x0FC4) __sfr ADRESH;
1453 
1454 //==============================================================================
1455 //        SSPCON2 Bits
1456 
1457 extern __at(0x0FC5) __sfr SSPCON2;
1458 
1459 typedef struct
1460   {
1461   unsigned SEN                  : 1;
1462   unsigned RSEN                 : 1;
1463   unsigned PEN                  : 1;
1464   unsigned RCEN                 : 1;
1465   unsigned ACKEN                : 1;
1466   unsigned ACKDT                : 1;
1467   unsigned ACKSTAT              : 1;
1468   unsigned GCEN                 : 1;
1469   } __SSPCON2bits_t;
1470 
1471 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1472 
1473 #define _SEN                    0x01
1474 #define _RSEN                   0x02
1475 #define _PEN                    0x04
1476 #define _RCEN                   0x08
1477 #define _ACKEN                  0x10
1478 #define _ACKDT                  0x20
1479 #define _ACKSTAT                0x40
1480 #define _GCEN                   0x80
1481 
1482 //==============================================================================
1483 
1484 
1485 //==============================================================================
1486 //        SSPCON1 Bits
1487 
1488 extern __at(0x0FC6) __sfr SSPCON1;
1489 
1490 typedef union
1491   {
1492   struct
1493     {
1494     unsigned SSPM0              : 1;
1495     unsigned SSPM1              : 1;
1496     unsigned SSPM2              : 1;
1497     unsigned SSPM3              : 1;
1498     unsigned CKP                : 1;
1499     unsigned SSPEN              : 1;
1500     unsigned SSPOV              : 1;
1501     unsigned WCOL               : 1;
1502     };
1503 
1504   struct
1505     {
1506     unsigned SSPM               : 4;
1507     unsigned                    : 4;
1508     };
1509   } __SSPCON1bits_t;
1510 
1511 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1512 
1513 #define _SSPM0                  0x01
1514 #define _SSPM1                  0x02
1515 #define _SSPM2                  0x04
1516 #define _SSPM3                  0x08
1517 #define _CKP                    0x10
1518 #define _SSPEN                  0x20
1519 #define _SSPOV                  0x40
1520 #define _WCOL                   0x80
1521 
1522 //==============================================================================
1523 
1524 
1525 //==============================================================================
1526 //        SSPSTAT Bits
1527 
1528 extern __at(0x0FC7) __sfr SSPSTAT;
1529 
1530 typedef union
1531   {
1532   struct
1533     {
1534     unsigned BF                 : 1;
1535     unsigned UA                 : 1;
1536     unsigned R_NOT_W            : 1;
1537     unsigned S                  : 1;
1538     unsigned P                  : 1;
1539     unsigned D_NOT_A            : 1;
1540     unsigned CKE                : 1;
1541     unsigned SMP                : 1;
1542     };
1543 
1544   struct
1545     {
1546     unsigned                    : 1;
1547     unsigned                    : 1;
1548     unsigned I2C_READ           : 1;
1549     unsigned I2C_START          : 1;
1550     unsigned I2C_STOP           : 1;
1551     unsigned I2C_DATA           : 1;
1552     unsigned                    : 1;
1553     unsigned                    : 1;
1554     };
1555 
1556   struct
1557     {
1558     unsigned                    : 1;
1559     unsigned                    : 1;
1560     unsigned R                  : 1;
1561     unsigned                    : 1;
1562     unsigned                    : 1;
1563     unsigned D                  : 1;
1564     unsigned                    : 1;
1565     unsigned                    : 1;
1566     };
1567 
1568   struct
1569     {
1570     unsigned                    : 1;
1571     unsigned                    : 1;
1572     unsigned READ_WRITE         : 1;
1573     unsigned                    : 1;
1574     unsigned                    : 1;
1575     unsigned DATA_ADDRESS       : 1;
1576     unsigned                    : 1;
1577     unsigned                    : 1;
1578     };
1579 
1580   struct
1581     {
1582     unsigned                    : 1;
1583     unsigned                    : 1;
1584     unsigned NOT_WRITE          : 1;
1585     unsigned                    : 1;
1586     unsigned                    : 1;
1587     unsigned NOT_ADDRESS        : 1;
1588     unsigned                    : 1;
1589     unsigned                    : 1;
1590     };
1591 
1592   struct
1593     {
1594     unsigned                    : 1;
1595     unsigned                    : 1;
1596     unsigned NOT_W              : 1;
1597     unsigned                    : 1;
1598     unsigned                    : 1;
1599     unsigned NOT_A              : 1;
1600     unsigned                    : 1;
1601     unsigned                    : 1;
1602     };
1603 
1604   struct
1605     {
1606     unsigned                    : 1;
1607     unsigned                    : 1;
1608     unsigned R_W                : 1;
1609     unsigned                    : 1;
1610     unsigned                    : 1;
1611     unsigned D_A                : 1;
1612     unsigned                    : 1;
1613     unsigned                    : 1;
1614     };
1615 
1616   struct
1617     {
1618     unsigned                    : 1;
1619     unsigned                    : 1;
1620     unsigned                    : 1;
1621     unsigned                    : 1;
1622     unsigned                    : 1;
1623     unsigned I2C_DAT            : 1;
1624     unsigned                    : 1;
1625     unsigned                    : 1;
1626     };
1627   } __SSPSTATbits_t;
1628 
1629 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1630 
1631 #define _BF                     0x01
1632 #define _UA                     0x02
1633 #define _R_NOT_W                0x04
1634 #define _I2C_READ               0x04
1635 #define _R                      0x04
1636 #define _READ_WRITE             0x04
1637 #define _NOT_WRITE              0x04
1638 #define _NOT_W                  0x04
1639 #define _R_W                    0x04
1640 #define _S                      0x08
1641 #define _I2C_START              0x08
1642 #define _P                      0x10
1643 #define _I2C_STOP               0x10
1644 #define _D_NOT_A                0x20
1645 #define _I2C_DATA               0x20
1646 #define _D                      0x20
1647 #define _DATA_ADDRESS           0x20
1648 #define _NOT_ADDRESS            0x20
1649 #define _NOT_A                  0x20
1650 #define _D_A                    0x20
1651 #define _I2C_DAT                0x20
1652 #define _CKE                    0x40
1653 #define _SMP                    0x80
1654 
1655 //==============================================================================
1656 
1657 extern __at(0x0FC8) __sfr SSPADD;
1658 extern __at(0x0FC9) __sfr SSPBUF;
1659 
1660 //==============================================================================
1661 //        T2CON Bits
1662 
1663 extern __at(0x0FCA) __sfr T2CON;
1664 
1665 typedef union
1666   {
1667   struct
1668     {
1669     unsigned T2CKPS0            : 1;
1670     unsigned T2CKPS1            : 1;
1671     unsigned TMR2ON             : 1;
1672     unsigned TOUTPS0            : 1;
1673     unsigned TOUTPS1            : 1;
1674     unsigned TOUTPS2            : 1;
1675     unsigned TOUTPS3            : 1;
1676     unsigned                    : 1;
1677     };
1678 
1679   struct
1680     {
1681     unsigned T2CKPS             : 2;
1682     unsigned                    : 6;
1683     };
1684 
1685   struct
1686     {
1687     unsigned                    : 3;
1688     unsigned TOUTPS             : 4;
1689     unsigned                    : 1;
1690     };
1691   } __T2CONbits_t;
1692 
1693 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
1694 
1695 #define _T2CKPS0                0x01
1696 #define _T2CKPS1                0x02
1697 #define _TMR2ON                 0x04
1698 #define _TOUTPS0                0x08
1699 #define _TOUTPS1                0x10
1700 #define _TOUTPS2                0x20
1701 #define _TOUTPS3                0x40
1702 
1703 //==============================================================================
1704 
1705 extern __at(0x0FCB) __sfr PR2;
1706 extern __at(0x0FCC) __sfr TMR2;
1707 
1708 //==============================================================================
1709 //        T1CON Bits
1710 
1711 extern __at(0x0FCD) __sfr T1CON;
1712 
1713 typedef union
1714   {
1715   struct
1716     {
1717     unsigned TMR1ON             : 1;
1718     unsigned TMR1CS             : 1;
1719     unsigned NOT_T1SYNC         : 1;
1720     unsigned T1OSCEN            : 1;
1721     unsigned T1CKPS0            : 1;
1722     unsigned T1CKPS1            : 1;
1723     unsigned                    : 1;
1724     unsigned RD16               : 1;
1725     };
1726 
1727   struct
1728     {
1729     unsigned                    : 1;
1730     unsigned                    : 1;
1731     unsigned T1SYNC             : 1;
1732     unsigned                    : 1;
1733     unsigned                    : 1;
1734     unsigned                    : 1;
1735     unsigned                    : 1;
1736     unsigned                    : 1;
1737     };
1738 
1739   struct
1740     {
1741     unsigned                    : 1;
1742     unsigned                    : 1;
1743     unsigned T1INSYNC           : 1;
1744     unsigned                    : 1;
1745     unsigned                    : 1;
1746     unsigned                    : 1;
1747     unsigned                    : 1;
1748     unsigned                    : 1;
1749     };
1750 
1751   struct
1752     {
1753     unsigned                    : 4;
1754     unsigned T1CKPS             : 2;
1755     unsigned                    : 2;
1756     };
1757   } __T1CONbits_t;
1758 
1759 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1760 
1761 #define _TMR1ON                 0x01
1762 #define _TMR1CS                 0x02
1763 #define _NOT_T1SYNC             0x04
1764 #define _T1SYNC                 0x04
1765 #define _T1INSYNC               0x04
1766 #define _T1OSCEN                0x08
1767 #define _T1CKPS0                0x10
1768 #define _T1CKPS1                0x20
1769 #define _RD16                   0x80
1770 
1771 //==============================================================================
1772 
1773 extern __at(0x0FCE) __sfr TMR1;
1774 extern __at(0x0FCE) __sfr TMR1L;
1775 extern __at(0x0FCF) __sfr TMR1H;
1776 
1777 //==============================================================================
1778 //        RCON Bits
1779 
1780 extern __at(0x0FD0) __sfr RCON;
1781 
1782 typedef union
1783   {
1784   struct
1785     {
1786     unsigned NOT_BOR            : 1;
1787     unsigned NOT_POR            : 1;
1788     unsigned NOT_PD             : 1;
1789     unsigned NOT_TO             : 1;
1790     unsigned NOT_RI             : 1;
1791     unsigned                    : 1;
1792     unsigned                    : 1;
1793     unsigned IPEN               : 1;
1794     };
1795 
1796   struct
1797     {
1798     unsigned BOR                : 1;
1799     unsigned POR                : 1;
1800     unsigned PD                 : 1;
1801     unsigned TO                 : 1;
1802     unsigned RI                 : 1;
1803     unsigned                    : 1;
1804     unsigned                    : 1;
1805     unsigned NOT_IPEN           : 1;
1806     };
1807   } __RCONbits_t;
1808 
1809 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1810 
1811 #define _NOT_BOR                0x01
1812 #define _BOR                    0x01
1813 #define _NOT_POR                0x02
1814 #define _POR                    0x02
1815 #define _NOT_PD                 0x04
1816 #define _PD                     0x04
1817 #define _NOT_TO                 0x08
1818 #define _TO                     0x08
1819 #define _NOT_RI                 0x10
1820 #define _RI                     0x10
1821 #define _IPEN                   0x80
1822 #define _NOT_IPEN               0x80
1823 
1824 //==============================================================================
1825 
1826 
1827 //==============================================================================
1828 //        WDTCON Bits
1829 
1830 extern __at(0x0FD1) __sfr WDTCON;
1831 
1832 typedef union
1833   {
1834   struct
1835     {
1836     unsigned SWDTEN             : 1;
1837     unsigned                    : 1;
1838     unsigned                    : 1;
1839     unsigned                    : 1;
1840     unsigned                    : 1;
1841     unsigned                    : 1;
1842     unsigned                    : 1;
1843     unsigned                    : 1;
1844     };
1845 
1846   struct
1847     {
1848     unsigned SWDTE              : 1;
1849     unsigned                    : 1;
1850     unsigned                    : 1;
1851     unsigned                    : 1;
1852     unsigned                    : 1;
1853     unsigned                    : 1;
1854     unsigned                    : 1;
1855     unsigned                    : 1;
1856     };
1857   } __WDTCONbits_t;
1858 
1859 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
1860 
1861 #define _SWDTEN                 0x01
1862 #define _SWDTE                  0x01
1863 
1864 //==============================================================================
1865 
1866 
1867 //==============================================================================
1868 //        LVDCON Bits
1869 
1870 extern __at(0x0FD2) __sfr LVDCON;
1871 
1872 typedef union
1873   {
1874   struct
1875     {
1876     unsigned LVDL0              : 1;
1877     unsigned LVDL1              : 1;
1878     unsigned LVDL2              : 1;
1879     unsigned LVDL3              : 1;
1880     unsigned LVDEN              : 1;
1881     unsigned IRVST              : 1;
1882     unsigned                    : 1;
1883     unsigned                    : 1;
1884     };
1885 
1886   struct
1887     {
1888     unsigned LVDL               : 4;
1889     unsigned                    : 4;
1890     };
1891   } __LVDCONbits_t;
1892 
1893 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
1894 
1895 #define _LVDL0                  0x01
1896 #define _LVDL1                  0x02
1897 #define _LVDL2                  0x04
1898 #define _LVDL3                  0x08
1899 #define _LVDEN                  0x10
1900 #define _IRVST                  0x20
1901 
1902 //==============================================================================
1903 
1904 
1905 //==============================================================================
1906 //        OSCCON Bits
1907 
1908 extern __at(0x0FD3) __sfr OSCCON;
1909 
1910 typedef struct
1911   {
1912   unsigned SCS                  : 1;
1913   unsigned                      : 1;
1914   unsigned                      : 1;
1915   unsigned                      : 1;
1916   unsigned                      : 1;
1917   unsigned                      : 1;
1918   unsigned                      : 1;
1919   unsigned                      : 1;
1920   } __OSCCONbits_t;
1921 
1922 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
1923 
1924 #define _SCS                    0x01
1925 
1926 //==============================================================================
1927 
1928 
1929 //==============================================================================
1930 //        T0CON Bits
1931 
1932 extern __at(0x0FD5) __sfr T0CON;
1933 
1934 typedef union
1935   {
1936   struct
1937     {
1938     unsigned T0PS0              : 1;
1939     unsigned T0PS1              : 1;
1940     unsigned T0PS2              : 1;
1941     unsigned PSA                : 1;
1942     unsigned T0SE               : 1;
1943     unsigned T0CS               : 1;
1944     unsigned T08BIT             : 1;
1945     unsigned TMR0ON             : 1;
1946     };
1947 
1948   struct
1949     {
1950     unsigned T0PS               : 3;
1951     unsigned                    : 5;
1952     };
1953   } __T0CONbits_t;
1954 
1955 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
1956 
1957 #define _T0PS0                  0x01
1958 #define _T0PS1                  0x02
1959 #define _T0PS2                  0x04
1960 #define _PSA                    0x08
1961 #define _T0SE                   0x10
1962 #define _T0CS                   0x20
1963 #define _T08BIT                 0x40
1964 #define _TMR0ON                 0x80
1965 
1966 //==============================================================================
1967 
1968 extern __at(0x0FD6) __sfr TMR0;
1969 extern __at(0x0FD6) __sfr TMR0L;
1970 extern __at(0x0FD7) __sfr TMR0H;
1971 
1972 //==============================================================================
1973 //        STATUS Bits
1974 
1975 extern __at(0x0FD8) __sfr STATUS;
1976 
1977 typedef struct
1978   {
1979   unsigned C                    : 1;
1980   unsigned DC                   : 1;
1981   unsigned Z                    : 1;
1982   unsigned OV                   : 1;
1983   unsigned N                    : 1;
1984   unsigned                      : 1;
1985   unsigned                      : 1;
1986   unsigned                      : 1;
1987   } __STATUSbits_t;
1988 
1989 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
1990 
1991 #define _C                      0x01
1992 #define _DC                     0x02
1993 #define _Z                      0x04
1994 #define _OV                     0x08
1995 #define _N                      0x10
1996 
1997 //==============================================================================
1998 
1999 extern __at(0x0FD9) __sfr FSR2L;
2000 extern __at(0x0FDA) __sfr FSR2H;
2001 extern __at(0x0FDB) __sfr PLUSW2;
2002 extern __at(0x0FDC) __sfr PREINC2;
2003 extern __at(0x0FDD) __sfr POSTDEC2;
2004 extern __at(0x0FDE) __sfr POSTINC2;
2005 extern __at(0x0FDF) __sfr INDF2;
2006 extern __at(0x0FE0) __sfr BSR;
2007 extern __at(0x0FE1) __sfr FSR1L;
2008 extern __at(0x0FE2) __sfr FSR1H;
2009 extern __at(0x0FE3) __sfr PLUSW1;
2010 extern __at(0x0FE4) __sfr PREINC1;
2011 extern __at(0x0FE5) __sfr POSTDEC1;
2012 extern __at(0x0FE6) __sfr POSTINC1;
2013 extern __at(0x0FE7) __sfr INDF1;
2014 extern __at(0x0FE8) __sfr WREG;
2015 extern __at(0x0FE9) __sfr FSR0L;
2016 extern __at(0x0FEA) __sfr FSR0H;
2017 extern __at(0x0FEB) __sfr PLUSW0;
2018 extern __at(0x0FEC) __sfr PREINC0;
2019 extern __at(0x0FED) __sfr POSTDEC0;
2020 extern __at(0x0FEE) __sfr POSTINC0;
2021 extern __at(0x0FEF) __sfr INDF0;
2022 
2023 //==============================================================================
2024 //        INTCON3 Bits
2025 
2026 extern __at(0x0FF0) __sfr INTCON3;
2027 
2028 typedef union
2029   {
2030   struct
2031     {
2032     unsigned INT1IF             : 1;
2033     unsigned INT2IF             : 1;
2034     unsigned                    : 1;
2035     unsigned INT1IE             : 1;
2036     unsigned INT2IE             : 1;
2037     unsigned                    : 1;
2038     unsigned INT1IP             : 1;
2039     unsigned INT2IP             : 1;
2040     };
2041 
2042   struct
2043     {
2044     unsigned INT1F              : 1;
2045     unsigned INT2F              : 1;
2046     unsigned                    : 1;
2047     unsigned INT1E              : 1;
2048     unsigned INT2E              : 1;
2049     unsigned                    : 1;
2050     unsigned INT1P              : 1;
2051     unsigned INT2P              : 1;
2052     };
2053   } __INTCON3bits_t;
2054 
2055 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2056 
2057 #define _INT1IF                 0x01
2058 #define _INT1F                  0x01
2059 #define _INT2IF                 0x02
2060 #define _INT2F                  0x02
2061 #define _INT1IE                 0x08
2062 #define _INT1E                  0x08
2063 #define _INT2IE                 0x10
2064 #define _INT2E                  0x10
2065 #define _INT1IP                 0x40
2066 #define _INT1P                  0x40
2067 #define _INT2IP                 0x80
2068 #define _INT2P                  0x80
2069 
2070 //==============================================================================
2071 
2072 
2073 //==============================================================================
2074 //        INTCON2 Bits
2075 
2076 extern __at(0x0FF1) __sfr INTCON2;
2077 
2078 typedef union
2079   {
2080   struct
2081     {
2082     unsigned RBIP               : 1;
2083     unsigned                    : 1;
2084     unsigned TMR0IP             : 1;
2085     unsigned                    : 1;
2086     unsigned INTEDG2            : 1;
2087     unsigned INTEDG1            : 1;
2088     unsigned INTEDG0            : 1;
2089     unsigned NOT_RBPU           : 1;
2090     };
2091 
2092   struct
2093     {
2094     unsigned                    : 1;
2095     unsigned                    : 1;
2096     unsigned T0IP               : 1;
2097     unsigned                    : 1;
2098     unsigned                    : 1;
2099     unsigned                    : 1;
2100     unsigned                    : 1;
2101     unsigned RBPU               : 1;
2102     };
2103   } __INTCON2bits_t;
2104 
2105 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2106 
2107 #define _RBIP                   0x01
2108 #define _TMR0IP                 0x04
2109 #define _T0IP                   0x04
2110 #define _INTEDG2                0x10
2111 #define _INTEDG1                0x20
2112 #define _INTEDG0                0x40
2113 #define _NOT_RBPU               0x80
2114 #define _RBPU                   0x80
2115 
2116 //==============================================================================
2117 
2118 
2119 //==============================================================================
2120 //        INTCON Bits
2121 
2122 extern __at(0x0FF2) __sfr INTCON;
2123 
2124 typedef union
2125   {
2126   struct
2127     {
2128     unsigned RBIF               : 1;
2129     unsigned INT0IF             : 1;
2130     unsigned TMR0IF             : 1;
2131     unsigned RBIE               : 1;
2132     unsigned INT0IE             : 1;
2133     unsigned TMR0IE             : 1;
2134     unsigned PEIE_GIEL          : 1;
2135     unsigned GIE_GIEH           : 1;
2136     };
2137 
2138   struct
2139     {
2140     unsigned                    : 1;
2141     unsigned INT0F              : 1;
2142     unsigned T0IF               : 1;
2143     unsigned                    : 1;
2144     unsigned INT0E              : 1;
2145     unsigned T0IE               : 1;
2146     unsigned PEIE               : 1;
2147     unsigned GIE                : 1;
2148     };
2149 
2150   struct
2151     {
2152     unsigned                    : 1;
2153     unsigned                    : 1;
2154     unsigned                    : 1;
2155     unsigned                    : 1;
2156     unsigned                    : 1;
2157     unsigned                    : 1;
2158     unsigned GIEL               : 1;
2159     unsigned GIEH               : 1;
2160     };
2161   } __INTCONbits_t;
2162 
2163 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2164 
2165 #define _RBIF                   0x01
2166 #define _INT0IF                 0x02
2167 #define _INT0F                  0x02
2168 #define _TMR0IF                 0x04
2169 #define _T0IF                   0x04
2170 #define _RBIE                   0x08
2171 #define _INT0IE                 0x10
2172 #define _INT0E                  0x10
2173 #define _TMR0IE                 0x20
2174 #define _T0IE                   0x20
2175 #define _PEIE_GIEL              0x40
2176 #define _PEIE                   0x40
2177 #define _GIEL                   0x40
2178 #define _GIE_GIEH               0x80
2179 #define _GIE                    0x80
2180 #define _GIEH                   0x80
2181 
2182 //==============================================================================
2183 
2184 
2185 //==============================================================================
2186 //        INTCON1 Bits
2187 
2188 extern __at(0x0FF2) __sfr INTCON1;
2189 
2190 typedef union
2191   {
2192   struct
2193     {
2194     unsigned RBIF               : 1;
2195     unsigned INT0IF             : 1;
2196     unsigned TMR0IF             : 1;
2197     unsigned RBIE               : 1;
2198     unsigned INT0IE             : 1;
2199     unsigned TMR0IE             : 1;
2200     unsigned PEIE_GIEL          : 1;
2201     unsigned GIE_GIEH           : 1;
2202     };
2203 
2204   struct
2205     {
2206     unsigned                    : 1;
2207     unsigned INT0F              : 1;
2208     unsigned T0IF               : 1;
2209     unsigned                    : 1;
2210     unsigned INT0E              : 1;
2211     unsigned T0IE               : 1;
2212     unsigned PEIE               : 1;
2213     unsigned GIE                : 1;
2214     };
2215 
2216   struct
2217     {
2218     unsigned                    : 1;
2219     unsigned                    : 1;
2220     unsigned                    : 1;
2221     unsigned                    : 1;
2222     unsigned                    : 1;
2223     unsigned                    : 1;
2224     unsigned GIEL               : 1;
2225     unsigned GIEH               : 1;
2226     };
2227   } __INTCON1bits_t;
2228 
2229 extern __at(0x0FF2) volatile __INTCON1bits_t INTCON1bits;
2230 
2231 #define _INTCON1_RBIF           0x01
2232 #define _INTCON1_INT0IF         0x02
2233 #define _INTCON1_INT0F          0x02
2234 #define _INTCON1_TMR0IF         0x04
2235 #define _INTCON1_T0IF           0x04
2236 #define _INTCON1_RBIE           0x08
2237 #define _INTCON1_INT0IE         0x10
2238 #define _INTCON1_INT0E          0x10
2239 #define _INTCON1_TMR0IE         0x20
2240 #define _INTCON1_T0IE           0x20
2241 #define _INTCON1_PEIE_GIEL      0x40
2242 #define _INTCON1_PEIE           0x40
2243 #define _INTCON1_GIEL           0x40
2244 #define _INTCON1_GIE_GIEH       0x80
2245 #define _INTCON1_GIE            0x80
2246 #define _INTCON1_GIEH           0x80
2247 
2248 //==============================================================================
2249 
2250 extern __at(0x0FF3) __sfr PROD;
2251 extern __at(0x0FF3) __sfr PRODL;
2252 extern __at(0x0FF4) __sfr PRODH;
2253 extern __at(0x0FF5) __sfr TABLAT;
2254 extern __at(0x0FF6) __sfr TBLPTR;
2255 extern __at(0x0FF6) __sfr TBLPTRL;
2256 extern __at(0x0FF7) __sfr TBLPTRH;
2257 extern __at(0x0FF8) __sfr TBLPTRU;
2258 extern __at(0x0FF9) __sfr PC;
2259 extern __at(0x0FF9) __sfr PCL;
2260 extern __at(0x0FFA) __sfr PCLATH;
2261 extern __at(0x0FFB) __sfr PCLATU;
2262 
2263 //==============================================================================
2264 //        STKPTR Bits
2265 
2266 extern __at(0x0FFC) __sfr STKPTR;
2267 
2268 typedef union
2269   {
2270   struct
2271     {
2272     unsigned STKPTR0            : 1;
2273     unsigned STKPTR1            : 1;
2274     unsigned STKPTR2            : 1;
2275     unsigned STKPTR3            : 1;
2276     unsigned STKPTR4            : 1;
2277     unsigned                    : 1;
2278     unsigned STKUNF             : 1;
2279     unsigned STKFUL             : 1;
2280     };
2281 
2282   struct
2283     {
2284     unsigned SP0                : 1;
2285     unsigned SP1                : 1;
2286     unsigned SP2                : 1;
2287     unsigned SP3                : 1;
2288     unsigned SP4                : 1;
2289     unsigned                    : 1;
2290     unsigned                    : 1;
2291     unsigned STKOVF             : 1;
2292     };
2293 
2294   struct
2295     {
2296     unsigned SP                 : 5;
2297     unsigned                    : 3;
2298     };
2299 
2300   struct
2301     {
2302     unsigned STKPTR             : 5;
2303     unsigned                    : 3;
2304     };
2305   } __STKPTRbits_t;
2306 
2307 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2308 
2309 #define _STKPTR0                0x01
2310 #define _SP0                    0x01
2311 #define _STKPTR1                0x02
2312 #define _SP1                    0x02
2313 #define _STKPTR2                0x04
2314 #define _SP2                    0x04
2315 #define _STKPTR3                0x08
2316 #define _SP3                    0x08
2317 #define _STKPTR4                0x10
2318 #define _SP4                    0x10
2319 #define _STKUNF                 0x40
2320 #define _STKFUL                 0x80
2321 #define _STKOVF                 0x80
2322 
2323 //==============================================================================
2324 
2325 extern __at(0x0FFD) __sfr TOS;
2326 extern __at(0x0FFD) __sfr TOSL;
2327 extern __at(0x0FFE) __sfr TOSH;
2328 extern __at(0x0FFF) __sfr TOSU;
2329 
2330 //==============================================================================
2331 //
2332 //        Configuration Bits
2333 //
2334 //==============================================================================
2335 
2336 #define __CONFIG1H              0x300001
2337 #define __CONFIG2L              0x300002
2338 #define __CONFIG2H              0x300003
2339 #define __CONFIG3H              0x300005
2340 #define __CONFIG4L              0x300006
2341 #define __CONFIG5L              0x300008
2342 #define __CONFIG5H              0x300009
2343 #define __CONFIG6L              0x30000A
2344 #define __CONFIG6H              0x30000B
2345 #define __CONFIG7L              0x30000C
2346 #define __CONFIG7H              0x30000D
2347 
2348 //----------------------------- CONFIG1H Options -------------------------------
2349 
2350 #define _LP_OSC                 0xF8    // LP oscillator.
2351 #define _LP_OSC_1H              0xF8    // LP oscillator.
2352 #define _XT_OSC                 0xF9    // XT oscillator.
2353 #define _XT_OSC_1H              0xF9    // XT oscillator.
2354 #define _HS_OSC                 0xFA    // HS oscillator.
2355 #define _HS_OSC_1H              0xFA    // HS oscillator.
2356 #define _RC_OSC                 0xFB    // RC oscillator.
2357 #define _RC_OSC_1H              0xFB    // RC oscillator.
2358 #define _EC_OSC                 0xFC    // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2359 #define _EC_OSC_1H              0xFC    // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2360 #define _ECIO_OSC               0xFD    // EC oscillator w/ OSC2 configured as RA6.
2361 #define _ECIO_OSC_1H            0xFD    // EC oscillator w/ OSC2 configured as RA6.
2362 #define _HSPLL_OSC              0xFE    // HS oscillator with PLL enabled/Clock frequency = (4 x FOSC).
2363 #define _HSPLL_OSC_1H           0xFE    // HS oscillator with PLL enabled/Clock frequency = (4 x FOSC).
2364 #define _RCIO_OSC               0xFF    // RC oscillator w/ OSC2 configured as RA6.
2365 #define _RCIO_OSC_1H            0xFF    // RC oscillator w/ OSC2 configured as RA6.
2366 #define _OSCS_ON_1H             0xDF    // Oscillator system clock switch option is enabled (oscillator switching is enabled).
2367 #define _OSCS_OFF_1H            0xFF    // Oscillator system clock switch option is disabled (main oscillator is source).
2368 
2369 //----------------------------- CONFIG2L Options -------------------------------
2370 
2371 #define _PWRT_ON_2L             0xFE    // PWRT enabled.
2372 #define _PWRT_OFF_2L            0xFF    // PWRT disabled.
2373 #define _BOR_OFF_2L             0xFD    // Brown-out Reset disabled.
2374 #define _BOR_ON_2L              0xFF    // Brown-out Reset enabled.
2375 #define _BORV_45_2L             0xF3    // VBOR set to 4.5V.
2376 #define _BORV_42_2L             0xF7    // VBOR set to 4.2V.
2377 #define _BORV_27_2L             0xFB    // VBOR set to 2.7V.
2378 #define _BORV_20                0xFF    // VBOR set to 2.0V.
2379 #define _BORV_20_2L             0xFF    // VBOR set to 2.0V.
2380 
2381 //----------------------------- CONFIG2H Options -------------------------------
2382 
2383 #define _WDT_OFF_2H             0xFE    // WDT disabled (control is placed on the SWDTEN bit).
2384 #define _WDT_ON_2H              0xFF    // WDT enabled.
2385 #define _WDTPS_1_2H             0xF1    // 1:1.
2386 #define _WDTPS_2_2H             0xF3    // 1:2.
2387 #define _WDTPS_4_2H             0xF5    // 1:4.
2388 #define _WDTPS_8_2H             0xF7    // 1:8.
2389 #define _WDTPS_16_2H            0xF9    // 1:16.
2390 #define _WDTPS_32_2H            0xFB    // 1:32.
2391 #define _WDTPS_64_2H            0xFD    // 1:64.
2392 #define _WDTPS_128_2H           0xFF    // 1:128.
2393 
2394 //----------------------------- CONFIG3H Options -------------------------------
2395 
2396 #define _CCP2MX_OFF             0xFE    // CCP2 input/output is multiplexed with RB3.
2397 #define _CCP2MX_OFF_3H          0xFE    // CCP2 input/output is multiplexed with RB3.
2398 #define _CCP2MX_ON              0xFF    // CCP2 input/output is multiplexed with RC1.
2399 #define _CCP2MX_ON_3H           0xFF    // CCP2 input/output is multiplexed with RC1.
2400 
2401 //----------------------------- CONFIG4L Options -------------------------------
2402 
2403 #define _STVR_OFF_4L            0xFE    // Stack Full/Underflow will not cause RESET.
2404 #define _STVR_ON_4L             0xFF    // Stack Full/Underflow will cause RESET.
2405 #define _LVP_OFF_4L             0xFB    // Low Voltage ICSP disabled.
2406 #define _LVP_ON_4L              0xFF    // Low Voltage ICSP enabled.
2407 #define _DEBUG_ON_4L            0x7F    // Background Debugger enabled. RB6 and RB7 are dedicated to In-Circuit Debug.
2408 #define _DEBUG_OFF_4L           0xFF    // Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
2409 
2410 //----------------------------- CONFIG5L Options -------------------------------
2411 
2412 #define _CP0_ON_5L              0xFE    // Block 0 (000200-001FFFh) code protected.
2413 #define _CP0_OFF_5L             0xFF    // Block 0 (000200-001FFFh) not code protected.
2414 #define _CP1_ON_5L              0xFD    // Block 1 (002000-003FFFh) code protected.
2415 #define _CP1_OFF_5L             0xFF    // Block 1 (002000-003FFFh) not code protected.
2416 #define _CP2_ON_5L              0xFB    // Block 2 (004000-005FFFh) code protected.
2417 #define _CP2_OFF_5L             0xFF    // Block 2 (004000-005FFFh) not code protected.
2418 #define _CP3_ON_5L              0xF7    // Block 3 (006000-007FFFh) code protected.
2419 #define _CP3_OFF_5L             0xFF    // Block 3 (006000-007FFFh) not code protected.
2420 
2421 //----------------------------- CONFIG5H Options -------------------------------
2422 
2423 #define _CPB_ON_5H              0xBF    // Boot Block (000000-0001FFh) code protected.
2424 #define _CPB_OFF_5H             0xFF    // Boot Block (000000-0001FFh) not code protected.
2425 #define _CPD_ON_5H              0x7F    // Data EEPROM code protected.
2426 #define _CPD_OFF_5H             0xFF    // Data EEPROM not code protected.
2427 
2428 //----------------------------- CONFIG6L Options -------------------------------
2429 
2430 #define _WRT0_ON_6L             0xFE    // Block 0 (000200-001FFFh) write protected.
2431 #define _WRT0_OFF_6L            0xFF    // Block 0 (000200-001FFFh) not write protected.
2432 #define _WRT1_ON_6L             0xFD    // Block 1 (002000-003FFFh) write protected.
2433 #define _WRT1_OFF_6L            0xFF    // Block 1 (002000-003FFFh) not write protected.
2434 #define _WRT2_ON_6L             0xFB    // Block 2 (004000-005FFFh) write protected.
2435 #define _WRT2_OFF_6L            0xFF    // Block 2 (004000-005FFFh) not write protected.
2436 #define _WRT3_ON_6L             0xF7    // Block 3 (006000-007FFFh) write protected.
2437 #define _WRT3_OFF_6L            0xFF    // Block 3 (006000-007FFFh) not write protected.
2438 
2439 //----------------------------- CONFIG6H Options -------------------------------
2440 
2441 #define _WRTC_ON_6H             0xDF    // Configuration registers (300000-3000FFh) write protected.
2442 #define _WRTC_OFF_6H            0xFF    // Configuration registers (300000-3000FFh) not write protected.
2443 #define _WRTB_ON_6H             0xBF    // Boot Block (000000-0001FFh) write protected.
2444 #define _WRTB_OFF_6H            0xFF    // Boot Block (000000-0001FFh) not write protected.
2445 #define _WRTD_ON_6H             0x7F    // Data EEPROM write protected.
2446 #define _WRTD_OFF_6H            0xFF    // Data EEPROM not write protected.
2447 
2448 //----------------------------- CONFIG7L Options -------------------------------
2449 
2450 #define _EBTR0_ON_7L            0xFE    // Block 0 (000200-001FFFh) protected from Table Reads executed in other blocks.
2451 #define _EBTR0_OFF_7L           0xFF    // Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks.
2452 #define _EBTR1_ON_7L            0xFD    // Block 1 (002000-003FFFh) protected from Table Reads executed in other blocks.
2453 #define _EBTR1_OFF_7L           0xFF    // Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks.
2454 #define _EBTR2_ON_7L            0xFB    // Block 2 (004000-005FFFh) protected from Table Reads executed in other blocks.
2455 #define _EBTR2_OFF_7L           0xFF    // Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks.
2456 #define _EBTR3_ON_7L            0xF7    // Block 3 (006000-007FFFh) protected from Table Reads executed in other blocks.
2457 #define _EBTR3_OFF_7L           0xFF    // Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks.
2458 
2459 //----------------------------- CONFIG7H Options -------------------------------
2460 
2461 #define _EBTRB_ON_7H            0xBF    // Boot Block (000000-0001FFh) protected from Table Reads executed in other blocks.
2462 #define _EBTRB_OFF_7H           0xFF    // Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks.
2463 
2464 //==============================================================================
2465 
2466 #define __DEVID1                0x3FFFFE
2467 #define __DEVID2                0x3FFFFF
2468 
2469 #define __IDLOC0                0x200000
2470 #define __IDLOC1                0x200001
2471 #define __IDLOC2                0x200002
2472 #define __IDLOC3                0x200003
2473 #define __IDLOC4                0x200004
2474 #define __IDLOC5                0x200005
2475 #define __IDLOC6                0x200006
2476 #define __IDLOC7                0x200007
2477 
2478 #endif // #ifndef __PIC18LF252_H__
2479