struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f26k20.h
blob14b25db72c88f1bae9c73d4e5364f7a3b7256db7
1 /*
2 * This declarations of the PIC18F26K20 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:28 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 __PIC18F26K20_H__
26 #define __PIC18F26K20_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 // EEADRH Bits
1500 extern __at(0x0FAA) __sfr EEADRH;
1502 typedef struct
1504 unsigned EEADR8 : 1;
1505 unsigned EEADR9 : 1;
1506 unsigned : 1;
1507 unsigned : 1;
1508 unsigned : 1;
1509 unsigned : 1;
1510 unsigned : 1;
1511 unsigned : 1;
1512 } __EEADRHbits_t;
1514 extern __at(0x0FAA) volatile __EEADRHbits_t EEADRHbits;
1516 #define _EEADR8 0x01
1517 #define _EEADR9 0x02
1519 //==============================================================================
1522 //==============================================================================
1523 // RCSTA Bits
1525 extern __at(0x0FAB) __sfr RCSTA;
1527 typedef union
1529 struct
1531 unsigned RX9D : 1;
1532 unsigned OERR : 1;
1533 unsigned FERR : 1;
1534 unsigned ADDEN : 1;
1535 unsigned CREN : 1;
1536 unsigned SREN : 1;
1537 unsigned RX9 : 1;
1538 unsigned SPEN : 1;
1541 struct
1543 unsigned : 1;
1544 unsigned : 1;
1545 unsigned : 1;
1546 unsigned ADEN : 1;
1547 unsigned : 1;
1548 unsigned : 1;
1549 unsigned : 1;
1550 unsigned : 1;
1552 } __RCSTAbits_t;
1554 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1556 #define _RX9D 0x01
1557 #define _OERR 0x02
1558 #define _FERR 0x04
1559 #define _ADDEN 0x08
1560 #define _ADEN 0x08
1561 #define _CREN 0x10
1562 #define _SREN 0x20
1563 #define _RX9 0x40
1564 #define _SPEN 0x80
1566 //==============================================================================
1569 //==============================================================================
1570 // TXSTA Bits
1572 extern __at(0x0FAC) __sfr TXSTA;
1574 typedef struct
1576 unsigned TX9D : 1;
1577 unsigned TRMT : 1;
1578 unsigned BRGH : 1;
1579 unsigned SENDB : 1;
1580 unsigned SYNC : 1;
1581 unsigned TXEN : 1;
1582 unsigned TX9 : 1;
1583 unsigned CSRC : 1;
1584 } __TXSTAbits_t;
1586 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1588 #define _TX9D 0x01
1589 #define _TRMT 0x02
1590 #define _BRGH 0x04
1591 #define _SENDB 0x08
1592 #define _SYNC 0x10
1593 #define _TXEN 0x20
1594 #define _TX9 0x40
1595 #define _CSRC 0x80
1597 //==============================================================================
1599 extern __at(0x0FAD) __sfr TXREG;
1600 extern __at(0x0FAE) __sfr RCREG;
1601 extern __at(0x0FAF) __sfr SPBRG;
1602 extern __at(0x0FB0) __sfr SPBRGH;
1604 //==============================================================================
1605 // T3CON Bits
1607 extern __at(0x0FB1) __sfr T3CON;
1609 typedef union
1611 struct
1613 unsigned TMR3ON : 1;
1614 unsigned TMR3CS : 1;
1615 unsigned NOT_T3SYNC : 1;
1616 unsigned T3CCP1 : 1;
1617 unsigned T3CKPS0 : 1;
1618 unsigned T3CKPS1 : 1;
1619 unsigned T3CCP2 : 1;
1620 unsigned RD16 : 1;
1623 struct
1625 unsigned : 1;
1626 unsigned : 1;
1627 unsigned T3SYNC : 1;
1628 unsigned : 1;
1629 unsigned : 1;
1630 unsigned : 1;
1631 unsigned : 1;
1632 unsigned : 1;
1635 struct
1637 unsigned : 4;
1638 unsigned T3CKPS : 2;
1639 unsigned : 2;
1641 } __T3CONbits_t;
1643 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1645 #define _T3CON_TMR3ON 0x01
1646 #define _T3CON_TMR3CS 0x02
1647 #define _T3CON_NOT_T3SYNC 0x04
1648 #define _T3CON_T3SYNC 0x04
1649 #define _T3CON_T3CCP1 0x08
1650 #define _T3CON_T3CKPS0 0x10
1651 #define _T3CON_T3CKPS1 0x20
1652 #define _T3CON_T3CCP2 0x40
1653 #define _T3CON_RD16 0x80
1655 //==============================================================================
1657 extern __at(0x0FB2) __sfr TMR3;
1658 extern __at(0x0FB2) __sfr TMR3L;
1659 extern __at(0x0FB3) __sfr TMR3H;
1661 //==============================================================================
1662 // CVRCON2 Bits
1664 extern __at(0x0FB4) __sfr CVRCON2;
1666 typedef struct
1668 unsigned : 1;
1669 unsigned : 1;
1670 unsigned : 1;
1671 unsigned : 1;
1672 unsigned : 1;
1673 unsigned : 1;
1674 unsigned FVRST : 1;
1675 unsigned FVREN : 1;
1676 } __CVRCON2bits_t;
1678 extern __at(0x0FB4) volatile __CVRCON2bits_t CVRCON2bits;
1680 #define _FVRST 0x40
1681 #define _FVREN 0x80
1683 //==============================================================================
1686 //==============================================================================
1687 // CVRCON Bits
1689 extern __at(0x0FB5) __sfr CVRCON;
1691 typedef union
1693 struct
1695 unsigned CVR0 : 1;
1696 unsigned CVR1 : 1;
1697 unsigned CVR2 : 1;
1698 unsigned CVR3 : 1;
1699 unsigned CVRSS : 1;
1700 unsigned CVRR : 1;
1701 unsigned CVROE : 1;
1702 unsigned CVREN : 1;
1705 struct
1707 unsigned CVR : 4;
1708 unsigned : 4;
1710 } __CVRCONbits_t;
1712 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1714 #define _CVR0 0x01
1715 #define _CVR1 0x02
1716 #define _CVR2 0x04
1717 #define _CVR3 0x08
1718 #define _CVRSS 0x10
1719 #define _CVRR 0x20
1720 #define _CVROE 0x40
1721 #define _CVREN 0x80
1723 //==============================================================================
1726 //==============================================================================
1727 // ECCP1AS Bits
1729 extern __at(0x0FB6) __sfr ECCP1AS;
1731 typedef union
1733 struct
1735 unsigned PSSBD0 : 1;
1736 unsigned PSSBD1 : 1;
1737 unsigned PSSAC0 : 1;
1738 unsigned PSSAC1 : 1;
1739 unsigned ECCPAS0 : 1;
1740 unsigned ECCPAS1 : 1;
1741 unsigned ECCPAS2 : 1;
1742 unsigned ECCPASE : 1;
1745 struct
1747 unsigned PSSBD : 2;
1748 unsigned : 6;
1751 struct
1753 unsigned : 2;
1754 unsigned PSSAC : 2;
1755 unsigned : 4;
1758 struct
1760 unsigned : 4;
1761 unsigned ECCPAS : 3;
1762 unsigned : 1;
1764 } __ECCP1ASbits_t;
1766 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1768 #define _PSSBD0 0x01
1769 #define _PSSBD1 0x02
1770 #define _PSSAC0 0x04
1771 #define _PSSAC1 0x08
1772 #define _ECCPAS0 0x10
1773 #define _ECCPAS1 0x20
1774 #define _ECCPAS2 0x40
1775 #define _ECCPASE 0x80
1777 //==============================================================================
1780 //==============================================================================
1781 // PWM1CON Bits
1783 extern __at(0x0FB7) __sfr PWM1CON;
1785 typedef union
1787 struct
1789 unsigned PDC0 : 1;
1790 unsigned PDC1 : 1;
1791 unsigned PDC2 : 1;
1792 unsigned PDC3 : 1;
1793 unsigned PDC4 : 1;
1794 unsigned PDC5 : 1;
1795 unsigned PDC6 : 1;
1796 unsigned PRSEN : 1;
1799 struct
1801 unsigned PDC : 7;
1802 unsigned : 1;
1804 } __PWM1CONbits_t;
1806 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1808 #define _PDC0 0x01
1809 #define _PDC1 0x02
1810 #define _PDC2 0x04
1811 #define _PDC3 0x08
1812 #define _PDC4 0x10
1813 #define _PDC5 0x20
1814 #define _PDC6 0x40
1815 #define _PRSEN 0x80
1817 //==============================================================================
1820 //==============================================================================
1821 // BAUDCON Bits
1823 extern __at(0x0FB8) __sfr BAUDCON;
1825 typedef union
1827 struct
1829 unsigned ABDEN : 1;
1830 unsigned WUE : 1;
1831 unsigned : 1;
1832 unsigned BRG16 : 1;
1833 unsigned CKTXP : 1;
1834 unsigned DTRXP : 1;
1835 unsigned RCIDL : 1;
1836 unsigned ABDOVF : 1;
1839 struct
1841 unsigned : 1;
1842 unsigned : 1;
1843 unsigned : 1;
1844 unsigned : 1;
1845 unsigned SCKP : 1;
1846 unsigned : 1;
1847 unsigned : 1;
1848 unsigned : 1;
1850 } __BAUDCONbits_t;
1852 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1854 #define _ABDEN 0x01
1855 #define _WUE 0x02
1856 #define _BRG16 0x08
1857 #define _CKTXP 0x10
1858 #define _SCKP 0x10
1859 #define _DTRXP 0x20
1860 #define _RCIDL 0x40
1861 #define _ABDOVF 0x80
1863 //==============================================================================
1866 //==============================================================================
1867 // BAUDCTL Bits
1869 extern __at(0x0FB8) __sfr BAUDCTL;
1871 typedef union
1873 struct
1875 unsigned ABDEN : 1;
1876 unsigned WUE : 1;
1877 unsigned : 1;
1878 unsigned BRG16 : 1;
1879 unsigned CKTXP : 1;
1880 unsigned DTRXP : 1;
1881 unsigned RCIDL : 1;
1882 unsigned ABDOVF : 1;
1885 struct
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned : 1;
1890 unsigned : 1;
1891 unsigned SCKP : 1;
1892 unsigned : 1;
1893 unsigned : 1;
1894 unsigned : 1;
1896 } __BAUDCTLbits_t;
1898 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1900 #define _BAUDCTL_ABDEN 0x01
1901 #define _BAUDCTL_WUE 0x02
1902 #define _BAUDCTL_BRG16 0x08
1903 #define _BAUDCTL_CKTXP 0x10
1904 #define _BAUDCTL_SCKP 0x10
1905 #define _BAUDCTL_DTRXP 0x20
1906 #define _BAUDCTL_RCIDL 0x40
1907 #define _BAUDCTL_ABDOVF 0x80
1909 //==============================================================================
1912 //==============================================================================
1913 // PSTRCON Bits
1915 extern __at(0x0FB9) __sfr PSTRCON;
1917 typedef struct
1919 unsigned STRA : 1;
1920 unsigned STRB : 1;
1921 unsigned STRC : 1;
1922 unsigned STRD : 1;
1923 unsigned STRSYNC : 1;
1924 unsigned : 1;
1925 unsigned : 1;
1926 unsigned : 1;
1927 } __PSTRCONbits_t;
1929 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1931 #define _STRA 0x01
1932 #define _STRB 0x02
1933 #define _STRC 0x04
1934 #define _STRD 0x08
1935 #define _STRSYNC 0x10
1937 //==============================================================================
1940 //==============================================================================
1941 // CCP2CON Bits
1943 extern __at(0x0FBA) __sfr CCP2CON;
1945 typedef union
1947 struct
1949 unsigned CCP2M0 : 1;
1950 unsigned CCP2M1 : 1;
1951 unsigned CCP2M2 : 1;
1952 unsigned CCP2M3 : 1;
1953 unsigned DC2B0 : 1;
1954 unsigned DC2B1 : 1;
1955 unsigned : 1;
1956 unsigned : 1;
1959 struct
1961 unsigned CCP2M : 4;
1962 unsigned : 4;
1965 struct
1967 unsigned : 4;
1968 unsigned DC2B : 2;
1969 unsigned : 2;
1971 } __CCP2CONbits_t;
1973 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1975 #define _CCP2M0 0x01
1976 #define _CCP2M1 0x02
1977 #define _CCP2M2 0x04
1978 #define _CCP2M3 0x08
1979 #define _DC2B0 0x10
1980 #define _DC2B1 0x20
1982 //==============================================================================
1984 extern __at(0x0FBB) __sfr CCPR2;
1985 extern __at(0x0FBB) __sfr CCPR2L;
1986 extern __at(0x0FBC) __sfr CCPR2H;
1988 //==============================================================================
1989 // CCP1CON Bits
1991 extern __at(0x0FBD) __sfr CCP1CON;
1993 typedef union
1995 struct
1997 unsigned CCP1M0 : 1;
1998 unsigned CCP1M1 : 1;
1999 unsigned CCP1M2 : 1;
2000 unsigned CCP1M3 : 1;
2001 unsigned DC1B0 : 1;
2002 unsigned DC1B1 : 1;
2003 unsigned P1M0 : 1;
2004 unsigned P1M1 : 1;
2007 struct
2009 unsigned CCP1M : 4;
2010 unsigned : 4;
2013 struct
2015 unsigned : 4;
2016 unsigned DC1B : 2;
2017 unsigned : 2;
2020 struct
2022 unsigned : 6;
2023 unsigned P1M : 2;
2025 } __CCP1CONbits_t;
2027 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2029 #define _CCP1M0 0x01
2030 #define _CCP1M1 0x02
2031 #define _CCP1M2 0x04
2032 #define _CCP1M3 0x08
2033 #define _DC1B0 0x10
2034 #define _DC1B1 0x20
2035 #define _P1M0 0x40
2036 #define _P1M1 0x80
2038 //==============================================================================
2040 extern __at(0x0FBE) __sfr CCPR1;
2041 extern __at(0x0FBE) __sfr CCPR1L;
2042 extern __at(0x0FBF) __sfr CCPR1H;
2044 //==============================================================================
2045 // ADCON2 Bits
2047 extern __at(0x0FC0) __sfr ADCON2;
2049 typedef union
2051 struct
2053 unsigned ADCS0 : 1;
2054 unsigned ADCS1 : 1;
2055 unsigned ADCS2 : 1;
2056 unsigned ACQT0 : 1;
2057 unsigned ACQT1 : 1;
2058 unsigned ACQT2 : 1;
2059 unsigned : 1;
2060 unsigned ADFM : 1;
2063 struct
2065 unsigned ADCS : 3;
2066 unsigned : 5;
2069 struct
2071 unsigned : 3;
2072 unsigned ACQT : 3;
2073 unsigned : 2;
2075 } __ADCON2bits_t;
2077 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2079 #define _ADCS0 0x01
2080 #define _ADCS1 0x02
2081 #define _ADCS2 0x04
2082 #define _ACQT0 0x08
2083 #define _ACQT1 0x10
2084 #define _ACQT2 0x20
2085 #define _ADFM 0x80
2087 //==============================================================================
2090 //==============================================================================
2091 // ADCON1 Bits
2093 extern __at(0x0FC1) __sfr ADCON1;
2095 typedef union
2097 struct
2099 unsigned : 1;
2100 unsigned : 1;
2101 unsigned : 1;
2102 unsigned : 1;
2103 unsigned VCFG0 : 1;
2104 unsigned VCFG1 : 1;
2105 unsigned : 1;
2106 unsigned : 1;
2109 struct
2111 unsigned : 4;
2112 unsigned VCFG : 2;
2113 unsigned : 2;
2115 } __ADCON1bits_t;
2117 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2119 #define _VCFG0 0x10
2120 #define _VCFG1 0x20
2122 //==============================================================================
2125 //==============================================================================
2126 // ADCON0 Bits
2128 extern __at(0x0FC2) __sfr ADCON0;
2130 typedef union
2132 struct
2134 unsigned ADON : 1;
2135 unsigned GO_NOT_DONE : 1;
2136 unsigned CHS0 : 1;
2137 unsigned CHS1 : 1;
2138 unsigned CHS2 : 1;
2139 unsigned CHS3 : 1;
2140 unsigned : 1;
2141 unsigned : 1;
2144 struct
2146 unsigned : 1;
2147 unsigned DONE : 1;
2148 unsigned : 1;
2149 unsigned : 1;
2150 unsigned : 1;
2151 unsigned : 1;
2152 unsigned : 1;
2153 unsigned : 1;
2156 struct
2158 unsigned : 1;
2159 unsigned NOT_DONE : 1;
2160 unsigned : 1;
2161 unsigned : 1;
2162 unsigned : 1;
2163 unsigned : 1;
2164 unsigned : 1;
2165 unsigned : 1;
2168 struct
2170 unsigned : 1;
2171 unsigned GO_DONE : 1;
2172 unsigned : 1;
2173 unsigned : 1;
2174 unsigned : 1;
2175 unsigned : 1;
2176 unsigned : 1;
2177 unsigned : 1;
2180 struct
2182 unsigned : 1;
2183 unsigned GO : 1;
2184 unsigned : 1;
2185 unsigned : 1;
2186 unsigned : 1;
2187 unsigned : 1;
2188 unsigned : 1;
2189 unsigned : 1;
2192 struct
2194 unsigned : 2;
2195 unsigned CHS : 4;
2196 unsigned : 2;
2198 } __ADCON0bits_t;
2200 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2202 #define _ADON 0x01
2203 #define _GO_NOT_DONE 0x02
2204 #define _DONE 0x02
2205 #define _NOT_DONE 0x02
2206 #define _GO_DONE 0x02
2207 #define _GO 0x02
2208 #define _CHS0 0x04
2209 #define _CHS1 0x08
2210 #define _CHS2 0x10
2211 #define _CHS3 0x20
2213 //==============================================================================
2215 extern __at(0x0FC3) __sfr ADRES;
2216 extern __at(0x0FC3) __sfr ADRESL;
2217 extern __at(0x0FC4) __sfr ADRESH;
2219 //==============================================================================
2220 // SSPCON2 Bits
2222 extern __at(0x0FC5) __sfr SSPCON2;
2224 typedef struct
2226 unsigned SEN : 1;
2227 unsigned RSEN : 1;
2228 unsigned PEN : 1;
2229 unsigned RCEN : 1;
2230 unsigned ACKEN : 1;
2231 unsigned ACKDT : 1;
2232 unsigned ACKSTAT : 1;
2233 unsigned GCEN : 1;
2234 } __SSPCON2bits_t;
2236 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2238 #define _SEN 0x01
2239 #define _RSEN 0x02
2240 #define _PEN 0x04
2241 #define _RCEN 0x08
2242 #define _ACKEN 0x10
2243 #define _ACKDT 0x20
2244 #define _ACKSTAT 0x40
2245 #define _GCEN 0x80
2247 //==============================================================================
2250 //==============================================================================
2251 // SSPCON1 Bits
2253 extern __at(0x0FC6) __sfr SSPCON1;
2255 typedef union
2257 struct
2259 unsigned SSPM0 : 1;
2260 unsigned SSPM1 : 1;
2261 unsigned SSPM2 : 1;
2262 unsigned SSPM3 : 1;
2263 unsigned CKP : 1;
2264 unsigned SSPEN : 1;
2265 unsigned SSPOV : 1;
2266 unsigned WCOL : 1;
2269 struct
2271 unsigned SSPM : 4;
2272 unsigned : 4;
2274 } __SSPCON1bits_t;
2276 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2278 #define _SSPM0 0x01
2279 #define _SSPM1 0x02
2280 #define _SSPM2 0x04
2281 #define _SSPM3 0x08
2282 #define _CKP 0x10
2283 #define _SSPEN 0x20
2284 #define _SSPOV 0x40
2285 #define _WCOL 0x80
2287 //==============================================================================
2290 //==============================================================================
2291 // SSPSTAT Bits
2293 extern __at(0x0FC7) __sfr SSPSTAT;
2295 typedef union
2297 struct
2299 unsigned BF : 1;
2300 unsigned UA : 1;
2301 unsigned R_NOT_W : 1;
2302 unsigned S : 1;
2303 unsigned P : 1;
2304 unsigned D_NOT_A : 1;
2305 unsigned CKE : 1;
2306 unsigned SMP : 1;
2309 struct
2311 unsigned : 1;
2312 unsigned : 1;
2313 unsigned R : 1;
2314 unsigned START : 1;
2315 unsigned STOP : 1;
2316 unsigned D : 1;
2317 unsigned : 1;
2318 unsigned : 1;
2321 struct
2323 unsigned : 1;
2324 unsigned : 1;
2325 unsigned NOT_W : 1;
2326 unsigned : 1;
2327 unsigned : 1;
2328 unsigned NOT_A : 1;
2329 unsigned : 1;
2330 unsigned : 1;
2333 struct
2335 unsigned : 1;
2336 unsigned : 1;
2337 unsigned R_W : 1;
2338 unsigned : 1;
2339 unsigned : 1;
2340 unsigned D_A : 1;
2341 unsigned : 1;
2342 unsigned : 1;
2345 struct
2347 unsigned : 1;
2348 unsigned : 1;
2349 unsigned NOT_WRITE : 1;
2350 unsigned : 1;
2351 unsigned : 1;
2352 unsigned NOT_ADDRESS : 1;
2353 unsigned : 1;
2354 unsigned : 1;
2356 } __SSPSTATbits_t;
2358 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2360 #define _BF 0x01
2361 #define _UA 0x02
2362 #define _R_NOT_W 0x04
2363 #define _R 0x04
2364 #define _NOT_W 0x04
2365 #define _R_W 0x04
2366 #define _NOT_WRITE 0x04
2367 #define _S 0x08
2368 #define _START 0x08
2369 #define _P 0x10
2370 #define _STOP 0x10
2371 #define _D_NOT_A 0x20
2372 #define _D 0x20
2373 #define _NOT_A 0x20
2374 #define _D_A 0x20
2375 #define _NOT_ADDRESS 0x20
2376 #define _CKE 0x40
2377 #define _SMP 0x80
2379 //==============================================================================
2381 extern __at(0x0FC8) __sfr SSPADD;
2382 extern __at(0x0FC9) __sfr SSPBUF;
2384 //==============================================================================
2385 // T2CON Bits
2387 extern __at(0x0FCA) __sfr T2CON;
2389 typedef union
2391 struct
2393 unsigned T2CKPS0 : 1;
2394 unsigned T2CKPS1 : 1;
2395 unsigned TMR2ON : 1;
2396 unsigned T2OUTPS0 : 1;
2397 unsigned T2OUTPS1 : 1;
2398 unsigned T2OUTPS2 : 1;
2399 unsigned T2OUTPS3 : 1;
2400 unsigned : 1;
2403 struct
2405 unsigned T2CKPS : 2;
2406 unsigned : 6;
2409 struct
2411 unsigned : 3;
2412 unsigned T2OUTPS : 4;
2413 unsigned : 1;
2415 } __T2CONbits_t;
2417 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2419 #define _T2CKPS0 0x01
2420 #define _T2CKPS1 0x02
2421 #define _TMR2ON 0x04
2422 #define _T2OUTPS0 0x08
2423 #define _T2OUTPS1 0x10
2424 #define _T2OUTPS2 0x20
2425 #define _T2OUTPS3 0x40
2427 //==============================================================================
2429 extern __at(0x0FCB) __sfr PR2;
2430 extern __at(0x0FCC) __sfr TMR2;
2432 //==============================================================================
2433 // T1CON Bits
2435 extern __at(0x0FCD) __sfr T1CON;
2437 typedef union
2439 struct
2441 unsigned TMR1ON : 1;
2442 unsigned TMR1CS : 1;
2443 unsigned NOT_T1SYNC : 1;
2444 unsigned T1OSCEN : 1;
2445 unsigned T1CKPS0 : 1;
2446 unsigned T1CKPS1 : 1;
2447 unsigned T1RUN : 1;
2448 unsigned RD16 : 1;
2451 struct
2453 unsigned : 1;
2454 unsigned : 1;
2455 unsigned T1SYNC : 1;
2456 unsigned : 1;
2457 unsigned : 1;
2458 unsigned : 1;
2459 unsigned : 1;
2460 unsigned : 1;
2463 struct
2465 unsigned : 4;
2466 unsigned T1CKPS : 2;
2467 unsigned : 2;
2469 } __T1CONbits_t;
2471 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2473 #define _TMR1ON 0x01
2474 #define _TMR1CS 0x02
2475 #define _NOT_T1SYNC 0x04
2476 #define _T1SYNC 0x04
2477 #define _T1OSCEN 0x08
2478 #define _T1CKPS0 0x10
2479 #define _T1CKPS1 0x20
2480 #define _T1RUN 0x40
2481 #define _RD16 0x80
2483 //==============================================================================
2485 extern __at(0x0FCE) __sfr TMR1;
2486 extern __at(0x0FCE) __sfr TMR1L;
2487 extern __at(0x0FCF) __sfr TMR1H;
2489 //==============================================================================
2490 // RCON Bits
2492 extern __at(0x0FD0) __sfr RCON;
2494 typedef union
2496 struct
2498 unsigned NOT_BOR : 1;
2499 unsigned NOT_POR : 1;
2500 unsigned NOT_PD : 1;
2501 unsigned NOT_TO : 1;
2502 unsigned NOT_RI : 1;
2503 unsigned : 1;
2504 unsigned SBOREN : 1;
2505 unsigned IPEN : 1;
2508 struct
2510 unsigned BOR : 1;
2511 unsigned POR : 1;
2512 unsigned PD : 1;
2513 unsigned TO : 1;
2514 unsigned RI : 1;
2515 unsigned : 1;
2516 unsigned : 1;
2517 unsigned : 1;
2519 } __RCONbits_t;
2521 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2523 #define _NOT_BOR 0x01
2524 #define _BOR 0x01
2525 #define _NOT_POR 0x02
2526 #define _POR 0x02
2527 #define _NOT_PD 0x04
2528 #define _PD 0x04
2529 #define _NOT_TO 0x08
2530 #define _TO 0x08
2531 #define _NOT_RI 0x10
2532 #define _RI 0x10
2533 #define _SBOREN 0x40
2534 #define _IPEN 0x80
2536 //==============================================================================
2539 //==============================================================================
2540 // WDTCON Bits
2542 extern __at(0x0FD1) __sfr WDTCON;
2544 typedef union
2546 struct
2548 unsigned SWDTEN : 1;
2549 unsigned : 1;
2550 unsigned : 1;
2551 unsigned : 1;
2552 unsigned : 1;
2553 unsigned : 1;
2554 unsigned : 1;
2555 unsigned : 1;
2558 struct
2560 unsigned SWDTE : 1;
2561 unsigned : 1;
2562 unsigned : 1;
2563 unsigned : 1;
2564 unsigned : 1;
2565 unsigned : 1;
2566 unsigned : 1;
2567 unsigned : 1;
2569 } __WDTCONbits_t;
2571 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2573 #define _SWDTEN 0x01
2574 #define _SWDTE 0x01
2576 //==============================================================================
2579 //==============================================================================
2580 // HLVDCON Bits
2582 extern __at(0x0FD2) __sfr HLVDCON;
2584 typedef union
2586 struct
2588 unsigned HLVDL0 : 1;
2589 unsigned HLVDL1 : 1;
2590 unsigned HLVDL2 : 1;
2591 unsigned HLVDL3 : 1;
2592 unsigned HLVDEN : 1;
2593 unsigned IRVST : 1;
2594 unsigned : 1;
2595 unsigned VDIRMAG : 1;
2598 struct
2600 unsigned LVDL0 : 1;
2601 unsigned LVDL1 : 1;
2602 unsigned LVDL2 : 1;
2603 unsigned LVDL3 : 1;
2604 unsigned LVDEN : 1;
2605 unsigned IVRST : 1;
2606 unsigned : 1;
2607 unsigned : 1;
2610 struct
2612 unsigned LVV0 : 1;
2613 unsigned LVV1 : 1;
2614 unsigned LVV2 : 1;
2615 unsigned LVV3 : 1;
2616 unsigned : 1;
2617 unsigned BGST : 1;
2618 unsigned : 1;
2619 unsigned : 1;
2622 struct
2624 unsigned LVV : 4;
2625 unsigned : 4;
2628 struct
2630 unsigned LVDL : 4;
2631 unsigned : 4;
2634 struct
2636 unsigned HLVDL : 4;
2637 unsigned : 4;
2639 } __HLVDCONbits_t;
2641 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2643 #define _HLVDL0 0x01
2644 #define _LVDL0 0x01
2645 #define _LVV0 0x01
2646 #define _HLVDL1 0x02
2647 #define _LVDL1 0x02
2648 #define _LVV1 0x02
2649 #define _HLVDL2 0x04
2650 #define _LVDL2 0x04
2651 #define _LVV2 0x04
2652 #define _HLVDL3 0x08
2653 #define _LVDL3 0x08
2654 #define _LVV3 0x08
2655 #define _HLVDEN 0x10
2656 #define _LVDEN 0x10
2657 #define _IRVST 0x20
2658 #define _IVRST 0x20
2659 #define _BGST 0x20
2660 #define _VDIRMAG 0x80
2662 //==============================================================================
2665 //==============================================================================
2666 // LVDCON Bits
2668 extern __at(0x0FD2) __sfr LVDCON;
2670 typedef union
2672 struct
2674 unsigned HLVDL0 : 1;
2675 unsigned HLVDL1 : 1;
2676 unsigned HLVDL2 : 1;
2677 unsigned HLVDL3 : 1;
2678 unsigned HLVDEN : 1;
2679 unsigned IRVST : 1;
2680 unsigned : 1;
2681 unsigned VDIRMAG : 1;
2684 struct
2686 unsigned LVDL0 : 1;
2687 unsigned LVDL1 : 1;
2688 unsigned LVDL2 : 1;
2689 unsigned LVDL3 : 1;
2690 unsigned LVDEN : 1;
2691 unsigned IVRST : 1;
2692 unsigned : 1;
2693 unsigned : 1;
2696 struct
2698 unsigned LVV0 : 1;
2699 unsigned LVV1 : 1;
2700 unsigned LVV2 : 1;
2701 unsigned LVV3 : 1;
2702 unsigned : 1;
2703 unsigned BGST : 1;
2704 unsigned : 1;
2705 unsigned : 1;
2708 struct
2710 unsigned LVDL : 4;
2711 unsigned : 4;
2714 struct
2716 unsigned HLVDL : 4;
2717 unsigned : 4;
2720 struct
2722 unsigned LVV : 4;
2723 unsigned : 4;
2725 } __LVDCONbits_t;
2727 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2729 #define _LVDCON_HLVDL0 0x01
2730 #define _LVDCON_LVDL0 0x01
2731 #define _LVDCON_LVV0 0x01
2732 #define _LVDCON_HLVDL1 0x02
2733 #define _LVDCON_LVDL1 0x02
2734 #define _LVDCON_LVV1 0x02
2735 #define _LVDCON_HLVDL2 0x04
2736 #define _LVDCON_LVDL2 0x04
2737 #define _LVDCON_LVV2 0x04
2738 #define _LVDCON_HLVDL3 0x08
2739 #define _LVDCON_LVDL3 0x08
2740 #define _LVDCON_LVV3 0x08
2741 #define _LVDCON_HLVDEN 0x10
2742 #define _LVDCON_LVDEN 0x10
2743 #define _LVDCON_IRVST 0x20
2744 #define _LVDCON_IVRST 0x20
2745 #define _LVDCON_BGST 0x20
2746 #define _LVDCON_VDIRMAG 0x80
2748 //==============================================================================
2751 //==============================================================================
2752 // OSCCON Bits
2754 extern __at(0x0FD3) __sfr OSCCON;
2756 typedef union
2758 struct
2760 unsigned SCS0 : 1;
2761 unsigned SCS1 : 1;
2762 unsigned IOFS : 1;
2763 unsigned OSTS : 1;
2764 unsigned IRCF0 : 1;
2765 unsigned IRCF1 : 1;
2766 unsigned IRCF2 : 1;
2767 unsigned IDLEN : 1;
2770 struct
2772 unsigned SCS : 2;
2773 unsigned : 6;
2776 struct
2778 unsigned : 4;
2779 unsigned IRCF : 3;
2780 unsigned : 1;
2782 } __OSCCONbits_t;
2784 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2786 #define _SCS0 0x01
2787 #define _SCS1 0x02
2788 #define _IOFS 0x04
2789 #define _OSTS 0x08
2790 #define _IRCF0 0x10
2791 #define _IRCF1 0x20
2792 #define _IRCF2 0x40
2793 #define _IDLEN 0x80
2795 //==============================================================================
2798 //==============================================================================
2799 // T0CON Bits
2801 extern __at(0x0FD5) __sfr T0CON;
2803 typedef union
2805 struct
2807 unsigned T0PS0 : 1;
2808 unsigned T0PS1 : 1;
2809 unsigned T0PS2 : 1;
2810 unsigned PSA : 1;
2811 unsigned T0SE : 1;
2812 unsigned T0CS : 1;
2813 unsigned T08BIT : 1;
2814 unsigned TMR0ON : 1;
2817 struct
2819 unsigned T0PS : 3;
2820 unsigned : 5;
2822 } __T0CONbits_t;
2824 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2826 #define _T0PS0 0x01
2827 #define _T0PS1 0x02
2828 #define _T0PS2 0x04
2829 #define _PSA 0x08
2830 #define _T0SE 0x10
2831 #define _T0CS 0x20
2832 #define _T08BIT 0x40
2833 #define _TMR0ON 0x80
2835 //==============================================================================
2837 extern __at(0x0FD6) __sfr TMR0;
2838 extern __at(0x0FD6) __sfr TMR0L;
2839 extern __at(0x0FD7) __sfr TMR0H;
2841 //==============================================================================
2842 // STATUS Bits
2844 extern __at(0x0FD8) __sfr STATUS;
2846 typedef struct
2848 unsigned C : 1;
2849 unsigned DC : 1;
2850 unsigned Z : 1;
2851 unsigned OV : 1;
2852 unsigned N : 1;
2853 unsigned : 1;
2854 unsigned : 1;
2855 unsigned : 1;
2856 } __STATUSbits_t;
2858 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2860 #define _C 0x01
2861 #define _DC 0x02
2862 #define _Z 0x04
2863 #define _OV 0x08
2864 #define _N 0x10
2866 //==============================================================================
2868 extern __at(0x0FD9) __sfr FSR2L;
2869 extern __at(0x0FDA) __sfr FSR2H;
2870 extern __at(0x0FDB) __sfr PLUSW2;
2871 extern __at(0x0FDC) __sfr PREINC2;
2872 extern __at(0x0FDD) __sfr POSTDEC2;
2873 extern __at(0x0FDE) __sfr POSTINC2;
2874 extern __at(0x0FDF) __sfr INDF2;
2875 extern __at(0x0FE0) __sfr BSR;
2876 extern __at(0x0FE1) __sfr FSR1L;
2877 extern __at(0x0FE2) __sfr FSR1H;
2878 extern __at(0x0FE3) __sfr PLUSW1;
2879 extern __at(0x0FE4) __sfr PREINC1;
2880 extern __at(0x0FE5) __sfr POSTDEC1;
2881 extern __at(0x0FE6) __sfr POSTINC1;
2882 extern __at(0x0FE7) __sfr INDF1;
2883 extern __at(0x0FE8) __sfr WREG;
2884 extern __at(0x0FE9) __sfr FSR0L;
2885 extern __at(0x0FEA) __sfr FSR0H;
2886 extern __at(0x0FEB) __sfr PLUSW0;
2887 extern __at(0x0FEC) __sfr PREINC0;
2888 extern __at(0x0FED) __sfr POSTDEC0;
2889 extern __at(0x0FEE) __sfr POSTINC0;
2890 extern __at(0x0FEF) __sfr INDF0;
2892 //==============================================================================
2893 // INTCON3 Bits
2895 extern __at(0x0FF0) __sfr INTCON3;
2897 typedef union
2899 struct
2901 unsigned INT1IF : 1;
2902 unsigned INT2IF : 1;
2903 unsigned : 1;
2904 unsigned INT1IE : 1;
2905 unsigned INT2IE : 1;
2906 unsigned : 1;
2907 unsigned INT1IP : 1;
2908 unsigned INT2IP : 1;
2911 struct
2913 unsigned INT1F : 1;
2914 unsigned INT2F : 1;
2915 unsigned : 1;
2916 unsigned INT1E : 1;
2917 unsigned INT2E : 1;
2918 unsigned : 1;
2919 unsigned INT1P : 1;
2920 unsigned INT2P : 1;
2922 } __INTCON3bits_t;
2924 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2926 #define _INT1IF 0x01
2927 #define _INT1F 0x01
2928 #define _INT2IF 0x02
2929 #define _INT2F 0x02
2930 #define _INT1IE 0x08
2931 #define _INT1E 0x08
2932 #define _INT2IE 0x10
2933 #define _INT2E 0x10
2934 #define _INT1IP 0x40
2935 #define _INT1P 0x40
2936 #define _INT2IP 0x80
2937 #define _INT2P 0x80
2939 //==============================================================================
2942 //==============================================================================
2943 // INTCON2 Bits
2945 extern __at(0x0FF1) __sfr INTCON2;
2947 typedef union
2949 struct
2951 unsigned RBIP : 1;
2952 unsigned : 1;
2953 unsigned TMR0IP : 1;
2954 unsigned : 1;
2955 unsigned INTEDG2 : 1;
2956 unsigned INTEDG1 : 1;
2957 unsigned INTEDG0 : 1;
2958 unsigned NOT_RBPU : 1;
2961 struct
2963 unsigned : 1;
2964 unsigned : 1;
2965 unsigned : 1;
2966 unsigned : 1;
2967 unsigned : 1;
2968 unsigned : 1;
2969 unsigned : 1;
2970 unsigned RBPU : 1;
2972 } __INTCON2bits_t;
2974 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2976 #define _RBIP 0x01
2977 #define _TMR0IP 0x04
2978 #define _INTEDG2 0x10
2979 #define _INTEDG1 0x20
2980 #define _INTEDG0 0x40
2981 #define _NOT_RBPU 0x80
2982 #define _RBPU 0x80
2984 //==============================================================================
2987 //==============================================================================
2988 // INTCON Bits
2990 extern __at(0x0FF2) __sfr INTCON;
2992 typedef union
2994 struct
2996 unsigned RBIF : 1;
2997 unsigned INT0IF : 1;
2998 unsigned TMR0IF : 1;
2999 unsigned RBIE : 1;
3000 unsigned INT0IE : 1;
3001 unsigned TMR0IE : 1;
3002 unsigned PEIE_GIEL : 1;
3003 unsigned GIE_GIEH : 1;
3006 struct
3008 unsigned : 1;
3009 unsigned INT0F : 1;
3010 unsigned T0IF : 1;
3011 unsigned : 1;
3012 unsigned INT0E : 1;
3013 unsigned T0IE : 1;
3014 unsigned PEIE : 1;
3015 unsigned GIE : 1;
3018 struct
3020 unsigned : 1;
3021 unsigned : 1;
3022 unsigned : 1;
3023 unsigned : 1;
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned GIEL : 1;
3027 unsigned GIEH : 1;
3029 } __INTCONbits_t;
3031 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3033 #define _RBIF 0x01
3034 #define _INT0IF 0x02
3035 #define _INT0F 0x02
3036 #define _TMR0IF 0x04
3037 #define _T0IF 0x04
3038 #define _RBIE 0x08
3039 #define _INT0IE 0x10
3040 #define _INT0E 0x10
3041 #define _TMR0IE 0x20
3042 #define _T0IE 0x20
3043 #define _PEIE_GIEL 0x40
3044 #define _PEIE 0x40
3045 #define _GIEL 0x40
3046 #define _GIE_GIEH 0x80
3047 #define _GIE 0x80
3048 #define _GIEH 0x80
3050 //==============================================================================
3052 extern __at(0x0FF3) __sfr PROD;
3053 extern __at(0x0FF3) __sfr PRODL;
3054 extern __at(0x0FF4) __sfr PRODH;
3055 extern __at(0x0FF5) __sfr TABLAT;
3056 extern __at(0x0FF6) __sfr TBLPTR;
3057 extern __at(0x0FF6) __sfr TBLPTRL;
3058 extern __at(0x0FF7) __sfr TBLPTRH;
3059 extern __at(0x0FF8) __sfr TBLPTRU;
3060 extern __at(0x0FF9) __sfr PC;
3061 extern __at(0x0FF9) __sfr PCL;
3062 extern __at(0x0FFA) __sfr PCLATH;
3063 extern __at(0x0FFB) __sfr PCLATU;
3065 //==============================================================================
3066 // STKPTR Bits
3068 extern __at(0x0FFC) __sfr STKPTR;
3070 typedef union
3072 struct
3074 unsigned SP0 : 1;
3075 unsigned SP1 : 1;
3076 unsigned SP2 : 1;
3077 unsigned SP3 : 1;
3078 unsigned SP4 : 1;
3079 unsigned : 1;
3080 unsigned STKUNF : 1;
3081 unsigned STKFUL : 1;
3084 struct
3086 unsigned : 1;
3087 unsigned : 1;
3088 unsigned : 1;
3089 unsigned : 1;
3090 unsigned : 1;
3091 unsigned : 1;
3092 unsigned : 1;
3093 unsigned STKOVF : 1;
3096 struct
3098 unsigned SP : 5;
3099 unsigned : 3;
3101 } __STKPTRbits_t;
3103 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3105 #define _SP0 0x01
3106 #define _SP1 0x02
3107 #define _SP2 0x04
3108 #define _SP3 0x08
3109 #define _SP4 0x10
3110 #define _STKUNF 0x40
3111 #define _STKFUL 0x80
3112 #define _STKOVF 0x80
3114 //==============================================================================
3116 extern __at(0x0FFD) __sfr TOS;
3117 extern __at(0x0FFD) __sfr TOSL;
3118 extern __at(0x0FFE) __sfr TOSH;
3119 extern __at(0x0FFF) __sfr TOSU;
3121 //==============================================================================
3123 // Configuration Bits
3125 //==============================================================================
3127 #define __CONFIG1H 0x300001
3128 #define __CONFIG2L 0x300002
3129 #define __CONFIG2H 0x300003
3130 #define __CONFIG3H 0x300005
3131 #define __CONFIG4L 0x300006
3132 #define __CONFIG5L 0x300008
3133 #define __CONFIG5H 0x300009
3134 #define __CONFIG6L 0x30000A
3135 #define __CONFIG6H 0x30000B
3136 #define __CONFIG7L 0x30000C
3137 #define __CONFIG7H 0x30000D
3139 //----------------------------- CONFIG1H Options -------------------------------
3141 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3142 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3143 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3144 #define _FOSC_RC_1H 0xF3 // External RC oscillator, CLKOUT function on RA6.
3145 #define _FOSC_EC_1H 0xF4 // EC oscillator, CLKOUT function on RA6.
3146 #define _FOSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
3147 #define _FOSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3148 #define _FOSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
3149 #define _FOSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
3150 #define _FOSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKOUT function on RA6, port function on RA7.
3151 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3152 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3153 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3154 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3156 //----------------------------- CONFIG2L Options -------------------------------
3158 #define _PWRT_ON_2L 0xFE // PWRT enabled.
3159 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
3160 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3161 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3162 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3163 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3164 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3165 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3166 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3167 #define _BORV_18_2L 0xFF // VBOR set to 1.8 V nominal.
3169 //----------------------------- CONFIG2H Options -------------------------------
3171 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3172 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3173 #define _WDTPS_1_2H 0xE1 // 1:1.
3174 #define _WDTPS_2_2H 0xE3 // 1:2.
3175 #define _WDTPS_4_2H 0xE5 // 1:4.
3176 #define _WDTPS_8_2H 0xE7 // 1:8.
3177 #define _WDTPS_16_2H 0xE9 // 1:16.
3178 #define _WDTPS_32_2H 0xEB // 1:32.
3179 #define _WDTPS_64_2H 0xED // 1:64.
3180 #define _WDTPS_128_2H 0xEF // 1:128.
3181 #define _WDTPS_256_2H 0xF1 // 1:256.
3182 #define _WDTPS_512_2H 0xF3 // 1:512.
3183 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3184 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3185 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3186 #define _WDTPS_8192_2H 0xFB // 1:8192.
3187 #define _WDTPS_16384_2H 0xFD // 1:16384.
3188 #define _WDTPS_32768_2H 0xFF // 1:32768.
3190 //----------------------------- CONFIG3H Options -------------------------------
3192 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3193 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3194 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3195 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3196 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3197 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3198 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3199 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3200 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3201 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3203 //----------------------------- CONFIG4L Options -------------------------------
3205 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3206 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3207 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3208 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3209 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3210 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3211 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3212 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3214 //----------------------------- CONFIG5L Options -------------------------------
3216 #define _CP0_ON_5L 0xFE // Block 0 (000800-003FFFh) code-protected.
3217 #define _CP0_OFF_5L 0xFF // Block 0 (000800-003FFFh) not code-protected.
3218 #define _CP1_ON_5L 0xFD // Block 1 (004000-007FFFh) code-protected.
3219 #define _CP1_OFF_5L 0xFF // Block 1 (004000-007FFFh) not code-protected.
3220 #define _CP2_ON_5L 0xFB // Block 2 (008000-00BFFFh) code-protected.
3221 #define _CP2_OFF_5L 0xFF // Block 2 (008000-00BFFFh) not code-protected.
3222 #define _CP3_ON_5L 0xF7 // Block 3 (00C000-00FFFFh) code-protected.
3223 #define _CP3_OFF_5L 0xFF // Block 3 (00C000-00FFFFh) not code-protected.
3225 //----------------------------- CONFIG5H Options -------------------------------
3227 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3228 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3229 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3230 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3232 //----------------------------- CONFIG6L Options -------------------------------
3234 #define _WRT0_ON_6L 0xFE // Block 0 (000800-003FFFh) write-protected.
3235 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-003FFFh) not write-protected.
3236 #define _WRT1_ON_6L 0xFD // Block 1 (004000-007FFFh) write-protected.
3237 #define _WRT1_OFF_6L 0xFF // Block 1 (004000-007FFFh) not write-protected.
3238 #define _WRT2_ON_6L 0xFB // Block 2 (008000-00BFFFh) write-protected.
3239 #define _WRT2_OFF_6L 0xFF // Block 2 (008000-00BFFFh) not write-protected.
3240 #define _WRT3_ON_6L 0xF7 // Block 3 (00C000h-00FFFFh) write-protected.
3241 #define _WRT3_OFF_6L 0xFF // Block 3 (00C000h-00FFFFh) not write-protected.
3243 //----------------------------- CONFIG6H Options -------------------------------
3245 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3246 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3247 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0007FFh) write-protected.
3248 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0007FFh) not write-protected.
3249 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3250 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3252 //----------------------------- CONFIG7L Options -------------------------------
3254 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-003FFFh) protected from table reads executed in other blocks.
3255 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-003FFFh) not protected from table reads executed in other blocks.
3256 #define _EBTR1_ON_7L 0xFD // Block 1 (004000-007FFFh) protected from table reads executed in other blocks.
3257 #define _EBTR1_OFF_7L 0xFF // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks.
3258 #define _EBTR2_ON_7L 0xFB // Block 2 (008000-00BFFFh) protected from table reads executed in other blocks.
3259 #define _EBTR2_OFF_7L 0xFF // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks.
3260 #define _EBTR3_ON_7L 0xF7 // Block 3 (00C000-00FFFFh) protected from table reads executed in other blocks.
3261 #define _EBTR3_OFF_7L 0xFF // Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks.
3263 //----------------------------- CONFIG7H Options -------------------------------
3265 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0007FFh) protected from table reads executed in other blocks.
3266 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks.
3268 //==============================================================================
3270 #define __DEVID1 0x3FFFFE
3271 #define __DEVID2 0x3FFFFF
3273 #define __IDLOC0 0x200000
3274 #define __IDLOC1 0x200001
3275 #define __IDLOC2 0x200002
3276 #define __IDLOC3 0x200003
3277 #define __IDLOC4 0x200004
3278 #define __IDLOC5 0x200005
3279 #define __IDLOC6 0x200006
3280 #define __IDLOC7 0x200007
3282 #endif // #ifndef __PIC18F26K20_H__