Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f25k20.h
blob0f11b2518d6638f6ed4e72389dac14ee3b81d95f
1 /*
2 * This declarations of the PIC18F25K20 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:27 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 __PIC18F25K20_H__
26 #define __PIC18F25K20_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // SSPMSK Bits
40 extern __at(0x0F77) __sfr SSPMSK;
42 typedef struct
44 unsigned MSK0 : 1;
45 unsigned MSK1 : 1;
46 unsigned MSK2 : 1;
47 unsigned MSK3 : 1;
48 unsigned MSK4 : 1;
49 unsigned MSK5 : 1;
50 unsigned MSK6 : 1;
51 unsigned MSK7 : 1;
52 } __SSPMSKbits_t;
54 extern __at(0x0F77) volatile __SSPMSKbits_t SSPMSKbits;
56 #define _MSK0 0x01
57 #define _MSK1 0x02
58 #define _MSK2 0x04
59 #define _MSK3 0x08
60 #define _MSK4 0x10
61 #define _MSK5 0x20
62 #define _MSK6 0x40
63 #define _MSK7 0x80
65 //==============================================================================
68 //==============================================================================
69 // SLRCON Bits
71 extern __at(0x0F78) __sfr SLRCON;
73 typedef struct
75 unsigned SLRA : 1;
76 unsigned SLRB : 1;
77 unsigned SLRC : 1;
78 unsigned : 1;
79 unsigned : 1;
80 unsigned : 1;
81 unsigned : 1;
82 unsigned : 1;
83 } __SLRCONbits_t;
85 extern __at(0x0F78) volatile __SLRCONbits_t SLRCONbits;
87 #define _SLRA 0x01
88 #define _SLRB 0x02
89 #define _SLRC 0x04
91 //==============================================================================
94 //==============================================================================
95 // CM2CON1 Bits
97 extern __at(0x0F79) __sfr CM2CON1;
99 typedef struct
101 unsigned : 1;
102 unsigned : 1;
103 unsigned : 1;
104 unsigned : 1;
105 unsigned C2RSEL : 1;
106 unsigned C1RSEL : 1;
107 unsigned MC2OUT : 1;
108 unsigned MC1OUT : 1;
109 } __CM2CON1bits_t;
111 extern __at(0x0F79) volatile __CM2CON1bits_t CM2CON1bits;
113 #define _C2RSEL 0x10
114 #define _C1RSEL 0x20
115 #define _MC2OUT 0x40
116 #define _MC1OUT 0x80
118 //==============================================================================
121 //==============================================================================
122 // CM2CON0 Bits
124 extern __at(0x0F7A) __sfr CM2CON0;
126 typedef union
128 struct
130 unsigned C2CH0 : 1;
131 unsigned C2CH1 : 1;
132 unsigned C2R : 1;
133 unsigned C2SP : 1;
134 unsigned C2POL : 1;
135 unsigned C2OE : 1;
136 unsigned C2OUT : 1;
137 unsigned C2ON : 1;
140 struct
142 unsigned C2CH : 2;
143 unsigned : 6;
145 } __CM2CON0bits_t;
147 extern __at(0x0F7A) volatile __CM2CON0bits_t CM2CON0bits;
149 #define _C2CH0 0x01
150 #define _C2CH1 0x02
151 #define _C2R 0x04
152 #define _C2SP 0x08
153 #define _C2POL 0x10
154 #define _C2OE 0x20
155 #define _C2OUT 0x40
156 #define _C2ON 0x80
158 //==============================================================================
161 //==============================================================================
162 // CM1CON0 Bits
164 extern __at(0x0F7B) __sfr CM1CON0;
166 typedef union
168 struct
170 unsigned C1CH0 : 1;
171 unsigned C1CH1 : 1;
172 unsigned C1R : 1;
173 unsigned C1SP : 1;
174 unsigned C1POL : 1;
175 unsigned C1OE : 1;
176 unsigned C1OUT : 1;
177 unsigned C1ON : 1;
180 struct
182 unsigned C1CH : 2;
183 unsigned : 6;
185 } __CM1CON0bits_t;
187 extern __at(0x0F7B) volatile __CM1CON0bits_t CM1CON0bits;
189 #define _C1CH0 0x01
190 #define _C1CH1 0x02
191 #define _C1R 0x04
192 #define _C1SP 0x08
193 #define _C1POL 0x10
194 #define _C1OE 0x20
195 #define _C1OUT 0x40
196 #define _C1ON 0x80
198 //==============================================================================
201 //==============================================================================
202 // WPUB Bits
204 extern __at(0x0F7C) __sfr WPUB;
206 typedef struct
208 unsigned WPUB0 : 1;
209 unsigned WPUB1 : 1;
210 unsigned WPUB2 : 1;
211 unsigned WPUB3 : 1;
212 unsigned WPUB4 : 1;
213 unsigned WPUB5 : 1;
214 unsigned WPUB6 : 1;
215 unsigned WPUB7 : 1;
216 } __WPUBbits_t;
218 extern __at(0x0F7C) volatile __WPUBbits_t WPUBbits;
220 #define _WPUB0 0x01
221 #define _WPUB1 0x02
222 #define _WPUB2 0x04
223 #define _WPUB3 0x08
224 #define _WPUB4 0x10
225 #define _WPUB5 0x20
226 #define _WPUB6 0x40
227 #define _WPUB7 0x80
229 //==============================================================================
232 //==============================================================================
233 // IOCB Bits
235 extern __at(0x0F7D) __sfr IOCB;
237 typedef struct
239 unsigned : 1;
240 unsigned : 1;
241 unsigned : 1;
242 unsigned : 1;
243 unsigned IOCB4 : 1;
244 unsigned IOCB5 : 1;
245 unsigned IOCB6 : 1;
246 unsigned IOCB7 : 1;
247 } __IOCBbits_t;
249 extern __at(0x0F7D) volatile __IOCBbits_t IOCBbits;
251 #define _IOCB4 0x10
252 #define _IOCB5 0x20
253 #define _IOCB6 0x40
254 #define _IOCB7 0x80
256 //==============================================================================
259 //==============================================================================
260 // ANSEL Bits
262 extern __at(0x0F7E) __sfr ANSEL;
264 typedef union
266 struct
268 unsigned ANS0 : 1;
269 unsigned ANS1 : 1;
270 unsigned ANS2 : 1;
271 unsigned ANS3 : 1;
272 unsigned ANS4 : 1;
273 unsigned : 1;
274 unsigned : 1;
275 unsigned : 1;
278 struct
280 unsigned ANS : 5;
281 unsigned : 3;
283 } __ANSELbits_t;
285 extern __at(0x0F7E) volatile __ANSELbits_t ANSELbits;
287 #define _ANS0 0x01
288 #define _ANS1 0x02
289 #define _ANS2 0x04
290 #define _ANS3 0x08
291 #define _ANS4 0x10
293 //==============================================================================
296 //==============================================================================
297 // ANSELH Bits
299 extern __at(0x0F7F) __sfr ANSELH;
301 typedef struct
303 unsigned ANS8 : 1;
304 unsigned ANS9 : 1;
305 unsigned ANS10 : 1;
306 unsigned ANS11 : 1;
307 unsigned ANS12 : 1;
308 unsigned : 1;
309 unsigned : 1;
310 unsigned : 1;
311 } __ANSELHbits_t;
313 extern __at(0x0F7F) volatile __ANSELHbits_t ANSELHbits;
315 #define _ANS8 0x01
316 #define _ANS9 0x02
317 #define _ANS10 0x04
318 #define _ANS11 0x08
319 #define _ANS12 0x10
321 //==============================================================================
324 //==============================================================================
325 // PORTA Bits
327 extern __at(0x0F80) __sfr PORTA;
329 typedef union
331 struct
333 unsigned RA0 : 1;
334 unsigned RA1 : 1;
335 unsigned RA2 : 1;
336 unsigned RA3 : 1;
337 unsigned RA4 : 1;
338 unsigned RA5 : 1;
339 unsigned RA6 : 1;
340 unsigned RA7 : 1;
343 struct
345 unsigned AN0 : 1;
346 unsigned AN1 : 1;
347 unsigned AN2 : 1;
348 unsigned AN3 : 1;
349 unsigned C1OUT : 1;
350 unsigned AN4 : 1;
351 unsigned : 1;
352 unsigned : 1;
355 struct
357 unsigned C12IN0M : 1;
358 unsigned C12IN1M : 1;
359 unsigned C2INP : 1;
360 unsigned C1INP : 1;
361 unsigned T0CKI : 1;
362 unsigned C2OUT : 1;
363 unsigned : 1;
364 unsigned : 1;
367 struct
369 unsigned C12IN0N : 1;
370 unsigned C12IN1N : 1;
371 unsigned VREFM : 1;
372 unsigned VREFP : 1;
373 unsigned : 1;
374 unsigned SS : 1;
375 unsigned : 1;
376 unsigned : 1;
379 struct
381 unsigned : 1;
382 unsigned : 1;
383 unsigned VREFN : 1;
384 unsigned : 1;
385 unsigned : 1;
386 unsigned NOT_SS : 1;
387 unsigned : 1;
388 unsigned : 1;
391 struct
393 unsigned : 1;
394 unsigned : 1;
395 unsigned CVREF : 1;
396 unsigned : 1;
397 unsigned : 1;
398 unsigned LVDIN : 1;
399 unsigned : 1;
400 unsigned : 1;
403 struct
405 unsigned : 1;
406 unsigned : 1;
407 unsigned : 1;
408 unsigned : 1;
409 unsigned : 1;
410 unsigned HLVDIN : 1;
411 unsigned : 1;
412 unsigned : 1;
414 } __PORTAbits_t;
416 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
418 #define _PORTA_RA0 0x01
419 #define _PORTA_AN0 0x01
420 #define _PORTA_C12IN0M 0x01
421 #define _PORTA_C12IN0N 0x01
422 #define _PORTA_RA1 0x02
423 #define _PORTA_AN1 0x02
424 #define _PORTA_C12IN1M 0x02
425 #define _PORTA_C12IN1N 0x02
426 #define _PORTA_RA2 0x04
427 #define _PORTA_AN2 0x04
428 #define _PORTA_C2INP 0x04
429 #define _PORTA_VREFM 0x04
430 #define _PORTA_VREFN 0x04
431 #define _PORTA_CVREF 0x04
432 #define _PORTA_RA3 0x08
433 #define _PORTA_AN3 0x08
434 #define _PORTA_C1INP 0x08
435 #define _PORTA_VREFP 0x08
436 #define _PORTA_RA4 0x10
437 #define _PORTA_C1OUT 0x10
438 #define _PORTA_T0CKI 0x10
439 #define _PORTA_RA5 0x20
440 #define _PORTA_AN4 0x20
441 #define _PORTA_C2OUT 0x20
442 #define _PORTA_SS 0x20
443 #define _PORTA_NOT_SS 0x20
444 #define _PORTA_LVDIN 0x20
445 #define _PORTA_HLVDIN 0x20
446 #define _PORTA_RA6 0x40
447 #define _PORTA_RA7 0x80
449 //==============================================================================
452 //==============================================================================
453 // PORTB Bits
455 extern __at(0x0F81) __sfr PORTB;
457 typedef union
459 struct
461 unsigned RB0 : 1;
462 unsigned RB1 : 1;
463 unsigned RB2 : 1;
464 unsigned RB3 : 1;
465 unsigned RB4 : 1;
466 unsigned RB5 : 1;
467 unsigned RB6 : 1;
468 unsigned RB7 : 1;
471 struct
473 unsigned INT0 : 1;
474 unsigned INT1 : 1;
475 unsigned INT2 : 1;
476 unsigned CCP2 : 1;
477 unsigned KBI0 : 1;
478 unsigned KBI1 : 1;
479 unsigned KBI2 : 1;
480 unsigned KBI3 : 1;
483 struct
485 unsigned AN12 : 1;
486 unsigned AN10 : 1;
487 unsigned AN8 : 1;
488 unsigned AN9 : 1;
489 unsigned AN11 : 1;
490 unsigned PGM : 1;
491 unsigned PGC : 1;
492 unsigned PGD : 1;
495 struct
497 unsigned FLT0 : 1;
498 unsigned C12IN3M : 1;
499 unsigned P1B : 1;
500 unsigned C12IN2M : 1;
501 unsigned P1D : 1;
502 unsigned : 1;
503 unsigned : 1;
504 unsigned : 1;
507 struct
509 unsigned : 1;
510 unsigned C12IN3N : 1;
511 unsigned : 1;
512 unsigned C12IN2N : 1;
513 unsigned : 1;
514 unsigned : 1;
515 unsigned : 1;
516 unsigned : 1;
519 struct
521 unsigned : 1;
522 unsigned P1C : 1;
523 unsigned : 1;
524 unsigned : 1;
525 unsigned : 1;
526 unsigned : 1;
527 unsigned : 1;
528 unsigned : 1;
531 struct
533 unsigned INT : 3;
534 unsigned : 5;
537 struct
539 unsigned : 4;
540 unsigned KBI : 4;
542 } __PORTBbits_t;
544 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
546 #define _PORTB_RB0 0x01
547 #define _PORTB_INT0 0x01
548 #define _PORTB_AN12 0x01
549 #define _PORTB_FLT0 0x01
550 #define _PORTB_RB1 0x02
551 #define _PORTB_INT1 0x02
552 #define _PORTB_AN10 0x02
553 #define _PORTB_C12IN3M 0x02
554 #define _PORTB_C12IN3N 0x02
555 #define _PORTB_P1C 0x02
556 #define _PORTB_RB2 0x04
557 #define _PORTB_INT2 0x04
558 #define _PORTB_AN8 0x04
559 #define _PORTB_P1B 0x04
560 #define _PORTB_RB3 0x08
561 #define _PORTB_CCP2 0x08
562 #define _PORTB_AN9 0x08
563 #define _PORTB_C12IN2M 0x08
564 #define _PORTB_C12IN2N 0x08
565 #define _PORTB_RB4 0x10
566 #define _PORTB_KBI0 0x10
567 #define _PORTB_AN11 0x10
568 #define _PORTB_P1D 0x10
569 #define _PORTB_RB5 0x20
570 #define _PORTB_KBI1 0x20
571 #define _PORTB_PGM 0x20
572 #define _PORTB_RB6 0x40
573 #define _PORTB_KBI2 0x40
574 #define _PORTB_PGC 0x40
575 #define _PORTB_RB7 0x80
576 #define _PORTB_KBI3 0x80
577 #define _PORTB_PGD 0x80
579 //==============================================================================
582 //==============================================================================
583 // PORTC Bits
585 extern __at(0x0F82) __sfr PORTC;
587 typedef union
589 struct
591 unsigned RC0 : 1;
592 unsigned RC1 : 1;
593 unsigned RC2 : 1;
594 unsigned RC3 : 1;
595 unsigned RC4 : 1;
596 unsigned RC5 : 1;
597 unsigned RC6 : 1;
598 unsigned RC7 : 1;
601 struct
603 unsigned T1OSO : 1;
604 unsigned T1OSI : 1;
605 unsigned CCP1 : 1;
606 unsigned SCK : 1;
607 unsigned SDI : 1;
608 unsigned SDO : 1;
609 unsigned TX : 1;
610 unsigned RX : 1;
613 struct
615 unsigned T13CKI : 1;
616 unsigned CCP2 : 1;
617 unsigned P1A : 1;
618 unsigned SCL : 1;
619 unsigned SDA : 1;
620 unsigned : 1;
621 unsigned CK : 1;
622 unsigned : 1;
625 struct
627 unsigned T1CKI : 1;
628 unsigned : 1;
629 unsigned : 1;
630 unsigned : 1;
631 unsigned : 1;
632 unsigned : 1;
633 unsigned : 1;
634 unsigned : 1;
637 struct
639 unsigned T3CKI : 1;
640 unsigned : 1;
641 unsigned : 1;
642 unsigned : 1;
643 unsigned : 1;
644 unsigned : 1;
645 unsigned : 1;
646 unsigned : 1;
648 } __PORTCbits_t;
650 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
652 #define _PORTC_RC0 0x01
653 #define _PORTC_T1OSO 0x01
654 #define _PORTC_T13CKI 0x01
655 #define _PORTC_T1CKI 0x01
656 #define _PORTC_T3CKI 0x01
657 #define _PORTC_RC1 0x02
658 #define _PORTC_T1OSI 0x02
659 #define _PORTC_CCP2 0x02
660 #define _PORTC_RC2 0x04
661 #define _PORTC_CCP1 0x04
662 #define _PORTC_P1A 0x04
663 #define _PORTC_RC3 0x08
664 #define _PORTC_SCK 0x08
665 #define _PORTC_SCL 0x08
666 #define _PORTC_RC4 0x10
667 #define _PORTC_SDI 0x10
668 #define _PORTC_SDA 0x10
669 #define _PORTC_RC5 0x20
670 #define _PORTC_SDO 0x20
671 #define _PORTC_RC6 0x40
672 #define _PORTC_TX 0x40
673 #define _PORTC_CK 0x40
674 #define _PORTC_RC7 0x80
675 #define _PORTC_RX 0x80
677 //==============================================================================
680 //==============================================================================
681 // PORTE Bits
683 extern __at(0x0F84) __sfr PORTE;
685 typedef union
687 struct
689 unsigned : 1;
690 unsigned : 1;
691 unsigned : 1;
692 unsigned RE3 : 1;
693 unsigned : 1;
694 unsigned : 1;
695 unsigned : 1;
696 unsigned : 1;
699 struct
701 unsigned : 1;
702 unsigned : 1;
703 unsigned : 1;
704 unsigned MCLR : 1;
705 unsigned : 1;
706 unsigned : 1;
707 unsigned : 1;
708 unsigned : 1;
711 struct
713 unsigned : 1;
714 unsigned : 1;
715 unsigned : 1;
716 unsigned NOT_MCLR : 1;
717 unsigned : 1;
718 unsigned : 1;
719 unsigned : 1;
720 unsigned : 1;
723 struct
725 unsigned : 1;
726 unsigned : 1;
727 unsigned : 1;
728 unsigned VPP : 1;
729 unsigned : 1;
730 unsigned : 1;
731 unsigned : 1;
732 unsigned : 1;
734 } __PORTEbits_t;
736 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
738 #define _RE3 0x08
739 #define _MCLR 0x08
740 #define _NOT_MCLR 0x08
741 #define _VPP 0x08
743 //==============================================================================
746 //==============================================================================
747 // LATA Bits
749 extern __at(0x0F89) __sfr LATA;
751 typedef struct
753 unsigned LATA0 : 1;
754 unsigned LATA1 : 1;
755 unsigned LATA2 : 1;
756 unsigned LATA3 : 1;
757 unsigned LATA4 : 1;
758 unsigned LATA5 : 1;
759 unsigned LATA6 : 1;
760 unsigned LATA7 : 1;
761 } __LATAbits_t;
763 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
765 #define _LATA0 0x01
766 #define _LATA1 0x02
767 #define _LATA2 0x04
768 #define _LATA3 0x08
769 #define _LATA4 0x10
770 #define _LATA5 0x20
771 #define _LATA6 0x40
772 #define _LATA7 0x80
774 //==============================================================================
777 //==============================================================================
778 // LATB Bits
780 extern __at(0x0F8A) __sfr LATB;
782 typedef struct
784 unsigned LATB0 : 1;
785 unsigned LATB1 : 1;
786 unsigned LATB2 : 1;
787 unsigned LATB3 : 1;
788 unsigned LATB4 : 1;
789 unsigned LATB5 : 1;
790 unsigned LATB6 : 1;
791 unsigned LATB7 : 1;
792 } __LATBbits_t;
794 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
796 #define _LATB0 0x01
797 #define _LATB1 0x02
798 #define _LATB2 0x04
799 #define _LATB3 0x08
800 #define _LATB4 0x10
801 #define _LATB5 0x20
802 #define _LATB6 0x40
803 #define _LATB7 0x80
805 //==============================================================================
808 //==============================================================================
809 // LATC Bits
811 extern __at(0x0F8B) __sfr LATC;
813 typedef struct
815 unsigned LATC0 : 1;
816 unsigned LATC1 : 1;
817 unsigned LATC2 : 1;
818 unsigned LATC3 : 1;
819 unsigned LATC4 : 1;
820 unsigned LATC5 : 1;
821 unsigned LATC6 : 1;
822 unsigned LATC7 : 1;
823 } __LATCbits_t;
825 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
827 #define _LATC0 0x01
828 #define _LATC1 0x02
829 #define _LATC2 0x04
830 #define _LATC3 0x08
831 #define _LATC4 0x10
832 #define _LATC5 0x20
833 #define _LATC6 0x40
834 #define _LATC7 0x80
836 //==============================================================================
839 //==============================================================================
840 // DDRA Bits
842 extern __at(0x0F92) __sfr DDRA;
844 typedef union
846 struct
848 unsigned TRISA0 : 1;
849 unsigned TRISA1 : 1;
850 unsigned TRISA2 : 1;
851 unsigned TRISA3 : 1;
852 unsigned TRISA4 : 1;
853 unsigned TRISA5 : 1;
854 unsigned TRISA6 : 1;
855 unsigned TRISA7 : 1;
858 struct
860 unsigned RA0 : 1;
861 unsigned RA1 : 1;
862 unsigned RA2 : 1;
863 unsigned RA3 : 1;
864 unsigned RA4 : 1;
865 unsigned RA5 : 1;
866 unsigned RA6 : 1;
867 unsigned RA7 : 1;
869 } __DDRAbits_t;
871 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
873 #define _TRISA0 0x01
874 #define _RA0 0x01
875 #define _TRISA1 0x02
876 #define _RA1 0x02
877 #define _TRISA2 0x04
878 #define _RA2 0x04
879 #define _TRISA3 0x08
880 #define _RA3 0x08
881 #define _TRISA4 0x10
882 #define _RA4 0x10
883 #define _TRISA5 0x20
884 #define _RA5 0x20
885 #define _TRISA6 0x40
886 #define _RA6 0x40
887 #define _TRISA7 0x80
888 #define _RA7 0x80
890 //==============================================================================
893 //==============================================================================
894 // TRISA Bits
896 extern __at(0x0F92) __sfr TRISA;
898 typedef union
900 struct
902 unsigned TRISA0 : 1;
903 unsigned TRISA1 : 1;
904 unsigned TRISA2 : 1;
905 unsigned TRISA3 : 1;
906 unsigned TRISA4 : 1;
907 unsigned TRISA5 : 1;
908 unsigned TRISA6 : 1;
909 unsigned TRISA7 : 1;
912 struct
914 unsigned RA0 : 1;
915 unsigned RA1 : 1;
916 unsigned RA2 : 1;
917 unsigned RA3 : 1;
918 unsigned RA4 : 1;
919 unsigned RA5 : 1;
920 unsigned RA6 : 1;
921 unsigned RA7 : 1;
923 } __TRISAbits_t;
925 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
927 #define _TRISA_TRISA0 0x01
928 #define _TRISA_RA0 0x01
929 #define _TRISA_TRISA1 0x02
930 #define _TRISA_RA1 0x02
931 #define _TRISA_TRISA2 0x04
932 #define _TRISA_RA2 0x04
933 #define _TRISA_TRISA3 0x08
934 #define _TRISA_RA3 0x08
935 #define _TRISA_TRISA4 0x10
936 #define _TRISA_RA4 0x10
937 #define _TRISA_TRISA5 0x20
938 #define _TRISA_RA5 0x20
939 #define _TRISA_TRISA6 0x40
940 #define _TRISA_RA6 0x40
941 #define _TRISA_TRISA7 0x80
942 #define _TRISA_RA7 0x80
944 //==============================================================================
947 //==============================================================================
948 // DDRB Bits
950 extern __at(0x0F93) __sfr DDRB;
952 typedef union
954 struct
956 unsigned TRISB0 : 1;
957 unsigned TRISB1 : 1;
958 unsigned TRISB2 : 1;
959 unsigned TRISB3 : 1;
960 unsigned TRISB4 : 1;
961 unsigned TRISB5 : 1;
962 unsigned TRISB6 : 1;
963 unsigned TRISB7 : 1;
966 struct
968 unsigned RB0 : 1;
969 unsigned RB1 : 1;
970 unsigned RB2 : 1;
971 unsigned RB3 : 1;
972 unsigned RB4 : 1;
973 unsigned RB5 : 1;
974 unsigned RB6 : 1;
975 unsigned RB7 : 1;
977 } __DDRBbits_t;
979 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
981 #define _TRISB0 0x01
982 #define _RB0 0x01
983 #define _TRISB1 0x02
984 #define _RB1 0x02
985 #define _TRISB2 0x04
986 #define _RB2 0x04
987 #define _TRISB3 0x08
988 #define _RB3 0x08
989 #define _TRISB4 0x10
990 #define _RB4 0x10
991 #define _TRISB5 0x20
992 #define _RB5 0x20
993 #define _TRISB6 0x40
994 #define _RB6 0x40
995 #define _TRISB7 0x80
996 #define _RB7 0x80
998 //==============================================================================
1001 //==============================================================================
1002 // TRISB Bits
1004 extern __at(0x0F93) __sfr TRISB;
1006 typedef union
1008 struct
1010 unsigned TRISB0 : 1;
1011 unsigned TRISB1 : 1;
1012 unsigned TRISB2 : 1;
1013 unsigned TRISB3 : 1;
1014 unsigned TRISB4 : 1;
1015 unsigned TRISB5 : 1;
1016 unsigned TRISB6 : 1;
1017 unsigned TRISB7 : 1;
1020 struct
1022 unsigned RB0 : 1;
1023 unsigned RB1 : 1;
1024 unsigned RB2 : 1;
1025 unsigned RB3 : 1;
1026 unsigned RB4 : 1;
1027 unsigned RB5 : 1;
1028 unsigned RB6 : 1;
1029 unsigned RB7 : 1;
1031 } __TRISBbits_t;
1033 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1035 #define _TRISB_TRISB0 0x01
1036 #define _TRISB_RB0 0x01
1037 #define _TRISB_TRISB1 0x02
1038 #define _TRISB_RB1 0x02
1039 #define _TRISB_TRISB2 0x04
1040 #define _TRISB_RB2 0x04
1041 #define _TRISB_TRISB3 0x08
1042 #define _TRISB_RB3 0x08
1043 #define _TRISB_TRISB4 0x10
1044 #define _TRISB_RB4 0x10
1045 #define _TRISB_TRISB5 0x20
1046 #define _TRISB_RB5 0x20
1047 #define _TRISB_TRISB6 0x40
1048 #define _TRISB_RB6 0x40
1049 #define _TRISB_TRISB7 0x80
1050 #define _TRISB_RB7 0x80
1052 //==============================================================================
1055 //==============================================================================
1056 // DDRC Bits
1058 extern __at(0x0F94) __sfr DDRC;
1060 typedef union
1062 struct
1064 unsigned TRISC0 : 1;
1065 unsigned TRISC1 : 1;
1066 unsigned TRISC2 : 1;
1067 unsigned TRISC3 : 1;
1068 unsigned TRISC4 : 1;
1069 unsigned TRISC5 : 1;
1070 unsigned TRISC6 : 1;
1071 unsigned TRISC7 : 1;
1074 struct
1076 unsigned RC0 : 1;
1077 unsigned RC1 : 1;
1078 unsigned RC2 : 1;
1079 unsigned RC3 : 1;
1080 unsigned RC4 : 1;
1081 unsigned RC5 : 1;
1082 unsigned RC6 : 1;
1083 unsigned RC7 : 1;
1085 } __DDRCbits_t;
1087 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1089 #define _TRISC0 0x01
1090 #define _RC0 0x01
1091 #define _TRISC1 0x02
1092 #define _RC1 0x02
1093 #define _TRISC2 0x04
1094 #define _RC2 0x04
1095 #define _TRISC3 0x08
1096 #define _RC3 0x08
1097 #define _TRISC4 0x10
1098 #define _RC4 0x10
1099 #define _TRISC5 0x20
1100 #define _RC5 0x20
1101 #define _TRISC6 0x40
1102 #define _RC6 0x40
1103 #define _TRISC7 0x80
1104 #define _RC7 0x80
1106 //==============================================================================
1109 //==============================================================================
1110 // TRISC Bits
1112 extern __at(0x0F94) __sfr TRISC;
1114 typedef union
1116 struct
1118 unsigned TRISC0 : 1;
1119 unsigned TRISC1 : 1;
1120 unsigned TRISC2 : 1;
1121 unsigned TRISC3 : 1;
1122 unsigned TRISC4 : 1;
1123 unsigned TRISC5 : 1;
1124 unsigned TRISC6 : 1;
1125 unsigned TRISC7 : 1;
1128 struct
1130 unsigned RC0 : 1;
1131 unsigned RC1 : 1;
1132 unsigned RC2 : 1;
1133 unsigned RC3 : 1;
1134 unsigned RC4 : 1;
1135 unsigned RC5 : 1;
1136 unsigned RC6 : 1;
1137 unsigned RC7 : 1;
1139 } __TRISCbits_t;
1141 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1143 #define _TRISC_TRISC0 0x01
1144 #define _TRISC_RC0 0x01
1145 #define _TRISC_TRISC1 0x02
1146 #define _TRISC_RC1 0x02
1147 #define _TRISC_TRISC2 0x04
1148 #define _TRISC_RC2 0x04
1149 #define _TRISC_TRISC3 0x08
1150 #define _TRISC_RC3 0x08
1151 #define _TRISC_TRISC4 0x10
1152 #define _TRISC_RC4 0x10
1153 #define _TRISC_TRISC5 0x20
1154 #define _TRISC_RC5 0x20
1155 #define _TRISC_TRISC6 0x40
1156 #define _TRISC_RC6 0x40
1157 #define _TRISC_TRISC7 0x80
1158 #define _TRISC_RC7 0x80
1160 //==============================================================================
1163 //==============================================================================
1164 // OSCTUNE Bits
1166 extern __at(0x0F9B) __sfr OSCTUNE;
1168 typedef union
1170 struct
1172 unsigned TUN0 : 1;
1173 unsigned TUN1 : 1;
1174 unsigned TUN2 : 1;
1175 unsigned TUN3 : 1;
1176 unsigned TUN4 : 1;
1177 unsigned TUN5 : 1;
1178 unsigned PLLEN : 1;
1179 unsigned INTSRC : 1;
1182 struct
1184 unsigned TUN : 6;
1185 unsigned : 2;
1187 } __OSCTUNEbits_t;
1189 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1191 #define _TUN0 0x01
1192 #define _TUN1 0x02
1193 #define _TUN2 0x04
1194 #define _TUN3 0x08
1195 #define _TUN4 0x10
1196 #define _TUN5 0x20
1197 #define _PLLEN 0x40
1198 #define _INTSRC 0x80
1200 //==============================================================================
1203 //==============================================================================
1204 // PIE1 Bits
1206 extern __at(0x0F9D) __sfr PIE1;
1208 typedef struct
1210 unsigned TMR1IE : 1;
1211 unsigned TMR2IE : 1;
1212 unsigned CCP1IE : 1;
1213 unsigned SSPIE : 1;
1214 unsigned TXIE : 1;
1215 unsigned RCIE : 1;
1216 unsigned ADIE : 1;
1217 unsigned : 1;
1218 } __PIE1bits_t;
1220 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1222 #define _TMR1IE 0x01
1223 #define _TMR2IE 0x02
1224 #define _CCP1IE 0x04
1225 #define _SSPIE 0x08
1226 #define _TXIE 0x10
1227 #define _RCIE 0x20
1228 #define _ADIE 0x40
1230 //==============================================================================
1233 //==============================================================================
1234 // PIR1 Bits
1236 extern __at(0x0F9E) __sfr PIR1;
1238 typedef struct
1240 unsigned TMR1IF : 1;
1241 unsigned TMR2IF : 1;
1242 unsigned CCP1IF : 1;
1243 unsigned SSPIF : 1;
1244 unsigned TXIF : 1;
1245 unsigned RCIF : 1;
1246 unsigned ADIF : 1;
1247 unsigned : 1;
1248 } __PIR1bits_t;
1250 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1252 #define _TMR1IF 0x01
1253 #define _TMR2IF 0x02
1254 #define _CCP1IF 0x04
1255 #define _SSPIF 0x08
1256 #define _TXIF 0x10
1257 #define _RCIF 0x20
1258 #define _ADIF 0x40
1260 //==============================================================================
1263 //==============================================================================
1264 // IPR1 Bits
1266 extern __at(0x0F9F) __sfr IPR1;
1268 typedef struct
1270 unsigned TMR1IP : 1;
1271 unsigned TMR2IP : 1;
1272 unsigned CCP1IP : 1;
1273 unsigned SSPIP : 1;
1274 unsigned TXIP : 1;
1275 unsigned RCIP : 1;
1276 unsigned ADIP : 1;
1277 unsigned : 1;
1278 } __IPR1bits_t;
1280 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1282 #define _TMR1IP 0x01
1283 #define _TMR2IP 0x02
1284 #define _CCP1IP 0x04
1285 #define _SSPIP 0x08
1286 #define _TXIP 0x10
1287 #define _RCIP 0x20
1288 #define _ADIP 0x40
1290 //==============================================================================
1293 //==============================================================================
1294 // PIE2 Bits
1296 extern __at(0x0FA0) __sfr PIE2;
1298 typedef union
1300 struct
1302 unsigned CCP2IE : 1;
1303 unsigned TMR3IE : 1;
1304 unsigned HLVDIE : 1;
1305 unsigned BCLIE : 1;
1306 unsigned EEIE : 1;
1307 unsigned C2IE : 1;
1308 unsigned C1IE : 1;
1309 unsigned OSCFIE : 1;
1312 struct
1314 unsigned : 1;
1315 unsigned : 1;
1316 unsigned LVDIE : 1;
1317 unsigned : 1;
1318 unsigned : 1;
1319 unsigned : 1;
1320 unsigned : 1;
1321 unsigned : 1;
1323 } __PIE2bits_t;
1325 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1327 #define _CCP2IE 0x01
1328 #define _TMR3IE 0x02
1329 #define _HLVDIE 0x04
1330 #define _LVDIE 0x04
1331 #define _BCLIE 0x08
1332 #define _EEIE 0x10
1333 #define _C2IE 0x20
1334 #define _C1IE 0x40
1335 #define _OSCFIE 0x80
1337 //==============================================================================
1340 //==============================================================================
1341 // PIR2 Bits
1343 extern __at(0x0FA1) __sfr PIR2;
1345 typedef union
1347 struct
1349 unsigned CCP2IF : 1;
1350 unsigned TMR3IF : 1;
1351 unsigned HLVDIF : 1;
1352 unsigned BCLIF : 1;
1353 unsigned EEIF : 1;
1354 unsigned C2IF : 1;
1355 unsigned C1IF : 1;
1356 unsigned OSCFIF : 1;
1359 struct
1361 unsigned : 1;
1362 unsigned : 1;
1363 unsigned LVDIF : 1;
1364 unsigned : 1;
1365 unsigned : 1;
1366 unsigned : 1;
1367 unsigned : 1;
1368 unsigned : 1;
1370 } __PIR2bits_t;
1372 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1374 #define _CCP2IF 0x01
1375 #define _TMR3IF 0x02
1376 #define _HLVDIF 0x04
1377 #define _LVDIF 0x04
1378 #define _BCLIF 0x08
1379 #define _EEIF 0x10
1380 #define _C2IF 0x20
1381 #define _C1IF 0x40
1382 #define _OSCFIF 0x80
1384 //==============================================================================
1387 //==============================================================================
1388 // IPR2 Bits
1390 extern __at(0x0FA2) __sfr IPR2;
1392 typedef union
1394 struct
1396 unsigned CCP2IP : 1;
1397 unsigned TMR3IP : 1;
1398 unsigned HLVDIP : 1;
1399 unsigned BCLIP : 1;
1400 unsigned EEIP : 1;
1401 unsigned C2IP : 1;
1402 unsigned C1IP : 1;
1403 unsigned OSCFIP : 1;
1406 struct
1408 unsigned : 1;
1409 unsigned : 1;
1410 unsigned LVDIP : 1;
1411 unsigned : 1;
1412 unsigned : 1;
1413 unsigned : 1;
1414 unsigned : 1;
1415 unsigned : 1;
1417 } __IPR2bits_t;
1419 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1421 #define _CCP2IP 0x01
1422 #define _TMR3IP 0x02
1423 #define _HLVDIP 0x04
1424 #define _LVDIP 0x04
1425 #define _BCLIP 0x08
1426 #define _EEIP 0x10
1427 #define _C2IP 0x20
1428 #define _C1IP 0x40
1429 #define _OSCFIP 0x80
1431 //==============================================================================
1434 //==============================================================================
1435 // EECON1 Bits
1437 extern __at(0x0FA6) __sfr EECON1;
1439 typedef struct
1441 unsigned RD : 1;
1442 unsigned WR : 1;
1443 unsigned WREN : 1;
1444 unsigned WRERR : 1;
1445 unsigned FREE : 1;
1446 unsigned : 1;
1447 unsigned CFGS : 1;
1448 unsigned EEPGD : 1;
1449 } __EECON1bits_t;
1451 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1453 #define _RD 0x01
1454 #define _WR 0x02
1455 #define _WREN 0x04
1456 #define _WRERR 0x08
1457 #define _FREE 0x10
1458 #define _CFGS 0x40
1459 #define _EEPGD 0x80
1461 //==============================================================================
1463 extern __at(0x0FA7) __sfr EECON2;
1464 extern __at(0x0FA8) __sfr EEDATA;
1466 //==============================================================================
1467 // EEADR Bits
1469 extern __at(0x0FA9) __sfr EEADR;
1471 typedef struct
1473 unsigned EEADR0 : 1;
1474 unsigned EEADR1 : 1;
1475 unsigned EEADR2 : 1;
1476 unsigned EEADR3 : 1;
1477 unsigned EEADR4 : 1;
1478 unsigned EEADR5 : 1;
1479 unsigned EEADR6 : 1;
1480 unsigned EEADR7 : 1;
1481 } __EEADRbits_t;
1483 extern __at(0x0FA9) volatile __EEADRbits_t EEADRbits;
1485 #define _EEADR0 0x01
1486 #define _EEADR1 0x02
1487 #define _EEADR2 0x04
1488 #define _EEADR3 0x08
1489 #define _EEADR4 0x10
1490 #define _EEADR5 0x20
1491 #define _EEADR6 0x40
1492 #define _EEADR7 0x80
1494 //==============================================================================
1497 //==============================================================================
1498 // RCSTA Bits
1500 extern __at(0x0FAB) __sfr RCSTA;
1502 typedef union
1504 struct
1506 unsigned RX9D : 1;
1507 unsigned OERR : 1;
1508 unsigned FERR : 1;
1509 unsigned ADDEN : 1;
1510 unsigned CREN : 1;
1511 unsigned SREN : 1;
1512 unsigned RX9 : 1;
1513 unsigned SPEN : 1;
1516 struct
1518 unsigned : 1;
1519 unsigned : 1;
1520 unsigned : 1;
1521 unsigned ADEN : 1;
1522 unsigned : 1;
1523 unsigned : 1;
1524 unsigned : 1;
1525 unsigned : 1;
1527 } __RCSTAbits_t;
1529 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1531 #define _RX9D 0x01
1532 #define _OERR 0x02
1533 #define _FERR 0x04
1534 #define _ADDEN 0x08
1535 #define _ADEN 0x08
1536 #define _CREN 0x10
1537 #define _SREN 0x20
1538 #define _RX9 0x40
1539 #define _SPEN 0x80
1541 //==============================================================================
1544 //==============================================================================
1545 // TXSTA Bits
1547 extern __at(0x0FAC) __sfr TXSTA;
1549 typedef struct
1551 unsigned TX9D : 1;
1552 unsigned TRMT : 1;
1553 unsigned BRGH : 1;
1554 unsigned SENDB : 1;
1555 unsigned SYNC : 1;
1556 unsigned TXEN : 1;
1557 unsigned TX9 : 1;
1558 unsigned CSRC : 1;
1559 } __TXSTAbits_t;
1561 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1563 #define _TX9D 0x01
1564 #define _TRMT 0x02
1565 #define _BRGH 0x04
1566 #define _SENDB 0x08
1567 #define _SYNC 0x10
1568 #define _TXEN 0x20
1569 #define _TX9 0x40
1570 #define _CSRC 0x80
1572 //==============================================================================
1574 extern __at(0x0FAD) __sfr TXREG;
1575 extern __at(0x0FAE) __sfr RCREG;
1576 extern __at(0x0FAF) __sfr SPBRG;
1577 extern __at(0x0FB0) __sfr SPBRGH;
1579 //==============================================================================
1580 // T3CON Bits
1582 extern __at(0x0FB1) __sfr T3CON;
1584 typedef union
1586 struct
1588 unsigned TMR3ON : 1;
1589 unsigned TMR3CS : 1;
1590 unsigned NOT_T3SYNC : 1;
1591 unsigned T3CCP1 : 1;
1592 unsigned T3CKPS0 : 1;
1593 unsigned T3CKPS1 : 1;
1594 unsigned T3CCP2 : 1;
1595 unsigned RD16 : 1;
1598 struct
1600 unsigned : 1;
1601 unsigned : 1;
1602 unsigned T3SYNC : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1605 unsigned : 1;
1606 unsigned : 1;
1607 unsigned : 1;
1610 struct
1612 unsigned : 4;
1613 unsigned T3CKPS : 2;
1614 unsigned : 2;
1616 } __T3CONbits_t;
1618 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1620 #define _T3CON_TMR3ON 0x01
1621 #define _T3CON_TMR3CS 0x02
1622 #define _T3CON_NOT_T3SYNC 0x04
1623 #define _T3CON_T3SYNC 0x04
1624 #define _T3CON_T3CCP1 0x08
1625 #define _T3CON_T3CKPS0 0x10
1626 #define _T3CON_T3CKPS1 0x20
1627 #define _T3CON_T3CCP2 0x40
1628 #define _T3CON_RD16 0x80
1630 //==============================================================================
1632 extern __at(0x0FB2) __sfr TMR3;
1633 extern __at(0x0FB2) __sfr TMR3L;
1634 extern __at(0x0FB3) __sfr TMR3H;
1636 //==============================================================================
1637 // CVRCON2 Bits
1639 extern __at(0x0FB4) __sfr CVRCON2;
1641 typedef struct
1643 unsigned : 1;
1644 unsigned : 1;
1645 unsigned : 1;
1646 unsigned : 1;
1647 unsigned : 1;
1648 unsigned : 1;
1649 unsigned FVRST : 1;
1650 unsigned FVREN : 1;
1651 } __CVRCON2bits_t;
1653 extern __at(0x0FB4) volatile __CVRCON2bits_t CVRCON2bits;
1655 #define _FVRST 0x40
1656 #define _FVREN 0x80
1658 //==============================================================================
1661 //==============================================================================
1662 // CVRCON Bits
1664 extern __at(0x0FB5) __sfr CVRCON;
1666 typedef union
1668 struct
1670 unsigned CVR0 : 1;
1671 unsigned CVR1 : 1;
1672 unsigned CVR2 : 1;
1673 unsigned CVR3 : 1;
1674 unsigned CVRSS : 1;
1675 unsigned CVRR : 1;
1676 unsigned CVROE : 1;
1677 unsigned CVREN : 1;
1680 struct
1682 unsigned CVR : 4;
1683 unsigned : 4;
1685 } __CVRCONbits_t;
1687 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1689 #define _CVR0 0x01
1690 #define _CVR1 0x02
1691 #define _CVR2 0x04
1692 #define _CVR3 0x08
1693 #define _CVRSS 0x10
1694 #define _CVRR 0x20
1695 #define _CVROE 0x40
1696 #define _CVREN 0x80
1698 //==============================================================================
1701 //==============================================================================
1702 // ECCP1AS Bits
1704 extern __at(0x0FB6) __sfr ECCP1AS;
1706 typedef union
1708 struct
1710 unsigned PSSBD0 : 1;
1711 unsigned PSSBD1 : 1;
1712 unsigned PSSAC0 : 1;
1713 unsigned PSSAC1 : 1;
1714 unsigned ECCPAS0 : 1;
1715 unsigned ECCPAS1 : 1;
1716 unsigned ECCPAS2 : 1;
1717 unsigned ECCPASE : 1;
1720 struct
1722 unsigned PSSBD : 2;
1723 unsigned : 6;
1726 struct
1728 unsigned : 2;
1729 unsigned PSSAC : 2;
1730 unsigned : 4;
1733 struct
1735 unsigned : 4;
1736 unsigned ECCPAS : 3;
1737 unsigned : 1;
1739 } __ECCP1ASbits_t;
1741 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1743 #define _PSSBD0 0x01
1744 #define _PSSBD1 0x02
1745 #define _PSSAC0 0x04
1746 #define _PSSAC1 0x08
1747 #define _ECCPAS0 0x10
1748 #define _ECCPAS1 0x20
1749 #define _ECCPAS2 0x40
1750 #define _ECCPASE 0x80
1752 //==============================================================================
1755 //==============================================================================
1756 // PWM1CON Bits
1758 extern __at(0x0FB7) __sfr PWM1CON;
1760 typedef union
1762 struct
1764 unsigned PDC0 : 1;
1765 unsigned PDC1 : 1;
1766 unsigned PDC2 : 1;
1767 unsigned PDC3 : 1;
1768 unsigned PDC4 : 1;
1769 unsigned PDC5 : 1;
1770 unsigned PDC6 : 1;
1771 unsigned PRSEN : 1;
1774 struct
1776 unsigned PDC : 7;
1777 unsigned : 1;
1779 } __PWM1CONbits_t;
1781 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1783 #define _PDC0 0x01
1784 #define _PDC1 0x02
1785 #define _PDC2 0x04
1786 #define _PDC3 0x08
1787 #define _PDC4 0x10
1788 #define _PDC5 0x20
1789 #define _PDC6 0x40
1790 #define _PRSEN 0x80
1792 //==============================================================================
1795 //==============================================================================
1796 // BAUDCON Bits
1798 extern __at(0x0FB8) __sfr BAUDCON;
1800 typedef union
1802 struct
1804 unsigned ABDEN : 1;
1805 unsigned WUE : 1;
1806 unsigned : 1;
1807 unsigned BRG16 : 1;
1808 unsigned CKTXP : 1;
1809 unsigned DTRXP : 1;
1810 unsigned RCIDL : 1;
1811 unsigned ABDOVF : 1;
1814 struct
1816 unsigned : 1;
1817 unsigned : 1;
1818 unsigned : 1;
1819 unsigned : 1;
1820 unsigned SCKP : 1;
1821 unsigned : 1;
1822 unsigned : 1;
1823 unsigned : 1;
1825 } __BAUDCONbits_t;
1827 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1829 #define _ABDEN 0x01
1830 #define _WUE 0x02
1831 #define _BRG16 0x08
1832 #define _CKTXP 0x10
1833 #define _SCKP 0x10
1834 #define _DTRXP 0x20
1835 #define _RCIDL 0x40
1836 #define _ABDOVF 0x80
1838 //==============================================================================
1841 //==============================================================================
1842 // BAUDCTL Bits
1844 extern __at(0x0FB8) __sfr BAUDCTL;
1846 typedef union
1848 struct
1850 unsigned ABDEN : 1;
1851 unsigned WUE : 1;
1852 unsigned : 1;
1853 unsigned BRG16 : 1;
1854 unsigned CKTXP : 1;
1855 unsigned DTRXP : 1;
1856 unsigned RCIDL : 1;
1857 unsigned ABDOVF : 1;
1860 struct
1862 unsigned : 1;
1863 unsigned : 1;
1864 unsigned : 1;
1865 unsigned : 1;
1866 unsigned SCKP : 1;
1867 unsigned : 1;
1868 unsigned : 1;
1869 unsigned : 1;
1871 } __BAUDCTLbits_t;
1873 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1875 #define _BAUDCTL_ABDEN 0x01
1876 #define _BAUDCTL_WUE 0x02
1877 #define _BAUDCTL_BRG16 0x08
1878 #define _BAUDCTL_CKTXP 0x10
1879 #define _BAUDCTL_SCKP 0x10
1880 #define _BAUDCTL_DTRXP 0x20
1881 #define _BAUDCTL_RCIDL 0x40
1882 #define _BAUDCTL_ABDOVF 0x80
1884 //==============================================================================
1887 //==============================================================================
1888 // PSTRCON Bits
1890 extern __at(0x0FB9) __sfr PSTRCON;
1892 typedef struct
1894 unsigned STRA : 1;
1895 unsigned STRB : 1;
1896 unsigned STRC : 1;
1897 unsigned STRD : 1;
1898 unsigned STRSYNC : 1;
1899 unsigned : 1;
1900 unsigned : 1;
1901 unsigned : 1;
1902 } __PSTRCONbits_t;
1904 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1906 #define _STRA 0x01
1907 #define _STRB 0x02
1908 #define _STRC 0x04
1909 #define _STRD 0x08
1910 #define _STRSYNC 0x10
1912 //==============================================================================
1915 //==============================================================================
1916 // CCP2CON Bits
1918 extern __at(0x0FBA) __sfr CCP2CON;
1920 typedef union
1922 struct
1924 unsigned CCP2M0 : 1;
1925 unsigned CCP2M1 : 1;
1926 unsigned CCP2M2 : 1;
1927 unsigned CCP2M3 : 1;
1928 unsigned DC2B0 : 1;
1929 unsigned DC2B1 : 1;
1930 unsigned : 1;
1931 unsigned : 1;
1934 struct
1936 unsigned CCP2M : 4;
1937 unsigned : 4;
1940 struct
1942 unsigned : 4;
1943 unsigned DC2B : 2;
1944 unsigned : 2;
1946 } __CCP2CONbits_t;
1948 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1950 #define _CCP2M0 0x01
1951 #define _CCP2M1 0x02
1952 #define _CCP2M2 0x04
1953 #define _CCP2M3 0x08
1954 #define _DC2B0 0x10
1955 #define _DC2B1 0x20
1957 //==============================================================================
1959 extern __at(0x0FBB) __sfr CCPR2;
1960 extern __at(0x0FBB) __sfr CCPR2L;
1961 extern __at(0x0FBC) __sfr CCPR2H;
1963 //==============================================================================
1964 // CCP1CON Bits
1966 extern __at(0x0FBD) __sfr CCP1CON;
1968 typedef union
1970 struct
1972 unsigned CCP1M0 : 1;
1973 unsigned CCP1M1 : 1;
1974 unsigned CCP1M2 : 1;
1975 unsigned CCP1M3 : 1;
1976 unsigned DC1B0 : 1;
1977 unsigned DC1B1 : 1;
1978 unsigned P1M0 : 1;
1979 unsigned P1M1 : 1;
1982 struct
1984 unsigned CCP1M : 4;
1985 unsigned : 4;
1988 struct
1990 unsigned : 4;
1991 unsigned DC1B : 2;
1992 unsigned : 2;
1995 struct
1997 unsigned : 6;
1998 unsigned P1M : 2;
2000 } __CCP1CONbits_t;
2002 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2004 #define _CCP1M0 0x01
2005 #define _CCP1M1 0x02
2006 #define _CCP1M2 0x04
2007 #define _CCP1M3 0x08
2008 #define _DC1B0 0x10
2009 #define _DC1B1 0x20
2010 #define _P1M0 0x40
2011 #define _P1M1 0x80
2013 //==============================================================================
2015 extern __at(0x0FBE) __sfr CCPR1;
2016 extern __at(0x0FBE) __sfr CCPR1L;
2017 extern __at(0x0FBF) __sfr CCPR1H;
2019 //==============================================================================
2020 // ADCON2 Bits
2022 extern __at(0x0FC0) __sfr ADCON2;
2024 typedef union
2026 struct
2028 unsigned ADCS0 : 1;
2029 unsigned ADCS1 : 1;
2030 unsigned ADCS2 : 1;
2031 unsigned ACQT0 : 1;
2032 unsigned ACQT1 : 1;
2033 unsigned ACQT2 : 1;
2034 unsigned : 1;
2035 unsigned ADFM : 1;
2038 struct
2040 unsigned ADCS : 3;
2041 unsigned : 5;
2044 struct
2046 unsigned : 3;
2047 unsigned ACQT : 3;
2048 unsigned : 2;
2050 } __ADCON2bits_t;
2052 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2054 #define _ADCS0 0x01
2055 #define _ADCS1 0x02
2056 #define _ADCS2 0x04
2057 #define _ACQT0 0x08
2058 #define _ACQT1 0x10
2059 #define _ACQT2 0x20
2060 #define _ADFM 0x80
2062 //==============================================================================
2065 //==============================================================================
2066 // ADCON1 Bits
2068 extern __at(0x0FC1) __sfr ADCON1;
2070 typedef union
2072 struct
2074 unsigned : 1;
2075 unsigned : 1;
2076 unsigned : 1;
2077 unsigned : 1;
2078 unsigned VCFG0 : 1;
2079 unsigned VCFG1 : 1;
2080 unsigned : 1;
2081 unsigned : 1;
2084 struct
2086 unsigned : 4;
2087 unsigned VCFG : 2;
2088 unsigned : 2;
2090 } __ADCON1bits_t;
2092 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2094 #define _VCFG0 0x10
2095 #define _VCFG1 0x20
2097 //==============================================================================
2100 //==============================================================================
2101 // ADCON0 Bits
2103 extern __at(0x0FC2) __sfr ADCON0;
2105 typedef union
2107 struct
2109 unsigned ADON : 1;
2110 unsigned GO_NOT_DONE : 1;
2111 unsigned CHS0 : 1;
2112 unsigned CHS1 : 1;
2113 unsigned CHS2 : 1;
2114 unsigned CHS3 : 1;
2115 unsigned : 1;
2116 unsigned : 1;
2119 struct
2121 unsigned : 1;
2122 unsigned DONE : 1;
2123 unsigned : 1;
2124 unsigned : 1;
2125 unsigned : 1;
2126 unsigned : 1;
2127 unsigned : 1;
2128 unsigned : 1;
2131 struct
2133 unsigned : 1;
2134 unsigned NOT_DONE : 1;
2135 unsigned : 1;
2136 unsigned : 1;
2137 unsigned : 1;
2138 unsigned : 1;
2139 unsigned : 1;
2140 unsigned : 1;
2143 struct
2145 unsigned : 1;
2146 unsigned GO_DONE : 1;
2147 unsigned : 1;
2148 unsigned : 1;
2149 unsigned : 1;
2150 unsigned : 1;
2151 unsigned : 1;
2152 unsigned : 1;
2155 struct
2157 unsigned : 1;
2158 unsigned GO : 1;
2159 unsigned : 1;
2160 unsigned : 1;
2161 unsigned : 1;
2162 unsigned : 1;
2163 unsigned : 1;
2164 unsigned : 1;
2167 struct
2169 unsigned : 2;
2170 unsigned CHS : 4;
2171 unsigned : 2;
2173 } __ADCON0bits_t;
2175 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2177 #define _ADON 0x01
2178 #define _GO_NOT_DONE 0x02
2179 #define _DONE 0x02
2180 #define _NOT_DONE 0x02
2181 #define _GO_DONE 0x02
2182 #define _GO 0x02
2183 #define _CHS0 0x04
2184 #define _CHS1 0x08
2185 #define _CHS2 0x10
2186 #define _CHS3 0x20
2188 //==============================================================================
2190 extern __at(0x0FC3) __sfr ADRES;
2191 extern __at(0x0FC3) __sfr ADRESL;
2192 extern __at(0x0FC4) __sfr ADRESH;
2194 //==============================================================================
2195 // SSPCON2 Bits
2197 extern __at(0x0FC5) __sfr SSPCON2;
2199 typedef struct
2201 unsigned SEN : 1;
2202 unsigned RSEN : 1;
2203 unsigned PEN : 1;
2204 unsigned RCEN : 1;
2205 unsigned ACKEN : 1;
2206 unsigned ACKDT : 1;
2207 unsigned ACKSTAT : 1;
2208 unsigned GCEN : 1;
2209 } __SSPCON2bits_t;
2211 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2213 #define _SEN 0x01
2214 #define _RSEN 0x02
2215 #define _PEN 0x04
2216 #define _RCEN 0x08
2217 #define _ACKEN 0x10
2218 #define _ACKDT 0x20
2219 #define _ACKSTAT 0x40
2220 #define _GCEN 0x80
2222 //==============================================================================
2225 //==============================================================================
2226 // SSPCON1 Bits
2228 extern __at(0x0FC6) __sfr SSPCON1;
2230 typedef union
2232 struct
2234 unsigned SSPM0 : 1;
2235 unsigned SSPM1 : 1;
2236 unsigned SSPM2 : 1;
2237 unsigned SSPM3 : 1;
2238 unsigned CKP : 1;
2239 unsigned SSPEN : 1;
2240 unsigned SSPOV : 1;
2241 unsigned WCOL : 1;
2244 struct
2246 unsigned SSPM : 4;
2247 unsigned : 4;
2249 } __SSPCON1bits_t;
2251 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2253 #define _SSPM0 0x01
2254 #define _SSPM1 0x02
2255 #define _SSPM2 0x04
2256 #define _SSPM3 0x08
2257 #define _CKP 0x10
2258 #define _SSPEN 0x20
2259 #define _SSPOV 0x40
2260 #define _WCOL 0x80
2262 //==============================================================================
2265 //==============================================================================
2266 // SSPSTAT Bits
2268 extern __at(0x0FC7) __sfr SSPSTAT;
2270 typedef union
2272 struct
2274 unsigned BF : 1;
2275 unsigned UA : 1;
2276 unsigned R_NOT_W : 1;
2277 unsigned S : 1;
2278 unsigned P : 1;
2279 unsigned D_NOT_A : 1;
2280 unsigned CKE : 1;
2281 unsigned SMP : 1;
2284 struct
2286 unsigned : 1;
2287 unsigned : 1;
2288 unsigned R : 1;
2289 unsigned START : 1;
2290 unsigned STOP : 1;
2291 unsigned D : 1;
2292 unsigned : 1;
2293 unsigned : 1;
2296 struct
2298 unsigned : 1;
2299 unsigned : 1;
2300 unsigned NOT_W : 1;
2301 unsigned : 1;
2302 unsigned : 1;
2303 unsigned NOT_A : 1;
2304 unsigned : 1;
2305 unsigned : 1;
2308 struct
2310 unsigned : 1;
2311 unsigned : 1;
2312 unsigned R_W : 1;
2313 unsigned : 1;
2314 unsigned : 1;
2315 unsigned D_A : 1;
2316 unsigned : 1;
2317 unsigned : 1;
2320 struct
2322 unsigned : 1;
2323 unsigned : 1;
2324 unsigned NOT_WRITE : 1;
2325 unsigned : 1;
2326 unsigned : 1;
2327 unsigned NOT_ADDRESS : 1;
2328 unsigned : 1;
2329 unsigned : 1;
2331 } __SSPSTATbits_t;
2333 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2335 #define _BF 0x01
2336 #define _UA 0x02
2337 #define _R_NOT_W 0x04
2338 #define _R 0x04
2339 #define _NOT_W 0x04
2340 #define _R_W 0x04
2341 #define _NOT_WRITE 0x04
2342 #define _S 0x08
2343 #define _START 0x08
2344 #define _P 0x10
2345 #define _STOP 0x10
2346 #define _D_NOT_A 0x20
2347 #define _D 0x20
2348 #define _NOT_A 0x20
2349 #define _D_A 0x20
2350 #define _NOT_ADDRESS 0x20
2351 #define _CKE 0x40
2352 #define _SMP 0x80
2354 //==============================================================================
2356 extern __at(0x0FC8) __sfr SSPADD;
2357 extern __at(0x0FC9) __sfr SSPBUF;
2359 //==============================================================================
2360 // T2CON Bits
2362 extern __at(0x0FCA) __sfr T2CON;
2364 typedef union
2366 struct
2368 unsigned T2CKPS0 : 1;
2369 unsigned T2CKPS1 : 1;
2370 unsigned TMR2ON : 1;
2371 unsigned T2OUTPS0 : 1;
2372 unsigned T2OUTPS1 : 1;
2373 unsigned T2OUTPS2 : 1;
2374 unsigned T2OUTPS3 : 1;
2375 unsigned : 1;
2378 struct
2380 unsigned T2CKPS : 2;
2381 unsigned : 6;
2384 struct
2386 unsigned : 3;
2387 unsigned T2OUTPS : 4;
2388 unsigned : 1;
2390 } __T2CONbits_t;
2392 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2394 #define _T2CKPS0 0x01
2395 #define _T2CKPS1 0x02
2396 #define _TMR2ON 0x04
2397 #define _T2OUTPS0 0x08
2398 #define _T2OUTPS1 0x10
2399 #define _T2OUTPS2 0x20
2400 #define _T2OUTPS3 0x40
2402 //==============================================================================
2404 extern __at(0x0FCB) __sfr PR2;
2405 extern __at(0x0FCC) __sfr TMR2;
2407 //==============================================================================
2408 // T1CON Bits
2410 extern __at(0x0FCD) __sfr T1CON;
2412 typedef union
2414 struct
2416 unsigned TMR1ON : 1;
2417 unsigned TMR1CS : 1;
2418 unsigned NOT_T1SYNC : 1;
2419 unsigned T1OSCEN : 1;
2420 unsigned T1CKPS0 : 1;
2421 unsigned T1CKPS1 : 1;
2422 unsigned T1RUN : 1;
2423 unsigned RD16 : 1;
2426 struct
2428 unsigned : 1;
2429 unsigned : 1;
2430 unsigned T1SYNC : 1;
2431 unsigned : 1;
2432 unsigned : 1;
2433 unsigned : 1;
2434 unsigned : 1;
2435 unsigned : 1;
2438 struct
2440 unsigned : 4;
2441 unsigned T1CKPS : 2;
2442 unsigned : 2;
2444 } __T1CONbits_t;
2446 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2448 #define _TMR1ON 0x01
2449 #define _TMR1CS 0x02
2450 #define _NOT_T1SYNC 0x04
2451 #define _T1SYNC 0x04
2452 #define _T1OSCEN 0x08
2453 #define _T1CKPS0 0x10
2454 #define _T1CKPS1 0x20
2455 #define _T1RUN 0x40
2456 #define _RD16 0x80
2458 //==============================================================================
2460 extern __at(0x0FCE) __sfr TMR1;
2461 extern __at(0x0FCE) __sfr TMR1L;
2462 extern __at(0x0FCF) __sfr TMR1H;
2464 //==============================================================================
2465 // RCON Bits
2467 extern __at(0x0FD0) __sfr RCON;
2469 typedef union
2471 struct
2473 unsigned NOT_BOR : 1;
2474 unsigned NOT_POR : 1;
2475 unsigned NOT_PD : 1;
2476 unsigned NOT_TO : 1;
2477 unsigned NOT_RI : 1;
2478 unsigned : 1;
2479 unsigned SBOREN : 1;
2480 unsigned IPEN : 1;
2483 struct
2485 unsigned BOR : 1;
2486 unsigned POR : 1;
2487 unsigned PD : 1;
2488 unsigned TO : 1;
2489 unsigned RI : 1;
2490 unsigned : 1;
2491 unsigned : 1;
2492 unsigned : 1;
2494 } __RCONbits_t;
2496 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2498 #define _NOT_BOR 0x01
2499 #define _BOR 0x01
2500 #define _NOT_POR 0x02
2501 #define _POR 0x02
2502 #define _NOT_PD 0x04
2503 #define _PD 0x04
2504 #define _NOT_TO 0x08
2505 #define _TO 0x08
2506 #define _NOT_RI 0x10
2507 #define _RI 0x10
2508 #define _SBOREN 0x40
2509 #define _IPEN 0x80
2511 //==============================================================================
2514 //==============================================================================
2515 // WDTCON Bits
2517 extern __at(0x0FD1) __sfr WDTCON;
2519 typedef union
2521 struct
2523 unsigned SWDTEN : 1;
2524 unsigned : 1;
2525 unsigned : 1;
2526 unsigned : 1;
2527 unsigned : 1;
2528 unsigned : 1;
2529 unsigned : 1;
2530 unsigned : 1;
2533 struct
2535 unsigned SWDTE : 1;
2536 unsigned : 1;
2537 unsigned : 1;
2538 unsigned : 1;
2539 unsigned : 1;
2540 unsigned : 1;
2541 unsigned : 1;
2542 unsigned : 1;
2544 } __WDTCONbits_t;
2546 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2548 #define _SWDTEN 0x01
2549 #define _SWDTE 0x01
2551 //==============================================================================
2554 //==============================================================================
2555 // HLVDCON Bits
2557 extern __at(0x0FD2) __sfr HLVDCON;
2559 typedef union
2561 struct
2563 unsigned HLVDL0 : 1;
2564 unsigned HLVDL1 : 1;
2565 unsigned HLVDL2 : 1;
2566 unsigned HLVDL3 : 1;
2567 unsigned HLVDEN : 1;
2568 unsigned IRVST : 1;
2569 unsigned : 1;
2570 unsigned VDIRMAG : 1;
2573 struct
2575 unsigned LVDL0 : 1;
2576 unsigned LVDL1 : 1;
2577 unsigned LVDL2 : 1;
2578 unsigned LVDL3 : 1;
2579 unsigned LVDEN : 1;
2580 unsigned IVRST : 1;
2581 unsigned : 1;
2582 unsigned : 1;
2585 struct
2587 unsigned LVV0 : 1;
2588 unsigned LVV1 : 1;
2589 unsigned LVV2 : 1;
2590 unsigned LVV3 : 1;
2591 unsigned : 1;
2592 unsigned BGST : 1;
2593 unsigned : 1;
2594 unsigned : 1;
2597 struct
2599 unsigned LVV : 4;
2600 unsigned : 4;
2603 struct
2605 unsigned LVDL : 4;
2606 unsigned : 4;
2609 struct
2611 unsigned HLVDL : 4;
2612 unsigned : 4;
2614 } __HLVDCONbits_t;
2616 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2618 #define _HLVDL0 0x01
2619 #define _LVDL0 0x01
2620 #define _LVV0 0x01
2621 #define _HLVDL1 0x02
2622 #define _LVDL1 0x02
2623 #define _LVV1 0x02
2624 #define _HLVDL2 0x04
2625 #define _LVDL2 0x04
2626 #define _LVV2 0x04
2627 #define _HLVDL3 0x08
2628 #define _LVDL3 0x08
2629 #define _LVV3 0x08
2630 #define _HLVDEN 0x10
2631 #define _LVDEN 0x10
2632 #define _IRVST 0x20
2633 #define _IVRST 0x20
2634 #define _BGST 0x20
2635 #define _VDIRMAG 0x80
2637 //==============================================================================
2640 //==============================================================================
2641 // LVDCON Bits
2643 extern __at(0x0FD2) __sfr LVDCON;
2645 typedef union
2647 struct
2649 unsigned HLVDL0 : 1;
2650 unsigned HLVDL1 : 1;
2651 unsigned HLVDL2 : 1;
2652 unsigned HLVDL3 : 1;
2653 unsigned HLVDEN : 1;
2654 unsigned IRVST : 1;
2655 unsigned : 1;
2656 unsigned VDIRMAG : 1;
2659 struct
2661 unsigned LVDL0 : 1;
2662 unsigned LVDL1 : 1;
2663 unsigned LVDL2 : 1;
2664 unsigned LVDL3 : 1;
2665 unsigned LVDEN : 1;
2666 unsigned IVRST : 1;
2667 unsigned : 1;
2668 unsigned : 1;
2671 struct
2673 unsigned LVV0 : 1;
2674 unsigned LVV1 : 1;
2675 unsigned LVV2 : 1;
2676 unsigned LVV3 : 1;
2677 unsigned : 1;
2678 unsigned BGST : 1;
2679 unsigned : 1;
2680 unsigned : 1;
2683 struct
2685 unsigned HLVDL : 4;
2686 unsigned : 4;
2689 struct
2691 unsigned LVV : 4;
2692 unsigned : 4;
2695 struct
2697 unsigned LVDL : 4;
2698 unsigned : 4;
2700 } __LVDCONbits_t;
2702 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2704 #define _LVDCON_HLVDL0 0x01
2705 #define _LVDCON_LVDL0 0x01
2706 #define _LVDCON_LVV0 0x01
2707 #define _LVDCON_HLVDL1 0x02
2708 #define _LVDCON_LVDL1 0x02
2709 #define _LVDCON_LVV1 0x02
2710 #define _LVDCON_HLVDL2 0x04
2711 #define _LVDCON_LVDL2 0x04
2712 #define _LVDCON_LVV2 0x04
2713 #define _LVDCON_HLVDL3 0x08
2714 #define _LVDCON_LVDL3 0x08
2715 #define _LVDCON_LVV3 0x08
2716 #define _LVDCON_HLVDEN 0x10
2717 #define _LVDCON_LVDEN 0x10
2718 #define _LVDCON_IRVST 0x20
2719 #define _LVDCON_IVRST 0x20
2720 #define _LVDCON_BGST 0x20
2721 #define _LVDCON_VDIRMAG 0x80
2723 //==============================================================================
2726 //==============================================================================
2727 // OSCCON Bits
2729 extern __at(0x0FD3) __sfr OSCCON;
2731 typedef union
2733 struct
2735 unsigned SCS0 : 1;
2736 unsigned SCS1 : 1;
2737 unsigned IOFS : 1;
2738 unsigned OSTS : 1;
2739 unsigned IRCF0 : 1;
2740 unsigned IRCF1 : 1;
2741 unsigned IRCF2 : 1;
2742 unsigned IDLEN : 1;
2745 struct
2747 unsigned SCS : 2;
2748 unsigned : 6;
2751 struct
2753 unsigned : 4;
2754 unsigned IRCF : 3;
2755 unsigned : 1;
2757 } __OSCCONbits_t;
2759 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2761 #define _SCS0 0x01
2762 #define _SCS1 0x02
2763 #define _IOFS 0x04
2764 #define _OSTS 0x08
2765 #define _IRCF0 0x10
2766 #define _IRCF1 0x20
2767 #define _IRCF2 0x40
2768 #define _IDLEN 0x80
2770 //==============================================================================
2773 //==============================================================================
2774 // T0CON Bits
2776 extern __at(0x0FD5) __sfr T0CON;
2778 typedef union
2780 struct
2782 unsigned T0PS0 : 1;
2783 unsigned T0PS1 : 1;
2784 unsigned T0PS2 : 1;
2785 unsigned PSA : 1;
2786 unsigned T0SE : 1;
2787 unsigned T0CS : 1;
2788 unsigned T08BIT : 1;
2789 unsigned TMR0ON : 1;
2792 struct
2794 unsigned T0PS : 3;
2795 unsigned : 5;
2797 } __T0CONbits_t;
2799 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2801 #define _T0PS0 0x01
2802 #define _T0PS1 0x02
2803 #define _T0PS2 0x04
2804 #define _PSA 0x08
2805 #define _T0SE 0x10
2806 #define _T0CS 0x20
2807 #define _T08BIT 0x40
2808 #define _TMR0ON 0x80
2810 //==============================================================================
2812 extern __at(0x0FD6) __sfr TMR0;
2813 extern __at(0x0FD6) __sfr TMR0L;
2814 extern __at(0x0FD7) __sfr TMR0H;
2816 //==============================================================================
2817 // STATUS Bits
2819 extern __at(0x0FD8) __sfr STATUS;
2821 typedef struct
2823 unsigned C : 1;
2824 unsigned DC : 1;
2825 unsigned Z : 1;
2826 unsigned OV : 1;
2827 unsigned N : 1;
2828 unsigned : 1;
2829 unsigned : 1;
2830 unsigned : 1;
2831 } __STATUSbits_t;
2833 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2835 #define _C 0x01
2836 #define _DC 0x02
2837 #define _Z 0x04
2838 #define _OV 0x08
2839 #define _N 0x10
2841 //==============================================================================
2843 extern __at(0x0FD9) __sfr FSR2L;
2844 extern __at(0x0FDA) __sfr FSR2H;
2845 extern __at(0x0FDB) __sfr PLUSW2;
2846 extern __at(0x0FDC) __sfr PREINC2;
2847 extern __at(0x0FDD) __sfr POSTDEC2;
2848 extern __at(0x0FDE) __sfr POSTINC2;
2849 extern __at(0x0FDF) __sfr INDF2;
2850 extern __at(0x0FE0) __sfr BSR;
2851 extern __at(0x0FE1) __sfr FSR1L;
2852 extern __at(0x0FE2) __sfr FSR1H;
2853 extern __at(0x0FE3) __sfr PLUSW1;
2854 extern __at(0x0FE4) __sfr PREINC1;
2855 extern __at(0x0FE5) __sfr POSTDEC1;
2856 extern __at(0x0FE6) __sfr POSTINC1;
2857 extern __at(0x0FE7) __sfr INDF1;
2858 extern __at(0x0FE8) __sfr WREG;
2859 extern __at(0x0FE9) __sfr FSR0L;
2860 extern __at(0x0FEA) __sfr FSR0H;
2861 extern __at(0x0FEB) __sfr PLUSW0;
2862 extern __at(0x0FEC) __sfr PREINC0;
2863 extern __at(0x0FED) __sfr POSTDEC0;
2864 extern __at(0x0FEE) __sfr POSTINC0;
2865 extern __at(0x0FEF) __sfr INDF0;
2867 //==============================================================================
2868 // INTCON3 Bits
2870 extern __at(0x0FF0) __sfr INTCON3;
2872 typedef union
2874 struct
2876 unsigned INT1IF : 1;
2877 unsigned INT2IF : 1;
2878 unsigned : 1;
2879 unsigned INT1IE : 1;
2880 unsigned INT2IE : 1;
2881 unsigned : 1;
2882 unsigned INT1IP : 1;
2883 unsigned INT2IP : 1;
2886 struct
2888 unsigned INT1F : 1;
2889 unsigned INT2F : 1;
2890 unsigned : 1;
2891 unsigned INT1E : 1;
2892 unsigned INT2E : 1;
2893 unsigned : 1;
2894 unsigned INT1P : 1;
2895 unsigned INT2P : 1;
2897 } __INTCON3bits_t;
2899 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2901 #define _INT1IF 0x01
2902 #define _INT1F 0x01
2903 #define _INT2IF 0x02
2904 #define _INT2F 0x02
2905 #define _INT1IE 0x08
2906 #define _INT1E 0x08
2907 #define _INT2IE 0x10
2908 #define _INT2E 0x10
2909 #define _INT1IP 0x40
2910 #define _INT1P 0x40
2911 #define _INT2IP 0x80
2912 #define _INT2P 0x80
2914 //==============================================================================
2917 //==============================================================================
2918 // INTCON2 Bits
2920 extern __at(0x0FF1) __sfr INTCON2;
2922 typedef union
2924 struct
2926 unsigned RBIP : 1;
2927 unsigned : 1;
2928 unsigned TMR0IP : 1;
2929 unsigned : 1;
2930 unsigned INTEDG2 : 1;
2931 unsigned INTEDG1 : 1;
2932 unsigned INTEDG0 : 1;
2933 unsigned NOT_RBPU : 1;
2936 struct
2938 unsigned : 1;
2939 unsigned : 1;
2940 unsigned : 1;
2941 unsigned : 1;
2942 unsigned : 1;
2943 unsigned : 1;
2944 unsigned : 1;
2945 unsigned RBPU : 1;
2947 } __INTCON2bits_t;
2949 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2951 #define _RBIP 0x01
2952 #define _TMR0IP 0x04
2953 #define _INTEDG2 0x10
2954 #define _INTEDG1 0x20
2955 #define _INTEDG0 0x40
2956 #define _NOT_RBPU 0x80
2957 #define _RBPU 0x80
2959 //==============================================================================
2962 //==============================================================================
2963 // INTCON Bits
2965 extern __at(0x0FF2) __sfr INTCON;
2967 typedef union
2969 struct
2971 unsigned RBIF : 1;
2972 unsigned INT0IF : 1;
2973 unsigned TMR0IF : 1;
2974 unsigned RBIE : 1;
2975 unsigned INT0IE : 1;
2976 unsigned TMR0IE : 1;
2977 unsigned PEIE_GIEL : 1;
2978 unsigned GIE_GIEH : 1;
2981 struct
2983 unsigned : 1;
2984 unsigned INT0F : 1;
2985 unsigned T0IF : 1;
2986 unsigned : 1;
2987 unsigned INT0E : 1;
2988 unsigned T0IE : 1;
2989 unsigned PEIE : 1;
2990 unsigned GIE : 1;
2993 struct
2995 unsigned : 1;
2996 unsigned : 1;
2997 unsigned : 1;
2998 unsigned : 1;
2999 unsigned : 1;
3000 unsigned : 1;
3001 unsigned GIEL : 1;
3002 unsigned GIEH : 1;
3004 } __INTCONbits_t;
3006 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3008 #define _RBIF 0x01
3009 #define _INT0IF 0x02
3010 #define _INT0F 0x02
3011 #define _TMR0IF 0x04
3012 #define _T0IF 0x04
3013 #define _RBIE 0x08
3014 #define _INT0IE 0x10
3015 #define _INT0E 0x10
3016 #define _TMR0IE 0x20
3017 #define _T0IE 0x20
3018 #define _PEIE_GIEL 0x40
3019 #define _PEIE 0x40
3020 #define _GIEL 0x40
3021 #define _GIE_GIEH 0x80
3022 #define _GIE 0x80
3023 #define _GIEH 0x80
3025 //==============================================================================
3027 extern __at(0x0FF3) __sfr PROD;
3028 extern __at(0x0FF3) __sfr PRODL;
3029 extern __at(0x0FF4) __sfr PRODH;
3030 extern __at(0x0FF5) __sfr TABLAT;
3031 extern __at(0x0FF6) __sfr TBLPTR;
3032 extern __at(0x0FF6) __sfr TBLPTRL;
3033 extern __at(0x0FF7) __sfr TBLPTRH;
3034 extern __at(0x0FF8) __sfr TBLPTRU;
3035 extern __at(0x0FF9) __sfr PC;
3036 extern __at(0x0FF9) __sfr PCL;
3037 extern __at(0x0FFA) __sfr PCLATH;
3038 extern __at(0x0FFB) __sfr PCLATU;
3040 //==============================================================================
3041 // STKPTR Bits
3043 extern __at(0x0FFC) __sfr STKPTR;
3045 typedef union
3047 struct
3049 unsigned SP0 : 1;
3050 unsigned SP1 : 1;
3051 unsigned SP2 : 1;
3052 unsigned SP3 : 1;
3053 unsigned SP4 : 1;
3054 unsigned : 1;
3055 unsigned STKUNF : 1;
3056 unsigned STKFUL : 1;
3059 struct
3061 unsigned : 1;
3062 unsigned : 1;
3063 unsigned : 1;
3064 unsigned : 1;
3065 unsigned : 1;
3066 unsigned : 1;
3067 unsigned : 1;
3068 unsigned STKOVF : 1;
3071 struct
3073 unsigned SP : 5;
3074 unsigned : 3;
3076 } __STKPTRbits_t;
3078 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3080 #define _SP0 0x01
3081 #define _SP1 0x02
3082 #define _SP2 0x04
3083 #define _SP3 0x08
3084 #define _SP4 0x10
3085 #define _STKUNF 0x40
3086 #define _STKFUL 0x80
3087 #define _STKOVF 0x80
3089 //==============================================================================
3091 extern __at(0x0FFD) __sfr TOS;
3092 extern __at(0x0FFD) __sfr TOSL;
3093 extern __at(0x0FFE) __sfr TOSH;
3094 extern __at(0x0FFF) __sfr TOSU;
3096 //==============================================================================
3098 // Configuration Bits
3100 //==============================================================================
3102 #define __CONFIG1H 0x300001
3103 #define __CONFIG2L 0x300002
3104 #define __CONFIG2H 0x300003
3105 #define __CONFIG3H 0x300005
3106 #define __CONFIG4L 0x300006
3107 #define __CONFIG5L 0x300008
3108 #define __CONFIG5H 0x300009
3109 #define __CONFIG6L 0x30000A
3110 #define __CONFIG6H 0x30000B
3111 #define __CONFIG7L 0x30000C
3112 #define __CONFIG7H 0x30000D
3114 //----------------------------- CONFIG1H Options -------------------------------
3116 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3117 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3118 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3119 #define _FOSC_RC_1H 0xF3 // External RC oscillator, CLKOUT function on RA6.
3120 #define _FOSC_EC_1H 0xF4 // EC oscillator, CLKOUT function on RA6.
3121 #define _FOSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
3122 #define _FOSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3123 #define _FOSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
3124 #define _FOSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
3125 #define _FOSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKOUT function on RA6, port function on RA7.
3126 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3127 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3128 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3129 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3131 //----------------------------- CONFIG2L Options -------------------------------
3133 #define _PWRT_ON_2L 0xFE // PWRT enabled.
3134 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
3135 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3136 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3137 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3138 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3139 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3140 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3141 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3142 #define _BORV_18_2L 0xFF // VBOR set to 1.8 V nominal.
3144 //----------------------------- CONFIG2H Options -------------------------------
3146 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3147 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3148 #define _WDTPS_1_2H 0xE1 // 1:1.
3149 #define _WDTPS_2_2H 0xE3 // 1:2.
3150 #define _WDTPS_4_2H 0xE5 // 1:4.
3151 #define _WDTPS_8_2H 0xE7 // 1:8.
3152 #define _WDTPS_16_2H 0xE9 // 1:16.
3153 #define _WDTPS_32_2H 0xEB // 1:32.
3154 #define _WDTPS_64_2H 0xED // 1:64.
3155 #define _WDTPS_128_2H 0xEF // 1:128.
3156 #define _WDTPS_256_2H 0xF1 // 1:256.
3157 #define _WDTPS_512_2H 0xF3 // 1:512.
3158 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3159 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3160 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3161 #define _WDTPS_8192_2H 0xFB // 1:8192.
3162 #define _WDTPS_16384_2H 0xFD // 1:16384.
3163 #define _WDTPS_32768_2H 0xFF // 1:32768.
3165 //----------------------------- CONFIG3H Options -------------------------------
3167 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3168 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3169 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3170 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3171 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3172 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3173 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3174 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3175 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3176 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3178 //----------------------------- CONFIG4L Options -------------------------------
3180 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3181 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3182 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3183 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3184 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3185 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3186 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3187 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3189 //----------------------------- CONFIG5L Options -------------------------------
3191 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected.
3192 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected.
3193 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected.
3194 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected.
3195 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected.
3196 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected.
3197 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected.
3198 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected.
3200 //----------------------------- CONFIG5H Options -------------------------------
3202 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3203 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3204 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3205 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3207 //----------------------------- CONFIG6L Options -------------------------------
3209 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected.
3210 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected.
3211 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected.
3212 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected.
3213 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected.
3214 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected.
3215 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected.
3216 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected.
3218 //----------------------------- CONFIG6H Options -------------------------------
3220 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3221 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3222 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0007FFh) write-protected.
3223 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0007FFh) not write-protected.
3224 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3225 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3227 //----------------------------- CONFIG7L Options -------------------------------
3229 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
3230 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
3231 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
3232 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
3233 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
3234 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
3235 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
3236 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
3238 //----------------------------- CONFIG7H Options -------------------------------
3240 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0007FFh) protected from table reads executed in other blocks.
3241 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks.
3243 //==============================================================================
3245 #define __DEVID1 0x3FFFFE
3246 #define __DEVID2 0x3FFFFF
3248 #define __IDLOC0 0x200000
3249 #define __IDLOC1 0x200001
3250 #define __IDLOC2 0x200002
3251 #define __IDLOC3 0x200003
3252 #define __IDLOC4 0x200004
3253 #define __IDLOC5 0x200005
3254 #define __IDLOC6 0x200006
3255 #define __IDLOC7 0x200007
3257 #endif // #ifndef __PIC18F25K20_H__