Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f14k22.h
blob4b00fe04829c18912b8fae431467c37aedfb22a6
1 /*
2 * This declarations of the PIC18F14K22 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:26 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 __PIC18F14K22_H__
26 #define __PIC18F14K22_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // SRCON0 Bits
40 extern __at(0x0F68) __sfr SRCON0;
42 typedef union
44 struct
46 unsigned SRPR : 1;
47 unsigned SRPS : 1;
48 unsigned SRNQEN : 1;
49 unsigned SRQEN : 1;
50 unsigned SRCLK0 : 1;
51 unsigned SRCLK1 : 1;
52 unsigned SRCLK2 : 1;
53 unsigned SRLEN : 1;
56 struct
58 unsigned : 4;
59 unsigned SRCLK : 3;
60 unsigned : 1;
62 } __SRCON0bits_t;
64 extern __at(0x0F68) volatile __SRCON0bits_t SRCON0bits;
66 #define _SRPR 0x01
67 #define _SRPS 0x02
68 #define _SRNQEN 0x04
69 #define _SRQEN 0x08
70 #define _SRCLK0 0x10
71 #define _SRCLK1 0x20
72 #define _SRCLK2 0x40
73 #define _SRLEN 0x80
75 //==============================================================================
78 //==============================================================================
79 // SRCON1 Bits
81 extern __at(0x0F69) __sfr SRCON1;
83 typedef struct
85 unsigned SRRC1E : 1;
86 unsigned SRRC2E : 1;
87 unsigned SRRCKE : 1;
88 unsigned SRRPE : 1;
89 unsigned SRSC1E : 1;
90 unsigned SRSC2E : 1;
91 unsigned SRSCKE : 1;
92 unsigned SRSPE : 1;
93 } __SRCON1bits_t;
95 extern __at(0x0F69) volatile __SRCON1bits_t SRCON1bits;
97 #define _SRRC1E 0x01
98 #define _SRRC2E 0x02
99 #define _SRRCKE 0x04
100 #define _SRRPE 0x08
101 #define _SRSC1E 0x10
102 #define _SRSC2E 0x20
103 #define _SRSCKE 0x40
104 #define _SRSPE 0x80
106 //==============================================================================
109 //==============================================================================
110 // CM2CON0 Bits
112 extern __at(0x0F6B) __sfr CM2CON0;
114 typedef union
116 struct
118 unsigned C2CH0 : 1;
119 unsigned C2CH1 : 1;
120 unsigned C2R : 1;
121 unsigned C2SP : 1;
122 unsigned C2POL : 1;
123 unsigned C2OE : 1;
124 unsigned C2OUT : 1;
125 unsigned C2ON : 1;
128 struct
130 unsigned C2CH : 2;
131 unsigned : 6;
133 } __CM2CON0bits_t;
135 extern __at(0x0F6B) volatile __CM2CON0bits_t CM2CON0bits;
137 #define _C2CH0 0x01
138 #define _C2CH1 0x02
139 #define _C2R 0x04
140 #define _C2SP 0x08
141 #define _C2POL 0x10
142 #define _C2OE 0x20
143 #define _C2OUT 0x40
144 #define _C2ON 0x80
146 //==============================================================================
149 //==============================================================================
150 // CM2CON1 Bits
152 extern __at(0x0F6C) __sfr CM2CON1;
154 typedef struct
156 unsigned C2SYNC : 1;
157 unsigned C1SYNC : 1;
158 unsigned C2HYS : 1;
159 unsigned C1HYS : 1;
160 unsigned C2RSEL : 1;
161 unsigned C1RSEL : 1;
162 unsigned MC2OUT : 1;
163 unsigned MC1OUT : 1;
164 } __CM2CON1bits_t;
166 extern __at(0x0F6C) volatile __CM2CON1bits_t CM2CON1bits;
168 #define _C2SYNC 0x01
169 #define _C1SYNC 0x02
170 #define _C2HYS 0x04
171 #define _C1HYS 0x08
172 #define _C2RSEL 0x10
173 #define _C1RSEL 0x20
174 #define _MC2OUT 0x40
175 #define _MC1OUT 0x80
177 //==============================================================================
180 //==============================================================================
181 // CM1CON0 Bits
183 extern __at(0x0F6D) __sfr CM1CON0;
185 typedef union
187 struct
189 unsigned C1CH0 : 1;
190 unsigned C1CH1 : 1;
191 unsigned C1R : 1;
192 unsigned C1SP : 1;
193 unsigned C1POL : 1;
194 unsigned C1OE : 1;
195 unsigned C1OUT : 1;
196 unsigned C1ON : 1;
199 struct
201 unsigned C1CH : 2;
202 unsigned : 6;
204 } __CM1CON0bits_t;
206 extern __at(0x0F6D) volatile __CM1CON0bits_t CM1CON0bits;
208 #define _C1CH0 0x01
209 #define _C1CH1 0x02
210 #define _C1R 0x04
211 #define _C1SP 0x08
212 #define _C1POL 0x10
213 #define _C1OE 0x20
214 #define _C1OUT 0x40
215 #define _C1ON 0x80
217 //==============================================================================
220 //==============================================================================
221 // SSPMSK Bits
223 extern __at(0x0F6F) __sfr SSPMSK;
225 typedef struct
227 unsigned MSK0 : 1;
228 unsigned MSK1 : 1;
229 unsigned MSK2 : 1;
230 unsigned MSK3 : 1;
231 unsigned MSK4 : 1;
232 unsigned MSK5 : 1;
233 unsigned MSK6 : 1;
234 unsigned MSK7 : 1;
235 } __SSPMSKbits_t;
237 extern __at(0x0F6F) volatile __SSPMSKbits_t SSPMSKbits;
239 #define _MSK0 0x01
240 #define _MSK1 0x02
241 #define _MSK2 0x04
242 #define _MSK3 0x08
243 #define _MSK4 0x10
244 #define _MSK5 0x20
245 #define _MSK6 0x40
246 #define _MSK7 0x80
248 //==============================================================================
251 //==============================================================================
252 // SLRCON Bits
254 extern __at(0x0F76) __sfr SLRCON;
256 typedef struct
258 unsigned SLRA : 1;
259 unsigned SLRB : 1;
260 unsigned SLRC : 1;
261 unsigned : 1;
262 unsigned : 1;
263 unsigned : 1;
264 unsigned : 1;
265 unsigned : 1;
266 } __SLRCONbits_t;
268 extern __at(0x0F76) volatile __SLRCONbits_t SLRCONbits;
270 #define _SLRA 0x01
271 #define _SLRB 0x02
272 #define _SLRC 0x04
274 //==============================================================================
277 //==============================================================================
278 // WPUA Bits
280 extern __at(0x0F77) __sfr WPUA;
282 typedef union
284 struct
286 unsigned WPUA0 : 1;
287 unsigned WPUA1 : 1;
288 unsigned WPUA2 : 1;
289 unsigned WPUA3 : 1;
290 unsigned WPUA4 : 1;
291 unsigned WPUA5 : 1;
292 unsigned : 1;
293 unsigned : 1;
296 struct
298 unsigned WPUA : 6;
299 unsigned : 2;
301 } __WPUAbits_t;
303 extern __at(0x0F77) volatile __WPUAbits_t WPUAbits;
305 #define _WPUA0 0x01
306 #define _WPUA1 0x02
307 #define _WPUA2 0x04
308 #define _WPUA3 0x08
309 #define _WPUA4 0x10
310 #define _WPUA5 0x20
312 //==============================================================================
315 //==============================================================================
316 // WPUB Bits
318 extern __at(0x0F78) __sfr WPUB;
320 typedef struct
322 unsigned : 1;
323 unsigned : 1;
324 unsigned : 1;
325 unsigned : 1;
326 unsigned WPUB4 : 1;
327 unsigned WPUB5 : 1;
328 unsigned WPUB6 : 1;
329 unsigned WPUB7 : 1;
330 } __WPUBbits_t;
332 extern __at(0x0F78) volatile __WPUBbits_t WPUBbits;
334 #define _WPUB4 0x10
335 #define _WPUB5 0x20
336 #define _WPUB6 0x40
337 #define _WPUB7 0x80
339 //==============================================================================
342 //==============================================================================
343 // IOCA Bits
345 extern __at(0x0F79) __sfr IOCA;
347 typedef union
349 struct
351 unsigned IOCA0 : 1;
352 unsigned IOCA1 : 1;
353 unsigned IOCA2 : 1;
354 unsigned IOCA3 : 1;
355 unsigned IOCA4 : 1;
356 unsigned IOCA5 : 1;
357 unsigned : 1;
358 unsigned : 1;
361 struct
363 unsigned IOCA : 6;
364 unsigned : 2;
366 } __IOCAbits_t;
368 extern __at(0x0F79) volatile __IOCAbits_t IOCAbits;
370 #define _IOCA0 0x01
371 #define _IOCA1 0x02
372 #define _IOCA2 0x04
373 #define _IOCA3 0x08
374 #define _IOCA4 0x10
375 #define _IOCA5 0x20
377 //==============================================================================
380 //==============================================================================
381 // IOCB Bits
383 extern __at(0x0F7A) __sfr IOCB;
385 typedef struct
387 unsigned : 1;
388 unsigned : 1;
389 unsigned : 1;
390 unsigned : 1;
391 unsigned IOCB4 : 1;
392 unsigned IOCB5 : 1;
393 unsigned IOCB6 : 1;
394 unsigned IOCB7 : 1;
395 } __IOCBbits_t;
397 extern __at(0x0F7A) volatile __IOCBbits_t IOCBbits;
399 #define _IOCB4 0x10
400 #define _IOCB5 0x20
401 #define _IOCB6 0x40
402 #define _IOCB7 0x80
404 //==============================================================================
407 //==============================================================================
408 // ANSEL Bits
410 extern __at(0x0F7E) __sfr ANSEL;
412 typedef union
414 struct
416 unsigned ANS0 : 1;
417 unsigned ANS1 : 1;
418 unsigned ANS2 : 1;
419 unsigned ANS3 : 1;
420 unsigned ANS4 : 1;
421 unsigned ANS5 : 1;
422 unsigned ANS6 : 1;
423 unsigned ANS7 : 1;
426 struct
428 unsigned ANSEL0 : 1;
429 unsigned ANSEL1 : 1;
430 unsigned ANSEL2 : 1;
431 unsigned ANSEL3 : 1;
432 unsigned ANSEL4 : 1;
433 unsigned ANSEL5 : 1;
434 unsigned ANSEL6 : 1;
435 unsigned ANSEL7 : 1;
437 } __ANSELbits_t;
439 extern __at(0x0F7E) volatile __ANSELbits_t ANSELbits;
441 #define _ANS0 0x01
442 #define _ANSEL0 0x01
443 #define _ANS1 0x02
444 #define _ANSEL1 0x02
445 #define _ANS2 0x04
446 #define _ANSEL2 0x04
447 #define _ANS3 0x08
448 #define _ANSEL3 0x08
449 #define _ANS4 0x10
450 #define _ANSEL4 0x10
451 #define _ANS5 0x20
452 #define _ANSEL5 0x20
453 #define _ANS6 0x40
454 #define _ANSEL6 0x40
455 #define _ANS7 0x80
456 #define _ANSEL7 0x80
458 //==============================================================================
461 //==============================================================================
462 // ANSELH Bits
464 extern __at(0x0F7F) __sfr ANSELH;
466 typedef union
468 struct
470 unsigned ANS8 : 1;
471 unsigned ANS9 : 1;
472 unsigned ANS10 : 1;
473 unsigned ANS11 : 1;
474 unsigned : 1;
475 unsigned : 1;
476 unsigned : 1;
477 unsigned : 1;
480 struct
482 unsigned ANSEL8 : 1;
483 unsigned ANSEL9 : 1;
484 unsigned ANSEL10 : 1;
485 unsigned ANSEL11 : 1;
486 unsigned : 1;
487 unsigned : 1;
488 unsigned : 1;
489 unsigned : 1;
491 } __ANSELHbits_t;
493 extern __at(0x0F7F) volatile __ANSELHbits_t ANSELHbits;
495 #define _ANS8 0x01
496 #define _ANSEL8 0x01
497 #define _ANS9 0x02
498 #define _ANSEL9 0x02
499 #define _ANS10 0x04
500 #define _ANSEL10 0x04
501 #define _ANS11 0x08
502 #define _ANSEL11 0x08
504 //==============================================================================
507 //==============================================================================
508 // PORTA Bits
510 extern __at(0x0F80) __sfr PORTA;
512 typedef union
514 struct
516 unsigned RA0 : 1;
517 unsigned RA1 : 1;
518 unsigned RA2 : 1;
519 unsigned RA3 : 1;
520 unsigned RA4 : 1;
521 unsigned RA5 : 1;
522 unsigned : 1;
523 unsigned : 1;
526 struct
528 unsigned AN0 : 1;
529 unsigned AN1 : 1;
530 unsigned AN2 : 1;
531 unsigned MCLR : 1;
532 unsigned AN3 : 1;
533 unsigned T13CKI : 1;
534 unsigned : 1;
535 unsigned : 1;
538 struct
540 unsigned CVREF : 1;
541 unsigned C12IN0M : 1;
542 unsigned T0CKI : 1;
543 unsigned NOT_MCLR : 1;
544 unsigned OSC2 : 1;
545 unsigned OSC1 : 1;
546 unsigned : 1;
547 unsigned : 1;
550 struct
552 unsigned VREFM : 1;
553 unsigned VREFP : 1;
554 unsigned INT2 : 1;
555 unsigned VPP : 1;
556 unsigned CLKOUT : 1;
557 unsigned CLKIN : 1;
558 unsigned : 1;
559 unsigned : 1;
562 struct
564 unsigned INT0 : 1;
565 unsigned INT1 : 1;
566 unsigned SRQ : 1;
567 unsigned : 1;
568 unsigned : 1;
569 unsigned : 1;
570 unsigned : 1;
571 unsigned : 1;
574 struct
576 unsigned PGD : 1;
577 unsigned PGC : 1;
578 unsigned : 1;
579 unsigned : 1;
580 unsigned : 1;
581 unsigned : 1;
582 unsigned : 1;
583 unsigned : 1;
586 struct
588 unsigned C1INP : 1;
589 unsigned : 1;
590 unsigned : 1;
591 unsigned : 1;
592 unsigned : 1;
593 unsigned : 1;
594 unsigned : 1;
595 unsigned : 1;
598 struct
600 unsigned INT : 3;
601 unsigned : 5;
604 struct
606 unsigned RA : 6;
607 unsigned : 2;
609 } __PORTAbits_t;
611 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
613 #define _PORTA_RA0 0x01
614 #define _PORTA_AN0 0x01
615 #define _PORTA_CVREF 0x01
616 #define _PORTA_VREFM 0x01
617 #define _PORTA_INT0 0x01
618 #define _PORTA_PGD 0x01
619 #define _PORTA_C1INP 0x01
620 #define _PORTA_RA1 0x02
621 #define _PORTA_AN1 0x02
622 #define _PORTA_C12IN0M 0x02
623 #define _PORTA_VREFP 0x02
624 #define _PORTA_INT1 0x02
625 #define _PORTA_PGC 0x02
626 #define _PORTA_RA2 0x04
627 #define _PORTA_AN2 0x04
628 #define _PORTA_T0CKI 0x04
629 #define _PORTA_INT2 0x04
630 #define _PORTA_SRQ 0x04
631 #define _PORTA_RA3 0x08
632 #define _PORTA_MCLR 0x08
633 #define _PORTA_NOT_MCLR 0x08
634 #define _PORTA_VPP 0x08
635 #define _PORTA_RA4 0x10
636 #define _PORTA_AN3 0x10
637 #define _PORTA_OSC2 0x10
638 #define _PORTA_CLKOUT 0x10
639 #define _PORTA_RA5 0x20
640 #define _PORTA_T13CKI 0x20
641 #define _PORTA_OSC1 0x20
642 #define _PORTA_CLKIN 0x20
644 //==============================================================================
647 //==============================================================================
648 // PORTB Bits
650 extern __at(0x0F81) __sfr PORTB;
652 typedef union
654 struct
656 unsigned : 1;
657 unsigned : 1;
658 unsigned : 1;
659 unsigned : 1;
660 unsigned RB4 : 1;
661 unsigned RB5 : 1;
662 unsigned RB6 : 1;
663 unsigned RB7 : 1;
666 struct
668 unsigned : 1;
669 unsigned : 1;
670 unsigned : 1;
671 unsigned : 1;
672 unsigned SDI : 1;
673 unsigned RX : 1;
674 unsigned SCL : 1;
675 unsigned TX : 1;
678 struct
680 unsigned : 1;
681 unsigned : 1;
682 unsigned : 1;
683 unsigned : 1;
684 unsigned SDA : 1;
685 unsigned AN11 : 1;
686 unsigned SCK : 1;
687 unsigned CK : 1;
690 struct
692 unsigned : 1;
693 unsigned : 1;
694 unsigned : 1;
695 unsigned : 1;
696 unsigned AN10 : 1;
697 unsigned : 1;
698 unsigned : 1;
699 unsigned : 1;
701 } __PORTBbits_t;
703 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
705 #define _PORTB_RB4 0x10
706 #define _PORTB_SDI 0x10
707 #define _PORTB_SDA 0x10
708 #define _PORTB_AN10 0x10
709 #define _PORTB_RB5 0x20
710 #define _PORTB_RX 0x20
711 #define _PORTB_AN11 0x20
712 #define _PORTB_RB6 0x40
713 #define _PORTB_SCL 0x40
714 #define _PORTB_SCK 0x40
715 #define _PORTB_RB7 0x80
716 #define _PORTB_TX 0x80
717 #define _PORTB_CK 0x80
719 //==============================================================================
722 //==============================================================================
723 // PORTC Bits
725 extern __at(0x0F82) __sfr PORTC;
727 typedef union
729 struct
731 unsigned RC0 : 1;
732 unsigned RC1 : 1;
733 unsigned RC2 : 1;
734 unsigned RC3 : 1;
735 unsigned RC4 : 1;
736 unsigned RC5 : 1;
737 unsigned RC6 : 1;
738 unsigned RC7 : 1;
741 struct
743 unsigned AN4 : 1;
744 unsigned AN5 : 1;
745 unsigned AN6 : 1;
746 unsigned AN7 : 1;
747 unsigned SRNQ : 1;
748 unsigned P1A : 1;
749 unsigned AN8 : 1;
750 unsigned AN9 : 1;
753 struct
755 unsigned C12INP : 1;
756 unsigned C12IN1M : 1;
757 unsigned C12IN2M : 1;
758 unsigned C12IN3M : 1;
759 unsigned C12OUT : 1;
760 unsigned CCP1 : 1;
761 unsigned SS : 1;
762 unsigned SDO : 1;
765 struct
767 unsigned C2INP : 1;
768 unsigned : 1;
769 unsigned P1D : 1;
770 unsigned P1C : 1;
771 unsigned P1B : 1;
772 unsigned : 1;
773 unsigned NOT_SS : 1;
774 unsigned : 1;
777 struct
779 unsigned : 1;
780 unsigned : 1;
781 unsigned : 1;
782 unsigned PGM : 1;
783 unsigned : 1;
784 unsigned : 1;
785 unsigned : 1;
786 unsigned : 1;
788 } __PORTCbits_t;
790 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
792 #define _PORTC_RC0 0x01
793 #define _PORTC_AN4 0x01
794 #define _PORTC_C12INP 0x01
795 #define _PORTC_C2INP 0x01
796 #define _PORTC_RC1 0x02
797 #define _PORTC_AN5 0x02
798 #define _PORTC_C12IN1M 0x02
799 #define _PORTC_RC2 0x04
800 #define _PORTC_AN6 0x04
801 #define _PORTC_C12IN2M 0x04
802 #define _PORTC_P1D 0x04
803 #define _PORTC_RC3 0x08
804 #define _PORTC_AN7 0x08
805 #define _PORTC_C12IN3M 0x08
806 #define _PORTC_P1C 0x08
807 #define _PORTC_PGM 0x08
808 #define _PORTC_RC4 0x10
809 #define _PORTC_SRNQ 0x10
810 #define _PORTC_C12OUT 0x10
811 #define _PORTC_P1B 0x10
812 #define _PORTC_RC5 0x20
813 #define _PORTC_P1A 0x20
814 #define _PORTC_CCP1 0x20
815 #define _PORTC_RC6 0x40
816 #define _PORTC_AN8 0x40
817 #define _PORTC_SS 0x40
818 #define _PORTC_NOT_SS 0x40
819 #define _PORTC_RC7 0x80
820 #define _PORTC_AN9 0x80
821 #define _PORTC_SDO 0x80
823 //==============================================================================
826 //==============================================================================
827 // LATA Bits
829 extern __at(0x0F89) __sfr LATA;
831 typedef struct
833 unsigned LATA0 : 1;
834 unsigned LATA1 : 1;
835 unsigned LATA2 : 1;
836 unsigned : 1;
837 unsigned LATA4 : 1;
838 unsigned LATA5 : 1;
839 unsigned : 1;
840 unsigned : 1;
841 } __LATAbits_t;
843 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
845 #define _LATA0 0x01
846 #define _LATA1 0x02
847 #define _LATA2 0x04
848 #define _LATA4 0x10
849 #define _LATA5 0x20
851 //==============================================================================
854 //==============================================================================
855 // LATB Bits
857 extern __at(0x0F8A) __sfr LATB;
859 typedef struct
861 unsigned : 1;
862 unsigned : 1;
863 unsigned : 1;
864 unsigned : 1;
865 unsigned LATB4 : 1;
866 unsigned LATB5 : 1;
867 unsigned LATB6 : 1;
868 unsigned LATB7 : 1;
869 } __LATBbits_t;
871 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
873 #define _LATB4 0x10
874 #define _LATB5 0x20
875 #define _LATB6 0x40
876 #define _LATB7 0x80
878 //==============================================================================
881 //==============================================================================
882 // LATC Bits
884 extern __at(0x0F8B) __sfr LATC;
886 typedef struct
888 unsigned LATC0 : 1;
889 unsigned LATC1 : 1;
890 unsigned LATC2 : 1;
891 unsigned LATC3 : 1;
892 unsigned LATC4 : 1;
893 unsigned LATC5 : 1;
894 unsigned LATC6 : 1;
895 unsigned LATC7 : 1;
896 } __LATCbits_t;
898 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
900 #define _LATC0 0x01
901 #define _LATC1 0x02
902 #define _LATC2 0x04
903 #define _LATC3 0x08
904 #define _LATC4 0x10
905 #define _LATC5 0x20
906 #define _LATC6 0x40
907 #define _LATC7 0x80
909 //==============================================================================
912 //==============================================================================
913 // DDRA Bits
915 extern __at(0x0F92) __sfr DDRA;
917 typedef union
919 struct
921 unsigned TRISA0 : 1;
922 unsigned TRISA1 : 1;
923 unsigned TRISA2 : 1;
924 unsigned : 1;
925 unsigned TRISA4 : 1;
926 unsigned TRISA5 : 1;
927 unsigned : 1;
928 unsigned : 1;
931 struct
933 unsigned RA0 : 1;
934 unsigned RA1 : 1;
935 unsigned RA2 : 1;
936 unsigned : 1;
937 unsigned RA4 : 1;
938 unsigned RA5 : 1;
939 unsigned : 1;
940 unsigned : 1;
942 } __DDRAbits_t;
944 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
946 #define _TRISA0 0x01
947 #define _RA0 0x01
948 #define _TRISA1 0x02
949 #define _RA1 0x02
950 #define _TRISA2 0x04
951 #define _RA2 0x04
952 #define _TRISA4 0x10
953 #define _RA4 0x10
954 #define _TRISA5 0x20
955 #define _RA5 0x20
957 //==============================================================================
960 //==============================================================================
961 // TRISA Bits
963 extern __at(0x0F92) __sfr TRISA;
965 typedef union
967 struct
969 unsigned TRISA0 : 1;
970 unsigned TRISA1 : 1;
971 unsigned TRISA2 : 1;
972 unsigned : 1;
973 unsigned TRISA4 : 1;
974 unsigned TRISA5 : 1;
975 unsigned : 1;
976 unsigned : 1;
979 struct
981 unsigned RA0 : 1;
982 unsigned RA1 : 1;
983 unsigned RA2 : 1;
984 unsigned : 1;
985 unsigned RA4 : 1;
986 unsigned RA5 : 1;
987 unsigned : 1;
988 unsigned : 1;
990 } __TRISAbits_t;
992 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
994 #define _TRISA_TRISA0 0x01
995 #define _TRISA_RA0 0x01
996 #define _TRISA_TRISA1 0x02
997 #define _TRISA_RA1 0x02
998 #define _TRISA_TRISA2 0x04
999 #define _TRISA_RA2 0x04
1000 #define _TRISA_TRISA4 0x10
1001 #define _TRISA_RA4 0x10
1002 #define _TRISA_TRISA5 0x20
1003 #define _TRISA_RA5 0x20
1005 //==============================================================================
1008 //==============================================================================
1009 // DDRB Bits
1011 extern __at(0x0F93) __sfr DDRB;
1013 typedef union
1015 struct
1017 unsigned : 1;
1018 unsigned : 1;
1019 unsigned : 1;
1020 unsigned : 1;
1021 unsigned TRISB4 : 1;
1022 unsigned TRISB5 : 1;
1023 unsigned TRISB6 : 1;
1024 unsigned TRISB7 : 1;
1027 struct
1029 unsigned : 1;
1030 unsigned : 1;
1031 unsigned : 1;
1032 unsigned : 1;
1033 unsigned RB4 : 1;
1034 unsigned RB5 : 1;
1035 unsigned RB6 : 1;
1036 unsigned RB7 : 1;
1038 } __DDRBbits_t;
1040 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1042 #define _TRISB4 0x10
1043 #define _RB4 0x10
1044 #define _TRISB5 0x20
1045 #define _RB5 0x20
1046 #define _TRISB6 0x40
1047 #define _RB6 0x40
1048 #define _TRISB7 0x80
1049 #define _RB7 0x80
1051 //==============================================================================
1054 //==============================================================================
1055 // TRISB Bits
1057 extern __at(0x0F93) __sfr TRISB;
1059 typedef union
1061 struct
1063 unsigned : 1;
1064 unsigned : 1;
1065 unsigned : 1;
1066 unsigned : 1;
1067 unsigned TRISB4 : 1;
1068 unsigned TRISB5 : 1;
1069 unsigned TRISB6 : 1;
1070 unsigned TRISB7 : 1;
1073 struct
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned : 1;
1078 unsigned : 1;
1079 unsigned RB4 : 1;
1080 unsigned RB5 : 1;
1081 unsigned RB6 : 1;
1082 unsigned RB7 : 1;
1084 } __TRISBbits_t;
1086 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1088 #define _TRISB_TRISB4 0x10
1089 #define _TRISB_RB4 0x10
1090 #define _TRISB_TRISB5 0x20
1091 #define _TRISB_RB5 0x20
1092 #define _TRISB_TRISB6 0x40
1093 #define _TRISB_RB6 0x40
1094 #define _TRISB_TRISB7 0x80
1095 #define _TRISB_RB7 0x80
1097 //==============================================================================
1100 //==============================================================================
1101 // DDRC Bits
1103 extern __at(0x0F94) __sfr DDRC;
1105 typedef union
1107 struct
1109 unsigned TRISC0 : 1;
1110 unsigned TRISC1 : 1;
1111 unsigned TRISC2 : 1;
1112 unsigned TRISC3 : 1;
1113 unsigned TRISC4 : 1;
1114 unsigned TRISC5 : 1;
1115 unsigned TRISC6 : 1;
1116 unsigned TRISC7 : 1;
1119 struct
1121 unsigned RC0 : 1;
1122 unsigned RC1 : 1;
1123 unsigned RC2 : 1;
1124 unsigned RC3 : 1;
1125 unsigned RC4 : 1;
1126 unsigned RC5 : 1;
1127 unsigned RC6 : 1;
1128 unsigned RC7 : 1;
1130 } __DDRCbits_t;
1132 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1134 #define _TRISC0 0x01
1135 #define _RC0 0x01
1136 #define _TRISC1 0x02
1137 #define _RC1 0x02
1138 #define _TRISC2 0x04
1139 #define _RC2 0x04
1140 #define _TRISC3 0x08
1141 #define _RC3 0x08
1142 #define _TRISC4 0x10
1143 #define _RC4 0x10
1144 #define _TRISC5 0x20
1145 #define _RC5 0x20
1146 #define _TRISC6 0x40
1147 #define _RC6 0x40
1148 #define _TRISC7 0x80
1149 #define _RC7 0x80
1151 //==============================================================================
1154 //==============================================================================
1155 // TRISC Bits
1157 extern __at(0x0F94) __sfr TRISC;
1159 typedef union
1161 struct
1163 unsigned TRISC0 : 1;
1164 unsigned TRISC1 : 1;
1165 unsigned TRISC2 : 1;
1166 unsigned TRISC3 : 1;
1167 unsigned TRISC4 : 1;
1168 unsigned TRISC5 : 1;
1169 unsigned TRISC6 : 1;
1170 unsigned TRISC7 : 1;
1173 struct
1175 unsigned RC0 : 1;
1176 unsigned RC1 : 1;
1177 unsigned RC2 : 1;
1178 unsigned RC3 : 1;
1179 unsigned RC4 : 1;
1180 unsigned RC5 : 1;
1181 unsigned RC6 : 1;
1182 unsigned RC7 : 1;
1184 } __TRISCbits_t;
1186 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1188 #define _TRISC_TRISC0 0x01
1189 #define _TRISC_RC0 0x01
1190 #define _TRISC_TRISC1 0x02
1191 #define _TRISC_RC1 0x02
1192 #define _TRISC_TRISC2 0x04
1193 #define _TRISC_RC2 0x04
1194 #define _TRISC_TRISC3 0x08
1195 #define _TRISC_RC3 0x08
1196 #define _TRISC_TRISC4 0x10
1197 #define _TRISC_RC4 0x10
1198 #define _TRISC_TRISC5 0x20
1199 #define _TRISC_RC5 0x20
1200 #define _TRISC_TRISC6 0x40
1201 #define _TRISC_RC6 0x40
1202 #define _TRISC_TRISC7 0x80
1203 #define _TRISC_RC7 0x80
1205 //==============================================================================
1208 //==============================================================================
1209 // OSCTUNE Bits
1211 extern __at(0x0F9B) __sfr OSCTUNE;
1213 typedef union
1215 struct
1217 unsigned TUN0 : 1;
1218 unsigned TUN1 : 1;
1219 unsigned TUN2 : 1;
1220 unsigned TUN3 : 1;
1221 unsigned TUN4 : 1;
1222 unsigned TUN5 : 1;
1223 unsigned PLLEN : 1;
1224 unsigned INTSRC : 1;
1227 struct
1229 unsigned TUN : 6;
1230 unsigned : 2;
1232 } __OSCTUNEbits_t;
1234 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1236 #define _TUN0 0x01
1237 #define _TUN1 0x02
1238 #define _TUN2 0x04
1239 #define _TUN3 0x08
1240 #define _TUN4 0x10
1241 #define _TUN5 0x20
1242 #define _PLLEN 0x40
1243 #define _INTSRC 0x80
1245 //==============================================================================
1248 //==============================================================================
1249 // PIE1 Bits
1251 extern __at(0x0F9D) __sfr PIE1;
1253 typedef struct
1255 unsigned TMR1IE : 1;
1256 unsigned TMR2IE : 1;
1257 unsigned CCP1IE : 1;
1258 unsigned SSPIE : 1;
1259 unsigned TXIE : 1;
1260 unsigned RCIE : 1;
1261 unsigned ADIE : 1;
1262 unsigned : 1;
1263 } __PIE1bits_t;
1265 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1267 #define _TMR1IE 0x01
1268 #define _TMR2IE 0x02
1269 #define _CCP1IE 0x04
1270 #define _SSPIE 0x08
1271 #define _TXIE 0x10
1272 #define _RCIE 0x20
1273 #define _ADIE 0x40
1275 //==============================================================================
1278 //==============================================================================
1279 // PIR1 Bits
1281 extern __at(0x0F9E) __sfr PIR1;
1283 typedef struct
1285 unsigned TMR1IF : 1;
1286 unsigned TMR2IF : 1;
1287 unsigned CCP1IF : 1;
1288 unsigned SSPIF : 1;
1289 unsigned TXIF : 1;
1290 unsigned RCIF : 1;
1291 unsigned ADIF : 1;
1292 unsigned : 1;
1293 } __PIR1bits_t;
1295 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1297 #define _TMR1IF 0x01
1298 #define _TMR2IF 0x02
1299 #define _CCP1IF 0x04
1300 #define _SSPIF 0x08
1301 #define _TXIF 0x10
1302 #define _RCIF 0x20
1303 #define _ADIF 0x40
1305 //==============================================================================
1308 //==============================================================================
1309 // IPR1 Bits
1311 extern __at(0x0F9F) __sfr IPR1;
1313 typedef struct
1315 unsigned TMR1IP : 1;
1316 unsigned TMR2IP : 1;
1317 unsigned CCP1IP : 1;
1318 unsigned SSPIP : 1;
1319 unsigned TXIP : 1;
1320 unsigned RCIP : 1;
1321 unsigned ADIP : 1;
1322 unsigned : 1;
1323 } __IPR1bits_t;
1325 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1327 #define _TMR1IP 0x01
1328 #define _TMR2IP 0x02
1329 #define _CCP1IP 0x04
1330 #define _SSPIP 0x08
1331 #define _TXIP 0x10
1332 #define _RCIP 0x20
1333 #define _ADIP 0x40
1335 //==============================================================================
1338 //==============================================================================
1339 // PIE2 Bits
1341 extern __at(0x0FA0) __sfr PIE2;
1343 typedef struct
1345 unsigned : 1;
1346 unsigned TMR3IE : 1;
1347 unsigned : 1;
1348 unsigned BCLIE : 1;
1349 unsigned EEIE : 1;
1350 unsigned C2IE : 1;
1351 unsigned C1IE : 1;
1352 unsigned OSCFIE : 1;
1353 } __PIE2bits_t;
1355 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1357 #define _TMR3IE 0x02
1358 #define _BCLIE 0x08
1359 #define _EEIE 0x10
1360 #define _C2IE 0x20
1361 #define _C1IE 0x40
1362 #define _OSCFIE 0x80
1364 //==============================================================================
1367 //==============================================================================
1368 // PIR2 Bits
1370 extern __at(0x0FA1) __sfr PIR2;
1372 typedef struct
1374 unsigned : 1;
1375 unsigned TMR3IF : 1;
1376 unsigned : 1;
1377 unsigned BCLIF : 1;
1378 unsigned EEIF : 1;
1379 unsigned C2IF : 1;
1380 unsigned C1IF : 1;
1381 unsigned OSCFIF : 1;
1382 } __PIR2bits_t;
1384 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1386 #define _TMR3IF 0x02
1387 #define _BCLIF 0x08
1388 #define _EEIF 0x10
1389 #define _C2IF 0x20
1390 #define _C1IF 0x40
1391 #define _OSCFIF 0x80
1393 //==============================================================================
1396 //==============================================================================
1397 // IPR2 Bits
1399 extern __at(0x0FA2) __sfr IPR2;
1401 typedef struct
1403 unsigned : 1;
1404 unsigned TMR3IP : 1;
1405 unsigned : 1;
1406 unsigned BCLIP : 1;
1407 unsigned EEIP : 1;
1408 unsigned C2IP : 1;
1409 unsigned C1IP : 1;
1410 unsigned OSCFIP : 1;
1411 } __IPR2bits_t;
1413 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1415 #define _TMR3IP 0x02
1416 #define _BCLIP 0x08
1417 #define _EEIP 0x10
1418 #define _C2IP 0x20
1419 #define _C1IP 0x40
1420 #define _OSCFIP 0x80
1422 //==============================================================================
1425 //==============================================================================
1426 // EECON1 Bits
1428 extern __at(0x0FA6) __sfr EECON1;
1430 typedef struct
1432 unsigned RD : 1;
1433 unsigned WR : 1;
1434 unsigned WREN : 1;
1435 unsigned WRERR : 1;
1436 unsigned FREE : 1;
1437 unsigned : 1;
1438 unsigned CFGS : 1;
1439 unsigned EEPGD : 1;
1440 } __EECON1bits_t;
1442 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1444 #define _RD 0x01
1445 #define _WR 0x02
1446 #define _WREN 0x04
1447 #define _WRERR 0x08
1448 #define _FREE 0x10
1449 #define _CFGS 0x40
1450 #define _EEPGD 0x80
1452 //==============================================================================
1454 extern __at(0x0FA7) __sfr EECON2;
1455 extern __at(0x0FA8) __sfr EEDATA;
1457 //==============================================================================
1458 // EEADR Bits
1460 extern __at(0x0FA9) __sfr EEADR;
1462 typedef struct
1464 unsigned EEADR0 : 1;
1465 unsigned EEADR1 : 1;
1466 unsigned EEADR2 : 1;
1467 unsigned EEADR3 : 1;
1468 unsigned EEADR4 : 1;
1469 unsigned EEADR5 : 1;
1470 unsigned EEADR6 : 1;
1471 unsigned EEADR7 : 1;
1472 } __EEADRbits_t;
1474 extern __at(0x0FA9) volatile __EEADRbits_t EEADRbits;
1476 #define _EEADR0 0x01
1477 #define _EEADR1 0x02
1478 #define _EEADR2 0x04
1479 #define _EEADR3 0x08
1480 #define _EEADR4 0x10
1481 #define _EEADR5 0x20
1482 #define _EEADR6 0x40
1483 #define _EEADR7 0x80
1485 //==============================================================================
1488 //==============================================================================
1489 // RCSTA Bits
1491 extern __at(0x0FAB) __sfr RCSTA;
1493 typedef union
1495 struct
1497 unsigned RX9D : 1;
1498 unsigned OERR : 1;
1499 unsigned FERR : 1;
1500 unsigned ADDEN : 1;
1501 unsigned CREN : 1;
1502 unsigned SREN : 1;
1503 unsigned RX9 : 1;
1504 unsigned SPEN : 1;
1507 struct
1509 unsigned : 1;
1510 unsigned : 1;
1511 unsigned : 1;
1512 unsigned ADEN : 1;
1513 unsigned : 1;
1514 unsigned : 1;
1515 unsigned : 1;
1516 unsigned : 1;
1518 } __RCSTAbits_t;
1520 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1522 #define _RX9D 0x01
1523 #define _OERR 0x02
1524 #define _FERR 0x04
1525 #define _ADDEN 0x08
1526 #define _ADEN 0x08
1527 #define _CREN 0x10
1528 #define _SREN 0x20
1529 #define _RX9 0x40
1530 #define _SPEN 0x80
1532 //==============================================================================
1535 //==============================================================================
1536 // TXSTA Bits
1538 extern __at(0x0FAC) __sfr TXSTA;
1540 typedef struct
1542 unsigned TX9D : 1;
1543 unsigned TRMT : 1;
1544 unsigned BRGH : 1;
1545 unsigned SENDB : 1;
1546 unsigned SYNC : 1;
1547 unsigned TXEN : 1;
1548 unsigned TX9 : 1;
1549 unsigned CSRC : 1;
1550 } __TXSTAbits_t;
1552 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1554 #define _TX9D 0x01
1555 #define _TRMT 0x02
1556 #define _BRGH 0x04
1557 #define _SENDB 0x08
1558 #define _SYNC 0x10
1559 #define _TXEN 0x20
1560 #define _TX9 0x40
1561 #define _CSRC 0x80
1563 //==============================================================================
1565 extern __at(0x0FAD) __sfr TXREG;
1566 extern __at(0x0FAE) __sfr RCREG;
1567 extern __at(0x0FAF) __sfr SPBRG;
1568 extern __at(0x0FB0) __sfr SPBRGH;
1570 //==============================================================================
1571 // T3CON Bits
1573 extern __at(0x0FB1) __sfr T3CON;
1575 typedef union
1577 struct
1579 unsigned TMR3ON : 1;
1580 unsigned TMR3CS : 1;
1581 unsigned NOT_T3SYNC : 1;
1582 unsigned T3CCP1 : 1;
1583 unsigned T3CKPS0 : 1;
1584 unsigned T3CKPS1 : 1;
1585 unsigned : 1;
1586 unsigned RD16 : 1;
1589 struct
1591 unsigned : 1;
1592 unsigned : 1;
1593 unsigned T3SYNC : 1;
1594 unsigned : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1597 unsigned : 1;
1598 unsigned : 1;
1601 struct
1603 unsigned : 4;
1604 unsigned T3CKPS : 2;
1605 unsigned : 2;
1607 } __T3CONbits_t;
1609 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1611 #define _T3CON_TMR3ON 0x01
1612 #define _T3CON_TMR3CS 0x02
1613 #define _T3CON_NOT_T3SYNC 0x04
1614 #define _T3CON_T3SYNC 0x04
1615 #define _T3CON_T3CCP1 0x08
1616 #define _T3CON_T3CKPS0 0x10
1617 #define _T3CON_T3CKPS1 0x20
1618 #define _T3CON_RD16 0x80
1620 //==============================================================================
1622 extern __at(0x0FB2) __sfr TMR3;
1623 extern __at(0x0FB2) __sfr TMR3L;
1624 extern __at(0x0FB3) __sfr TMR3H;
1626 //==============================================================================
1627 // ECCP1AS Bits
1629 extern __at(0x0FB6) __sfr ECCP1AS;
1631 typedef union
1633 struct
1635 unsigned PSSBD0 : 1;
1636 unsigned PSSBD1 : 1;
1637 unsigned PSSAC0 : 1;
1638 unsigned PSSAC1 : 1;
1639 unsigned ECCPAS0 : 1;
1640 unsigned ECCPAS1 : 1;
1641 unsigned ECCPAS2 : 1;
1642 unsigned ECCPASE : 1;
1645 struct
1647 unsigned PSSBD : 2;
1648 unsigned : 6;
1651 struct
1653 unsigned : 2;
1654 unsigned PSSAC : 2;
1655 unsigned : 4;
1658 struct
1660 unsigned : 4;
1661 unsigned ECCPAS : 3;
1662 unsigned : 1;
1664 } __ECCP1ASbits_t;
1666 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1668 #define _PSSBD0 0x01
1669 #define _PSSBD1 0x02
1670 #define _PSSAC0 0x04
1671 #define _PSSAC1 0x08
1672 #define _ECCPAS0 0x10
1673 #define _ECCPAS1 0x20
1674 #define _ECCPAS2 0x40
1675 #define _ECCPASE 0x80
1677 //==============================================================================
1680 //==============================================================================
1681 // PWM1CON Bits
1683 extern __at(0x0FB7) __sfr PWM1CON;
1685 typedef union
1687 struct
1689 unsigned PDC0 : 1;
1690 unsigned PDC1 : 1;
1691 unsigned PDC2 : 1;
1692 unsigned PDC3 : 1;
1693 unsigned PDC4 : 1;
1694 unsigned PDC5 : 1;
1695 unsigned PDC6 : 1;
1696 unsigned PRSEN : 1;
1699 struct
1701 unsigned PDC : 7;
1702 unsigned : 1;
1704 } __PWM1CONbits_t;
1706 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1708 #define _PDC0 0x01
1709 #define _PDC1 0x02
1710 #define _PDC2 0x04
1711 #define _PDC3 0x08
1712 #define _PDC4 0x10
1713 #define _PDC5 0x20
1714 #define _PDC6 0x40
1715 #define _PRSEN 0x80
1717 //==============================================================================
1720 //==============================================================================
1721 // BAUDCON Bits
1723 extern __at(0x0FB8) __sfr BAUDCON;
1725 typedef union
1727 struct
1729 unsigned ABDEN : 1;
1730 unsigned WUE : 1;
1731 unsigned : 1;
1732 unsigned BRG16 : 1;
1733 unsigned CKTXP : 1;
1734 unsigned DTRXP : 1;
1735 unsigned RCIDL : 1;
1736 unsigned ABDOVF : 1;
1739 struct
1741 unsigned : 1;
1742 unsigned : 1;
1743 unsigned : 1;
1744 unsigned : 1;
1745 unsigned SCKP : 1;
1746 unsigned : 1;
1747 unsigned : 1;
1748 unsigned : 1;
1750 } __BAUDCONbits_t;
1752 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1754 #define _ABDEN 0x01
1755 #define _WUE 0x02
1756 #define _BRG16 0x08
1757 #define _CKTXP 0x10
1758 #define _SCKP 0x10
1759 #define _DTRXP 0x20
1760 #define _RCIDL 0x40
1761 #define _ABDOVF 0x80
1763 //==============================================================================
1766 //==============================================================================
1767 // BAUDCTL Bits
1769 extern __at(0x0FB8) __sfr BAUDCTL;
1771 typedef union
1773 struct
1775 unsigned ABDEN : 1;
1776 unsigned WUE : 1;
1777 unsigned : 1;
1778 unsigned BRG16 : 1;
1779 unsigned CKTXP : 1;
1780 unsigned DTRXP : 1;
1781 unsigned RCIDL : 1;
1782 unsigned ABDOVF : 1;
1785 struct
1787 unsigned : 1;
1788 unsigned : 1;
1789 unsigned : 1;
1790 unsigned : 1;
1791 unsigned SCKP : 1;
1792 unsigned : 1;
1793 unsigned : 1;
1794 unsigned : 1;
1796 } __BAUDCTLbits_t;
1798 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1800 #define _BAUDCTL_ABDEN 0x01
1801 #define _BAUDCTL_WUE 0x02
1802 #define _BAUDCTL_BRG16 0x08
1803 #define _BAUDCTL_CKTXP 0x10
1804 #define _BAUDCTL_SCKP 0x10
1805 #define _BAUDCTL_DTRXP 0x20
1806 #define _BAUDCTL_RCIDL 0x40
1807 #define _BAUDCTL_ABDOVF 0x80
1809 //==============================================================================
1812 //==============================================================================
1813 // PSTRCON Bits
1815 extern __at(0x0FB9) __sfr PSTRCON;
1817 typedef struct
1819 unsigned STRA : 1;
1820 unsigned STRB : 1;
1821 unsigned STRC : 1;
1822 unsigned STRD : 1;
1823 unsigned STRSYNC : 1;
1824 unsigned : 1;
1825 unsigned : 1;
1826 unsigned : 1;
1827 } __PSTRCONbits_t;
1829 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1831 #define _STRA 0x01
1832 #define _STRB 0x02
1833 #define _STRC 0x04
1834 #define _STRD 0x08
1835 #define _STRSYNC 0x10
1837 //==============================================================================
1840 //==============================================================================
1841 // REFCON0 Bits
1843 extern __at(0x0FBA) __sfr REFCON0;
1845 typedef union
1847 struct
1849 unsigned : 1;
1850 unsigned : 1;
1851 unsigned : 1;
1852 unsigned : 1;
1853 unsigned FVR1S0 : 1;
1854 unsigned FVR1S1 : 1;
1855 unsigned FVR1ST : 1;
1856 unsigned FVR1EN : 1;
1859 struct
1861 unsigned : 4;
1862 unsigned FVR1S : 2;
1863 unsigned : 2;
1865 } __REFCON0bits_t;
1867 extern __at(0x0FBA) volatile __REFCON0bits_t REFCON0bits;
1869 #define _FVR1S0 0x10
1870 #define _FVR1S1 0x20
1871 #define _FVR1ST 0x40
1872 #define _FVR1EN 0x80
1874 //==============================================================================
1877 //==============================================================================
1878 // VREFCON0 Bits
1880 extern __at(0x0FBA) __sfr VREFCON0;
1882 typedef union
1884 struct
1886 unsigned : 1;
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned : 1;
1890 unsigned FVR1S0 : 1;
1891 unsigned FVR1S1 : 1;
1892 unsigned FVR1ST : 1;
1893 unsigned FVR1EN : 1;
1896 struct
1898 unsigned : 4;
1899 unsigned FVR1S : 2;
1900 unsigned : 2;
1902 } __VREFCON0bits_t;
1904 extern __at(0x0FBA) volatile __VREFCON0bits_t VREFCON0bits;
1906 #define _VREFCON0_FVR1S0 0x10
1907 #define _VREFCON0_FVR1S1 0x20
1908 #define _VREFCON0_FVR1ST 0x40
1909 #define _VREFCON0_FVR1EN 0x80
1911 //==============================================================================
1914 //==============================================================================
1915 // REFCON1 Bits
1917 extern __at(0x0FBB) __sfr REFCON1;
1919 typedef union
1921 struct
1923 unsigned D1NSS : 1;
1924 unsigned : 1;
1925 unsigned D1PSS0 : 1;
1926 unsigned D1PSS1 : 1;
1927 unsigned : 1;
1928 unsigned DAC1OE : 1;
1929 unsigned D1LPS : 1;
1930 unsigned D1EN : 1;
1933 struct
1935 unsigned D1NSS0 : 1;
1936 unsigned : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1941 unsigned : 1;
1942 unsigned : 1;
1945 struct
1947 unsigned : 2;
1948 unsigned D1PSS : 2;
1949 unsigned : 4;
1951 } __REFCON1bits_t;
1953 extern __at(0x0FBB) volatile __REFCON1bits_t REFCON1bits;
1955 #define _D1NSS 0x01
1956 #define _D1NSS0 0x01
1957 #define _D1PSS0 0x04
1958 #define _D1PSS1 0x08
1959 #define _DAC1OE 0x20
1960 #define _D1LPS 0x40
1961 #define _D1EN 0x80
1963 //==============================================================================
1966 //==============================================================================
1967 // VREFCON1 Bits
1969 extern __at(0x0FBB) __sfr VREFCON1;
1971 typedef union
1973 struct
1975 unsigned D1NSS : 1;
1976 unsigned : 1;
1977 unsigned D1PSS0 : 1;
1978 unsigned D1PSS1 : 1;
1979 unsigned : 1;
1980 unsigned DAC1OE : 1;
1981 unsigned D1LPS : 1;
1982 unsigned D1EN : 1;
1985 struct
1987 unsigned D1NSS0 : 1;
1988 unsigned : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1991 unsigned : 1;
1992 unsigned : 1;
1993 unsigned : 1;
1994 unsigned : 1;
1997 struct
1999 unsigned : 2;
2000 unsigned D1PSS : 2;
2001 unsigned : 4;
2003 } __VREFCON1bits_t;
2005 extern __at(0x0FBB) volatile __VREFCON1bits_t VREFCON1bits;
2007 #define _VREFCON1_D1NSS 0x01
2008 #define _VREFCON1_D1NSS0 0x01
2009 #define _VREFCON1_D1PSS0 0x04
2010 #define _VREFCON1_D1PSS1 0x08
2011 #define _VREFCON1_DAC1OE 0x20
2012 #define _VREFCON1_D1LPS 0x40
2013 #define _VREFCON1_D1EN 0x80
2015 //==============================================================================
2018 //==============================================================================
2019 // REFCON2 Bits
2021 extern __at(0x0FBC) __sfr REFCON2;
2023 typedef union
2025 struct
2027 unsigned DAC1R0 : 1;
2028 unsigned DAC1R1 : 1;
2029 unsigned DAC1R2 : 1;
2030 unsigned DAC1R3 : 1;
2031 unsigned DAC1R4 : 1;
2032 unsigned : 1;
2033 unsigned : 1;
2034 unsigned : 1;
2037 struct
2039 unsigned DAC1R : 5;
2040 unsigned : 3;
2042 } __REFCON2bits_t;
2044 extern __at(0x0FBC) volatile __REFCON2bits_t REFCON2bits;
2046 #define _DAC1R0 0x01
2047 #define _DAC1R1 0x02
2048 #define _DAC1R2 0x04
2049 #define _DAC1R3 0x08
2050 #define _DAC1R4 0x10
2052 //==============================================================================
2055 //==============================================================================
2056 // VREFCON2 Bits
2058 extern __at(0x0FBC) __sfr VREFCON2;
2060 typedef union
2062 struct
2064 unsigned DAC1R0 : 1;
2065 unsigned DAC1R1 : 1;
2066 unsigned DAC1R2 : 1;
2067 unsigned DAC1R3 : 1;
2068 unsigned DAC1R4 : 1;
2069 unsigned : 1;
2070 unsigned : 1;
2071 unsigned : 1;
2074 struct
2076 unsigned DAC1R : 5;
2077 unsigned : 3;
2079 } __VREFCON2bits_t;
2081 extern __at(0x0FBC) volatile __VREFCON2bits_t VREFCON2bits;
2083 #define _VREFCON2_DAC1R0 0x01
2084 #define _VREFCON2_DAC1R1 0x02
2085 #define _VREFCON2_DAC1R2 0x04
2086 #define _VREFCON2_DAC1R3 0x08
2087 #define _VREFCON2_DAC1R4 0x10
2089 //==============================================================================
2092 //==============================================================================
2093 // CCP1CON Bits
2095 extern __at(0x0FBD) __sfr CCP1CON;
2097 typedef union
2099 struct
2101 unsigned CCP1M0 : 1;
2102 unsigned CCP1M1 : 1;
2103 unsigned CCP1M2 : 1;
2104 unsigned CCP1M3 : 1;
2105 unsigned DC1B0 : 1;
2106 unsigned DC1B1 : 1;
2107 unsigned P1M0 : 1;
2108 unsigned P1M1 : 1;
2111 struct
2113 unsigned CCP1M : 4;
2114 unsigned : 4;
2117 struct
2119 unsigned : 4;
2120 unsigned DC1B : 2;
2121 unsigned : 2;
2124 struct
2126 unsigned : 6;
2127 unsigned P1M : 2;
2129 } __CCP1CONbits_t;
2131 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2133 #define _CCP1M0 0x01
2134 #define _CCP1M1 0x02
2135 #define _CCP1M2 0x04
2136 #define _CCP1M3 0x08
2137 #define _DC1B0 0x10
2138 #define _DC1B1 0x20
2139 #define _P1M0 0x40
2140 #define _P1M1 0x80
2142 //==============================================================================
2144 extern __at(0x0FBE) __sfr CCPR1;
2145 extern __at(0x0FBE) __sfr CCPR1L;
2146 extern __at(0x0FBF) __sfr CCPR1H;
2148 //==============================================================================
2149 // ADCON2 Bits
2151 extern __at(0x0FC0) __sfr ADCON2;
2153 typedef union
2155 struct
2157 unsigned ADCS0 : 1;
2158 unsigned ADCS1 : 1;
2159 unsigned ADCS2 : 1;
2160 unsigned ACQT0 : 1;
2161 unsigned ACQT1 : 1;
2162 unsigned ACQT2 : 1;
2163 unsigned : 1;
2164 unsigned ADFM : 1;
2167 struct
2169 unsigned ADCS : 3;
2170 unsigned : 5;
2173 struct
2175 unsigned : 3;
2176 unsigned ACQT : 3;
2177 unsigned : 2;
2179 } __ADCON2bits_t;
2181 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2183 #define _ADCS0 0x01
2184 #define _ADCS1 0x02
2185 #define _ADCS2 0x04
2186 #define _ACQT0 0x08
2187 #define _ACQT1 0x10
2188 #define _ACQT2 0x20
2189 #define _ADFM 0x80
2191 //==============================================================================
2194 //==============================================================================
2195 // ADCON1 Bits
2197 extern __at(0x0FC1) __sfr ADCON1;
2199 typedef union
2201 struct
2203 unsigned NVCFG0 : 1;
2204 unsigned NVCFG1 : 1;
2205 unsigned PVCFG0 : 1;
2206 unsigned PVCFG1 : 1;
2207 unsigned : 1;
2208 unsigned : 1;
2209 unsigned : 1;
2210 unsigned : 1;
2213 struct
2215 unsigned NVCFG : 2;
2216 unsigned : 6;
2219 struct
2221 unsigned : 2;
2222 unsigned PVCFG : 2;
2223 unsigned : 4;
2225 } __ADCON1bits_t;
2227 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2229 #define _NVCFG0 0x01
2230 #define _NVCFG1 0x02
2231 #define _PVCFG0 0x04
2232 #define _PVCFG1 0x08
2234 //==============================================================================
2237 //==============================================================================
2238 // ADCON0 Bits
2240 extern __at(0x0FC2) __sfr ADCON0;
2242 typedef union
2244 struct
2246 unsigned ADON : 1;
2247 unsigned GO_NOT_DONE : 1;
2248 unsigned CHS0 : 1;
2249 unsigned CHS1 : 1;
2250 unsigned CHS2 : 1;
2251 unsigned CHS3 : 1;
2252 unsigned : 1;
2253 unsigned : 1;
2256 struct
2258 unsigned : 1;
2259 unsigned DONE : 1;
2260 unsigned : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned : 1;
2264 unsigned : 1;
2265 unsigned : 1;
2268 struct
2270 unsigned : 1;
2271 unsigned NOT_DONE : 1;
2272 unsigned : 1;
2273 unsigned : 1;
2274 unsigned : 1;
2275 unsigned : 1;
2276 unsigned : 1;
2277 unsigned : 1;
2280 struct
2282 unsigned : 1;
2283 unsigned GO_DONE : 1;
2284 unsigned : 1;
2285 unsigned : 1;
2286 unsigned : 1;
2287 unsigned : 1;
2288 unsigned : 1;
2289 unsigned : 1;
2292 struct
2294 unsigned : 1;
2295 unsigned GO : 1;
2296 unsigned : 1;
2297 unsigned : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2300 unsigned : 1;
2301 unsigned : 1;
2304 struct
2306 unsigned : 2;
2307 unsigned CHS : 4;
2308 unsigned : 2;
2310 } __ADCON0bits_t;
2312 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2314 #define _ADON 0x01
2315 #define _GO_NOT_DONE 0x02
2316 #define _DONE 0x02
2317 #define _NOT_DONE 0x02
2318 #define _GO_DONE 0x02
2319 #define _GO 0x02
2320 #define _CHS0 0x04
2321 #define _CHS1 0x08
2322 #define _CHS2 0x10
2323 #define _CHS3 0x20
2325 //==============================================================================
2327 extern __at(0x0FC3) __sfr ADRES;
2328 extern __at(0x0FC3) __sfr ADRESL;
2329 extern __at(0x0FC4) __sfr ADRESH;
2331 //==============================================================================
2332 // SSPCON2 Bits
2334 extern __at(0x0FC5) __sfr SSPCON2;
2336 typedef struct
2338 unsigned SEN : 1;
2339 unsigned RSEN : 1;
2340 unsigned PEN : 1;
2341 unsigned RCEN : 1;
2342 unsigned ACKEN : 1;
2343 unsigned ACKDT : 1;
2344 unsigned ACKSTAT : 1;
2345 unsigned GCEN : 1;
2346 } __SSPCON2bits_t;
2348 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2350 #define _SEN 0x01
2351 #define _RSEN 0x02
2352 #define _PEN 0x04
2353 #define _RCEN 0x08
2354 #define _ACKEN 0x10
2355 #define _ACKDT 0x20
2356 #define _ACKSTAT 0x40
2357 #define _GCEN 0x80
2359 //==============================================================================
2362 //==============================================================================
2363 // SSPCON1 Bits
2365 extern __at(0x0FC6) __sfr SSPCON1;
2367 typedef union
2369 struct
2371 unsigned SSPM0 : 1;
2372 unsigned SSPM1 : 1;
2373 unsigned SSPM2 : 1;
2374 unsigned SSPM3 : 1;
2375 unsigned CKP : 1;
2376 unsigned SSPEN : 1;
2377 unsigned SSPOV : 1;
2378 unsigned WCOL : 1;
2381 struct
2383 unsigned SSPM : 4;
2384 unsigned : 4;
2386 } __SSPCON1bits_t;
2388 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2390 #define _SSPM0 0x01
2391 #define _SSPM1 0x02
2392 #define _SSPM2 0x04
2393 #define _SSPM3 0x08
2394 #define _CKP 0x10
2395 #define _SSPEN 0x20
2396 #define _SSPOV 0x40
2397 #define _WCOL 0x80
2399 //==============================================================================
2402 //==============================================================================
2403 // SSPSTAT Bits
2405 extern __at(0x0FC7) __sfr SSPSTAT;
2407 typedef union
2409 struct
2411 unsigned BF : 1;
2412 unsigned UA : 1;
2413 unsigned R_NOT_W : 1;
2414 unsigned S : 1;
2415 unsigned P : 1;
2416 unsigned D_NOT_A : 1;
2417 unsigned CKE : 1;
2418 unsigned SMP : 1;
2421 struct
2423 unsigned : 1;
2424 unsigned : 1;
2425 unsigned R : 1;
2426 unsigned : 1;
2427 unsigned : 1;
2428 unsigned D : 1;
2429 unsigned : 1;
2430 unsigned : 1;
2433 struct
2435 unsigned : 1;
2436 unsigned : 1;
2437 unsigned NOT_W : 1;
2438 unsigned : 1;
2439 unsigned : 1;
2440 unsigned NOT_A : 1;
2441 unsigned : 1;
2442 unsigned : 1;
2445 struct
2447 unsigned : 1;
2448 unsigned : 1;
2449 unsigned R_W : 1;
2450 unsigned : 1;
2451 unsigned : 1;
2452 unsigned D_A : 1;
2453 unsigned : 1;
2454 unsigned : 1;
2457 struct
2459 unsigned : 1;
2460 unsigned : 1;
2461 unsigned NOT_WRITE : 1;
2462 unsigned : 1;
2463 unsigned : 1;
2464 unsigned NOT_ADDRESS : 1;
2465 unsigned : 1;
2466 unsigned : 1;
2468 } __SSPSTATbits_t;
2470 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2472 #define _BF 0x01
2473 #define _UA 0x02
2474 #define _R_NOT_W 0x04
2475 #define _R 0x04
2476 #define _NOT_W 0x04
2477 #define _R_W 0x04
2478 #define _NOT_WRITE 0x04
2479 #define _S 0x08
2480 #define _P 0x10
2481 #define _D_NOT_A 0x20
2482 #define _D 0x20
2483 #define _NOT_A 0x20
2484 #define _D_A 0x20
2485 #define _NOT_ADDRESS 0x20
2486 #define _CKE 0x40
2487 #define _SMP 0x80
2489 //==============================================================================
2491 extern __at(0x0FC8) __sfr SSPADD;
2492 extern __at(0x0FC9) __sfr SSPBUF;
2494 //==============================================================================
2495 // T2CON Bits
2497 extern __at(0x0FCA) __sfr T2CON;
2499 typedef union
2501 struct
2503 unsigned T2CKPS0 : 1;
2504 unsigned T2CKPS1 : 1;
2505 unsigned TMR2ON : 1;
2506 unsigned T2OUTPS0 : 1;
2507 unsigned T2OUTPS1 : 1;
2508 unsigned T2OUTPS2 : 1;
2509 unsigned T2OUTPS3 : 1;
2510 unsigned : 1;
2513 struct
2515 unsigned T2CKPS : 2;
2516 unsigned : 6;
2519 struct
2521 unsigned : 3;
2522 unsigned T2OUTPS : 4;
2523 unsigned : 1;
2525 } __T2CONbits_t;
2527 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2529 #define _T2CKPS0 0x01
2530 #define _T2CKPS1 0x02
2531 #define _TMR2ON 0x04
2532 #define _T2OUTPS0 0x08
2533 #define _T2OUTPS1 0x10
2534 #define _T2OUTPS2 0x20
2535 #define _T2OUTPS3 0x40
2537 //==============================================================================
2539 extern __at(0x0FCB) __sfr PR2;
2540 extern __at(0x0FCC) __sfr TMR2;
2542 //==============================================================================
2543 // T1CON Bits
2545 extern __at(0x0FCD) __sfr T1CON;
2547 typedef union
2549 struct
2551 unsigned TMR1ON : 1;
2552 unsigned TMR1CS : 1;
2553 unsigned NOT_T1SYNC : 1;
2554 unsigned T1OSCEN : 1;
2555 unsigned T1CKPS0 : 1;
2556 unsigned T1CKPS1 : 1;
2557 unsigned T1RUN : 1;
2558 unsigned RD16 : 1;
2561 struct
2563 unsigned : 1;
2564 unsigned : 1;
2565 unsigned T1SYNC : 1;
2566 unsigned : 1;
2567 unsigned : 1;
2568 unsigned : 1;
2569 unsigned : 1;
2570 unsigned : 1;
2573 struct
2575 unsigned : 4;
2576 unsigned T1CKPS : 2;
2577 unsigned : 2;
2579 } __T1CONbits_t;
2581 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2583 #define _TMR1ON 0x01
2584 #define _TMR1CS 0x02
2585 #define _NOT_T1SYNC 0x04
2586 #define _T1SYNC 0x04
2587 #define _T1OSCEN 0x08
2588 #define _T1CKPS0 0x10
2589 #define _T1CKPS1 0x20
2590 #define _T1RUN 0x40
2591 #define _RD16 0x80
2593 //==============================================================================
2595 extern __at(0x0FCE) __sfr TMR1;
2596 extern __at(0x0FCE) __sfr TMR1L;
2597 extern __at(0x0FCF) __sfr TMR1H;
2599 //==============================================================================
2600 // RCON Bits
2602 extern __at(0x0FD0) __sfr RCON;
2604 typedef union
2606 struct
2608 unsigned NOT_BOR : 1;
2609 unsigned NOT_POR : 1;
2610 unsigned NOT_PD : 1;
2611 unsigned NOT_TO : 1;
2612 unsigned NOT_RI : 1;
2613 unsigned : 1;
2614 unsigned SBOREN : 1;
2615 unsigned IPEN : 1;
2618 struct
2620 unsigned BOR : 1;
2621 unsigned POR : 1;
2622 unsigned PD : 1;
2623 unsigned TO : 1;
2624 unsigned RI : 1;
2625 unsigned : 1;
2626 unsigned : 1;
2627 unsigned : 1;
2629 } __RCONbits_t;
2631 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2633 #define _NOT_BOR 0x01
2634 #define _BOR 0x01
2635 #define _NOT_POR 0x02
2636 #define _POR 0x02
2637 #define _NOT_PD 0x04
2638 #define _PD 0x04
2639 #define _NOT_TO 0x08
2640 #define _TO 0x08
2641 #define _NOT_RI 0x10
2642 #define _RI 0x10
2643 #define _SBOREN 0x40
2644 #define _IPEN 0x80
2646 //==============================================================================
2649 //==============================================================================
2650 // WDTCON Bits
2652 extern __at(0x0FD1) __sfr WDTCON;
2654 typedef union
2656 struct
2658 unsigned SWDTEN : 1;
2659 unsigned : 1;
2660 unsigned : 1;
2661 unsigned : 1;
2662 unsigned : 1;
2663 unsigned : 1;
2664 unsigned : 1;
2665 unsigned : 1;
2668 struct
2670 unsigned SWDTE : 1;
2671 unsigned : 1;
2672 unsigned : 1;
2673 unsigned : 1;
2674 unsigned : 1;
2675 unsigned : 1;
2676 unsigned : 1;
2677 unsigned : 1;
2679 } __WDTCONbits_t;
2681 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2683 #define _SWDTEN 0x01
2684 #define _SWDTE 0x01
2686 //==============================================================================
2689 //==============================================================================
2690 // OSCCON2 Bits
2692 extern __at(0x0FD2) __sfr OSCCON2;
2694 typedef struct
2696 unsigned LFIOFS : 1;
2697 unsigned HFIOFL : 1;
2698 unsigned PRI_SD : 1;
2699 unsigned : 1;
2700 unsigned : 1;
2701 unsigned : 1;
2702 unsigned : 1;
2703 unsigned : 1;
2704 } __OSCCON2bits_t;
2706 extern __at(0x0FD2) volatile __OSCCON2bits_t OSCCON2bits;
2708 #define _LFIOFS 0x01
2709 #define _HFIOFL 0x02
2710 #define _PRI_SD 0x04
2712 //==============================================================================
2715 //==============================================================================
2716 // OSCCON Bits
2718 extern __at(0x0FD3) __sfr OSCCON;
2720 typedef union
2722 struct
2724 unsigned SCS0 : 1;
2725 unsigned SCS1 : 1;
2726 unsigned HFIOFS : 1;
2727 unsigned OSTS : 1;
2728 unsigned IRCF0 : 1;
2729 unsigned IRCF1 : 1;
2730 unsigned IRCF2 : 1;
2731 unsigned IDLEN : 1;
2734 struct
2736 unsigned : 1;
2737 unsigned : 1;
2738 unsigned FLTS : 1;
2739 unsigned : 1;
2740 unsigned : 1;
2741 unsigned : 1;
2742 unsigned : 1;
2743 unsigned : 1;
2746 struct
2748 unsigned SCS : 2;
2749 unsigned : 6;
2752 struct
2754 unsigned : 4;
2755 unsigned IRCF : 3;
2756 unsigned : 1;
2758 } __OSCCONbits_t;
2760 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2762 #define _SCS0 0x01
2763 #define _SCS1 0x02
2764 #define _HFIOFS 0x04
2765 #define _FLTS 0x04
2766 #define _OSTS 0x08
2767 #define _IRCF0 0x10
2768 #define _IRCF1 0x20
2769 #define _IRCF2 0x40
2770 #define _IDLEN 0x80
2772 //==============================================================================
2775 //==============================================================================
2776 // T0CON Bits
2778 extern __at(0x0FD5) __sfr T0CON;
2780 typedef union
2782 struct
2784 unsigned T0PS0 : 1;
2785 unsigned T0PS1 : 1;
2786 unsigned T0PS2 : 1;
2787 unsigned PSA : 1;
2788 unsigned T0SE : 1;
2789 unsigned T0CS : 1;
2790 unsigned T08BIT : 1;
2791 unsigned TMR0ON : 1;
2794 struct
2796 unsigned T0PS : 3;
2797 unsigned : 5;
2799 } __T0CONbits_t;
2801 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2803 #define _T0PS0 0x01
2804 #define _T0PS1 0x02
2805 #define _T0PS2 0x04
2806 #define _PSA 0x08
2807 #define _T0SE 0x10
2808 #define _T0CS 0x20
2809 #define _T08BIT 0x40
2810 #define _TMR0ON 0x80
2812 //==============================================================================
2814 extern __at(0x0FD6) __sfr TMR0;
2815 extern __at(0x0FD6) __sfr TMR0L;
2816 extern __at(0x0FD7) __sfr TMR0H;
2818 //==============================================================================
2819 // STATUS Bits
2821 extern __at(0x0FD8) __sfr STATUS;
2823 typedef struct
2825 unsigned C : 1;
2826 unsigned DC : 1;
2827 unsigned Z : 1;
2828 unsigned OV : 1;
2829 unsigned N : 1;
2830 unsigned : 1;
2831 unsigned : 1;
2832 unsigned : 1;
2833 } __STATUSbits_t;
2835 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2837 #define _C 0x01
2838 #define _DC 0x02
2839 #define _Z 0x04
2840 #define _OV 0x08
2841 #define _N 0x10
2843 //==============================================================================
2845 extern __at(0x0FD9) __sfr FSR2L;
2846 extern __at(0x0FDA) __sfr FSR2H;
2847 extern __at(0x0FDB) __sfr PLUSW2;
2848 extern __at(0x0FDC) __sfr PREINC2;
2849 extern __at(0x0FDD) __sfr POSTDEC2;
2850 extern __at(0x0FDE) __sfr POSTINC2;
2851 extern __at(0x0FDF) __sfr INDF2;
2852 extern __at(0x0FE0) __sfr BSR;
2853 extern __at(0x0FE1) __sfr FSR1L;
2854 extern __at(0x0FE2) __sfr FSR1H;
2855 extern __at(0x0FE3) __sfr PLUSW1;
2856 extern __at(0x0FE4) __sfr PREINC1;
2857 extern __at(0x0FE5) __sfr POSTDEC1;
2858 extern __at(0x0FE6) __sfr POSTINC1;
2859 extern __at(0x0FE7) __sfr INDF1;
2860 extern __at(0x0FE8) __sfr WREG;
2861 extern __at(0x0FE9) __sfr FSR0L;
2862 extern __at(0x0FEA) __sfr FSR0H;
2863 extern __at(0x0FEB) __sfr PLUSW0;
2864 extern __at(0x0FEC) __sfr PREINC0;
2865 extern __at(0x0FED) __sfr POSTDEC0;
2866 extern __at(0x0FEE) __sfr POSTINC0;
2867 extern __at(0x0FEF) __sfr INDF0;
2869 //==============================================================================
2870 // INTCON3 Bits
2872 extern __at(0x0FF0) __sfr INTCON3;
2874 typedef union
2876 struct
2878 unsigned INT1IF : 1;
2879 unsigned INT2IF : 1;
2880 unsigned : 1;
2881 unsigned INT1IE : 1;
2882 unsigned INT2IE : 1;
2883 unsigned : 1;
2884 unsigned INT1IP : 1;
2885 unsigned INT2IP : 1;
2888 struct
2890 unsigned INT1F : 1;
2891 unsigned INT2F : 1;
2892 unsigned : 1;
2893 unsigned INT1E : 1;
2894 unsigned INT2E : 1;
2895 unsigned : 1;
2896 unsigned INT1P : 1;
2897 unsigned INT2P : 1;
2899 } __INTCON3bits_t;
2901 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2903 #define _INT1IF 0x01
2904 #define _INT1F 0x01
2905 #define _INT2IF 0x02
2906 #define _INT2F 0x02
2907 #define _INT1IE 0x08
2908 #define _INT1E 0x08
2909 #define _INT2IE 0x10
2910 #define _INT2E 0x10
2911 #define _INT1IP 0x40
2912 #define _INT1P 0x40
2913 #define _INT2IP 0x80
2914 #define _INT2P 0x80
2916 //==============================================================================
2919 //==============================================================================
2920 // INTCON2 Bits
2922 extern __at(0x0FF1) __sfr INTCON2;
2924 typedef union
2926 struct
2928 unsigned RABIP : 1;
2929 unsigned : 1;
2930 unsigned TMR0IP : 1;
2931 unsigned : 1;
2932 unsigned INTEDG2 : 1;
2933 unsigned INTEDG1 : 1;
2934 unsigned INTEDG0 : 1;
2935 unsigned NOT_RABPU : 1;
2938 struct
2940 unsigned RBIP : 1;
2941 unsigned : 1;
2942 unsigned : 1;
2943 unsigned : 1;
2944 unsigned : 1;
2945 unsigned : 1;
2946 unsigned : 1;
2947 unsigned RABPU : 1;
2950 struct
2952 unsigned : 1;
2953 unsigned : 1;
2954 unsigned : 1;
2955 unsigned : 1;
2956 unsigned : 1;
2957 unsigned : 1;
2958 unsigned : 1;
2959 unsigned NOT_RBPU : 1;
2961 } __INTCON2bits_t;
2963 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2965 #define _RABIP 0x01
2966 #define _RBIP 0x01
2967 #define _TMR0IP 0x04
2968 #define _INTEDG2 0x10
2969 #define _INTEDG1 0x20
2970 #define _INTEDG0 0x40
2971 #define _NOT_RABPU 0x80
2972 #define _RABPU 0x80
2973 #define _NOT_RBPU 0x80
2975 //==============================================================================
2978 //==============================================================================
2979 // INTCON Bits
2981 extern __at(0x0FF2) __sfr INTCON;
2983 typedef union
2985 struct
2987 unsigned RABIF : 1;
2988 unsigned INT0IF : 1;
2989 unsigned TMR0IF : 1;
2990 unsigned RABIE : 1;
2991 unsigned INT0IE : 1;
2992 unsigned TMR0IE : 1;
2993 unsigned PEIE_GIEL : 1;
2994 unsigned GIE_GIEH : 1;
2997 struct
2999 unsigned RBIF : 1;
3000 unsigned INT0F : 1;
3001 unsigned T0IF : 1;
3002 unsigned RBIE : 1;
3003 unsigned INT0E : 1;
3004 unsigned T0IE : 1;
3005 unsigned PEIE : 1;
3006 unsigned GIE : 1;
3009 struct
3011 unsigned : 1;
3012 unsigned : 1;
3013 unsigned : 1;
3014 unsigned : 1;
3015 unsigned : 1;
3016 unsigned : 1;
3017 unsigned GIEL : 1;
3018 unsigned GIEH : 1;
3021 struct
3023 unsigned : 1;
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned : 1;
3027 unsigned : 1;
3028 unsigned : 1;
3029 unsigned PIE : 1;
3030 unsigned : 1;
3032 } __INTCONbits_t;
3034 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3036 #define _RABIF 0x01
3037 #define _RBIF 0x01
3038 #define _INT0IF 0x02
3039 #define _INT0F 0x02
3040 #define _TMR0IF 0x04
3041 #define _T0IF 0x04
3042 #define _RABIE 0x08
3043 #define _RBIE 0x08
3044 #define _INT0IE 0x10
3045 #define _INT0E 0x10
3046 #define _TMR0IE 0x20
3047 #define _T0IE 0x20
3048 #define _PEIE_GIEL 0x40
3049 #define _PEIE 0x40
3050 #define _GIEL 0x40
3051 #define _PIE 0x40
3052 #define _GIE_GIEH 0x80
3053 #define _GIE 0x80
3054 #define _GIEH 0x80
3056 //==============================================================================
3058 extern __at(0x0FF3) __sfr PROD;
3059 extern __at(0x0FF3) __sfr PRODL;
3060 extern __at(0x0FF4) __sfr PRODH;
3061 extern __at(0x0FF5) __sfr TABLAT;
3062 extern __at(0x0FF6) __sfr TBLPTR;
3063 extern __at(0x0FF6) __sfr TBLPTRL;
3064 extern __at(0x0FF7) __sfr TBLPTRH;
3065 extern __at(0x0FF8) __sfr TBLPTRU;
3066 extern __at(0x0FF9) __sfr PC;
3067 extern __at(0x0FF9) __sfr PCL;
3068 extern __at(0x0FFA) __sfr PCLATH;
3069 extern __at(0x0FFB) __sfr PCLATU;
3071 //==============================================================================
3072 // STKPTR Bits
3074 extern __at(0x0FFC) __sfr STKPTR;
3076 typedef union
3078 struct
3080 unsigned SP0 : 1;
3081 unsigned SP1 : 1;
3082 unsigned SP2 : 1;
3083 unsigned SP3 : 1;
3084 unsigned SP4 : 1;
3085 unsigned : 1;
3086 unsigned STKUNF : 1;
3087 unsigned STKOVF : 1;
3090 struct
3092 unsigned : 1;
3093 unsigned : 1;
3094 unsigned : 1;
3095 unsigned : 1;
3096 unsigned : 1;
3097 unsigned : 1;
3098 unsigned : 1;
3099 unsigned STKFUL : 1;
3102 struct
3104 unsigned SP : 5;
3105 unsigned : 3;
3107 } __STKPTRbits_t;
3109 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3111 #define _SP0 0x01
3112 #define _SP1 0x02
3113 #define _SP2 0x04
3114 #define _SP3 0x08
3115 #define _SP4 0x10
3116 #define _STKUNF 0x40
3117 #define _STKOVF 0x80
3118 #define _STKFUL 0x80
3120 //==============================================================================
3122 extern __at(0x0FFD) __sfr TOS;
3123 extern __at(0x0FFD) __sfr TOSL;
3124 extern __at(0x0FFE) __sfr TOSH;
3125 extern __at(0x0FFF) __sfr TOSU;
3127 //==============================================================================
3129 // Configuration Bits
3131 //==============================================================================
3133 #define __CONFIG1H 0x300001
3134 #define __CONFIG2L 0x300002
3135 #define __CONFIG2H 0x300003
3136 #define __CONFIG3H 0x300005
3137 #define __CONFIG4L 0x300006
3138 #define __CONFIG5L 0x300008
3139 #define __CONFIG5H 0x300009
3140 #define __CONFIG6L 0x30000A
3141 #define __CONFIG6H 0x30000B
3142 #define __CONFIG7L 0x30000C
3143 #define __CONFIG7H 0x30000D
3145 //----------------------------- CONFIG1H Options -------------------------------
3147 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3148 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3149 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3150 #define _FOSC_ERCCLKOUT_1H 0xF3 // External RC oscillator, CLKOUT function on OSC2.
3151 #define _FOSC_ECCLKOUTH_1H 0xF4 // EC, CLKOUT function on OSC2 (high).
3152 #define _FOSC_ECH_1H 0xF5 // EC (high).
3153 #define _FOSC_ERC_1H 0xF7 // External RC oscillator.
3154 #define _FOSC_IRC_1H 0xF8 // Internal RC oscillator.
3155 #define _FOSC_IRCCLKOUT_1H 0xF9 // Internal RC oscillator, CLKOUT function on OSC2.
3156 #define _FOSC_ECCLKOUTM_1H 0xFA // EC, CLKOUT function on OSC2 (medium).
3157 #define _FOSC_ECM_1H 0xFB // EC (medium).
3158 #define _FOSC_ECCLKOUTL_1H 0xFC // EC, CLKOUT function on OSC2 (low).
3159 #define _FOSC_ECL_1H 0xFD // EC (low).
3160 #define _PLLEN_OFF_1H 0xEF // PLL is under software control.
3161 #define _PLLEN_ON_1H 0xFF // Oscillator multiplied by 4.
3162 #define _PCLKEN_OFF_1H 0xDF // Primary clock is under software control.
3163 #define _PCLKEN_ON_1H 0xFF // Primary clock enabled.
3164 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3165 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3166 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3167 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3169 //----------------------------- CONFIG2L Options -------------------------------
3171 #define _PWRTEN_ON_2L 0xFE // PWRT enabled.
3172 #define _PWRTEN_OFF_2L 0xFF // PWRT disabled.
3173 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3174 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3175 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3176 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3177 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3178 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3179 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3180 #define _BORV_19_2L 0xFF // VBOR set to 1.9 V nominal.
3182 //----------------------------- CONFIG2H Options -------------------------------
3184 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3185 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3186 #define _WDTPS_1_2H 0xE1 // 1:1.
3187 #define _WDTPS_2_2H 0xE3 // 1:2.
3188 #define _WDTPS_4_2H 0xE5 // 1:4.
3189 #define _WDTPS_8_2H 0xE7 // 1:8.
3190 #define _WDTPS_16_2H 0xE9 // 1:16.
3191 #define _WDTPS_32_2H 0xEB // 1:32.
3192 #define _WDTPS_64_2H 0xED // 1:64.
3193 #define _WDTPS_128_2H 0xEF // 1:128.
3194 #define _WDTPS_256_2H 0xF1 // 1:256.
3195 #define _WDTPS_512_2H 0xF3 // 1:512.
3196 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3197 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3198 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3199 #define _WDTPS_8192_2H 0xFB // 1:8192.
3200 #define _WDTPS_16384_2H 0xFD // 1:16384.
3201 #define _WDTPS_32768_2H 0xFF // 1:32768.
3203 //----------------------------- CONFIG3H Options -------------------------------
3205 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3206 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3207 #define _MCLRE_OFF_3H 0x7F // RA3 input pin enabled; MCLR disabled.
3208 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA3 input pin disabled.
3210 //----------------------------- CONFIG4L Options -------------------------------
3212 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3213 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3214 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3215 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3216 #define _BBSIZ_OFF_4L 0xF7 // 1kW boot block size.
3217 #define _BBSIZ_ON_4L 0xFF // 2kW boot block size.
3218 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3219 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3220 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RA0 and RA1 are dedicated to In-Circuit Debug.
3221 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins.
3223 //----------------------------- CONFIG5L Options -------------------------------
3225 #define _CP0_ON_5L 0xFE // Block 0 code-protected.
3226 #define _CP0_OFF_5L 0xFF // Block 0 not code-protected.
3227 #define _CP1_ON_5L 0xFD // Block 1 code-protected.
3228 #define _CP1_OFF_5L 0xFF // Block 1 not code-protected.
3230 //----------------------------- CONFIG5H Options -------------------------------
3232 #define _CPB_ON_5H 0xBF // Boot block code-protected.
3233 #define _CPB_OFF_5H 0xFF // Boot block not code-protected.
3234 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3235 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3237 //----------------------------- CONFIG6L Options -------------------------------
3239 #define _WRT0_ON_6L 0xFE // Block 0 write-protected.
3240 #define _WRT0_OFF_6L 0xFF // Block 0 not write-protected.
3241 #define _WRT1_ON_6L 0xFD // Block 1 write-protected.
3242 #define _WRT1_OFF_6L 0xFF // Block 1 not write-protected.
3244 //----------------------------- CONFIG6H Options -------------------------------
3246 #define _WRTC_ON_6H 0xDF // Configuration registers write-protected.
3247 #define _WRTC_OFF_6H 0xFF // Configuration registers not write-protected.
3248 #define _WRTB_ON_6H 0xBF // Boot block write-protected.
3249 #define _WRTB_OFF_6H 0xFF // Boot block not write-protected.
3250 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3251 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3253 //----------------------------- CONFIG7L Options -------------------------------
3255 #define _EBTR0_ON_7L 0xFE // Block 0 protected from table reads executed in other blocks.
3256 #define _EBTR0_OFF_7L 0xFF // Block 0 not protected from table reads executed in other blocks.
3257 #define _EBTR1_ON_7L 0xFD // Block 1 protected from table reads executed in other blocks.
3258 #define _EBTR1_OFF_7L 0xFF // Block 1 not protected from table reads executed in other blocks.
3260 //----------------------------- CONFIG7H Options -------------------------------
3262 #define _EBTRB_ON_7H 0xBF // Boot block protected from table reads executed in other blocks.
3263 #define _EBTRB_OFF_7H 0xFF // Boot block not protected from table reads executed in other blocks.
3265 //==============================================================================
3267 #define __DEVID1 0x3FFFFE
3268 #define __DEVID2 0x3FFFFF
3270 #define __IDLOC0 0x200000
3271 #define __IDLOC1 0x200001
3272 #define __IDLOC2 0x200002
3273 #define __IDLOC3 0x200003
3274 #define __IDLOC4 0x200004
3275 #define __IDLOC5 0x200005
3276 #define __IDLOC6 0x200006
3277 #define __IDLOC7 0x200007
3279 #endif // #ifndef __PIC18F14K22_H__