Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf2523.h
blobf8785da9a6b8f6a69f9298443c448cef827ac1aa
1 /*
2 * This declarations of the PIC18LF2523 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:24:01 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 __PIC18LF2523_H__
26 #define __PIC18LF2523_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 // RCSTA1 Bits
1178 extern __at(0x0FAB) __sfr RCSTA1;
1180 typedef union
1182 struct
1184 unsigned RX9D : 1;
1185 unsigned OERR : 1;
1186 unsigned FERR : 1;
1187 unsigned ADDEN : 1;
1188 unsigned CREN : 1;
1189 unsigned SREN : 1;
1190 unsigned RX9 : 1;
1191 unsigned SPEN : 1;
1194 struct
1196 unsigned : 1;
1197 unsigned : 1;
1198 unsigned : 1;
1199 unsigned ADEN : 1;
1200 unsigned : 1;
1201 unsigned : 1;
1202 unsigned : 1;
1203 unsigned : 1;
1205 } __RCSTA1bits_t;
1207 extern __at(0x0FAB) volatile __RCSTA1bits_t RCSTA1bits;
1209 #define _RCSTA1_RX9D 0x01
1210 #define _RCSTA1_OERR 0x02
1211 #define _RCSTA1_FERR 0x04
1212 #define _RCSTA1_ADDEN 0x08
1213 #define _RCSTA1_ADEN 0x08
1214 #define _RCSTA1_CREN 0x10
1215 #define _RCSTA1_SREN 0x20
1216 #define _RCSTA1_RX9 0x40
1217 #define _RCSTA1_SPEN 0x80
1219 //==============================================================================
1222 //==============================================================================
1223 // TXSTA Bits
1225 extern __at(0x0FAC) __sfr TXSTA;
1227 typedef struct
1229 unsigned TX9D : 1;
1230 unsigned TRMT : 1;
1231 unsigned BRGH : 1;
1232 unsigned SENDB : 1;
1233 unsigned SYNC : 1;
1234 unsigned TXEN : 1;
1235 unsigned TX9 : 1;
1236 unsigned CSRC : 1;
1237 } __TXSTAbits_t;
1239 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1241 #define _TX9D 0x01
1242 #define _TRMT 0x02
1243 #define _BRGH 0x04
1244 #define _SENDB 0x08
1245 #define _SYNC 0x10
1246 #define _TXEN 0x20
1247 #define _TX9 0x40
1248 #define _CSRC 0x80
1250 //==============================================================================
1253 //==============================================================================
1254 // TXSTA1 Bits
1256 extern __at(0x0FAC) __sfr TXSTA1;
1258 typedef struct
1260 unsigned TX9D : 1;
1261 unsigned TRMT : 1;
1262 unsigned BRGH : 1;
1263 unsigned SENDB : 1;
1264 unsigned SYNC : 1;
1265 unsigned TXEN : 1;
1266 unsigned TX9 : 1;
1267 unsigned CSRC : 1;
1268 } __TXSTA1bits_t;
1270 extern __at(0x0FAC) volatile __TXSTA1bits_t TXSTA1bits;
1272 #define _TXSTA1_TX9D 0x01
1273 #define _TXSTA1_TRMT 0x02
1274 #define _TXSTA1_BRGH 0x04
1275 #define _TXSTA1_SENDB 0x08
1276 #define _TXSTA1_SYNC 0x10
1277 #define _TXSTA1_TXEN 0x20
1278 #define _TXSTA1_TX9 0x40
1279 #define _TXSTA1_CSRC 0x80
1281 //==============================================================================
1283 extern __at(0x0FAD) __sfr TXREG;
1284 extern __at(0x0FAD) __sfr TXREG1;
1285 extern __at(0x0FAE) __sfr RCREG;
1286 extern __at(0x0FAE) __sfr RCREG1;
1287 extern __at(0x0FAF) __sfr SPBRG;
1288 extern __at(0x0FAF) __sfr SPBTG1;
1289 extern __at(0x0FB0) __sfr SPBRGH;
1291 //==============================================================================
1292 // T3CON Bits
1294 extern __at(0x0FB1) __sfr T3CON;
1296 typedef union
1298 struct
1300 unsigned TMR3ON : 1;
1301 unsigned TMR3CS : 1;
1302 unsigned NOT_T3SYNC : 1;
1303 unsigned T3CCP1 : 1;
1304 unsigned T3CKPS0 : 1;
1305 unsigned T3CKPS1 : 1;
1306 unsigned T3CCP2 : 1;
1307 unsigned RD16 : 1;
1310 struct
1312 unsigned : 1;
1313 unsigned : 1;
1314 unsigned T3SYNC : 1;
1315 unsigned : 1;
1316 unsigned : 1;
1317 unsigned : 1;
1318 unsigned : 1;
1319 unsigned : 1;
1322 struct
1324 unsigned : 4;
1325 unsigned T3CKPS : 2;
1326 unsigned : 2;
1328 } __T3CONbits_t;
1330 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1332 #define _T3CON_TMR3ON 0x01
1333 #define _T3CON_TMR3CS 0x02
1334 #define _T3CON_NOT_T3SYNC 0x04
1335 #define _T3CON_T3SYNC 0x04
1336 #define _T3CON_T3CCP1 0x08
1337 #define _T3CON_T3CKPS0 0x10
1338 #define _T3CON_T3CKPS1 0x20
1339 #define _T3CON_T3CCP2 0x40
1340 #define _T3CON_RD16 0x80
1342 //==============================================================================
1344 extern __at(0x0FB2) __sfr TMR3;
1345 extern __at(0x0FB2) __sfr TMR3L;
1346 extern __at(0x0FB3) __sfr TMR3H;
1348 //==============================================================================
1349 // CMCON Bits
1351 extern __at(0x0FB4) __sfr CMCON;
1353 typedef union
1355 struct
1357 unsigned CM0 : 1;
1358 unsigned CM1 : 1;
1359 unsigned CM2 : 1;
1360 unsigned CIS : 1;
1361 unsigned C1INV : 1;
1362 unsigned C2INV : 1;
1363 unsigned C1OUT : 1;
1364 unsigned C2OUT : 1;
1367 struct
1369 unsigned CM : 3;
1370 unsigned : 5;
1372 } __CMCONbits_t;
1374 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1376 #define _CM0 0x01
1377 #define _CM1 0x02
1378 #define _CM2 0x04
1379 #define _CIS 0x08
1380 #define _C1INV 0x10
1381 #define _C2INV 0x20
1382 #define _C1OUT 0x40
1383 #define _C2OUT 0x80
1385 //==============================================================================
1388 //==============================================================================
1389 // CVRCON Bits
1391 extern __at(0x0FB5) __sfr CVRCON;
1393 typedef union
1395 struct
1397 unsigned CVR0 : 1;
1398 unsigned CVR1 : 1;
1399 unsigned CVR2 : 1;
1400 unsigned CVR3 : 1;
1401 unsigned CVRSS : 1;
1402 unsigned CVRR : 1;
1403 unsigned CVROE : 1;
1404 unsigned CVREN : 1;
1407 struct
1409 unsigned CVR : 4;
1410 unsigned : 4;
1412 } __CVRCONbits_t;
1414 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1416 #define _CVR0 0x01
1417 #define _CVR1 0x02
1418 #define _CVR2 0x04
1419 #define _CVR3 0x08
1420 #define _CVRSS 0x10
1421 #define _CVRR 0x20
1422 #define _CVROE 0x40
1423 #define _CVREN 0x80
1425 //==============================================================================
1428 //==============================================================================
1429 // ECCP1AS Bits
1431 extern __at(0x0FB6) __sfr ECCP1AS;
1433 typedef union
1435 struct
1437 unsigned : 1;
1438 unsigned : 1;
1439 unsigned PSSAC0 : 1;
1440 unsigned PSSAC1 : 1;
1441 unsigned ECCPAS0 : 1;
1442 unsigned ECCPAS1 : 1;
1443 unsigned ECCPAS2 : 1;
1444 unsigned ECCPASE : 1;
1447 struct
1449 unsigned : 2;
1450 unsigned PSSAC : 2;
1451 unsigned : 4;
1454 struct
1456 unsigned : 4;
1457 unsigned ECCPAS : 3;
1458 unsigned : 1;
1460 } __ECCP1ASbits_t;
1462 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1464 #define _PSSAC0 0x04
1465 #define _PSSAC1 0x08
1466 #define _ECCPAS0 0x10
1467 #define _ECCPAS1 0x20
1468 #define _ECCPAS2 0x40
1469 #define _ECCPASE 0x80
1471 //==============================================================================
1474 //==============================================================================
1475 // ECCPAS Bits
1477 extern __at(0x0FB6) __sfr ECCPAS;
1479 typedef union
1481 struct
1483 unsigned : 1;
1484 unsigned : 1;
1485 unsigned PSSAC0 : 1;
1486 unsigned PSSAC1 : 1;
1487 unsigned ECCPAS0 : 1;
1488 unsigned ECCPAS1 : 1;
1489 unsigned ECCPAS2 : 1;
1490 unsigned ECCPASE : 1;
1493 struct
1495 unsigned : 2;
1496 unsigned PSSAC : 2;
1497 unsigned : 4;
1500 struct
1502 unsigned : 4;
1503 unsigned ECCPAS : 3;
1504 unsigned : 1;
1506 } __ECCPASbits_t;
1508 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1510 #define _ECCPAS_PSSAC0 0x04
1511 #define _ECCPAS_PSSAC1 0x08
1512 #define _ECCPAS_ECCPAS0 0x10
1513 #define _ECCPAS_ECCPAS1 0x20
1514 #define _ECCPAS_ECCPAS2 0x40
1515 #define _ECCPAS_ECCPASE 0x80
1517 //==============================================================================
1520 //==============================================================================
1521 // ECCP1DEL Bits
1523 extern __at(0x0FB7) __sfr ECCP1DEL;
1525 typedef struct
1527 unsigned : 1;
1528 unsigned : 1;
1529 unsigned : 1;
1530 unsigned : 1;
1531 unsigned : 1;
1532 unsigned : 1;
1533 unsigned : 1;
1534 unsigned PRSEN : 1;
1535 } __ECCP1DELbits_t;
1537 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1539 #define _PRSEN 0x80
1541 //==============================================================================
1544 //==============================================================================
1545 // PWM1CON Bits
1547 extern __at(0x0FB7) __sfr PWM1CON;
1549 typedef struct
1551 unsigned : 1;
1552 unsigned : 1;
1553 unsigned : 1;
1554 unsigned : 1;
1555 unsigned : 1;
1556 unsigned : 1;
1557 unsigned : 1;
1558 unsigned PRSEN : 1;
1559 } __PWM1CONbits_t;
1561 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1563 #define _PWM1CON_PRSEN 0x80
1565 //==============================================================================
1568 //==============================================================================
1569 // BAUDCON Bits
1571 extern __at(0x0FB8) __sfr BAUDCON;
1573 typedef union
1575 struct
1577 unsigned ABDEN : 1;
1578 unsigned WUE : 1;
1579 unsigned : 1;
1580 unsigned BRG16 : 1;
1581 unsigned TXCKP : 1;
1582 unsigned RXDTP : 1;
1583 unsigned RCIDL : 1;
1584 unsigned ABDOVF : 1;
1587 struct
1589 unsigned : 1;
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned : 1;
1593 unsigned SCKP : 1;
1594 unsigned : 1;
1595 unsigned RCMT : 1;
1596 unsigned : 1;
1598 } __BAUDCONbits_t;
1600 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1602 #define _ABDEN 0x01
1603 #define _WUE 0x02
1604 #define _BRG16 0x08
1605 #define _TXCKP 0x10
1606 #define _SCKP 0x10
1607 #define _RXDTP 0x20
1608 #define _RCIDL 0x40
1609 #define _RCMT 0x40
1610 #define _ABDOVF 0x80
1612 //==============================================================================
1615 //==============================================================================
1616 // BAUDCTL Bits
1618 extern __at(0x0FB8) __sfr BAUDCTL;
1620 typedef union
1622 struct
1624 unsigned ABDEN : 1;
1625 unsigned WUE : 1;
1626 unsigned : 1;
1627 unsigned BRG16 : 1;
1628 unsigned TXCKP : 1;
1629 unsigned RXDTP : 1;
1630 unsigned RCIDL : 1;
1631 unsigned ABDOVF : 1;
1634 struct
1636 unsigned : 1;
1637 unsigned : 1;
1638 unsigned : 1;
1639 unsigned : 1;
1640 unsigned SCKP : 1;
1641 unsigned : 1;
1642 unsigned RCMT : 1;
1643 unsigned : 1;
1645 } __BAUDCTLbits_t;
1647 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1649 #define _BAUDCTL_ABDEN 0x01
1650 #define _BAUDCTL_WUE 0x02
1651 #define _BAUDCTL_BRG16 0x08
1652 #define _BAUDCTL_TXCKP 0x10
1653 #define _BAUDCTL_SCKP 0x10
1654 #define _BAUDCTL_RXDTP 0x20
1655 #define _BAUDCTL_RCIDL 0x40
1656 #define _BAUDCTL_RCMT 0x40
1657 #define _BAUDCTL_ABDOVF 0x80
1659 //==============================================================================
1662 //==============================================================================
1663 // CCP2CON Bits
1665 extern __at(0x0FBA) __sfr CCP2CON;
1667 typedef union
1669 struct
1671 unsigned CCP2M0 : 1;
1672 unsigned CCP2M1 : 1;
1673 unsigned CCP2M2 : 1;
1674 unsigned CCP2M3 : 1;
1675 unsigned CCP2Y : 1;
1676 unsigned CCP2X : 1;
1677 unsigned : 1;
1678 unsigned : 1;
1681 struct
1683 unsigned : 1;
1684 unsigned : 1;
1685 unsigned : 1;
1686 unsigned : 1;
1687 unsigned DC2B0 : 1;
1688 unsigned DC2B1 : 1;
1689 unsigned : 1;
1690 unsigned : 1;
1693 struct
1695 unsigned CCP2M : 4;
1696 unsigned : 4;
1699 struct
1701 unsigned : 4;
1702 unsigned DC2B : 2;
1703 unsigned : 2;
1705 } __CCP2CONbits_t;
1707 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1709 #define _CCP2M0 0x01
1710 #define _CCP2M1 0x02
1711 #define _CCP2M2 0x04
1712 #define _CCP2M3 0x08
1713 #define _CCP2Y 0x10
1714 #define _DC2B0 0x10
1715 #define _CCP2X 0x20
1716 #define _DC2B1 0x20
1718 //==============================================================================
1720 extern __at(0x0FBB) __sfr CCPR2;
1721 extern __at(0x0FBB) __sfr CCPR2L;
1722 extern __at(0x0FBC) __sfr CCPR2H;
1724 //==============================================================================
1725 // CCP1CON Bits
1727 extern __at(0x0FBD) __sfr CCP1CON;
1729 typedef union
1731 struct
1733 unsigned CCP1M0 : 1;
1734 unsigned CCP1M1 : 1;
1735 unsigned CCP1M2 : 1;
1736 unsigned CCP1M3 : 1;
1737 unsigned CCP1Y : 1;
1738 unsigned CCP1X : 1;
1739 unsigned : 1;
1740 unsigned : 1;
1743 struct
1745 unsigned : 1;
1746 unsigned : 1;
1747 unsigned : 1;
1748 unsigned : 1;
1749 unsigned DC1B0 : 1;
1750 unsigned DC1B1 : 1;
1751 unsigned : 1;
1752 unsigned : 1;
1755 struct
1757 unsigned CCP1M : 4;
1758 unsigned : 4;
1761 struct
1763 unsigned : 4;
1764 unsigned DC1B : 2;
1765 unsigned : 2;
1767 } __CCP1CONbits_t;
1769 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1771 #define _CCP1M0 0x01
1772 #define _CCP1M1 0x02
1773 #define _CCP1M2 0x04
1774 #define _CCP1M3 0x08
1775 #define _CCP1Y 0x10
1776 #define _DC1B0 0x10
1777 #define _CCP1X 0x20
1778 #define _DC1B1 0x20
1780 //==============================================================================
1782 extern __at(0x0FBE) __sfr CCPR1;
1783 extern __at(0x0FBE) __sfr CCPR1L;
1784 extern __at(0x0FBF) __sfr CCPR1H;
1786 //==============================================================================
1787 // ADCON2 Bits
1789 extern __at(0x0FC0) __sfr ADCON2;
1791 typedef union
1793 struct
1795 unsigned ADCS0 : 1;
1796 unsigned ADCS1 : 1;
1797 unsigned ADCS2 : 1;
1798 unsigned ACQT0 : 1;
1799 unsigned ACQT1 : 1;
1800 unsigned ACQT2 : 1;
1801 unsigned : 1;
1802 unsigned ADFM : 1;
1805 struct
1807 unsigned ADCS : 3;
1808 unsigned : 5;
1811 struct
1813 unsigned : 3;
1814 unsigned ACQT : 3;
1815 unsigned : 2;
1817 } __ADCON2bits_t;
1819 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1821 #define _ADCS0 0x01
1822 #define _ADCS1 0x02
1823 #define _ADCS2 0x04
1824 #define _ACQT0 0x08
1825 #define _ACQT1 0x10
1826 #define _ACQT2 0x20
1827 #define _ADFM 0x80
1829 //==============================================================================
1832 //==============================================================================
1833 // ADCON1 Bits
1835 extern __at(0x0FC1) __sfr ADCON1;
1837 typedef union
1839 struct
1841 unsigned PCFG0 : 1;
1842 unsigned PCFG1 : 1;
1843 unsigned PCFG2 : 1;
1844 unsigned PCFG3 : 1;
1845 unsigned VCFG0 : 1;
1846 unsigned VCFG1 : 1;
1847 unsigned : 1;
1848 unsigned : 1;
1851 struct
1853 unsigned PCFG : 4;
1854 unsigned : 4;
1857 struct
1859 unsigned : 4;
1860 unsigned VCFG : 2;
1861 unsigned : 2;
1863 } __ADCON1bits_t;
1865 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1867 #define _PCFG0 0x01
1868 #define _PCFG1 0x02
1869 #define _PCFG2 0x04
1870 #define _PCFG3 0x08
1871 #define _VCFG0 0x10
1872 #define _VCFG1 0x20
1874 //==============================================================================
1877 //==============================================================================
1878 // ADCON0 Bits
1880 extern __at(0x0FC2) __sfr ADCON0;
1882 typedef union
1884 struct
1886 unsigned ADON : 1;
1887 unsigned GO_NOT_DONE : 1;
1888 unsigned CHS0 : 1;
1889 unsigned CHS1 : 1;
1890 unsigned CHS2 : 1;
1891 unsigned CHS3 : 1;
1892 unsigned : 1;
1893 unsigned : 1;
1896 struct
1898 unsigned : 1;
1899 unsigned GO : 1;
1900 unsigned : 1;
1901 unsigned : 1;
1902 unsigned : 1;
1903 unsigned : 1;
1904 unsigned : 1;
1905 unsigned : 1;
1908 struct
1910 unsigned : 1;
1911 unsigned DONE : 1;
1912 unsigned : 1;
1913 unsigned : 1;
1914 unsigned : 1;
1915 unsigned : 1;
1916 unsigned : 1;
1917 unsigned : 1;
1920 struct
1922 unsigned : 1;
1923 unsigned NOT_DONE : 1;
1924 unsigned : 1;
1925 unsigned : 1;
1926 unsigned : 1;
1927 unsigned : 1;
1928 unsigned : 1;
1929 unsigned : 1;
1932 struct
1934 unsigned : 1;
1935 unsigned GO_DONE : 1;
1936 unsigned : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1941 unsigned : 1;
1944 struct
1946 unsigned : 2;
1947 unsigned CHS : 4;
1948 unsigned : 2;
1950 } __ADCON0bits_t;
1952 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1954 #define _ADON 0x01
1955 #define _GO_NOT_DONE 0x02
1956 #define _GO 0x02
1957 #define _DONE 0x02
1958 #define _NOT_DONE 0x02
1959 #define _GO_DONE 0x02
1960 #define _CHS0 0x04
1961 #define _CHS1 0x08
1962 #define _CHS2 0x10
1963 #define _CHS3 0x20
1965 //==============================================================================
1967 extern __at(0x0FC3) __sfr ADRES;
1968 extern __at(0x0FC3) __sfr ADRESL;
1969 extern __at(0x0FC4) __sfr ADRESH;
1971 //==============================================================================
1972 // SSPCON2 Bits
1974 extern __at(0x0FC5) __sfr SSPCON2;
1976 typedef union
1978 struct
1980 unsigned SEN : 1;
1981 unsigned RSEN : 1;
1982 unsigned PEN : 1;
1983 unsigned RCEN : 1;
1984 unsigned ACKEN : 1;
1985 unsigned ACKDT : 1;
1986 unsigned ACKSTAT : 1;
1987 unsigned GCEN : 1;
1990 struct
1992 unsigned : 1;
1993 unsigned ADMSK1 : 1;
1994 unsigned ADMSK2 : 1;
1995 unsigned ADMSK3 : 1;
1996 unsigned ADMSK4 : 1;
1997 unsigned ADMSK5 : 1;
1998 unsigned : 1;
1999 unsigned : 1;
2001 } __SSPCON2bits_t;
2003 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2005 #define _SEN 0x01
2006 #define _RSEN 0x02
2007 #define _ADMSK1 0x02
2008 #define _PEN 0x04
2009 #define _ADMSK2 0x04
2010 #define _RCEN 0x08
2011 #define _ADMSK3 0x08
2012 #define _ACKEN 0x10
2013 #define _ADMSK4 0x10
2014 #define _ACKDT 0x20
2015 #define _ADMSK5 0x20
2016 #define _ACKSTAT 0x40
2017 #define _GCEN 0x80
2019 //==============================================================================
2022 //==============================================================================
2023 // SSPCON1 Bits
2025 extern __at(0x0FC6) __sfr SSPCON1;
2027 typedef union
2029 struct
2031 unsigned SSPM0 : 1;
2032 unsigned SSPM1 : 1;
2033 unsigned SSPM2 : 1;
2034 unsigned SSPM3 : 1;
2035 unsigned CKP : 1;
2036 unsigned SSPEN : 1;
2037 unsigned SSPOV : 1;
2038 unsigned WCOL : 1;
2041 struct
2043 unsigned SSPM : 4;
2044 unsigned : 4;
2046 } __SSPCON1bits_t;
2048 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2050 #define _SSPM0 0x01
2051 #define _SSPM1 0x02
2052 #define _SSPM2 0x04
2053 #define _SSPM3 0x08
2054 #define _CKP 0x10
2055 #define _SSPEN 0x20
2056 #define _SSPOV 0x40
2057 #define _WCOL 0x80
2059 //==============================================================================
2062 //==============================================================================
2063 // SSPSTAT Bits
2065 extern __at(0x0FC7) __sfr SSPSTAT;
2067 typedef union
2069 struct
2071 unsigned BF : 1;
2072 unsigned UA : 1;
2073 unsigned R_NOT_W : 1;
2074 unsigned S : 1;
2075 unsigned P : 1;
2076 unsigned D_NOT_A : 1;
2077 unsigned CKE : 1;
2078 unsigned SMP : 1;
2081 struct
2083 unsigned : 1;
2084 unsigned : 1;
2085 unsigned R : 1;
2086 unsigned : 1;
2087 unsigned : 1;
2088 unsigned D : 1;
2089 unsigned : 1;
2090 unsigned : 1;
2093 struct
2095 unsigned : 1;
2096 unsigned : 1;
2097 unsigned NOT_W : 1;
2098 unsigned : 1;
2099 unsigned : 1;
2100 unsigned NOT_A : 1;
2101 unsigned : 1;
2102 unsigned : 1;
2105 struct
2107 unsigned : 1;
2108 unsigned : 1;
2109 unsigned R_W : 1;
2110 unsigned : 1;
2111 unsigned : 1;
2112 unsigned D_A : 1;
2113 unsigned : 1;
2114 unsigned : 1;
2117 struct
2119 unsigned : 1;
2120 unsigned : 1;
2121 unsigned NOT_WRITE : 1;
2122 unsigned : 1;
2123 unsigned : 1;
2124 unsigned NOT_ADDRESS : 1;
2125 unsigned : 1;
2126 unsigned : 1;
2128 } __SSPSTATbits_t;
2130 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2132 #define _BF 0x01
2133 #define _UA 0x02
2134 #define _R_NOT_W 0x04
2135 #define _R 0x04
2136 #define _NOT_W 0x04
2137 #define _R_W 0x04
2138 #define _NOT_WRITE 0x04
2139 #define _S 0x08
2140 #define _P 0x10
2141 #define _D_NOT_A 0x20
2142 #define _D 0x20
2143 #define _NOT_A 0x20
2144 #define _D_A 0x20
2145 #define _NOT_ADDRESS 0x20
2146 #define _CKE 0x40
2147 #define _SMP 0x80
2149 //==============================================================================
2151 extern __at(0x0FC8) __sfr SSPADD;
2152 extern __at(0x0FC9) __sfr SSPBUF;
2154 //==============================================================================
2155 // T2CON Bits
2157 extern __at(0x0FCA) __sfr T2CON;
2159 typedef union
2161 struct
2163 unsigned T2CKPS0 : 1;
2164 unsigned T2CKPS1 : 1;
2165 unsigned TMR2ON : 1;
2166 unsigned T2OUTPS0 : 1;
2167 unsigned T2OUTPS1 : 1;
2168 unsigned T2OUTPS2 : 1;
2169 unsigned T2OUTPS3 : 1;
2170 unsigned : 1;
2173 struct
2175 unsigned : 1;
2176 unsigned : 1;
2177 unsigned : 1;
2178 unsigned TOUTPS0 : 1;
2179 unsigned TOUTPS1 : 1;
2180 unsigned TOUTPS2 : 1;
2181 unsigned TOUTPS3 : 1;
2182 unsigned : 1;
2185 struct
2187 unsigned T2CKPS : 2;
2188 unsigned : 6;
2191 struct
2193 unsigned : 3;
2194 unsigned T2OUTPS : 4;
2195 unsigned : 1;
2198 struct
2200 unsigned : 3;
2201 unsigned TOUTPS : 4;
2202 unsigned : 1;
2204 } __T2CONbits_t;
2206 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2208 #define _T2CKPS0 0x01
2209 #define _T2CKPS1 0x02
2210 #define _TMR2ON 0x04
2211 #define _T2OUTPS0 0x08
2212 #define _TOUTPS0 0x08
2213 #define _T2OUTPS1 0x10
2214 #define _TOUTPS1 0x10
2215 #define _T2OUTPS2 0x20
2216 #define _TOUTPS2 0x20
2217 #define _T2OUTPS3 0x40
2218 #define _TOUTPS3 0x40
2220 //==============================================================================
2222 extern __at(0x0FCB) __sfr PR2;
2223 extern __at(0x0FCC) __sfr TMR2;
2225 //==============================================================================
2226 // T1CON Bits
2228 extern __at(0x0FCD) __sfr T1CON;
2230 typedef union
2232 struct
2234 unsigned TMR1ON : 1;
2235 unsigned TMR1CS : 1;
2236 unsigned NOT_T1SYNC : 1;
2237 unsigned T1OSCEN : 1;
2238 unsigned T1CKPS0 : 1;
2239 unsigned T1CKPS1 : 1;
2240 unsigned T1RUN : 1;
2241 unsigned RD16 : 1;
2244 struct
2246 unsigned : 1;
2247 unsigned : 1;
2248 unsigned T1SYNC : 1;
2249 unsigned : 1;
2250 unsigned : 1;
2251 unsigned : 1;
2252 unsigned : 1;
2253 unsigned : 1;
2256 struct
2258 unsigned : 4;
2259 unsigned T1CKPS : 2;
2260 unsigned : 2;
2262 } __T1CONbits_t;
2264 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2266 #define _TMR1ON 0x01
2267 #define _TMR1CS 0x02
2268 #define _NOT_T1SYNC 0x04
2269 #define _T1SYNC 0x04
2270 #define _T1OSCEN 0x08
2271 #define _T1CKPS0 0x10
2272 #define _T1CKPS1 0x20
2273 #define _T1RUN 0x40
2274 #define _RD16 0x80
2276 //==============================================================================
2278 extern __at(0x0FCE) __sfr TMR1;
2279 extern __at(0x0FCE) __sfr TMR1L;
2280 extern __at(0x0FCF) __sfr TMR1H;
2282 //==============================================================================
2283 // RCON Bits
2285 extern __at(0x0FD0) __sfr RCON;
2287 typedef union
2289 struct
2291 unsigned NOT_BOR : 1;
2292 unsigned NOT_POR : 1;
2293 unsigned NOT_PD : 1;
2294 unsigned NOT_TO : 1;
2295 unsigned NOT_RI : 1;
2296 unsigned : 1;
2297 unsigned SBOREN : 1;
2298 unsigned IPEN : 1;
2301 struct
2303 unsigned BOR : 1;
2304 unsigned POR : 1;
2305 unsigned PD : 1;
2306 unsigned TO : 1;
2307 unsigned RI : 1;
2308 unsigned : 1;
2309 unsigned : 1;
2310 unsigned : 1;
2312 } __RCONbits_t;
2314 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2316 #define _NOT_BOR 0x01
2317 #define _BOR 0x01
2318 #define _NOT_POR 0x02
2319 #define _POR 0x02
2320 #define _NOT_PD 0x04
2321 #define _PD 0x04
2322 #define _NOT_TO 0x08
2323 #define _TO 0x08
2324 #define _NOT_RI 0x10
2325 #define _RI 0x10
2326 #define _SBOREN 0x40
2327 #define _IPEN 0x80
2329 //==============================================================================
2332 //==============================================================================
2333 // WDTCON Bits
2335 extern __at(0x0FD1) __sfr WDTCON;
2337 typedef union
2339 struct
2341 unsigned SWDTEN : 1;
2342 unsigned : 1;
2343 unsigned : 1;
2344 unsigned : 1;
2345 unsigned : 1;
2346 unsigned : 1;
2347 unsigned : 1;
2348 unsigned : 1;
2351 struct
2353 unsigned SWDTE : 1;
2354 unsigned : 1;
2355 unsigned : 1;
2356 unsigned : 1;
2357 unsigned : 1;
2358 unsigned : 1;
2359 unsigned : 1;
2360 unsigned : 1;
2362 } __WDTCONbits_t;
2364 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2366 #define _SWDTEN 0x01
2367 #define _SWDTE 0x01
2369 //==============================================================================
2372 //==============================================================================
2373 // HLVDCON Bits
2375 extern __at(0x0FD2) __sfr HLVDCON;
2377 typedef union
2379 struct
2381 unsigned HLVDL0 : 1;
2382 unsigned HLVDL1 : 1;
2383 unsigned HLVDL2 : 1;
2384 unsigned HLVDL3 : 1;
2385 unsigned HLVDEN : 1;
2386 unsigned IVRST : 1;
2387 unsigned : 1;
2388 unsigned VDIRMAG : 1;
2391 struct
2393 unsigned LVDL0 : 1;
2394 unsigned LVDL1 : 1;
2395 unsigned LVDL2 : 1;
2396 unsigned LVDL3 : 1;
2397 unsigned LVDEN : 1;
2398 unsigned IRVST : 1;
2399 unsigned : 1;
2400 unsigned : 1;
2403 struct
2405 unsigned LVV0 : 1;
2406 unsigned LVV1 : 1;
2407 unsigned LVV2 : 1;
2408 unsigned LVV3 : 1;
2409 unsigned : 1;
2410 unsigned BGST : 1;
2411 unsigned : 1;
2412 unsigned : 1;
2415 struct
2417 unsigned LVDL : 4;
2418 unsigned : 4;
2421 struct
2423 unsigned HLVDL : 4;
2424 unsigned : 4;
2427 struct
2429 unsigned LVV : 4;
2430 unsigned : 4;
2432 } __HLVDCONbits_t;
2434 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2436 #define _HLVDL0 0x01
2437 #define _LVDL0 0x01
2438 #define _LVV0 0x01
2439 #define _HLVDL1 0x02
2440 #define _LVDL1 0x02
2441 #define _LVV1 0x02
2442 #define _HLVDL2 0x04
2443 #define _LVDL2 0x04
2444 #define _LVV2 0x04
2445 #define _HLVDL3 0x08
2446 #define _LVDL3 0x08
2447 #define _LVV3 0x08
2448 #define _HLVDEN 0x10
2449 #define _LVDEN 0x10
2450 #define _IVRST 0x20
2451 #define _IRVST 0x20
2452 #define _BGST 0x20
2453 #define _VDIRMAG 0x80
2455 //==============================================================================
2458 //==============================================================================
2459 // LVDCON Bits
2461 extern __at(0x0FD2) __sfr LVDCON;
2463 typedef union
2465 struct
2467 unsigned HLVDL0 : 1;
2468 unsigned HLVDL1 : 1;
2469 unsigned HLVDL2 : 1;
2470 unsigned HLVDL3 : 1;
2471 unsigned HLVDEN : 1;
2472 unsigned IVRST : 1;
2473 unsigned : 1;
2474 unsigned VDIRMAG : 1;
2477 struct
2479 unsigned LVDL0 : 1;
2480 unsigned LVDL1 : 1;
2481 unsigned LVDL2 : 1;
2482 unsigned LVDL3 : 1;
2483 unsigned LVDEN : 1;
2484 unsigned IRVST : 1;
2485 unsigned : 1;
2486 unsigned : 1;
2489 struct
2491 unsigned LVV0 : 1;
2492 unsigned LVV1 : 1;
2493 unsigned LVV2 : 1;
2494 unsigned LVV3 : 1;
2495 unsigned : 1;
2496 unsigned BGST : 1;
2497 unsigned : 1;
2498 unsigned : 1;
2501 struct
2503 unsigned LVDL : 4;
2504 unsigned : 4;
2507 struct
2509 unsigned HLVDL : 4;
2510 unsigned : 4;
2513 struct
2515 unsigned LVV : 4;
2516 unsigned : 4;
2518 } __LVDCONbits_t;
2520 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2522 #define _LVDCON_HLVDL0 0x01
2523 #define _LVDCON_LVDL0 0x01
2524 #define _LVDCON_LVV0 0x01
2525 #define _LVDCON_HLVDL1 0x02
2526 #define _LVDCON_LVDL1 0x02
2527 #define _LVDCON_LVV1 0x02
2528 #define _LVDCON_HLVDL2 0x04
2529 #define _LVDCON_LVDL2 0x04
2530 #define _LVDCON_LVV2 0x04
2531 #define _LVDCON_HLVDL3 0x08
2532 #define _LVDCON_LVDL3 0x08
2533 #define _LVDCON_LVV3 0x08
2534 #define _LVDCON_HLVDEN 0x10
2535 #define _LVDCON_LVDEN 0x10
2536 #define _LVDCON_IVRST 0x20
2537 #define _LVDCON_IRVST 0x20
2538 #define _LVDCON_BGST 0x20
2539 #define _LVDCON_VDIRMAG 0x80
2541 //==============================================================================
2544 //==============================================================================
2545 // OSCCON Bits
2547 extern __at(0x0FD3) __sfr OSCCON;
2549 typedef union
2551 struct
2553 unsigned SCS0 : 1;
2554 unsigned SCS1 : 1;
2555 unsigned IOFS : 1;
2556 unsigned OSTS : 1;
2557 unsigned IRCF0 : 1;
2558 unsigned IRCF1 : 1;
2559 unsigned IRCF2 : 1;
2560 unsigned IDLEN : 1;
2563 struct
2565 unsigned : 1;
2566 unsigned : 1;
2567 unsigned FLTS : 1;
2568 unsigned : 1;
2569 unsigned : 1;
2570 unsigned : 1;
2571 unsigned : 1;
2572 unsigned : 1;
2575 struct
2577 unsigned SCS : 2;
2578 unsigned : 6;
2581 struct
2583 unsigned : 4;
2584 unsigned IRCF : 3;
2585 unsigned : 1;
2587 } __OSCCONbits_t;
2589 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2591 #define _SCS0 0x01
2592 #define _SCS1 0x02
2593 #define _IOFS 0x04
2594 #define _FLTS 0x04
2595 #define _OSTS 0x08
2596 #define _IRCF0 0x10
2597 #define _IRCF1 0x20
2598 #define _IRCF2 0x40
2599 #define _IDLEN 0x80
2601 //==============================================================================
2604 //==============================================================================
2605 // T0CON Bits
2607 extern __at(0x0FD5) __sfr T0CON;
2609 typedef union
2611 struct
2613 unsigned T0PS0 : 1;
2614 unsigned T0PS1 : 1;
2615 unsigned T0PS2 : 1;
2616 unsigned PSA : 1;
2617 unsigned T0SE : 1;
2618 unsigned T0CS : 1;
2619 unsigned T08BIT : 1;
2620 unsigned TMR0ON : 1;
2623 struct
2625 unsigned : 1;
2626 unsigned : 1;
2627 unsigned : 1;
2628 unsigned T0PS3 : 1;
2629 unsigned : 1;
2630 unsigned : 1;
2631 unsigned T016BIT : 1;
2632 unsigned : 1;
2635 struct
2637 unsigned T0PS : 4;
2638 unsigned : 4;
2640 } __T0CONbits_t;
2642 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2644 #define _T0PS0 0x01
2645 #define _T0PS1 0x02
2646 #define _T0PS2 0x04
2647 #define _PSA 0x08
2648 #define _T0PS3 0x08
2649 #define _T0SE 0x10
2650 #define _T0CS 0x20
2651 #define _T08BIT 0x40
2652 #define _T016BIT 0x40
2653 #define _TMR0ON 0x80
2655 //==============================================================================
2657 extern __at(0x0FD6) __sfr TMR0;
2658 extern __at(0x0FD6) __sfr TMR0L;
2659 extern __at(0x0FD7) __sfr TMR0H;
2661 //==============================================================================
2662 // STATUS Bits
2664 extern __at(0x0FD8) __sfr STATUS;
2666 typedef struct
2668 unsigned C : 1;
2669 unsigned DC : 1;
2670 unsigned Z : 1;
2671 unsigned OV : 1;
2672 unsigned N : 1;
2673 unsigned : 1;
2674 unsigned : 1;
2675 unsigned : 1;
2676 } __STATUSbits_t;
2678 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2680 #define _C 0x01
2681 #define _DC 0x02
2682 #define _Z 0x04
2683 #define _OV 0x08
2684 #define _N 0x10
2686 //==============================================================================
2688 extern __at(0x0FD9) __sfr FSR2L;
2689 extern __at(0x0FDA) __sfr FSR2H;
2690 extern __at(0x0FDB) __sfr PLUSW2;
2691 extern __at(0x0FDC) __sfr PREINC2;
2692 extern __at(0x0FDD) __sfr POSTDEC2;
2693 extern __at(0x0FDE) __sfr POSTINC2;
2694 extern __at(0x0FDF) __sfr INDF2;
2695 extern __at(0x0FE0) __sfr BSR;
2696 extern __at(0x0FE1) __sfr FSR1L;
2697 extern __at(0x0FE2) __sfr FSR1H;
2698 extern __at(0x0FE3) __sfr PLUSW1;
2699 extern __at(0x0FE4) __sfr PREINC1;
2700 extern __at(0x0FE5) __sfr POSTDEC1;
2701 extern __at(0x0FE6) __sfr POSTINC1;
2702 extern __at(0x0FE7) __sfr INDF1;
2703 extern __at(0x0FE8) __sfr WREG;
2704 extern __at(0x0FE9) __sfr FSR0L;
2705 extern __at(0x0FEA) __sfr FSR0H;
2706 extern __at(0x0FEB) __sfr PLUSW0;
2707 extern __at(0x0FEC) __sfr PREINC0;
2708 extern __at(0x0FED) __sfr POSTDEC0;
2709 extern __at(0x0FEE) __sfr POSTINC0;
2710 extern __at(0x0FEF) __sfr INDF0;
2712 //==============================================================================
2713 // INTCON3 Bits
2715 extern __at(0x0FF0) __sfr INTCON3;
2717 typedef union
2719 struct
2721 unsigned INT1IF : 1;
2722 unsigned INT2IF : 1;
2723 unsigned : 1;
2724 unsigned INT1IE : 1;
2725 unsigned INT2IE : 1;
2726 unsigned : 1;
2727 unsigned INT1IP : 1;
2728 unsigned INT2IP : 1;
2731 struct
2733 unsigned INT1F : 1;
2734 unsigned INT2F : 1;
2735 unsigned : 1;
2736 unsigned INT1E : 1;
2737 unsigned INT2E : 1;
2738 unsigned : 1;
2739 unsigned INT1P : 1;
2740 unsigned INT2P : 1;
2742 } __INTCON3bits_t;
2744 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2746 #define _INT1IF 0x01
2747 #define _INT1F 0x01
2748 #define _INT2IF 0x02
2749 #define _INT2F 0x02
2750 #define _INT1IE 0x08
2751 #define _INT1E 0x08
2752 #define _INT2IE 0x10
2753 #define _INT2E 0x10
2754 #define _INT1IP 0x40
2755 #define _INT1P 0x40
2756 #define _INT2IP 0x80
2757 #define _INT2P 0x80
2759 //==============================================================================
2762 //==============================================================================
2763 // INTCON2 Bits
2765 extern __at(0x0FF1) __sfr INTCON2;
2767 typedef union
2769 struct
2771 unsigned RBIP : 1;
2772 unsigned : 1;
2773 unsigned TMR0IP : 1;
2774 unsigned : 1;
2775 unsigned INTEDG2 : 1;
2776 unsigned INTEDG1 : 1;
2777 unsigned INTEDG0 : 1;
2778 unsigned NOT_RBPU : 1;
2781 struct
2783 unsigned : 1;
2784 unsigned : 1;
2785 unsigned : 1;
2786 unsigned : 1;
2787 unsigned : 1;
2788 unsigned : 1;
2789 unsigned : 1;
2790 unsigned RBPU : 1;
2792 } __INTCON2bits_t;
2794 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2796 #define _RBIP 0x01
2797 #define _TMR0IP 0x04
2798 #define _INTEDG2 0x10
2799 #define _INTEDG1 0x20
2800 #define _INTEDG0 0x40
2801 #define _NOT_RBPU 0x80
2802 #define _RBPU 0x80
2804 //==============================================================================
2807 //==============================================================================
2808 // INTCON Bits
2810 extern __at(0x0FF2) __sfr INTCON;
2812 typedef union
2814 struct
2816 unsigned RBIF : 1;
2817 unsigned INT0IF : 1;
2818 unsigned TMR0IF : 1;
2819 unsigned RBIE : 1;
2820 unsigned INT0IE : 1;
2821 unsigned TMR0IE : 1;
2822 unsigned PEIE_GIEL : 1;
2823 unsigned GIE_GIEH : 1;
2826 struct
2828 unsigned : 1;
2829 unsigned INT0F : 1;
2830 unsigned T0IF : 1;
2831 unsigned : 1;
2832 unsigned INT0E : 1;
2833 unsigned T0IE : 1;
2834 unsigned PEIE : 1;
2835 unsigned GIE : 1;
2838 struct
2840 unsigned : 1;
2841 unsigned : 1;
2842 unsigned : 1;
2843 unsigned : 1;
2844 unsigned : 1;
2845 unsigned : 1;
2846 unsigned GIEL : 1;
2847 unsigned GIEH : 1;
2849 } __INTCONbits_t;
2851 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2853 #define _RBIF 0x01
2854 #define _INT0IF 0x02
2855 #define _INT0F 0x02
2856 #define _TMR0IF 0x04
2857 #define _T0IF 0x04
2858 #define _RBIE 0x08
2859 #define _INT0IE 0x10
2860 #define _INT0E 0x10
2861 #define _TMR0IE 0x20
2862 #define _T0IE 0x20
2863 #define _PEIE_GIEL 0x40
2864 #define _PEIE 0x40
2865 #define _GIEL 0x40
2866 #define _GIE_GIEH 0x80
2867 #define _GIE 0x80
2868 #define _GIEH 0x80
2870 //==============================================================================
2872 extern __at(0x0FF3) __sfr PROD;
2873 extern __at(0x0FF3) __sfr PRODL;
2874 extern __at(0x0FF4) __sfr PRODH;
2875 extern __at(0x0FF5) __sfr TABLAT;
2876 extern __at(0x0FF6) __sfr TBLPTR;
2877 extern __at(0x0FF6) __sfr TBLPTRL;
2878 extern __at(0x0FF7) __sfr TBLPTRH;
2879 extern __at(0x0FF8) __sfr TBLPTRU;
2880 extern __at(0x0FF9) __sfr PC;
2881 extern __at(0x0FF9) __sfr PCL;
2882 extern __at(0x0FFA) __sfr PCLATH;
2883 extern __at(0x0FFB) __sfr PCLATU;
2885 //==============================================================================
2886 // STKPTR Bits
2888 extern __at(0x0FFC) __sfr STKPTR;
2890 typedef union
2892 struct
2894 unsigned SP0 : 1;
2895 unsigned SP1 : 1;
2896 unsigned SP2 : 1;
2897 unsigned SP3 : 1;
2898 unsigned SP4 : 1;
2899 unsigned : 1;
2900 unsigned STKUNF : 1;
2901 unsigned STKFUL : 1;
2904 struct
2906 unsigned : 1;
2907 unsigned : 1;
2908 unsigned : 1;
2909 unsigned : 1;
2910 unsigned : 1;
2911 unsigned : 1;
2912 unsigned : 1;
2913 unsigned STKOVF : 1;
2916 struct
2918 unsigned SP : 5;
2919 unsigned : 3;
2921 } __STKPTRbits_t;
2923 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2925 #define _SP0 0x01
2926 #define _SP1 0x02
2927 #define _SP2 0x04
2928 #define _SP3 0x08
2929 #define _SP4 0x10
2930 #define _STKUNF 0x40
2931 #define _STKFUL 0x80
2932 #define _STKOVF 0x80
2934 //==============================================================================
2936 extern __at(0x0FFD) __sfr TOS;
2937 extern __at(0x0FFD) __sfr TOSL;
2938 extern __at(0x0FFE) __sfr TOSH;
2939 extern __at(0x0FFF) __sfr TOSU;
2941 //==============================================================================
2943 // Configuration Bits
2945 //==============================================================================
2947 #define __CONFIG1H 0x300001
2948 #define __CONFIG2L 0x300002
2949 #define __CONFIG2H 0x300003
2950 #define __CONFIG3H 0x300005
2951 #define __CONFIG4L 0x300006
2952 #define __CONFIG5L 0x300008
2953 #define __CONFIG5H 0x300009
2954 #define __CONFIG6L 0x30000A
2955 #define __CONFIG6H 0x30000B
2956 #define __CONFIG7L 0x30000C
2957 #define __CONFIG7H 0x30000D
2959 //----------------------------- CONFIG1H Options -------------------------------
2961 #define _OSC_LP_1H 0xF0 // LP oscillator.
2962 #define _OSC_XT_1H 0xF1 // XT oscillator.
2963 #define _OSC_HS_1H 0xF2 // HS oscillator.
2964 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
2965 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2966 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
2967 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
2968 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
2969 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
2970 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7.
2971 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2972 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2973 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2974 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2976 //----------------------------- CONFIG2L Options -------------------------------
2978 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2979 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2980 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2981 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2982 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2983 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2984 #define _BORV_0_2L 0xE7 // Maximum setting.
2985 #define _BORV_1_2L 0xEF
2986 #define _BORV_2_2L 0xF7
2987 #define _BORV_3_2L 0xFF // Minimum setting.
2989 //----------------------------- CONFIG2H Options -------------------------------
2991 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2992 #define _WDT_ON_2H 0xFF // WDT enabled.
2993 #define _WDTPS_1_2H 0xE1 // 1:1.
2994 #define _WDTPS_2_2H 0xE3 // 1:2.
2995 #define _WDTPS_4_2H 0xE5 // 1:4.
2996 #define _WDTPS_8_2H 0xE7 // 1:8.
2997 #define _WDTPS_16_2H 0xE9 // 1:16.
2998 #define _WDTPS_32_2H 0xEB // 1:32.
2999 #define _WDTPS_64_2H 0xED // 1:64.
3000 #define _WDTPS_128_2H 0xEF // 1:128.
3001 #define _WDTPS_256_2H 0xF1 // 1:256.
3002 #define _WDTPS_512_2H 0xF3 // 1:512.
3003 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3004 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3005 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3006 #define _WDTPS_8192_2H 0xFB // 1:8192.
3007 #define _WDTPS_16384_2H 0xFD // 1:16384.
3008 #define _WDTPS_32768_2H 0xFF // 1:32768.
3010 //----------------------------- CONFIG3H Options -------------------------------
3012 #define _CCP2MX_PORTB_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3013 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3014 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3015 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3016 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3017 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3018 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3019 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3021 //----------------------------- CONFIG4L Options -------------------------------
3023 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3024 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3025 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3026 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3027 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3028 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3029 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3030 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3032 //----------------------------- CONFIG5L Options -------------------------------
3034 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected.
3035 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected.
3036 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected.
3037 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected.
3038 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected.
3039 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected.
3040 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected.
3041 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected.
3043 //----------------------------- CONFIG5H Options -------------------------------
3045 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3046 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3047 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3048 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3050 //----------------------------- CONFIG6L Options -------------------------------
3052 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected.
3053 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected.
3054 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected.
3055 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected.
3056 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected.
3057 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected.
3058 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected.
3059 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected.
3061 //----------------------------- CONFIG6H Options -------------------------------
3063 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3064 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3065 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) write-protected.
3066 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) not write-protected.
3067 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3068 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3070 //----------------------------- CONFIG7L Options -------------------------------
3072 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
3073 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
3074 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
3075 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
3076 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
3077 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
3078 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
3079 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
3081 //----------------------------- CONFIG7H Options -------------------------------
3083 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) protected from table reads executed in other blocks.
3084 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) not protected from table reads executed in other blocks.
3086 //==============================================================================
3088 #define __DEVID1 0x3FFFFE
3089 #define __DEVID2 0x3FFFFF
3091 #define __IDLOC0 0x200000
3092 #define __IDLOC1 0x200001
3093 #define __IDLOC2 0x200002
3094 #define __IDLOC3 0x200003
3095 #define __IDLOC4 0x200004
3096 #define __IDLOC5 0x200005
3097 #define __IDLOC6 0x200006
3098 #define __IDLOC7 0x200007
3100 #endif // #ifndef __PIC18LF2523_H__