struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf14k22.h
blobd4e60fa3a89dbf6919ccef66f9c6e4b90c9f17b9
1 /*
2 * This declarations of the PIC18LF14K22 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:53 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 __PIC18LF14K22_H__
26 #define __PIC18LF14K22_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 C1OUT : 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 T0CKI : 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 INT2 : 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 SRQ : 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_C1OUT 0x04
629 #define _PORTA_T0CKI 0x04
630 #define _PORTA_INT2 0x04
631 #define _PORTA_SRQ 0x04
632 #define _PORTA_RA3 0x08
633 #define _PORTA_MCLR 0x08
634 #define _PORTA_NOT_MCLR 0x08
635 #define _PORTA_VPP 0x08
636 #define _PORTA_RA4 0x10
637 #define _PORTA_AN3 0x10
638 #define _PORTA_OSC2 0x10
639 #define _PORTA_CLKOUT 0x10
640 #define _PORTA_RA5 0x20
641 #define _PORTA_T13CKI 0x20
642 #define _PORTA_OSC1 0x20
643 #define _PORTA_CLKIN 0x20
645 //==============================================================================
648 //==============================================================================
649 // PORTB Bits
651 extern __at(0x0F81) __sfr PORTB;
653 typedef union
655 struct
657 unsigned : 1;
658 unsigned : 1;
659 unsigned : 1;
660 unsigned : 1;
661 unsigned RB4 : 1;
662 unsigned RB5 : 1;
663 unsigned RB6 : 1;
664 unsigned RB7 : 1;
667 struct
669 unsigned : 1;
670 unsigned : 1;
671 unsigned : 1;
672 unsigned : 1;
673 unsigned SDI : 1;
674 unsigned RX : 1;
675 unsigned SCL : 1;
676 unsigned TX : 1;
679 struct
681 unsigned : 1;
682 unsigned : 1;
683 unsigned : 1;
684 unsigned : 1;
685 unsigned SDA : 1;
686 unsigned AN11 : 1;
687 unsigned SCK : 1;
688 unsigned CK : 1;
691 struct
693 unsigned : 1;
694 unsigned : 1;
695 unsigned : 1;
696 unsigned : 1;
697 unsigned AN10 : 1;
698 unsigned : 1;
699 unsigned : 1;
700 unsigned : 1;
702 } __PORTBbits_t;
704 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
706 #define _PORTB_RB4 0x10
707 #define _PORTB_SDI 0x10
708 #define _PORTB_SDA 0x10
709 #define _PORTB_AN10 0x10
710 #define _PORTB_RB5 0x20
711 #define _PORTB_RX 0x20
712 #define _PORTB_AN11 0x20
713 #define _PORTB_RB6 0x40
714 #define _PORTB_SCL 0x40
715 #define _PORTB_SCK 0x40
716 #define _PORTB_RB7 0x80
717 #define _PORTB_TX 0x80
718 #define _PORTB_CK 0x80
720 //==============================================================================
723 //==============================================================================
724 // PORTC Bits
726 extern __at(0x0F82) __sfr PORTC;
728 typedef union
730 struct
732 unsigned RC0 : 1;
733 unsigned RC1 : 1;
734 unsigned RC2 : 1;
735 unsigned RC3 : 1;
736 unsigned RC4 : 1;
737 unsigned RC5 : 1;
738 unsigned RC6 : 1;
739 unsigned RC7 : 1;
742 struct
744 unsigned AN4 : 1;
745 unsigned AN5 : 1;
746 unsigned AN6 : 1;
747 unsigned AN7 : 1;
748 unsigned C12OUT : 1;
749 unsigned P1A : 1;
750 unsigned AN8 : 1;
751 unsigned AN9 : 1;
754 struct
756 unsigned C12INP : 1;
757 unsigned C12IN1M : 1;
758 unsigned C12IN2M : 1;
759 unsigned C12IN3M : 1;
760 unsigned P1B : 1;
761 unsigned CCP1 : 1;
762 unsigned SS : 1;
763 unsigned SDO : 1;
766 struct
768 unsigned C2INP : 1;
769 unsigned : 1;
770 unsigned P1D : 1;
771 unsigned P1C : 1;
772 unsigned C2OUT : 1;
773 unsigned : 1;
774 unsigned NOT_SS : 1;
775 unsigned : 1;
778 struct
780 unsigned : 1;
781 unsigned : 1;
782 unsigned : 1;
783 unsigned PGM : 1;
784 unsigned : 1;
785 unsigned : 1;
786 unsigned : 1;
787 unsigned : 1;
789 } __PORTCbits_t;
791 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
793 #define _PORTC_RC0 0x01
794 #define _PORTC_AN4 0x01
795 #define _PORTC_C12INP 0x01
796 #define _PORTC_C2INP 0x01
797 #define _PORTC_RC1 0x02
798 #define _PORTC_AN5 0x02
799 #define _PORTC_C12IN1M 0x02
800 #define _PORTC_RC2 0x04
801 #define _PORTC_AN6 0x04
802 #define _PORTC_C12IN2M 0x04
803 #define _PORTC_P1D 0x04
804 #define _PORTC_RC3 0x08
805 #define _PORTC_AN7 0x08
806 #define _PORTC_C12IN3M 0x08
807 #define _PORTC_P1C 0x08
808 #define _PORTC_PGM 0x08
809 #define _PORTC_RC4 0x10
810 #define _PORTC_C12OUT 0x10
811 #define _PORTC_P1B 0x10
812 #define _PORTC_C2OUT 0x10
813 #define _PORTC_RC5 0x20
814 #define _PORTC_P1A 0x20
815 #define _PORTC_CCP1 0x20
816 #define _PORTC_RC6 0x40
817 #define _PORTC_AN8 0x40
818 #define _PORTC_SS 0x40
819 #define _PORTC_NOT_SS 0x40
820 #define _PORTC_RC7 0x80
821 #define _PORTC_AN9 0x80
822 #define _PORTC_SDO 0x80
824 //==============================================================================
827 //==============================================================================
828 // LATA Bits
830 extern __at(0x0F89) __sfr LATA;
832 typedef struct
834 unsigned LATA0 : 1;
835 unsigned LATA1 : 1;
836 unsigned LATA2 : 1;
837 unsigned : 1;
838 unsigned LATA4 : 1;
839 unsigned LATA5 : 1;
840 unsigned : 1;
841 unsigned : 1;
842 } __LATAbits_t;
844 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
846 #define _LATA0 0x01
847 #define _LATA1 0x02
848 #define _LATA2 0x04
849 #define _LATA4 0x10
850 #define _LATA5 0x20
852 //==============================================================================
855 //==============================================================================
856 // LATB Bits
858 extern __at(0x0F8A) __sfr LATB;
860 typedef struct
862 unsigned : 1;
863 unsigned : 1;
864 unsigned : 1;
865 unsigned : 1;
866 unsigned LATB4 : 1;
867 unsigned LATB5 : 1;
868 unsigned LATB6 : 1;
869 unsigned LATB7 : 1;
870 } __LATBbits_t;
872 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
874 #define _LATB4 0x10
875 #define _LATB5 0x20
876 #define _LATB6 0x40
877 #define _LATB7 0x80
879 //==============================================================================
882 //==============================================================================
883 // LATC Bits
885 extern __at(0x0F8B) __sfr LATC;
887 typedef struct
889 unsigned LATC0 : 1;
890 unsigned LATC1 : 1;
891 unsigned LATC2 : 1;
892 unsigned LATC3 : 1;
893 unsigned LATC4 : 1;
894 unsigned LATC5 : 1;
895 unsigned LATC6 : 1;
896 unsigned LATC7 : 1;
897 } __LATCbits_t;
899 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
901 #define _LATC0 0x01
902 #define _LATC1 0x02
903 #define _LATC2 0x04
904 #define _LATC3 0x08
905 #define _LATC4 0x10
906 #define _LATC5 0x20
907 #define _LATC6 0x40
908 #define _LATC7 0x80
910 //==============================================================================
913 //==============================================================================
914 // DDRA Bits
916 extern __at(0x0F92) __sfr DDRA;
918 typedef union
920 struct
922 unsigned TRISA0 : 1;
923 unsigned TRISA1 : 1;
924 unsigned TRISA2 : 1;
925 unsigned : 1;
926 unsigned TRISA4 : 1;
927 unsigned TRISA5 : 1;
928 unsigned : 1;
929 unsigned : 1;
932 struct
934 unsigned RA0 : 1;
935 unsigned RA1 : 1;
936 unsigned RA2 : 1;
937 unsigned : 1;
938 unsigned RA4 : 1;
939 unsigned RA5 : 1;
940 unsigned : 1;
941 unsigned : 1;
943 } __DDRAbits_t;
945 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
947 #define _TRISA0 0x01
948 #define _RA0 0x01
949 #define _TRISA1 0x02
950 #define _RA1 0x02
951 #define _TRISA2 0x04
952 #define _RA2 0x04
953 #define _TRISA4 0x10
954 #define _RA4 0x10
955 #define _TRISA5 0x20
956 #define _RA5 0x20
958 //==============================================================================
961 //==============================================================================
962 // TRISA Bits
964 extern __at(0x0F92) __sfr TRISA;
966 typedef union
968 struct
970 unsigned TRISA0 : 1;
971 unsigned TRISA1 : 1;
972 unsigned TRISA2 : 1;
973 unsigned : 1;
974 unsigned TRISA4 : 1;
975 unsigned TRISA5 : 1;
976 unsigned : 1;
977 unsigned : 1;
980 struct
982 unsigned RA0 : 1;
983 unsigned RA1 : 1;
984 unsigned RA2 : 1;
985 unsigned : 1;
986 unsigned RA4 : 1;
987 unsigned RA5 : 1;
988 unsigned : 1;
989 unsigned : 1;
991 } __TRISAbits_t;
993 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
995 #define _TRISA_TRISA0 0x01
996 #define _TRISA_RA0 0x01
997 #define _TRISA_TRISA1 0x02
998 #define _TRISA_RA1 0x02
999 #define _TRISA_TRISA2 0x04
1000 #define _TRISA_RA2 0x04
1001 #define _TRISA_TRISA4 0x10
1002 #define _TRISA_RA4 0x10
1003 #define _TRISA_TRISA5 0x20
1004 #define _TRISA_RA5 0x20
1006 //==============================================================================
1009 //==============================================================================
1010 // DDRB Bits
1012 extern __at(0x0F93) __sfr DDRB;
1014 typedef union
1016 struct
1018 unsigned : 1;
1019 unsigned : 1;
1020 unsigned : 1;
1021 unsigned : 1;
1022 unsigned TRISB4 : 1;
1023 unsigned TRISB5 : 1;
1024 unsigned TRISB6 : 1;
1025 unsigned TRISB7 : 1;
1028 struct
1030 unsigned : 1;
1031 unsigned : 1;
1032 unsigned : 1;
1033 unsigned : 1;
1034 unsigned RB4 : 1;
1035 unsigned RB5 : 1;
1036 unsigned RB6 : 1;
1037 unsigned RB7 : 1;
1039 } __DDRBbits_t;
1041 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1043 #define _TRISB4 0x10
1044 #define _RB4 0x10
1045 #define _TRISB5 0x20
1046 #define _RB5 0x20
1047 #define _TRISB6 0x40
1048 #define _RB6 0x40
1049 #define _TRISB7 0x80
1050 #define _RB7 0x80
1052 //==============================================================================
1055 //==============================================================================
1056 // TRISB Bits
1058 extern __at(0x0F93) __sfr TRISB;
1060 typedef union
1062 struct
1064 unsigned : 1;
1065 unsigned : 1;
1066 unsigned : 1;
1067 unsigned : 1;
1068 unsigned TRISB4 : 1;
1069 unsigned TRISB5 : 1;
1070 unsigned TRISB6 : 1;
1071 unsigned TRISB7 : 1;
1074 struct
1076 unsigned : 1;
1077 unsigned : 1;
1078 unsigned : 1;
1079 unsigned : 1;
1080 unsigned RB4 : 1;
1081 unsigned RB5 : 1;
1082 unsigned RB6 : 1;
1083 unsigned RB7 : 1;
1085 } __TRISBbits_t;
1087 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1089 #define _TRISB_TRISB4 0x10
1090 #define _TRISB_RB4 0x10
1091 #define _TRISB_TRISB5 0x20
1092 #define _TRISB_RB5 0x20
1093 #define _TRISB_TRISB6 0x40
1094 #define _TRISB_RB6 0x40
1095 #define _TRISB_TRISB7 0x80
1096 #define _TRISB_RB7 0x80
1098 //==============================================================================
1101 //==============================================================================
1102 // DDRC Bits
1104 extern __at(0x0F94) __sfr DDRC;
1106 typedef union
1108 struct
1110 unsigned TRISC0 : 1;
1111 unsigned TRISC1 : 1;
1112 unsigned TRISC2 : 1;
1113 unsigned TRISC3 : 1;
1114 unsigned TRISC4 : 1;
1115 unsigned TRISC5 : 1;
1116 unsigned TRISC6 : 1;
1117 unsigned TRISC7 : 1;
1120 struct
1122 unsigned RC0 : 1;
1123 unsigned RC1 : 1;
1124 unsigned RC2 : 1;
1125 unsigned RC3 : 1;
1126 unsigned RC4 : 1;
1127 unsigned RC5 : 1;
1128 unsigned RC6 : 1;
1129 unsigned RC7 : 1;
1131 } __DDRCbits_t;
1133 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1135 #define _TRISC0 0x01
1136 #define _RC0 0x01
1137 #define _TRISC1 0x02
1138 #define _RC1 0x02
1139 #define _TRISC2 0x04
1140 #define _RC2 0x04
1141 #define _TRISC3 0x08
1142 #define _RC3 0x08
1143 #define _TRISC4 0x10
1144 #define _RC4 0x10
1145 #define _TRISC5 0x20
1146 #define _RC5 0x20
1147 #define _TRISC6 0x40
1148 #define _RC6 0x40
1149 #define _TRISC7 0x80
1150 #define _RC7 0x80
1152 //==============================================================================
1155 //==============================================================================
1156 // TRISC Bits
1158 extern __at(0x0F94) __sfr TRISC;
1160 typedef union
1162 struct
1164 unsigned TRISC0 : 1;
1165 unsigned TRISC1 : 1;
1166 unsigned TRISC2 : 1;
1167 unsigned TRISC3 : 1;
1168 unsigned TRISC4 : 1;
1169 unsigned TRISC5 : 1;
1170 unsigned TRISC6 : 1;
1171 unsigned TRISC7 : 1;
1174 struct
1176 unsigned RC0 : 1;
1177 unsigned RC1 : 1;
1178 unsigned RC2 : 1;
1179 unsigned RC3 : 1;
1180 unsigned RC4 : 1;
1181 unsigned RC5 : 1;
1182 unsigned RC6 : 1;
1183 unsigned RC7 : 1;
1185 } __TRISCbits_t;
1187 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1189 #define _TRISC_TRISC0 0x01
1190 #define _TRISC_RC0 0x01
1191 #define _TRISC_TRISC1 0x02
1192 #define _TRISC_RC1 0x02
1193 #define _TRISC_TRISC2 0x04
1194 #define _TRISC_RC2 0x04
1195 #define _TRISC_TRISC3 0x08
1196 #define _TRISC_RC3 0x08
1197 #define _TRISC_TRISC4 0x10
1198 #define _TRISC_RC4 0x10
1199 #define _TRISC_TRISC5 0x20
1200 #define _TRISC_RC5 0x20
1201 #define _TRISC_TRISC6 0x40
1202 #define _TRISC_RC6 0x40
1203 #define _TRISC_TRISC7 0x80
1204 #define _TRISC_RC7 0x80
1206 //==============================================================================
1209 //==============================================================================
1210 // OSCTUNE Bits
1212 extern __at(0x0F9B) __sfr OSCTUNE;
1214 typedef union
1216 struct
1218 unsigned TUN0 : 1;
1219 unsigned TUN1 : 1;
1220 unsigned TUN2 : 1;
1221 unsigned TUN3 : 1;
1222 unsigned TUN4 : 1;
1223 unsigned TUN5 : 1;
1224 unsigned PLLEN : 1;
1225 unsigned INTSRC : 1;
1228 struct
1230 unsigned TUN : 6;
1231 unsigned : 2;
1233 } __OSCTUNEbits_t;
1235 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1237 #define _TUN0 0x01
1238 #define _TUN1 0x02
1239 #define _TUN2 0x04
1240 #define _TUN3 0x08
1241 #define _TUN4 0x10
1242 #define _TUN5 0x20
1243 #define _PLLEN 0x40
1244 #define _INTSRC 0x80
1246 //==============================================================================
1249 //==============================================================================
1250 // PIE1 Bits
1252 extern __at(0x0F9D) __sfr PIE1;
1254 typedef struct
1256 unsigned TMR1IE : 1;
1257 unsigned TMR2IE : 1;
1258 unsigned CCP1IE : 1;
1259 unsigned SSPIE : 1;
1260 unsigned TXIE : 1;
1261 unsigned RCIE : 1;
1262 unsigned ADIE : 1;
1263 unsigned : 1;
1264 } __PIE1bits_t;
1266 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1268 #define _TMR1IE 0x01
1269 #define _TMR2IE 0x02
1270 #define _CCP1IE 0x04
1271 #define _SSPIE 0x08
1272 #define _TXIE 0x10
1273 #define _RCIE 0x20
1274 #define _ADIE 0x40
1276 //==============================================================================
1279 //==============================================================================
1280 // PIR1 Bits
1282 extern __at(0x0F9E) __sfr PIR1;
1284 typedef struct
1286 unsigned TMR1IF : 1;
1287 unsigned TMR2IF : 1;
1288 unsigned CCP1IF : 1;
1289 unsigned SSPIF : 1;
1290 unsigned TXIF : 1;
1291 unsigned RCIF : 1;
1292 unsigned ADIF : 1;
1293 unsigned : 1;
1294 } __PIR1bits_t;
1296 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1298 #define _TMR1IF 0x01
1299 #define _TMR2IF 0x02
1300 #define _CCP1IF 0x04
1301 #define _SSPIF 0x08
1302 #define _TXIF 0x10
1303 #define _RCIF 0x20
1304 #define _ADIF 0x40
1306 //==============================================================================
1309 //==============================================================================
1310 // IPR1 Bits
1312 extern __at(0x0F9F) __sfr IPR1;
1314 typedef struct
1316 unsigned TMR1IP : 1;
1317 unsigned TMR2IP : 1;
1318 unsigned CCP1IP : 1;
1319 unsigned SSPIP : 1;
1320 unsigned TXIP : 1;
1321 unsigned RCIP : 1;
1322 unsigned ADIP : 1;
1323 unsigned : 1;
1324 } __IPR1bits_t;
1326 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1328 #define _TMR1IP 0x01
1329 #define _TMR2IP 0x02
1330 #define _CCP1IP 0x04
1331 #define _SSPIP 0x08
1332 #define _TXIP 0x10
1333 #define _RCIP 0x20
1334 #define _ADIP 0x40
1336 //==============================================================================
1339 //==============================================================================
1340 // PIE2 Bits
1342 extern __at(0x0FA0) __sfr PIE2;
1344 typedef struct
1346 unsigned : 1;
1347 unsigned TMR3IE : 1;
1348 unsigned : 1;
1349 unsigned BCLIE : 1;
1350 unsigned EEIE : 1;
1351 unsigned C2IE : 1;
1352 unsigned C1IE : 1;
1353 unsigned OSCFIE : 1;
1354 } __PIE2bits_t;
1356 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1358 #define _TMR3IE 0x02
1359 #define _BCLIE 0x08
1360 #define _EEIE 0x10
1361 #define _C2IE 0x20
1362 #define _C1IE 0x40
1363 #define _OSCFIE 0x80
1365 //==============================================================================
1368 //==============================================================================
1369 // PIR2 Bits
1371 extern __at(0x0FA1) __sfr PIR2;
1373 typedef struct
1375 unsigned : 1;
1376 unsigned TMR3IF : 1;
1377 unsigned : 1;
1378 unsigned BCLIF : 1;
1379 unsigned EEIF : 1;
1380 unsigned C2IF : 1;
1381 unsigned C1IF : 1;
1382 unsigned OSCFIF : 1;
1383 } __PIR2bits_t;
1385 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1387 #define _TMR3IF 0x02
1388 #define _BCLIF 0x08
1389 #define _EEIF 0x10
1390 #define _C2IF 0x20
1391 #define _C1IF 0x40
1392 #define _OSCFIF 0x80
1394 //==============================================================================
1397 //==============================================================================
1398 // IPR2 Bits
1400 extern __at(0x0FA2) __sfr IPR2;
1402 typedef struct
1404 unsigned : 1;
1405 unsigned TMR3IP : 1;
1406 unsigned : 1;
1407 unsigned BCLIP : 1;
1408 unsigned EEIP : 1;
1409 unsigned C2IP : 1;
1410 unsigned C1IP : 1;
1411 unsigned OSCFIP : 1;
1412 } __IPR2bits_t;
1414 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1416 #define _TMR3IP 0x02
1417 #define _BCLIP 0x08
1418 #define _EEIP 0x10
1419 #define _C2IP 0x20
1420 #define _C1IP 0x40
1421 #define _OSCFIP 0x80
1423 //==============================================================================
1426 //==============================================================================
1427 // EECON1 Bits
1429 extern __at(0x0FA6) __sfr EECON1;
1431 typedef struct
1433 unsigned RD : 1;
1434 unsigned WR : 1;
1435 unsigned WREN : 1;
1436 unsigned WRERR : 1;
1437 unsigned FREE : 1;
1438 unsigned : 1;
1439 unsigned CFGS : 1;
1440 unsigned EEPGD : 1;
1441 } __EECON1bits_t;
1443 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1445 #define _RD 0x01
1446 #define _WR 0x02
1447 #define _WREN 0x04
1448 #define _WRERR 0x08
1449 #define _FREE 0x10
1450 #define _CFGS 0x40
1451 #define _EEPGD 0x80
1453 //==============================================================================
1455 extern __at(0x0FA7) __sfr EECON2;
1456 extern __at(0x0FA8) __sfr EEDATA;
1458 //==============================================================================
1459 // EEADR Bits
1461 extern __at(0x0FA9) __sfr EEADR;
1463 typedef struct
1465 unsigned EEADR0 : 1;
1466 unsigned EEADR1 : 1;
1467 unsigned EEADR2 : 1;
1468 unsigned EEADR3 : 1;
1469 unsigned EEADR4 : 1;
1470 unsigned EEADR5 : 1;
1471 unsigned EEADR6 : 1;
1472 unsigned EEADR7 : 1;
1473 } __EEADRbits_t;
1475 extern __at(0x0FA9) volatile __EEADRbits_t EEADRbits;
1477 #define _EEADR0 0x01
1478 #define _EEADR1 0x02
1479 #define _EEADR2 0x04
1480 #define _EEADR3 0x08
1481 #define _EEADR4 0x10
1482 #define _EEADR5 0x20
1483 #define _EEADR6 0x40
1484 #define _EEADR7 0x80
1486 //==============================================================================
1489 //==============================================================================
1490 // RCSTA Bits
1492 extern __at(0x0FAB) __sfr RCSTA;
1494 typedef union
1496 struct
1498 unsigned RX9D : 1;
1499 unsigned OERR : 1;
1500 unsigned FERR : 1;
1501 unsigned ADDEN : 1;
1502 unsigned CREN : 1;
1503 unsigned SREN : 1;
1504 unsigned RX9 : 1;
1505 unsigned SPEN : 1;
1508 struct
1510 unsigned : 1;
1511 unsigned : 1;
1512 unsigned : 1;
1513 unsigned ADEN : 1;
1514 unsigned : 1;
1515 unsigned : 1;
1516 unsigned : 1;
1517 unsigned : 1;
1519 } __RCSTAbits_t;
1521 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1523 #define _RX9D 0x01
1524 #define _OERR 0x02
1525 #define _FERR 0x04
1526 #define _ADDEN 0x08
1527 #define _ADEN 0x08
1528 #define _CREN 0x10
1529 #define _SREN 0x20
1530 #define _RX9 0x40
1531 #define _SPEN 0x80
1533 //==============================================================================
1536 //==============================================================================
1537 // TXSTA Bits
1539 extern __at(0x0FAC) __sfr TXSTA;
1541 typedef struct
1543 unsigned TX9D : 1;
1544 unsigned TRMT : 1;
1545 unsigned BRGH : 1;
1546 unsigned SENDB : 1;
1547 unsigned SYNC : 1;
1548 unsigned TXEN : 1;
1549 unsigned TX9 : 1;
1550 unsigned CSRC : 1;
1551 } __TXSTAbits_t;
1553 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1555 #define _TX9D 0x01
1556 #define _TRMT 0x02
1557 #define _BRGH 0x04
1558 #define _SENDB 0x08
1559 #define _SYNC 0x10
1560 #define _TXEN 0x20
1561 #define _TX9 0x40
1562 #define _CSRC 0x80
1564 //==============================================================================
1566 extern __at(0x0FAD) __sfr TXREG;
1567 extern __at(0x0FAE) __sfr RCREG;
1568 extern __at(0x0FAF) __sfr SPBRG;
1569 extern __at(0x0FB0) __sfr SPBRGH;
1571 //==============================================================================
1572 // T3CON Bits
1574 extern __at(0x0FB1) __sfr T3CON;
1576 typedef union
1578 struct
1580 unsigned TMR3ON : 1;
1581 unsigned TMR3CS : 1;
1582 unsigned NOT_T3SYNC : 1;
1583 unsigned T3CCP1 : 1;
1584 unsigned T3CKPS0 : 1;
1585 unsigned T3CKPS1 : 1;
1586 unsigned : 1;
1587 unsigned RD16 : 1;
1590 struct
1592 unsigned : 1;
1593 unsigned : 1;
1594 unsigned T3SYNC : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1597 unsigned : 1;
1598 unsigned : 1;
1599 unsigned : 1;
1602 struct
1604 unsigned : 4;
1605 unsigned T3CKPS : 2;
1606 unsigned : 2;
1608 } __T3CONbits_t;
1610 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1612 #define _T3CON_TMR3ON 0x01
1613 #define _T3CON_TMR3CS 0x02
1614 #define _T3CON_NOT_T3SYNC 0x04
1615 #define _T3CON_T3SYNC 0x04
1616 #define _T3CON_T3CCP1 0x08
1617 #define _T3CON_T3CKPS0 0x10
1618 #define _T3CON_T3CKPS1 0x20
1619 #define _T3CON_RD16 0x80
1621 //==============================================================================
1623 extern __at(0x0FB2) __sfr TMR3;
1624 extern __at(0x0FB2) __sfr TMR3L;
1625 extern __at(0x0FB3) __sfr TMR3H;
1627 //==============================================================================
1628 // ECCP1AS Bits
1630 extern __at(0x0FB6) __sfr ECCP1AS;
1632 typedef union
1634 struct
1636 unsigned PSSBD0 : 1;
1637 unsigned PSSBD1 : 1;
1638 unsigned PSSAC0 : 1;
1639 unsigned PSSAC1 : 1;
1640 unsigned ECCPAS0 : 1;
1641 unsigned ECCPAS1 : 1;
1642 unsigned ECCPAS2 : 1;
1643 unsigned ECCPASE : 1;
1646 struct
1648 unsigned PSSBD : 2;
1649 unsigned : 6;
1652 struct
1654 unsigned : 2;
1655 unsigned PSSAC : 2;
1656 unsigned : 4;
1659 struct
1661 unsigned : 4;
1662 unsigned ECCPAS : 3;
1663 unsigned : 1;
1665 } __ECCP1ASbits_t;
1667 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1669 #define _PSSBD0 0x01
1670 #define _PSSBD1 0x02
1671 #define _PSSAC0 0x04
1672 #define _PSSAC1 0x08
1673 #define _ECCPAS0 0x10
1674 #define _ECCPAS1 0x20
1675 #define _ECCPAS2 0x40
1676 #define _ECCPASE 0x80
1678 //==============================================================================
1681 //==============================================================================
1682 // PWM1CON Bits
1684 extern __at(0x0FB7) __sfr PWM1CON;
1686 typedef union
1688 struct
1690 unsigned PDC0 : 1;
1691 unsigned PDC1 : 1;
1692 unsigned PDC2 : 1;
1693 unsigned PDC3 : 1;
1694 unsigned PDC4 : 1;
1695 unsigned PDC5 : 1;
1696 unsigned PDC6 : 1;
1697 unsigned PRSEN : 1;
1700 struct
1702 unsigned PDC : 7;
1703 unsigned : 1;
1705 } __PWM1CONbits_t;
1707 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1709 #define _PDC0 0x01
1710 #define _PDC1 0x02
1711 #define _PDC2 0x04
1712 #define _PDC3 0x08
1713 #define _PDC4 0x10
1714 #define _PDC5 0x20
1715 #define _PDC6 0x40
1716 #define _PRSEN 0x80
1718 //==============================================================================
1721 //==============================================================================
1722 // BAUDCON Bits
1724 extern __at(0x0FB8) __sfr BAUDCON;
1726 typedef union
1728 struct
1730 unsigned ABDEN : 1;
1731 unsigned WUE : 1;
1732 unsigned : 1;
1733 unsigned BRG16 : 1;
1734 unsigned CKTXP : 1;
1735 unsigned DTRXP : 1;
1736 unsigned RCIDL : 1;
1737 unsigned ABDOVF : 1;
1740 struct
1742 unsigned : 1;
1743 unsigned : 1;
1744 unsigned : 1;
1745 unsigned : 1;
1746 unsigned SCKP : 1;
1747 unsigned : 1;
1748 unsigned : 1;
1749 unsigned : 1;
1751 } __BAUDCONbits_t;
1753 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1755 #define _ABDEN 0x01
1756 #define _WUE 0x02
1757 #define _BRG16 0x08
1758 #define _CKTXP 0x10
1759 #define _SCKP 0x10
1760 #define _DTRXP 0x20
1761 #define _RCIDL 0x40
1762 #define _ABDOVF 0x80
1764 //==============================================================================
1767 //==============================================================================
1768 // BAUDCTL Bits
1770 extern __at(0x0FB8) __sfr BAUDCTL;
1772 typedef union
1774 struct
1776 unsigned ABDEN : 1;
1777 unsigned WUE : 1;
1778 unsigned : 1;
1779 unsigned BRG16 : 1;
1780 unsigned CKTXP : 1;
1781 unsigned DTRXP : 1;
1782 unsigned RCIDL : 1;
1783 unsigned ABDOVF : 1;
1786 struct
1788 unsigned : 1;
1789 unsigned : 1;
1790 unsigned : 1;
1791 unsigned : 1;
1792 unsigned SCKP : 1;
1793 unsigned : 1;
1794 unsigned : 1;
1795 unsigned : 1;
1797 } __BAUDCTLbits_t;
1799 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1801 #define _BAUDCTL_ABDEN 0x01
1802 #define _BAUDCTL_WUE 0x02
1803 #define _BAUDCTL_BRG16 0x08
1804 #define _BAUDCTL_CKTXP 0x10
1805 #define _BAUDCTL_SCKP 0x10
1806 #define _BAUDCTL_DTRXP 0x20
1807 #define _BAUDCTL_RCIDL 0x40
1808 #define _BAUDCTL_ABDOVF 0x80
1810 //==============================================================================
1813 //==============================================================================
1814 // PSTRCON Bits
1816 extern __at(0x0FB9) __sfr PSTRCON;
1818 typedef struct
1820 unsigned STRA : 1;
1821 unsigned STRB : 1;
1822 unsigned STRC : 1;
1823 unsigned STRD : 1;
1824 unsigned STRSYNC : 1;
1825 unsigned : 1;
1826 unsigned : 1;
1827 unsigned : 1;
1828 } __PSTRCONbits_t;
1830 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1832 #define _STRA 0x01
1833 #define _STRB 0x02
1834 #define _STRC 0x04
1835 #define _STRD 0x08
1836 #define _STRSYNC 0x10
1838 //==============================================================================
1841 //==============================================================================
1842 // REFCON0 Bits
1844 extern __at(0x0FBA) __sfr REFCON0;
1846 typedef union
1848 struct
1850 unsigned : 1;
1851 unsigned : 1;
1852 unsigned : 1;
1853 unsigned : 1;
1854 unsigned FVR1S0 : 1;
1855 unsigned FVR1S1 : 1;
1856 unsigned FVR1ST : 1;
1857 unsigned FVR1EN : 1;
1860 struct
1862 unsigned : 4;
1863 unsigned FVR1S : 2;
1864 unsigned : 2;
1866 } __REFCON0bits_t;
1868 extern __at(0x0FBA) volatile __REFCON0bits_t REFCON0bits;
1870 #define _FVR1S0 0x10
1871 #define _FVR1S1 0x20
1872 #define _FVR1ST 0x40
1873 #define _FVR1EN 0x80
1875 //==============================================================================
1878 //==============================================================================
1879 // VREFCON0 Bits
1881 extern __at(0x0FBA) __sfr VREFCON0;
1883 typedef union
1885 struct
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned : 1;
1890 unsigned : 1;
1891 unsigned FVR1S0 : 1;
1892 unsigned FVR1S1 : 1;
1893 unsigned FVR1ST : 1;
1894 unsigned FVR1EN : 1;
1897 struct
1899 unsigned : 4;
1900 unsigned FVR1S : 2;
1901 unsigned : 2;
1903 } __VREFCON0bits_t;
1905 extern __at(0x0FBA) volatile __VREFCON0bits_t VREFCON0bits;
1907 #define _VREFCON0_FVR1S0 0x10
1908 #define _VREFCON0_FVR1S1 0x20
1909 #define _VREFCON0_FVR1ST 0x40
1910 #define _VREFCON0_FVR1EN 0x80
1912 //==============================================================================
1915 //==============================================================================
1916 // REFCON1 Bits
1918 extern __at(0x0FBB) __sfr REFCON1;
1920 typedef union
1922 struct
1924 unsigned D1NSS : 1;
1925 unsigned : 1;
1926 unsigned D1PSS0 : 1;
1927 unsigned D1PSS1 : 1;
1928 unsigned : 1;
1929 unsigned DAC1OE : 1;
1930 unsigned D1LPS : 1;
1931 unsigned D1EN : 1;
1934 struct
1936 unsigned D1NSS0 : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1941 unsigned : 1;
1942 unsigned : 1;
1943 unsigned : 1;
1946 struct
1948 unsigned : 2;
1949 unsigned D1PSS : 2;
1950 unsigned : 4;
1952 } __REFCON1bits_t;
1954 extern __at(0x0FBB) volatile __REFCON1bits_t REFCON1bits;
1956 #define _D1NSS 0x01
1957 #define _D1NSS0 0x01
1958 #define _D1PSS0 0x04
1959 #define _D1PSS1 0x08
1960 #define _DAC1OE 0x20
1961 #define _D1LPS 0x40
1962 #define _D1EN 0x80
1964 //==============================================================================
1967 //==============================================================================
1968 // VREFCON1 Bits
1970 extern __at(0x0FBB) __sfr VREFCON1;
1972 typedef union
1974 struct
1976 unsigned D1NSS : 1;
1977 unsigned : 1;
1978 unsigned D1PSS0 : 1;
1979 unsigned D1PSS1 : 1;
1980 unsigned : 1;
1981 unsigned DAC1OE : 1;
1982 unsigned D1LPS : 1;
1983 unsigned D1EN : 1;
1986 struct
1988 unsigned D1NSS0 : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1991 unsigned : 1;
1992 unsigned : 1;
1993 unsigned : 1;
1994 unsigned : 1;
1995 unsigned : 1;
1998 struct
2000 unsigned : 2;
2001 unsigned D1PSS : 2;
2002 unsigned : 4;
2004 } __VREFCON1bits_t;
2006 extern __at(0x0FBB) volatile __VREFCON1bits_t VREFCON1bits;
2008 #define _VREFCON1_D1NSS 0x01
2009 #define _VREFCON1_D1NSS0 0x01
2010 #define _VREFCON1_D1PSS0 0x04
2011 #define _VREFCON1_D1PSS1 0x08
2012 #define _VREFCON1_DAC1OE 0x20
2013 #define _VREFCON1_D1LPS 0x40
2014 #define _VREFCON1_D1EN 0x80
2016 //==============================================================================
2019 //==============================================================================
2020 // REFCON2 Bits
2022 extern __at(0x0FBC) __sfr REFCON2;
2024 typedef union
2026 struct
2028 unsigned DAC1R0 : 1;
2029 unsigned DAC1R1 : 1;
2030 unsigned DAC1R2 : 1;
2031 unsigned DAC1R3 : 1;
2032 unsigned DAC1R4 : 1;
2033 unsigned : 1;
2034 unsigned : 1;
2035 unsigned : 1;
2038 struct
2040 unsigned DAC1R : 5;
2041 unsigned : 3;
2043 } __REFCON2bits_t;
2045 extern __at(0x0FBC) volatile __REFCON2bits_t REFCON2bits;
2047 #define _DAC1R0 0x01
2048 #define _DAC1R1 0x02
2049 #define _DAC1R2 0x04
2050 #define _DAC1R3 0x08
2051 #define _DAC1R4 0x10
2053 //==============================================================================
2056 //==============================================================================
2057 // VREFCON2 Bits
2059 extern __at(0x0FBC) __sfr VREFCON2;
2061 typedef union
2063 struct
2065 unsigned DAC1R0 : 1;
2066 unsigned DAC1R1 : 1;
2067 unsigned DAC1R2 : 1;
2068 unsigned DAC1R3 : 1;
2069 unsigned DAC1R4 : 1;
2070 unsigned : 1;
2071 unsigned : 1;
2072 unsigned : 1;
2075 struct
2077 unsigned DAC1R : 5;
2078 unsigned : 3;
2080 } __VREFCON2bits_t;
2082 extern __at(0x0FBC) volatile __VREFCON2bits_t VREFCON2bits;
2084 #define _VREFCON2_DAC1R0 0x01
2085 #define _VREFCON2_DAC1R1 0x02
2086 #define _VREFCON2_DAC1R2 0x04
2087 #define _VREFCON2_DAC1R3 0x08
2088 #define _VREFCON2_DAC1R4 0x10
2090 //==============================================================================
2093 //==============================================================================
2094 // CCP1CON Bits
2096 extern __at(0x0FBD) __sfr CCP1CON;
2098 typedef union
2100 struct
2102 unsigned CCP1M0 : 1;
2103 unsigned CCP1M1 : 1;
2104 unsigned CCP1M2 : 1;
2105 unsigned CCP1M3 : 1;
2106 unsigned DC1B0 : 1;
2107 unsigned DC1B1 : 1;
2108 unsigned P1M0 : 1;
2109 unsigned P1M1 : 1;
2112 struct
2114 unsigned CCP1M : 4;
2115 unsigned : 4;
2118 struct
2120 unsigned : 4;
2121 unsigned DC1B : 2;
2122 unsigned : 2;
2125 struct
2127 unsigned : 6;
2128 unsigned P1M : 2;
2130 } __CCP1CONbits_t;
2132 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2134 #define _CCP1M0 0x01
2135 #define _CCP1M1 0x02
2136 #define _CCP1M2 0x04
2137 #define _CCP1M3 0x08
2138 #define _DC1B0 0x10
2139 #define _DC1B1 0x20
2140 #define _P1M0 0x40
2141 #define _P1M1 0x80
2143 //==============================================================================
2145 extern __at(0x0FBE) __sfr CCPR1;
2146 extern __at(0x0FBE) __sfr CCPR1L;
2147 extern __at(0x0FBF) __sfr CCPR1H;
2149 //==============================================================================
2150 // ADCON2 Bits
2152 extern __at(0x0FC0) __sfr ADCON2;
2154 typedef union
2156 struct
2158 unsigned ADCS0 : 1;
2159 unsigned ADCS1 : 1;
2160 unsigned ADCS2 : 1;
2161 unsigned ACQT0 : 1;
2162 unsigned ACQT1 : 1;
2163 unsigned ACQT2 : 1;
2164 unsigned : 1;
2165 unsigned ADFM : 1;
2168 struct
2170 unsigned ADCS : 3;
2171 unsigned : 5;
2174 struct
2176 unsigned : 3;
2177 unsigned ACQT : 3;
2178 unsigned : 2;
2180 } __ADCON2bits_t;
2182 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2184 #define _ADCS0 0x01
2185 #define _ADCS1 0x02
2186 #define _ADCS2 0x04
2187 #define _ACQT0 0x08
2188 #define _ACQT1 0x10
2189 #define _ACQT2 0x20
2190 #define _ADFM 0x80
2192 //==============================================================================
2195 //==============================================================================
2196 // ADCON1 Bits
2198 extern __at(0x0FC1) __sfr ADCON1;
2200 typedef union
2202 struct
2204 unsigned NVCFG0 : 1;
2205 unsigned NVCFG1 : 1;
2206 unsigned PVCFG0 : 1;
2207 unsigned PVCFG1 : 1;
2208 unsigned : 1;
2209 unsigned : 1;
2210 unsigned : 1;
2211 unsigned : 1;
2214 struct
2216 unsigned NVCFG : 2;
2217 unsigned : 6;
2220 struct
2222 unsigned : 2;
2223 unsigned PVCFG : 2;
2224 unsigned : 4;
2226 } __ADCON1bits_t;
2228 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2230 #define _NVCFG0 0x01
2231 #define _NVCFG1 0x02
2232 #define _PVCFG0 0x04
2233 #define _PVCFG1 0x08
2235 //==============================================================================
2238 //==============================================================================
2239 // ADCON0 Bits
2241 extern __at(0x0FC2) __sfr ADCON0;
2243 typedef union
2245 struct
2247 unsigned ADON : 1;
2248 unsigned GO_NOT_DONE : 1;
2249 unsigned CHS0 : 1;
2250 unsigned CHS1 : 1;
2251 unsigned CHS2 : 1;
2252 unsigned CHS3 : 1;
2253 unsigned : 1;
2254 unsigned : 1;
2257 struct
2259 unsigned : 1;
2260 unsigned DONE : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned : 1;
2264 unsigned : 1;
2265 unsigned : 1;
2266 unsigned : 1;
2269 struct
2271 unsigned : 1;
2272 unsigned NOT_DONE : 1;
2273 unsigned : 1;
2274 unsigned : 1;
2275 unsigned : 1;
2276 unsigned : 1;
2277 unsigned : 1;
2278 unsigned : 1;
2281 struct
2283 unsigned : 1;
2284 unsigned GO_DONE : 1;
2285 unsigned : 1;
2286 unsigned : 1;
2287 unsigned : 1;
2288 unsigned : 1;
2289 unsigned : 1;
2290 unsigned : 1;
2293 struct
2295 unsigned : 1;
2296 unsigned GO : 1;
2297 unsigned : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2300 unsigned : 1;
2301 unsigned : 1;
2302 unsigned : 1;
2305 struct
2307 unsigned : 2;
2308 unsigned CHS : 4;
2309 unsigned : 2;
2311 } __ADCON0bits_t;
2313 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2315 #define _ADON 0x01
2316 #define _GO_NOT_DONE 0x02
2317 #define _DONE 0x02
2318 #define _NOT_DONE 0x02
2319 #define _GO_DONE 0x02
2320 #define _GO 0x02
2321 #define _CHS0 0x04
2322 #define _CHS1 0x08
2323 #define _CHS2 0x10
2324 #define _CHS3 0x20
2326 //==============================================================================
2328 extern __at(0x0FC3) __sfr ADRES;
2329 extern __at(0x0FC3) __sfr ADRESL;
2330 extern __at(0x0FC4) __sfr ADRESH;
2332 //==============================================================================
2333 // SSPCON2 Bits
2335 extern __at(0x0FC5) __sfr SSPCON2;
2337 typedef struct
2339 unsigned SEN : 1;
2340 unsigned RSEN : 1;
2341 unsigned PEN : 1;
2342 unsigned RCEN : 1;
2343 unsigned ACKEN : 1;
2344 unsigned ACKDT : 1;
2345 unsigned ACKSTAT : 1;
2346 unsigned GCEN : 1;
2347 } __SSPCON2bits_t;
2349 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2351 #define _SEN 0x01
2352 #define _RSEN 0x02
2353 #define _PEN 0x04
2354 #define _RCEN 0x08
2355 #define _ACKEN 0x10
2356 #define _ACKDT 0x20
2357 #define _ACKSTAT 0x40
2358 #define _GCEN 0x80
2360 //==============================================================================
2363 //==============================================================================
2364 // SSPCON1 Bits
2366 extern __at(0x0FC6) __sfr SSPCON1;
2368 typedef union
2370 struct
2372 unsigned SSPM0 : 1;
2373 unsigned SSPM1 : 1;
2374 unsigned SSPM2 : 1;
2375 unsigned SSPM3 : 1;
2376 unsigned CKP : 1;
2377 unsigned SSPEN : 1;
2378 unsigned SSPOV : 1;
2379 unsigned WCOL : 1;
2382 struct
2384 unsigned SSPM : 4;
2385 unsigned : 4;
2387 } __SSPCON1bits_t;
2389 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2391 #define _SSPM0 0x01
2392 #define _SSPM1 0x02
2393 #define _SSPM2 0x04
2394 #define _SSPM3 0x08
2395 #define _CKP 0x10
2396 #define _SSPEN 0x20
2397 #define _SSPOV 0x40
2398 #define _WCOL 0x80
2400 //==============================================================================
2403 //==============================================================================
2404 // SSPSTAT Bits
2406 extern __at(0x0FC7) __sfr SSPSTAT;
2408 typedef union
2410 struct
2412 unsigned BF : 1;
2413 unsigned UA : 1;
2414 unsigned R_NOT_W : 1;
2415 unsigned S : 1;
2416 unsigned P : 1;
2417 unsigned D_NOT_A : 1;
2418 unsigned CKE : 1;
2419 unsigned SMP : 1;
2422 struct
2424 unsigned : 1;
2425 unsigned : 1;
2426 unsigned R : 1;
2427 unsigned : 1;
2428 unsigned : 1;
2429 unsigned D : 1;
2430 unsigned : 1;
2431 unsigned : 1;
2434 struct
2436 unsigned : 1;
2437 unsigned : 1;
2438 unsigned NOT_W : 1;
2439 unsigned : 1;
2440 unsigned : 1;
2441 unsigned NOT_A : 1;
2442 unsigned : 1;
2443 unsigned : 1;
2446 struct
2448 unsigned : 1;
2449 unsigned : 1;
2450 unsigned R_W : 1;
2451 unsigned : 1;
2452 unsigned : 1;
2453 unsigned D_A : 1;
2454 unsigned : 1;
2455 unsigned : 1;
2458 struct
2460 unsigned : 1;
2461 unsigned : 1;
2462 unsigned NOT_WRITE : 1;
2463 unsigned : 1;
2464 unsigned : 1;
2465 unsigned NOT_ADDRESS : 1;
2466 unsigned : 1;
2467 unsigned : 1;
2469 } __SSPSTATbits_t;
2471 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2473 #define _BF 0x01
2474 #define _UA 0x02
2475 #define _R_NOT_W 0x04
2476 #define _R 0x04
2477 #define _NOT_W 0x04
2478 #define _R_W 0x04
2479 #define _NOT_WRITE 0x04
2480 #define _S 0x08
2481 #define _P 0x10
2482 #define _D_NOT_A 0x20
2483 #define _D 0x20
2484 #define _NOT_A 0x20
2485 #define _D_A 0x20
2486 #define _NOT_ADDRESS 0x20
2487 #define _CKE 0x40
2488 #define _SMP 0x80
2490 //==============================================================================
2492 extern __at(0x0FC8) __sfr SSPADD;
2493 extern __at(0x0FC9) __sfr SSPBUF;
2495 //==============================================================================
2496 // T2CON Bits
2498 extern __at(0x0FCA) __sfr T2CON;
2500 typedef union
2502 struct
2504 unsigned T2CKPS0 : 1;
2505 unsigned T2CKPS1 : 1;
2506 unsigned TMR2ON : 1;
2507 unsigned T2OUTPS0 : 1;
2508 unsigned T2OUTPS1 : 1;
2509 unsigned T2OUTPS2 : 1;
2510 unsigned T2OUTPS3 : 1;
2511 unsigned : 1;
2514 struct
2516 unsigned T2CKPS : 2;
2517 unsigned : 6;
2520 struct
2522 unsigned : 3;
2523 unsigned T2OUTPS : 4;
2524 unsigned : 1;
2526 } __T2CONbits_t;
2528 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2530 #define _T2CKPS0 0x01
2531 #define _T2CKPS1 0x02
2532 #define _TMR2ON 0x04
2533 #define _T2OUTPS0 0x08
2534 #define _T2OUTPS1 0x10
2535 #define _T2OUTPS2 0x20
2536 #define _T2OUTPS3 0x40
2538 //==============================================================================
2540 extern __at(0x0FCB) __sfr PR2;
2541 extern __at(0x0FCC) __sfr TMR2;
2543 //==============================================================================
2544 // T1CON Bits
2546 extern __at(0x0FCD) __sfr T1CON;
2548 typedef union
2550 struct
2552 unsigned TMR1ON : 1;
2553 unsigned TMR1CS : 1;
2554 unsigned NOT_T1SYNC : 1;
2555 unsigned T1OSCEN : 1;
2556 unsigned T1CKPS0 : 1;
2557 unsigned T1CKPS1 : 1;
2558 unsigned T1RUN : 1;
2559 unsigned RD16 : 1;
2562 struct
2564 unsigned : 1;
2565 unsigned : 1;
2566 unsigned T1SYNC : 1;
2567 unsigned : 1;
2568 unsigned : 1;
2569 unsigned : 1;
2570 unsigned : 1;
2571 unsigned : 1;
2574 struct
2576 unsigned : 4;
2577 unsigned T1CKPS : 2;
2578 unsigned : 2;
2580 } __T1CONbits_t;
2582 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2584 #define _TMR1ON 0x01
2585 #define _TMR1CS 0x02
2586 #define _NOT_T1SYNC 0x04
2587 #define _T1SYNC 0x04
2588 #define _T1OSCEN 0x08
2589 #define _T1CKPS0 0x10
2590 #define _T1CKPS1 0x20
2591 #define _T1RUN 0x40
2592 #define _RD16 0x80
2594 //==============================================================================
2596 extern __at(0x0FCE) __sfr TMR1;
2597 extern __at(0x0FCE) __sfr TMR1L;
2598 extern __at(0x0FCF) __sfr TMR1H;
2600 //==============================================================================
2601 // RCON Bits
2603 extern __at(0x0FD0) __sfr RCON;
2605 typedef union
2607 struct
2609 unsigned NOT_BOR : 1;
2610 unsigned NOT_POR : 1;
2611 unsigned NOT_PD : 1;
2612 unsigned NOT_TO : 1;
2613 unsigned NOT_RI : 1;
2614 unsigned : 1;
2615 unsigned SBOREN : 1;
2616 unsigned IPEN : 1;
2619 struct
2621 unsigned BOR : 1;
2622 unsigned POR : 1;
2623 unsigned PD : 1;
2624 unsigned TO : 1;
2625 unsigned RI : 1;
2626 unsigned : 1;
2627 unsigned : 1;
2628 unsigned : 1;
2630 } __RCONbits_t;
2632 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2634 #define _NOT_BOR 0x01
2635 #define _BOR 0x01
2636 #define _NOT_POR 0x02
2637 #define _POR 0x02
2638 #define _NOT_PD 0x04
2639 #define _PD 0x04
2640 #define _NOT_TO 0x08
2641 #define _TO 0x08
2642 #define _NOT_RI 0x10
2643 #define _RI 0x10
2644 #define _SBOREN 0x40
2645 #define _IPEN 0x80
2647 //==============================================================================
2650 //==============================================================================
2651 // WDTCON Bits
2653 extern __at(0x0FD1) __sfr WDTCON;
2655 typedef union
2657 struct
2659 unsigned SWDTEN : 1;
2660 unsigned : 1;
2661 unsigned : 1;
2662 unsigned : 1;
2663 unsigned : 1;
2664 unsigned : 1;
2665 unsigned : 1;
2666 unsigned : 1;
2669 struct
2671 unsigned SWDTE : 1;
2672 unsigned : 1;
2673 unsigned : 1;
2674 unsigned : 1;
2675 unsigned : 1;
2676 unsigned : 1;
2677 unsigned : 1;
2678 unsigned : 1;
2680 } __WDTCONbits_t;
2682 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2684 #define _SWDTEN 0x01
2685 #define _SWDTE 0x01
2687 //==============================================================================
2690 //==============================================================================
2691 // OSCCON2 Bits
2693 extern __at(0x0FD2) __sfr OSCCON2;
2695 typedef struct
2697 unsigned LFIOFS : 1;
2698 unsigned HFIOFL : 1;
2699 unsigned PRI_SD : 1;
2700 unsigned : 1;
2701 unsigned : 1;
2702 unsigned : 1;
2703 unsigned : 1;
2704 unsigned : 1;
2705 } __OSCCON2bits_t;
2707 extern __at(0x0FD2) volatile __OSCCON2bits_t OSCCON2bits;
2709 #define _LFIOFS 0x01
2710 #define _HFIOFL 0x02
2711 #define _PRI_SD 0x04
2713 //==============================================================================
2716 //==============================================================================
2717 // OSCCON Bits
2719 extern __at(0x0FD3) __sfr OSCCON;
2721 typedef union
2723 struct
2725 unsigned SCS0 : 1;
2726 unsigned SCS1 : 1;
2727 unsigned HFIOFS : 1;
2728 unsigned OSTS : 1;
2729 unsigned IRCF0 : 1;
2730 unsigned IRCF1 : 1;
2731 unsigned IRCF2 : 1;
2732 unsigned IDLEN : 1;
2735 struct
2737 unsigned : 1;
2738 unsigned : 1;
2739 unsigned FLTS : 1;
2740 unsigned : 1;
2741 unsigned : 1;
2742 unsigned : 1;
2743 unsigned : 1;
2744 unsigned : 1;
2747 struct
2749 unsigned SCS : 2;
2750 unsigned : 6;
2753 struct
2755 unsigned : 4;
2756 unsigned IRCF : 3;
2757 unsigned : 1;
2759 } __OSCCONbits_t;
2761 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2763 #define _SCS0 0x01
2764 #define _SCS1 0x02
2765 #define _HFIOFS 0x04
2766 #define _FLTS 0x04
2767 #define _OSTS 0x08
2768 #define _IRCF0 0x10
2769 #define _IRCF1 0x20
2770 #define _IRCF2 0x40
2771 #define _IDLEN 0x80
2773 //==============================================================================
2776 //==============================================================================
2777 // T0CON Bits
2779 extern __at(0x0FD5) __sfr T0CON;
2781 typedef union
2783 struct
2785 unsigned T0PS0 : 1;
2786 unsigned T0PS1 : 1;
2787 unsigned T0PS2 : 1;
2788 unsigned PSA : 1;
2789 unsigned T0SE : 1;
2790 unsigned T0CS : 1;
2791 unsigned T08BIT : 1;
2792 unsigned TMR0ON : 1;
2795 struct
2797 unsigned T0PS : 3;
2798 unsigned : 5;
2800 } __T0CONbits_t;
2802 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2804 #define _T0PS0 0x01
2805 #define _T0PS1 0x02
2806 #define _T0PS2 0x04
2807 #define _PSA 0x08
2808 #define _T0SE 0x10
2809 #define _T0CS 0x20
2810 #define _T08BIT 0x40
2811 #define _TMR0ON 0x80
2813 //==============================================================================
2815 extern __at(0x0FD6) __sfr TMR0;
2816 extern __at(0x0FD6) __sfr TMR0L;
2817 extern __at(0x0FD7) __sfr TMR0H;
2819 //==============================================================================
2820 // STATUS Bits
2822 extern __at(0x0FD8) __sfr STATUS;
2824 typedef struct
2826 unsigned C : 1;
2827 unsigned DC : 1;
2828 unsigned Z : 1;
2829 unsigned OV : 1;
2830 unsigned N : 1;
2831 unsigned : 1;
2832 unsigned : 1;
2833 unsigned : 1;
2834 } __STATUSbits_t;
2836 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2838 #define _C 0x01
2839 #define _DC 0x02
2840 #define _Z 0x04
2841 #define _OV 0x08
2842 #define _N 0x10
2844 //==============================================================================
2846 extern __at(0x0FD9) __sfr FSR2L;
2847 extern __at(0x0FDA) __sfr FSR2H;
2848 extern __at(0x0FDB) __sfr PLUSW2;
2849 extern __at(0x0FDC) __sfr PREINC2;
2850 extern __at(0x0FDD) __sfr POSTDEC2;
2851 extern __at(0x0FDE) __sfr POSTINC2;
2852 extern __at(0x0FDF) __sfr INDF2;
2853 extern __at(0x0FE0) __sfr BSR;
2854 extern __at(0x0FE1) __sfr FSR1L;
2855 extern __at(0x0FE2) __sfr FSR1H;
2856 extern __at(0x0FE3) __sfr PLUSW1;
2857 extern __at(0x0FE4) __sfr PREINC1;
2858 extern __at(0x0FE5) __sfr POSTDEC1;
2859 extern __at(0x0FE6) __sfr POSTINC1;
2860 extern __at(0x0FE7) __sfr INDF1;
2861 extern __at(0x0FE8) __sfr WREG;
2862 extern __at(0x0FE9) __sfr FSR0L;
2863 extern __at(0x0FEA) __sfr FSR0H;
2864 extern __at(0x0FEB) __sfr PLUSW0;
2865 extern __at(0x0FEC) __sfr PREINC0;
2866 extern __at(0x0FED) __sfr POSTDEC0;
2867 extern __at(0x0FEE) __sfr POSTINC0;
2868 extern __at(0x0FEF) __sfr INDF0;
2870 //==============================================================================
2871 // INTCON3 Bits
2873 extern __at(0x0FF0) __sfr INTCON3;
2875 typedef union
2877 struct
2879 unsigned INT1IF : 1;
2880 unsigned INT2IF : 1;
2881 unsigned : 1;
2882 unsigned INT1IE : 1;
2883 unsigned INT2IE : 1;
2884 unsigned : 1;
2885 unsigned INT1IP : 1;
2886 unsigned INT2IP : 1;
2889 struct
2891 unsigned INT1F : 1;
2892 unsigned INT2F : 1;
2893 unsigned : 1;
2894 unsigned INT1E : 1;
2895 unsigned INT2E : 1;
2896 unsigned : 1;
2897 unsigned INT1P : 1;
2898 unsigned INT2P : 1;
2900 } __INTCON3bits_t;
2902 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2904 #define _INT1IF 0x01
2905 #define _INT1F 0x01
2906 #define _INT2IF 0x02
2907 #define _INT2F 0x02
2908 #define _INT1IE 0x08
2909 #define _INT1E 0x08
2910 #define _INT2IE 0x10
2911 #define _INT2E 0x10
2912 #define _INT1IP 0x40
2913 #define _INT1P 0x40
2914 #define _INT2IP 0x80
2915 #define _INT2P 0x80
2917 //==============================================================================
2920 //==============================================================================
2921 // INTCON2 Bits
2923 extern __at(0x0FF1) __sfr INTCON2;
2925 typedef union
2927 struct
2929 unsigned RABIP : 1;
2930 unsigned : 1;
2931 unsigned TMR0IP : 1;
2932 unsigned : 1;
2933 unsigned INTEDG2 : 1;
2934 unsigned INTEDG1 : 1;
2935 unsigned INTEDG0 : 1;
2936 unsigned NOT_RABPU : 1;
2939 struct
2941 unsigned RBIP : 1;
2942 unsigned : 1;
2943 unsigned : 1;
2944 unsigned : 1;
2945 unsigned : 1;
2946 unsigned : 1;
2947 unsigned : 1;
2948 unsigned RABPU : 1;
2951 struct
2953 unsigned : 1;
2954 unsigned : 1;
2955 unsigned : 1;
2956 unsigned : 1;
2957 unsigned : 1;
2958 unsigned : 1;
2959 unsigned : 1;
2960 unsigned NOT_RBPU : 1;
2962 } __INTCON2bits_t;
2964 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2966 #define _RABIP 0x01
2967 #define _RBIP 0x01
2968 #define _TMR0IP 0x04
2969 #define _INTEDG2 0x10
2970 #define _INTEDG1 0x20
2971 #define _INTEDG0 0x40
2972 #define _NOT_RABPU 0x80
2973 #define _RABPU 0x80
2974 #define _NOT_RBPU 0x80
2976 //==============================================================================
2979 //==============================================================================
2980 // INTCON Bits
2982 extern __at(0x0FF2) __sfr INTCON;
2984 typedef union
2986 struct
2988 unsigned RABIF : 1;
2989 unsigned INT0IF : 1;
2990 unsigned TMR0IF : 1;
2991 unsigned RABIE : 1;
2992 unsigned INT0IE : 1;
2993 unsigned TMR0IE : 1;
2994 unsigned PEIE_GIEL : 1;
2995 unsigned GIE_GIEH : 1;
2998 struct
3000 unsigned RBIF : 1;
3001 unsigned INT0F : 1;
3002 unsigned T0IF : 1;
3003 unsigned RBIE : 1;
3004 unsigned INT0E : 1;
3005 unsigned T0IE : 1;
3006 unsigned PEIE : 1;
3007 unsigned GIE : 1;
3010 struct
3012 unsigned : 1;
3013 unsigned : 1;
3014 unsigned : 1;
3015 unsigned : 1;
3016 unsigned : 1;
3017 unsigned : 1;
3018 unsigned GIEL : 1;
3019 unsigned GIEH : 1;
3022 struct
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned : 1;
3027 unsigned : 1;
3028 unsigned : 1;
3029 unsigned : 1;
3030 unsigned PIE : 1;
3031 unsigned : 1;
3033 } __INTCONbits_t;
3035 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3037 #define _RABIF 0x01
3038 #define _RBIF 0x01
3039 #define _INT0IF 0x02
3040 #define _INT0F 0x02
3041 #define _TMR0IF 0x04
3042 #define _T0IF 0x04
3043 #define _RABIE 0x08
3044 #define _RBIE 0x08
3045 #define _INT0IE 0x10
3046 #define _INT0E 0x10
3047 #define _TMR0IE 0x20
3048 #define _T0IE 0x20
3049 #define _PEIE_GIEL 0x40
3050 #define _PEIE 0x40
3051 #define _GIEL 0x40
3052 #define _PIE 0x40
3053 #define _GIE_GIEH 0x80
3054 #define _GIE 0x80
3055 #define _GIEH 0x80
3057 //==============================================================================
3059 extern __at(0x0FF3) __sfr PROD;
3060 extern __at(0x0FF3) __sfr PRODL;
3061 extern __at(0x0FF4) __sfr PRODH;
3062 extern __at(0x0FF5) __sfr TABLAT;
3063 extern __at(0x0FF6) __sfr TBLPTR;
3064 extern __at(0x0FF6) __sfr TBLPTRL;
3065 extern __at(0x0FF7) __sfr TBLPTRH;
3066 extern __at(0x0FF8) __sfr TBLPTRU;
3067 extern __at(0x0FF9) __sfr PC;
3068 extern __at(0x0FF9) __sfr PCL;
3069 extern __at(0x0FFA) __sfr PCLATH;
3070 extern __at(0x0FFB) __sfr PCLATU;
3072 //==============================================================================
3073 // STKPTR Bits
3075 extern __at(0x0FFC) __sfr STKPTR;
3077 typedef union
3079 struct
3081 unsigned SP0 : 1;
3082 unsigned SP1 : 1;
3083 unsigned SP2 : 1;
3084 unsigned SP3 : 1;
3085 unsigned SP4 : 1;
3086 unsigned : 1;
3087 unsigned STKUNF : 1;
3088 unsigned STKOVF : 1;
3091 struct
3093 unsigned : 1;
3094 unsigned : 1;
3095 unsigned : 1;
3096 unsigned : 1;
3097 unsigned : 1;
3098 unsigned : 1;
3099 unsigned : 1;
3100 unsigned STKFUL : 1;
3103 struct
3105 unsigned SP : 5;
3106 unsigned : 3;
3108 } __STKPTRbits_t;
3110 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3112 #define _SP0 0x01
3113 #define _SP1 0x02
3114 #define _SP2 0x04
3115 #define _SP3 0x08
3116 #define _SP4 0x10
3117 #define _STKUNF 0x40
3118 #define _STKOVF 0x80
3119 #define _STKFUL 0x80
3121 //==============================================================================
3123 extern __at(0x0FFD) __sfr TOS;
3124 extern __at(0x0FFD) __sfr TOSL;
3125 extern __at(0x0FFE) __sfr TOSH;
3126 extern __at(0x0FFF) __sfr TOSU;
3128 //==============================================================================
3130 // Configuration Bits
3132 //==============================================================================
3134 #define __CONFIG1H 0x300001
3135 #define __CONFIG2L 0x300002
3136 #define __CONFIG2H 0x300003
3137 #define __CONFIG3H 0x300005
3138 #define __CONFIG4L 0x300006
3139 #define __CONFIG5L 0x300008
3140 #define __CONFIG5H 0x300009
3141 #define __CONFIG6L 0x30000A
3142 #define __CONFIG6H 0x30000B
3143 #define __CONFIG7L 0x30000C
3144 #define __CONFIG7H 0x30000D
3146 //----------------------------- CONFIG1H Options -------------------------------
3148 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3149 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3150 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3151 #define _FOSC_ERCCLKOUT_1H 0xF3 // External RC oscillator, CLKOUT function on OSC2.
3152 #define _FOSC_ECCLKOUTH_1H 0xF4 // EC, CLKOUT function on OSC2 (high).
3153 #define _FOSC_ECH_1H 0xF5 // EC (high).
3154 #define _FOSC_ERC_1H 0xF7 // External RC oscillator.
3155 #define _FOSC_IRC_1H 0xF8 // Internal RC oscillator.
3156 #define _FOSC_IRCCLKOUT_1H 0xF9 // Internal RC oscillator, CLKOUT function on OSC2.
3157 #define _FOSC_ECCLKOUTM_1H 0xFA // EC, CLKOUT function on OSC2 (medium).
3158 #define _FOSC_ECM_1H 0xFB // EC (medium).
3159 #define _FOSC_ECCLKOUTL_1H 0xFC // EC, CLKOUT function on OSC2 (low).
3160 #define _FOSC_ECL_1H 0xFD // EC (low).
3161 #define _PLLEN_OFF_1H 0xEF // PLL is under software control.
3162 #define _PLLEN_ON_1H 0xFF // Oscillator multiplied by 4.
3163 #define _PCLKEN_OFF_1H 0xDF // Primary clock is under software control.
3164 #define _PCLKEN_ON_1H 0xFF // Primary clock enabled.
3165 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3166 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3167 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3168 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3170 //----------------------------- CONFIG2L Options -------------------------------
3172 #define _PWRTEN_ON_2L 0xFE // PWRT enabled.
3173 #define _PWRTEN_OFF_2L 0xFF // PWRT disabled.
3174 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3175 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3176 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3177 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3178 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3179 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3180 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3181 #define _BORV_19_2L 0xFF // VBOR set to 1.9 V nominal.
3183 //----------------------------- CONFIG2H Options -------------------------------
3185 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3186 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3187 #define _WDTPS_1_2H 0xE1 // 1:1.
3188 #define _WDTPS_2_2H 0xE3 // 1:2.
3189 #define _WDTPS_4_2H 0xE5 // 1:4.
3190 #define _WDTPS_8_2H 0xE7 // 1:8.
3191 #define _WDTPS_16_2H 0xE9 // 1:16.
3192 #define _WDTPS_32_2H 0xEB // 1:32.
3193 #define _WDTPS_64_2H 0xED // 1:64.
3194 #define _WDTPS_128_2H 0xEF // 1:128.
3195 #define _WDTPS_256_2H 0xF1 // 1:256.
3196 #define _WDTPS_512_2H 0xF3 // 1:512.
3197 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3198 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3199 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3200 #define _WDTPS_8192_2H 0xFB // 1:8192.
3201 #define _WDTPS_16384_2H 0xFD // 1:16384.
3202 #define _WDTPS_32768_2H 0xFF // 1:32768.
3204 //----------------------------- CONFIG3H Options -------------------------------
3206 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3207 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3208 #define _MCLRE_OFF_3H 0x7F // RA3 input pin enabled; MCLR disabled.
3209 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA3 input pin disabled.
3211 //----------------------------- CONFIG4L Options -------------------------------
3213 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3214 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3215 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3216 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3217 #define _BBSIZ_OFF_4L 0xF7 // 1kW boot block size.
3218 #define _BBSIZ_ON_4L 0xFF // 2kW boot block size.
3219 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3220 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3221 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RA0 and RA1 are dedicated to In-Circuit Debug.
3222 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins.
3224 //----------------------------- CONFIG5L Options -------------------------------
3226 #define _CP0_ON_5L 0xFE // Block 0 code-protected.
3227 #define _CP0_OFF_5L 0xFF // Block 0 not code-protected.
3228 #define _CP1_ON_5L 0xFD // Block 1 code-protected.
3229 #define _CP1_OFF_5L 0xFF // Block 1 not code-protected.
3231 //----------------------------- CONFIG5H Options -------------------------------
3233 #define _CPB_ON_5H 0xBF // Boot block code-protected.
3234 #define _CPB_OFF_5H 0xFF // Boot block not code-protected.
3235 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3236 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3238 //----------------------------- CONFIG6L Options -------------------------------
3240 #define _WRT0_ON_6L 0xFE // Block 0 write-protected.
3241 #define _WRT0_OFF_6L 0xFF // Block 0 not write-protected.
3242 #define _WRT1_ON_6L 0xFD // Block 1 write-protected.
3243 #define _WRT1_OFF_6L 0xFF // Block 1 not write-protected.
3245 //----------------------------- CONFIG6H Options -------------------------------
3247 #define _WRTC_ON_6H 0xDF // Configuration registers write-protected.
3248 #define _WRTC_OFF_6H 0xFF // Configuration registers not write-protected.
3249 #define _WRTB_ON_6H 0xBF // Boot block write-protected.
3250 #define _WRTB_OFF_6H 0xFF // Boot block not write-protected.
3251 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3252 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3254 //----------------------------- CONFIG7L Options -------------------------------
3256 #define _EBTR0_ON_7L 0xFE // Block 0 protected from table reads executed in other blocks.
3257 #define _EBTR0_OFF_7L 0xFF // Block 0 not protected from table reads executed in other blocks.
3258 #define _EBTR1_ON_7L 0xFD // Block 1 protected from table reads executed in other blocks.
3259 #define _EBTR1_OFF_7L 0xFF // Block 1 not protected from table reads executed in other blocks.
3261 //----------------------------- CONFIG7H Options -------------------------------
3263 #define _EBTRB_ON_7H 0xBF // Boot block protected from table reads executed in other blocks.
3264 #define _EBTRB_OFF_7H 0xFF // Boot block not protected from table reads executed in other blocks.
3266 //==============================================================================
3268 #define __DEVID1 0x3FFFFE
3269 #define __DEVID2 0x3FFFFF
3271 #define __IDLOC0 0x200000
3272 #define __IDLOC1 0x200001
3273 #define __IDLOC2 0x200002
3274 #define __IDLOC3 0x200003
3275 #define __IDLOC4 0x200004
3276 #define __IDLOC5 0x200005
3277 #define __IDLOC6 0x200006
3278 #define __IDLOC7 0x200007
3280 #endif // #ifndef __PIC18LF14K22_H__