struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf13k22.h
blob3dc14a652630510abf80ab24eddef1ae77b33bc1
1 /*
2 * This declarations of the PIC18LF13K22 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 __PIC18LF13K22_H__
26 #define __PIC18LF13K22_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 P1B : 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 : 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 : 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_P1B 0x10
810 #define _PORTC_RC5 0x20
811 #define _PORTC_P1A 0x20
812 #define _PORTC_CCP1 0x20
813 #define _PORTC_RC6 0x40
814 #define _PORTC_AN8 0x40
815 #define _PORTC_SS 0x40
816 #define _PORTC_NOT_SS 0x40
817 #define _PORTC_RC7 0x80
818 #define _PORTC_AN9 0x80
819 #define _PORTC_SDO 0x80
821 //==============================================================================
824 //==============================================================================
825 // LATA Bits
827 extern __at(0x0F89) __sfr LATA;
829 typedef struct
831 unsigned LATA0 : 1;
832 unsigned LATA1 : 1;
833 unsigned LATA2 : 1;
834 unsigned : 1;
835 unsigned LATA4 : 1;
836 unsigned LATA5 : 1;
837 unsigned : 1;
838 unsigned : 1;
839 } __LATAbits_t;
841 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
843 #define _LATA0 0x01
844 #define _LATA1 0x02
845 #define _LATA2 0x04
846 #define _LATA4 0x10
847 #define _LATA5 0x20
849 //==============================================================================
852 //==============================================================================
853 // LATB Bits
855 extern __at(0x0F8A) __sfr LATB;
857 typedef struct
859 unsigned : 1;
860 unsigned : 1;
861 unsigned : 1;
862 unsigned : 1;
863 unsigned LATB4 : 1;
864 unsigned LATB5 : 1;
865 unsigned LATB6 : 1;
866 unsigned LATB7 : 1;
867 } __LATBbits_t;
869 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
871 #define _LATB4 0x10
872 #define _LATB5 0x20
873 #define _LATB6 0x40
874 #define _LATB7 0x80
876 //==============================================================================
879 //==============================================================================
880 // LATC Bits
882 extern __at(0x0F8B) __sfr LATC;
884 typedef struct
886 unsigned LATC0 : 1;
887 unsigned LATC1 : 1;
888 unsigned LATC2 : 1;
889 unsigned LATC3 : 1;
890 unsigned LATC4 : 1;
891 unsigned LATC5 : 1;
892 unsigned LATC6 : 1;
893 unsigned LATC7 : 1;
894 } __LATCbits_t;
896 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
898 #define _LATC0 0x01
899 #define _LATC1 0x02
900 #define _LATC2 0x04
901 #define _LATC3 0x08
902 #define _LATC4 0x10
903 #define _LATC5 0x20
904 #define _LATC6 0x40
905 #define _LATC7 0x80
907 //==============================================================================
910 //==============================================================================
911 // DDRA Bits
913 extern __at(0x0F92) __sfr DDRA;
915 typedef union
917 struct
919 unsigned TRISA0 : 1;
920 unsigned TRISA1 : 1;
921 unsigned TRISA2 : 1;
922 unsigned : 1;
923 unsigned TRISA4 : 1;
924 unsigned TRISA5 : 1;
925 unsigned : 1;
926 unsigned : 1;
929 struct
931 unsigned RA0 : 1;
932 unsigned RA1 : 1;
933 unsigned RA2 : 1;
934 unsigned : 1;
935 unsigned RA4 : 1;
936 unsigned RA5 : 1;
937 unsigned : 1;
938 unsigned : 1;
940 } __DDRAbits_t;
942 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
944 #define _TRISA0 0x01
945 #define _RA0 0x01
946 #define _TRISA1 0x02
947 #define _RA1 0x02
948 #define _TRISA2 0x04
949 #define _RA2 0x04
950 #define _TRISA4 0x10
951 #define _RA4 0x10
952 #define _TRISA5 0x20
953 #define _RA5 0x20
955 //==============================================================================
958 //==============================================================================
959 // TRISA Bits
961 extern __at(0x0F92) __sfr TRISA;
963 typedef union
965 struct
967 unsigned TRISA0 : 1;
968 unsigned TRISA1 : 1;
969 unsigned TRISA2 : 1;
970 unsigned : 1;
971 unsigned TRISA4 : 1;
972 unsigned TRISA5 : 1;
973 unsigned : 1;
974 unsigned : 1;
977 struct
979 unsigned RA0 : 1;
980 unsigned RA1 : 1;
981 unsigned RA2 : 1;
982 unsigned : 1;
983 unsigned RA4 : 1;
984 unsigned RA5 : 1;
985 unsigned : 1;
986 unsigned : 1;
988 } __TRISAbits_t;
990 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
992 #define _TRISA_TRISA0 0x01
993 #define _TRISA_RA0 0x01
994 #define _TRISA_TRISA1 0x02
995 #define _TRISA_RA1 0x02
996 #define _TRISA_TRISA2 0x04
997 #define _TRISA_RA2 0x04
998 #define _TRISA_TRISA4 0x10
999 #define _TRISA_RA4 0x10
1000 #define _TRISA_TRISA5 0x20
1001 #define _TRISA_RA5 0x20
1003 //==============================================================================
1006 //==============================================================================
1007 // DDRB Bits
1009 extern __at(0x0F93) __sfr DDRB;
1011 typedef union
1013 struct
1015 unsigned : 1;
1016 unsigned : 1;
1017 unsigned : 1;
1018 unsigned : 1;
1019 unsigned TRISB4 : 1;
1020 unsigned TRISB5 : 1;
1021 unsigned TRISB6 : 1;
1022 unsigned TRISB7 : 1;
1025 struct
1027 unsigned : 1;
1028 unsigned : 1;
1029 unsigned : 1;
1030 unsigned : 1;
1031 unsigned RB4 : 1;
1032 unsigned RB5 : 1;
1033 unsigned RB6 : 1;
1034 unsigned RB7 : 1;
1036 } __DDRBbits_t;
1038 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1040 #define _TRISB4 0x10
1041 #define _RB4 0x10
1042 #define _TRISB5 0x20
1043 #define _RB5 0x20
1044 #define _TRISB6 0x40
1045 #define _RB6 0x40
1046 #define _TRISB7 0x80
1047 #define _RB7 0x80
1049 //==============================================================================
1052 //==============================================================================
1053 // TRISB Bits
1055 extern __at(0x0F93) __sfr TRISB;
1057 typedef union
1059 struct
1061 unsigned : 1;
1062 unsigned : 1;
1063 unsigned : 1;
1064 unsigned : 1;
1065 unsigned TRISB4 : 1;
1066 unsigned TRISB5 : 1;
1067 unsigned TRISB6 : 1;
1068 unsigned TRISB7 : 1;
1071 struct
1073 unsigned : 1;
1074 unsigned : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned RB4 : 1;
1078 unsigned RB5 : 1;
1079 unsigned RB6 : 1;
1080 unsigned RB7 : 1;
1082 } __TRISBbits_t;
1084 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1086 #define _TRISB_TRISB4 0x10
1087 #define _TRISB_RB4 0x10
1088 #define _TRISB_TRISB5 0x20
1089 #define _TRISB_RB5 0x20
1090 #define _TRISB_TRISB6 0x40
1091 #define _TRISB_RB6 0x40
1092 #define _TRISB_TRISB7 0x80
1093 #define _TRISB_RB7 0x80
1095 //==============================================================================
1098 //==============================================================================
1099 // DDRC Bits
1101 extern __at(0x0F94) __sfr DDRC;
1103 typedef union
1105 struct
1107 unsigned TRISC0 : 1;
1108 unsigned TRISC1 : 1;
1109 unsigned TRISC2 : 1;
1110 unsigned TRISC3 : 1;
1111 unsigned TRISC4 : 1;
1112 unsigned TRISC5 : 1;
1113 unsigned TRISC6 : 1;
1114 unsigned TRISC7 : 1;
1117 struct
1119 unsigned RC0 : 1;
1120 unsigned RC1 : 1;
1121 unsigned RC2 : 1;
1122 unsigned RC3 : 1;
1123 unsigned RC4 : 1;
1124 unsigned RC5 : 1;
1125 unsigned RC6 : 1;
1126 unsigned RC7 : 1;
1128 } __DDRCbits_t;
1130 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1132 #define _TRISC0 0x01
1133 #define _RC0 0x01
1134 #define _TRISC1 0x02
1135 #define _RC1 0x02
1136 #define _TRISC2 0x04
1137 #define _RC2 0x04
1138 #define _TRISC3 0x08
1139 #define _RC3 0x08
1140 #define _TRISC4 0x10
1141 #define _RC4 0x10
1142 #define _TRISC5 0x20
1143 #define _RC5 0x20
1144 #define _TRISC6 0x40
1145 #define _RC6 0x40
1146 #define _TRISC7 0x80
1147 #define _RC7 0x80
1149 //==============================================================================
1152 //==============================================================================
1153 // TRISC Bits
1155 extern __at(0x0F94) __sfr TRISC;
1157 typedef union
1159 struct
1161 unsigned TRISC0 : 1;
1162 unsigned TRISC1 : 1;
1163 unsigned TRISC2 : 1;
1164 unsigned TRISC3 : 1;
1165 unsigned TRISC4 : 1;
1166 unsigned TRISC5 : 1;
1167 unsigned TRISC6 : 1;
1168 unsigned TRISC7 : 1;
1171 struct
1173 unsigned RC0 : 1;
1174 unsigned RC1 : 1;
1175 unsigned RC2 : 1;
1176 unsigned RC3 : 1;
1177 unsigned RC4 : 1;
1178 unsigned RC5 : 1;
1179 unsigned RC6 : 1;
1180 unsigned RC7 : 1;
1182 } __TRISCbits_t;
1184 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1186 #define _TRISC_TRISC0 0x01
1187 #define _TRISC_RC0 0x01
1188 #define _TRISC_TRISC1 0x02
1189 #define _TRISC_RC1 0x02
1190 #define _TRISC_TRISC2 0x04
1191 #define _TRISC_RC2 0x04
1192 #define _TRISC_TRISC3 0x08
1193 #define _TRISC_RC3 0x08
1194 #define _TRISC_TRISC4 0x10
1195 #define _TRISC_RC4 0x10
1196 #define _TRISC_TRISC5 0x20
1197 #define _TRISC_RC5 0x20
1198 #define _TRISC_TRISC6 0x40
1199 #define _TRISC_RC6 0x40
1200 #define _TRISC_TRISC7 0x80
1201 #define _TRISC_RC7 0x80
1203 //==============================================================================
1206 //==============================================================================
1207 // OSCTUNE Bits
1209 extern __at(0x0F9B) __sfr OSCTUNE;
1211 typedef union
1213 struct
1215 unsigned TUN0 : 1;
1216 unsigned TUN1 : 1;
1217 unsigned TUN2 : 1;
1218 unsigned TUN3 : 1;
1219 unsigned TUN4 : 1;
1220 unsigned TUN5 : 1;
1221 unsigned PLLEN : 1;
1222 unsigned INTSRC : 1;
1225 struct
1227 unsigned TUN : 6;
1228 unsigned : 2;
1230 } __OSCTUNEbits_t;
1232 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1234 #define _TUN0 0x01
1235 #define _TUN1 0x02
1236 #define _TUN2 0x04
1237 #define _TUN3 0x08
1238 #define _TUN4 0x10
1239 #define _TUN5 0x20
1240 #define _PLLEN 0x40
1241 #define _INTSRC 0x80
1243 //==============================================================================
1246 //==============================================================================
1247 // PIE1 Bits
1249 extern __at(0x0F9D) __sfr PIE1;
1251 typedef struct
1253 unsigned TMR1IE : 1;
1254 unsigned TMR2IE : 1;
1255 unsigned CCP1IE : 1;
1256 unsigned SSPIE : 1;
1257 unsigned TXIE : 1;
1258 unsigned RCIE : 1;
1259 unsigned ADIE : 1;
1260 unsigned : 1;
1261 } __PIE1bits_t;
1263 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1265 #define _TMR1IE 0x01
1266 #define _TMR2IE 0x02
1267 #define _CCP1IE 0x04
1268 #define _SSPIE 0x08
1269 #define _TXIE 0x10
1270 #define _RCIE 0x20
1271 #define _ADIE 0x40
1273 //==============================================================================
1276 //==============================================================================
1277 // PIR1 Bits
1279 extern __at(0x0F9E) __sfr PIR1;
1281 typedef struct
1283 unsigned TMR1IF : 1;
1284 unsigned TMR2IF : 1;
1285 unsigned CCP1IF : 1;
1286 unsigned SSPIF : 1;
1287 unsigned TXIF : 1;
1288 unsigned RCIF : 1;
1289 unsigned ADIF : 1;
1290 unsigned : 1;
1291 } __PIR1bits_t;
1293 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1295 #define _TMR1IF 0x01
1296 #define _TMR2IF 0x02
1297 #define _CCP1IF 0x04
1298 #define _SSPIF 0x08
1299 #define _TXIF 0x10
1300 #define _RCIF 0x20
1301 #define _ADIF 0x40
1303 //==============================================================================
1306 //==============================================================================
1307 // IPR1 Bits
1309 extern __at(0x0F9F) __sfr IPR1;
1311 typedef struct
1313 unsigned TMR1IP : 1;
1314 unsigned TMR2IP : 1;
1315 unsigned CCP1IP : 1;
1316 unsigned SSPIP : 1;
1317 unsigned TXIP : 1;
1318 unsigned RCIP : 1;
1319 unsigned ADIP : 1;
1320 unsigned : 1;
1321 } __IPR1bits_t;
1323 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1325 #define _TMR1IP 0x01
1326 #define _TMR2IP 0x02
1327 #define _CCP1IP 0x04
1328 #define _SSPIP 0x08
1329 #define _TXIP 0x10
1330 #define _RCIP 0x20
1331 #define _ADIP 0x40
1333 //==============================================================================
1336 //==============================================================================
1337 // PIE2 Bits
1339 extern __at(0x0FA0) __sfr PIE2;
1341 typedef struct
1343 unsigned : 1;
1344 unsigned TMR3IE : 1;
1345 unsigned : 1;
1346 unsigned BCLIE : 1;
1347 unsigned EEIE : 1;
1348 unsigned C2IE : 1;
1349 unsigned C1IE : 1;
1350 unsigned OSCFIE : 1;
1351 } __PIE2bits_t;
1353 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1355 #define _TMR3IE 0x02
1356 #define _BCLIE 0x08
1357 #define _EEIE 0x10
1358 #define _C2IE 0x20
1359 #define _C1IE 0x40
1360 #define _OSCFIE 0x80
1362 //==============================================================================
1365 //==============================================================================
1366 // PIR2 Bits
1368 extern __at(0x0FA1) __sfr PIR2;
1370 typedef struct
1372 unsigned : 1;
1373 unsigned TMR3IF : 1;
1374 unsigned : 1;
1375 unsigned BCLIF : 1;
1376 unsigned EEIF : 1;
1377 unsigned C2IF : 1;
1378 unsigned C1IF : 1;
1379 unsigned OSCFIF : 1;
1380 } __PIR2bits_t;
1382 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1384 #define _TMR3IF 0x02
1385 #define _BCLIF 0x08
1386 #define _EEIF 0x10
1387 #define _C2IF 0x20
1388 #define _C1IF 0x40
1389 #define _OSCFIF 0x80
1391 //==============================================================================
1394 //==============================================================================
1395 // IPR2 Bits
1397 extern __at(0x0FA2) __sfr IPR2;
1399 typedef struct
1401 unsigned : 1;
1402 unsigned TMR3IP : 1;
1403 unsigned : 1;
1404 unsigned BCLIP : 1;
1405 unsigned EEIP : 1;
1406 unsigned C2IP : 1;
1407 unsigned C1IP : 1;
1408 unsigned OSCFIP : 1;
1409 } __IPR2bits_t;
1411 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1413 #define _TMR3IP 0x02
1414 #define _BCLIP 0x08
1415 #define _EEIP 0x10
1416 #define _C2IP 0x20
1417 #define _C1IP 0x40
1418 #define _OSCFIP 0x80
1420 //==============================================================================
1423 //==============================================================================
1424 // EECON1 Bits
1426 extern __at(0x0FA6) __sfr EECON1;
1428 typedef struct
1430 unsigned RD : 1;
1431 unsigned WR : 1;
1432 unsigned WREN : 1;
1433 unsigned WRERR : 1;
1434 unsigned FREE : 1;
1435 unsigned : 1;
1436 unsigned CFGS : 1;
1437 unsigned EEPGD : 1;
1438 } __EECON1bits_t;
1440 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1442 #define _RD 0x01
1443 #define _WR 0x02
1444 #define _WREN 0x04
1445 #define _WRERR 0x08
1446 #define _FREE 0x10
1447 #define _CFGS 0x40
1448 #define _EEPGD 0x80
1450 //==============================================================================
1452 extern __at(0x0FA7) __sfr EECON2;
1453 extern __at(0x0FA8) __sfr EEDATA;
1455 //==============================================================================
1456 // EEADR Bits
1458 extern __at(0x0FA9) __sfr EEADR;
1460 typedef struct
1462 unsigned EEADR0 : 1;
1463 unsigned EEADR1 : 1;
1464 unsigned EEADR2 : 1;
1465 unsigned EEADR3 : 1;
1466 unsigned EEADR4 : 1;
1467 unsigned EEADR5 : 1;
1468 unsigned EEADR6 : 1;
1469 unsigned EEADR7 : 1;
1470 } __EEADRbits_t;
1472 extern __at(0x0FA9) volatile __EEADRbits_t EEADRbits;
1474 #define _EEADR0 0x01
1475 #define _EEADR1 0x02
1476 #define _EEADR2 0x04
1477 #define _EEADR3 0x08
1478 #define _EEADR4 0x10
1479 #define _EEADR5 0x20
1480 #define _EEADR6 0x40
1481 #define _EEADR7 0x80
1483 //==============================================================================
1486 //==============================================================================
1487 // RCSTA Bits
1489 extern __at(0x0FAB) __sfr RCSTA;
1491 typedef union
1493 struct
1495 unsigned RX9D : 1;
1496 unsigned OERR : 1;
1497 unsigned FERR : 1;
1498 unsigned ADDEN : 1;
1499 unsigned CREN : 1;
1500 unsigned SREN : 1;
1501 unsigned RX9 : 1;
1502 unsigned SPEN : 1;
1505 struct
1507 unsigned : 1;
1508 unsigned : 1;
1509 unsigned : 1;
1510 unsigned ADEN : 1;
1511 unsigned : 1;
1512 unsigned : 1;
1513 unsigned : 1;
1514 unsigned : 1;
1516 } __RCSTAbits_t;
1518 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1520 #define _RX9D 0x01
1521 #define _OERR 0x02
1522 #define _FERR 0x04
1523 #define _ADDEN 0x08
1524 #define _ADEN 0x08
1525 #define _CREN 0x10
1526 #define _SREN 0x20
1527 #define _RX9 0x40
1528 #define _SPEN 0x80
1530 //==============================================================================
1533 //==============================================================================
1534 // TXSTA Bits
1536 extern __at(0x0FAC) __sfr TXSTA;
1538 typedef struct
1540 unsigned TX9D : 1;
1541 unsigned TRMT : 1;
1542 unsigned BRGH : 1;
1543 unsigned SENDB : 1;
1544 unsigned SYNC : 1;
1545 unsigned TXEN : 1;
1546 unsigned TX9 : 1;
1547 unsigned CSRC : 1;
1548 } __TXSTAbits_t;
1550 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1552 #define _TX9D 0x01
1553 #define _TRMT 0x02
1554 #define _BRGH 0x04
1555 #define _SENDB 0x08
1556 #define _SYNC 0x10
1557 #define _TXEN 0x20
1558 #define _TX9 0x40
1559 #define _CSRC 0x80
1561 //==============================================================================
1563 extern __at(0x0FAD) __sfr TXREG;
1564 extern __at(0x0FAE) __sfr RCREG;
1565 extern __at(0x0FAF) __sfr SPBRG;
1566 extern __at(0x0FB0) __sfr SPBRGH;
1568 //==============================================================================
1569 // T3CON Bits
1571 extern __at(0x0FB1) __sfr T3CON;
1573 typedef union
1575 struct
1577 unsigned TMR3ON : 1;
1578 unsigned TMR3CS : 1;
1579 unsigned NOT_T3SYNC : 1;
1580 unsigned T3CCP1 : 1;
1581 unsigned T3CKPS0 : 1;
1582 unsigned T3CKPS1 : 1;
1583 unsigned : 1;
1584 unsigned RD16 : 1;
1587 struct
1589 unsigned : 1;
1590 unsigned : 1;
1591 unsigned T3SYNC : 1;
1592 unsigned : 1;
1593 unsigned : 1;
1594 unsigned : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1599 struct
1601 unsigned : 4;
1602 unsigned T3CKPS : 2;
1603 unsigned : 2;
1605 } __T3CONbits_t;
1607 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1609 #define _T3CON_TMR3ON 0x01
1610 #define _T3CON_TMR3CS 0x02
1611 #define _T3CON_NOT_T3SYNC 0x04
1612 #define _T3CON_T3SYNC 0x04
1613 #define _T3CON_T3CCP1 0x08
1614 #define _T3CON_T3CKPS0 0x10
1615 #define _T3CON_T3CKPS1 0x20
1616 #define _T3CON_RD16 0x80
1618 //==============================================================================
1620 extern __at(0x0FB2) __sfr TMR3;
1621 extern __at(0x0FB2) __sfr TMR3L;
1622 extern __at(0x0FB3) __sfr TMR3H;
1624 //==============================================================================
1625 // ECCP1AS Bits
1627 extern __at(0x0FB6) __sfr ECCP1AS;
1629 typedef union
1631 struct
1633 unsigned PSSBD0 : 1;
1634 unsigned PSSBD1 : 1;
1635 unsigned PSSAC0 : 1;
1636 unsigned PSSAC1 : 1;
1637 unsigned ECCPAS0 : 1;
1638 unsigned ECCPAS1 : 1;
1639 unsigned ECCPAS2 : 1;
1640 unsigned ECCPASE : 1;
1643 struct
1645 unsigned PSSBD : 2;
1646 unsigned : 6;
1649 struct
1651 unsigned : 2;
1652 unsigned PSSAC : 2;
1653 unsigned : 4;
1656 struct
1658 unsigned : 4;
1659 unsigned ECCPAS : 3;
1660 unsigned : 1;
1662 } __ECCP1ASbits_t;
1664 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1666 #define _PSSBD0 0x01
1667 #define _PSSBD1 0x02
1668 #define _PSSAC0 0x04
1669 #define _PSSAC1 0x08
1670 #define _ECCPAS0 0x10
1671 #define _ECCPAS1 0x20
1672 #define _ECCPAS2 0x40
1673 #define _ECCPASE 0x80
1675 //==============================================================================
1678 //==============================================================================
1679 // PWM1CON Bits
1681 extern __at(0x0FB7) __sfr PWM1CON;
1683 typedef union
1685 struct
1687 unsigned PDC0 : 1;
1688 unsigned PDC1 : 1;
1689 unsigned PDC2 : 1;
1690 unsigned PDC3 : 1;
1691 unsigned PDC4 : 1;
1692 unsigned PDC5 : 1;
1693 unsigned PDC6 : 1;
1694 unsigned PRSEN : 1;
1697 struct
1699 unsigned PDC : 7;
1700 unsigned : 1;
1702 } __PWM1CONbits_t;
1704 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1706 #define _PDC0 0x01
1707 #define _PDC1 0x02
1708 #define _PDC2 0x04
1709 #define _PDC3 0x08
1710 #define _PDC4 0x10
1711 #define _PDC5 0x20
1712 #define _PDC6 0x40
1713 #define _PRSEN 0x80
1715 //==============================================================================
1718 //==============================================================================
1719 // BAUDCON Bits
1721 extern __at(0x0FB8) __sfr BAUDCON;
1723 typedef union
1725 struct
1727 unsigned ABDEN : 1;
1728 unsigned WUE : 1;
1729 unsigned : 1;
1730 unsigned BRG16 : 1;
1731 unsigned CKTXP : 1;
1732 unsigned DTRXP : 1;
1733 unsigned RCIDL : 1;
1734 unsigned ABDOVF : 1;
1737 struct
1739 unsigned : 1;
1740 unsigned : 1;
1741 unsigned : 1;
1742 unsigned : 1;
1743 unsigned SCKP : 1;
1744 unsigned : 1;
1745 unsigned : 1;
1746 unsigned : 1;
1748 } __BAUDCONbits_t;
1750 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1752 #define _ABDEN 0x01
1753 #define _WUE 0x02
1754 #define _BRG16 0x08
1755 #define _CKTXP 0x10
1756 #define _SCKP 0x10
1757 #define _DTRXP 0x20
1758 #define _RCIDL 0x40
1759 #define _ABDOVF 0x80
1761 //==============================================================================
1764 //==============================================================================
1765 // BAUDCTL Bits
1767 extern __at(0x0FB8) __sfr BAUDCTL;
1769 typedef union
1771 struct
1773 unsigned ABDEN : 1;
1774 unsigned WUE : 1;
1775 unsigned : 1;
1776 unsigned BRG16 : 1;
1777 unsigned CKTXP : 1;
1778 unsigned DTRXP : 1;
1779 unsigned RCIDL : 1;
1780 unsigned ABDOVF : 1;
1783 struct
1785 unsigned : 1;
1786 unsigned : 1;
1787 unsigned : 1;
1788 unsigned : 1;
1789 unsigned SCKP : 1;
1790 unsigned : 1;
1791 unsigned : 1;
1792 unsigned : 1;
1794 } __BAUDCTLbits_t;
1796 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1798 #define _BAUDCTL_ABDEN 0x01
1799 #define _BAUDCTL_WUE 0x02
1800 #define _BAUDCTL_BRG16 0x08
1801 #define _BAUDCTL_CKTXP 0x10
1802 #define _BAUDCTL_SCKP 0x10
1803 #define _BAUDCTL_DTRXP 0x20
1804 #define _BAUDCTL_RCIDL 0x40
1805 #define _BAUDCTL_ABDOVF 0x80
1807 //==============================================================================
1810 //==============================================================================
1811 // PSTRCON Bits
1813 extern __at(0x0FB9) __sfr PSTRCON;
1815 typedef struct
1817 unsigned STRA : 1;
1818 unsigned STRB : 1;
1819 unsigned STRC : 1;
1820 unsigned STRD : 1;
1821 unsigned STRSYNC : 1;
1822 unsigned : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1825 } __PSTRCONbits_t;
1827 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1829 #define _STRA 0x01
1830 #define _STRB 0x02
1831 #define _STRC 0x04
1832 #define _STRD 0x08
1833 #define _STRSYNC 0x10
1835 //==============================================================================
1838 //==============================================================================
1839 // REFCON0 Bits
1841 extern __at(0x0FBA) __sfr REFCON0;
1843 typedef union
1845 struct
1847 unsigned : 1;
1848 unsigned : 1;
1849 unsigned : 1;
1850 unsigned : 1;
1851 unsigned FVR1S0 : 1;
1852 unsigned FVR1S1 : 1;
1853 unsigned FVR1ST : 1;
1854 unsigned FVR1EN : 1;
1857 struct
1859 unsigned : 4;
1860 unsigned FVR1S : 2;
1861 unsigned : 2;
1863 } __REFCON0bits_t;
1865 extern __at(0x0FBA) volatile __REFCON0bits_t REFCON0bits;
1867 #define _FVR1S0 0x10
1868 #define _FVR1S1 0x20
1869 #define _FVR1ST 0x40
1870 #define _FVR1EN 0x80
1872 //==============================================================================
1875 //==============================================================================
1876 // VREFCON0 Bits
1878 extern __at(0x0FBA) __sfr VREFCON0;
1880 typedef union
1882 struct
1884 unsigned : 1;
1885 unsigned : 1;
1886 unsigned : 1;
1887 unsigned : 1;
1888 unsigned FVR1S0 : 1;
1889 unsigned FVR1S1 : 1;
1890 unsigned FVR1ST : 1;
1891 unsigned FVR1EN : 1;
1894 struct
1896 unsigned : 4;
1897 unsigned FVR1S : 2;
1898 unsigned : 2;
1900 } __VREFCON0bits_t;
1902 extern __at(0x0FBA) volatile __VREFCON0bits_t VREFCON0bits;
1904 #define _VREFCON0_FVR1S0 0x10
1905 #define _VREFCON0_FVR1S1 0x20
1906 #define _VREFCON0_FVR1ST 0x40
1907 #define _VREFCON0_FVR1EN 0x80
1909 //==============================================================================
1912 //==============================================================================
1913 // REFCON1 Bits
1915 extern __at(0x0FBB) __sfr REFCON1;
1917 typedef union
1919 struct
1921 unsigned D1NSS : 1;
1922 unsigned : 1;
1923 unsigned D1PSS0 : 1;
1924 unsigned D1PSS1 : 1;
1925 unsigned : 1;
1926 unsigned DAC1OE : 1;
1927 unsigned D1LPS : 1;
1928 unsigned D1EN : 1;
1931 struct
1933 unsigned D1NSS0 : 1;
1934 unsigned : 1;
1935 unsigned : 1;
1936 unsigned : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1943 struct
1945 unsigned : 2;
1946 unsigned D1PSS : 2;
1947 unsigned : 4;
1949 } __REFCON1bits_t;
1951 extern __at(0x0FBB) volatile __REFCON1bits_t REFCON1bits;
1953 #define _D1NSS 0x01
1954 #define _D1NSS0 0x01
1955 #define _D1PSS0 0x04
1956 #define _D1PSS1 0x08
1957 #define _DAC1OE 0x20
1958 #define _D1LPS 0x40
1959 #define _D1EN 0x80
1961 //==============================================================================
1964 //==============================================================================
1965 // VREFCON1 Bits
1967 extern __at(0x0FBB) __sfr VREFCON1;
1969 typedef union
1971 struct
1973 unsigned D1NSS : 1;
1974 unsigned : 1;
1975 unsigned D1PSS0 : 1;
1976 unsigned D1PSS1 : 1;
1977 unsigned : 1;
1978 unsigned DAC1OE : 1;
1979 unsigned D1LPS : 1;
1980 unsigned D1EN : 1;
1983 struct
1985 unsigned D1NSS0 : 1;
1986 unsigned : 1;
1987 unsigned : 1;
1988 unsigned : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1991 unsigned : 1;
1992 unsigned : 1;
1995 struct
1997 unsigned : 2;
1998 unsigned D1PSS : 2;
1999 unsigned : 4;
2001 } __VREFCON1bits_t;
2003 extern __at(0x0FBB) volatile __VREFCON1bits_t VREFCON1bits;
2005 #define _VREFCON1_D1NSS 0x01
2006 #define _VREFCON1_D1NSS0 0x01
2007 #define _VREFCON1_D1PSS0 0x04
2008 #define _VREFCON1_D1PSS1 0x08
2009 #define _VREFCON1_DAC1OE 0x20
2010 #define _VREFCON1_D1LPS 0x40
2011 #define _VREFCON1_D1EN 0x80
2013 //==============================================================================
2016 //==============================================================================
2017 // REFCON2 Bits
2019 extern __at(0x0FBC) __sfr REFCON2;
2021 typedef union
2023 struct
2025 unsigned DAC1R0 : 1;
2026 unsigned DAC1R1 : 1;
2027 unsigned DAC1R2 : 1;
2028 unsigned DAC1R3 : 1;
2029 unsigned DAC1R4 : 1;
2030 unsigned : 1;
2031 unsigned : 1;
2032 unsigned : 1;
2035 struct
2037 unsigned DAC1R : 5;
2038 unsigned : 3;
2040 } __REFCON2bits_t;
2042 extern __at(0x0FBC) volatile __REFCON2bits_t REFCON2bits;
2044 #define _DAC1R0 0x01
2045 #define _DAC1R1 0x02
2046 #define _DAC1R2 0x04
2047 #define _DAC1R3 0x08
2048 #define _DAC1R4 0x10
2050 //==============================================================================
2053 //==============================================================================
2054 // VREFCON2 Bits
2056 extern __at(0x0FBC) __sfr VREFCON2;
2058 typedef union
2060 struct
2062 unsigned DAC1R0 : 1;
2063 unsigned DAC1R1 : 1;
2064 unsigned DAC1R2 : 1;
2065 unsigned DAC1R3 : 1;
2066 unsigned DAC1R4 : 1;
2067 unsigned : 1;
2068 unsigned : 1;
2069 unsigned : 1;
2072 struct
2074 unsigned DAC1R : 5;
2075 unsigned : 3;
2077 } __VREFCON2bits_t;
2079 extern __at(0x0FBC) volatile __VREFCON2bits_t VREFCON2bits;
2081 #define _VREFCON2_DAC1R0 0x01
2082 #define _VREFCON2_DAC1R1 0x02
2083 #define _VREFCON2_DAC1R2 0x04
2084 #define _VREFCON2_DAC1R3 0x08
2085 #define _VREFCON2_DAC1R4 0x10
2087 //==============================================================================
2090 //==============================================================================
2091 // CCP1CON Bits
2093 extern __at(0x0FBD) __sfr CCP1CON;
2095 typedef union
2097 struct
2099 unsigned CCP1M0 : 1;
2100 unsigned CCP1M1 : 1;
2101 unsigned CCP1M2 : 1;
2102 unsigned CCP1M3 : 1;
2103 unsigned DC1B0 : 1;
2104 unsigned DC1B1 : 1;
2105 unsigned P1M0 : 1;
2106 unsigned P1M1 : 1;
2109 struct
2111 unsigned CCP1M : 4;
2112 unsigned : 4;
2115 struct
2117 unsigned : 4;
2118 unsigned DC1B : 2;
2119 unsigned : 2;
2122 struct
2124 unsigned : 6;
2125 unsigned P1M : 2;
2127 } __CCP1CONbits_t;
2129 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2131 #define _CCP1M0 0x01
2132 #define _CCP1M1 0x02
2133 #define _CCP1M2 0x04
2134 #define _CCP1M3 0x08
2135 #define _DC1B0 0x10
2136 #define _DC1B1 0x20
2137 #define _P1M0 0x40
2138 #define _P1M1 0x80
2140 //==============================================================================
2142 extern __at(0x0FBE) __sfr CCPR1;
2143 extern __at(0x0FBE) __sfr CCPR1L;
2144 extern __at(0x0FBF) __sfr CCPR1H;
2146 //==============================================================================
2147 // ADCON2 Bits
2149 extern __at(0x0FC0) __sfr ADCON2;
2151 typedef union
2153 struct
2155 unsigned ADCS0 : 1;
2156 unsigned ADCS1 : 1;
2157 unsigned ADCS2 : 1;
2158 unsigned ACQT0 : 1;
2159 unsigned ACQT1 : 1;
2160 unsigned ACQT2 : 1;
2161 unsigned : 1;
2162 unsigned ADFM : 1;
2165 struct
2167 unsigned ADCS : 3;
2168 unsigned : 5;
2171 struct
2173 unsigned : 3;
2174 unsigned ACQT : 3;
2175 unsigned : 2;
2177 } __ADCON2bits_t;
2179 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2181 #define _ADCS0 0x01
2182 #define _ADCS1 0x02
2183 #define _ADCS2 0x04
2184 #define _ACQT0 0x08
2185 #define _ACQT1 0x10
2186 #define _ACQT2 0x20
2187 #define _ADFM 0x80
2189 //==============================================================================
2192 //==============================================================================
2193 // ADCON1 Bits
2195 extern __at(0x0FC1) __sfr ADCON1;
2197 typedef union
2199 struct
2201 unsigned NVCFG0 : 1;
2202 unsigned NVCFG1 : 1;
2203 unsigned PVCFG0 : 1;
2204 unsigned PVCFG1 : 1;
2205 unsigned : 1;
2206 unsigned : 1;
2207 unsigned : 1;
2208 unsigned : 1;
2211 struct
2213 unsigned NVCFG : 2;
2214 unsigned : 6;
2217 struct
2219 unsigned : 2;
2220 unsigned PVCFG : 2;
2221 unsigned : 4;
2223 } __ADCON1bits_t;
2225 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2227 #define _NVCFG0 0x01
2228 #define _NVCFG1 0x02
2229 #define _PVCFG0 0x04
2230 #define _PVCFG1 0x08
2232 //==============================================================================
2235 //==============================================================================
2236 // ADCON0 Bits
2238 extern __at(0x0FC2) __sfr ADCON0;
2240 typedef union
2242 struct
2244 unsigned ADON : 1;
2245 unsigned GO_NOT_DONE : 1;
2246 unsigned CHS0 : 1;
2247 unsigned CHS1 : 1;
2248 unsigned CHS2 : 1;
2249 unsigned CHS3 : 1;
2250 unsigned : 1;
2251 unsigned : 1;
2254 struct
2256 unsigned : 1;
2257 unsigned DONE : 1;
2258 unsigned : 1;
2259 unsigned : 1;
2260 unsigned : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned : 1;
2266 struct
2268 unsigned : 1;
2269 unsigned NOT_DONE : 1;
2270 unsigned : 1;
2271 unsigned : 1;
2272 unsigned : 1;
2273 unsigned : 1;
2274 unsigned : 1;
2275 unsigned : 1;
2278 struct
2280 unsigned : 1;
2281 unsigned GO_DONE : 1;
2282 unsigned : 1;
2283 unsigned : 1;
2284 unsigned : 1;
2285 unsigned : 1;
2286 unsigned : 1;
2287 unsigned : 1;
2290 struct
2292 unsigned : 1;
2293 unsigned GO : 1;
2294 unsigned : 1;
2295 unsigned : 1;
2296 unsigned : 1;
2297 unsigned : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2302 struct
2304 unsigned : 2;
2305 unsigned CHS : 4;
2306 unsigned : 2;
2308 } __ADCON0bits_t;
2310 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2312 #define _ADON 0x01
2313 #define _GO_NOT_DONE 0x02
2314 #define _DONE 0x02
2315 #define _NOT_DONE 0x02
2316 #define _GO_DONE 0x02
2317 #define _GO 0x02
2318 #define _CHS0 0x04
2319 #define _CHS1 0x08
2320 #define _CHS2 0x10
2321 #define _CHS3 0x20
2323 //==============================================================================
2325 extern __at(0x0FC3) __sfr ADRES;
2326 extern __at(0x0FC3) __sfr ADRESL;
2327 extern __at(0x0FC4) __sfr ADRESH;
2329 //==============================================================================
2330 // SSPCON2 Bits
2332 extern __at(0x0FC5) __sfr SSPCON2;
2334 typedef struct
2336 unsigned SEN : 1;
2337 unsigned RSEN : 1;
2338 unsigned PEN : 1;
2339 unsigned RCEN : 1;
2340 unsigned ACKEN : 1;
2341 unsigned ACKDT : 1;
2342 unsigned ACKSTAT : 1;
2343 unsigned GCEN : 1;
2344 } __SSPCON2bits_t;
2346 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2348 #define _SEN 0x01
2349 #define _RSEN 0x02
2350 #define _PEN 0x04
2351 #define _RCEN 0x08
2352 #define _ACKEN 0x10
2353 #define _ACKDT 0x20
2354 #define _ACKSTAT 0x40
2355 #define _GCEN 0x80
2357 //==============================================================================
2360 //==============================================================================
2361 // SSPCON1 Bits
2363 extern __at(0x0FC6) __sfr SSPCON1;
2365 typedef union
2367 struct
2369 unsigned SSPM0 : 1;
2370 unsigned SSPM1 : 1;
2371 unsigned SSPM2 : 1;
2372 unsigned SSPM3 : 1;
2373 unsigned CKP : 1;
2374 unsigned SSPEN : 1;
2375 unsigned SSPOV : 1;
2376 unsigned WCOL : 1;
2379 struct
2381 unsigned SSPM : 4;
2382 unsigned : 4;
2384 } __SSPCON1bits_t;
2386 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2388 #define _SSPM0 0x01
2389 #define _SSPM1 0x02
2390 #define _SSPM2 0x04
2391 #define _SSPM3 0x08
2392 #define _CKP 0x10
2393 #define _SSPEN 0x20
2394 #define _SSPOV 0x40
2395 #define _WCOL 0x80
2397 //==============================================================================
2400 //==============================================================================
2401 // SSPSTAT Bits
2403 extern __at(0x0FC7) __sfr SSPSTAT;
2405 typedef union
2407 struct
2409 unsigned BF : 1;
2410 unsigned UA : 1;
2411 unsigned R_NOT_W : 1;
2412 unsigned S : 1;
2413 unsigned P : 1;
2414 unsigned D_NOT_A : 1;
2415 unsigned CKE : 1;
2416 unsigned SMP : 1;
2419 struct
2421 unsigned : 1;
2422 unsigned : 1;
2423 unsigned R : 1;
2424 unsigned : 1;
2425 unsigned : 1;
2426 unsigned D : 1;
2427 unsigned : 1;
2428 unsigned : 1;
2431 struct
2433 unsigned : 1;
2434 unsigned : 1;
2435 unsigned NOT_W : 1;
2436 unsigned : 1;
2437 unsigned : 1;
2438 unsigned NOT_A : 1;
2439 unsigned : 1;
2440 unsigned : 1;
2443 struct
2445 unsigned : 1;
2446 unsigned : 1;
2447 unsigned R_W : 1;
2448 unsigned : 1;
2449 unsigned : 1;
2450 unsigned D_A : 1;
2451 unsigned : 1;
2452 unsigned : 1;
2455 struct
2457 unsigned : 1;
2458 unsigned : 1;
2459 unsigned NOT_WRITE : 1;
2460 unsigned : 1;
2461 unsigned : 1;
2462 unsigned NOT_ADDRESS : 1;
2463 unsigned : 1;
2464 unsigned : 1;
2466 } __SSPSTATbits_t;
2468 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2470 #define _BF 0x01
2471 #define _UA 0x02
2472 #define _R_NOT_W 0x04
2473 #define _R 0x04
2474 #define _NOT_W 0x04
2475 #define _R_W 0x04
2476 #define _NOT_WRITE 0x04
2477 #define _S 0x08
2478 #define _P 0x10
2479 #define _D_NOT_A 0x20
2480 #define _D 0x20
2481 #define _NOT_A 0x20
2482 #define _D_A 0x20
2483 #define _NOT_ADDRESS 0x20
2484 #define _CKE 0x40
2485 #define _SMP 0x80
2487 //==============================================================================
2489 extern __at(0x0FC8) __sfr SSPADD;
2490 extern __at(0x0FC9) __sfr SSPBUF;
2492 //==============================================================================
2493 // T2CON Bits
2495 extern __at(0x0FCA) __sfr T2CON;
2497 typedef union
2499 struct
2501 unsigned T2CKPS0 : 1;
2502 unsigned T2CKPS1 : 1;
2503 unsigned TMR2ON : 1;
2504 unsigned T2OUTPS0 : 1;
2505 unsigned T2OUTPS1 : 1;
2506 unsigned T2OUTPS2 : 1;
2507 unsigned T2OUTPS3 : 1;
2508 unsigned : 1;
2511 struct
2513 unsigned T2CKPS : 2;
2514 unsigned : 6;
2517 struct
2519 unsigned : 3;
2520 unsigned T2OUTPS : 4;
2521 unsigned : 1;
2523 } __T2CONbits_t;
2525 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2527 #define _T2CKPS0 0x01
2528 #define _T2CKPS1 0x02
2529 #define _TMR2ON 0x04
2530 #define _T2OUTPS0 0x08
2531 #define _T2OUTPS1 0x10
2532 #define _T2OUTPS2 0x20
2533 #define _T2OUTPS3 0x40
2535 //==============================================================================
2537 extern __at(0x0FCB) __sfr PR2;
2538 extern __at(0x0FCC) __sfr TMR2;
2540 //==============================================================================
2541 // T1CON Bits
2543 extern __at(0x0FCD) __sfr T1CON;
2545 typedef union
2547 struct
2549 unsigned TMR1ON : 1;
2550 unsigned TMR1CS : 1;
2551 unsigned NOT_T1SYNC : 1;
2552 unsigned T1OSCEN : 1;
2553 unsigned T1CKPS0 : 1;
2554 unsigned T1CKPS1 : 1;
2555 unsigned T1RUN : 1;
2556 unsigned RD16 : 1;
2559 struct
2561 unsigned : 1;
2562 unsigned : 1;
2563 unsigned T1SYNC : 1;
2564 unsigned : 1;
2565 unsigned : 1;
2566 unsigned : 1;
2567 unsigned : 1;
2568 unsigned : 1;
2571 struct
2573 unsigned : 4;
2574 unsigned T1CKPS : 2;
2575 unsigned : 2;
2577 } __T1CONbits_t;
2579 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2581 #define _TMR1ON 0x01
2582 #define _TMR1CS 0x02
2583 #define _NOT_T1SYNC 0x04
2584 #define _T1SYNC 0x04
2585 #define _T1OSCEN 0x08
2586 #define _T1CKPS0 0x10
2587 #define _T1CKPS1 0x20
2588 #define _T1RUN 0x40
2589 #define _RD16 0x80
2591 //==============================================================================
2593 extern __at(0x0FCE) __sfr TMR1;
2594 extern __at(0x0FCE) __sfr TMR1L;
2595 extern __at(0x0FCF) __sfr TMR1H;
2597 //==============================================================================
2598 // RCON Bits
2600 extern __at(0x0FD0) __sfr RCON;
2602 typedef union
2604 struct
2606 unsigned NOT_BOR : 1;
2607 unsigned NOT_POR : 1;
2608 unsigned NOT_PD : 1;
2609 unsigned NOT_TO : 1;
2610 unsigned NOT_RI : 1;
2611 unsigned : 1;
2612 unsigned SBOREN : 1;
2613 unsigned IPEN : 1;
2616 struct
2618 unsigned BOR : 1;
2619 unsigned POR : 1;
2620 unsigned PD : 1;
2621 unsigned TO : 1;
2622 unsigned RI : 1;
2623 unsigned : 1;
2624 unsigned : 1;
2625 unsigned : 1;
2627 } __RCONbits_t;
2629 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2631 #define _NOT_BOR 0x01
2632 #define _BOR 0x01
2633 #define _NOT_POR 0x02
2634 #define _POR 0x02
2635 #define _NOT_PD 0x04
2636 #define _PD 0x04
2637 #define _NOT_TO 0x08
2638 #define _TO 0x08
2639 #define _NOT_RI 0x10
2640 #define _RI 0x10
2641 #define _SBOREN 0x40
2642 #define _IPEN 0x80
2644 //==============================================================================
2647 //==============================================================================
2648 // WDTCON Bits
2650 extern __at(0x0FD1) __sfr WDTCON;
2652 typedef union
2654 struct
2656 unsigned SWDTEN : 1;
2657 unsigned : 1;
2658 unsigned : 1;
2659 unsigned : 1;
2660 unsigned : 1;
2661 unsigned : 1;
2662 unsigned : 1;
2663 unsigned : 1;
2666 struct
2668 unsigned SWDTE : 1;
2669 unsigned : 1;
2670 unsigned : 1;
2671 unsigned : 1;
2672 unsigned : 1;
2673 unsigned : 1;
2674 unsigned : 1;
2675 unsigned : 1;
2677 } __WDTCONbits_t;
2679 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2681 #define _SWDTEN 0x01
2682 #define _SWDTE 0x01
2684 //==============================================================================
2687 //==============================================================================
2688 // OSCCON2 Bits
2690 extern __at(0x0FD2) __sfr OSCCON2;
2692 typedef struct
2694 unsigned LFIOFS : 1;
2695 unsigned HFIOFL : 1;
2696 unsigned PRI_SD : 1;
2697 unsigned : 1;
2698 unsigned : 1;
2699 unsigned : 1;
2700 unsigned : 1;
2701 unsigned : 1;
2702 } __OSCCON2bits_t;
2704 extern __at(0x0FD2) volatile __OSCCON2bits_t OSCCON2bits;
2706 #define _LFIOFS 0x01
2707 #define _HFIOFL 0x02
2708 #define _PRI_SD 0x04
2710 //==============================================================================
2713 //==============================================================================
2714 // OSCCON Bits
2716 extern __at(0x0FD3) __sfr OSCCON;
2718 typedef union
2720 struct
2722 unsigned SCS0 : 1;
2723 unsigned SCS1 : 1;
2724 unsigned HFIOFS : 1;
2725 unsigned OSTS : 1;
2726 unsigned IRCF0 : 1;
2727 unsigned IRCF1 : 1;
2728 unsigned IRCF2 : 1;
2729 unsigned IDLEN : 1;
2732 struct
2734 unsigned : 1;
2735 unsigned : 1;
2736 unsigned FLTS : 1;
2737 unsigned : 1;
2738 unsigned : 1;
2739 unsigned : 1;
2740 unsigned : 1;
2741 unsigned : 1;
2744 struct
2746 unsigned SCS : 2;
2747 unsigned : 6;
2750 struct
2752 unsigned : 4;
2753 unsigned IRCF : 3;
2754 unsigned : 1;
2756 } __OSCCONbits_t;
2758 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2760 #define _SCS0 0x01
2761 #define _SCS1 0x02
2762 #define _HFIOFS 0x04
2763 #define _FLTS 0x04
2764 #define _OSTS 0x08
2765 #define _IRCF0 0x10
2766 #define _IRCF1 0x20
2767 #define _IRCF2 0x40
2768 #define _IDLEN 0x80
2770 //==============================================================================
2773 //==============================================================================
2774 // T0CON Bits
2776 extern __at(0x0FD5) __sfr T0CON;
2778 typedef union
2780 struct
2782 unsigned T0PS0 : 1;
2783 unsigned T0PS1 : 1;
2784 unsigned T0PS2 : 1;
2785 unsigned PSA : 1;
2786 unsigned T0SE : 1;
2787 unsigned T0CS : 1;
2788 unsigned T08BIT : 1;
2789 unsigned TMR0ON : 1;
2792 struct
2794 unsigned T0PS : 3;
2795 unsigned : 5;
2797 } __T0CONbits_t;
2799 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2801 #define _T0PS0 0x01
2802 #define _T0PS1 0x02
2803 #define _T0PS2 0x04
2804 #define _PSA 0x08
2805 #define _T0SE 0x10
2806 #define _T0CS 0x20
2807 #define _T08BIT 0x40
2808 #define _TMR0ON 0x80
2810 //==============================================================================
2812 extern __at(0x0FD6) __sfr TMR0;
2813 extern __at(0x0FD6) __sfr TMR0L;
2814 extern __at(0x0FD7) __sfr TMR0H;
2816 //==============================================================================
2817 // STATUS Bits
2819 extern __at(0x0FD8) __sfr STATUS;
2821 typedef struct
2823 unsigned C : 1;
2824 unsigned DC : 1;
2825 unsigned Z : 1;
2826 unsigned OV : 1;
2827 unsigned N : 1;
2828 unsigned : 1;
2829 unsigned : 1;
2830 unsigned : 1;
2831 } __STATUSbits_t;
2833 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2835 #define _C 0x01
2836 #define _DC 0x02
2837 #define _Z 0x04
2838 #define _OV 0x08
2839 #define _N 0x10
2841 //==============================================================================
2843 extern __at(0x0FD9) __sfr FSR2L;
2844 extern __at(0x0FDA) __sfr FSR2H;
2845 extern __at(0x0FDB) __sfr PLUSW2;
2846 extern __at(0x0FDC) __sfr PREINC2;
2847 extern __at(0x0FDD) __sfr POSTDEC2;
2848 extern __at(0x0FDE) __sfr POSTINC2;
2849 extern __at(0x0FDF) __sfr INDF2;
2850 extern __at(0x0FE0) __sfr BSR;
2851 extern __at(0x0FE1) __sfr FSR1L;
2852 extern __at(0x0FE2) __sfr FSR1H;
2853 extern __at(0x0FE3) __sfr PLUSW1;
2854 extern __at(0x0FE4) __sfr PREINC1;
2855 extern __at(0x0FE5) __sfr POSTDEC1;
2856 extern __at(0x0FE6) __sfr POSTINC1;
2857 extern __at(0x0FE7) __sfr INDF1;
2858 extern __at(0x0FE8) __sfr WREG;
2859 extern __at(0x0FE9) __sfr FSR0L;
2860 extern __at(0x0FEA) __sfr FSR0H;
2861 extern __at(0x0FEB) __sfr PLUSW0;
2862 extern __at(0x0FEC) __sfr PREINC0;
2863 extern __at(0x0FED) __sfr POSTDEC0;
2864 extern __at(0x0FEE) __sfr POSTINC0;
2865 extern __at(0x0FEF) __sfr INDF0;
2867 //==============================================================================
2868 // INTCON3 Bits
2870 extern __at(0x0FF0) __sfr INTCON3;
2872 typedef union
2874 struct
2876 unsigned INT1IF : 1;
2877 unsigned INT2IF : 1;
2878 unsigned : 1;
2879 unsigned INT1IE : 1;
2880 unsigned INT2IE : 1;
2881 unsigned : 1;
2882 unsigned INT1IP : 1;
2883 unsigned INT2IP : 1;
2886 struct
2888 unsigned INT1F : 1;
2889 unsigned INT2F : 1;
2890 unsigned : 1;
2891 unsigned INT1E : 1;
2892 unsigned INT2E : 1;
2893 unsigned : 1;
2894 unsigned INT1P : 1;
2895 unsigned INT2P : 1;
2897 } __INTCON3bits_t;
2899 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2901 #define _INT1IF 0x01
2902 #define _INT1F 0x01
2903 #define _INT2IF 0x02
2904 #define _INT2F 0x02
2905 #define _INT1IE 0x08
2906 #define _INT1E 0x08
2907 #define _INT2IE 0x10
2908 #define _INT2E 0x10
2909 #define _INT1IP 0x40
2910 #define _INT1P 0x40
2911 #define _INT2IP 0x80
2912 #define _INT2P 0x80
2914 //==============================================================================
2917 //==============================================================================
2918 // INTCON2 Bits
2920 extern __at(0x0FF1) __sfr INTCON2;
2922 typedef union
2924 struct
2926 unsigned RABIP : 1;
2927 unsigned : 1;
2928 unsigned TMR0IP : 1;
2929 unsigned : 1;
2930 unsigned INTEDG2 : 1;
2931 unsigned INTEDG1 : 1;
2932 unsigned INTEDG0 : 1;
2933 unsigned NOT_RABPU : 1;
2936 struct
2938 unsigned RBIP : 1;
2939 unsigned : 1;
2940 unsigned : 1;
2941 unsigned : 1;
2942 unsigned : 1;
2943 unsigned : 1;
2944 unsigned : 1;
2945 unsigned RABPU : 1;
2948 struct
2950 unsigned : 1;
2951 unsigned : 1;
2952 unsigned : 1;
2953 unsigned : 1;
2954 unsigned : 1;
2955 unsigned : 1;
2956 unsigned : 1;
2957 unsigned NOT_RBPU : 1;
2959 } __INTCON2bits_t;
2961 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2963 #define _RABIP 0x01
2964 #define _RBIP 0x01
2965 #define _TMR0IP 0x04
2966 #define _INTEDG2 0x10
2967 #define _INTEDG1 0x20
2968 #define _INTEDG0 0x40
2969 #define _NOT_RABPU 0x80
2970 #define _RABPU 0x80
2971 #define _NOT_RBPU 0x80
2973 //==============================================================================
2976 //==============================================================================
2977 // INTCON Bits
2979 extern __at(0x0FF2) __sfr INTCON;
2981 typedef union
2983 struct
2985 unsigned RABIF : 1;
2986 unsigned INT0IF : 1;
2987 unsigned TMR0IF : 1;
2988 unsigned RABIE : 1;
2989 unsigned INT0IE : 1;
2990 unsigned TMR0IE : 1;
2991 unsigned PEIE_GIEL : 1;
2992 unsigned GIE_GIEH : 1;
2995 struct
2997 unsigned RBIF : 1;
2998 unsigned INT0F : 1;
2999 unsigned T0IF : 1;
3000 unsigned RBIE : 1;
3001 unsigned INT0E : 1;
3002 unsigned T0IE : 1;
3003 unsigned PEIE : 1;
3004 unsigned GIE : 1;
3007 struct
3009 unsigned : 1;
3010 unsigned : 1;
3011 unsigned : 1;
3012 unsigned : 1;
3013 unsigned : 1;
3014 unsigned : 1;
3015 unsigned GIEL : 1;
3016 unsigned GIEH : 1;
3019 struct
3021 unsigned : 1;
3022 unsigned : 1;
3023 unsigned : 1;
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned : 1;
3027 unsigned PIE : 1;
3028 unsigned : 1;
3030 } __INTCONbits_t;
3032 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3034 #define _RABIF 0x01
3035 #define _RBIF 0x01
3036 #define _INT0IF 0x02
3037 #define _INT0F 0x02
3038 #define _TMR0IF 0x04
3039 #define _T0IF 0x04
3040 #define _RABIE 0x08
3041 #define _RBIE 0x08
3042 #define _INT0IE 0x10
3043 #define _INT0E 0x10
3044 #define _TMR0IE 0x20
3045 #define _T0IE 0x20
3046 #define _PEIE_GIEL 0x40
3047 #define _PEIE 0x40
3048 #define _GIEL 0x40
3049 #define _PIE 0x40
3050 #define _GIE_GIEH 0x80
3051 #define _GIE 0x80
3052 #define _GIEH 0x80
3054 //==============================================================================
3056 extern __at(0x0FF3) __sfr PROD;
3057 extern __at(0x0FF3) __sfr PRODL;
3058 extern __at(0x0FF4) __sfr PRODH;
3059 extern __at(0x0FF5) __sfr TABLAT;
3060 extern __at(0x0FF6) __sfr TBLPTR;
3061 extern __at(0x0FF6) __sfr TBLPTRL;
3062 extern __at(0x0FF7) __sfr TBLPTRH;
3063 extern __at(0x0FF8) __sfr TBLPTRU;
3064 extern __at(0x0FF9) __sfr PC;
3065 extern __at(0x0FF9) __sfr PCL;
3066 extern __at(0x0FFA) __sfr PCLATH;
3067 extern __at(0x0FFB) __sfr PCLATU;
3069 //==============================================================================
3070 // STKPTR Bits
3072 extern __at(0x0FFC) __sfr STKPTR;
3074 typedef union
3076 struct
3078 unsigned SP0 : 1;
3079 unsigned SP1 : 1;
3080 unsigned SP2 : 1;
3081 unsigned SP3 : 1;
3082 unsigned SP4 : 1;
3083 unsigned : 1;
3084 unsigned STKUNF : 1;
3085 unsigned STKOVF : 1;
3088 struct
3090 unsigned : 1;
3091 unsigned : 1;
3092 unsigned : 1;
3093 unsigned : 1;
3094 unsigned : 1;
3095 unsigned : 1;
3096 unsigned : 1;
3097 unsigned STKFUL : 1;
3100 struct
3102 unsigned SP : 5;
3103 unsigned : 3;
3105 } __STKPTRbits_t;
3107 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3109 #define _SP0 0x01
3110 #define _SP1 0x02
3111 #define _SP2 0x04
3112 #define _SP3 0x08
3113 #define _SP4 0x10
3114 #define _STKUNF 0x40
3115 #define _STKOVF 0x80
3116 #define _STKFUL 0x80
3118 //==============================================================================
3120 extern __at(0x0FFD) __sfr TOS;
3121 extern __at(0x0FFD) __sfr TOSL;
3122 extern __at(0x0FFE) __sfr TOSH;
3123 extern __at(0x0FFF) __sfr TOSU;
3125 //==============================================================================
3127 // Configuration Bits
3129 //==============================================================================
3131 #define __CONFIG1H 0x300001
3132 #define __CONFIG2L 0x300002
3133 #define __CONFIG2H 0x300003
3134 #define __CONFIG3H 0x300005
3135 #define __CONFIG4L 0x300006
3136 #define __CONFIG5L 0x300008
3137 #define __CONFIG5H 0x300009
3138 #define __CONFIG6L 0x30000A
3139 #define __CONFIG6H 0x30000B
3140 #define __CONFIG7L 0x30000C
3141 #define __CONFIG7H 0x30000D
3143 //----------------------------- CONFIG1H Options -------------------------------
3145 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3146 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3147 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3148 #define _FOSC_ERCCLKOUT_1H 0xF3 // External RC oscillator, CLKOUT function on OSC2.
3149 #define _FOSC_ECCLKOUTH_1H 0xF4 // EC, CLKOUT function on OSC2 (high).
3150 #define _FOSC_ECH_1H 0xF5 // EC (high).
3151 #define _FOSC_ERC_1H 0xF7 // External RC oscillator.
3152 #define _FOSC_IRC_1H 0xF8 // Internal RC oscillator.
3153 #define _FOSC_IRCCLKOUT_1H 0xF9 // Internal RC oscillator, CLKOUT function on OSC2.
3154 #define _FOSC_ECCLKOUTM_1H 0xFA // EC, CLKOUT function on OSC2 (medium).
3155 #define _FOSC_ECM_1H 0xFB // EC (medium).
3156 #define _FOSC_ECCLKOUTL_1H 0xFC // EC, CLKOUT function on OSC2 (low).
3157 #define _FOSC_ECL_1H 0xFD // EC (low).
3158 #define _PLLEN_OFF_1H 0xEF // PLL is under software control.
3159 #define _PLLEN_ON_1H 0xFF // Oscillator multiplied by 4.
3160 #define _PCLKEN_OFF_1H 0xDF // Primary clock is under software control.
3161 #define _PCLKEN_ON_1H 0xFF // Primary clock enabled.
3162 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3163 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3164 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3165 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3167 //----------------------------- CONFIG2L Options -------------------------------
3169 #define _PWRTEN_ON_2L 0xFE // PWRT enabled.
3170 #define _PWRTEN_OFF_2L 0xFF // PWRT disabled.
3171 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3172 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3173 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3174 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3175 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3176 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3177 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3178 #define _BORV_19_2L 0xFF // VBOR set to 1.9 V nominal.
3180 //----------------------------- CONFIG2H Options -------------------------------
3182 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3183 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3184 #define _WDTPS_1_2H 0xE1 // 1:1.
3185 #define _WDTPS_2_2H 0xE3 // 1:2.
3186 #define _WDTPS_4_2H 0xE5 // 1:4.
3187 #define _WDTPS_8_2H 0xE7 // 1:8.
3188 #define _WDTPS_16_2H 0xE9 // 1:16.
3189 #define _WDTPS_32_2H 0xEB // 1:32.
3190 #define _WDTPS_64_2H 0xED // 1:64.
3191 #define _WDTPS_128_2H 0xEF // 1:128.
3192 #define _WDTPS_256_2H 0xF1 // 1:256.
3193 #define _WDTPS_512_2H 0xF3 // 1:512.
3194 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3195 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3196 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3197 #define _WDTPS_8192_2H 0xFB // 1:8192.
3198 #define _WDTPS_16384_2H 0xFD // 1:16384.
3199 #define _WDTPS_32768_2H 0xFF // 1:32768.
3201 //----------------------------- CONFIG3H Options -------------------------------
3203 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3204 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3205 #define _MCLRE_OFF_3H 0x7F // RA3 input pin enabled; MCLR disabled.
3206 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA3 input pin disabled.
3208 //----------------------------- CONFIG4L Options -------------------------------
3210 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3211 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3212 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3213 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3214 #define _BBSIZ_OFF_4L 0xF7 // 512W boot block size.
3215 #define _BBSIZ_ON_4L 0xFF // 1kW boot block size.
3216 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3217 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3218 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RA0 and RA1 are dedicated to In-Circuit Debug.
3219 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins.
3221 //----------------------------- CONFIG5L Options -------------------------------
3223 #define _CP0_ON_5L 0xFE // Block 0 code-protected.
3224 #define _CP0_OFF_5L 0xFF // Block 0 not code-protected.
3225 #define _CP1_ON_5L 0xFD // Block 1 code-protected.
3226 #define _CP1_OFF_5L 0xFF // Block 1 not code-protected.
3228 //----------------------------- CONFIG5H Options -------------------------------
3230 #define _CPB_ON_5H 0xBF // Boot block code-protected.
3231 #define _CPB_OFF_5H 0xFF // Boot block not code-protected.
3232 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3233 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3235 //----------------------------- CONFIG6L Options -------------------------------
3237 #define _WRT0_ON_6L 0xFE // Block 0 write-protected.
3238 #define _WRT0_OFF_6L 0xFF // Block 0 not write-protected.
3239 #define _WRT1_ON_6L 0xFD // Block 1 write-protected.
3240 #define _WRT1_OFF_6L 0xFF // Block 1 not write-protected.
3242 //----------------------------- CONFIG6H Options -------------------------------
3244 #define _WRTC_ON_6H 0xDF // Configuration registers write-protected.
3245 #define _WRTC_OFF_6H 0xFF // Configuration registers not write-protected.
3246 #define _WRTB_ON_6H 0xBF // Boot block write-protected.
3247 #define _WRTB_OFF_6H 0xFF // Boot block not write-protected.
3248 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3249 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3251 //----------------------------- CONFIG7L Options -------------------------------
3253 #define _EBTR0_ON_7L 0xFE // Block 0 protected from table reads executed in other blocks.
3254 #define _EBTR0_OFF_7L 0xFF // Block 0 not protected from table reads executed in other blocks.
3255 #define _EBTR1_ON_7L 0xFD // Block 1 protected from table reads executed in other blocks.
3256 #define _EBTR1_OFF_7L 0xFF // Block 1 not protected from table reads executed in other blocks.
3258 //----------------------------- CONFIG7H Options -------------------------------
3260 #define _EBTRB_ON_7H 0xBF // Boot block protected from table reads executed in other blocks.
3261 #define _EBTRB_OFF_7H 0xFF // Boot block not protected from table reads executed in other blocks.
3263 //==============================================================================
3265 #define __DEVID1 0x3FFFFE
3266 #define __DEVID2 0x3FFFFF
3268 #define __IDLOC0 0x200000
3269 #define __IDLOC1 0x200001
3270 #define __IDLOC2 0x200002
3271 #define __IDLOC3 0x200003
3272 #define __IDLOC4 0x200004
3273 #define __IDLOC5 0x200005
3274 #define __IDLOC6 0x200006
3275 #define __IDLOC7 0x200007
3277 #endif // #ifndef __PIC18LF13K22_H__