struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf4620.h
blob0f4a22fc6aaaa48b538d57a59a042d7c6948a4da
1 /*
2 * This declarations of the PIC18LF4620 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:24:05 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 __PIC18LF4620_H__
26 #define __PIC18LF4620_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // PORTA Bits
40 extern __at(0x0F80) __sfr PORTA;
42 typedef union
44 struct
46 unsigned RA0 : 1;
47 unsigned RA1 : 1;
48 unsigned RA2 : 1;
49 unsigned RA3 : 1;
50 unsigned RA4 : 1;
51 unsigned RA5 : 1;
52 unsigned RA6 : 1;
53 unsigned RA7 : 1;
56 struct
58 unsigned : 1;
59 unsigned : 1;
60 unsigned : 1;
61 unsigned : 1;
62 unsigned T0CKI : 1;
63 unsigned AN4 : 1;
64 unsigned : 1;
65 unsigned : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned : 1;
73 unsigned : 1;
74 unsigned : 1;
75 unsigned SS : 1;
76 unsigned : 1;
77 unsigned : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned NOT_SS : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned : 1;
95 unsigned : 1;
96 unsigned : 1;
97 unsigned : 1;
98 unsigned : 1;
99 unsigned LVDIN : 1;
100 unsigned : 1;
101 unsigned : 1;
104 struct
106 unsigned : 1;
107 unsigned : 1;
108 unsigned : 1;
109 unsigned : 1;
110 unsigned : 1;
111 unsigned HLVDIN : 1;
112 unsigned : 1;
113 unsigned : 1;
115 } __PORTAbits_t;
117 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
119 #define _PORTA_RA0 0x01
120 #define _PORTA_RA1 0x02
121 #define _PORTA_RA2 0x04
122 #define _PORTA_RA3 0x08
123 #define _PORTA_RA4 0x10
124 #define _PORTA_T0CKI 0x10
125 #define _PORTA_RA5 0x20
126 #define _PORTA_AN4 0x20
127 #define _PORTA_SS 0x20
128 #define _PORTA_NOT_SS 0x20
129 #define _PORTA_LVDIN 0x20
130 #define _PORTA_HLVDIN 0x20
131 #define _PORTA_RA6 0x40
132 #define _PORTA_RA7 0x80
134 //==============================================================================
137 //==============================================================================
138 // PORTB Bits
140 extern __at(0x0F81) __sfr PORTB;
142 typedef union
144 struct
146 unsigned RB0 : 1;
147 unsigned RB1 : 1;
148 unsigned RB2 : 1;
149 unsigned RB3 : 1;
150 unsigned RB4 : 1;
151 unsigned RB5 : 1;
152 unsigned RB6 : 1;
153 unsigned RB7 : 1;
156 struct
158 unsigned INT0 : 1;
159 unsigned INT1 : 1;
160 unsigned INT2 : 1;
161 unsigned CCP2 : 1;
162 unsigned KBI0 : 1;
163 unsigned KBI1 : 1;
164 unsigned KBI2 : 1;
165 unsigned KBI3 : 1;
168 struct
170 unsigned AN12 : 1;
171 unsigned AN10 : 1;
172 unsigned AN8 : 1;
173 unsigned AN9 : 1;
174 unsigned AN11 : 1;
175 unsigned PGM : 1;
176 unsigned PGC : 1;
177 unsigned PGD : 1;
180 struct
182 unsigned INT : 3;
183 unsigned : 5;
186 struct
188 unsigned : 4;
189 unsigned KBI : 4;
191 } __PORTBbits_t;
193 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
195 #define _PORTB_RB0 0x01
196 #define _PORTB_INT0 0x01
197 #define _PORTB_AN12 0x01
198 #define _PORTB_RB1 0x02
199 #define _PORTB_INT1 0x02
200 #define _PORTB_AN10 0x02
201 #define _PORTB_RB2 0x04
202 #define _PORTB_INT2 0x04
203 #define _PORTB_AN8 0x04
204 #define _PORTB_RB3 0x08
205 #define _PORTB_CCP2 0x08
206 #define _PORTB_AN9 0x08
207 #define _PORTB_RB4 0x10
208 #define _PORTB_KBI0 0x10
209 #define _PORTB_AN11 0x10
210 #define _PORTB_RB5 0x20
211 #define _PORTB_KBI1 0x20
212 #define _PORTB_PGM 0x20
213 #define _PORTB_RB6 0x40
214 #define _PORTB_KBI2 0x40
215 #define _PORTB_PGC 0x40
216 #define _PORTB_RB7 0x80
217 #define _PORTB_KBI3 0x80
218 #define _PORTB_PGD 0x80
220 //==============================================================================
223 //==============================================================================
224 // PORTC Bits
226 extern __at(0x0F82) __sfr PORTC;
228 typedef union
230 struct
232 unsigned RC0 : 1;
233 unsigned RC1 : 1;
234 unsigned RC2 : 1;
235 unsigned RC3 : 1;
236 unsigned RC4 : 1;
237 unsigned RC5 : 1;
238 unsigned RC6 : 1;
239 unsigned RC7 : 1;
242 struct
244 unsigned T1OSO : 1;
245 unsigned T1OSI : 1;
246 unsigned CCP1 : 1;
247 unsigned SCK : 1;
248 unsigned SDI : 1;
249 unsigned SDO : 1;
250 unsigned TX : 1;
251 unsigned RX : 1;
254 struct
256 unsigned T13CKI : 1;
257 unsigned CCP2 : 1;
258 unsigned : 1;
259 unsigned SCL : 1;
260 unsigned SDA : 1;
261 unsigned : 1;
262 unsigned CK : 1;
263 unsigned : 1;
266 struct
268 unsigned T1CKI : 1;
269 unsigned : 1;
270 unsigned : 1;
271 unsigned : 1;
272 unsigned : 1;
273 unsigned : 1;
274 unsigned : 1;
275 unsigned : 1;
277 } __PORTCbits_t;
279 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
281 #define _PORTC_RC0 0x01
282 #define _PORTC_T1OSO 0x01
283 #define _PORTC_T13CKI 0x01
284 #define _PORTC_T1CKI 0x01
285 #define _PORTC_RC1 0x02
286 #define _PORTC_T1OSI 0x02
287 #define _PORTC_CCP2 0x02
288 #define _PORTC_RC2 0x04
289 #define _PORTC_CCP1 0x04
290 #define _PORTC_RC3 0x08
291 #define _PORTC_SCK 0x08
292 #define _PORTC_SCL 0x08
293 #define _PORTC_RC4 0x10
294 #define _PORTC_SDI 0x10
295 #define _PORTC_SDA 0x10
296 #define _PORTC_RC5 0x20
297 #define _PORTC_SDO 0x20
298 #define _PORTC_RC6 0x40
299 #define _PORTC_TX 0x40
300 #define _PORTC_CK 0x40
301 #define _PORTC_RC7 0x80
302 #define _PORTC_RX 0x80
304 //==============================================================================
307 //==============================================================================
308 // PORTD Bits
310 extern __at(0x0F83) __sfr PORTD;
312 typedef union
314 struct
316 unsigned RD0 : 1;
317 unsigned RD1 : 1;
318 unsigned RD2 : 1;
319 unsigned RD3 : 1;
320 unsigned RD4 : 1;
321 unsigned RD5 : 1;
322 unsigned RD6 : 1;
323 unsigned RD7 : 1;
326 struct
328 unsigned PSP0 : 1;
329 unsigned PSP1 : 1;
330 unsigned PSP2 : 1;
331 unsigned PSP3 : 1;
332 unsigned PSP4 : 1;
333 unsigned PSP5 : 1;
334 unsigned PSP6 : 1;
335 unsigned PSP7 : 1;
338 struct
340 unsigned : 1;
341 unsigned : 1;
342 unsigned : 1;
343 unsigned : 1;
344 unsigned : 1;
345 unsigned P1B : 1;
346 unsigned P1C : 1;
347 unsigned P1D : 1;
349 } __PORTDbits_t;
351 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
353 #define _PORTD_RD0 0x01
354 #define _PORTD_PSP0 0x01
355 #define _PORTD_RD1 0x02
356 #define _PORTD_PSP1 0x02
357 #define _PORTD_RD2 0x04
358 #define _PORTD_PSP2 0x04
359 #define _PORTD_RD3 0x08
360 #define _PORTD_PSP3 0x08
361 #define _PORTD_RD4 0x10
362 #define _PORTD_PSP4 0x10
363 #define _PORTD_RD5 0x20
364 #define _PORTD_PSP5 0x20
365 #define _PORTD_P1B 0x20
366 #define _PORTD_RD6 0x40
367 #define _PORTD_PSP6 0x40
368 #define _PORTD_P1C 0x40
369 #define _PORTD_RD7 0x80
370 #define _PORTD_PSP7 0x80
371 #define _PORTD_P1D 0x80
373 //==============================================================================
376 //==============================================================================
377 // PORTE Bits
379 extern __at(0x0F84) __sfr PORTE;
381 typedef union
383 struct
385 unsigned RE0 : 1;
386 unsigned RE1 : 1;
387 unsigned RE2 : 1;
388 unsigned RE3 : 1;
389 unsigned : 1;
390 unsigned : 1;
391 unsigned : 1;
392 unsigned : 1;
395 struct
397 unsigned RD : 1;
398 unsigned WR : 1;
399 unsigned CS : 1;
400 unsigned MCLR : 1;
401 unsigned : 1;
402 unsigned : 1;
403 unsigned : 1;
404 unsigned : 1;
407 struct
409 unsigned NOT_RD : 1;
410 unsigned NOT_WR : 1;
411 unsigned NOT_CS : 1;
412 unsigned NOT_MCLR : 1;
413 unsigned : 1;
414 unsigned : 1;
415 unsigned : 1;
416 unsigned : 1;
419 struct
421 unsigned AN5 : 1;
422 unsigned AN6 : 1;
423 unsigned AN7 : 1;
424 unsigned VPP : 1;
425 unsigned : 1;
426 unsigned : 1;
427 unsigned : 1;
428 unsigned : 1;
431 struct
433 unsigned RE : 4;
434 unsigned : 4;
436 } __PORTEbits_t;
438 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
440 #define _PORTE_RE0 0x01
441 #define _PORTE_RD 0x01
442 #define _PORTE_NOT_RD 0x01
443 #define _PORTE_AN5 0x01
444 #define _PORTE_RE1 0x02
445 #define _PORTE_WR 0x02
446 #define _PORTE_NOT_WR 0x02
447 #define _PORTE_AN6 0x02
448 #define _PORTE_RE2 0x04
449 #define _PORTE_CS 0x04
450 #define _PORTE_NOT_CS 0x04
451 #define _PORTE_AN7 0x04
452 #define _PORTE_RE3 0x08
453 #define _PORTE_MCLR 0x08
454 #define _PORTE_NOT_MCLR 0x08
455 #define _PORTE_VPP 0x08
457 //==============================================================================
460 //==============================================================================
461 // LATA Bits
463 extern __at(0x0F89) __sfr LATA;
465 typedef struct
467 unsigned LATA0 : 1;
468 unsigned LATA1 : 1;
469 unsigned LATA2 : 1;
470 unsigned LATA3 : 1;
471 unsigned LATA4 : 1;
472 unsigned LATA5 : 1;
473 unsigned LATA6 : 1;
474 unsigned LATA7 : 1;
475 } __LATAbits_t;
477 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
479 #define _LATA0 0x01
480 #define _LATA1 0x02
481 #define _LATA2 0x04
482 #define _LATA3 0x08
483 #define _LATA4 0x10
484 #define _LATA5 0x20
485 #define _LATA6 0x40
486 #define _LATA7 0x80
488 //==============================================================================
491 //==============================================================================
492 // LATB Bits
494 extern __at(0x0F8A) __sfr LATB;
496 typedef struct
498 unsigned LATB0 : 1;
499 unsigned LATB1 : 1;
500 unsigned LATB2 : 1;
501 unsigned LATB3 : 1;
502 unsigned LATB4 : 1;
503 unsigned LATB5 : 1;
504 unsigned LATB6 : 1;
505 unsigned LATB7 : 1;
506 } __LATBbits_t;
508 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
510 #define _LATB0 0x01
511 #define _LATB1 0x02
512 #define _LATB2 0x04
513 #define _LATB3 0x08
514 #define _LATB4 0x10
515 #define _LATB5 0x20
516 #define _LATB6 0x40
517 #define _LATB7 0x80
519 //==============================================================================
522 //==============================================================================
523 // LATC Bits
525 extern __at(0x0F8B) __sfr LATC;
527 typedef struct
529 unsigned LATC0 : 1;
530 unsigned LATC1 : 1;
531 unsigned LATC2 : 1;
532 unsigned LATC3 : 1;
533 unsigned LATC4 : 1;
534 unsigned LATC5 : 1;
535 unsigned LATC6 : 1;
536 unsigned LATC7 : 1;
537 } __LATCbits_t;
539 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
541 #define _LATC0 0x01
542 #define _LATC1 0x02
543 #define _LATC2 0x04
544 #define _LATC3 0x08
545 #define _LATC4 0x10
546 #define _LATC5 0x20
547 #define _LATC6 0x40
548 #define _LATC7 0x80
550 //==============================================================================
553 //==============================================================================
554 // LATD Bits
556 extern __at(0x0F8C) __sfr LATD;
558 typedef struct
560 unsigned LATD0 : 1;
561 unsigned LATD1 : 1;
562 unsigned LATD2 : 1;
563 unsigned LATD3 : 1;
564 unsigned LATD4 : 1;
565 unsigned LATD5 : 1;
566 unsigned LATD6 : 1;
567 unsigned LATD7 : 1;
568 } __LATDbits_t;
570 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
572 #define _LATD0 0x01
573 #define _LATD1 0x02
574 #define _LATD2 0x04
575 #define _LATD3 0x08
576 #define _LATD4 0x10
577 #define _LATD5 0x20
578 #define _LATD6 0x40
579 #define _LATD7 0x80
581 //==============================================================================
584 //==============================================================================
585 // LATE Bits
587 extern __at(0x0F8D) __sfr LATE;
589 typedef union
591 struct
593 unsigned LATE0 : 1;
594 unsigned LATE1 : 1;
595 unsigned LATE2 : 1;
596 unsigned : 1;
597 unsigned : 1;
598 unsigned : 1;
599 unsigned : 1;
600 unsigned : 1;
603 struct
605 unsigned LATE : 3;
606 unsigned : 5;
608 } __LATEbits_t;
610 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
612 #define _LATE0 0x01
613 #define _LATE1 0x02
614 #define _LATE2 0x04
616 //==============================================================================
619 //==============================================================================
620 // DDRA Bits
622 extern __at(0x0F92) __sfr DDRA;
624 typedef union
626 struct
628 unsigned TRISA0 : 1;
629 unsigned TRISA1 : 1;
630 unsigned TRISA2 : 1;
631 unsigned TRISA3 : 1;
632 unsigned TRISA4 : 1;
633 unsigned TRISA5 : 1;
634 unsigned TRISA6 : 1;
635 unsigned TRISA7 : 1;
638 struct
640 unsigned RA0 : 1;
641 unsigned RA1 : 1;
642 unsigned RA2 : 1;
643 unsigned RA3 : 1;
644 unsigned RA4 : 1;
645 unsigned RA5 : 1;
646 unsigned RA6 : 1;
647 unsigned RA7 : 1;
649 } __DDRAbits_t;
651 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
653 #define _TRISA0 0x01
654 #define _RA0 0x01
655 #define _TRISA1 0x02
656 #define _RA1 0x02
657 #define _TRISA2 0x04
658 #define _RA2 0x04
659 #define _TRISA3 0x08
660 #define _RA3 0x08
661 #define _TRISA4 0x10
662 #define _RA4 0x10
663 #define _TRISA5 0x20
664 #define _RA5 0x20
665 #define _TRISA6 0x40
666 #define _RA6 0x40
667 #define _TRISA7 0x80
668 #define _RA7 0x80
670 //==============================================================================
673 //==============================================================================
674 // TRISA Bits
676 extern __at(0x0F92) __sfr TRISA;
678 typedef union
680 struct
682 unsigned TRISA0 : 1;
683 unsigned TRISA1 : 1;
684 unsigned TRISA2 : 1;
685 unsigned TRISA3 : 1;
686 unsigned TRISA4 : 1;
687 unsigned TRISA5 : 1;
688 unsigned TRISA6 : 1;
689 unsigned TRISA7 : 1;
692 struct
694 unsigned RA0 : 1;
695 unsigned RA1 : 1;
696 unsigned RA2 : 1;
697 unsigned RA3 : 1;
698 unsigned RA4 : 1;
699 unsigned RA5 : 1;
700 unsigned RA6 : 1;
701 unsigned RA7 : 1;
703 } __TRISAbits_t;
705 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
707 #define _TRISA_TRISA0 0x01
708 #define _TRISA_RA0 0x01
709 #define _TRISA_TRISA1 0x02
710 #define _TRISA_RA1 0x02
711 #define _TRISA_TRISA2 0x04
712 #define _TRISA_RA2 0x04
713 #define _TRISA_TRISA3 0x08
714 #define _TRISA_RA3 0x08
715 #define _TRISA_TRISA4 0x10
716 #define _TRISA_RA4 0x10
717 #define _TRISA_TRISA5 0x20
718 #define _TRISA_RA5 0x20
719 #define _TRISA_TRISA6 0x40
720 #define _TRISA_RA6 0x40
721 #define _TRISA_TRISA7 0x80
722 #define _TRISA_RA7 0x80
724 //==============================================================================
727 //==============================================================================
728 // DDRB Bits
730 extern __at(0x0F93) __sfr DDRB;
732 typedef union
734 struct
736 unsigned TRISB0 : 1;
737 unsigned TRISB1 : 1;
738 unsigned TRISB2 : 1;
739 unsigned TRISB3 : 1;
740 unsigned TRISB4 : 1;
741 unsigned TRISB5 : 1;
742 unsigned TRISB6 : 1;
743 unsigned TRISB7 : 1;
746 struct
748 unsigned RB0 : 1;
749 unsigned RB1 : 1;
750 unsigned RB2 : 1;
751 unsigned RB3 : 1;
752 unsigned RB4 : 1;
753 unsigned RB5 : 1;
754 unsigned RB6 : 1;
755 unsigned RB7 : 1;
757 } __DDRBbits_t;
759 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
761 #define _TRISB0 0x01
762 #define _RB0 0x01
763 #define _TRISB1 0x02
764 #define _RB1 0x02
765 #define _TRISB2 0x04
766 #define _RB2 0x04
767 #define _TRISB3 0x08
768 #define _RB3 0x08
769 #define _TRISB4 0x10
770 #define _RB4 0x10
771 #define _TRISB5 0x20
772 #define _RB5 0x20
773 #define _TRISB6 0x40
774 #define _RB6 0x40
775 #define _TRISB7 0x80
776 #define _RB7 0x80
778 //==============================================================================
781 //==============================================================================
782 // TRISB Bits
784 extern __at(0x0F93) __sfr TRISB;
786 typedef union
788 struct
790 unsigned TRISB0 : 1;
791 unsigned TRISB1 : 1;
792 unsigned TRISB2 : 1;
793 unsigned TRISB3 : 1;
794 unsigned TRISB4 : 1;
795 unsigned TRISB5 : 1;
796 unsigned TRISB6 : 1;
797 unsigned TRISB7 : 1;
800 struct
802 unsigned RB0 : 1;
803 unsigned RB1 : 1;
804 unsigned RB2 : 1;
805 unsigned RB3 : 1;
806 unsigned RB4 : 1;
807 unsigned RB5 : 1;
808 unsigned RB6 : 1;
809 unsigned RB7 : 1;
811 } __TRISBbits_t;
813 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
815 #define _TRISB_TRISB0 0x01
816 #define _TRISB_RB0 0x01
817 #define _TRISB_TRISB1 0x02
818 #define _TRISB_RB1 0x02
819 #define _TRISB_TRISB2 0x04
820 #define _TRISB_RB2 0x04
821 #define _TRISB_TRISB3 0x08
822 #define _TRISB_RB3 0x08
823 #define _TRISB_TRISB4 0x10
824 #define _TRISB_RB4 0x10
825 #define _TRISB_TRISB5 0x20
826 #define _TRISB_RB5 0x20
827 #define _TRISB_TRISB6 0x40
828 #define _TRISB_RB6 0x40
829 #define _TRISB_TRISB7 0x80
830 #define _TRISB_RB7 0x80
832 //==============================================================================
835 //==============================================================================
836 // DDRC Bits
838 extern __at(0x0F94) __sfr DDRC;
840 typedef union
842 struct
844 unsigned TRISC0 : 1;
845 unsigned TRISC1 : 1;
846 unsigned TRISC2 : 1;
847 unsigned TRISC3 : 1;
848 unsigned TRISC4 : 1;
849 unsigned TRISC5 : 1;
850 unsigned TRISC6 : 1;
851 unsigned TRISC7 : 1;
854 struct
856 unsigned RC0 : 1;
857 unsigned RC1 : 1;
858 unsigned RC2 : 1;
859 unsigned RC3 : 1;
860 unsigned RC4 : 1;
861 unsigned RC5 : 1;
862 unsigned RC6 : 1;
863 unsigned RC7 : 1;
865 } __DDRCbits_t;
867 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
869 #define _TRISC0 0x01
870 #define _RC0 0x01
871 #define _TRISC1 0x02
872 #define _RC1 0x02
873 #define _TRISC2 0x04
874 #define _RC2 0x04
875 #define _TRISC3 0x08
876 #define _RC3 0x08
877 #define _TRISC4 0x10
878 #define _RC4 0x10
879 #define _TRISC5 0x20
880 #define _RC5 0x20
881 #define _TRISC6 0x40
882 #define _RC6 0x40
883 #define _TRISC7 0x80
884 #define _RC7 0x80
886 //==============================================================================
889 //==============================================================================
890 // TRISC Bits
892 extern __at(0x0F94) __sfr TRISC;
894 typedef union
896 struct
898 unsigned TRISC0 : 1;
899 unsigned TRISC1 : 1;
900 unsigned TRISC2 : 1;
901 unsigned TRISC3 : 1;
902 unsigned TRISC4 : 1;
903 unsigned TRISC5 : 1;
904 unsigned TRISC6 : 1;
905 unsigned TRISC7 : 1;
908 struct
910 unsigned RC0 : 1;
911 unsigned RC1 : 1;
912 unsigned RC2 : 1;
913 unsigned RC3 : 1;
914 unsigned RC4 : 1;
915 unsigned RC5 : 1;
916 unsigned RC6 : 1;
917 unsigned RC7 : 1;
919 } __TRISCbits_t;
921 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
923 #define _TRISC_TRISC0 0x01
924 #define _TRISC_RC0 0x01
925 #define _TRISC_TRISC1 0x02
926 #define _TRISC_RC1 0x02
927 #define _TRISC_TRISC2 0x04
928 #define _TRISC_RC2 0x04
929 #define _TRISC_TRISC3 0x08
930 #define _TRISC_RC3 0x08
931 #define _TRISC_TRISC4 0x10
932 #define _TRISC_RC4 0x10
933 #define _TRISC_TRISC5 0x20
934 #define _TRISC_RC5 0x20
935 #define _TRISC_TRISC6 0x40
936 #define _TRISC_RC6 0x40
937 #define _TRISC_TRISC7 0x80
938 #define _TRISC_RC7 0x80
940 //==============================================================================
943 //==============================================================================
944 // DDRD Bits
946 extern __at(0x0F95) __sfr DDRD;
948 typedef union
950 struct
952 unsigned TRISD0 : 1;
953 unsigned TRISD1 : 1;
954 unsigned TRISD2 : 1;
955 unsigned TRISD3 : 1;
956 unsigned TRISD4 : 1;
957 unsigned TRISD5 : 1;
958 unsigned TRISD6 : 1;
959 unsigned TRISD7 : 1;
962 struct
964 unsigned RD0 : 1;
965 unsigned RD1 : 1;
966 unsigned RD2 : 1;
967 unsigned RD3 : 1;
968 unsigned RD4 : 1;
969 unsigned RD5 : 1;
970 unsigned RD6 : 1;
971 unsigned RD7 : 1;
973 } __DDRDbits_t;
975 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
977 #define _TRISD0 0x01
978 #define _RD0 0x01
979 #define _TRISD1 0x02
980 #define _RD1 0x02
981 #define _TRISD2 0x04
982 #define _RD2 0x04
983 #define _TRISD3 0x08
984 #define _RD3 0x08
985 #define _TRISD4 0x10
986 #define _RD4 0x10
987 #define _TRISD5 0x20
988 #define _RD5 0x20
989 #define _TRISD6 0x40
990 #define _RD6 0x40
991 #define _TRISD7 0x80
992 #define _RD7 0x80
994 //==============================================================================
997 //==============================================================================
998 // TRISD Bits
1000 extern __at(0x0F95) __sfr TRISD;
1002 typedef union
1004 struct
1006 unsigned TRISD0 : 1;
1007 unsigned TRISD1 : 1;
1008 unsigned TRISD2 : 1;
1009 unsigned TRISD3 : 1;
1010 unsigned TRISD4 : 1;
1011 unsigned TRISD5 : 1;
1012 unsigned TRISD6 : 1;
1013 unsigned TRISD7 : 1;
1016 struct
1018 unsigned RD0 : 1;
1019 unsigned RD1 : 1;
1020 unsigned RD2 : 1;
1021 unsigned RD3 : 1;
1022 unsigned RD4 : 1;
1023 unsigned RD5 : 1;
1024 unsigned RD6 : 1;
1025 unsigned RD7 : 1;
1027 } __TRISDbits_t;
1029 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
1031 #define _TRISD_TRISD0 0x01
1032 #define _TRISD_RD0 0x01
1033 #define _TRISD_TRISD1 0x02
1034 #define _TRISD_RD1 0x02
1035 #define _TRISD_TRISD2 0x04
1036 #define _TRISD_RD2 0x04
1037 #define _TRISD_TRISD3 0x08
1038 #define _TRISD_RD3 0x08
1039 #define _TRISD_TRISD4 0x10
1040 #define _TRISD_RD4 0x10
1041 #define _TRISD_TRISD5 0x20
1042 #define _TRISD_RD5 0x20
1043 #define _TRISD_TRISD6 0x40
1044 #define _TRISD_RD6 0x40
1045 #define _TRISD_TRISD7 0x80
1046 #define _TRISD_RD7 0x80
1048 //==============================================================================
1051 //==============================================================================
1052 // DDRE Bits
1054 extern __at(0x0F96) __sfr DDRE;
1056 typedef union
1058 struct
1060 unsigned TRISE0 : 1;
1061 unsigned TRISE1 : 1;
1062 unsigned TRISE2 : 1;
1063 unsigned : 1;
1064 unsigned PSPMODE : 1;
1065 unsigned IBOV : 1;
1066 unsigned OBF : 1;
1067 unsigned IBF : 1;
1070 struct
1072 unsigned RE0 : 1;
1073 unsigned RE1 : 1;
1074 unsigned RE2 : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned : 1;
1078 unsigned : 1;
1079 unsigned : 1;
1082 struct
1084 unsigned TRISE : 3;
1085 unsigned : 5;
1088 struct
1090 unsigned RE : 3;
1091 unsigned : 5;
1093 } __DDREbits_t;
1095 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1097 #define _TRISE0 0x01
1098 #define _RE0 0x01
1099 #define _TRISE1 0x02
1100 #define _RE1 0x02
1101 #define _TRISE2 0x04
1102 #define _RE2 0x04
1103 #define _PSPMODE 0x10
1104 #define _IBOV 0x20
1105 #define _OBF 0x40
1106 #define _IBF 0x80
1108 //==============================================================================
1111 //==============================================================================
1112 // TRISE Bits
1114 extern __at(0x0F96) __sfr TRISE;
1116 typedef union
1118 struct
1120 unsigned TRISE0 : 1;
1121 unsigned TRISE1 : 1;
1122 unsigned TRISE2 : 1;
1123 unsigned : 1;
1124 unsigned PSPMODE : 1;
1125 unsigned IBOV : 1;
1126 unsigned OBF : 1;
1127 unsigned IBF : 1;
1130 struct
1132 unsigned RE0 : 1;
1133 unsigned RE1 : 1;
1134 unsigned RE2 : 1;
1135 unsigned : 1;
1136 unsigned : 1;
1137 unsigned : 1;
1138 unsigned : 1;
1139 unsigned : 1;
1142 struct
1144 unsigned TRISE : 3;
1145 unsigned : 5;
1148 struct
1150 unsigned RE : 3;
1151 unsigned : 5;
1153 } __TRISEbits_t;
1155 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1157 #define _TRISE_TRISE0 0x01
1158 #define _TRISE_RE0 0x01
1159 #define _TRISE_TRISE1 0x02
1160 #define _TRISE_RE1 0x02
1161 #define _TRISE_TRISE2 0x04
1162 #define _TRISE_RE2 0x04
1163 #define _TRISE_PSPMODE 0x10
1164 #define _TRISE_IBOV 0x20
1165 #define _TRISE_OBF 0x40
1166 #define _TRISE_IBF 0x80
1168 //==============================================================================
1171 //==============================================================================
1172 // OSCTUNE Bits
1174 extern __at(0x0F9B) __sfr OSCTUNE;
1176 typedef union
1178 struct
1180 unsigned TUN0 : 1;
1181 unsigned TUN1 : 1;
1182 unsigned TUN2 : 1;
1183 unsigned TUN3 : 1;
1184 unsigned TUN4 : 1;
1185 unsigned : 1;
1186 unsigned PLLEN : 1;
1187 unsigned INTSRC : 1;
1190 struct
1192 unsigned TUN : 5;
1193 unsigned : 3;
1195 } __OSCTUNEbits_t;
1197 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1199 #define _TUN0 0x01
1200 #define _TUN1 0x02
1201 #define _TUN2 0x04
1202 #define _TUN3 0x08
1203 #define _TUN4 0x10
1204 #define _PLLEN 0x40
1205 #define _INTSRC 0x80
1207 //==============================================================================
1210 //==============================================================================
1211 // PIE1 Bits
1213 extern __at(0x0F9D) __sfr PIE1;
1215 typedef struct
1217 unsigned TMR1IE : 1;
1218 unsigned TMR2IE : 1;
1219 unsigned CCP1IE : 1;
1220 unsigned SSPIE : 1;
1221 unsigned TXIE : 1;
1222 unsigned RCIE : 1;
1223 unsigned ADIE : 1;
1224 unsigned PSPIE : 1;
1225 } __PIE1bits_t;
1227 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1229 #define _TMR1IE 0x01
1230 #define _TMR2IE 0x02
1231 #define _CCP1IE 0x04
1232 #define _SSPIE 0x08
1233 #define _TXIE 0x10
1234 #define _RCIE 0x20
1235 #define _ADIE 0x40
1236 #define _PSPIE 0x80
1238 //==============================================================================
1241 //==============================================================================
1242 // PIR1 Bits
1244 extern __at(0x0F9E) __sfr PIR1;
1246 typedef struct
1248 unsigned TMR1IF : 1;
1249 unsigned TMR2IF : 1;
1250 unsigned CCP1IF : 1;
1251 unsigned SSPIF : 1;
1252 unsigned TXIF : 1;
1253 unsigned RCIF : 1;
1254 unsigned ADIF : 1;
1255 unsigned PSPIF : 1;
1256 } __PIR1bits_t;
1258 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1260 #define _TMR1IF 0x01
1261 #define _TMR2IF 0x02
1262 #define _CCP1IF 0x04
1263 #define _SSPIF 0x08
1264 #define _TXIF 0x10
1265 #define _RCIF 0x20
1266 #define _ADIF 0x40
1267 #define _PSPIF 0x80
1269 //==============================================================================
1272 //==============================================================================
1273 // IPR1 Bits
1275 extern __at(0x0F9F) __sfr IPR1;
1277 typedef struct
1279 unsigned TMR1IP : 1;
1280 unsigned TMR2IP : 1;
1281 unsigned CCP1IP : 1;
1282 unsigned SSPIP : 1;
1283 unsigned TXIP : 1;
1284 unsigned RCIP : 1;
1285 unsigned ADIP : 1;
1286 unsigned PSPIP : 1;
1287 } __IPR1bits_t;
1289 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1291 #define _TMR1IP 0x01
1292 #define _TMR2IP 0x02
1293 #define _CCP1IP 0x04
1294 #define _SSPIP 0x08
1295 #define _TXIP 0x10
1296 #define _RCIP 0x20
1297 #define _ADIP 0x40
1298 #define _PSPIP 0x80
1300 //==============================================================================
1303 //==============================================================================
1304 // PIE2 Bits
1306 extern __at(0x0FA0) __sfr PIE2;
1308 typedef union
1310 struct
1312 unsigned CCP2IE : 1;
1313 unsigned TMR3IE : 1;
1314 unsigned HLVDIE : 1;
1315 unsigned BCLIE : 1;
1316 unsigned EEIE : 1;
1317 unsigned : 1;
1318 unsigned CMIE : 1;
1319 unsigned OSCFIE : 1;
1322 struct
1324 unsigned : 1;
1325 unsigned : 1;
1326 unsigned LVDIE : 1;
1327 unsigned : 1;
1328 unsigned : 1;
1329 unsigned : 1;
1330 unsigned : 1;
1331 unsigned : 1;
1333 } __PIE2bits_t;
1335 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1337 #define _CCP2IE 0x01
1338 #define _TMR3IE 0x02
1339 #define _HLVDIE 0x04
1340 #define _LVDIE 0x04
1341 #define _BCLIE 0x08
1342 #define _EEIE 0x10
1343 #define _CMIE 0x40
1344 #define _OSCFIE 0x80
1346 //==============================================================================
1349 //==============================================================================
1350 // PIR2 Bits
1352 extern __at(0x0FA1) __sfr PIR2;
1354 typedef union
1356 struct
1358 unsigned CCP2IF : 1;
1359 unsigned TMR3IF : 1;
1360 unsigned HLVDIF : 1;
1361 unsigned BCLIF : 1;
1362 unsigned EEIF : 1;
1363 unsigned : 1;
1364 unsigned CMIF : 1;
1365 unsigned OSCFIF : 1;
1368 struct
1370 unsigned : 1;
1371 unsigned : 1;
1372 unsigned LVDIF : 1;
1373 unsigned : 1;
1374 unsigned : 1;
1375 unsigned : 1;
1376 unsigned : 1;
1377 unsigned : 1;
1379 } __PIR2bits_t;
1381 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1383 #define _CCP2IF 0x01
1384 #define _TMR3IF 0x02
1385 #define _HLVDIF 0x04
1386 #define _LVDIF 0x04
1387 #define _BCLIF 0x08
1388 #define _EEIF 0x10
1389 #define _CMIF 0x40
1390 #define _OSCFIF 0x80
1392 //==============================================================================
1395 //==============================================================================
1396 // IPR2 Bits
1398 extern __at(0x0FA2) __sfr IPR2;
1400 typedef union
1402 struct
1404 unsigned CCP2IP : 1;
1405 unsigned TMR3IP : 1;
1406 unsigned HLVDIP : 1;
1407 unsigned BCLIP : 1;
1408 unsigned EEIP : 1;
1409 unsigned : 1;
1410 unsigned CMIP : 1;
1411 unsigned OSCFIP : 1;
1414 struct
1416 unsigned : 1;
1417 unsigned : 1;
1418 unsigned LVDIP : 1;
1419 unsigned : 1;
1420 unsigned : 1;
1421 unsigned : 1;
1422 unsigned : 1;
1423 unsigned : 1;
1425 } __IPR2bits_t;
1427 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1429 #define _CCP2IP 0x01
1430 #define _TMR3IP 0x02
1431 #define _HLVDIP 0x04
1432 #define _LVDIP 0x04
1433 #define _BCLIP 0x08
1434 #define _EEIP 0x10
1435 #define _CMIP 0x40
1436 #define _OSCFIP 0x80
1438 //==============================================================================
1441 //==============================================================================
1442 // EECON1 Bits
1444 extern __at(0x0FA6) __sfr EECON1;
1446 typedef struct
1448 unsigned RD : 1;
1449 unsigned WR : 1;
1450 unsigned WREN : 1;
1451 unsigned WRERR : 1;
1452 unsigned FREE : 1;
1453 unsigned : 1;
1454 unsigned CFGS : 1;
1455 unsigned EEPGD : 1;
1456 } __EECON1bits_t;
1458 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1460 #define _RD 0x01
1461 #define _WR 0x02
1462 #define _WREN 0x04
1463 #define _WRERR 0x08
1464 #define _FREE 0x10
1465 #define _CFGS 0x40
1466 #define _EEPGD 0x80
1468 //==============================================================================
1470 extern __at(0x0FA7) __sfr EECON2;
1471 extern __at(0x0FA8) __sfr EEDATA;
1472 extern __at(0x0FA9) __sfr EEADR;
1473 extern __at(0x0FAA) __sfr EEADRH;
1475 //==============================================================================
1476 // RCSTA Bits
1478 extern __at(0x0FAB) __sfr RCSTA;
1480 typedef union
1482 struct
1484 unsigned RX9D : 1;
1485 unsigned OERR : 1;
1486 unsigned FERR : 1;
1487 unsigned ADDEN : 1;
1488 unsigned CREN : 1;
1489 unsigned SREN : 1;
1490 unsigned RX9 : 1;
1491 unsigned SPEN : 1;
1494 struct
1496 unsigned : 1;
1497 unsigned : 1;
1498 unsigned : 1;
1499 unsigned ADEN : 1;
1500 unsigned : 1;
1501 unsigned : 1;
1502 unsigned : 1;
1503 unsigned : 1;
1505 } __RCSTAbits_t;
1507 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1509 #define _RX9D 0x01
1510 #define _OERR 0x02
1511 #define _FERR 0x04
1512 #define _ADDEN 0x08
1513 #define _ADEN 0x08
1514 #define _CREN 0x10
1515 #define _SREN 0x20
1516 #define _RX9 0x40
1517 #define _SPEN 0x80
1519 //==============================================================================
1522 //==============================================================================
1523 // TXSTA Bits
1525 extern __at(0x0FAC) __sfr TXSTA;
1527 typedef struct
1529 unsigned TX9D : 1;
1530 unsigned TRMT : 1;
1531 unsigned BRGH : 1;
1532 unsigned SENDB : 1;
1533 unsigned SYNC : 1;
1534 unsigned TXEN : 1;
1535 unsigned TX9 : 1;
1536 unsigned CSRC : 1;
1537 } __TXSTAbits_t;
1539 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1541 #define _TX9D 0x01
1542 #define _TRMT 0x02
1543 #define _BRGH 0x04
1544 #define _SENDB 0x08
1545 #define _SYNC 0x10
1546 #define _TXEN 0x20
1547 #define _TX9 0x40
1548 #define _CSRC 0x80
1550 //==============================================================================
1552 extern __at(0x0FAD) __sfr TXREG;
1553 extern __at(0x0FAE) __sfr RCREG;
1554 extern __at(0x0FAF) __sfr SPBRG;
1555 extern __at(0x0FB0) __sfr SPBRGH;
1557 //==============================================================================
1558 // T3CON Bits
1560 extern __at(0x0FB1) __sfr T3CON;
1562 typedef union
1564 struct
1566 unsigned TMR3ON : 1;
1567 unsigned TMR3CS : 1;
1568 unsigned NOT_T3SYNC : 1;
1569 unsigned T3CCP1 : 1;
1570 unsigned T3CKPS0 : 1;
1571 unsigned T3CKPS1 : 1;
1572 unsigned T3CCP2 : 1;
1573 unsigned RD16 : 1;
1576 struct
1578 unsigned : 1;
1579 unsigned : 1;
1580 unsigned T3SYNC : 1;
1581 unsigned : 1;
1582 unsigned : 1;
1583 unsigned : 1;
1584 unsigned : 1;
1585 unsigned : 1;
1588 struct
1590 unsigned : 4;
1591 unsigned T3CKPS : 2;
1592 unsigned : 2;
1594 } __T3CONbits_t;
1596 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1598 #define _T3CON_TMR3ON 0x01
1599 #define _T3CON_TMR3CS 0x02
1600 #define _T3CON_NOT_T3SYNC 0x04
1601 #define _T3CON_T3SYNC 0x04
1602 #define _T3CON_T3CCP1 0x08
1603 #define _T3CON_T3CKPS0 0x10
1604 #define _T3CON_T3CKPS1 0x20
1605 #define _T3CON_T3CCP2 0x40
1606 #define _T3CON_RD16 0x80
1608 //==============================================================================
1610 extern __at(0x0FB2) __sfr TMR3;
1611 extern __at(0x0FB2) __sfr TMR3L;
1612 extern __at(0x0FB3) __sfr TMR3H;
1614 //==============================================================================
1615 // CMCON Bits
1617 extern __at(0x0FB4) __sfr CMCON;
1619 typedef union
1621 struct
1623 unsigned CM0 : 1;
1624 unsigned CM1 : 1;
1625 unsigned CM2 : 1;
1626 unsigned CIS : 1;
1627 unsigned C1INV : 1;
1628 unsigned C2INV : 1;
1629 unsigned C1OUT : 1;
1630 unsigned C2OUT : 1;
1633 struct
1635 unsigned CM : 3;
1636 unsigned : 5;
1638 } __CMCONbits_t;
1640 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1642 #define _CM0 0x01
1643 #define _CM1 0x02
1644 #define _CM2 0x04
1645 #define _CIS 0x08
1646 #define _C1INV 0x10
1647 #define _C2INV 0x20
1648 #define _C1OUT 0x40
1649 #define _C2OUT 0x80
1651 //==============================================================================
1654 //==============================================================================
1655 // CVRCON Bits
1657 extern __at(0x0FB5) __sfr CVRCON;
1659 typedef union
1661 struct
1663 unsigned CVR0 : 1;
1664 unsigned CVR1 : 1;
1665 unsigned CVR2 : 1;
1666 unsigned CVR3 : 1;
1667 unsigned CVRSS : 1;
1668 unsigned CVRR : 1;
1669 unsigned CVROE : 1;
1670 unsigned CVREN : 1;
1673 struct
1675 unsigned CVR : 4;
1676 unsigned : 4;
1678 } __CVRCONbits_t;
1680 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1682 #define _CVR0 0x01
1683 #define _CVR1 0x02
1684 #define _CVR2 0x04
1685 #define _CVR3 0x08
1686 #define _CVRSS 0x10
1687 #define _CVRR 0x20
1688 #define _CVROE 0x40
1689 #define _CVREN 0x80
1691 //==============================================================================
1694 //==============================================================================
1695 // ECCP1AS Bits
1697 extern __at(0x0FB6) __sfr ECCP1AS;
1699 typedef union
1701 struct
1703 unsigned PSSBD0 : 1;
1704 unsigned PSSBD1 : 1;
1705 unsigned PSSAC0 : 1;
1706 unsigned PSSAC1 : 1;
1707 unsigned ECCPAS0 : 1;
1708 unsigned ECCPAS1 : 1;
1709 unsigned ECCPAS2 : 1;
1710 unsigned ECCPASE : 1;
1713 struct
1715 unsigned PSSBD : 2;
1716 unsigned : 6;
1719 struct
1721 unsigned : 2;
1722 unsigned PSSAC : 2;
1723 unsigned : 4;
1726 struct
1728 unsigned : 4;
1729 unsigned ECCPAS : 3;
1730 unsigned : 1;
1732 } __ECCP1ASbits_t;
1734 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1736 #define _PSSBD0 0x01
1737 #define _PSSBD1 0x02
1738 #define _PSSAC0 0x04
1739 #define _PSSAC1 0x08
1740 #define _ECCPAS0 0x10
1741 #define _ECCPAS1 0x20
1742 #define _ECCPAS2 0x40
1743 #define _ECCPASE 0x80
1745 //==============================================================================
1748 //==============================================================================
1749 // PWM1CON Bits
1751 extern __at(0x0FB7) __sfr PWM1CON;
1753 typedef union
1755 struct
1757 unsigned PDC0 : 1;
1758 unsigned PDC1 : 1;
1759 unsigned PDC2 : 1;
1760 unsigned PDC3 : 1;
1761 unsigned PDC4 : 1;
1762 unsigned PDC5 : 1;
1763 unsigned PDC6 : 1;
1764 unsigned PRSEN : 1;
1767 struct
1769 unsigned PDC : 7;
1770 unsigned : 1;
1772 } __PWM1CONbits_t;
1774 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1776 #define _PDC0 0x01
1777 #define _PDC1 0x02
1778 #define _PDC2 0x04
1779 #define _PDC3 0x08
1780 #define _PDC4 0x10
1781 #define _PDC5 0x20
1782 #define _PDC6 0x40
1783 #define _PRSEN 0x80
1785 //==============================================================================
1788 //==============================================================================
1789 // BAUDCON Bits
1791 extern __at(0x0FB8) __sfr BAUDCON;
1793 typedef union
1795 struct
1797 unsigned ABDEN : 1;
1798 unsigned WUE : 1;
1799 unsigned : 1;
1800 unsigned BRG16 : 1;
1801 unsigned TXCKP : 1;
1802 unsigned RXDTP : 1;
1803 unsigned RCIDL : 1;
1804 unsigned ABDOVF : 1;
1807 struct
1809 unsigned : 1;
1810 unsigned : 1;
1811 unsigned : 1;
1812 unsigned : 1;
1813 unsigned SCKP : 1;
1814 unsigned RXCKP : 1;
1815 unsigned RCMT : 1;
1816 unsigned : 1;
1818 } __BAUDCONbits_t;
1820 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1822 #define _ABDEN 0x01
1823 #define _WUE 0x02
1824 #define _BRG16 0x08
1825 #define _TXCKP 0x10
1826 #define _SCKP 0x10
1827 #define _RXDTP 0x20
1828 #define _RXCKP 0x20
1829 #define _RCIDL 0x40
1830 #define _RCMT 0x40
1831 #define _ABDOVF 0x80
1833 //==============================================================================
1836 //==============================================================================
1837 // BAUDCTL Bits
1839 extern __at(0x0FB8) __sfr BAUDCTL;
1841 typedef union
1843 struct
1845 unsigned ABDEN : 1;
1846 unsigned WUE : 1;
1847 unsigned : 1;
1848 unsigned BRG16 : 1;
1849 unsigned TXCKP : 1;
1850 unsigned RXDTP : 1;
1851 unsigned RCIDL : 1;
1852 unsigned ABDOVF : 1;
1855 struct
1857 unsigned : 1;
1858 unsigned : 1;
1859 unsigned : 1;
1860 unsigned : 1;
1861 unsigned SCKP : 1;
1862 unsigned RXCKP : 1;
1863 unsigned RCMT : 1;
1864 unsigned : 1;
1866 } __BAUDCTLbits_t;
1868 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1870 #define _BAUDCTL_ABDEN 0x01
1871 #define _BAUDCTL_WUE 0x02
1872 #define _BAUDCTL_BRG16 0x08
1873 #define _BAUDCTL_TXCKP 0x10
1874 #define _BAUDCTL_SCKP 0x10
1875 #define _BAUDCTL_RXDTP 0x20
1876 #define _BAUDCTL_RXCKP 0x20
1877 #define _BAUDCTL_RCIDL 0x40
1878 #define _BAUDCTL_RCMT 0x40
1879 #define _BAUDCTL_ABDOVF 0x80
1881 //==============================================================================
1884 //==============================================================================
1885 // CCP2CON Bits
1887 extern __at(0x0FBA) __sfr CCP2CON;
1889 typedef union
1891 struct
1893 unsigned CCP2M0 : 1;
1894 unsigned CCP2M1 : 1;
1895 unsigned CCP2M2 : 1;
1896 unsigned CCP2M3 : 1;
1897 unsigned CCP2Y : 1;
1898 unsigned CCP2X : 1;
1899 unsigned : 1;
1900 unsigned : 1;
1903 struct
1905 unsigned : 1;
1906 unsigned : 1;
1907 unsigned : 1;
1908 unsigned : 1;
1909 unsigned DC2B0 : 1;
1910 unsigned DC2B1 : 1;
1911 unsigned : 1;
1912 unsigned : 1;
1915 struct
1917 unsigned CCP2M : 4;
1918 unsigned : 4;
1921 struct
1923 unsigned : 4;
1924 unsigned DC2B : 2;
1925 unsigned : 2;
1927 } __CCP2CONbits_t;
1929 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1931 #define _CCP2M0 0x01
1932 #define _CCP2M1 0x02
1933 #define _CCP2M2 0x04
1934 #define _CCP2M3 0x08
1935 #define _CCP2Y 0x10
1936 #define _DC2B0 0x10
1937 #define _CCP2X 0x20
1938 #define _DC2B1 0x20
1940 //==============================================================================
1942 extern __at(0x0FBB) __sfr CCPR2;
1943 extern __at(0x0FBB) __sfr CCPR2L;
1944 extern __at(0x0FBC) __sfr CCPR2H;
1946 //==============================================================================
1947 // CCP1CON Bits
1949 extern __at(0x0FBD) __sfr CCP1CON;
1951 typedef union
1953 struct
1955 unsigned CCP1M0 : 1;
1956 unsigned CCP1M1 : 1;
1957 unsigned CCP1M2 : 1;
1958 unsigned CCP1M3 : 1;
1959 unsigned CCP1Y : 1;
1960 unsigned CCP1X : 1;
1961 unsigned P1M0 : 1;
1962 unsigned P1M1 : 1;
1965 struct
1967 unsigned : 1;
1968 unsigned : 1;
1969 unsigned : 1;
1970 unsigned : 1;
1971 unsigned DC1B0 : 1;
1972 unsigned DC1B1 : 1;
1973 unsigned : 1;
1974 unsigned : 1;
1977 struct
1979 unsigned CCP1M : 4;
1980 unsigned : 4;
1983 struct
1985 unsigned : 4;
1986 unsigned DC1B : 2;
1987 unsigned : 2;
1990 struct
1992 unsigned : 6;
1993 unsigned P1M : 2;
1995 } __CCP1CONbits_t;
1997 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1999 #define _CCP1M0 0x01
2000 #define _CCP1M1 0x02
2001 #define _CCP1M2 0x04
2002 #define _CCP1M3 0x08
2003 #define _CCP1Y 0x10
2004 #define _DC1B0 0x10
2005 #define _CCP1X 0x20
2006 #define _DC1B1 0x20
2007 #define _P1M0 0x40
2008 #define _P1M1 0x80
2010 //==============================================================================
2012 extern __at(0x0FBE) __sfr CCPR1;
2013 extern __at(0x0FBE) __sfr CCPR1L;
2014 extern __at(0x0FBF) __sfr CCPR1H;
2016 //==============================================================================
2017 // ADCON2 Bits
2019 extern __at(0x0FC0) __sfr ADCON2;
2021 typedef union
2023 struct
2025 unsigned ADCS0 : 1;
2026 unsigned ADCS1 : 1;
2027 unsigned ADCS2 : 1;
2028 unsigned ACQT0 : 1;
2029 unsigned ACQT1 : 1;
2030 unsigned ACQT2 : 1;
2031 unsigned : 1;
2032 unsigned ADFM : 1;
2035 struct
2037 unsigned ADCS : 3;
2038 unsigned : 5;
2041 struct
2043 unsigned : 3;
2044 unsigned ACQT : 3;
2045 unsigned : 2;
2047 } __ADCON2bits_t;
2049 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2051 #define _ADCS0 0x01
2052 #define _ADCS1 0x02
2053 #define _ADCS2 0x04
2054 #define _ACQT0 0x08
2055 #define _ACQT1 0x10
2056 #define _ACQT2 0x20
2057 #define _ADFM 0x80
2059 //==============================================================================
2062 //==============================================================================
2063 // ADCON1 Bits
2065 extern __at(0x0FC1) __sfr ADCON1;
2067 typedef union
2069 struct
2071 unsigned PCFG0 : 1;
2072 unsigned PCFG1 : 1;
2073 unsigned PCFG2 : 1;
2074 unsigned PCFG3 : 1;
2075 unsigned VCFG0 : 1;
2076 unsigned VCFG1 : 1;
2077 unsigned : 1;
2078 unsigned : 1;
2081 struct
2083 unsigned PCFG : 4;
2084 unsigned : 4;
2087 struct
2089 unsigned : 4;
2090 unsigned VCFG : 2;
2091 unsigned : 2;
2093 } __ADCON1bits_t;
2095 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2097 #define _PCFG0 0x01
2098 #define _PCFG1 0x02
2099 #define _PCFG2 0x04
2100 #define _PCFG3 0x08
2101 #define _VCFG0 0x10
2102 #define _VCFG1 0x20
2104 //==============================================================================
2107 //==============================================================================
2108 // ADCON0 Bits
2110 extern __at(0x0FC2) __sfr ADCON0;
2112 typedef union
2114 struct
2116 unsigned ADON : 1;
2117 unsigned GO_NOT_DONE : 1;
2118 unsigned CHS0 : 1;
2119 unsigned CHS1 : 1;
2120 unsigned CHS2 : 1;
2121 unsigned CHS3 : 1;
2122 unsigned : 1;
2123 unsigned : 1;
2126 struct
2128 unsigned : 1;
2129 unsigned GO : 1;
2130 unsigned : 1;
2131 unsigned : 1;
2132 unsigned : 1;
2133 unsigned : 1;
2134 unsigned : 1;
2135 unsigned : 1;
2138 struct
2140 unsigned : 1;
2141 unsigned DONE : 1;
2142 unsigned : 1;
2143 unsigned : 1;
2144 unsigned : 1;
2145 unsigned : 1;
2146 unsigned : 1;
2147 unsigned : 1;
2150 struct
2152 unsigned : 1;
2153 unsigned NOT_DONE : 1;
2154 unsigned : 1;
2155 unsigned : 1;
2156 unsigned : 1;
2157 unsigned : 1;
2158 unsigned : 1;
2159 unsigned : 1;
2162 struct
2164 unsigned : 1;
2165 unsigned GO_DONE : 1;
2166 unsigned : 1;
2167 unsigned : 1;
2168 unsigned : 1;
2169 unsigned : 1;
2170 unsigned : 1;
2171 unsigned : 1;
2174 struct
2176 unsigned : 2;
2177 unsigned CHS : 4;
2178 unsigned : 2;
2180 } __ADCON0bits_t;
2182 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2184 #define _ADON 0x01
2185 #define _GO_NOT_DONE 0x02
2186 #define _GO 0x02
2187 #define _DONE 0x02
2188 #define _NOT_DONE 0x02
2189 #define _GO_DONE 0x02
2190 #define _CHS0 0x04
2191 #define _CHS1 0x08
2192 #define _CHS2 0x10
2193 #define _CHS3 0x20
2195 //==============================================================================
2197 extern __at(0x0FC3) __sfr ADRES;
2198 extern __at(0x0FC3) __sfr ADRESL;
2199 extern __at(0x0FC4) __sfr ADRESH;
2201 //==============================================================================
2202 // SSPCON2 Bits
2204 extern __at(0x0FC5) __sfr SSPCON2;
2206 typedef struct
2208 unsigned SEN : 1;
2209 unsigned RSEN : 1;
2210 unsigned PEN : 1;
2211 unsigned RCEN : 1;
2212 unsigned ACKEN : 1;
2213 unsigned ACKDT : 1;
2214 unsigned ACKSTAT : 1;
2215 unsigned GCEN : 1;
2216 } __SSPCON2bits_t;
2218 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2220 #define _SEN 0x01
2221 #define _RSEN 0x02
2222 #define _PEN 0x04
2223 #define _RCEN 0x08
2224 #define _ACKEN 0x10
2225 #define _ACKDT 0x20
2226 #define _ACKSTAT 0x40
2227 #define _GCEN 0x80
2229 //==============================================================================
2232 //==============================================================================
2233 // SSPCON1 Bits
2235 extern __at(0x0FC6) __sfr SSPCON1;
2237 typedef union
2239 struct
2241 unsigned SSPM0 : 1;
2242 unsigned SSPM1 : 1;
2243 unsigned SSPM2 : 1;
2244 unsigned SSPM3 : 1;
2245 unsigned CKP : 1;
2246 unsigned SSPEN : 1;
2247 unsigned SSPOV : 1;
2248 unsigned WCOL : 1;
2251 struct
2253 unsigned SSPM : 4;
2254 unsigned : 4;
2256 } __SSPCON1bits_t;
2258 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2260 #define _SSPM0 0x01
2261 #define _SSPM1 0x02
2262 #define _SSPM2 0x04
2263 #define _SSPM3 0x08
2264 #define _CKP 0x10
2265 #define _SSPEN 0x20
2266 #define _SSPOV 0x40
2267 #define _WCOL 0x80
2269 //==============================================================================
2272 //==============================================================================
2273 // SSPSTAT Bits
2275 extern __at(0x0FC7) __sfr SSPSTAT;
2277 typedef union
2279 struct
2281 unsigned BF : 1;
2282 unsigned UA : 1;
2283 unsigned R_NOT_W : 1;
2284 unsigned S : 1;
2285 unsigned P : 1;
2286 unsigned D_NOT_A : 1;
2287 unsigned CKE : 1;
2288 unsigned SMP : 1;
2291 struct
2293 unsigned : 1;
2294 unsigned : 1;
2295 unsigned R : 1;
2296 unsigned : 1;
2297 unsigned : 1;
2298 unsigned D : 1;
2299 unsigned : 1;
2300 unsigned : 1;
2303 struct
2305 unsigned : 1;
2306 unsigned : 1;
2307 unsigned NOT_W : 1;
2308 unsigned : 1;
2309 unsigned : 1;
2310 unsigned NOT_A : 1;
2311 unsigned : 1;
2312 unsigned : 1;
2315 struct
2317 unsigned : 1;
2318 unsigned : 1;
2319 unsigned R_W : 1;
2320 unsigned : 1;
2321 unsigned : 1;
2322 unsigned D_A : 1;
2323 unsigned : 1;
2324 unsigned : 1;
2327 struct
2329 unsigned : 1;
2330 unsigned : 1;
2331 unsigned NOT_WRITE : 1;
2332 unsigned : 1;
2333 unsigned : 1;
2334 unsigned NOT_ADDRESS : 1;
2335 unsigned : 1;
2336 unsigned : 1;
2338 } __SSPSTATbits_t;
2340 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2342 #define _BF 0x01
2343 #define _UA 0x02
2344 #define _R_NOT_W 0x04
2345 #define _R 0x04
2346 #define _NOT_W 0x04
2347 #define _R_W 0x04
2348 #define _NOT_WRITE 0x04
2349 #define _S 0x08
2350 #define _P 0x10
2351 #define _D_NOT_A 0x20
2352 #define _D 0x20
2353 #define _NOT_A 0x20
2354 #define _D_A 0x20
2355 #define _NOT_ADDRESS 0x20
2356 #define _CKE 0x40
2357 #define _SMP 0x80
2359 //==============================================================================
2361 extern __at(0x0FC8) __sfr SSPADD;
2362 extern __at(0x0FC9) __sfr SSPBUF;
2364 //==============================================================================
2365 // T2CON Bits
2367 extern __at(0x0FCA) __sfr T2CON;
2369 typedef union
2371 struct
2373 unsigned T2CKPS0 : 1;
2374 unsigned T2CKPS1 : 1;
2375 unsigned TMR2ON : 1;
2376 unsigned T2OUTPS0 : 1;
2377 unsigned T2OUTPS1 : 1;
2378 unsigned T2OUTPS2 : 1;
2379 unsigned T2OUTPS3 : 1;
2380 unsigned : 1;
2383 struct
2385 unsigned T2CKPS : 2;
2386 unsigned : 6;
2389 struct
2391 unsigned : 3;
2392 unsigned T2OUTPS : 4;
2393 unsigned : 1;
2395 } __T2CONbits_t;
2397 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2399 #define _T2CKPS0 0x01
2400 #define _T2CKPS1 0x02
2401 #define _TMR2ON 0x04
2402 #define _T2OUTPS0 0x08
2403 #define _T2OUTPS1 0x10
2404 #define _T2OUTPS2 0x20
2405 #define _T2OUTPS3 0x40
2407 //==============================================================================
2409 extern __at(0x0FCB) __sfr PR2;
2410 extern __at(0x0FCC) __sfr TMR2;
2412 //==============================================================================
2413 // T1CON Bits
2415 extern __at(0x0FCD) __sfr T1CON;
2417 typedef union
2419 struct
2421 unsigned TMR1ON : 1;
2422 unsigned TMR1CS : 1;
2423 unsigned NOT_T1SYNC : 1;
2424 unsigned T1OSCEN : 1;
2425 unsigned T1CKPS0 : 1;
2426 unsigned T1CKPS1 : 1;
2427 unsigned T1RUN : 1;
2428 unsigned RD16 : 1;
2431 struct
2433 unsigned : 1;
2434 unsigned : 1;
2435 unsigned T1SYNC : 1;
2436 unsigned : 1;
2437 unsigned : 1;
2438 unsigned : 1;
2439 unsigned : 1;
2440 unsigned : 1;
2443 struct
2445 unsigned : 4;
2446 unsigned T1CKPS : 2;
2447 unsigned : 2;
2449 } __T1CONbits_t;
2451 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2453 #define _TMR1ON 0x01
2454 #define _TMR1CS 0x02
2455 #define _NOT_T1SYNC 0x04
2456 #define _T1SYNC 0x04
2457 #define _T1OSCEN 0x08
2458 #define _T1CKPS0 0x10
2459 #define _T1CKPS1 0x20
2460 #define _T1RUN 0x40
2461 #define _RD16 0x80
2463 //==============================================================================
2465 extern __at(0x0FCE) __sfr TMR1;
2466 extern __at(0x0FCE) __sfr TMR1L;
2467 extern __at(0x0FCF) __sfr TMR1H;
2469 //==============================================================================
2470 // RCON Bits
2472 extern __at(0x0FD0) __sfr RCON;
2474 typedef union
2476 struct
2478 unsigned NOT_BOR : 1;
2479 unsigned NOT_POR : 1;
2480 unsigned NOT_PD : 1;
2481 unsigned NOT_TO : 1;
2482 unsigned NOT_RI : 1;
2483 unsigned : 1;
2484 unsigned SBOREN : 1;
2485 unsigned IPEN : 1;
2488 struct
2490 unsigned BOR : 1;
2491 unsigned POR : 1;
2492 unsigned PD : 1;
2493 unsigned TO : 1;
2494 unsigned RI : 1;
2495 unsigned : 1;
2496 unsigned : 1;
2497 unsigned : 1;
2499 } __RCONbits_t;
2501 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2503 #define _NOT_BOR 0x01
2504 #define _BOR 0x01
2505 #define _NOT_POR 0x02
2506 #define _POR 0x02
2507 #define _NOT_PD 0x04
2508 #define _PD 0x04
2509 #define _NOT_TO 0x08
2510 #define _TO 0x08
2511 #define _NOT_RI 0x10
2512 #define _RI 0x10
2513 #define _SBOREN 0x40
2514 #define _IPEN 0x80
2516 //==============================================================================
2519 //==============================================================================
2520 // WDTCON Bits
2522 extern __at(0x0FD1) __sfr WDTCON;
2524 typedef union
2526 struct
2528 unsigned SWDTEN : 1;
2529 unsigned : 1;
2530 unsigned : 1;
2531 unsigned : 1;
2532 unsigned : 1;
2533 unsigned : 1;
2534 unsigned : 1;
2535 unsigned : 1;
2538 struct
2540 unsigned SWDTE : 1;
2541 unsigned : 1;
2542 unsigned : 1;
2543 unsigned : 1;
2544 unsigned : 1;
2545 unsigned : 1;
2546 unsigned : 1;
2547 unsigned : 1;
2549 } __WDTCONbits_t;
2551 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2553 #define _SWDTEN 0x01
2554 #define _SWDTE 0x01
2556 //==============================================================================
2559 //==============================================================================
2560 // HLVDCON Bits
2562 extern __at(0x0FD2) __sfr HLVDCON;
2564 typedef union
2566 struct
2568 unsigned HLVDL0 : 1;
2569 unsigned HLVDL1 : 1;
2570 unsigned HLVDL2 : 1;
2571 unsigned HLVDL3 : 1;
2572 unsigned HLVDEN : 1;
2573 unsigned IVRST : 1;
2574 unsigned : 1;
2575 unsigned VDIRMAG : 1;
2578 struct
2580 unsigned LVDL0 : 1;
2581 unsigned LVDL1 : 1;
2582 unsigned LVDL2 : 1;
2583 unsigned LVDL3 : 1;
2584 unsigned LVDEN : 1;
2585 unsigned IRVST : 1;
2586 unsigned : 1;
2587 unsigned : 1;
2590 struct
2592 unsigned LVV0 : 1;
2593 unsigned LVV1 : 1;
2594 unsigned LVV2 : 1;
2595 unsigned LVV3 : 1;
2596 unsigned : 1;
2597 unsigned BGST : 1;
2598 unsigned : 1;
2599 unsigned : 1;
2602 struct
2604 unsigned HLVDL : 4;
2605 unsigned : 4;
2608 struct
2610 unsigned LVV : 4;
2611 unsigned : 4;
2614 struct
2616 unsigned LVDL : 4;
2617 unsigned : 4;
2619 } __HLVDCONbits_t;
2621 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2623 #define _HLVDL0 0x01
2624 #define _LVDL0 0x01
2625 #define _LVV0 0x01
2626 #define _HLVDL1 0x02
2627 #define _LVDL1 0x02
2628 #define _LVV1 0x02
2629 #define _HLVDL2 0x04
2630 #define _LVDL2 0x04
2631 #define _LVV2 0x04
2632 #define _HLVDL3 0x08
2633 #define _LVDL3 0x08
2634 #define _LVV3 0x08
2635 #define _HLVDEN 0x10
2636 #define _LVDEN 0x10
2637 #define _IVRST 0x20
2638 #define _IRVST 0x20
2639 #define _BGST 0x20
2640 #define _VDIRMAG 0x80
2642 //==============================================================================
2645 //==============================================================================
2646 // LVDCON Bits
2648 extern __at(0x0FD2) __sfr LVDCON;
2650 typedef union
2652 struct
2654 unsigned HLVDL0 : 1;
2655 unsigned HLVDL1 : 1;
2656 unsigned HLVDL2 : 1;
2657 unsigned HLVDL3 : 1;
2658 unsigned HLVDEN : 1;
2659 unsigned IVRST : 1;
2660 unsigned : 1;
2661 unsigned VDIRMAG : 1;
2664 struct
2666 unsigned LVDL0 : 1;
2667 unsigned LVDL1 : 1;
2668 unsigned LVDL2 : 1;
2669 unsigned LVDL3 : 1;
2670 unsigned LVDEN : 1;
2671 unsigned IRVST : 1;
2672 unsigned : 1;
2673 unsigned : 1;
2676 struct
2678 unsigned LVV0 : 1;
2679 unsigned LVV1 : 1;
2680 unsigned LVV2 : 1;
2681 unsigned LVV3 : 1;
2682 unsigned : 1;
2683 unsigned BGST : 1;
2684 unsigned : 1;
2685 unsigned : 1;
2688 struct
2690 unsigned HLVDL : 4;
2691 unsigned : 4;
2694 struct
2696 unsigned LVDL : 4;
2697 unsigned : 4;
2700 struct
2702 unsigned LVV : 4;
2703 unsigned : 4;
2705 } __LVDCONbits_t;
2707 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2709 #define _LVDCON_HLVDL0 0x01
2710 #define _LVDCON_LVDL0 0x01
2711 #define _LVDCON_LVV0 0x01
2712 #define _LVDCON_HLVDL1 0x02
2713 #define _LVDCON_LVDL1 0x02
2714 #define _LVDCON_LVV1 0x02
2715 #define _LVDCON_HLVDL2 0x04
2716 #define _LVDCON_LVDL2 0x04
2717 #define _LVDCON_LVV2 0x04
2718 #define _LVDCON_HLVDL3 0x08
2719 #define _LVDCON_LVDL3 0x08
2720 #define _LVDCON_LVV3 0x08
2721 #define _LVDCON_HLVDEN 0x10
2722 #define _LVDCON_LVDEN 0x10
2723 #define _LVDCON_IVRST 0x20
2724 #define _LVDCON_IRVST 0x20
2725 #define _LVDCON_BGST 0x20
2726 #define _LVDCON_VDIRMAG 0x80
2728 //==============================================================================
2731 //==============================================================================
2732 // OSCCON Bits
2734 extern __at(0x0FD3) __sfr OSCCON;
2736 typedef union
2738 struct
2740 unsigned SCS0 : 1;
2741 unsigned SCS1 : 1;
2742 unsigned IOFS : 1;
2743 unsigned OSTS : 1;
2744 unsigned IRCF0 : 1;
2745 unsigned IRCF1 : 1;
2746 unsigned IRCF2 : 1;
2747 unsigned IDLEN : 1;
2750 struct
2752 unsigned SCS : 2;
2753 unsigned : 6;
2756 struct
2758 unsigned : 4;
2759 unsigned IRCF : 3;
2760 unsigned : 1;
2762 } __OSCCONbits_t;
2764 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2766 #define _SCS0 0x01
2767 #define _SCS1 0x02
2768 #define _IOFS 0x04
2769 #define _OSTS 0x08
2770 #define _IRCF0 0x10
2771 #define _IRCF1 0x20
2772 #define _IRCF2 0x40
2773 #define _IDLEN 0x80
2775 //==============================================================================
2778 //==============================================================================
2779 // T0CON Bits
2781 extern __at(0x0FD5) __sfr T0CON;
2783 typedef union
2785 struct
2787 unsigned T0PS0 : 1;
2788 unsigned T0PS1 : 1;
2789 unsigned T0PS2 : 1;
2790 unsigned PSA : 1;
2791 unsigned T0SE : 1;
2792 unsigned T0CS : 1;
2793 unsigned T08BIT : 1;
2794 unsigned TMR0ON : 1;
2797 struct
2799 unsigned : 1;
2800 unsigned : 1;
2801 unsigned : 1;
2802 unsigned : 1;
2803 unsigned : 1;
2804 unsigned : 1;
2805 unsigned T016BIT : 1;
2806 unsigned : 1;
2809 struct
2811 unsigned T0PS : 3;
2812 unsigned : 5;
2814 } __T0CONbits_t;
2816 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2818 #define _T0PS0 0x01
2819 #define _T0PS1 0x02
2820 #define _T0PS2 0x04
2821 #define _PSA 0x08
2822 #define _T0SE 0x10
2823 #define _T0CS 0x20
2824 #define _T08BIT 0x40
2825 #define _T016BIT 0x40
2826 #define _TMR0ON 0x80
2828 //==============================================================================
2830 extern __at(0x0FD6) __sfr TMR0;
2831 extern __at(0x0FD6) __sfr TMR0L;
2832 extern __at(0x0FD7) __sfr TMR0H;
2834 //==============================================================================
2835 // STATUS Bits
2837 extern __at(0x0FD8) __sfr STATUS;
2839 typedef struct
2841 unsigned C : 1;
2842 unsigned DC : 1;
2843 unsigned Z : 1;
2844 unsigned OV : 1;
2845 unsigned N : 1;
2846 unsigned : 1;
2847 unsigned : 1;
2848 unsigned : 1;
2849 } __STATUSbits_t;
2851 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2853 #define _C 0x01
2854 #define _DC 0x02
2855 #define _Z 0x04
2856 #define _OV 0x08
2857 #define _N 0x10
2859 //==============================================================================
2861 extern __at(0x0FD9) __sfr FSR2L;
2862 extern __at(0x0FDA) __sfr FSR2H;
2863 extern __at(0x0FDB) __sfr PLUSW2;
2864 extern __at(0x0FDC) __sfr PREINC2;
2865 extern __at(0x0FDD) __sfr POSTDEC2;
2866 extern __at(0x0FDE) __sfr POSTINC2;
2867 extern __at(0x0FDF) __sfr INDF2;
2868 extern __at(0x0FE0) __sfr BSR;
2869 extern __at(0x0FE1) __sfr FSR1L;
2870 extern __at(0x0FE2) __sfr FSR1H;
2871 extern __at(0x0FE3) __sfr PLUSW1;
2872 extern __at(0x0FE4) __sfr PREINC1;
2873 extern __at(0x0FE5) __sfr POSTDEC1;
2874 extern __at(0x0FE6) __sfr POSTINC1;
2875 extern __at(0x0FE7) __sfr INDF1;
2876 extern __at(0x0FE8) __sfr WREG;
2877 extern __at(0x0FE9) __sfr FSR0L;
2878 extern __at(0x0FEA) __sfr FSR0H;
2879 extern __at(0x0FEB) __sfr PLUSW0;
2880 extern __at(0x0FEC) __sfr PREINC0;
2881 extern __at(0x0FED) __sfr POSTDEC0;
2882 extern __at(0x0FEE) __sfr POSTINC0;
2883 extern __at(0x0FEF) __sfr INDF0;
2885 //==============================================================================
2886 // INTCON3 Bits
2888 extern __at(0x0FF0) __sfr INTCON3;
2890 typedef union
2892 struct
2894 unsigned INT1IF : 1;
2895 unsigned INT2IF : 1;
2896 unsigned : 1;
2897 unsigned INT1IE : 1;
2898 unsigned INT2IE : 1;
2899 unsigned : 1;
2900 unsigned INT1IP : 1;
2901 unsigned INT2IP : 1;
2904 struct
2906 unsigned INT1F : 1;
2907 unsigned INT2F : 1;
2908 unsigned : 1;
2909 unsigned INT1E : 1;
2910 unsigned INT2E : 1;
2911 unsigned : 1;
2912 unsigned INT1P : 1;
2913 unsigned INT2P : 1;
2915 } __INTCON3bits_t;
2917 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2919 #define _INT1IF 0x01
2920 #define _INT1F 0x01
2921 #define _INT2IF 0x02
2922 #define _INT2F 0x02
2923 #define _INT1IE 0x08
2924 #define _INT1E 0x08
2925 #define _INT2IE 0x10
2926 #define _INT2E 0x10
2927 #define _INT1IP 0x40
2928 #define _INT1P 0x40
2929 #define _INT2IP 0x80
2930 #define _INT2P 0x80
2932 //==============================================================================
2935 //==============================================================================
2936 // INTCON2 Bits
2938 extern __at(0x0FF1) __sfr INTCON2;
2940 typedef union
2942 struct
2944 unsigned RBIP : 1;
2945 unsigned : 1;
2946 unsigned TMR0IP : 1;
2947 unsigned : 1;
2948 unsigned INTEDG2 : 1;
2949 unsigned INTEDG1 : 1;
2950 unsigned INTEDG0 : 1;
2951 unsigned NOT_RBPU : 1;
2954 struct
2956 unsigned : 1;
2957 unsigned : 1;
2958 unsigned : 1;
2959 unsigned : 1;
2960 unsigned : 1;
2961 unsigned : 1;
2962 unsigned : 1;
2963 unsigned RBPU : 1;
2965 } __INTCON2bits_t;
2967 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2969 #define _RBIP 0x01
2970 #define _TMR0IP 0x04
2971 #define _INTEDG2 0x10
2972 #define _INTEDG1 0x20
2973 #define _INTEDG0 0x40
2974 #define _NOT_RBPU 0x80
2975 #define _RBPU 0x80
2977 //==============================================================================
2980 //==============================================================================
2981 // INTCON Bits
2983 extern __at(0x0FF2) __sfr INTCON;
2985 typedef union
2987 struct
2989 unsigned RBIF : 1;
2990 unsigned INT0IF : 1;
2991 unsigned TMR0IF : 1;
2992 unsigned RBIE : 1;
2993 unsigned INT0IE : 1;
2994 unsigned TMR0IE : 1;
2995 unsigned PEIE_GIEL : 1;
2996 unsigned GIE_GIEH : 1;
2999 struct
3001 unsigned : 1;
3002 unsigned INT0F : 1;
3003 unsigned T0IF : 1;
3004 unsigned : 1;
3005 unsigned INT0E : 1;
3006 unsigned T0IE : 1;
3007 unsigned PEIE : 1;
3008 unsigned GIE : 1;
3011 struct
3013 unsigned : 1;
3014 unsigned : 1;
3015 unsigned : 1;
3016 unsigned : 1;
3017 unsigned : 1;
3018 unsigned : 1;
3019 unsigned GIEL : 1;
3020 unsigned GIEH : 1;
3022 } __INTCONbits_t;
3024 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3026 #define _RBIF 0x01
3027 #define _INT0IF 0x02
3028 #define _INT0F 0x02
3029 #define _TMR0IF 0x04
3030 #define _T0IF 0x04
3031 #define _RBIE 0x08
3032 #define _INT0IE 0x10
3033 #define _INT0E 0x10
3034 #define _TMR0IE 0x20
3035 #define _T0IE 0x20
3036 #define _PEIE_GIEL 0x40
3037 #define _PEIE 0x40
3038 #define _GIEL 0x40
3039 #define _GIE_GIEH 0x80
3040 #define _GIE 0x80
3041 #define _GIEH 0x80
3043 //==============================================================================
3045 extern __at(0x0FF3) __sfr PROD;
3046 extern __at(0x0FF3) __sfr PRODL;
3047 extern __at(0x0FF4) __sfr PRODH;
3048 extern __at(0x0FF5) __sfr TABLAT;
3049 extern __at(0x0FF6) __sfr TBLPTR;
3050 extern __at(0x0FF6) __sfr TBLPTRL;
3051 extern __at(0x0FF7) __sfr TBLPTRH;
3052 extern __at(0x0FF8) __sfr TBLPTRU;
3053 extern __at(0x0FF9) __sfr PC;
3054 extern __at(0x0FF9) __sfr PCL;
3055 extern __at(0x0FFA) __sfr PCLATH;
3056 extern __at(0x0FFB) __sfr PCLATU;
3058 //==============================================================================
3059 // STKPTR Bits
3061 extern __at(0x0FFC) __sfr STKPTR;
3063 typedef union
3065 struct
3067 unsigned STKPTR0 : 1;
3068 unsigned STKPTR1 : 1;
3069 unsigned STKPTR2 : 1;
3070 unsigned STKPTR3 : 1;
3071 unsigned STKPTR4 : 1;
3072 unsigned : 1;
3073 unsigned STKUNF : 1;
3074 unsigned STKFUL : 1;
3077 struct
3079 unsigned SP0 : 1;
3080 unsigned SP1 : 1;
3081 unsigned SP2 : 1;
3082 unsigned SP3 : 1;
3083 unsigned SP4 : 1;
3084 unsigned : 1;
3085 unsigned : 1;
3086 unsigned STKOVF : 1;
3089 struct
3091 unsigned SP : 5;
3092 unsigned : 3;
3095 struct
3097 unsigned STKPTR : 5;
3098 unsigned : 3;
3100 } __STKPTRbits_t;
3102 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3104 #define _STKPTR0 0x01
3105 #define _SP0 0x01
3106 #define _STKPTR1 0x02
3107 #define _SP1 0x02
3108 #define _STKPTR2 0x04
3109 #define _SP2 0x04
3110 #define _STKPTR3 0x08
3111 #define _SP3 0x08
3112 #define _STKPTR4 0x10
3113 #define _SP4 0x10
3114 #define _STKUNF 0x40
3115 #define _STKFUL 0x80
3116 #define _STKOVF 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 _OSC_LP_1H 0xF0 // LP oscillator.
3146 #define _OSC_XT_1H 0xF1 // XT oscillator.
3147 #define _OSC_HS_1H 0xF2 // HS oscillator.
3148 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
3149 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKOUT function on RA6.
3150 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
3151 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3152 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
3153 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
3154 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKOUT function on RA6, port function on RA7.
3155 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3156 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3157 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3158 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3160 //----------------------------- CONFIG2L Options -------------------------------
3162 #define _PWRT_ON_2L 0xFE // PWRT enabled.
3163 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
3164 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3165 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3166 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3167 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3168 #define _BORV_0_2L 0xE7 // Maximum setting.
3169 #define _BORV_1_2L 0xEF
3170 #define _BORV_2_2L 0xF7
3171 #define _BORV_3_2L 0xFF // Minimum setting.
3173 //----------------------------- CONFIG2H Options -------------------------------
3175 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
3176 #define _WDT_ON_2H 0xFF // WDT enabled.
3177 #define _WDTPS_1_2H 0xE1 // 1:1.
3178 #define _WDTPS_2_2H 0xE3 // 1:2.
3179 #define _WDTPS_4_2H 0xE5 // 1:4.
3180 #define _WDTPS_8_2H 0xE7 // 1:8.
3181 #define _WDTPS_16_2H 0xE9 // 1:16.
3182 #define _WDTPS_32_2H 0xEB // 1:32.
3183 #define _WDTPS_64_2H 0xED // 1:64.
3184 #define _WDTPS_128_2H 0xEF // 1:128.
3185 #define _WDTPS_256_2H 0xF1 // 1:256.
3186 #define _WDTPS_512_2H 0xF3 // 1:512.
3187 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3188 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3189 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3190 #define _WDTPS_8192_2H 0xFB // 1:8192.
3191 #define _WDTPS_16384_2H 0xFD // 1:16384.
3192 #define _WDTPS_32768_2H 0xFF // 1:32768.
3194 //----------------------------- CONFIG3H Options -------------------------------
3196 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3197 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3198 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3199 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3200 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3201 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3202 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3203 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3205 //----------------------------- CONFIG4L Options -------------------------------
3207 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3208 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3209 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3210 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3211 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3212 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3213 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3214 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3216 //----------------------------- CONFIG5L Options -------------------------------
3218 #define _CP0_ON_5L 0xFE // Block 0 (000800-003FFFh) code-protected.
3219 #define _CP0_OFF_5L 0xFF // Block 0 (000800-003FFFh) not code-protected.
3220 #define _CP1_ON_5L 0xFD // Block 1 (004000-007FFFh) code-protected.
3221 #define _CP1_OFF_5L 0xFF // Block 1 (004000-007FFFh) not code-protected.
3222 #define _CP2_ON_5L 0xFB // Block 2 (008000-00BFFFh) code-protected.
3223 #define _CP2_OFF_5L 0xFF // Block 2 (008000-00BFFFh) not code-protected.
3224 #define _CP3_ON_5L 0xF7 // Block 3 (00C000-00FFFFh) code-protected.
3225 #define _CP3_OFF_5L 0xFF // Block 3 (00C000-00FFFFh) not code-protected.
3227 //----------------------------- CONFIG5H Options -------------------------------
3229 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3230 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3231 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3232 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3234 //----------------------------- CONFIG6L Options -------------------------------
3236 #define _WRT0_ON_6L 0xFE // Block 0 (000800-003FFFh) write-protected.
3237 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-003FFFh) not write-protected.
3238 #define _WRT1_ON_6L 0xFD // Block 1 (004000-007FFFh) write-protected.
3239 #define _WRT1_OFF_6L 0xFF // Block 1 (004000-007FFFh) not write-protected.
3240 #define _WRT2_ON_6L 0xFB // Block 2 (008000-00BFFFh) write-protected.
3241 #define _WRT2_OFF_6L 0xFF // Block 2 (008000-00BFFFh) not write-protected.
3242 #define _WRT3_ON_6L 0xF7 // Block 3 (00C000-00FFFFh) write-protected.
3243 #define _WRT3_OFF_6L 0xFF // Block 3 (00C000-00FFFFh) not write-protected.
3245 //----------------------------- CONFIG6H Options -------------------------------
3247 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3248 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3249 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0007FFh) write-protected.
3250 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0007FFh) 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 (000800-003FFFh) protected from table reads executed in other blocks.
3257 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-003FFFh) not protected from table reads executed in other blocks.
3258 #define _EBTR1_ON_7L 0xFD // Block 1 (004000-007FFFh) protected from table reads executed in other blocks.
3259 #define _EBTR1_OFF_7L 0xFF // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks.
3260 #define _EBTR2_ON_7L 0xFB // Block 2 (008000-00BFFFh) protected from table reads executed in other blocks.
3261 #define _EBTR2_OFF_7L 0xFF // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks.
3262 #define _EBTR3_ON_7L 0xF7 // Block 3 (00C000-00FFFFh) protected from table reads executed in other blocks.
3263 #define _EBTR3_OFF_7L 0xFF // Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks.
3265 //----------------------------- CONFIG7H Options -------------------------------
3267 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0007FFh) protected from table reads executed in other blocks.
3268 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks.
3270 //==============================================================================
3272 #define __DEVID1 0x3FFFFE
3273 #define __DEVID2 0x3FFFFF
3275 #define __IDLOC0 0x200000
3276 #define __IDLOC1 0x200001
3277 #define __IDLOC2 0x200002
3278 #define __IDLOC3 0x200003
3279 #define __IDLOC4 0x200004
3280 #define __IDLOC5 0x200005
3281 #define __IDLOC6 0x200006
3282 #define __IDLOC7 0x200007
3284 #endif // #ifndef __PIC18LF4620_H__