struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f2221.h
blobb3878d2cfa865d5aeeaeaaf6ac74ec80b4e5e29f
1 /*
2 * This declarations of the PIC18F2221 MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:42 UTC.
9 * SDCC is licensed under the GNU Public license (GPL) v2. Note that
10 * this license covers the code to the compiler and other executables,
11 * but explicitly does not cover any code or objects generated by sdcc.
13 * For pic device libraries and header files which are derived from
14 * Microchip header (.inc) and linker script (.lkr) files Microchip
15 * requires that "The header files should state that they are only to be
16 * used with authentic Microchip devices" which makes them incompatible
17 * with the GPL. Pic device libraries and header files are located at
18 * non-free/lib and non-free/include directories respectively.
19 * Sdcc should be run with the --use-non-free command line option in
20 * order to include non-free header files and libraries.
22 * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
25 #ifndef __PIC18F2221_H__
26 #define __PIC18F2221_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // PORTA Bits
40 extern __at(0x0F80) __sfr PORTA;
42 typedef union
44 struct
46 unsigned RA0 : 1;
47 unsigned RA1 : 1;
48 unsigned RA2 : 1;
49 unsigned RA3 : 1;
50 unsigned RA4 : 1;
51 unsigned RA5 : 1;
52 unsigned RA6 : 1;
53 unsigned RA7 : 1;
56 struct
58 unsigned AN0 : 1;
59 unsigned AN1 : 1;
60 unsigned AN2 : 1;
61 unsigned AN3 : 1;
62 unsigned C1OUT : 1;
63 unsigned AN4 : 1;
64 unsigned OSC2 : 1;
65 unsigned OSC1 : 1;
68 struct
70 unsigned C1N : 1;
71 unsigned C2N : 1;
72 unsigned C2P : 1;
73 unsigned C1P : 1;
74 unsigned T0CKI : 1;
75 unsigned C2OUT : 1;
76 unsigned CLKO : 1;
77 unsigned CLKI : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned VREFM : 1;
85 unsigned VREFP : 1;
86 unsigned : 1;
87 unsigned HLVDIN : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned : 1;
95 unsigned : 1;
96 unsigned CVREF : 1;
97 unsigned : 1;
98 unsigned : 1;
99 unsigned NOT_SS : 1;
100 unsigned : 1;
101 unsigned : 1;
103 } __PORTAbits_t;
105 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
107 #define _PORTA_RA0 0x01
108 #define _PORTA_AN0 0x01
109 #define _PORTA_C1N 0x01
110 #define _PORTA_RA1 0x02
111 #define _PORTA_AN1 0x02
112 #define _PORTA_C2N 0x02
113 #define _PORTA_RA2 0x04
114 #define _PORTA_AN2 0x04
115 #define _PORTA_C2P 0x04
116 #define _PORTA_VREFM 0x04
117 #define _PORTA_CVREF 0x04
118 #define _PORTA_RA3 0x08
119 #define _PORTA_AN3 0x08
120 #define _PORTA_C1P 0x08
121 #define _PORTA_VREFP 0x08
122 #define _PORTA_RA4 0x10
123 #define _PORTA_C1OUT 0x10
124 #define _PORTA_T0CKI 0x10
125 #define _PORTA_RA5 0x20
126 #define _PORTA_AN4 0x20
127 #define _PORTA_C2OUT 0x20
128 #define _PORTA_HLVDIN 0x20
129 #define _PORTA_NOT_SS 0x20
130 #define _PORTA_RA6 0x40
131 #define _PORTA_OSC2 0x40
132 #define _PORTA_CLKO 0x40
133 #define _PORTA_RA7 0x80
134 #define _PORTA_OSC1 0x80
135 #define _PORTA_CLKI 0x80
137 //==============================================================================
140 //==============================================================================
141 // PORTB Bits
143 extern __at(0x0F81) __sfr PORTB;
145 typedef union
147 struct
149 unsigned RB0 : 1;
150 unsigned RB1 : 1;
151 unsigned RB2 : 1;
152 unsigned RB3 : 1;
153 unsigned RB4 : 1;
154 unsigned RB5 : 1;
155 unsigned RB6 : 1;
156 unsigned RB7 : 1;
159 struct
161 unsigned INT0 : 1;
162 unsigned INT1 : 1;
163 unsigned INT2 : 1;
164 unsigned CCP2 : 1;
165 unsigned KBI0 : 1;
166 unsigned KBI1 : 1;
167 unsigned KBI2 : 1;
168 unsigned KBI3 : 1;
171 struct
173 unsigned AN12 : 1;
174 unsigned AN10 : 1;
175 unsigned AN8 : 1;
176 unsigned AN9 : 1;
177 unsigned AN11 : 1;
178 unsigned PGM : 1;
179 unsigned PGC : 1;
180 unsigned PGD : 1;
183 struct
185 unsigned FLT0 : 1;
186 unsigned : 1;
187 unsigned : 1;
188 unsigned : 1;
189 unsigned : 1;
190 unsigned : 1;
191 unsigned : 1;
192 unsigned : 1;
195 struct
197 unsigned INT : 3;
198 unsigned : 5;
201 struct
203 unsigned : 4;
204 unsigned KBI : 4;
206 } __PORTBbits_t;
208 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
210 #define _PORTB_RB0 0x01
211 #define _PORTB_INT0 0x01
212 #define _PORTB_AN12 0x01
213 #define _PORTB_FLT0 0x01
214 #define _PORTB_RB1 0x02
215 #define _PORTB_INT1 0x02
216 #define _PORTB_AN10 0x02
217 #define _PORTB_RB2 0x04
218 #define _PORTB_INT2 0x04
219 #define _PORTB_AN8 0x04
220 #define _PORTB_RB3 0x08
221 #define _PORTB_CCP2 0x08
222 #define _PORTB_AN9 0x08
223 #define _PORTB_RB4 0x10
224 #define _PORTB_KBI0 0x10
225 #define _PORTB_AN11 0x10
226 #define _PORTB_RB5 0x20
227 #define _PORTB_KBI1 0x20
228 #define _PORTB_PGM 0x20
229 #define _PORTB_RB6 0x40
230 #define _PORTB_KBI2 0x40
231 #define _PORTB_PGC 0x40
232 #define _PORTB_RB7 0x80
233 #define _PORTB_KBI3 0x80
234 #define _PORTB_PGD 0x80
236 //==============================================================================
239 //==============================================================================
240 // PORTC Bits
242 extern __at(0x0F82) __sfr PORTC;
244 typedef union
246 struct
248 unsigned RC0 : 1;
249 unsigned RC1 : 1;
250 unsigned RC2 : 1;
251 unsigned RC3 : 1;
252 unsigned RC4 : 1;
253 unsigned RC5 : 1;
254 unsigned RC6 : 1;
255 unsigned RC7 : 1;
258 struct
260 unsigned T1OSO : 1;
261 unsigned T1OSI : 1;
262 unsigned CCP1 : 1;
263 unsigned SCK : 1;
264 unsigned SDI : 1;
265 unsigned SDO : 1;
266 unsigned TX : 1;
267 unsigned RX : 1;
270 struct
272 unsigned T13CKI : 1;
273 unsigned CCP2 : 1;
274 unsigned P1A : 1;
275 unsigned SCL : 1;
276 unsigned SDA : 1;
277 unsigned : 1;
278 unsigned CK : 1;
279 unsigned : 1;
282 struct
284 unsigned T1CKI : 1;
285 unsigned : 1;
286 unsigned : 1;
287 unsigned : 1;
288 unsigned : 1;
289 unsigned : 1;
290 unsigned : 1;
291 unsigned : 1;
293 } __PORTCbits_t;
295 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
297 #define _PORTC_RC0 0x01
298 #define _PORTC_T1OSO 0x01
299 #define _PORTC_T13CKI 0x01
300 #define _PORTC_T1CKI 0x01
301 #define _PORTC_RC1 0x02
302 #define _PORTC_T1OSI 0x02
303 #define _PORTC_CCP2 0x02
304 #define _PORTC_RC2 0x04
305 #define _PORTC_CCP1 0x04
306 #define _PORTC_P1A 0x04
307 #define _PORTC_RC3 0x08
308 #define _PORTC_SCK 0x08
309 #define _PORTC_SCL 0x08
310 #define _PORTC_RC4 0x10
311 #define _PORTC_SDI 0x10
312 #define _PORTC_SDA 0x10
313 #define _PORTC_RC5 0x20
314 #define _PORTC_SDO 0x20
315 #define _PORTC_RC6 0x40
316 #define _PORTC_TX 0x40
317 #define _PORTC_CK 0x40
318 #define _PORTC_RC7 0x80
319 #define _PORTC_RX 0x80
321 //==============================================================================
324 //==============================================================================
325 // PORTE Bits
327 extern __at(0x0F84) __sfr PORTE;
329 typedef union
331 struct
333 unsigned : 1;
334 unsigned : 1;
335 unsigned : 1;
336 unsigned RE3 : 1;
337 unsigned : 1;
338 unsigned : 1;
339 unsigned : 1;
340 unsigned : 1;
343 struct
345 unsigned : 1;
346 unsigned : 1;
347 unsigned : 1;
348 unsigned MCLR : 1;
349 unsigned : 1;
350 unsigned : 1;
351 unsigned : 1;
352 unsigned : 1;
355 struct
357 unsigned : 1;
358 unsigned : 1;
359 unsigned : 1;
360 unsigned NOT_MCLR : 1;
361 unsigned : 1;
362 unsigned : 1;
363 unsigned : 1;
364 unsigned : 1;
367 struct
369 unsigned : 1;
370 unsigned : 1;
371 unsigned : 1;
372 unsigned VPP : 1;
373 unsigned : 1;
374 unsigned : 1;
375 unsigned : 1;
376 unsigned : 1;
378 } __PORTEbits_t;
380 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
382 #define _RE3 0x08
383 #define _MCLR 0x08
384 #define _NOT_MCLR 0x08
385 #define _VPP 0x08
387 //==============================================================================
390 //==============================================================================
391 // LATA Bits
393 extern __at(0x0F89) __sfr LATA;
395 typedef struct
397 unsigned LATA0 : 1;
398 unsigned LATA1 : 1;
399 unsigned LATA2 : 1;
400 unsigned LATA3 : 1;
401 unsigned LATA4 : 1;
402 unsigned LATA5 : 1;
403 unsigned LATA6 : 1;
404 unsigned LATA7 : 1;
405 } __LATAbits_t;
407 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
409 #define _LATA0 0x01
410 #define _LATA1 0x02
411 #define _LATA2 0x04
412 #define _LATA3 0x08
413 #define _LATA4 0x10
414 #define _LATA5 0x20
415 #define _LATA6 0x40
416 #define _LATA7 0x80
418 //==============================================================================
421 //==============================================================================
422 // LATB Bits
424 extern __at(0x0F8A) __sfr LATB;
426 typedef struct
428 unsigned LATB0 : 1;
429 unsigned LATB1 : 1;
430 unsigned LATB2 : 1;
431 unsigned LATB3 : 1;
432 unsigned LATB4 : 1;
433 unsigned LATB5 : 1;
434 unsigned LATB6 : 1;
435 unsigned LATB7 : 1;
436 } __LATBbits_t;
438 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
440 #define _LATB0 0x01
441 #define _LATB1 0x02
442 #define _LATB2 0x04
443 #define _LATB3 0x08
444 #define _LATB4 0x10
445 #define _LATB5 0x20
446 #define _LATB6 0x40
447 #define _LATB7 0x80
449 //==============================================================================
452 //==============================================================================
453 // LATC Bits
455 extern __at(0x0F8B) __sfr LATC;
457 typedef struct
459 unsigned LATC0 : 1;
460 unsigned LATC1 : 1;
461 unsigned LATC2 : 1;
462 unsigned LATC3 : 1;
463 unsigned LATC4 : 1;
464 unsigned LATC5 : 1;
465 unsigned LATC6 : 1;
466 unsigned LATC7 : 1;
467 } __LATCbits_t;
469 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
471 #define _LATC0 0x01
472 #define _LATC1 0x02
473 #define _LATC2 0x04
474 #define _LATC3 0x08
475 #define _LATC4 0x10
476 #define _LATC5 0x20
477 #define _LATC6 0x40
478 #define _LATC7 0x80
480 //==============================================================================
483 //==============================================================================
484 // DDRA Bits
486 extern __at(0x0F92) __sfr DDRA;
488 typedef union
490 struct
492 unsigned TRISA0 : 1;
493 unsigned TRISA1 : 1;
494 unsigned TRISA2 : 1;
495 unsigned TRISA3 : 1;
496 unsigned TRISA4 : 1;
497 unsigned TRISA5 : 1;
498 unsigned TRISA6 : 1;
499 unsigned TRISA7 : 1;
502 struct
504 unsigned RA0 : 1;
505 unsigned RA1 : 1;
506 unsigned RA2 : 1;
507 unsigned RA3 : 1;
508 unsigned RA4 : 1;
509 unsigned RA5 : 1;
510 unsigned RA6 : 1;
511 unsigned RA7 : 1;
513 } __DDRAbits_t;
515 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
517 #define _TRISA0 0x01
518 #define _RA0 0x01
519 #define _TRISA1 0x02
520 #define _RA1 0x02
521 #define _TRISA2 0x04
522 #define _RA2 0x04
523 #define _TRISA3 0x08
524 #define _RA3 0x08
525 #define _TRISA4 0x10
526 #define _RA4 0x10
527 #define _TRISA5 0x20
528 #define _RA5 0x20
529 #define _TRISA6 0x40
530 #define _RA6 0x40
531 #define _TRISA7 0x80
532 #define _RA7 0x80
534 //==============================================================================
537 //==============================================================================
538 // TRISA Bits
540 extern __at(0x0F92) __sfr TRISA;
542 typedef union
544 struct
546 unsigned TRISA0 : 1;
547 unsigned TRISA1 : 1;
548 unsigned TRISA2 : 1;
549 unsigned TRISA3 : 1;
550 unsigned TRISA4 : 1;
551 unsigned TRISA5 : 1;
552 unsigned TRISA6 : 1;
553 unsigned TRISA7 : 1;
556 struct
558 unsigned RA0 : 1;
559 unsigned RA1 : 1;
560 unsigned RA2 : 1;
561 unsigned RA3 : 1;
562 unsigned RA4 : 1;
563 unsigned RA5 : 1;
564 unsigned RA6 : 1;
565 unsigned RA7 : 1;
567 } __TRISAbits_t;
569 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
571 #define _TRISA_TRISA0 0x01
572 #define _TRISA_RA0 0x01
573 #define _TRISA_TRISA1 0x02
574 #define _TRISA_RA1 0x02
575 #define _TRISA_TRISA2 0x04
576 #define _TRISA_RA2 0x04
577 #define _TRISA_TRISA3 0x08
578 #define _TRISA_RA3 0x08
579 #define _TRISA_TRISA4 0x10
580 #define _TRISA_RA4 0x10
581 #define _TRISA_TRISA5 0x20
582 #define _TRISA_RA5 0x20
583 #define _TRISA_TRISA6 0x40
584 #define _TRISA_RA6 0x40
585 #define _TRISA_TRISA7 0x80
586 #define _TRISA_RA7 0x80
588 //==============================================================================
591 //==============================================================================
592 // DDRB Bits
594 extern __at(0x0F93) __sfr DDRB;
596 typedef union
598 struct
600 unsigned TRISB0 : 1;
601 unsigned TRISB1 : 1;
602 unsigned TRISB2 : 1;
603 unsigned TRISB3 : 1;
604 unsigned TRISB4 : 1;
605 unsigned TRISB5 : 1;
606 unsigned TRISB6 : 1;
607 unsigned TRISB7 : 1;
610 struct
612 unsigned RB0 : 1;
613 unsigned RB1 : 1;
614 unsigned RB2 : 1;
615 unsigned RB3 : 1;
616 unsigned RB4 : 1;
617 unsigned RB5 : 1;
618 unsigned RB6 : 1;
619 unsigned RB7 : 1;
621 } __DDRBbits_t;
623 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
625 #define _TRISB0 0x01
626 #define _RB0 0x01
627 #define _TRISB1 0x02
628 #define _RB1 0x02
629 #define _TRISB2 0x04
630 #define _RB2 0x04
631 #define _TRISB3 0x08
632 #define _RB3 0x08
633 #define _TRISB4 0x10
634 #define _RB4 0x10
635 #define _TRISB5 0x20
636 #define _RB5 0x20
637 #define _TRISB6 0x40
638 #define _RB6 0x40
639 #define _TRISB7 0x80
640 #define _RB7 0x80
642 //==============================================================================
645 //==============================================================================
646 // TRISB Bits
648 extern __at(0x0F93) __sfr TRISB;
650 typedef union
652 struct
654 unsigned TRISB0 : 1;
655 unsigned TRISB1 : 1;
656 unsigned TRISB2 : 1;
657 unsigned TRISB3 : 1;
658 unsigned TRISB4 : 1;
659 unsigned TRISB5 : 1;
660 unsigned TRISB6 : 1;
661 unsigned TRISB7 : 1;
664 struct
666 unsigned RB0 : 1;
667 unsigned RB1 : 1;
668 unsigned RB2 : 1;
669 unsigned RB3 : 1;
670 unsigned RB4 : 1;
671 unsigned RB5 : 1;
672 unsigned RB6 : 1;
673 unsigned RB7 : 1;
675 } __TRISBbits_t;
677 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
679 #define _TRISB_TRISB0 0x01
680 #define _TRISB_RB0 0x01
681 #define _TRISB_TRISB1 0x02
682 #define _TRISB_RB1 0x02
683 #define _TRISB_TRISB2 0x04
684 #define _TRISB_RB2 0x04
685 #define _TRISB_TRISB3 0x08
686 #define _TRISB_RB3 0x08
687 #define _TRISB_TRISB4 0x10
688 #define _TRISB_RB4 0x10
689 #define _TRISB_TRISB5 0x20
690 #define _TRISB_RB5 0x20
691 #define _TRISB_TRISB6 0x40
692 #define _TRISB_RB6 0x40
693 #define _TRISB_TRISB7 0x80
694 #define _TRISB_RB7 0x80
696 //==============================================================================
699 //==============================================================================
700 // DDRC Bits
702 extern __at(0x0F94) __sfr DDRC;
704 typedef union
706 struct
708 unsigned TRISC0 : 1;
709 unsigned TRISC1 : 1;
710 unsigned TRISC2 : 1;
711 unsigned TRISC3 : 1;
712 unsigned TRISC4 : 1;
713 unsigned TRISC5 : 1;
714 unsigned TRISC6 : 1;
715 unsigned TRISC7 : 1;
718 struct
720 unsigned RC0 : 1;
721 unsigned RC1 : 1;
722 unsigned RC2 : 1;
723 unsigned RC3 : 1;
724 unsigned RC4 : 1;
725 unsigned RC5 : 1;
726 unsigned RC6 : 1;
727 unsigned RC7 : 1;
729 } __DDRCbits_t;
731 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
733 #define _TRISC0 0x01
734 #define _RC0 0x01
735 #define _TRISC1 0x02
736 #define _RC1 0x02
737 #define _TRISC2 0x04
738 #define _RC2 0x04
739 #define _TRISC3 0x08
740 #define _RC3 0x08
741 #define _TRISC4 0x10
742 #define _RC4 0x10
743 #define _TRISC5 0x20
744 #define _RC5 0x20
745 #define _TRISC6 0x40
746 #define _RC6 0x40
747 #define _TRISC7 0x80
748 #define _RC7 0x80
750 //==============================================================================
753 //==============================================================================
754 // TRISC Bits
756 extern __at(0x0F94) __sfr TRISC;
758 typedef union
760 struct
762 unsigned TRISC0 : 1;
763 unsigned TRISC1 : 1;
764 unsigned TRISC2 : 1;
765 unsigned TRISC3 : 1;
766 unsigned TRISC4 : 1;
767 unsigned TRISC5 : 1;
768 unsigned TRISC6 : 1;
769 unsigned TRISC7 : 1;
772 struct
774 unsigned RC0 : 1;
775 unsigned RC1 : 1;
776 unsigned RC2 : 1;
777 unsigned RC3 : 1;
778 unsigned RC4 : 1;
779 unsigned RC5 : 1;
780 unsigned RC6 : 1;
781 unsigned RC7 : 1;
783 } __TRISCbits_t;
785 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
787 #define _TRISC_TRISC0 0x01
788 #define _TRISC_RC0 0x01
789 #define _TRISC_TRISC1 0x02
790 #define _TRISC_RC1 0x02
791 #define _TRISC_TRISC2 0x04
792 #define _TRISC_RC2 0x04
793 #define _TRISC_TRISC3 0x08
794 #define _TRISC_RC3 0x08
795 #define _TRISC_TRISC4 0x10
796 #define _TRISC_RC4 0x10
797 #define _TRISC_TRISC5 0x20
798 #define _TRISC_RC5 0x20
799 #define _TRISC_TRISC6 0x40
800 #define _TRISC_RC6 0x40
801 #define _TRISC_TRISC7 0x80
802 #define _TRISC_RC7 0x80
804 //==============================================================================
807 //==============================================================================
808 // OSCTUNE Bits
810 extern __at(0x0F9B) __sfr OSCTUNE;
812 typedef union
814 struct
816 unsigned TUN0 : 1;
817 unsigned TUN1 : 1;
818 unsigned TUN2 : 1;
819 unsigned TUN3 : 1;
820 unsigned TUN4 : 1;
821 unsigned : 1;
822 unsigned PLLEN : 1;
823 unsigned INTSRC : 1;
826 struct
828 unsigned TUN : 5;
829 unsigned : 3;
831 } __OSCTUNEbits_t;
833 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
835 #define _TUN0 0x01
836 #define _TUN1 0x02
837 #define _TUN2 0x04
838 #define _TUN3 0x08
839 #define _TUN4 0x10
840 #define _PLLEN 0x40
841 #define _INTSRC 0x80
843 //==============================================================================
846 //==============================================================================
847 // PIE1 Bits
849 extern __at(0x0F9D) __sfr PIE1;
851 typedef struct
853 unsigned TMR1IE : 1;
854 unsigned TMR2IE : 1;
855 unsigned CCP1IE : 1;
856 unsigned SSPIE : 1;
857 unsigned TXIE : 1;
858 unsigned RCIE : 1;
859 unsigned ADIE : 1;
860 unsigned : 1;
861 } __PIE1bits_t;
863 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
865 #define _TMR1IE 0x01
866 #define _TMR2IE 0x02
867 #define _CCP1IE 0x04
868 #define _SSPIE 0x08
869 #define _TXIE 0x10
870 #define _RCIE 0x20
871 #define _ADIE 0x40
873 //==============================================================================
876 //==============================================================================
877 // PIR1 Bits
879 extern __at(0x0F9E) __sfr PIR1;
881 typedef struct
883 unsigned TMR1IF : 1;
884 unsigned TMR2IF : 1;
885 unsigned CCP1IF : 1;
886 unsigned SSPIF : 1;
887 unsigned TXIF : 1;
888 unsigned RCIF : 1;
889 unsigned ADIF : 1;
890 unsigned : 1;
891 } __PIR1bits_t;
893 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
895 #define _TMR1IF 0x01
896 #define _TMR2IF 0x02
897 #define _CCP1IF 0x04
898 #define _SSPIF 0x08
899 #define _TXIF 0x10
900 #define _RCIF 0x20
901 #define _ADIF 0x40
903 //==============================================================================
906 //==============================================================================
907 // IPR1 Bits
909 extern __at(0x0F9F) __sfr IPR1;
911 typedef struct
913 unsigned TMR1IP : 1;
914 unsigned TMR2IP : 1;
915 unsigned CCP1IP : 1;
916 unsigned SSPIP : 1;
917 unsigned TXIP : 1;
918 unsigned RCIP : 1;
919 unsigned ADIP : 1;
920 unsigned : 1;
921 } __IPR1bits_t;
923 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
925 #define _TMR1IP 0x01
926 #define _TMR2IP 0x02
927 #define _CCP1IP 0x04
928 #define _SSPIP 0x08
929 #define _TXIP 0x10
930 #define _RCIP 0x20
931 #define _ADIP 0x40
933 //==============================================================================
936 //==============================================================================
937 // PIE2 Bits
939 extern __at(0x0FA0) __sfr PIE2;
941 typedef union
943 struct
945 unsigned CCP2IE : 1;
946 unsigned TMR3IE : 1;
947 unsigned HLVDIE : 1;
948 unsigned BCLIE : 1;
949 unsigned EEIE : 1;
950 unsigned : 1;
951 unsigned CMIE : 1;
952 unsigned OSCFIE : 1;
955 struct
957 unsigned : 1;
958 unsigned : 1;
959 unsigned LVDIE : 1;
960 unsigned : 1;
961 unsigned : 1;
962 unsigned : 1;
963 unsigned : 1;
964 unsigned : 1;
966 } __PIE2bits_t;
968 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
970 #define _CCP2IE 0x01
971 #define _TMR3IE 0x02
972 #define _HLVDIE 0x04
973 #define _LVDIE 0x04
974 #define _BCLIE 0x08
975 #define _EEIE 0x10
976 #define _CMIE 0x40
977 #define _OSCFIE 0x80
979 //==============================================================================
982 //==============================================================================
983 // PIR2 Bits
985 extern __at(0x0FA1) __sfr PIR2;
987 typedef union
989 struct
991 unsigned CCP2IF : 1;
992 unsigned TMR3IF : 1;
993 unsigned HLVDIF : 1;
994 unsigned BCLIF : 1;
995 unsigned EEIF : 1;
996 unsigned : 1;
997 unsigned CMIF : 1;
998 unsigned OSCFIF : 1;
1001 struct
1003 unsigned : 1;
1004 unsigned : 1;
1005 unsigned LVDIF : 1;
1006 unsigned : 1;
1007 unsigned : 1;
1008 unsigned : 1;
1009 unsigned : 1;
1010 unsigned : 1;
1012 } __PIR2bits_t;
1014 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1016 #define _CCP2IF 0x01
1017 #define _TMR3IF 0x02
1018 #define _HLVDIF 0x04
1019 #define _LVDIF 0x04
1020 #define _BCLIF 0x08
1021 #define _EEIF 0x10
1022 #define _CMIF 0x40
1023 #define _OSCFIF 0x80
1025 //==============================================================================
1028 //==============================================================================
1029 // IPR2 Bits
1031 extern __at(0x0FA2) __sfr IPR2;
1033 typedef union
1035 struct
1037 unsigned CCP2IP : 1;
1038 unsigned TMR3IP : 1;
1039 unsigned HLVDIP : 1;
1040 unsigned BCLIP : 1;
1041 unsigned EEIP : 1;
1042 unsigned : 1;
1043 unsigned CMIP : 1;
1044 unsigned OSCFIP : 1;
1047 struct
1049 unsigned : 1;
1050 unsigned : 1;
1051 unsigned LVDIP : 1;
1052 unsigned : 1;
1053 unsigned : 1;
1054 unsigned : 1;
1055 unsigned : 1;
1056 unsigned : 1;
1058 } __IPR2bits_t;
1060 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1062 #define _CCP2IP 0x01
1063 #define _TMR3IP 0x02
1064 #define _HLVDIP 0x04
1065 #define _LVDIP 0x04
1066 #define _BCLIP 0x08
1067 #define _EEIP 0x10
1068 #define _CMIP 0x40
1069 #define _OSCFIP 0x80
1071 //==============================================================================
1074 //==============================================================================
1075 // EECON1 Bits
1077 extern __at(0x0FA6) __sfr EECON1;
1079 typedef struct
1081 unsigned RD : 1;
1082 unsigned WR : 1;
1083 unsigned WREN : 1;
1084 unsigned WRERR : 1;
1085 unsigned FREE : 1;
1086 unsigned : 1;
1087 unsigned CFGS : 1;
1088 unsigned EEPGD : 1;
1089 } __EECON1bits_t;
1091 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1093 #define _RD 0x01
1094 #define _WR 0x02
1095 #define _WREN 0x04
1096 #define _WRERR 0x08
1097 #define _FREE 0x10
1098 #define _CFGS 0x40
1099 #define _EEPGD 0x80
1101 //==============================================================================
1103 extern __at(0x0FA7) __sfr EECON2;
1104 extern __at(0x0FA8) __sfr EEDATA;
1105 extern __at(0x0FA9) __sfr EEADR;
1107 //==============================================================================
1108 // RCSTA Bits
1110 extern __at(0x0FAB) __sfr RCSTA;
1112 typedef union
1114 struct
1116 unsigned RX9D : 1;
1117 unsigned OERR : 1;
1118 unsigned FERR : 1;
1119 unsigned ADDEN : 1;
1120 unsigned CREN : 1;
1121 unsigned SREN : 1;
1122 unsigned RX9 : 1;
1123 unsigned SPEN : 1;
1126 struct
1128 unsigned : 1;
1129 unsigned : 1;
1130 unsigned : 1;
1131 unsigned ADEN : 1;
1132 unsigned : 1;
1133 unsigned : 1;
1134 unsigned : 1;
1135 unsigned : 1;
1137 } __RCSTAbits_t;
1139 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1141 #define _RX9D 0x01
1142 #define _OERR 0x02
1143 #define _FERR 0x04
1144 #define _ADDEN 0x08
1145 #define _ADEN 0x08
1146 #define _CREN 0x10
1147 #define _SREN 0x20
1148 #define _RX9 0x40
1149 #define _SPEN 0x80
1151 //==============================================================================
1154 //==============================================================================
1155 // TXSTA Bits
1157 extern __at(0x0FAC) __sfr TXSTA;
1159 typedef struct
1161 unsigned TX9D : 1;
1162 unsigned TRMT : 1;
1163 unsigned BRGH : 1;
1164 unsigned SENDB : 1;
1165 unsigned SYNC : 1;
1166 unsigned TXEN : 1;
1167 unsigned TX9 : 1;
1168 unsigned CSRC : 1;
1169 } __TXSTAbits_t;
1171 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1173 #define _TX9D 0x01
1174 #define _TRMT 0x02
1175 #define _BRGH 0x04
1176 #define _SENDB 0x08
1177 #define _SYNC 0x10
1178 #define _TXEN 0x20
1179 #define _TX9 0x40
1180 #define _CSRC 0x80
1182 //==============================================================================
1184 extern __at(0x0FAD) __sfr TXREG;
1185 extern __at(0x0FAE) __sfr RCREG;
1186 extern __at(0x0FAF) __sfr SPBRG;
1187 extern __at(0x0FB0) __sfr SPBRGH;
1189 //==============================================================================
1190 // T3CON Bits
1192 extern __at(0x0FB1) __sfr T3CON;
1194 typedef union
1196 struct
1198 unsigned TMR3ON : 1;
1199 unsigned TMR3CS : 1;
1200 unsigned NOT_T3SYNC : 1;
1201 unsigned T3CCP1 : 1;
1202 unsigned T3CKPS0 : 1;
1203 unsigned T3CKPS1 : 1;
1204 unsigned T3CCP2 : 1;
1205 unsigned RD16 : 1;
1208 struct
1210 unsigned : 1;
1211 unsigned : 1;
1212 unsigned T3SYNC : 1;
1213 unsigned : 1;
1214 unsigned : 1;
1215 unsigned : 1;
1216 unsigned : 1;
1217 unsigned : 1;
1220 struct
1222 unsigned : 4;
1223 unsigned T3CKPS : 2;
1224 unsigned : 2;
1226 } __T3CONbits_t;
1228 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1230 #define _T3CON_TMR3ON 0x01
1231 #define _T3CON_TMR3CS 0x02
1232 #define _T3CON_NOT_T3SYNC 0x04
1233 #define _T3CON_T3SYNC 0x04
1234 #define _T3CON_T3CCP1 0x08
1235 #define _T3CON_T3CKPS0 0x10
1236 #define _T3CON_T3CKPS1 0x20
1237 #define _T3CON_T3CCP2 0x40
1238 #define _T3CON_RD16 0x80
1240 //==============================================================================
1242 extern __at(0x0FB2) __sfr TMR3;
1243 extern __at(0x0FB2) __sfr TMR3L;
1244 extern __at(0x0FB3) __sfr TMR3H;
1246 //==============================================================================
1247 // CMCON Bits
1249 extern __at(0x0FB4) __sfr CMCON;
1251 typedef union
1253 struct
1255 unsigned CM0 : 1;
1256 unsigned CM1 : 1;
1257 unsigned CM2 : 1;
1258 unsigned CIS : 1;
1259 unsigned C1INV : 1;
1260 unsigned C2INV : 1;
1261 unsigned C1OUT : 1;
1262 unsigned C2OUT : 1;
1265 struct
1267 unsigned CM : 3;
1268 unsigned : 5;
1270 } __CMCONbits_t;
1272 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1274 #define _CM0 0x01
1275 #define _CM1 0x02
1276 #define _CM2 0x04
1277 #define _CIS 0x08
1278 #define _C1INV 0x10
1279 #define _C2INV 0x20
1280 #define _C1OUT 0x40
1281 #define _C2OUT 0x80
1283 //==============================================================================
1286 //==============================================================================
1287 // CVRCON Bits
1289 extern __at(0x0FB5) __sfr CVRCON;
1291 typedef union
1293 struct
1295 unsigned CVR0 : 1;
1296 unsigned CVR1 : 1;
1297 unsigned CVR2 : 1;
1298 unsigned CVR3 : 1;
1299 unsigned CVRSS : 1;
1300 unsigned CVRR : 1;
1301 unsigned CVROE : 1;
1302 unsigned CVREN : 1;
1305 struct
1307 unsigned CVR : 4;
1308 unsigned : 4;
1310 } __CVRCONbits_t;
1312 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1314 #define _CVR0 0x01
1315 #define _CVR1 0x02
1316 #define _CVR2 0x04
1317 #define _CVR3 0x08
1318 #define _CVRSS 0x10
1319 #define _CVRR 0x20
1320 #define _CVROE 0x40
1321 #define _CVREN 0x80
1323 //==============================================================================
1326 //==============================================================================
1327 // ECCP1AS Bits
1329 extern __at(0x0FB6) __sfr ECCP1AS;
1331 typedef union
1333 struct
1335 unsigned : 1;
1336 unsigned : 1;
1337 unsigned PSSAC0 : 1;
1338 unsigned PSSAC1 : 1;
1339 unsigned ECCPAS0 : 1;
1340 unsigned ECCPAS1 : 1;
1341 unsigned ECCPAS2 : 1;
1342 unsigned ECCPASE : 1;
1345 struct
1347 unsigned : 2;
1348 unsigned PSSAC : 2;
1349 unsigned : 4;
1352 struct
1354 unsigned : 4;
1355 unsigned ECCPAS : 3;
1356 unsigned : 1;
1358 } __ECCP1ASbits_t;
1360 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1362 #define _PSSAC0 0x04
1363 #define _PSSAC1 0x08
1364 #define _ECCPAS0 0x10
1365 #define _ECCPAS1 0x20
1366 #define _ECCPAS2 0x40
1367 #define _ECCPASE 0x80
1369 //==============================================================================
1372 //==============================================================================
1373 // ECCP1DEL Bits
1375 extern __at(0x0FB7) __sfr ECCP1DEL;
1377 typedef struct
1379 unsigned : 1;
1380 unsigned : 1;
1381 unsigned : 1;
1382 unsigned : 1;
1383 unsigned : 1;
1384 unsigned : 1;
1385 unsigned : 1;
1386 unsigned PRSEN : 1;
1387 } __ECCP1DELbits_t;
1389 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1391 #define _PRSEN 0x80
1393 //==============================================================================
1396 //==============================================================================
1397 // PWM1CON Bits
1399 extern __at(0x0FB7) __sfr PWM1CON;
1401 typedef struct
1403 unsigned : 1;
1404 unsigned : 1;
1405 unsigned : 1;
1406 unsigned : 1;
1407 unsigned : 1;
1408 unsigned : 1;
1409 unsigned : 1;
1410 unsigned PRSEN : 1;
1411 } __PWM1CONbits_t;
1413 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1415 #define _PWM1CON_PRSEN 0x80
1417 //==============================================================================
1420 //==============================================================================
1421 // BAUDCON Bits
1423 extern __at(0x0FB8) __sfr BAUDCON;
1425 typedef union
1427 struct
1429 unsigned ABDEN : 1;
1430 unsigned WUE : 1;
1431 unsigned : 1;
1432 unsigned BRG16 : 1;
1433 unsigned TXCKP : 1;
1434 unsigned RXDTP : 1;
1435 unsigned RCIDL : 1;
1436 unsigned ABDOVF : 1;
1439 struct
1441 unsigned : 1;
1442 unsigned : 1;
1443 unsigned : 1;
1444 unsigned : 1;
1445 unsigned SCKP : 1;
1446 unsigned : 1;
1447 unsigned RCMT : 1;
1448 unsigned : 1;
1450 } __BAUDCONbits_t;
1452 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1454 #define _ABDEN 0x01
1455 #define _WUE 0x02
1456 #define _BRG16 0x08
1457 #define _TXCKP 0x10
1458 #define _SCKP 0x10
1459 #define _RXDTP 0x20
1460 #define _RCIDL 0x40
1461 #define _RCMT 0x40
1462 #define _ABDOVF 0x80
1464 //==============================================================================
1467 //==============================================================================
1468 // BAUDCTL Bits
1470 extern __at(0x0FB8) __sfr BAUDCTL;
1472 typedef union
1474 struct
1476 unsigned ABDEN : 1;
1477 unsigned WUE : 1;
1478 unsigned : 1;
1479 unsigned BRG16 : 1;
1480 unsigned TXCKP : 1;
1481 unsigned RXDTP : 1;
1482 unsigned RCIDL : 1;
1483 unsigned ABDOVF : 1;
1486 struct
1488 unsigned : 1;
1489 unsigned : 1;
1490 unsigned : 1;
1491 unsigned : 1;
1492 unsigned SCKP : 1;
1493 unsigned : 1;
1494 unsigned RCMT : 1;
1495 unsigned : 1;
1497 } __BAUDCTLbits_t;
1499 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1501 #define _BAUDCTL_ABDEN 0x01
1502 #define _BAUDCTL_WUE 0x02
1503 #define _BAUDCTL_BRG16 0x08
1504 #define _BAUDCTL_TXCKP 0x10
1505 #define _BAUDCTL_SCKP 0x10
1506 #define _BAUDCTL_RXDTP 0x20
1507 #define _BAUDCTL_RCIDL 0x40
1508 #define _BAUDCTL_RCMT 0x40
1509 #define _BAUDCTL_ABDOVF 0x80
1511 //==============================================================================
1514 //==============================================================================
1515 // CCP2CON Bits
1517 extern __at(0x0FBA) __sfr CCP2CON;
1519 typedef union
1521 struct
1523 unsigned CCP2M0 : 1;
1524 unsigned CCP2M1 : 1;
1525 unsigned CCP2M2 : 1;
1526 unsigned CCP2M3 : 1;
1527 unsigned DC2B0 : 1;
1528 unsigned DC2B1 : 1;
1529 unsigned : 1;
1530 unsigned : 1;
1533 struct
1535 unsigned : 1;
1536 unsigned : 1;
1537 unsigned : 1;
1538 unsigned : 1;
1539 unsigned CCP2Y : 1;
1540 unsigned CCP2X : 1;
1541 unsigned : 1;
1542 unsigned : 1;
1545 struct
1547 unsigned CCP2M : 4;
1548 unsigned : 4;
1551 struct
1553 unsigned : 4;
1554 unsigned DC2B : 2;
1555 unsigned : 2;
1557 } __CCP2CONbits_t;
1559 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1561 #define _CCP2M0 0x01
1562 #define _CCP2M1 0x02
1563 #define _CCP2M2 0x04
1564 #define _CCP2M3 0x08
1565 #define _DC2B0 0x10
1566 #define _CCP2Y 0x10
1567 #define _DC2B1 0x20
1568 #define _CCP2X 0x20
1570 //==============================================================================
1572 extern __at(0x0FBB) __sfr CCPR2;
1573 extern __at(0x0FBB) __sfr CCPR2L;
1574 extern __at(0x0FBC) __sfr CCPR2H;
1576 //==============================================================================
1577 // CCP1CON Bits
1579 extern __at(0x0FBD) __sfr CCP1CON;
1581 typedef union
1583 struct
1585 unsigned CCP1M0 : 1;
1586 unsigned CCP1M1 : 1;
1587 unsigned CCP1M2 : 1;
1588 unsigned CCP1M3 : 1;
1589 unsigned DC1B0 : 1;
1590 unsigned DC1B1 : 1;
1591 unsigned : 1;
1592 unsigned : 1;
1595 struct
1597 unsigned : 1;
1598 unsigned : 1;
1599 unsigned : 1;
1600 unsigned : 1;
1601 unsigned CCP1Y : 1;
1602 unsigned CCP1X : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1607 struct
1609 unsigned CCP1M : 4;
1610 unsigned : 4;
1613 struct
1615 unsigned : 4;
1616 unsigned DC1B : 2;
1617 unsigned : 2;
1619 } __CCP1CONbits_t;
1621 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1623 #define _CCP1M0 0x01
1624 #define _CCP1M1 0x02
1625 #define _CCP1M2 0x04
1626 #define _CCP1M3 0x08
1627 #define _DC1B0 0x10
1628 #define _CCP1Y 0x10
1629 #define _DC1B1 0x20
1630 #define _CCP1X 0x20
1632 //==============================================================================
1635 //==============================================================================
1636 // ECCP1CON Bits
1638 extern __at(0x0FBD) __sfr ECCP1CON;
1640 typedef union
1642 struct
1644 unsigned CCP1M0 : 1;
1645 unsigned CCP1M1 : 1;
1646 unsigned CCP1M2 : 1;
1647 unsigned CCP1M3 : 1;
1648 unsigned DC1B0 : 1;
1649 unsigned DC1B1 : 1;
1650 unsigned : 1;
1651 unsigned : 1;
1654 struct
1656 unsigned : 1;
1657 unsigned : 1;
1658 unsigned : 1;
1659 unsigned : 1;
1660 unsigned CCP1Y : 1;
1661 unsigned CCP1X : 1;
1662 unsigned : 1;
1663 unsigned : 1;
1666 struct
1668 unsigned CCP1M : 4;
1669 unsigned : 4;
1672 struct
1674 unsigned : 4;
1675 unsigned DC1B : 2;
1676 unsigned : 2;
1678 } __ECCP1CONbits_t;
1680 extern __at(0x0FBD) volatile __ECCP1CONbits_t ECCP1CONbits;
1682 #define _ECCP1CON_CCP1M0 0x01
1683 #define _ECCP1CON_CCP1M1 0x02
1684 #define _ECCP1CON_CCP1M2 0x04
1685 #define _ECCP1CON_CCP1M3 0x08
1686 #define _ECCP1CON_DC1B0 0x10
1687 #define _ECCP1CON_CCP1Y 0x10
1688 #define _ECCP1CON_DC1B1 0x20
1689 #define _ECCP1CON_CCP1X 0x20
1691 //==============================================================================
1693 extern __at(0x0FBE) __sfr CCPR1;
1694 extern __at(0x0FBE) __sfr CCPR1L;
1695 extern __at(0x0FBF) __sfr CCPR1H;
1697 //==============================================================================
1698 // ADCON2 Bits
1700 extern __at(0x0FC0) __sfr ADCON2;
1702 typedef union
1704 struct
1706 unsigned ADCS0 : 1;
1707 unsigned ADCS1 : 1;
1708 unsigned ADCS2 : 1;
1709 unsigned ACQT0 : 1;
1710 unsigned ACQT1 : 1;
1711 unsigned ACQT2 : 1;
1712 unsigned : 1;
1713 unsigned ADFM : 1;
1716 struct
1718 unsigned ADCS : 3;
1719 unsigned : 5;
1722 struct
1724 unsigned : 3;
1725 unsigned ACQT : 3;
1726 unsigned : 2;
1728 } __ADCON2bits_t;
1730 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1732 #define _ADCS0 0x01
1733 #define _ADCS1 0x02
1734 #define _ADCS2 0x04
1735 #define _ACQT0 0x08
1736 #define _ACQT1 0x10
1737 #define _ACQT2 0x20
1738 #define _ADFM 0x80
1740 //==============================================================================
1743 //==============================================================================
1744 // ADCON1 Bits
1746 extern __at(0x0FC1) __sfr ADCON1;
1748 typedef union
1750 struct
1752 unsigned PCFG0 : 1;
1753 unsigned PCFG1 : 1;
1754 unsigned PCFG2 : 1;
1755 unsigned PCFG3 : 1;
1756 unsigned VCFG0 : 1;
1757 unsigned VCFG1 : 1;
1758 unsigned : 1;
1759 unsigned : 1;
1762 struct
1764 unsigned PCFG : 4;
1765 unsigned : 4;
1768 struct
1770 unsigned : 4;
1771 unsigned VCFG : 2;
1772 unsigned : 2;
1774 } __ADCON1bits_t;
1776 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1778 #define _PCFG0 0x01
1779 #define _PCFG1 0x02
1780 #define _PCFG2 0x04
1781 #define _PCFG3 0x08
1782 #define _VCFG0 0x10
1783 #define _VCFG1 0x20
1785 //==============================================================================
1788 //==============================================================================
1789 // ADCON0 Bits
1791 extern __at(0x0FC2) __sfr ADCON0;
1793 typedef union
1795 struct
1797 unsigned ADON : 1;
1798 unsigned GO_NOT_DONE : 1;
1799 unsigned CHS0 : 1;
1800 unsigned CHS1 : 1;
1801 unsigned CHS2 : 1;
1802 unsigned CHS3 : 1;
1803 unsigned : 1;
1804 unsigned : 1;
1807 struct
1809 unsigned : 1;
1810 unsigned GO : 1;
1811 unsigned : 1;
1812 unsigned : 1;
1813 unsigned : 1;
1814 unsigned : 1;
1815 unsigned : 1;
1816 unsigned : 1;
1819 struct
1821 unsigned : 1;
1822 unsigned DONE : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1825 unsigned : 1;
1826 unsigned : 1;
1827 unsigned : 1;
1828 unsigned : 1;
1831 struct
1833 unsigned : 1;
1834 unsigned NOT_DONE : 1;
1835 unsigned : 1;
1836 unsigned : 1;
1837 unsigned : 1;
1838 unsigned : 1;
1839 unsigned : 1;
1840 unsigned : 1;
1843 struct
1845 unsigned : 1;
1846 unsigned GO_DONE : 1;
1847 unsigned : 1;
1848 unsigned : 1;
1849 unsigned : 1;
1850 unsigned : 1;
1851 unsigned : 1;
1852 unsigned : 1;
1855 struct
1857 unsigned : 2;
1858 unsigned CHS : 4;
1859 unsigned : 2;
1861 } __ADCON0bits_t;
1863 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1865 #define _ADON 0x01
1866 #define _GO_NOT_DONE 0x02
1867 #define _GO 0x02
1868 #define _DONE 0x02
1869 #define _NOT_DONE 0x02
1870 #define _GO_DONE 0x02
1871 #define _CHS0 0x04
1872 #define _CHS1 0x08
1873 #define _CHS2 0x10
1874 #define _CHS3 0x20
1876 //==============================================================================
1878 extern __at(0x0FC3) __sfr ADRES;
1879 extern __at(0x0FC3) __sfr ADRESL;
1880 extern __at(0x0FC4) __sfr ADRESH;
1882 //==============================================================================
1883 // SSPCON2 Bits
1885 extern __at(0x0FC5) __sfr SSPCON2;
1887 typedef union
1889 struct
1891 unsigned SEN : 1;
1892 unsigned RSEN : 1;
1893 unsigned PEN : 1;
1894 unsigned RCEN : 1;
1895 unsigned ACKEN : 1;
1896 unsigned ACKDT : 1;
1897 unsigned ACKSTAT : 1;
1898 unsigned GCEN : 1;
1901 struct
1903 unsigned : 1;
1904 unsigned ADMSK1 : 1;
1905 unsigned ADMSK2 : 1;
1906 unsigned ADMSK3 : 1;
1907 unsigned ADMSK4 : 1;
1908 unsigned ADMSK5 : 1;
1909 unsigned : 1;
1910 unsigned : 1;
1912 } __SSPCON2bits_t;
1914 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1916 #define _SEN 0x01
1917 #define _RSEN 0x02
1918 #define _ADMSK1 0x02
1919 #define _PEN 0x04
1920 #define _ADMSK2 0x04
1921 #define _RCEN 0x08
1922 #define _ADMSK3 0x08
1923 #define _ACKEN 0x10
1924 #define _ADMSK4 0x10
1925 #define _ACKDT 0x20
1926 #define _ADMSK5 0x20
1927 #define _ACKSTAT 0x40
1928 #define _GCEN 0x80
1930 //==============================================================================
1933 //==============================================================================
1934 // SSPCON1 Bits
1936 extern __at(0x0FC6) __sfr SSPCON1;
1938 typedef union
1940 struct
1942 unsigned SSPM0 : 1;
1943 unsigned SSPM1 : 1;
1944 unsigned SSPM2 : 1;
1945 unsigned SSPM3 : 1;
1946 unsigned CKP : 1;
1947 unsigned SSPEN : 1;
1948 unsigned SSPOV : 1;
1949 unsigned WCOL : 1;
1952 struct
1954 unsigned SSPM : 4;
1955 unsigned : 4;
1957 } __SSPCON1bits_t;
1959 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1961 #define _SSPM0 0x01
1962 #define _SSPM1 0x02
1963 #define _SSPM2 0x04
1964 #define _SSPM3 0x08
1965 #define _CKP 0x10
1966 #define _SSPEN 0x20
1967 #define _SSPOV 0x40
1968 #define _WCOL 0x80
1970 //==============================================================================
1973 //==============================================================================
1974 // SSPSTAT Bits
1976 extern __at(0x0FC7) __sfr SSPSTAT;
1978 typedef union
1980 struct
1982 unsigned BF : 1;
1983 unsigned UA : 1;
1984 unsigned R_NOT_W : 1;
1985 unsigned S : 1;
1986 unsigned P : 1;
1987 unsigned D_NOT_A : 1;
1988 unsigned CKE : 1;
1989 unsigned SMP : 1;
1992 struct
1994 unsigned : 1;
1995 unsigned : 1;
1996 unsigned R : 1;
1997 unsigned : 1;
1998 unsigned : 1;
1999 unsigned D : 1;
2000 unsigned : 1;
2001 unsigned : 1;
2004 struct
2006 unsigned : 1;
2007 unsigned : 1;
2008 unsigned NOT_W : 1;
2009 unsigned : 1;
2010 unsigned : 1;
2011 unsigned NOT_A : 1;
2012 unsigned : 1;
2013 unsigned : 1;
2016 struct
2018 unsigned : 1;
2019 unsigned : 1;
2020 unsigned R_W : 1;
2021 unsigned : 1;
2022 unsigned : 1;
2023 unsigned D_A : 1;
2024 unsigned : 1;
2025 unsigned : 1;
2028 struct
2030 unsigned : 1;
2031 unsigned : 1;
2032 unsigned NOT_WRITE : 1;
2033 unsigned : 1;
2034 unsigned : 1;
2035 unsigned NOT_ADDRESS : 1;
2036 unsigned : 1;
2037 unsigned : 1;
2039 } __SSPSTATbits_t;
2041 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2043 #define _BF 0x01
2044 #define _UA 0x02
2045 #define _R_NOT_W 0x04
2046 #define _R 0x04
2047 #define _NOT_W 0x04
2048 #define _R_W 0x04
2049 #define _NOT_WRITE 0x04
2050 #define _S 0x08
2051 #define _P 0x10
2052 #define _D_NOT_A 0x20
2053 #define _D 0x20
2054 #define _NOT_A 0x20
2055 #define _D_A 0x20
2056 #define _NOT_ADDRESS 0x20
2057 #define _CKE 0x40
2058 #define _SMP 0x80
2060 //==============================================================================
2062 extern __at(0x0FC8) __sfr SSPADD;
2063 extern __at(0x0FC9) __sfr SSPBUF;
2065 //==============================================================================
2066 // T2CON Bits
2068 extern __at(0x0FCA) __sfr T2CON;
2070 typedef union
2072 struct
2074 unsigned T2CKPS0 : 1;
2075 unsigned T2CKPS1 : 1;
2076 unsigned TMR2ON : 1;
2077 unsigned TOUTPS0 : 1;
2078 unsigned TOUTPS1 : 1;
2079 unsigned TOUTPS2 : 1;
2080 unsigned TOUTPS3 : 1;
2081 unsigned : 1;
2084 struct
2086 unsigned : 1;
2087 unsigned : 1;
2088 unsigned : 1;
2089 unsigned T2OUTPS0 : 1;
2090 unsigned T2OUTPS1 : 1;
2091 unsigned T2OUTPS2 : 1;
2092 unsigned T2OUTPS3 : 1;
2093 unsigned : 1;
2096 struct
2098 unsigned T2CKPS : 2;
2099 unsigned : 6;
2102 struct
2104 unsigned : 3;
2105 unsigned TOUTPS : 4;
2106 unsigned : 1;
2109 struct
2111 unsigned : 3;
2112 unsigned T2OUTPS : 4;
2113 unsigned : 1;
2115 } __T2CONbits_t;
2117 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2119 #define _T2CKPS0 0x01
2120 #define _T2CKPS1 0x02
2121 #define _TMR2ON 0x04
2122 #define _TOUTPS0 0x08
2123 #define _T2OUTPS0 0x08
2124 #define _TOUTPS1 0x10
2125 #define _T2OUTPS1 0x10
2126 #define _TOUTPS2 0x20
2127 #define _T2OUTPS2 0x20
2128 #define _TOUTPS3 0x40
2129 #define _T2OUTPS3 0x40
2131 //==============================================================================
2133 extern __at(0x0FCB) __sfr PR2;
2134 extern __at(0x0FCC) __sfr TMR2;
2136 //==============================================================================
2137 // T1CON Bits
2139 extern __at(0x0FCD) __sfr T1CON;
2141 typedef union
2143 struct
2145 unsigned TMR1ON : 1;
2146 unsigned TMR1CS : 1;
2147 unsigned NOT_T1SYNC : 1;
2148 unsigned T1OSCEN : 1;
2149 unsigned T1CKPS0 : 1;
2150 unsigned T1CKPS1 : 1;
2151 unsigned T1RUN : 1;
2152 unsigned RD16 : 1;
2155 struct
2157 unsigned : 1;
2158 unsigned : 1;
2159 unsigned T1SYNC : 1;
2160 unsigned : 1;
2161 unsigned : 1;
2162 unsigned : 1;
2163 unsigned : 1;
2164 unsigned : 1;
2167 struct
2169 unsigned : 4;
2170 unsigned T1CKPS : 2;
2171 unsigned : 2;
2173 } __T1CONbits_t;
2175 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2177 #define _TMR1ON 0x01
2178 #define _TMR1CS 0x02
2179 #define _NOT_T1SYNC 0x04
2180 #define _T1SYNC 0x04
2181 #define _T1OSCEN 0x08
2182 #define _T1CKPS0 0x10
2183 #define _T1CKPS1 0x20
2184 #define _T1RUN 0x40
2185 #define _RD16 0x80
2187 //==============================================================================
2189 extern __at(0x0FCE) __sfr TMR1;
2190 extern __at(0x0FCE) __sfr TMR1L;
2191 extern __at(0x0FCF) __sfr TMR1H;
2193 //==============================================================================
2194 // RCON Bits
2196 extern __at(0x0FD0) __sfr RCON;
2198 typedef union
2200 struct
2202 unsigned NOT_BOR : 1;
2203 unsigned NOT_POR : 1;
2204 unsigned NOT_PD : 1;
2205 unsigned NOT_TO : 1;
2206 unsigned NOT_RI : 1;
2207 unsigned : 1;
2208 unsigned SBOREN : 1;
2209 unsigned IPEN : 1;
2212 struct
2214 unsigned BOR : 1;
2215 unsigned POR : 1;
2216 unsigned PD : 1;
2217 unsigned TO : 1;
2218 unsigned RI : 1;
2219 unsigned : 1;
2220 unsigned : 1;
2221 unsigned : 1;
2223 } __RCONbits_t;
2225 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2227 #define _NOT_BOR 0x01
2228 #define _BOR 0x01
2229 #define _NOT_POR 0x02
2230 #define _POR 0x02
2231 #define _NOT_PD 0x04
2232 #define _PD 0x04
2233 #define _NOT_TO 0x08
2234 #define _TO 0x08
2235 #define _NOT_RI 0x10
2236 #define _RI 0x10
2237 #define _SBOREN 0x40
2238 #define _IPEN 0x80
2240 //==============================================================================
2243 //==============================================================================
2244 // WDTCON Bits
2246 extern __at(0x0FD1) __sfr WDTCON;
2248 typedef union
2250 struct
2252 unsigned SWDTEN : 1;
2253 unsigned : 1;
2254 unsigned : 1;
2255 unsigned : 1;
2256 unsigned : 1;
2257 unsigned : 1;
2258 unsigned : 1;
2259 unsigned : 1;
2262 struct
2264 unsigned SWDTE : 1;
2265 unsigned : 1;
2266 unsigned : 1;
2267 unsigned : 1;
2268 unsigned : 1;
2269 unsigned : 1;
2270 unsigned : 1;
2271 unsigned : 1;
2273 } __WDTCONbits_t;
2275 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2277 #define _SWDTEN 0x01
2278 #define _SWDTE 0x01
2280 //==============================================================================
2283 //==============================================================================
2284 // HLVDCON Bits
2286 extern __at(0x0FD2) __sfr HLVDCON;
2288 typedef union
2290 struct
2292 unsigned HLVDL0 : 1;
2293 unsigned HLVDL1 : 1;
2294 unsigned HLVDL2 : 1;
2295 unsigned HLVDL3 : 1;
2296 unsigned HLVDEN : 1;
2297 unsigned IRVST : 1;
2298 unsigned : 1;
2299 unsigned VDIRMAG : 1;
2302 struct
2304 unsigned LVDL0 : 1;
2305 unsigned LVDL1 : 1;
2306 unsigned LVDL2 : 1;
2307 unsigned LVDL3 : 1;
2308 unsigned LVDEN : 1;
2309 unsigned BGST : 1;
2310 unsigned : 1;
2311 unsigned : 1;
2314 struct
2316 unsigned LVV0 : 1;
2317 unsigned LVV1 : 1;
2318 unsigned LVV2 : 1;
2319 unsigned LVV3 : 1;
2320 unsigned : 1;
2321 unsigned : 1;
2322 unsigned : 1;
2323 unsigned : 1;
2326 struct
2328 unsigned HLVDL : 4;
2329 unsigned : 4;
2332 struct
2334 unsigned LVV : 4;
2335 unsigned : 4;
2338 struct
2340 unsigned LVDL : 4;
2341 unsigned : 4;
2343 } __HLVDCONbits_t;
2345 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2347 #define _HLVDL0 0x01
2348 #define _LVDL0 0x01
2349 #define _LVV0 0x01
2350 #define _HLVDL1 0x02
2351 #define _LVDL1 0x02
2352 #define _LVV1 0x02
2353 #define _HLVDL2 0x04
2354 #define _LVDL2 0x04
2355 #define _LVV2 0x04
2356 #define _HLVDL3 0x08
2357 #define _LVDL3 0x08
2358 #define _LVV3 0x08
2359 #define _HLVDEN 0x10
2360 #define _LVDEN 0x10
2361 #define _IRVST 0x20
2362 #define _BGST 0x20
2363 #define _VDIRMAG 0x80
2365 //==============================================================================
2368 //==============================================================================
2369 // LVDCON Bits
2371 extern __at(0x0FD2) __sfr LVDCON;
2373 typedef union
2375 struct
2377 unsigned HLVDL0 : 1;
2378 unsigned HLVDL1 : 1;
2379 unsigned HLVDL2 : 1;
2380 unsigned HLVDL3 : 1;
2381 unsigned HLVDEN : 1;
2382 unsigned IRVST : 1;
2383 unsigned : 1;
2384 unsigned VDIRMAG : 1;
2387 struct
2389 unsigned LVDL0 : 1;
2390 unsigned LVDL1 : 1;
2391 unsigned LVDL2 : 1;
2392 unsigned LVDL3 : 1;
2393 unsigned LVDEN : 1;
2394 unsigned BGST : 1;
2395 unsigned : 1;
2396 unsigned : 1;
2399 struct
2401 unsigned LVV0 : 1;
2402 unsigned LVV1 : 1;
2403 unsigned LVV2 : 1;
2404 unsigned LVV3 : 1;
2405 unsigned : 1;
2406 unsigned : 1;
2407 unsigned : 1;
2408 unsigned : 1;
2411 struct
2413 unsigned LVDL : 4;
2414 unsigned : 4;
2417 struct
2419 unsigned HLVDL : 4;
2420 unsigned : 4;
2423 struct
2425 unsigned LVV : 4;
2426 unsigned : 4;
2428 } __LVDCONbits_t;
2430 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2432 #define _LVDCON_HLVDL0 0x01
2433 #define _LVDCON_LVDL0 0x01
2434 #define _LVDCON_LVV0 0x01
2435 #define _LVDCON_HLVDL1 0x02
2436 #define _LVDCON_LVDL1 0x02
2437 #define _LVDCON_LVV1 0x02
2438 #define _LVDCON_HLVDL2 0x04
2439 #define _LVDCON_LVDL2 0x04
2440 #define _LVDCON_LVV2 0x04
2441 #define _LVDCON_HLVDL3 0x08
2442 #define _LVDCON_LVDL3 0x08
2443 #define _LVDCON_LVV3 0x08
2444 #define _LVDCON_HLVDEN 0x10
2445 #define _LVDCON_LVDEN 0x10
2446 #define _LVDCON_IRVST 0x20
2447 #define _LVDCON_BGST 0x20
2448 #define _LVDCON_VDIRMAG 0x80
2450 //==============================================================================
2453 //==============================================================================
2454 // OSCCON Bits
2456 extern __at(0x0FD3) __sfr OSCCON;
2458 typedef union
2460 struct
2462 unsigned SCS0 : 1;
2463 unsigned SCS1 : 1;
2464 unsigned IOFS : 1;
2465 unsigned OSTS : 1;
2466 unsigned IRCF0 : 1;
2467 unsigned IRCF1 : 1;
2468 unsigned IRCF2 : 1;
2469 unsigned IDLEN : 1;
2472 struct
2474 unsigned : 1;
2475 unsigned : 1;
2476 unsigned FLTS : 1;
2477 unsigned : 1;
2478 unsigned : 1;
2479 unsigned : 1;
2480 unsigned : 1;
2481 unsigned : 1;
2484 struct
2486 unsigned SCS : 2;
2487 unsigned : 6;
2490 struct
2492 unsigned : 4;
2493 unsigned IRCF : 3;
2494 unsigned : 1;
2496 } __OSCCONbits_t;
2498 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2500 #define _SCS0 0x01
2501 #define _SCS1 0x02
2502 #define _IOFS 0x04
2503 #define _FLTS 0x04
2504 #define _OSTS 0x08
2505 #define _IRCF0 0x10
2506 #define _IRCF1 0x20
2507 #define _IRCF2 0x40
2508 #define _IDLEN 0x80
2510 //==============================================================================
2513 //==============================================================================
2514 // T0CON Bits
2516 extern __at(0x0FD5) __sfr T0CON;
2518 typedef union
2520 struct
2522 unsigned T0PS0 : 1;
2523 unsigned T0PS1 : 1;
2524 unsigned T0PS2 : 1;
2525 unsigned PSA : 1;
2526 unsigned T0SE : 1;
2527 unsigned T0CS : 1;
2528 unsigned T08BIT : 1;
2529 unsigned TMR0ON : 1;
2532 struct
2534 unsigned : 1;
2535 unsigned : 1;
2536 unsigned : 1;
2537 unsigned : 1;
2538 unsigned : 1;
2539 unsigned : 1;
2540 unsigned T016BIT : 1;
2541 unsigned : 1;
2544 struct
2546 unsigned T0PS : 3;
2547 unsigned : 5;
2549 } __T0CONbits_t;
2551 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2553 #define _T0PS0 0x01
2554 #define _T0PS1 0x02
2555 #define _T0PS2 0x04
2556 #define _PSA 0x08
2557 #define _T0SE 0x10
2558 #define _T0CS 0x20
2559 #define _T08BIT 0x40
2560 #define _T016BIT 0x40
2561 #define _TMR0ON 0x80
2563 //==============================================================================
2565 extern __at(0x0FD6) __sfr TMR0;
2566 extern __at(0x0FD6) __sfr TMR0L;
2567 extern __at(0x0FD7) __sfr TMR0H;
2569 //==============================================================================
2570 // STATUS Bits
2572 extern __at(0x0FD8) __sfr STATUS;
2574 typedef struct
2576 unsigned C : 1;
2577 unsigned DC : 1;
2578 unsigned Z : 1;
2579 unsigned OV : 1;
2580 unsigned N : 1;
2581 unsigned : 1;
2582 unsigned : 1;
2583 unsigned : 1;
2584 } __STATUSbits_t;
2586 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2588 #define _C 0x01
2589 #define _DC 0x02
2590 #define _Z 0x04
2591 #define _OV 0x08
2592 #define _N 0x10
2594 //==============================================================================
2596 extern __at(0x0FD9) __sfr FSR2L;
2597 extern __at(0x0FDA) __sfr FSR2H;
2598 extern __at(0x0FDB) __sfr PLUSW2;
2599 extern __at(0x0FDC) __sfr PREINC2;
2600 extern __at(0x0FDD) __sfr POSTDEC2;
2601 extern __at(0x0FDE) __sfr POSTINC2;
2602 extern __at(0x0FDF) __sfr INDF2;
2603 extern __at(0x0FE0) __sfr BSR;
2604 extern __at(0x0FE1) __sfr FSR1L;
2605 extern __at(0x0FE2) __sfr FSR1H;
2606 extern __at(0x0FE3) __sfr PLUSW1;
2607 extern __at(0x0FE4) __sfr PREINC1;
2608 extern __at(0x0FE5) __sfr POSTDEC1;
2609 extern __at(0x0FE6) __sfr POSTINC1;
2610 extern __at(0x0FE7) __sfr INDF1;
2611 extern __at(0x0FE8) __sfr WREG;
2612 extern __at(0x0FE9) __sfr FSR0L;
2613 extern __at(0x0FEA) __sfr FSR0H;
2614 extern __at(0x0FEB) __sfr PLUSW0;
2615 extern __at(0x0FEC) __sfr PREINC0;
2616 extern __at(0x0FED) __sfr POSTDEC0;
2617 extern __at(0x0FEE) __sfr POSTINC0;
2618 extern __at(0x0FEF) __sfr INDF0;
2620 //==============================================================================
2621 // INTCON3 Bits
2623 extern __at(0x0FF0) __sfr INTCON3;
2625 typedef union
2627 struct
2629 unsigned INT1IF : 1;
2630 unsigned INT2IF : 1;
2631 unsigned : 1;
2632 unsigned INT1IE : 1;
2633 unsigned INT2IE : 1;
2634 unsigned : 1;
2635 unsigned INT1IP : 1;
2636 unsigned INT2IP : 1;
2639 struct
2641 unsigned INT1F : 1;
2642 unsigned INT2F : 1;
2643 unsigned : 1;
2644 unsigned INT1E : 1;
2645 unsigned INT2E : 1;
2646 unsigned : 1;
2647 unsigned INT1P : 1;
2648 unsigned INT2P : 1;
2650 } __INTCON3bits_t;
2652 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2654 #define _INT1IF 0x01
2655 #define _INT1F 0x01
2656 #define _INT2IF 0x02
2657 #define _INT2F 0x02
2658 #define _INT1IE 0x08
2659 #define _INT1E 0x08
2660 #define _INT2IE 0x10
2661 #define _INT2E 0x10
2662 #define _INT1IP 0x40
2663 #define _INT1P 0x40
2664 #define _INT2IP 0x80
2665 #define _INT2P 0x80
2667 //==============================================================================
2670 //==============================================================================
2671 // INTCON2 Bits
2673 extern __at(0x0FF1) __sfr INTCON2;
2675 typedef union
2677 struct
2679 unsigned RBIP : 1;
2680 unsigned : 1;
2681 unsigned TMR0IP : 1;
2682 unsigned : 1;
2683 unsigned INTEDG2 : 1;
2684 unsigned INTEDG1 : 1;
2685 unsigned INTEDG0 : 1;
2686 unsigned NOT_RBPU : 1;
2689 struct
2691 unsigned : 1;
2692 unsigned : 1;
2693 unsigned : 1;
2694 unsigned : 1;
2695 unsigned : 1;
2696 unsigned : 1;
2697 unsigned : 1;
2698 unsigned RBPU : 1;
2700 } __INTCON2bits_t;
2702 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2704 #define _RBIP 0x01
2705 #define _TMR0IP 0x04
2706 #define _INTEDG2 0x10
2707 #define _INTEDG1 0x20
2708 #define _INTEDG0 0x40
2709 #define _NOT_RBPU 0x80
2710 #define _RBPU 0x80
2712 //==============================================================================
2715 //==============================================================================
2716 // INTCON Bits
2718 extern __at(0x0FF2) __sfr INTCON;
2720 typedef union
2722 struct
2724 unsigned RBIF : 1;
2725 unsigned INT0IF : 1;
2726 unsigned TMR0IF : 1;
2727 unsigned RBIE : 1;
2728 unsigned INT0IE : 1;
2729 unsigned TMR0IE : 1;
2730 unsigned PEIE_GIEL : 1;
2731 unsigned GIE_GIEH : 1;
2734 struct
2736 unsigned : 1;
2737 unsigned INT0F : 1;
2738 unsigned T0IF : 1;
2739 unsigned : 1;
2740 unsigned INT0E : 1;
2741 unsigned T0IE : 1;
2742 unsigned PEIE : 1;
2743 unsigned GIE : 1;
2746 struct
2748 unsigned : 1;
2749 unsigned : 1;
2750 unsigned : 1;
2751 unsigned : 1;
2752 unsigned : 1;
2753 unsigned : 1;
2754 unsigned GIEL : 1;
2755 unsigned GIEH : 1;
2757 } __INTCONbits_t;
2759 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2761 #define _RBIF 0x01
2762 #define _INT0IF 0x02
2763 #define _INT0F 0x02
2764 #define _TMR0IF 0x04
2765 #define _T0IF 0x04
2766 #define _RBIE 0x08
2767 #define _INT0IE 0x10
2768 #define _INT0E 0x10
2769 #define _TMR0IE 0x20
2770 #define _T0IE 0x20
2771 #define _PEIE_GIEL 0x40
2772 #define _PEIE 0x40
2773 #define _GIEL 0x40
2774 #define _GIE_GIEH 0x80
2775 #define _GIE 0x80
2776 #define _GIEH 0x80
2778 //==============================================================================
2780 extern __at(0x0FF3) __sfr PROD;
2781 extern __at(0x0FF3) __sfr PRODL;
2782 extern __at(0x0FF4) __sfr PRODH;
2783 extern __at(0x0FF5) __sfr TABLAT;
2784 extern __at(0x0FF6) __sfr TBLPTR;
2785 extern __at(0x0FF6) __sfr TBLPTRL;
2786 extern __at(0x0FF7) __sfr TBLPTRH;
2787 extern __at(0x0FF8) __sfr TBLPTRU;
2788 extern __at(0x0FF9) __sfr PC;
2789 extern __at(0x0FF9) __sfr PCL;
2790 extern __at(0x0FFA) __sfr PCLATH;
2791 extern __at(0x0FFB) __sfr PCLATU;
2793 //==============================================================================
2794 // STKPTR Bits
2796 extern __at(0x0FFC) __sfr STKPTR;
2798 typedef union
2800 struct
2802 unsigned SP0 : 1;
2803 unsigned SP1 : 1;
2804 unsigned SP2 : 1;
2805 unsigned SP3 : 1;
2806 unsigned SP4 : 1;
2807 unsigned : 1;
2808 unsigned STKUNF : 1;
2809 unsigned STKFUL : 1;
2812 struct
2814 unsigned : 1;
2815 unsigned : 1;
2816 unsigned : 1;
2817 unsigned : 1;
2818 unsigned : 1;
2819 unsigned : 1;
2820 unsigned : 1;
2821 unsigned STKOVF : 1;
2824 struct
2826 unsigned SP : 5;
2827 unsigned : 3;
2829 } __STKPTRbits_t;
2831 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2833 #define _SP0 0x01
2834 #define _SP1 0x02
2835 #define _SP2 0x04
2836 #define _SP3 0x08
2837 #define _SP4 0x10
2838 #define _STKUNF 0x40
2839 #define _STKFUL 0x80
2840 #define _STKOVF 0x80
2842 //==============================================================================
2844 extern __at(0x0FFD) __sfr TOS;
2845 extern __at(0x0FFD) __sfr TOSL;
2846 extern __at(0x0FFE) __sfr TOSH;
2847 extern __at(0x0FFF) __sfr TOSU;
2849 //==============================================================================
2851 // Configuration Bits
2853 //==============================================================================
2855 #define __CONFIG1H 0x300001
2856 #define __CONFIG2L 0x300002
2857 #define __CONFIG2H 0x300003
2858 #define __CONFIG3H 0x300005
2859 #define __CONFIG4L 0x300006
2860 #define __CONFIG5L 0x300008
2861 #define __CONFIG5H 0x300009
2862 #define __CONFIG6L 0x30000A
2863 #define __CONFIG6H 0x30000B
2864 #define __CONFIG7L 0x30000C
2865 #define __CONFIG7H 0x30000D
2867 //----------------------------- CONFIG1H Options -------------------------------
2869 #define _OSC_LP_1H 0xF0 // LP Oscillator.
2870 #define _OSC_XT_1H 0xF1 // XT Oscillator.
2871 #define _OSC_HS_1H 0xF2 // HS Oscillator.
2872 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
2873 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2874 #define _OSC_ECIO_1H 0xF5 // EC oscillator, port function on RA6.
2875 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
2876 #define _OSC_RCIO_1H 0xF7 // External RC oscillator, port function on RA6.
2877 #define _OSC_INTIO2_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
2878 #define _OSC_INTIO1_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7.
2879 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2880 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2881 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2882 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2884 //----------------------------- CONFIG2L Options -------------------------------
2886 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2887 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2888 #define _BOR_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2889 #define _BOR_SOFT_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2890 #define _BOR_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2891 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2892 #define _BORV_0_2L 0xE7 // Maximum Setting.
2893 #define _BORV_1_2L 0xEF
2894 #define _BORV_2_2L 0xF7
2895 #define _BORV_3_2L 0xFF // Minimum Setting.
2897 //----------------------------- CONFIG2H Options -------------------------------
2899 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2900 #define _WDT_ON_2H 0xFF // WDT enabled.
2901 #define _WDTPS_1_2H 0xE1 // 1:1.
2902 #define _WDTPS_2_2H 0xE3 // 1:2.
2903 #define _WDTPS_4_2H 0xE5 // 1:4.
2904 #define _WDTPS_8_2H 0xE7 // 1:8.
2905 #define _WDTPS_16_2H 0xE9 // 1:16.
2906 #define _WDTPS_32_2H 0xEB // 1:32.
2907 #define _WDTPS_64_2H 0xED // 1:64.
2908 #define _WDTPS_128_2H 0xEF // 1:128.
2909 #define _WDTPS_256_2H 0xF1 // 1:256.
2910 #define _WDTPS_512_2H 0xF3 // 1:512.
2911 #define _WDTPS_1024_2H 0xF5 // 1:1024.
2912 #define _WDTPS_2048_2H 0xF7 // 1:2048.
2913 #define _WDTPS_4096_2H 0xF9 // 1:4096.
2914 #define _WDTPS_8192_2H 0xFB // 1:8192.
2915 #define _WDTPS_16384_2H 0xFD // 1:16384.
2916 #define _WDTPS_32768_2H 0xFF // 1:32768.
2918 //----------------------------- CONFIG3H Options -------------------------------
2920 #define _CCP2MX_RB3_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2921 #define _CCP2MX_RC1_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2922 #define _PBADEN_DIG_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
2923 #define _PBADEN_ANA_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
2924 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
2925 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
2926 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
2927 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
2929 //----------------------------- CONFIG4L Options -------------------------------
2931 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
2932 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
2933 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
2934 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
2935 #define _BBSIZ_BB256_4L 0xCF // 256 Word.
2936 #define _BBSIZ_BB512_4L 0xFF // 512 Word.
2937 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
2938 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
2939 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2940 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2942 //----------------------------- CONFIG5L Options -------------------------------
2944 #define _CP0_ON_5L 0xFE // Block 0 code-protected.
2945 #define _CP0_OFF_5L 0xFF // Block 0 not code-protected.
2946 #define _CP1_ON_5L 0xFD // Block 1 code-protected.
2947 #define _CP1_OFF_5L 0xFF // Block 1 not code-protected.
2949 //----------------------------- CONFIG5H Options -------------------------------
2951 #define _CPB_ON_5H 0xBF // Boot block code-protected.
2952 #define _CPB_OFF_5H 0xFF // Boot block not code-protected.
2953 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
2954 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
2956 //----------------------------- CONFIG6L Options -------------------------------
2958 #define _WRT0_ON_6L 0xFE // Block 0 write-protected.
2959 #define _WRT0_OFF_6L 0xFF // Block 0 not write-protected.
2960 #define _WRT1_ON_6L 0xFD // Block 1 write-protected.
2961 #define _WRT1_OFF_6L 0xFF // Block 1 not write-protected.
2963 //----------------------------- CONFIG6H Options -------------------------------
2965 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
2966 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
2967 #define _WRTB_ON_6H 0xBF // Boot block write-protected.
2968 #define _WRTB_OFF_6H 0xFF // Boot block not write-protected.
2969 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
2970 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
2972 //----------------------------- CONFIG7L Options -------------------------------
2974 #define _EBTR0_ON_7L 0xFE // Block 0 protected from table reads executed in other blocks.
2975 #define _EBTR0_OFF_7L 0xFF // Block 0 not protected from table reads executed in other blocks.
2976 #define _EBTR1_ON_7L 0xFD // Block 1 protected from table reads executed in other blocks.
2977 #define _EBTR1_OFF_7L 0xFF // Block 1 not protected from table reads executed in other blocks.
2979 //----------------------------- CONFIG7H Options -------------------------------
2981 #define _EBTRB_ON_7H 0xBF // Boot block protected from table reads executed in other blocks.
2982 #define _EBTRB_OFF_7H 0xFF // Boot block not protected from table reads executed in other blocks.
2984 //==============================================================================
2986 #define __DEVID1 0x3FFFFE
2987 #define __DEVID2 0x3FFFFF
2989 #define __IDLOC0 0x200000
2990 #define __IDLOC1 0x200001
2991 #define __IDLOC2 0x200002
2992 #define __IDLOC3 0x200003
2993 #define __IDLOC4 0x200004
2994 #define __IDLOC5 0x200005
2995 #define __IDLOC6 0x200006
2996 #define __IDLOC7 0x200007
2998 #endif // #ifndef __PIC18F2221_H__