Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f2520.h
blob3cb573fef33ce463d54756642fa9f29b9fd9f74f
1 /*
2 * This declarations of the PIC18F2520 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:43 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 __PIC18F2520_H__
26 #define __PIC18F2520_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 T0CKI : 1;
63 unsigned AN4 : 1;
64 unsigned OSC2 : 1;
65 unsigned OSC1 : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned VREFN : 1;
73 unsigned VREFP : 1;
74 unsigned C1OUT : 1;
75 unsigned SS : 1;
76 unsigned CLKO : 1;
77 unsigned CLKI : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned CVREF : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned NOT_SS : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned : 1;
95 unsigned : 1;
96 unsigned : 1;
97 unsigned : 1;
98 unsigned : 1;
99 unsigned LVDIN : 1;
100 unsigned : 1;
101 unsigned : 1;
104 struct
106 unsigned : 1;
107 unsigned : 1;
108 unsigned : 1;
109 unsigned : 1;
110 unsigned : 1;
111 unsigned HLVDIN : 1;
112 unsigned : 1;
113 unsigned : 1;
116 struct
118 unsigned : 1;
119 unsigned : 1;
120 unsigned : 1;
121 unsigned : 1;
122 unsigned : 1;
123 unsigned C2OUT : 1;
124 unsigned : 1;
125 unsigned : 1;
127 } __PORTAbits_t;
129 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
131 #define _PORTA_RA0 0x01
132 #define _PORTA_AN0 0x01
133 #define _PORTA_RA1 0x02
134 #define _PORTA_AN1 0x02
135 #define _PORTA_RA2 0x04
136 #define _PORTA_AN2 0x04
137 #define _PORTA_VREFN 0x04
138 #define _PORTA_CVREF 0x04
139 #define _PORTA_RA3 0x08
140 #define _PORTA_AN3 0x08
141 #define _PORTA_VREFP 0x08
142 #define _PORTA_RA4 0x10
143 #define _PORTA_T0CKI 0x10
144 #define _PORTA_C1OUT 0x10
145 #define _PORTA_RA5 0x20
146 #define _PORTA_AN4 0x20
147 #define _PORTA_SS 0x20
148 #define _PORTA_NOT_SS 0x20
149 #define _PORTA_LVDIN 0x20
150 #define _PORTA_HLVDIN 0x20
151 #define _PORTA_C2OUT 0x20
152 #define _PORTA_RA6 0x40
153 #define _PORTA_OSC2 0x40
154 #define _PORTA_CLKO 0x40
155 #define _PORTA_RA7 0x80
156 #define _PORTA_OSC1 0x80
157 #define _PORTA_CLKI 0x80
159 //==============================================================================
162 //==============================================================================
163 // PORTB Bits
165 extern __at(0x0F81) __sfr PORTB;
167 typedef union
169 struct
171 unsigned RB0 : 1;
172 unsigned RB1 : 1;
173 unsigned RB2 : 1;
174 unsigned RB3 : 1;
175 unsigned RB4 : 1;
176 unsigned RB5 : 1;
177 unsigned RB6 : 1;
178 unsigned RB7 : 1;
181 struct
183 unsigned INT0 : 1;
184 unsigned INT1 : 1;
185 unsigned INT2 : 1;
186 unsigned CCP2 : 1;
187 unsigned KBI0 : 1;
188 unsigned KBI1 : 1;
189 unsigned KBI2 : 1;
190 unsigned KBI3 : 1;
193 struct
195 unsigned AN12 : 1;
196 unsigned AN10 : 1;
197 unsigned AN8 : 1;
198 unsigned AN9 : 1;
199 unsigned AN11 : 1;
200 unsigned PGM : 1;
201 unsigned PGC : 1;
202 unsigned PGD : 1;
205 struct
207 unsigned FLT0 : 1;
208 unsigned : 1;
209 unsigned : 1;
210 unsigned : 1;
211 unsigned : 1;
212 unsigned : 1;
213 unsigned : 1;
214 unsigned : 1;
217 struct
219 unsigned INT : 3;
220 unsigned : 5;
223 struct
225 unsigned : 4;
226 unsigned KBI : 4;
228 } __PORTBbits_t;
230 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
232 #define _PORTB_RB0 0x01
233 #define _PORTB_INT0 0x01
234 #define _PORTB_AN12 0x01
235 #define _PORTB_FLT0 0x01
236 #define _PORTB_RB1 0x02
237 #define _PORTB_INT1 0x02
238 #define _PORTB_AN10 0x02
239 #define _PORTB_RB2 0x04
240 #define _PORTB_INT2 0x04
241 #define _PORTB_AN8 0x04
242 #define _PORTB_RB3 0x08
243 #define _PORTB_CCP2 0x08
244 #define _PORTB_AN9 0x08
245 #define _PORTB_RB4 0x10
246 #define _PORTB_KBI0 0x10
247 #define _PORTB_AN11 0x10
248 #define _PORTB_RB5 0x20
249 #define _PORTB_KBI1 0x20
250 #define _PORTB_PGM 0x20
251 #define _PORTB_RB6 0x40
252 #define _PORTB_KBI2 0x40
253 #define _PORTB_PGC 0x40
254 #define _PORTB_RB7 0x80
255 #define _PORTB_KBI3 0x80
256 #define _PORTB_PGD 0x80
258 //==============================================================================
261 //==============================================================================
262 // PORTC Bits
264 extern __at(0x0F82) __sfr PORTC;
266 typedef union
268 struct
270 unsigned RC0 : 1;
271 unsigned RC1 : 1;
272 unsigned RC2 : 1;
273 unsigned RC3 : 1;
274 unsigned RC4 : 1;
275 unsigned RC5 : 1;
276 unsigned RC6 : 1;
277 unsigned RC7 : 1;
280 struct
282 unsigned T1OSO : 1;
283 unsigned T1OSI : 1;
284 unsigned CCP1 : 1;
285 unsigned SCK : 1;
286 unsigned SDI : 1;
287 unsigned SDO : 1;
288 unsigned TX : 1;
289 unsigned RX : 1;
292 struct
294 unsigned T13CKI : 1;
295 unsigned CCP2 : 1;
296 unsigned : 1;
297 unsigned SCL : 1;
298 unsigned SDA : 1;
299 unsigned : 1;
300 unsigned CK : 1;
301 unsigned : 1;
304 struct
306 unsigned T1CKI : 1;
307 unsigned : 1;
308 unsigned : 1;
309 unsigned : 1;
310 unsigned : 1;
311 unsigned : 1;
312 unsigned : 1;
313 unsigned : 1;
315 } __PORTCbits_t;
317 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
319 #define _PORTC_RC0 0x01
320 #define _PORTC_T1OSO 0x01
321 #define _PORTC_T13CKI 0x01
322 #define _PORTC_T1CKI 0x01
323 #define _PORTC_RC1 0x02
324 #define _PORTC_T1OSI 0x02
325 #define _PORTC_CCP2 0x02
326 #define _PORTC_RC2 0x04
327 #define _PORTC_CCP1 0x04
328 #define _PORTC_RC3 0x08
329 #define _PORTC_SCK 0x08
330 #define _PORTC_SCL 0x08
331 #define _PORTC_RC4 0x10
332 #define _PORTC_SDI 0x10
333 #define _PORTC_SDA 0x10
334 #define _PORTC_RC5 0x20
335 #define _PORTC_SDO 0x20
336 #define _PORTC_RC6 0x40
337 #define _PORTC_TX 0x40
338 #define _PORTC_CK 0x40
339 #define _PORTC_RC7 0x80
340 #define _PORTC_RX 0x80
342 //==============================================================================
345 //==============================================================================
346 // PORTE Bits
348 extern __at(0x0F84) __sfr PORTE;
350 typedef union
352 struct
354 unsigned : 1;
355 unsigned : 1;
356 unsigned : 1;
357 unsigned RE3 : 1;
358 unsigned : 1;
359 unsigned : 1;
360 unsigned : 1;
361 unsigned : 1;
364 struct
366 unsigned : 1;
367 unsigned : 1;
368 unsigned : 1;
369 unsigned MCLR : 1;
370 unsigned : 1;
371 unsigned : 1;
372 unsigned : 1;
373 unsigned : 1;
376 struct
378 unsigned : 1;
379 unsigned : 1;
380 unsigned : 1;
381 unsigned NOT_MCLR : 1;
382 unsigned : 1;
383 unsigned : 1;
384 unsigned : 1;
385 unsigned : 1;
388 struct
390 unsigned : 1;
391 unsigned : 1;
392 unsigned : 1;
393 unsigned VPP : 1;
394 unsigned : 1;
395 unsigned : 1;
396 unsigned : 1;
397 unsigned : 1;
399 } __PORTEbits_t;
401 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
403 #define _RE3 0x08
404 #define _MCLR 0x08
405 #define _NOT_MCLR 0x08
406 #define _VPP 0x08
408 //==============================================================================
411 //==============================================================================
412 // LATA Bits
414 extern __at(0x0F89) __sfr LATA;
416 typedef struct
418 unsigned LATA0 : 1;
419 unsigned LATA1 : 1;
420 unsigned LATA2 : 1;
421 unsigned LATA3 : 1;
422 unsigned LATA4 : 1;
423 unsigned LATA5 : 1;
424 unsigned LATA6 : 1;
425 unsigned LATA7 : 1;
426 } __LATAbits_t;
428 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
430 #define _LATA0 0x01
431 #define _LATA1 0x02
432 #define _LATA2 0x04
433 #define _LATA3 0x08
434 #define _LATA4 0x10
435 #define _LATA5 0x20
436 #define _LATA6 0x40
437 #define _LATA7 0x80
439 //==============================================================================
442 //==============================================================================
443 // LATB Bits
445 extern __at(0x0F8A) __sfr LATB;
447 typedef struct
449 unsigned LATB0 : 1;
450 unsigned LATB1 : 1;
451 unsigned LATB2 : 1;
452 unsigned LATB3 : 1;
453 unsigned LATB4 : 1;
454 unsigned LATB5 : 1;
455 unsigned LATB6 : 1;
456 unsigned LATB7 : 1;
457 } __LATBbits_t;
459 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
461 #define _LATB0 0x01
462 #define _LATB1 0x02
463 #define _LATB2 0x04
464 #define _LATB3 0x08
465 #define _LATB4 0x10
466 #define _LATB5 0x20
467 #define _LATB6 0x40
468 #define _LATB7 0x80
470 //==============================================================================
473 //==============================================================================
474 // LATC Bits
476 extern __at(0x0F8B) __sfr LATC;
478 typedef struct
480 unsigned LATC0 : 1;
481 unsigned LATC1 : 1;
482 unsigned LATC2 : 1;
483 unsigned LATC3 : 1;
484 unsigned LATC4 : 1;
485 unsigned LATC5 : 1;
486 unsigned LATC6 : 1;
487 unsigned LATC7 : 1;
488 } __LATCbits_t;
490 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
492 #define _LATC0 0x01
493 #define _LATC1 0x02
494 #define _LATC2 0x04
495 #define _LATC3 0x08
496 #define _LATC4 0x10
497 #define _LATC5 0x20
498 #define _LATC6 0x40
499 #define _LATC7 0x80
501 //==============================================================================
504 //==============================================================================
505 // DDRA Bits
507 extern __at(0x0F92) __sfr DDRA;
509 typedef union
511 struct
513 unsigned TRISA0 : 1;
514 unsigned TRISA1 : 1;
515 unsigned TRISA2 : 1;
516 unsigned TRISA3 : 1;
517 unsigned TRISA4 : 1;
518 unsigned TRISA5 : 1;
519 unsigned TRISA6 : 1;
520 unsigned TRISA7 : 1;
523 struct
525 unsigned RA0 : 1;
526 unsigned RA1 : 1;
527 unsigned RA2 : 1;
528 unsigned RA3 : 1;
529 unsigned RA4 : 1;
530 unsigned RA5 : 1;
531 unsigned RA6 : 1;
532 unsigned RA7 : 1;
534 } __DDRAbits_t;
536 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
538 #define _TRISA0 0x01
539 #define _RA0 0x01
540 #define _TRISA1 0x02
541 #define _RA1 0x02
542 #define _TRISA2 0x04
543 #define _RA2 0x04
544 #define _TRISA3 0x08
545 #define _RA3 0x08
546 #define _TRISA4 0x10
547 #define _RA4 0x10
548 #define _TRISA5 0x20
549 #define _RA5 0x20
550 #define _TRISA6 0x40
551 #define _RA6 0x40
552 #define _TRISA7 0x80
553 #define _RA7 0x80
555 //==============================================================================
558 //==============================================================================
559 // TRISA Bits
561 extern __at(0x0F92) __sfr TRISA;
563 typedef union
565 struct
567 unsigned TRISA0 : 1;
568 unsigned TRISA1 : 1;
569 unsigned TRISA2 : 1;
570 unsigned TRISA3 : 1;
571 unsigned TRISA4 : 1;
572 unsigned TRISA5 : 1;
573 unsigned TRISA6 : 1;
574 unsigned TRISA7 : 1;
577 struct
579 unsigned RA0 : 1;
580 unsigned RA1 : 1;
581 unsigned RA2 : 1;
582 unsigned RA3 : 1;
583 unsigned RA4 : 1;
584 unsigned RA5 : 1;
585 unsigned RA6 : 1;
586 unsigned RA7 : 1;
588 } __TRISAbits_t;
590 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
592 #define _TRISA_TRISA0 0x01
593 #define _TRISA_RA0 0x01
594 #define _TRISA_TRISA1 0x02
595 #define _TRISA_RA1 0x02
596 #define _TRISA_TRISA2 0x04
597 #define _TRISA_RA2 0x04
598 #define _TRISA_TRISA3 0x08
599 #define _TRISA_RA3 0x08
600 #define _TRISA_TRISA4 0x10
601 #define _TRISA_RA4 0x10
602 #define _TRISA_TRISA5 0x20
603 #define _TRISA_RA5 0x20
604 #define _TRISA_TRISA6 0x40
605 #define _TRISA_RA6 0x40
606 #define _TRISA_TRISA7 0x80
607 #define _TRISA_RA7 0x80
609 //==============================================================================
612 //==============================================================================
613 // DDRB Bits
615 extern __at(0x0F93) __sfr DDRB;
617 typedef union
619 struct
621 unsigned TRISB0 : 1;
622 unsigned TRISB1 : 1;
623 unsigned TRISB2 : 1;
624 unsigned TRISB3 : 1;
625 unsigned TRISB4 : 1;
626 unsigned TRISB5 : 1;
627 unsigned TRISB6 : 1;
628 unsigned TRISB7 : 1;
631 struct
633 unsigned RB0 : 1;
634 unsigned RB1 : 1;
635 unsigned RB2 : 1;
636 unsigned RB3 : 1;
637 unsigned RB4 : 1;
638 unsigned RB5 : 1;
639 unsigned RB6 : 1;
640 unsigned RB7 : 1;
642 } __DDRBbits_t;
644 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
646 #define _TRISB0 0x01
647 #define _RB0 0x01
648 #define _TRISB1 0x02
649 #define _RB1 0x02
650 #define _TRISB2 0x04
651 #define _RB2 0x04
652 #define _TRISB3 0x08
653 #define _RB3 0x08
654 #define _TRISB4 0x10
655 #define _RB4 0x10
656 #define _TRISB5 0x20
657 #define _RB5 0x20
658 #define _TRISB6 0x40
659 #define _RB6 0x40
660 #define _TRISB7 0x80
661 #define _RB7 0x80
663 //==============================================================================
666 //==============================================================================
667 // TRISB Bits
669 extern __at(0x0F93) __sfr TRISB;
671 typedef union
673 struct
675 unsigned TRISB0 : 1;
676 unsigned TRISB1 : 1;
677 unsigned TRISB2 : 1;
678 unsigned TRISB3 : 1;
679 unsigned TRISB4 : 1;
680 unsigned TRISB5 : 1;
681 unsigned TRISB6 : 1;
682 unsigned TRISB7 : 1;
685 struct
687 unsigned RB0 : 1;
688 unsigned RB1 : 1;
689 unsigned RB2 : 1;
690 unsigned RB3 : 1;
691 unsigned RB4 : 1;
692 unsigned RB5 : 1;
693 unsigned RB6 : 1;
694 unsigned RB7 : 1;
696 } __TRISBbits_t;
698 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
700 #define _TRISB_TRISB0 0x01
701 #define _TRISB_RB0 0x01
702 #define _TRISB_TRISB1 0x02
703 #define _TRISB_RB1 0x02
704 #define _TRISB_TRISB2 0x04
705 #define _TRISB_RB2 0x04
706 #define _TRISB_TRISB3 0x08
707 #define _TRISB_RB3 0x08
708 #define _TRISB_TRISB4 0x10
709 #define _TRISB_RB4 0x10
710 #define _TRISB_TRISB5 0x20
711 #define _TRISB_RB5 0x20
712 #define _TRISB_TRISB6 0x40
713 #define _TRISB_RB6 0x40
714 #define _TRISB_TRISB7 0x80
715 #define _TRISB_RB7 0x80
717 //==============================================================================
720 //==============================================================================
721 // DDRC Bits
723 extern __at(0x0F94) __sfr DDRC;
725 typedef union
727 struct
729 unsigned TRISC0 : 1;
730 unsigned TRISC1 : 1;
731 unsigned TRISC2 : 1;
732 unsigned TRISC3 : 1;
733 unsigned TRISC4 : 1;
734 unsigned TRISC5 : 1;
735 unsigned TRISC6 : 1;
736 unsigned TRISC7 : 1;
739 struct
741 unsigned RC0 : 1;
742 unsigned RC1 : 1;
743 unsigned RC2 : 1;
744 unsigned RC3 : 1;
745 unsigned RC4 : 1;
746 unsigned RC5 : 1;
747 unsigned RC6 : 1;
748 unsigned RC7 : 1;
750 } __DDRCbits_t;
752 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
754 #define _TRISC0 0x01
755 #define _RC0 0x01
756 #define _TRISC1 0x02
757 #define _RC1 0x02
758 #define _TRISC2 0x04
759 #define _RC2 0x04
760 #define _TRISC3 0x08
761 #define _RC3 0x08
762 #define _TRISC4 0x10
763 #define _RC4 0x10
764 #define _TRISC5 0x20
765 #define _RC5 0x20
766 #define _TRISC6 0x40
767 #define _RC6 0x40
768 #define _TRISC7 0x80
769 #define _RC7 0x80
771 //==============================================================================
774 //==============================================================================
775 // TRISC Bits
777 extern __at(0x0F94) __sfr TRISC;
779 typedef union
781 struct
783 unsigned TRISC0 : 1;
784 unsigned TRISC1 : 1;
785 unsigned TRISC2 : 1;
786 unsigned TRISC3 : 1;
787 unsigned TRISC4 : 1;
788 unsigned TRISC5 : 1;
789 unsigned TRISC6 : 1;
790 unsigned TRISC7 : 1;
793 struct
795 unsigned RC0 : 1;
796 unsigned RC1 : 1;
797 unsigned RC2 : 1;
798 unsigned RC3 : 1;
799 unsigned RC4 : 1;
800 unsigned RC5 : 1;
801 unsigned RC6 : 1;
802 unsigned RC7 : 1;
804 } __TRISCbits_t;
806 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
808 #define _TRISC_TRISC0 0x01
809 #define _TRISC_RC0 0x01
810 #define _TRISC_TRISC1 0x02
811 #define _TRISC_RC1 0x02
812 #define _TRISC_TRISC2 0x04
813 #define _TRISC_RC2 0x04
814 #define _TRISC_TRISC3 0x08
815 #define _TRISC_RC3 0x08
816 #define _TRISC_TRISC4 0x10
817 #define _TRISC_RC4 0x10
818 #define _TRISC_TRISC5 0x20
819 #define _TRISC_RC5 0x20
820 #define _TRISC_TRISC6 0x40
821 #define _TRISC_RC6 0x40
822 #define _TRISC_TRISC7 0x80
823 #define _TRISC_RC7 0x80
825 //==============================================================================
828 //==============================================================================
829 // OSCTUNE Bits
831 extern __at(0x0F9B) __sfr OSCTUNE;
833 typedef union
835 struct
837 unsigned TUN0 : 1;
838 unsigned TUN1 : 1;
839 unsigned TUN2 : 1;
840 unsigned TUN3 : 1;
841 unsigned TUN4 : 1;
842 unsigned : 1;
843 unsigned PLLEN : 1;
844 unsigned INTSRC : 1;
847 struct
849 unsigned TUN : 5;
850 unsigned : 3;
852 } __OSCTUNEbits_t;
854 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
856 #define _TUN0 0x01
857 #define _TUN1 0x02
858 #define _TUN2 0x04
859 #define _TUN3 0x08
860 #define _TUN4 0x10
861 #define _PLLEN 0x40
862 #define _INTSRC 0x80
864 //==============================================================================
867 //==============================================================================
868 // PIE1 Bits
870 extern __at(0x0F9D) __sfr PIE1;
872 typedef struct
874 unsigned TMR1IE : 1;
875 unsigned TMR2IE : 1;
876 unsigned CCP1IE : 1;
877 unsigned SSPIE : 1;
878 unsigned TXIE : 1;
879 unsigned RCIE : 1;
880 unsigned ADIE : 1;
881 unsigned : 1;
882 } __PIE1bits_t;
884 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
886 #define _TMR1IE 0x01
887 #define _TMR2IE 0x02
888 #define _CCP1IE 0x04
889 #define _SSPIE 0x08
890 #define _TXIE 0x10
891 #define _RCIE 0x20
892 #define _ADIE 0x40
894 //==============================================================================
897 //==============================================================================
898 // PIR1 Bits
900 extern __at(0x0F9E) __sfr PIR1;
902 typedef struct
904 unsigned TMR1IF : 1;
905 unsigned TMR2IF : 1;
906 unsigned CCP1IF : 1;
907 unsigned SSPIF : 1;
908 unsigned TXIF : 1;
909 unsigned RCIF : 1;
910 unsigned ADIF : 1;
911 unsigned : 1;
912 } __PIR1bits_t;
914 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
916 #define _TMR1IF 0x01
917 #define _TMR2IF 0x02
918 #define _CCP1IF 0x04
919 #define _SSPIF 0x08
920 #define _TXIF 0x10
921 #define _RCIF 0x20
922 #define _ADIF 0x40
924 //==============================================================================
927 //==============================================================================
928 // IPR1 Bits
930 extern __at(0x0F9F) __sfr IPR1;
932 typedef struct
934 unsigned TMR1IP : 1;
935 unsigned TMR2IP : 1;
936 unsigned CCP1IP : 1;
937 unsigned SSPIP : 1;
938 unsigned TXIP : 1;
939 unsigned RCIP : 1;
940 unsigned ADIP : 1;
941 unsigned : 1;
942 } __IPR1bits_t;
944 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
946 #define _TMR1IP 0x01
947 #define _TMR2IP 0x02
948 #define _CCP1IP 0x04
949 #define _SSPIP 0x08
950 #define _TXIP 0x10
951 #define _RCIP 0x20
952 #define _ADIP 0x40
954 //==============================================================================
957 //==============================================================================
958 // PIE2 Bits
960 extern __at(0x0FA0) __sfr PIE2;
962 typedef union
964 struct
966 unsigned CCP2IE : 1;
967 unsigned TMR3IE : 1;
968 unsigned HLVDIE : 1;
969 unsigned BCLIE : 1;
970 unsigned EEIE : 1;
971 unsigned : 1;
972 unsigned CMIE : 1;
973 unsigned OSCFIE : 1;
976 struct
978 unsigned : 1;
979 unsigned : 1;
980 unsigned LVDIE : 1;
981 unsigned : 1;
982 unsigned : 1;
983 unsigned : 1;
984 unsigned : 1;
985 unsigned : 1;
987 } __PIE2bits_t;
989 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
991 #define _CCP2IE 0x01
992 #define _TMR3IE 0x02
993 #define _HLVDIE 0x04
994 #define _LVDIE 0x04
995 #define _BCLIE 0x08
996 #define _EEIE 0x10
997 #define _CMIE 0x40
998 #define _OSCFIE 0x80
1000 //==============================================================================
1003 //==============================================================================
1004 // PIR2 Bits
1006 extern __at(0x0FA1) __sfr PIR2;
1008 typedef union
1010 struct
1012 unsigned CCP2IF : 1;
1013 unsigned TMR3IF : 1;
1014 unsigned HLVDIF : 1;
1015 unsigned BCLIF : 1;
1016 unsigned EEIF : 1;
1017 unsigned : 1;
1018 unsigned CMIF : 1;
1019 unsigned OSCFIF : 1;
1022 struct
1024 unsigned : 1;
1025 unsigned : 1;
1026 unsigned LVDIF : 1;
1027 unsigned : 1;
1028 unsigned : 1;
1029 unsigned : 1;
1030 unsigned : 1;
1031 unsigned : 1;
1033 } __PIR2bits_t;
1035 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1037 #define _CCP2IF 0x01
1038 #define _TMR3IF 0x02
1039 #define _HLVDIF 0x04
1040 #define _LVDIF 0x04
1041 #define _BCLIF 0x08
1042 #define _EEIF 0x10
1043 #define _CMIF 0x40
1044 #define _OSCFIF 0x80
1046 //==============================================================================
1049 //==============================================================================
1050 // IPR2 Bits
1052 extern __at(0x0FA2) __sfr IPR2;
1054 typedef union
1056 struct
1058 unsigned CCP2IP : 1;
1059 unsigned TMR3IP : 1;
1060 unsigned HLVDIP : 1;
1061 unsigned BCLIP : 1;
1062 unsigned EEIP : 1;
1063 unsigned : 1;
1064 unsigned CMIP : 1;
1065 unsigned OSCFIP : 1;
1068 struct
1070 unsigned : 1;
1071 unsigned : 1;
1072 unsigned LVDIP : 1;
1073 unsigned : 1;
1074 unsigned : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned : 1;
1079 } __IPR2bits_t;
1081 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1083 #define _CCP2IP 0x01
1084 #define _TMR3IP 0x02
1085 #define _HLVDIP 0x04
1086 #define _LVDIP 0x04
1087 #define _BCLIP 0x08
1088 #define _EEIP 0x10
1089 #define _CMIP 0x40
1090 #define _OSCFIP 0x80
1092 //==============================================================================
1095 //==============================================================================
1096 // EECON1 Bits
1098 extern __at(0x0FA6) __sfr EECON1;
1100 typedef struct
1102 unsigned RD : 1;
1103 unsigned WR : 1;
1104 unsigned WREN : 1;
1105 unsigned WRERR : 1;
1106 unsigned FREE : 1;
1107 unsigned : 1;
1108 unsigned CFGS : 1;
1109 unsigned EEPGD : 1;
1110 } __EECON1bits_t;
1112 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1114 #define _RD 0x01
1115 #define _WR 0x02
1116 #define _WREN 0x04
1117 #define _WRERR 0x08
1118 #define _FREE 0x10
1119 #define _CFGS 0x40
1120 #define _EEPGD 0x80
1122 //==============================================================================
1124 extern __at(0x0FA7) __sfr EECON2;
1125 extern __at(0x0FA8) __sfr EEDATA;
1126 extern __at(0x0FA9) __sfr EEADR;
1128 //==============================================================================
1129 // RCSTA Bits
1131 extern __at(0x0FAB) __sfr RCSTA;
1133 typedef union
1135 struct
1137 unsigned RX9D : 1;
1138 unsigned OERR : 1;
1139 unsigned FERR : 1;
1140 unsigned ADDEN : 1;
1141 unsigned CREN : 1;
1142 unsigned SREN : 1;
1143 unsigned RX9 : 1;
1144 unsigned SPEN : 1;
1147 struct
1149 unsigned : 1;
1150 unsigned : 1;
1151 unsigned : 1;
1152 unsigned ADEN : 1;
1153 unsigned : 1;
1154 unsigned : 1;
1155 unsigned : 1;
1156 unsigned : 1;
1158 } __RCSTAbits_t;
1160 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1162 #define _RX9D 0x01
1163 #define _OERR 0x02
1164 #define _FERR 0x04
1165 #define _ADDEN 0x08
1166 #define _ADEN 0x08
1167 #define _CREN 0x10
1168 #define _SREN 0x20
1169 #define _RX9 0x40
1170 #define _SPEN 0x80
1172 //==============================================================================
1175 //==============================================================================
1176 // TXSTA Bits
1178 extern __at(0x0FAC) __sfr TXSTA;
1180 typedef struct
1182 unsigned TX9D : 1;
1183 unsigned TRMT : 1;
1184 unsigned BRGH : 1;
1185 unsigned SENDB : 1;
1186 unsigned SYNC : 1;
1187 unsigned TXEN : 1;
1188 unsigned TX9 : 1;
1189 unsigned CSRC : 1;
1190 } __TXSTAbits_t;
1192 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1194 #define _TX9D 0x01
1195 #define _TRMT 0x02
1196 #define _BRGH 0x04
1197 #define _SENDB 0x08
1198 #define _SYNC 0x10
1199 #define _TXEN 0x20
1200 #define _TX9 0x40
1201 #define _CSRC 0x80
1203 //==============================================================================
1205 extern __at(0x0FAD) __sfr TXREG;
1206 extern __at(0x0FAE) __sfr RCREG;
1207 extern __at(0x0FAF) __sfr SPBRG;
1208 extern __at(0x0FB0) __sfr SPBRGH;
1210 //==============================================================================
1211 // T3CON Bits
1213 extern __at(0x0FB1) __sfr T3CON;
1215 typedef union
1217 struct
1219 unsigned TMR3ON : 1;
1220 unsigned TMR3CS : 1;
1221 unsigned NOT_T3SYNC : 1;
1222 unsigned T3CCP1 : 1;
1223 unsigned T3CKPS0 : 1;
1224 unsigned T3CKPS1 : 1;
1225 unsigned T3CCP2 : 1;
1226 unsigned RD16 : 1;
1229 struct
1231 unsigned : 1;
1232 unsigned : 1;
1233 unsigned T3SYNC : 1;
1234 unsigned : 1;
1235 unsigned : 1;
1236 unsigned : 1;
1237 unsigned : 1;
1238 unsigned : 1;
1241 struct
1243 unsigned : 4;
1244 unsigned T3CKPS : 2;
1245 unsigned : 2;
1247 } __T3CONbits_t;
1249 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1251 #define _T3CON_TMR3ON 0x01
1252 #define _T3CON_TMR3CS 0x02
1253 #define _T3CON_NOT_T3SYNC 0x04
1254 #define _T3CON_T3SYNC 0x04
1255 #define _T3CON_T3CCP1 0x08
1256 #define _T3CON_T3CKPS0 0x10
1257 #define _T3CON_T3CKPS1 0x20
1258 #define _T3CON_T3CCP2 0x40
1259 #define _T3CON_RD16 0x80
1261 //==============================================================================
1263 extern __at(0x0FB2) __sfr TMR3;
1264 extern __at(0x0FB2) __sfr TMR3L;
1265 extern __at(0x0FB3) __sfr TMR3H;
1267 //==============================================================================
1268 // CMCON Bits
1270 extern __at(0x0FB4) __sfr CMCON;
1272 typedef union
1274 struct
1276 unsigned CM0 : 1;
1277 unsigned CM1 : 1;
1278 unsigned CM2 : 1;
1279 unsigned CIS : 1;
1280 unsigned C1INV : 1;
1281 unsigned C2INV : 1;
1282 unsigned C1OUT : 1;
1283 unsigned C2OUT : 1;
1286 struct
1288 unsigned CM : 3;
1289 unsigned : 5;
1291 } __CMCONbits_t;
1293 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1295 #define _CM0 0x01
1296 #define _CM1 0x02
1297 #define _CM2 0x04
1298 #define _CIS 0x08
1299 #define _C1INV 0x10
1300 #define _C2INV 0x20
1301 #define _C1OUT 0x40
1302 #define _C2OUT 0x80
1304 //==============================================================================
1307 //==============================================================================
1308 // CVRCON Bits
1310 extern __at(0x0FB5) __sfr CVRCON;
1312 typedef union
1314 struct
1316 unsigned CVR0 : 1;
1317 unsigned CVR1 : 1;
1318 unsigned CVR2 : 1;
1319 unsigned CVR3 : 1;
1320 unsigned CVRSS : 1;
1321 unsigned CVRR : 1;
1322 unsigned CVROE : 1;
1323 unsigned CVREN : 1;
1326 struct
1328 unsigned CVR : 4;
1329 unsigned : 4;
1331 } __CVRCONbits_t;
1333 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1335 #define _CVR0 0x01
1336 #define _CVR1 0x02
1337 #define _CVR2 0x04
1338 #define _CVR3 0x08
1339 #define _CVRSS 0x10
1340 #define _CVRR 0x20
1341 #define _CVROE 0x40
1342 #define _CVREN 0x80
1344 //==============================================================================
1347 //==============================================================================
1348 // ECCP1AS Bits
1350 extern __at(0x0FB6) __sfr ECCP1AS;
1352 typedef union
1354 struct
1356 unsigned : 1;
1357 unsigned : 1;
1358 unsigned PSSAC0 : 1;
1359 unsigned PSSAC1 : 1;
1360 unsigned ECCPAS0 : 1;
1361 unsigned ECCPAS1 : 1;
1362 unsigned ECCPAS2 : 1;
1363 unsigned ECCPASE : 1;
1366 struct
1368 unsigned : 2;
1369 unsigned PSSAC : 2;
1370 unsigned : 4;
1373 struct
1375 unsigned : 4;
1376 unsigned ECCPAS : 3;
1377 unsigned : 1;
1379 } __ECCP1ASbits_t;
1381 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1383 #define _PSSAC0 0x04
1384 #define _PSSAC1 0x08
1385 #define _ECCPAS0 0x10
1386 #define _ECCPAS1 0x20
1387 #define _ECCPAS2 0x40
1388 #define _ECCPASE 0x80
1390 //==============================================================================
1393 //==============================================================================
1394 // ECCPAS Bits
1396 extern __at(0x0FB6) __sfr ECCPAS;
1398 typedef union
1400 struct
1402 unsigned : 1;
1403 unsigned : 1;
1404 unsigned PSSAC0 : 1;
1405 unsigned PSSAC1 : 1;
1406 unsigned ECCPAS0 : 1;
1407 unsigned ECCPAS1 : 1;
1408 unsigned ECCPAS2 : 1;
1409 unsigned ECCPASE : 1;
1412 struct
1414 unsigned : 2;
1415 unsigned PSSAC : 2;
1416 unsigned : 4;
1419 struct
1421 unsigned : 4;
1422 unsigned ECCPAS : 3;
1423 unsigned : 1;
1425 } __ECCPASbits_t;
1427 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1429 #define _ECCPAS_PSSAC0 0x04
1430 #define _ECCPAS_PSSAC1 0x08
1431 #define _ECCPAS_ECCPAS0 0x10
1432 #define _ECCPAS_ECCPAS1 0x20
1433 #define _ECCPAS_ECCPAS2 0x40
1434 #define _ECCPAS_ECCPASE 0x80
1436 //==============================================================================
1439 //==============================================================================
1440 // ECCP1DEL Bits
1442 extern __at(0x0FB7) __sfr ECCP1DEL;
1444 typedef struct
1446 unsigned : 1;
1447 unsigned : 1;
1448 unsigned : 1;
1449 unsigned : 1;
1450 unsigned : 1;
1451 unsigned : 1;
1452 unsigned : 1;
1453 unsigned PRSEN : 1;
1454 } __ECCP1DELbits_t;
1456 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1458 #define _PRSEN 0x80
1460 //==============================================================================
1463 //==============================================================================
1464 // PWM1CON Bits
1466 extern __at(0x0FB7) __sfr PWM1CON;
1468 typedef struct
1470 unsigned : 1;
1471 unsigned : 1;
1472 unsigned : 1;
1473 unsigned : 1;
1474 unsigned : 1;
1475 unsigned : 1;
1476 unsigned : 1;
1477 unsigned PRSEN : 1;
1478 } __PWM1CONbits_t;
1480 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1482 #define _PWM1CON_PRSEN 0x80
1484 //==============================================================================
1487 //==============================================================================
1488 // BAUDCON Bits
1490 extern __at(0x0FB8) __sfr BAUDCON;
1492 typedef union
1494 struct
1496 unsigned ABDEN : 1;
1497 unsigned WUE : 1;
1498 unsigned : 1;
1499 unsigned BRG16 : 1;
1500 unsigned TXCKP : 1;
1501 unsigned RXDTP : 1;
1502 unsigned RCIDL : 1;
1503 unsigned ABDOVF : 1;
1506 struct
1508 unsigned : 1;
1509 unsigned : 1;
1510 unsigned : 1;
1511 unsigned : 1;
1512 unsigned SCKP : 1;
1513 unsigned : 1;
1514 unsigned RCMT : 1;
1515 unsigned : 1;
1517 } __BAUDCONbits_t;
1519 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1521 #define _ABDEN 0x01
1522 #define _WUE 0x02
1523 #define _BRG16 0x08
1524 #define _TXCKP 0x10
1525 #define _SCKP 0x10
1526 #define _RXDTP 0x20
1527 #define _RCIDL 0x40
1528 #define _RCMT 0x40
1529 #define _ABDOVF 0x80
1531 //==============================================================================
1534 //==============================================================================
1535 // BAUDCTL Bits
1537 extern __at(0x0FB8) __sfr BAUDCTL;
1539 typedef union
1541 struct
1543 unsigned ABDEN : 1;
1544 unsigned WUE : 1;
1545 unsigned : 1;
1546 unsigned BRG16 : 1;
1547 unsigned TXCKP : 1;
1548 unsigned RXDTP : 1;
1549 unsigned RCIDL : 1;
1550 unsigned ABDOVF : 1;
1553 struct
1555 unsigned : 1;
1556 unsigned : 1;
1557 unsigned : 1;
1558 unsigned : 1;
1559 unsigned SCKP : 1;
1560 unsigned : 1;
1561 unsigned RCMT : 1;
1562 unsigned : 1;
1564 } __BAUDCTLbits_t;
1566 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1568 #define _BAUDCTL_ABDEN 0x01
1569 #define _BAUDCTL_WUE 0x02
1570 #define _BAUDCTL_BRG16 0x08
1571 #define _BAUDCTL_TXCKP 0x10
1572 #define _BAUDCTL_SCKP 0x10
1573 #define _BAUDCTL_RXDTP 0x20
1574 #define _BAUDCTL_RCIDL 0x40
1575 #define _BAUDCTL_RCMT 0x40
1576 #define _BAUDCTL_ABDOVF 0x80
1578 //==============================================================================
1581 //==============================================================================
1582 // CCP2CON Bits
1584 extern __at(0x0FBA) __sfr CCP2CON;
1586 typedef union
1588 struct
1590 unsigned CCP2M0 : 1;
1591 unsigned CCP2M1 : 1;
1592 unsigned CCP2M2 : 1;
1593 unsigned CCP2M3 : 1;
1594 unsigned CCP2Y : 1;
1595 unsigned CCP2X : 1;
1596 unsigned : 1;
1597 unsigned : 1;
1600 struct
1602 unsigned : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1605 unsigned : 1;
1606 unsigned DC2B0 : 1;
1607 unsigned DC2B1 : 1;
1608 unsigned : 1;
1609 unsigned : 1;
1612 struct
1614 unsigned CCP2M : 4;
1615 unsigned : 4;
1618 struct
1620 unsigned : 4;
1621 unsigned DC2B : 2;
1622 unsigned : 2;
1624 } __CCP2CONbits_t;
1626 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1628 #define _CCP2M0 0x01
1629 #define _CCP2M1 0x02
1630 #define _CCP2M2 0x04
1631 #define _CCP2M3 0x08
1632 #define _CCP2Y 0x10
1633 #define _DC2B0 0x10
1634 #define _CCP2X 0x20
1635 #define _DC2B1 0x20
1637 //==============================================================================
1639 extern __at(0x0FBB) __sfr CCPR2;
1640 extern __at(0x0FBB) __sfr CCPR2L;
1641 extern __at(0x0FBC) __sfr CCPR2H;
1643 //==============================================================================
1644 // CCP1CON Bits
1646 extern __at(0x0FBD) __sfr CCP1CON;
1648 typedef union
1650 struct
1652 unsigned CCP1M0 : 1;
1653 unsigned CCP1M1 : 1;
1654 unsigned CCP1M2 : 1;
1655 unsigned CCP1M3 : 1;
1656 unsigned CCP1Y : 1;
1657 unsigned CCP1X : 1;
1658 unsigned : 1;
1659 unsigned : 1;
1662 struct
1664 unsigned : 1;
1665 unsigned : 1;
1666 unsigned : 1;
1667 unsigned : 1;
1668 unsigned DC1B0 : 1;
1669 unsigned DC1B1 : 1;
1670 unsigned : 1;
1671 unsigned : 1;
1674 struct
1676 unsigned CCP1M : 4;
1677 unsigned : 4;
1680 struct
1682 unsigned : 4;
1683 unsigned DC1B : 2;
1684 unsigned : 2;
1686 } __CCP1CONbits_t;
1688 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1690 #define _CCP1M0 0x01
1691 #define _CCP1M1 0x02
1692 #define _CCP1M2 0x04
1693 #define _CCP1M3 0x08
1694 #define _CCP1Y 0x10
1695 #define _DC1B0 0x10
1696 #define _CCP1X 0x20
1697 #define _DC1B1 0x20
1699 //==============================================================================
1701 extern __at(0x0FBE) __sfr CCPR1;
1702 extern __at(0x0FBE) __sfr CCPR1L;
1703 extern __at(0x0FBF) __sfr CCPR1H;
1705 //==============================================================================
1706 // ADCON2 Bits
1708 extern __at(0x0FC0) __sfr ADCON2;
1710 typedef union
1712 struct
1714 unsigned ADCS0 : 1;
1715 unsigned ADCS1 : 1;
1716 unsigned ADCS2 : 1;
1717 unsigned ACQT0 : 1;
1718 unsigned ACQT1 : 1;
1719 unsigned ACQT2 : 1;
1720 unsigned : 1;
1721 unsigned ADFM : 1;
1724 struct
1726 unsigned ADCS : 3;
1727 unsigned : 5;
1730 struct
1732 unsigned : 3;
1733 unsigned ACQT : 3;
1734 unsigned : 2;
1736 } __ADCON2bits_t;
1738 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1740 #define _ADCS0 0x01
1741 #define _ADCS1 0x02
1742 #define _ADCS2 0x04
1743 #define _ACQT0 0x08
1744 #define _ACQT1 0x10
1745 #define _ACQT2 0x20
1746 #define _ADFM 0x80
1748 //==============================================================================
1751 //==============================================================================
1752 // ADCON1 Bits
1754 extern __at(0x0FC1) __sfr ADCON1;
1756 typedef union
1758 struct
1760 unsigned PCFG0 : 1;
1761 unsigned PCFG1 : 1;
1762 unsigned PCFG2 : 1;
1763 unsigned PCFG3 : 1;
1764 unsigned VCFG0 : 1;
1765 unsigned VCFG1 : 1;
1766 unsigned : 1;
1767 unsigned : 1;
1770 struct
1772 unsigned PCFG : 4;
1773 unsigned : 4;
1776 struct
1778 unsigned : 4;
1779 unsigned VCFG : 2;
1780 unsigned : 2;
1782 } __ADCON1bits_t;
1784 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1786 #define _PCFG0 0x01
1787 #define _PCFG1 0x02
1788 #define _PCFG2 0x04
1789 #define _PCFG3 0x08
1790 #define _VCFG0 0x10
1791 #define _VCFG1 0x20
1793 //==============================================================================
1796 //==============================================================================
1797 // ADCON0 Bits
1799 extern __at(0x0FC2) __sfr ADCON0;
1801 typedef union
1803 struct
1805 unsigned ADON : 1;
1806 unsigned GO_NOT_DONE : 1;
1807 unsigned CHS0 : 1;
1808 unsigned CHS1 : 1;
1809 unsigned CHS2 : 1;
1810 unsigned CHS3 : 1;
1811 unsigned : 1;
1812 unsigned : 1;
1815 struct
1817 unsigned : 1;
1818 unsigned GO : 1;
1819 unsigned : 1;
1820 unsigned : 1;
1821 unsigned : 1;
1822 unsigned : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1827 struct
1829 unsigned : 1;
1830 unsigned DONE : 1;
1831 unsigned : 1;
1832 unsigned : 1;
1833 unsigned : 1;
1834 unsigned : 1;
1835 unsigned : 1;
1836 unsigned : 1;
1839 struct
1841 unsigned : 1;
1842 unsigned NOT_DONE : 1;
1843 unsigned : 1;
1844 unsigned : 1;
1845 unsigned : 1;
1846 unsigned : 1;
1847 unsigned : 1;
1848 unsigned : 1;
1851 struct
1853 unsigned : 1;
1854 unsigned GO_DONE : 1;
1855 unsigned : 1;
1856 unsigned : 1;
1857 unsigned : 1;
1858 unsigned : 1;
1859 unsigned : 1;
1860 unsigned : 1;
1863 struct
1865 unsigned : 2;
1866 unsigned CHS : 4;
1867 unsigned : 2;
1869 } __ADCON0bits_t;
1871 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1873 #define _ADON 0x01
1874 #define _GO_NOT_DONE 0x02
1875 #define _GO 0x02
1876 #define _DONE 0x02
1877 #define _NOT_DONE 0x02
1878 #define _GO_DONE 0x02
1879 #define _CHS0 0x04
1880 #define _CHS1 0x08
1881 #define _CHS2 0x10
1882 #define _CHS3 0x20
1884 //==============================================================================
1886 extern __at(0x0FC3) __sfr ADRES;
1887 extern __at(0x0FC3) __sfr ADRESL;
1888 extern __at(0x0FC4) __sfr ADRESH;
1890 //==============================================================================
1891 // SSPCON2 Bits
1893 extern __at(0x0FC5) __sfr SSPCON2;
1895 typedef union
1897 struct
1899 unsigned SEN : 1;
1900 unsigned RSEN : 1;
1901 unsigned PEN : 1;
1902 unsigned RCEN : 1;
1903 unsigned ACKEN : 1;
1904 unsigned ACKDT : 1;
1905 unsigned ACKSTAT : 1;
1906 unsigned GCEN : 1;
1909 struct
1911 unsigned : 1;
1912 unsigned ADMSK1 : 1;
1913 unsigned ADMSK2 : 1;
1914 unsigned ADMSK3 : 1;
1915 unsigned ADMSK4 : 1;
1916 unsigned ADMSK5 : 1;
1917 unsigned : 1;
1918 unsigned : 1;
1920 } __SSPCON2bits_t;
1922 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1924 #define _SEN 0x01
1925 #define _RSEN 0x02
1926 #define _ADMSK1 0x02
1927 #define _PEN 0x04
1928 #define _ADMSK2 0x04
1929 #define _RCEN 0x08
1930 #define _ADMSK3 0x08
1931 #define _ACKEN 0x10
1932 #define _ADMSK4 0x10
1933 #define _ACKDT 0x20
1934 #define _ADMSK5 0x20
1935 #define _ACKSTAT 0x40
1936 #define _GCEN 0x80
1938 //==============================================================================
1941 //==============================================================================
1942 // SSPCON1 Bits
1944 extern __at(0x0FC6) __sfr SSPCON1;
1946 typedef union
1948 struct
1950 unsigned SSPM0 : 1;
1951 unsigned SSPM1 : 1;
1952 unsigned SSPM2 : 1;
1953 unsigned SSPM3 : 1;
1954 unsigned CKP : 1;
1955 unsigned SSPEN : 1;
1956 unsigned SSPOV : 1;
1957 unsigned WCOL : 1;
1960 struct
1962 unsigned SSPM : 4;
1963 unsigned : 4;
1965 } __SSPCON1bits_t;
1967 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1969 #define _SSPM0 0x01
1970 #define _SSPM1 0x02
1971 #define _SSPM2 0x04
1972 #define _SSPM3 0x08
1973 #define _CKP 0x10
1974 #define _SSPEN 0x20
1975 #define _SSPOV 0x40
1976 #define _WCOL 0x80
1978 //==============================================================================
1981 //==============================================================================
1982 // SSPSTAT Bits
1984 extern __at(0x0FC7) __sfr SSPSTAT;
1986 typedef union
1988 struct
1990 unsigned BF : 1;
1991 unsigned UA : 1;
1992 unsigned R_NOT_W : 1;
1993 unsigned S : 1;
1994 unsigned P : 1;
1995 unsigned D_NOT_A : 1;
1996 unsigned CKE : 1;
1997 unsigned SMP : 1;
2000 struct
2002 unsigned : 1;
2003 unsigned : 1;
2004 unsigned R : 1;
2005 unsigned : 1;
2006 unsigned : 1;
2007 unsigned D : 1;
2008 unsigned : 1;
2009 unsigned : 1;
2012 struct
2014 unsigned : 1;
2015 unsigned : 1;
2016 unsigned NOT_W : 1;
2017 unsigned : 1;
2018 unsigned : 1;
2019 unsigned NOT_A : 1;
2020 unsigned : 1;
2021 unsigned : 1;
2024 struct
2026 unsigned : 1;
2027 unsigned : 1;
2028 unsigned R_W : 1;
2029 unsigned : 1;
2030 unsigned : 1;
2031 unsigned D_A : 1;
2032 unsigned : 1;
2033 unsigned : 1;
2036 struct
2038 unsigned : 1;
2039 unsigned : 1;
2040 unsigned NOT_WRITE : 1;
2041 unsigned : 1;
2042 unsigned : 1;
2043 unsigned NOT_ADDRESS : 1;
2044 unsigned : 1;
2045 unsigned : 1;
2047 } __SSPSTATbits_t;
2049 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2051 #define _BF 0x01
2052 #define _UA 0x02
2053 #define _R_NOT_W 0x04
2054 #define _R 0x04
2055 #define _NOT_W 0x04
2056 #define _R_W 0x04
2057 #define _NOT_WRITE 0x04
2058 #define _S 0x08
2059 #define _P 0x10
2060 #define _D_NOT_A 0x20
2061 #define _D 0x20
2062 #define _NOT_A 0x20
2063 #define _D_A 0x20
2064 #define _NOT_ADDRESS 0x20
2065 #define _CKE 0x40
2066 #define _SMP 0x80
2068 //==============================================================================
2070 extern __at(0x0FC8) __sfr SSPADD;
2071 extern __at(0x0FC9) __sfr SSPBUF;
2073 //==============================================================================
2074 // T2CON Bits
2076 extern __at(0x0FCA) __sfr T2CON;
2078 typedef union
2080 struct
2082 unsigned T2CKPS0 : 1;
2083 unsigned T2CKPS1 : 1;
2084 unsigned TMR2ON : 1;
2085 unsigned T2OUTPS0 : 1;
2086 unsigned T2OUTPS1 : 1;
2087 unsigned T2OUTPS2 : 1;
2088 unsigned T2OUTPS3 : 1;
2089 unsigned : 1;
2092 struct
2094 unsigned : 1;
2095 unsigned : 1;
2096 unsigned : 1;
2097 unsigned TOUTPS0 : 1;
2098 unsigned TOUTPS1 : 1;
2099 unsigned TOUTPS2 : 1;
2100 unsigned TOUTPS3 : 1;
2101 unsigned : 1;
2104 struct
2106 unsigned T2CKPS : 2;
2107 unsigned : 6;
2110 struct
2112 unsigned : 3;
2113 unsigned T2OUTPS : 4;
2114 unsigned : 1;
2117 struct
2119 unsigned : 3;
2120 unsigned TOUTPS : 4;
2121 unsigned : 1;
2123 } __T2CONbits_t;
2125 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2127 #define _T2CKPS0 0x01
2128 #define _T2CKPS1 0x02
2129 #define _TMR2ON 0x04
2130 #define _T2OUTPS0 0x08
2131 #define _TOUTPS0 0x08
2132 #define _T2OUTPS1 0x10
2133 #define _TOUTPS1 0x10
2134 #define _T2OUTPS2 0x20
2135 #define _TOUTPS2 0x20
2136 #define _T2OUTPS3 0x40
2137 #define _TOUTPS3 0x40
2139 //==============================================================================
2141 extern __at(0x0FCB) __sfr PR2;
2142 extern __at(0x0FCC) __sfr TMR2;
2144 //==============================================================================
2145 // T1CON Bits
2147 extern __at(0x0FCD) __sfr T1CON;
2149 typedef union
2151 struct
2153 unsigned TMR1ON : 1;
2154 unsigned TMR1CS : 1;
2155 unsigned NOT_T1SYNC : 1;
2156 unsigned T1OSCEN : 1;
2157 unsigned T1CKPS0 : 1;
2158 unsigned T1CKPS1 : 1;
2159 unsigned T1RUN : 1;
2160 unsigned RD16 : 1;
2163 struct
2165 unsigned : 1;
2166 unsigned : 1;
2167 unsigned T1SYNC : 1;
2168 unsigned : 1;
2169 unsigned : 1;
2170 unsigned : 1;
2171 unsigned : 1;
2172 unsigned : 1;
2175 struct
2177 unsigned : 4;
2178 unsigned T1CKPS : 2;
2179 unsigned : 2;
2181 } __T1CONbits_t;
2183 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2185 #define _TMR1ON 0x01
2186 #define _TMR1CS 0x02
2187 #define _NOT_T1SYNC 0x04
2188 #define _T1SYNC 0x04
2189 #define _T1OSCEN 0x08
2190 #define _T1CKPS0 0x10
2191 #define _T1CKPS1 0x20
2192 #define _T1RUN 0x40
2193 #define _RD16 0x80
2195 //==============================================================================
2197 extern __at(0x0FCE) __sfr TMR1;
2198 extern __at(0x0FCE) __sfr TMR1L;
2199 extern __at(0x0FCF) __sfr TMR1H;
2201 //==============================================================================
2202 // RCON Bits
2204 extern __at(0x0FD0) __sfr RCON;
2206 typedef union
2208 struct
2210 unsigned NOT_BOR : 1;
2211 unsigned NOT_POR : 1;
2212 unsigned NOT_PD : 1;
2213 unsigned NOT_TO : 1;
2214 unsigned NOT_RI : 1;
2215 unsigned : 1;
2216 unsigned SBOREN : 1;
2217 unsigned IPEN : 1;
2220 struct
2222 unsigned BOR : 1;
2223 unsigned POR : 1;
2224 unsigned PD : 1;
2225 unsigned TO : 1;
2226 unsigned RI : 1;
2227 unsigned : 1;
2228 unsigned : 1;
2229 unsigned : 1;
2231 } __RCONbits_t;
2233 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2235 #define _NOT_BOR 0x01
2236 #define _BOR 0x01
2237 #define _NOT_POR 0x02
2238 #define _POR 0x02
2239 #define _NOT_PD 0x04
2240 #define _PD 0x04
2241 #define _NOT_TO 0x08
2242 #define _TO 0x08
2243 #define _NOT_RI 0x10
2244 #define _RI 0x10
2245 #define _SBOREN 0x40
2246 #define _IPEN 0x80
2248 //==============================================================================
2251 //==============================================================================
2252 // WDTCON Bits
2254 extern __at(0x0FD1) __sfr WDTCON;
2256 typedef union
2258 struct
2260 unsigned SWDTEN : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned : 1;
2264 unsigned : 1;
2265 unsigned : 1;
2266 unsigned : 1;
2267 unsigned : 1;
2270 struct
2272 unsigned SWDTE : 1;
2273 unsigned : 1;
2274 unsigned : 1;
2275 unsigned : 1;
2276 unsigned : 1;
2277 unsigned : 1;
2278 unsigned : 1;
2279 unsigned : 1;
2281 } __WDTCONbits_t;
2283 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2285 #define _SWDTEN 0x01
2286 #define _SWDTE 0x01
2288 //==============================================================================
2291 //==============================================================================
2292 // HLVDCON Bits
2294 extern __at(0x0FD2) __sfr HLVDCON;
2296 typedef union
2298 struct
2300 unsigned HLVDL0 : 1;
2301 unsigned HLVDL1 : 1;
2302 unsigned HLVDL2 : 1;
2303 unsigned HLVDL3 : 1;
2304 unsigned HLVDEN : 1;
2305 unsigned IVRST : 1;
2306 unsigned : 1;
2307 unsigned VDIRMAG : 1;
2310 struct
2312 unsigned LVDL0 : 1;
2313 unsigned LVDL1 : 1;
2314 unsigned LVDL2 : 1;
2315 unsigned LVDL3 : 1;
2316 unsigned LVDEN : 1;
2317 unsigned IRVST : 1;
2318 unsigned : 1;
2319 unsigned : 1;
2322 struct
2324 unsigned LVV0 : 1;
2325 unsigned LVV1 : 1;
2326 unsigned LVV2 : 1;
2327 unsigned LVV3 : 1;
2328 unsigned : 1;
2329 unsigned BGST : 1;
2330 unsigned : 1;
2331 unsigned : 1;
2334 struct
2336 unsigned LVDL : 4;
2337 unsigned : 4;
2340 struct
2342 unsigned HLVDL : 4;
2343 unsigned : 4;
2346 struct
2348 unsigned LVV : 4;
2349 unsigned : 4;
2351 } __HLVDCONbits_t;
2353 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2355 #define _HLVDL0 0x01
2356 #define _LVDL0 0x01
2357 #define _LVV0 0x01
2358 #define _HLVDL1 0x02
2359 #define _LVDL1 0x02
2360 #define _LVV1 0x02
2361 #define _HLVDL2 0x04
2362 #define _LVDL2 0x04
2363 #define _LVV2 0x04
2364 #define _HLVDL3 0x08
2365 #define _LVDL3 0x08
2366 #define _LVV3 0x08
2367 #define _HLVDEN 0x10
2368 #define _LVDEN 0x10
2369 #define _IVRST 0x20
2370 #define _IRVST 0x20
2371 #define _BGST 0x20
2372 #define _VDIRMAG 0x80
2374 //==============================================================================
2377 //==============================================================================
2378 // LVDCON Bits
2380 extern __at(0x0FD2) __sfr LVDCON;
2382 typedef union
2384 struct
2386 unsigned HLVDL0 : 1;
2387 unsigned HLVDL1 : 1;
2388 unsigned HLVDL2 : 1;
2389 unsigned HLVDL3 : 1;
2390 unsigned HLVDEN : 1;
2391 unsigned IVRST : 1;
2392 unsigned : 1;
2393 unsigned VDIRMAG : 1;
2396 struct
2398 unsigned LVDL0 : 1;
2399 unsigned LVDL1 : 1;
2400 unsigned LVDL2 : 1;
2401 unsigned LVDL3 : 1;
2402 unsigned LVDEN : 1;
2403 unsigned IRVST : 1;
2404 unsigned : 1;
2405 unsigned : 1;
2408 struct
2410 unsigned LVV0 : 1;
2411 unsigned LVV1 : 1;
2412 unsigned LVV2 : 1;
2413 unsigned LVV3 : 1;
2414 unsigned : 1;
2415 unsigned BGST : 1;
2416 unsigned : 1;
2417 unsigned : 1;
2420 struct
2422 unsigned LVV : 4;
2423 unsigned : 4;
2426 struct
2428 unsigned HLVDL : 4;
2429 unsigned : 4;
2432 struct
2434 unsigned LVDL : 4;
2435 unsigned : 4;
2437 } __LVDCONbits_t;
2439 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2441 #define _LVDCON_HLVDL0 0x01
2442 #define _LVDCON_LVDL0 0x01
2443 #define _LVDCON_LVV0 0x01
2444 #define _LVDCON_HLVDL1 0x02
2445 #define _LVDCON_LVDL1 0x02
2446 #define _LVDCON_LVV1 0x02
2447 #define _LVDCON_HLVDL2 0x04
2448 #define _LVDCON_LVDL2 0x04
2449 #define _LVDCON_LVV2 0x04
2450 #define _LVDCON_HLVDL3 0x08
2451 #define _LVDCON_LVDL3 0x08
2452 #define _LVDCON_LVV3 0x08
2453 #define _LVDCON_HLVDEN 0x10
2454 #define _LVDCON_LVDEN 0x10
2455 #define _LVDCON_IVRST 0x20
2456 #define _LVDCON_IRVST 0x20
2457 #define _LVDCON_BGST 0x20
2458 #define _LVDCON_VDIRMAG 0x80
2460 //==============================================================================
2463 //==============================================================================
2464 // OSCCON Bits
2466 extern __at(0x0FD3) __sfr OSCCON;
2468 typedef union
2470 struct
2472 unsigned SCS0 : 1;
2473 unsigned SCS1 : 1;
2474 unsigned IOFS : 1;
2475 unsigned OSTS : 1;
2476 unsigned IRCF0 : 1;
2477 unsigned IRCF1 : 1;
2478 unsigned IRCF2 : 1;
2479 unsigned IDLEN : 1;
2482 struct
2484 unsigned : 1;
2485 unsigned : 1;
2486 unsigned FLTS : 1;
2487 unsigned : 1;
2488 unsigned : 1;
2489 unsigned : 1;
2490 unsigned : 1;
2491 unsigned : 1;
2494 struct
2496 unsigned SCS : 2;
2497 unsigned : 6;
2500 struct
2502 unsigned : 4;
2503 unsigned IRCF : 3;
2504 unsigned : 1;
2506 } __OSCCONbits_t;
2508 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2510 #define _SCS0 0x01
2511 #define _SCS1 0x02
2512 #define _IOFS 0x04
2513 #define _FLTS 0x04
2514 #define _OSTS 0x08
2515 #define _IRCF0 0x10
2516 #define _IRCF1 0x20
2517 #define _IRCF2 0x40
2518 #define _IDLEN 0x80
2520 //==============================================================================
2523 //==============================================================================
2524 // T0CON Bits
2526 extern __at(0x0FD5) __sfr T0CON;
2528 typedef union
2530 struct
2532 unsigned T0PS0 : 1;
2533 unsigned T0PS1 : 1;
2534 unsigned T0PS2 : 1;
2535 unsigned PSA : 1;
2536 unsigned T0SE : 1;
2537 unsigned T0CS : 1;
2538 unsigned T08BIT : 1;
2539 unsigned TMR0ON : 1;
2542 struct
2544 unsigned : 1;
2545 unsigned : 1;
2546 unsigned : 1;
2547 unsigned T0PS3 : 1;
2548 unsigned : 1;
2549 unsigned : 1;
2550 unsigned T016BIT : 1;
2551 unsigned : 1;
2554 struct
2556 unsigned T0PS : 4;
2557 unsigned : 4;
2559 } __T0CONbits_t;
2561 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2563 #define _T0PS0 0x01
2564 #define _T0PS1 0x02
2565 #define _T0PS2 0x04
2566 #define _PSA 0x08
2567 #define _T0PS3 0x08
2568 #define _T0SE 0x10
2569 #define _T0CS 0x20
2570 #define _T08BIT 0x40
2571 #define _T016BIT 0x40
2572 #define _TMR0ON 0x80
2574 //==============================================================================
2576 extern __at(0x0FD6) __sfr TMR0;
2577 extern __at(0x0FD6) __sfr TMR0L;
2578 extern __at(0x0FD7) __sfr TMR0H;
2580 //==============================================================================
2581 // STATUS Bits
2583 extern __at(0x0FD8) __sfr STATUS;
2585 typedef struct
2587 unsigned C : 1;
2588 unsigned DC : 1;
2589 unsigned Z : 1;
2590 unsigned OV : 1;
2591 unsigned N : 1;
2592 unsigned : 1;
2593 unsigned : 1;
2594 unsigned : 1;
2595 } __STATUSbits_t;
2597 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2599 #define _C 0x01
2600 #define _DC 0x02
2601 #define _Z 0x04
2602 #define _OV 0x08
2603 #define _N 0x10
2605 //==============================================================================
2607 extern __at(0x0FD9) __sfr FSR2L;
2608 extern __at(0x0FDA) __sfr FSR2H;
2609 extern __at(0x0FDB) __sfr PLUSW2;
2610 extern __at(0x0FDC) __sfr PREINC2;
2611 extern __at(0x0FDD) __sfr POSTDEC2;
2612 extern __at(0x0FDE) __sfr POSTINC2;
2613 extern __at(0x0FDF) __sfr INDF2;
2614 extern __at(0x0FE0) __sfr BSR;
2615 extern __at(0x0FE1) __sfr FSR1L;
2616 extern __at(0x0FE2) __sfr FSR1H;
2617 extern __at(0x0FE3) __sfr PLUSW1;
2618 extern __at(0x0FE4) __sfr PREINC1;
2619 extern __at(0x0FE5) __sfr POSTDEC1;
2620 extern __at(0x0FE6) __sfr POSTINC1;
2621 extern __at(0x0FE7) __sfr INDF1;
2622 extern __at(0x0FE8) __sfr WREG;
2623 extern __at(0x0FE9) __sfr FSR0L;
2624 extern __at(0x0FEA) __sfr FSR0H;
2625 extern __at(0x0FEB) __sfr PLUSW0;
2626 extern __at(0x0FEC) __sfr PREINC0;
2627 extern __at(0x0FED) __sfr POSTDEC0;
2628 extern __at(0x0FEE) __sfr POSTINC0;
2629 extern __at(0x0FEF) __sfr INDF0;
2631 //==============================================================================
2632 // INTCON3 Bits
2634 extern __at(0x0FF0) __sfr INTCON3;
2636 typedef union
2638 struct
2640 unsigned INT1IF : 1;
2641 unsigned INT2IF : 1;
2642 unsigned : 1;
2643 unsigned INT1IE : 1;
2644 unsigned INT2IE : 1;
2645 unsigned : 1;
2646 unsigned INT1IP : 1;
2647 unsigned INT2IP : 1;
2650 struct
2652 unsigned INT1F : 1;
2653 unsigned INT2F : 1;
2654 unsigned : 1;
2655 unsigned INT1E : 1;
2656 unsigned INT2E : 1;
2657 unsigned : 1;
2658 unsigned INT1P : 1;
2659 unsigned INT2P : 1;
2661 } __INTCON3bits_t;
2663 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2665 #define _INT1IF 0x01
2666 #define _INT1F 0x01
2667 #define _INT2IF 0x02
2668 #define _INT2F 0x02
2669 #define _INT1IE 0x08
2670 #define _INT1E 0x08
2671 #define _INT2IE 0x10
2672 #define _INT2E 0x10
2673 #define _INT1IP 0x40
2674 #define _INT1P 0x40
2675 #define _INT2IP 0x80
2676 #define _INT2P 0x80
2678 //==============================================================================
2681 //==============================================================================
2682 // INTCON2 Bits
2684 extern __at(0x0FF1) __sfr INTCON2;
2686 typedef union
2688 struct
2690 unsigned RBIP : 1;
2691 unsigned : 1;
2692 unsigned TMR0IP : 1;
2693 unsigned : 1;
2694 unsigned INTEDG2 : 1;
2695 unsigned INTEDG1 : 1;
2696 unsigned INTEDG0 : 1;
2697 unsigned NOT_RBPU : 1;
2700 struct
2702 unsigned : 1;
2703 unsigned : 1;
2704 unsigned : 1;
2705 unsigned : 1;
2706 unsigned : 1;
2707 unsigned : 1;
2708 unsigned : 1;
2709 unsigned RBPU : 1;
2711 } __INTCON2bits_t;
2713 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2715 #define _RBIP 0x01
2716 #define _TMR0IP 0x04
2717 #define _INTEDG2 0x10
2718 #define _INTEDG1 0x20
2719 #define _INTEDG0 0x40
2720 #define _NOT_RBPU 0x80
2721 #define _RBPU 0x80
2723 //==============================================================================
2726 //==============================================================================
2727 // INTCON Bits
2729 extern __at(0x0FF2) __sfr INTCON;
2731 typedef union
2733 struct
2735 unsigned RBIF : 1;
2736 unsigned INT0IF : 1;
2737 unsigned TMR0IF : 1;
2738 unsigned RBIE : 1;
2739 unsigned INT0IE : 1;
2740 unsigned TMR0IE : 1;
2741 unsigned PEIE_GIEL : 1;
2742 unsigned GIE_GIEH : 1;
2745 struct
2747 unsigned : 1;
2748 unsigned INT0F : 1;
2749 unsigned T0IF : 1;
2750 unsigned : 1;
2751 unsigned INT0E : 1;
2752 unsigned T0IE : 1;
2753 unsigned PEIE : 1;
2754 unsigned GIE : 1;
2757 struct
2759 unsigned : 1;
2760 unsigned : 1;
2761 unsigned : 1;
2762 unsigned : 1;
2763 unsigned : 1;
2764 unsigned : 1;
2765 unsigned GIEL : 1;
2766 unsigned GIEH : 1;
2768 } __INTCONbits_t;
2770 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2772 #define _RBIF 0x01
2773 #define _INT0IF 0x02
2774 #define _INT0F 0x02
2775 #define _TMR0IF 0x04
2776 #define _T0IF 0x04
2777 #define _RBIE 0x08
2778 #define _INT0IE 0x10
2779 #define _INT0E 0x10
2780 #define _TMR0IE 0x20
2781 #define _T0IE 0x20
2782 #define _PEIE_GIEL 0x40
2783 #define _PEIE 0x40
2784 #define _GIEL 0x40
2785 #define _GIE_GIEH 0x80
2786 #define _GIE 0x80
2787 #define _GIEH 0x80
2789 //==============================================================================
2791 extern __at(0x0FF3) __sfr PROD;
2792 extern __at(0x0FF3) __sfr PRODL;
2793 extern __at(0x0FF4) __sfr PRODH;
2794 extern __at(0x0FF5) __sfr TABLAT;
2795 extern __at(0x0FF6) __sfr TBLPTR;
2796 extern __at(0x0FF6) __sfr TBLPTRL;
2797 extern __at(0x0FF7) __sfr TBLPTRH;
2798 extern __at(0x0FF8) __sfr TBLPTRU;
2799 extern __at(0x0FF9) __sfr PC;
2800 extern __at(0x0FF9) __sfr PCL;
2801 extern __at(0x0FFA) __sfr PCLATH;
2802 extern __at(0x0FFB) __sfr PCLATU;
2804 //==============================================================================
2805 // STKPTR Bits
2807 extern __at(0x0FFC) __sfr STKPTR;
2809 typedef union
2811 struct
2813 unsigned SP0 : 1;
2814 unsigned SP1 : 1;
2815 unsigned SP2 : 1;
2816 unsigned SP3 : 1;
2817 unsigned SP4 : 1;
2818 unsigned : 1;
2819 unsigned STKUNF : 1;
2820 unsigned STKFUL : 1;
2823 struct
2825 unsigned : 1;
2826 unsigned : 1;
2827 unsigned : 1;
2828 unsigned : 1;
2829 unsigned : 1;
2830 unsigned : 1;
2831 unsigned : 1;
2832 unsigned STKOVF : 1;
2835 struct
2837 unsigned SP : 5;
2838 unsigned : 3;
2840 } __STKPTRbits_t;
2842 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2844 #define _SP0 0x01
2845 #define _SP1 0x02
2846 #define _SP2 0x04
2847 #define _SP3 0x08
2848 #define _SP4 0x10
2849 #define _STKUNF 0x40
2850 #define _STKFUL 0x80
2851 #define _STKOVF 0x80
2853 //==============================================================================
2855 extern __at(0x0FFD) __sfr TOS;
2856 extern __at(0x0FFD) __sfr TOSL;
2857 extern __at(0x0FFE) __sfr TOSH;
2858 extern __at(0x0FFF) __sfr TOSU;
2860 //==============================================================================
2862 // Configuration Bits
2864 //==============================================================================
2866 #define __CONFIG1H 0x300001
2867 #define __CONFIG2L 0x300002
2868 #define __CONFIG2H 0x300003
2869 #define __CONFIG3H 0x300005
2870 #define __CONFIG4L 0x300006
2871 #define __CONFIG5L 0x300008
2872 #define __CONFIG5H 0x300009
2873 #define __CONFIG6L 0x30000A
2874 #define __CONFIG6H 0x30000B
2875 #define __CONFIG7L 0x30000C
2876 #define __CONFIG7H 0x30000D
2878 //----------------------------- CONFIG1H Options -------------------------------
2880 #define _OSC_LP_1H 0xF0 // LP oscillator.
2881 #define _OSC_XT_1H 0xF1 // XT oscillator.
2882 #define _OSC_HS_1H 0xF2 // HS oscillator.
2883 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
2884 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2885 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
2886 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
2887 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
2888 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
2889 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7.
2890 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2891 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2892 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2893 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2895 //----------------------------- CONFIG2L Options -------------------------------
2897 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2898 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2899 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2900 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2901 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2902 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2903 #define _BORV_0_2L 0xE7 // Maximum setting.
2904 #define _BORV_1_2L 0xEF
2905 #define _BORV_2_2L 0xF7
2906 #define _BORV_3_2L 0xFF // Minimum setting.
2908 //----------------------------- CONFIG2H Options -------------------------------
2910 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2911 #define _WDT_ON_2H 0xFF // WDT enabled.
2912 #define _WDTPS_1_2H 0xE1 // 1:1.
2913 #define _WDTPS_2_2H 0xE3 // 1:2.
2914 #define _WDTPS_4_2H 0xE5 // 1:4.
2915 #define _WDTPS_8_2H 0xE7 // 1:8.
2916 #define _WDTPS_16_2H 0xE9 // 1:16.
2917 #define _WDTPS_32_2H 0xEB // 1:32.
2918 #define _WDTPS_64_2H 0xED // 1:64.
2919 #define _WDTPS_128_2H 0xEF // 1:128.
2920 #define _WDTPS_256_2H 0xF1 // 1:256.
2921 #define _WDTPS_512_2H 0xF3 // 1:512.
2922 #define _WDTPS_1024_2H 0xF5 // 1:1024.
2923 #define _WDTPS_2048_2H 0xF7 // 1:2048.
2924 #define _WDTPS_4096_2H 0xF9 // 1:4096.
2925 #define _WDTPS_8192_2H 0xFB // 1:8192.
2926 #define _WDTPS_16384_2H 0xFD // 1:16384.
2927 #define _WDTPS_32768_2H 0xFF // 1:32768.
2929 //----------------------------- CONFIG3H Options -------------------------------
2931 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2932 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2933 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
2934 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
2935 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
2936 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
2937 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
2938 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
2940 //----------------------------- CONFIG4L Options -------------------------------
2942 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
2943 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
2944 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
2945 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
2946 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
2947 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
2948 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2949 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2951 //----------------------------- CONFIG5L Options -------------------------------
2953 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected.
2954 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected.
2955 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected.
2956 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected.
2957 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected.
2958 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected.
2959 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected.
2960 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected.
2962 //----------------------------- CONFIG5H Options -------------------------------
2964 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
2965 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
2966 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
2967 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
2969 //----------------------------- CONFIG6L Options -------------------------------
2971 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected.
2972 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected.
2973 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected.
2974 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected.
2975 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected.
2976 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected.
2977 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected.
2978 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected.
2980 //----------------------------- CONFIG6H Options -------------------------------
2982 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
2983 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
2984 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) write-protected.
2985 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) not write-protected.
2986 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
2987 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
2989 //----------------------------- CONFIG7L Options -------------------------------
2991 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
2992 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
2993 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
2994 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
2995 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
2996 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
2997 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
2998 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
3000 //----------------------------- CONFIG7H Options -------------------------------
3002 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) protected from table reads executed in other blocks.
3003 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) not protected from table reads executed in other blocks.
3005 //==============================================================================
3007 #define __DEVID1 0x3FFFFE
3008 #define __DEVID2 0x3FFFFF
3010 #define __IDLOC0 0x200000
3011 #define __IDLOC1 0x200001
3012 #define __IDLOC2 0x200002
3013 #define __IDLOC3 0x200003
3014 #define __IDLOC4 0x200004
3015 #define __IDLOC5 0x200005
3016 #define __IDLOC6 0x200006
3017 #define __IDLOC7 0x200007
3019 #endif // #ifndef __PIC18F2520_H__