Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf4525.h
blobc337c29bc87e5633893726178545f00b1bf79213
1 /*
2 * This declarations of the PIC18LF4525 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:04 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 __PIC18LF4525_H__
26 #define __PIC18LF4525_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 RE3 : 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 RE : 4;
1085 unsigned : 4;
1088 struct
1090 unsigned TRISE : 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 _RE3 0x08
1104 #define _PSPMODE 0x10
1105 #define _IBOV 0x20
1106 #define _OBF 0x40
1107 #define _IBF 0x80
1109 //==============================================================================
1112 //==============================================================================
1113 // TRISE Bits
1115 extern __at(0x0F96) __sfr TRISE;
1117 typedef union
1119 struct
1121 unsigned TRISE0 : 1;
1122 unsigned TRISE1 : 1;
1123 unsigned TRISE2 : 1;
1124 unsigned RE3 : 1;
1125 unsigned PSPMODE : 1;
1126 unsigned IBOV : 1;
1127 unsigned OBF : 1;
1128 unsigned IBF : 1;
1131 struct
1133 unsigned RE0 : 1;
1134 unsigned RE1 : 1;
1135 unsigned RE2 : 1;
1136 unsigned : 1;
1137 unsigned : 1;
1138 unsigned : 1;
1139 unsigned : 1;
1140 unsigned : 1;
1143 struct
1145 unsigned RE : 4;
1146 unsigned : 4;
1149 struct
1151 unsigned TRISE : 3;
1152 unsigned : 5;
1154 } __TRISEbits_t;
1156 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1158 #define _TRISE_TRISE0 0x01
1159 #define _TRISE_RE0 0x01
1160 #define _TRISE_TRISE1 0x02
1161 #define _TRISE_RE1 0x02
1162 #define _TRISE_TRISE2 0x04
1163 #define _TRISE_RE2 0x04
1164 #define _TRISE_RE3 0x08
1165 #define _TRISE_PSPMODE 0x10
1166 #define _TRISE_IBOV 0x20
1167 #define _TRISE_OBF 0x40
1168 #define _TRISE_IBF 0x80
1170 //==============================================================================
1173 //==============================================================================
1174 // OSCTUNE Bits
1176 extern __at(0x0F9B) __sfr OSCTUNE;
1178 typedef union
1180 struct
1182 unsigned TUN0 : 1;
1183 unsigned TUN1 : 1;
1184 unsigned TUN2 : 1;
1185 unsigned TUN3 : 1;
1186 unsigned TUN4 : 1;
1187 unsigned : 1;
1188 unsigned PLLEN : 1;
1189 unsigned INTSRC : 1;
1192 struct
1194 unsigned TUN : 5;
1195 unsigned : 3;
1197 } __OSCTUNEbits_t;
1199 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1201 #define _TUN0 0x01
1202 #define _TUN1 0x02
1203 #define _TUN2 0x04
1204 #define _TUN3 0x08
1205 #define _TUN4 0x10
1206 #define _PLLEN 0x40
1207 #define _INTSRC 0x80
1209 //==============================================================================
1212 //==============================================================================
1213 // PIE1 Bits
1215 extern __at(0x0F9D) __sfr PIE1;
1217 typedef struct
1219 unsigned TMR1IE : 1;
1220 unsigned TMR2IE : 1;
1221 unsigned CCP1IE : 1;
1222 unsigned SSPIE : 1;
1223 unsigned TXIE : 1;
1224 unsigned RCIE : 1;
1225 unsigned ADIE : 1;
1226 unsigned PSPIE : 1;
1227 } __PIE1bits_t;
1229 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1231 #define _TMR1IE 0x01
1232 #define _TMR2IE 0x02
1233 #define _CCP1IE 0x04
1234 #define _SSPIE 0x08
1235 #define _TXIE 0x10
1236 #define _RCIE 0x20
1237 #define _ADIE 0x40
1238 #define _PSPIE 0x80
1240 //==============================================================================
1243 //==============================================================================
1244 // PIR1 Bits
1246 extern __at(0x0F9E) __sfr PIR1;
1248 typedef struct
1250 unsigned TMR1IF : 1;
1251 unsigned TMR2IF : 1;
1252 unsigned CCP1IF : 1;
1253 unsigned SSPIF : 1;
1254 unsigned TXIF : 1;
1255 unsigned RCIF : 1;
1256 unsigned ADIF : 1;
1257 unsigned PSPIF : 1;
1258 } __PIR1bits_t;
1260 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1262 #define _TMR1IF 0x01
1263 #define _TMR2IF 0x02
1264 #define _CCP1IF 0x04
1265 #define _SSPIF 0x08
1266 #define _TXIF 0x10
1267 #define _RCIF 0x20
1268 #define _ADIF 0x40
1269 #define _PSPIF 0x80
1271 //==============================================================================
1274 //==============================================================================
1275 // IPR1 Bits
1277 extern __at(0x0F9F) __sfr IPR1;
1279 typedef struct
1281 unsigned TMR1IP : 1;
1282 unsigned TMR2IP : 1;
1283 unsigned CCP1IP : 1;
1284 unsigned SSPIP : 1;
1285 unsigned TXIP : 1;
1286 unsigned RCIP : 1;
1287 unsigned ADIP : 1;
1288 unsigned PSPIP : 1;
1289 } __IPR1bits_t;
1291 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1293 #define _TMR1IP 0x01
1294 #define _TMR2IP 0x02
1295 #define _CCP1IP 0x04
1296 #define _SSPIP 0x08
1297 #define _TXIP 0x10
1298 #define _RCIP 0x20
1299 #define _ADIP 0x40
1300 #define _PSPIP 0x80
1302 //==============================================================================
1305 //==============================================================================
1306 // PIE2 Bits
1308 extern __at(0x0FA0) __sfr PIE2;
1310 typedef union
1312 struct
1314 unsigned CCP2IE : 1;
1315 unsigned TMR3IE : 1;
1316 unsigned HLVDIE : 1;
1317 unsigned BCLIE : 1;
1318 unsigned EEIE : 1;
1319 unsigned : 1;
1320 unsigned CMIE : 1;
1321 unsigned OSCFIE : 1;
1324 struct
1326 unsigned : 1;
1327 unsigned : 1;
1328 unsigned LVDIE : 1;
1329 unsigned : 1;
1330 unsigned : 1;
1331 unsigned : 1;
1332 unsigned : 1;
1333 unsigned : 1;
1335 } __PIE2bits_t;
1337 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1339 #define _CCP2IE 0x01
1340 #define _TMR3IE 0x02
1341 #define _HLVDIE 0x04
1342 #define _LVDIE 0x04
1343 #define _BCLIE 0x08
1344 #define _EEIE 0x10
1345 #define _CMIE 0x40
1346 #define _OSCFIE 0x80
1348 //==============================================================================
1351 //==============================================================================
1352 // PIR2 Bits
1354 extern __at(0x0FA1) __sfr PIR2;
1356 typedef union
1358 struct
1360 unsigned CCP2IF : 1;
1361 unsigned TMR3IF : 1;
1362 unsigned HLVDIF : 1;
1363 unsigned BCLIF : 1;
1364 unsigned EEIF : 1;
1365 unsigned : 1;
1366 unsigned CMIF : 1;
1367 unsigned OSCFIF : 1;
1370 struct
1372 unsigned : 1;
1373 unsigned : 1;
1374 unsigned LVDIF : 1;
1375 unsigned : 1;
1376 unsigned : 1;
1377 unsigned : 1;
1378 unsigned : 1;
1379 unsigned : 1;
1381 } __PIR2bits_t;
1383 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1385 #define _CCP2IF 0x01
1386 #define _TMR3IF 0x02
1387 #define _HLVDIF 0x04
1388 #define _LVDIF 0x04
1389 #define _BCLIF 0x08
1390 #define _EEIF 0x10
1391 #define _CMIF 0x40
1392 #define _OSCFIF 0x80
1394 //==============================================================================
1397 //==============================================================================
1398 // IPR2 Bits
1400 extern __at(0x0FA2) __sfr IPR2;
1402 typedef union
1404 struct
1406 unsigned CCP2IP : 1;
1407 unsigned TMR3IP : 1;
1408 unsigned HLVDIP : 1;
1409 unsigned BCLIP : 1;
1410 unsigned EEIP : 1;
1411 unsigned : 1;
1412 unsigned CMIP : 1;
1413 unsigned OSCFIP : 1;
1416 struct
1418 unsigned : 1;
1419 unsigned : 1;
1420 unsigned LVDIP : 1;
1421 unsigned : 1;
1422 unsigned : 1;
1423 unsigned : 1;
1424 unsigned : 1;
1425 unsigned : 1;
1427 } __IPR2bits_t;
1429 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1431 #define _CCP2IP 0x01
1432 #define _TMR3IP 0x02
1433 #define _HLVDIP 0x04
1434 #define _LVDIP 0x04
1435 #define _BCLIP 0x08
1436 #define _EEIP 0x10
1437 #define _CMIP 0x40
1438 #define _OSCFIP 0x80
1440 //==============================================================================
1443 //==============================================================================
1444 // EECON1 Bits
1446 extern __at(0x0FA6) __sfr EECON1;
1448 typedef struct
1450 unsigned RD : 1;
1451 unsigned WR : 1;
1452 unsigned WREN : 1;
1453 unsigned WRERR : 1;
1454 unsigned FREE : 1;
1455 unsigned : 1;
1456 unsigned CFGS : 1;
1457 unsigned EEPGD : 1;
1458 } __EECON1bits_t;
1460 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1462 #define _RD 0x01
1463 #define _WR 0x02
1464 #define _WREN 0x04
1465 #define _WRERR 0x08
1466 #define _FREE 0x10
1467 #define _CFGS 0x40
1468 #define _EEPGD 0x80
1470 //==============================================================================
1472 extern __at(0x0FA7) __sfr EECON2;
1473 extern __at(0x0FA8) __sfr EEDATA;
1474 extern __at(0x0FA9) __sfr EEADR;
1475 extern __at(0x0FAA) __sfr EEADRH;
1477 //==============================================================================
1478 // RCSTA Bits
1480 extern __at(0x0FAB) __sfr RCSTA;
1482 typedef union
1484 struct
1486 unsigned RX9D : 1;
1487 unsigned OERR : 1;
1488 unsigned FERR : 1;
1489 unsigned ADDEN : 1;
1490 unsigned CREN : 1;
1491 unsigned SREN : 1;
1492 unsigned RX9 : 1;
1493 unsigned SPEN : 1;
1496 struct
1498 unsigned : 1;
1499 unsigned : 1;
1500 unsigned : 1;
1501 unsigned ADEN : 1;
1502 unsigned : 1;
1503 unsigned : 1;
1504 unsigned : 1;
1505 unsigned : 1;
1507 } __RCSTAbits_t;
1509 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1511 #define _RX9D 0x01
1512 #define _OERR 0x02
1513 #define _FERR 0x04
1514 #define _ADDEN 0x08
1515 #define _ADEN 0x08
1516 #define _CREN 0x10
1517 #define _SREN 0x20
1518 #define _RX9 0x40
1519 #define _SPEN 0x80
1521 //==============================================================================
1524 //==============================================================================
1525 // TXSTA Bits
1527 extern __at(0x0FAC) __sfr TXSTA;
1529 typedef struct
1531 unsigned TX9D : 1;
1532 unsigned TRMT : 1;
1533 unsigned BRGH : 1;
1534 unsigned SENDB : 1;
1535 unsigned SYNC : 1;
1536 unsigned TXEN : 1;
1537 unsigned TX9 : 1;
1538 unsigned CSRC : 1;
1539 } __TXSTAbits_t;
1541 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1543 #define _TX9D 0x01
1544 #define _TRMT 0x02
1545 #define _BRGH 0x04
1546 #define _SENDB 0x08
1547 #define _SYNC 0x10
1548 #define _TXEN 0x20
1549 #define _TX9 0x40
1550 #define _CSRC 0x80
1552 //==============================================================================
1554 extern __at(0x0FAD) __sfr TXREG;
1555 extern __at(0x0FAE) __sfr RCREG;
1556 extern __at(0x0FAF) __sfr SPBRG;
1557 extern __at(0x0FB0) __sfr SPBRGH;
1559 //==============================================================================
1560 // T3CON Bits
1562 extern __at(0x0FB1) __sfr T3CON;
1564 typedef union
1566 struct
1568 unsigned TMR3ON : 1;
1569 unsigned TMR3CS : 1;
1570 unsigned NOT_T3SYNC : 1;
1571 unsigned T3CCP1 : 1;
1572 unsigned T3CKPS0 : 1;
1573 unsigned T3CKPS1 : 1;
1574 unsigned T3CCP2 : 1;
1575 unsigned RD16 : 1;
1578 struct
1580 unsigned : 1;
1581 unsigned : 1;
1582 unsigned T3SYNC : 1;
1583 unsigned : 1;
1584 unsigned : 1;
1585 unsigned : 1;
1586 unsigned : 1;
1587 unsigned : 1;
1590 struct
1592 unsigned : 4;
1593 unsigned T3CKPS : 2;
1594 unsigned : 2;
1596 } __T3CONbits_t;
1598 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1600 #define _T3CON_TMR3ON 0x01
1601 #define _T3CON_TMR3CS 0x02
1602 #define _T3CON_NOT_T3SYNC 0x04
1603 #define _T3CON_T3SYNC 0x04
1604 #define _T3CON_T3CCP1 0x08
1605 #define _T3CON_T3CKPS0 0x10
1606 #define _T3CON_T3CKPS1 0x20
1607 #define _T3CON_T3CCP2 0x40
1608 #define _T3CON_RD16 0x80
1610 //==============================================================================
1612 extern __at(0x0FB2) __sfr TMR3;
1613 extern __at(0x0FB2) __sfr TMR3L;
1614 extern __at(0x0FB3) __sfr TMR3H;
1616 //==============================================================================
1617 // CMCON Bits
1619 extern __at(0x0FB4) __sfr CMCON;
1621 typedef union
1623 struct
1625 unsigned CM0 : 1;
1626 unsigned CM1 : 1;
1627 unsigned CM2 : 1;
1628 unsigned CIS : 1;
1629 unsigned C1INV : 1;
1630 unsigned C2INV : 1;
1631 unsigned C1OUT : 1;
1632 unsigned C2OUT : 1;
1635 struct
1637 unsigned CM : 3;
1638 unsigned : 5;
1640 } __CMCONbits_t;
1642 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1644 #define _CM0 0x01
1645 #define _CM1 0x02
1646 #define _CM2 0x04
1647 #define _CIS 0x08
1648 #define _C1INV 0x10
1649 #define _C2INV 0x20
1650 #define _C1OUT 0x40
1651 #define _C2OUT 0x80
1653 //==============================================================================
1656 //==============================================================================
1657 // CVRCON Bits
1659 extern __at(0x0FB5) __sfr CVRCON;
1661 typedef union
1663 struct
1665 unsigned CVR0 : 1;
1666 unsigned CVR1 : 1;
1667 unsigned CVR2 : 1;
1668 unsigned CVR3 : 1;
1669 unsigned CVRSS : 1;
1670 unsigned CVRR : 1;
1671 unsigned CVROE : 1;
1672 unsigned CVREN : 1;
1675 struct
1677 unsigned CVR : 4;
1678 unsigned : 4;
1680 } __CVRCONbits_t;
1682 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1684 #define _CVR0 0x01
1685 #define _CVR1 0x02
1686 #define _CVR2 0x04
1687 #define _CVR3 0x08
1688 #define _CVRSS 0x10
1689 #define _CVRR 0x20
1690 #define _CVROE 0x40
1691 #define _CVREN 0x80
1693 //==============================================================================
1696 //==============================================================================
1697 // ECCP1AS Bits
1699 extern __at(0x0FB6) __sfr ECCP1AS;
1701 typedef union
1703 struct
1705 unsigned PSSBD0 : 1;
1706 unsigned PSSBD1 : 1;
1707 unsigned PSSAC0 : 1;
1708 unsigned PSSAC1 : 1;
1709 unsigned ECCPAS0 : 1;
1710 unsigned ECCPAS1 : 1;
1711 unsigned ECCPAS2 : 1;
1712 unsigned ECCPASE : 1;
1715 struct
1717 unsigned PSSBD : 2;
1718 unsigned : 6;
1721 struct
1723 unsigned : 2;
1724 unsigned PSSAC : 2;
1725 unsigned : 4;
1728 struct
1730 unsigned : 4;
1731 unsigned ECCPAS : 3;
1732 unsigned : 1;
1734 } __ECCP1ASbits_t;
1736 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1738 #define _PSSBD0 0x01
1739 #define _PSSBD1 0x02
1740 #define _PSSAC0 0x04
1741 #define _PSSAC1 0x08
1742 #define _ECCPAS0 0x10
1743 #define _ECCPAS1 0x20
1744 #define _ECCPAS2 0x40
1745 #define _ECCPASE 0x80
1747 //==============================================================================
1750 //==============================================================================
1751 // ECCPAS Bits
1753 extern __at(0x0FB6) __sfr ECCPAS;
1755 typedef union
1757 struct
1759 unsigned PSSBD0 : 1;
1760 unsigned PSSBD1 : 1;
1761 unsigned PSSAC0 : 1;
1762 unsigned PSSAC1 : 1;
1763 unsigned ECCPAS0 : 1;
1764 unsigned ECCPAS1 : 1;
1765 unsigned ECCPAS2 : 1;
1766 unsigned ECCPASE : 1;
1769 struct
1771 unsigned PSSBD : 2;
1772 unsigned : 6;
1775 struct
1777 unsigned : 2;
1778 unsigned PSSAC : 2;
1779 unsigned : 4;
1782 struct
1784 unsigned : 4;
1785 unsigned ECCPAS : 3;
1786 unsigned : 1;
1788 } __ECCPASbits_t;
1790 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1792 #define _ECCPAS_PSSBD0 0x01
1793 #define _ECCPAS_PSSBD1 0x02
1794 #define _ECCPAS_PSSAC0 0x04
1795 #define _ECCPAS_PSSAC1 0x08
1796 #define _ECCPAS_ECCPAS0 0x10
1797 #define _ECCPAS_ECCPAS1 0x20
1798 #define _ECCPAS_ECCPAS2 0x40
1799 #define _ECCPAS_ECCPASE 0x80
1801 //==============================================================================
1804 //==============================================================================
1805 // PWM1CON Bits
1807 extern __at(0x0FB7) __sfr PWM1CON;
1809 typedef union
1811 struct
1813 unsigned PDC0 : 1;
1814 unsigned PDC1 : 1;
1815 unsigned PDC2 : 1;
1816 unsigned PDC3 : 1;
1817 unsigned PDC4 : 1;
1818 unsigned PDC5 : 1;
1819 unsigned PDC6 : 1;
1820 unsigned PRSEN : 1;
1823 struct
1825 unsigned PDC : 7;
1826 unsigned : 1;
1828 } __PWM1CONbits_t;
1830 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1832 #define _PDC0 0x01
1833 #define _PDC1 0x02
1834 #define _PDC2 0x04
1835 #define _PDC3 0x08
1836 #define _PDC4 0x10
1837 #define _PDC5 0x20
1838 #define _PDC6 0x40
1839 #define _PRSEN 0x80
1841 //==============================================================================
1844 //==============================================================================
1845 // BAUDCON Bits
1847 extern __at(0x0FB8) __sfr BAUDCON;
1849 typedef union
1851 struct
1853 unsigned ABDEN : 1;
1854 unsigned WUE : 1;
1855 unsigned : 1;
1856 unsigned BRG16 : 1;
1857 unsigned TXCKP : 1;
1858 unsigned RXDTP : 1;
1859 unsigned RCIDL : 1;
1860 unsigned ABDOVF : 1;
1863 struct
1865 unsigned : 1;
1866 unsigned : 1;
1867 unsigned : 1;
1868 unsigned : 1;
1869 unsigned SCKP : 1;
1870 unsigned RXCKP : 1;
1871 unsigned RCMT : 1;
1872 unsigned : 1;
1874 } __BAUDCONbits_t;
1876 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1878 #define _ABDEN 0x01
1879 #define _WUE 0x02
1880 #define _BRG16 0x08
1881 #define _TXCKP 0x10
1882 #define _SCKP 0x10
1883 #define _RXDTP 0x20
1884 #define _RXCKP 0x20
1885 #define _RCIDL 0x40
1886 #define _RCMT 0x40
1887 #define _ABDOVF 0x80
1889 //==============================================================================
1892 //==============================================================================
1893 // BAUDCTL Bits
1895 extern __at(0x0FB8) __sfr BAUDCTL;
1897 typedef union
1899 struct
1901 unsigned ABDEN : 1;
1902 unsigned WUE : 1;
1903 unsigned : 1;
1904 unsigned BRG16 : 1;
1905 unsigned TXCKP : 1;
1906 unsigned RXDTP : 1;
1907 unsigned RCIDL : 1;
1908 unsigned ABDOVF : 1;
1911 struct
1913 unsigned : 1;
1914 unsigned : 1;
1915 unsigned : 1;
1916 unsigned : 1;
1917 unsigned SCKP : 1;
1918 unsigned RXCKP : 1;
1919 unsigned RCMT : 1;
1920 unsigned : 1;
1922 } __BAUDCTLbits_t;
1924 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1926 #define _BAUDCTL_ABDEN 0x01
1927 #define _BAUDCTL_WUE 0x02
1928 #define _BAUDCTL_BRG16 0x08
1929 #define _BAUDCTL_TXCKP 0x10
1930 #define _BAUDCTL_SCKP 0x10
1931 #define _BAUDCTL_RXDTP 0x20
1932 #define _BAUDCTL_RXCKP 0x20
1933 #define _BAUDCTL_RCIDL 0x40
1934 #define _BAUDCTL_RCMT 0x40
1935 #define _BAUDCTL_ABDOVF 0x80
1937 //==============================================================================
1940 //==============================================================================
1941 // CCP2CON Bits
1943 extern __at(0x0FBA) __sfr CCP2CON;
1945 typedef union
1947 struct
1949 unsigned CCP2M0 : 1;
1950 unsigned CCP2M1 : 1;
1951 unsigned CCP2M2 : 1;
1952 unsigned CCP2M3 : 1;
1953 unsigned CCP2Y : 1;
1954 unsigned CCP2X : 1;
1955 unsigned : 1;
1956 unsigned : 1;
1959 struct
1961 unsigned : 1;
1962 unsigned : 1;
1963 unsigned : 1;
1964 unsigned : 1;
1965 unsigned DC2B0 : 1;
1966 unsigned DC2B1 : 1;
1967 unsigned : 1;
1968 unsigned : 1;
1971 struct
1973 unsigned CCP2M : 4;
1974 unsigned : 4;
1977 struct
1979 unsigned : 4;
1980 unsigned DC2B : 2;
1981 unsigned : 2;
1983 } __CCP2CONbits_t;
1985 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1987 #define _CCP2M0 0x01
1988 #define _CCP2M1 0x02
1989 #define _CCP2M2 0x04
1990 #define _CCP2M3 0x08
1991 #define _CCP2Y 0x10
1992 #define _DC2B0 0x10
1993 #define _CCP2X 0x20
1994 #define _DC2B1 0x20
1996 //==============================================================================
1998 extern __at(0x0FBB) __sfr CCPR2;
1999 extern __at(0x0FBB) __sfr CCPR2L;
2000 extern __at(0x0FBC) __sfr CCPR2H;
2002 //==============================================================================
2003 // CCP1CON Bits
2005 extern __at(0x0FBD) __sfr CCP1CON;
2007 typedef union
2009 struct
2011 unsigned CCP1M0 : 1;
2012 unsigned CCP1M1 : 1;
2013 unsigned CCP1M2 : 1;
2014 unsigned CCP1M3 : 1;
2015 unsigned CCP1Y : 1;
2016 unsigned CCP1X : 1;
2017 unsigned P1M0 : 1;
2018 unsigned P1M1 : 1;
2021 struct
2023 unsigned : 1;
2024 unsigned : 1;
2025 unsigned : 1;
2026 unsigned : 1;
2027 unsigned DC1B0 : 1;
2028 unsigned DC1B1 : 1;
2029 unsigned : 1;
2030 unsigned : 1;
2033 struct
2035 unsigned CCP1M : 4;
2036 unsigned : 4;
2039 struct
2041 unsigned : 4;
2042 unsigned DC1B : 2;
2043 unsigned : 2;
2046 struct
2048 unsigned : 6;
2049 unsigned P1M : 2;
2051 } __CCP1CONbits_t;
2053 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2055 #define _CCP1M0 0x01
2056 #define _CCP1M1 0x02
2057 #define _CCP1M2 0x04
2058 #define _CCP1M3 0x08
2059 #define _CCP1Y 0x10
2060 #define _DC1B0 0x10
2061 #define _CCP1X 0x20
2062 #define _DC1B1 0x20
2063 #define _P1M0 0x40
2064 #define _P1M1 0x80
2066 //==============================================================================
2068 extern __at(0x0FBE) __sfr CCPR1;
2069 extern __at(0x0FBE) __sfr CCPR1L;
2070 extern __at(0x0FBF) __sfr CCPR1H;
2072 //==============================================================================
2073 // ADCON2 Bits
2075 extern __at(0x0FC0) __sfr ADCON2;
2077 typedef union
2079 struct
2081 unsigned ADCS0 : 1;
2082 unsigned ADCS1 : 1;
2083 unsigned ADCS2 : 1;
2084 unsigned ACQT0 : 1;
2085 unsigned ACQT1 : 1;
2086 unsigned ACQT2 : 1;
2087 unsigned : 1;
2088 unsigned ADFM : 1;
2091 struct
2093 unsigned ADCS : 3;
2094 unsigned : 5;
2097 struct
2099 unsigned : 3;
2100 unsigned ACQT : 3;
2101 unsigned : 2;
2103 } __ADCON2bits_t;
2105 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2107 #define _ADCS0 0x01
2108 #define _ADCS1 0x02
2109 #define _ADCS2 0x04
2110 #define _ACQT0 0x08
2111 #define _ACQT1 0x10
2112 #define _ACQT2 0x20
2113 #define _ADFM 0x80
2115 //==============================================================================
2118 //==============================================================================
2119 // ADCON1 Bits
2121 extern __at(0x0FC1) __sfr ADCON1;
2123 typedef union
2125 struct
2127 unsigned PCFG0 : 1;
2128 unsigned PCFG1 : 1;
2129 unsigned PCFG2 : 1;
2130 unsigned PCFG3 : 1;
2131 unsigned VCFG0 : 1;
2132 unsigned VCFG1 : 1;
2133 unsigned : 1;
2134 unsigned : 1;
2137 struct
2139 unsigned PCFG : 4;
2140 unsigned : 4;
2143 struct
2145 unsigned : 4;
2146 unsigned VCFG : 2;
2147 unsigned : 2;
2149 } __ADCON1bits_t;
2151 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2153 #define _PCFG0 0x01
2154 #define _PCFG1 0x02
2155 #define _PCFG2 0x04
2156 #define _PCFG3 0x08
2157 #define _VCFG0 0x10
2158 #define _VCFG1 0x20
2160 //==============================================================================
2163 //==============================================================================
2164 // ADCON0 Bits
2166 extern __at(0x0FC2) __sfr ADCON0;
2168 typedef union
2170 struct
2172 unsigned ADON : 1;
2173 unsigned GO_NOT_DONE : 1;
2174 unsigned CHS0 : 1;
2175 unsigned CHS1 : 1;
2176 unsigned CHS2 : 1;
2177 unsigned CHS3 : 1;
2178 unsigned : 1;
2179 unsigned : 1;
2182 struct
2184 unsigned : 1;
2185 unsigned GO : 1;
2186 unsigned : 1;
2187 unsigned : 1;
2188 unsigned : 1;
2189 unsigned : 1;
2190 unsigned : 1;
2191 unsigned : 1;
2194 struct
2196 unsigned : 1;
2197 unsigned DONE : 1;
2198 unsigned : 1;
2199 unsigned : 1;
2200 unsigned : 1;
2201 unsigned : 1;
2202 unsigned : 1;
2203 unsigned : 1;
2206 struct
2208 unsigned : 1;
2209 unsigned NOT_DONE : 1;
2210 unsigned : 1;
2211 unsigned : 1;
2212 unsigned : 1;
2213 unsigned : 1;
2214 unsigned : 1;
2215 unsigned : 1;
2218 struct
2220 unsigned : 1;
2221 unsigned GO_DONE : 1;
2222 unsigned : 1;
2223 unsigned : 1;
2224 unsigned : 1;
2225 unsigned : 1;
2226 unsigned : 1;
2227 unsigned : 1;
2230 struct
2232 unsigned : 2;
2233 unsigned CHS : 4;
2234 unsigned : 2;
2236 } __ADCON0bits_t;
2238 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2240 #define _ADON 0x01
2241 #define _GO_NOT_DONE 0x02
2242 #define _GO 0x02
2243 #define _DONE 0x02
2244 #define _NOT_DONE 0x02
2245 #define _GO_DONE 0x02
2246 #define _CHS0 0x04
2247 #define _CHS1 0x08
2248 #define _CHS2 0x10
2249 #define _CHS3 0x20
2251 //==============================================================================
2253 extern __at(0x0FC3) __sfr ADRES;
2254 extern __at(0x0FC3) __sfr ADRESL;
2255 extern __at(0x0FC4) __sfr ADRESH;
2257 //==============================================================================
2258 // SSPCON2 Bits
2260 extern __at(0x0FC5) __sfr SSPCON2;
2262 typedef struct
2264 unsigned SEN : 1;
2265 unsigned RSEN : 1;
2266 unsigned PEN : 1;
2267 unsigned RCEN : 1;
2268 unsigned ACKEN : 1;
2269 unsigned ACKDT : 1;
2270 unsigned ACKSTAT : 1;
2271 unsigned GCEN : 1;
2272 } __SSPCON2bits_t;
2274 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2276 #define _SEN 0x01
2277 #define _RSEN 0x02
2278 #define _PEN 0x04
2279 #define _RCEN 0x08
2280 #define _ACKEN 0x10
2281 #define _ACKDT 0x20
2282 #define _ACKSTAT 0x40
2283 #define _GCEN 0x80
2285 //==============================================================================
2288 //==============================================================================
2289 // SSPCON1 Bits
2291 extern __at(0x0FC6) __sfr SSPCON1;
2293 typedef union
2295 struct
2297 unsigned SSPM0 : 1;
2298 unsigned SSPM1 : 1;
2299 unsigned SSPM2 : 1;
2300 unsigned SSPM3 : 1;
2301 unsigned CKP : 1;
2302 unsigned SSPEN : 1;
2303 unsigned SSPOV : 1;
2304 unsigned WCOL : 1;
2307 struct
2309 unsigned SSPM : 4;
2310 unsigned : 4;
2312 } __SSPCON1bits_t;
2314 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2316 #define _SSPM0 0x01
2317 #define _SSPM1 0x02
2318 #define _SSPM2 0x04
2319 #define _SSPM3 0x08
2320 #define _CKP 0x10
2321 #define _SSPEN 0x20
2322 #define _SSPOV 0x40
2323 #define _WCOL 0x80
2325 //==============================================================================
2328 //==============================================================================
2329 // SSPSTAT Bits
2331 extern __at(0x0FC7) __sfr SSPSTAT;
2333 typedef union
2335 struct
2337 unsigned BF : 1;
2338 unsigned UA : 1;
2339 unsigned R_NOT_W : 1;
2340 unsigned S : 1;
2341 unsigned P : 1;
2342 unsigned D_NOT_A : 1;
2343 unsigned CKE : 1;
2344 unsigned SMP : 1;
2347 struct
2349 unsigned : 1;
2350 unsigned : 1;
2351 unsigned R : 1;
2352 unsigned : 1;
2353 unsigned : 1;
2354 unsigned D : 1;
2355 unsigned : 1;
2356 unsigned : 1;
2359 struct
2361 unsigned : 1;
2362 unsigned : 1;
2363 unsigned NOT_W : 1;
2364 unsigned : 1;
2365 unsigned : 1;
2366 unsigned NOT_A : 1;
2367 unsigned : 1;
2368 unsigned : 1;
2371 struct
2373 unsigned : 1;
2374 unsigned : 1;
2375 unsigned R_W : 1;
2376 unsigned : 1;
2377 unsigned : 1;
2378 unsigned D_A : 1;
2379 unsigned : 1;
2380 unsigned : 1;
2383 struct
2385 unsigned : 1;
2386 unsigned : 1;
2387 unsigned NOT_WRITE : 1;
2388 unsigned : 1;
2389 unsigned : 1;
2390 unsigned NOT_ADDRESS : 1;
2391 unsigned : 1;
2392 unsigned : 1;
2394 } __SSPSTATbits_t;
2396 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2398 #define _BF 0x01
2399 #define _UA 0x02
2400 #define _R_NOT_W 0x04
2401 #define _R 0x04
2402 #define _NOT_W 0x04
2403 #define _R_W 0x04
2404 #define _NOT_WRITE 0x04
2405 #define _S 0x08
2406 #define _P 0x10
2407 #define _D_NOT_A 0x20
2408 #define _D 0x20
2409 #define _NOT_A 0x20
2410 #define _D_A 0x20
2411 #define _NOT_ADDRESS 0x20
2412 #define _CKE 0x40
2413 #define _SMP 0x80
2415 //==============================================================================
2417 extern __at(0x0FC8) __sfr SSPADD;
2418 extern __at(0x0FC9) __sfr SSPBUF;
2420 //==============================================================================
2421 // T2CON Bits
2423 extern __at(0x0FCA) __sfr T2CON;
2425 typedef union
2427 struct
2429 unsigned T2CKPS0 : 1;
2430 unsigned T2CKPS1 : 1;
2431 unsigned TMR2ON : 1;
2432 unsigned T2OUTPS0 : 1;
2433 unsigned T2OUTPS1 : 1;
2434 unsigned T2OUTPS2 : 1;
2435 unsigned T2OUTPS3 : 1;
2436 unsigned : 1;
2439 struct
2441 unsigned : 1;
2442 unsigned : 1;
2443 unsigned : 1;
2444 unsigned TOUTPS0 : 1;
2445 unsigned TOUTPS1 : 1;
2446 unsigned TOUTPS2 : 1;
2447 unsigned TOUTPS3 : 1;
2448 unsigned : 1;
2451 struct
2453 unsigned T2CKPS : 2;
2454 unsigned : 6;
2457 struct
2459 unsigned : 3;
2460 unsigned T2OUTPS : 4;
2461 unsigned : 1;
2464 struct
2466 unsigned : 3;
2467 unsigned TOUTPS : 4;
2468 unsigned : 1;
2470 } __T2CONbits_t;
2472 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2474 #define _T2CKPS0 0x01
2475 #define _T2CKPS1 0x02
2476 #define _TMR2ON 0x04
2477 #define _T2OUTPS0 0x08
2478 #define _TOUTPS0 0x08
2479 #define _T2OUTPS1 0x10
2480 #define _TOUTPS1 0x10
2481 #define _T2OUTPS2 0x20
2482 #define _TOUTPS2 0x20
2483 #define _T2OUTPS3 0x40
2484 #define _TOUTPS3 0x40
2486 //==============================================================================
2488 extern __at(0x0FCB) __sfr PR2;
2489 extern __at(0x0FCC) __sfr TMR2;
2491 //==============================================================================
2492 // T1CON Bits
2494 extern __at(0x0FCD) __sfr T1CON;
2496 typedef union
2498 struct
2500 unsigned TMR1ON : 1;
2501 unsigned TMR1CS : 1;
2502 unsigned NOT_T1SYNC : 1;
2503 unsigned T1OSCEN : 1;
2504 unsigned T1CKPS0 : 1;
2505 unsigned T1CKPS1 : 1;
2506 unsigned T1RUN : 1;
2507 unsigned RD16 : 1;
2510 struct
2512 unsigned : 1;
2513 unsigned : 1;
2514 unsigned T1SYNC : 1;
2515 unsigned : 1;
2516 unsigned : 1;
2517 unsigned : 1;
2518 unsigned : 1;
2519 unsigned : 1;
2522 struct
2524 unsigned : 4;
2525 unsigned T1CKPS : 2;
2526 unsigned : 2;
2528 } __T1CONbits_t;
2530 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2532 #define _TMR1ON 0x01
2533 #define _TMR1CS 0x02
2534 #define _NOT_T1SYNC 0x04
2535 #define _T1SYNC 0x04
2536 #define _T1OSCEN 0x08
2537 #define _T1CKPS0 0x10
2538 #define _T1CKPS1 0x20
2539 #define _T1RUN 0x40
2540 #define _RD16 0x80
2542 //==============================================================================
2544 extern __at(0x0FCE) __sfr TMR1;
2545 extern __at(0x0FCE) __sfr TMR1L;
2546 extern __at(0x0FCF) __sfr TMR1H;
2548 //==============================================================================
2549 // RCON Bits
2551 extern __at(0x0FD0) __sfr RCON;
2553 typedef union
2555 struct
2557 unsigned NOT_BOR : 1;
2558 unsigned NOT_POR : 1;
2559 unsigned NOT_PD : 1;
2560 unsigned NOT_TO : 1;
2561 unsigned NOT_RI : 1;
2562 unsigned : 1;
2563 unsigned SBOREN : 1;
2564 unsigned IPEN : 1;
2567 struct
2569 unsigned BOR : 1;
2570 unsigned POR : 1;
2571 unsigned PD : 1;
2572 unsigned TO : 1;
2573 unsigned RI : 1;
2574 unsigned : 1;
2575 unsigned : 1;
2576 unsigned : 1;
2578 } __RCONbits_t;
2580 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2582 #define _NOT_BOR 0x01
2583 #define _BOR 0x01
2584 #define _NOT_POR 0x02
2585 #define _POR 0x02
2586 #define _NOT_PD 0x04
2587 #define _PD 0x04
2588 #define _NOT_TO 0x08
2589 #define _TO 0x08
2590 #define _NOT_RI 0x10
2591 #define _RI 0x10
2592 #define _SBOREN 0x40
2593 #define _IPEN 0x80
2595 //==============================================================================
2598 //==============================================================================
2599 // WDTCON Bits
2601 extern __at(0x0FD1) __sfr WDTCON;
2603 typedef union
2605 struct
2607 unsigned SWDTEN : 1;
2608 unsigned : 1;
2609 unsigned : 1;
2610 unsigned : 1;
2611 unsigned : 1;
2612 unsigned : 1;
2613 unsigned : 1;
2614 unsigned : 1;
2617 struct
2619 unsigned SWDTE : 1;
2620 unsigned : 1;
2621 unsigned : 1;
2622 unsigned : 1;
2623 unsigned : 1;
2624 unsigned : 1;
2625 unsigned : 1;
2626 unsigned : 1;
2628 } __WDTCONbits_t;
2630 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2632 #define _SWDTEN 0x01
2633 #define _SWDTE 0x01
2635 //==============================================================================
2638 //==============================================================================
2639 // HLVDCON Bits
2641 extern __at(0x0FD2) __sfr HLVDCON;
2643 typedef union
2645 struct
2647 unsigned HLVDL0 : 1;
2648 unsigned HLVDL1 : 1;
2649 unsigned HLVDL2 : 1;
2650 unsigned HLVDL3 : 1;
2651 unsigned HLVDEN : 1;
2652 unsigned IVRST : 1;
2653 unsigned : 1;
2654 unsigned VDIRMAG : 1;
2657 struct
2659 unsigned LVDL0 : 1;
2660 unsigned LVDL1 : 1;
2661 unsigned LVDL2 : 1;
2662 unsigned LVDL3 : 1;
2663 unsigned LVDEN : 1;
2664 unsigned IRVST : 1;
2665 unsigned : 1;
2666 unsigned : 1;
2669 struct
2671 unsigned LVV0 : 1;
2672 unsigned LVV1 : 1;
2673 unsigned LVV2 : 1;
2674 unsigned LVV3 : 1;
2675 unsigned : 1;
2676 unsigned BGST : 1;
2677 unsigned : 1;
2678 unsigned : 1;
2681 struct
2683 unsigned HLVDL : 4;
2684 unsigned : 4;
2687 struct
2689 unsigned LVV : 4;
2690 unsigned : 4;
2693 struct
2695 unsigned LVDL : 4;
2696 unsigned : 4;
2698 } __HLVDCONbits_t;
2700 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2702 #define _HLVDL0 0x01
2703 #define _LVDL0 0x01
2704 #define _LVV0 0x01
2705 #define _HLVDL1 0x02
2706 #define _LVDL1 0x02
2707 #define _LVV1 0x02
2708 #define _HLVDL2 0x04
2709 #define _LVDL2 0x04
2710 #define _LVV2 0x04
2711 #define _HLVDL3 0x08
2712 #define _LVDL3 0x08
2713 #define _LVV3 0x08
2714 #define _HLVDEN 0x10
2715 #define _LVDEN 0x10
2716 #define _IVRST 0x20
2717 #define _IRVST 0x20
2718 #define _BGST 0x20
2719 #define _VDIRMAG 0x80
2721 //==============================================================================
2724 //==============================================================================
2725 // LVDCON Bits
2727 extern __at(0x0FD2) __sfr LVDCON;
2729 typedef union
2731 struct
2733 unsigned HLVDL0 : 1;
2734 unsigned HLVDL1 : 1;
2735 unsigned HLVDL2 : 1;
2736 unsigned HLVDL3 : 1;
2737 unsigned HLVDEN : 1;
2738 unsigned IVRST : 1;
2739 unsigned : 1;
2740 unsigned VDIRMAG : 1;
2743 struct
2745 unsigned LVDL0 : 1;
2746 unsigned LVDL1 : 1;
2747 unsigned LVDL2 : 1;
2748 unsigned LVDL3 : 1;
2749 unsigned LVDEN : 1;
2750 unsigned IRVST : 1;
2751 unsigned : 1;
2752 unsigned : 1;
2755 struct
2757 unsigned LVV0 : 1;
2758 unsigned LVV1 : 1;
2759 unsigned LVV2 : 1;
2760 unsigned LVV3 : 1;
2761 unsigned : 1;
2762 unsigned BGST : 1;
2763 unsigned : 1;
2764 unsigned : 1;
2767 struct
2769 unsigned HLVDL : 4;
2770 unsigned : 4;
2773 struct
2775 unsigned LVDL : 4;
2776 unsigned : 4;
2779 struct
2781 unsigned LVV : 4;
2782 unsigned : 4;
2784 } __LVDCONbits_t;
2786 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2788 #define _LVDCON_HLVDL0 0x01
2789 #define _LVDCON_LVDL0 0x01
2790 #define _LVDCON_LVV0 0x01
2791 #define _LVDCON_HLVDL1 0x02
2792 #define _LVDCON_LVDL1 0x02
2793 #define _LVDCON_LVV1 0x02
2794 #define _LVDCON_HLVDL2 0x04
2795 #define _LVDCON_LVDL2 0x04
2796 #define _LVDCON_LVV2 0x04
2797 #define _LVDCON_HLVDL3 0x08
2798 #define _LVDCON_LVDL3 0x08
2799 #define _LVDCON_LVV3 0x08
2800 #define _LVDCON_HLVDEN 0x10
2801 #define _LVDCON_LVDEN 0x10
2802 #define _LVDCON_IVRST 0x20
2803 #define _LVDCON_IRVST 0x20
2804 #define _LVDCON_BGST 0x20
2805 #define _LVDCON_VDIRMAG 0x80
2807 //==============================================================================
2810 //==============================================================================
2811 // OSCCON Bits
2813 extern __at(0x0FD3) __sfr OSCCON;
2815 typedef union
2817 struct
2819 unsigned SCS0 : 1;
2820 unsigned SCS1 : 1;
2821 unsigned IOFS : 1;
2822 unsigned OSTS : 1;
2823 unsigned IRCF0 : 1;
2824 unsigned IRCF1 : 1;
2825 unsigned IRCF2 : 1;
2826 unsigned IDLEN : 1;
2829 struct
2831 unsigned : 1;
2832 unsigned : 1;
2833 unsigned FLTS : 1;
2834 unsigned : 1;
2835 unsigned : 1;
2836 unsigned : 1;
2837 unsigned : 1;
2838 unsigned : 1;
2841 struct
2843 unsigned SCS : 2;
2844 unsigned : 6;
2847 struct
2849 unsigned : 4;
2850 unsigned IRCF : 3;
2851 unsigned : 1;
2853 } __OSCCONbits_t;
2855 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2857 #define _SCS0 0x01
2858 #define _SCS1 0x02
2859 #define _IOFS 0x04
2860 #define _FLTS 0x04
2861 #define _OSTS 0x08
2862 #define _IRCF0 0x10
2863 #define _IRCF1 0x20
2864 #define _IRCF2 0x40
2865 #define _IDLEN 0x80
2867 //==============================================================================
2870 //==============================================================================
2871 // T0CON Bits
2873 extern __at(0x0FD5) __sfr T0CON;
2875 typedef union
2877 struct
2879 unsigned T0PS0 : 1;
2880 unsigned T0PS1 : 1;
2881 unsigned T0PS2 : 1;
2882 unsigned PSA : 1;
2883 unsigned T0SE : 1;
2884 unsigned T0CS : 1;
2885 unsigned T08BIT : 1;
2886 unsigned TMR0ON : 1;
2889 struct
2891 unsigned : 1;
2892 unsigned : 1;
2893 unsigned : 1;
2894 unsigned : 1;
2895 unsigned : 1;
2896 unsigned : 1;
2897 unsigned T016BIT : 1;
2898 unsigned : 1;
2901 struct
2903 unsigned T0PS : 3;
2904 unsigned : 5;
2906 } __T0CONbits_t;
2908 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2910 #define _T0PS0 0x01
2911 #define _T0PS1 0x02
2912 #define _T0PS2 0x04
2913 #define _PSA 0x08
2914 #define _T0SE 0x10
2915 #define _T0CS 0x20
2916 #define _T08BIT 0x40
2917 #define _T016BIT 0x40
2918 #define _TMR0ON 0x80
2920 //==============================================================================
2922 extern __at(0x0FD6) __sfr TMR0;
2923 extern __at(0x0FD6) __sfr TMR0L;
2924 extern __at(0x0FD7) __sfr TMR0H;
2926 //==============================================================================
2927 // STATUS Bits
2929 extern __at(0x0FD8) __sfr STATUS;
2931 typedef struct
2933 unsigned C : 1;
2934 unsigned DC : 1;
2935 unsigned Z : 1;
2936 unsigned OV : 1;
2937 unsigned N : 1;
2938 unsigned : 1;
2939 unsigned : 1;
2940 unsigned : 1;
2941 } __STATUSbits_t;
2943 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2945 #define _C 0x01
2946 #define _DC 0x02
2947 #define _Z 0x04
2948 #define _OV 0x08
2949 #define _N 0x10
2951 //==============================================================================
2953 extern __at(0x0FD9) __sfr FSR2L;
2954 extern __at(0x0FDA) __sfr FSR2H;
2955 extern __at(0x0FDB) __sfr PLUSW2;
2956 extern __at(0x0FDC) __sfr PREINC2;
2957 extern __at(0x0FDD) __sfr POSTDEC2;
2958 extern __at(0x0FDE) __sfr POSTINC2;
2959 extern __at(0x0FDF) __sfr INDF2;
2960 extern __at(0x0FE0) __sfr BSR;
2961 extern __at(0x0FE1) __sfr FSR1L;
2962 extern __at(0x0FE2) __sfr FSR1H;
2963 extern __at(0x0FE3) __sfr PLUSW1;
2964 extern __at(0x0FE4) __sfr PREINC1;
2965 extern __at(0x0FE5) __sfr POSTDEC1;
2966 extern __at(0x0FE6) __sfr POSTINC1;
2967 extern __at(0x0FE7) __sfr INDF1;
2968 extern __at(0x0FE8) __sfr WREG;
2969 extern __at(0x0FE9) __sfr FSR0L;
2970 extern __at(0x0FEA) __sfr FSR0H;
2971 extern __at(0x0FEB) __sfr PLUSW0;
2972 extern __at(0x0FEC) __sfr PREINC0;
2973 extern __at(0x0FED) __sfr POSTDEC0;
2974 extern __at(0x0FEE) __sfr POSTINC0;
2975 extern __at(0x0FEF) __sfr INDF0;
2977 //==============================================================================
2978 // INTCON3 Bits
2980 extern __at(0x0FF0) __sfr INTCON3;
2982 typedef union
2984 struct
2986 unsigned INT1IF : 1;
2987 unsigned INT2IF : 1;
2988 unsigned : 1;
2989 unsigned INT1IE : 1;
2990 unsigned INT2IE : 1;
2991 unsigned : 1;
2992 unsigned INT1IP : 1;
2993 unsigned INT2IP : 1;
2996 struct
2998 unsigned INT1F : 1;
2999 unsigned INT2F : 1;
3000 unsigned : 1;
3001 unsigned INT1E : 1;
3002 unsigned INT2E : 1;
3003 unsigned : 1;
3004 unsigned INT1P : 1;
3005 unsigned INT2P : 1;
3007 } __INTCON3bits_t;
3009 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
3011 #define _INT1IF 0x01
3012 #define _INT1F 0x01
3013 #define _INT2IF 0x02
3014 #define _INT2F 0x02
3015 #define _INT1IE 0x08
3016 #define _INT1E 0x08
3017 #define _INT2IE 0x10
3018 #define _INT2E 0x10
3019 #define _INT1IP 0x40
3020 #define _INT1P 0x40
3021 #define _INT2IP 0x80
3022 #define _INT2P 0x80
3024 //==============================================================================
3027 //==============================================================================
3028 // INTCON2 Bits
3030 extern __at(0x0FF1) __sfr INTCON2;
3032 typedef union
3034 struct
3036 unsigned RBIP : 1;
3037 unsigned : 1;
3038 unsigned TMR0IP : 1;
3039 unsigned : 1;
3040 unsigned INTEDG2 : 1;
3041 unsigned INTEDG1 : 1;
3042 unsigned INTEDG0 : 1;
3043 unsigned NOT_RBPU : 1;
3046 struct
3048 unsigned : 1;
3049 unsigned : 1;
3050 unsigned : 1;
3051 unsigned : 1;
3052 unsigned : 1;
3053 unsigned : 1;
3054 unsigned : 1;
3055 unsigned RBPU : 1;
3057 } __INTCON2bits_t;
3059 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
3061 #define _RBIP 0x01
3062 #define _TMR0IP 0x04
3063 #define _INTEDG2 0x10
3064 #define _INTEDG1 0x20
3065 #define _INTEDG0 0x40
3066 #define _NOT_RBPU 0x80
3067 #define _RBPU 0x80
3069 //==============================================================================
3072 //==============================================================================
3073 // INTCON Bits
3075 extern __at(0x0FF2) __sfr INTCON;
3077 typedef union
3079 struct
3081 unsigned RBIF : 1;
3082 unsigned INT0IF : 1;
3083 unsigned TMR0IF : 1;
3084 unsigned RBIE : 1;
3085 unsigned INT0IE : 1;
3086 unsigned TMR0IE : 1;
3087 unsigned PEIE_GIEL : 1;
3088 unsigned GIE_GIEH : 1;
3091 struct
3093 unsigned : 1;
3094 unsigned INT0F : 1;
3095 unsigned T0IF : 1;
3096 unsigned : 1;
3097 unsigned INT0E : 1;
3098 unsigned T0IE : 1;
3099 unsigned PEIE : 1;
3100 unsigned GIE : 1;
3103 struct
3105 unsigned : 1;
3106 unsigned : 1;
3107 unsigned : 1;
3108 unsigned : 1;
3109 unsigned : 1;
3110 unsigned : 1;
3111 unsigned GIEL : 1;
3112 unsigned GIEH : 1;
3114 } __INTCONbits_t;
3116 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3118 #define _RBIF 0x01
3119 #define _INT0IF 0x02
3120 #define _INT0F 0x02
3121 #define _TMR0IF 0x04
3122 #define _T0IF 0x04
3123 #define _RBIE 0x08
3124 #define _INT0IE 0x10
3125 #define _INT0E 0x10
3126 #define _TMR0IE 0x20
3127 #define _T0IE 0x20
3128 #define _PEIE_GIEL 0x40
3129 #define _PEIE 0x40
3130 #define _GIEL 0x40
3131 #define _GIE_GIEH 0x80
3132 #define _GIE 0x80
3133 #define _GIEH 0x80
3135 //==============================================================================
3137 extern __at(0x0FF3) __sfr PROD;
3138 extern __at(0x0FF3) __sfr PRODL;
3139 extern __at(0x0FF4) __sfr PRODH;
3140 extern __at(0x0FF5) __sfr TABLAT;
3141 extern __at(0x0FF6) __sfr TBLPTR;
3142 extern __at(0x0FF6) __sfr TBLPTRL;
3143 extern __at(0x0FF7) __sfr TBLPTRH;
3144 extern __at(0x0FF8) __sfr TBLPTRU;
3145 extern __at(0x0FF9) __sfr PC;
3146 extern __at(0x0FF9) __sfr PCL;
3147 extern __at(0x0FFA) __sfr PCLATH;
3148 extern __at(0x0FFB) __sfr PCLATU;
3150 //==============================================================================
3151 // STKPTR Bits
3153 extern __at(0x0FFC) __sfr STKPTR;
3155 typedef union
3157 struct
3159 unsigned STKPTR0 : 1;
3160 unsigned STKPTR1 : 1;
3161 unsigned STKPTR2 : 1;
3162 unsigned STKPTR3 : 1;
3163 unsigned STKPTR4 : 1;
3164 unsigned : 1;
3165 unsigned STKUNF : 1;
3166 unsigned STKFUL : 1;
3169 struct
3171 unsigned SP0 : 1;
3172 unsigned SP1 : 1;
3173 unsigned SP2 : 1;
3174 unsigned SP3 : 1;
3175 unsigned SP4 : 1;
3176 unsigned : 1;
3177 unsigned : 1;
3178 unsigned STKOVF : 1;
3181 struct
3183 unsigned STKPTR : 5;
3184 unsigned : 3;
3187 struct
3189 unsigned SP : 5;
3190 unsigned : 3;
3192 } __STKPTRbits_t;
3194 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3196 #define _STKPTR0 0x01
3197 #define _SP0 0x01
3198 #define _STKPTR1 0x02
3199 #define _SP1 0x02
3200 #define _STKPTR2 0x04
3201 #define _SP2 0x04
3202 #define _STKPTR3 0x08
3203 #define _SP3 0x08
3204 #define _STKPTR4 0x10
3205 #define _SP4 0x10
3206 #define _STKUNF 0x40
3207 #define _STKFUL 0x80
3208 #define _STKOVF 0x80
3210 //==============================================================================
3212 extern __at(0x0FFD) __sfr TOS;
3213 extern __at(0x0FFD) __sfr TOSL;
3214 extern __at(0x0FFE) __sfr TOSH;
3215 extern __at(0x0FFF) __sfr TOSU;
3217 //==============================================================================
3219 // Configuration Bits
3221 //==============================================================================
3223 #define __CONFIG1H 0x300001
3224 #define __CONFIG2L 0x300002
3225 #define __CONFIG2H 0x300003
3226 #define __CONFIG3H 0x300005
3227 #define __CONFIG4L 0x300006
3228 #define __CONFIG5L 0x300008
3229 #define __CONFIG5H 0x300009
3230 #define __CONFIG6L 0x30000A
3231 #define __CONFIG6H 0x30000B
3232 #define __CONFIG7L 0x30000C
3233 #define __CONFIG7H 0x30000D
3235 //----------------------------- CONFIG1H Options -------------------------------
3237 #define _OSC_LP_1H 0xF0 // LP oscillator.
3238 #define _OSC_XT_1H 0xF1 // XT oscillator.
3239 #define _OSC_HS_1H 0xF2 // HS oscillator.
3240 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
3241 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKOUT function on RA6.
3242 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
3243 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3244 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
3245 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
3246 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKOUT function on RA6, port function on RA7.
3247 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3248 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3249 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3250 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3252 //----------------------------- CONFIG2L Options -------------------------------
3254 #define _PWRT_ON_2L 0xFE // PWRT enabled.
3255 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
3256 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3257 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3258 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3259 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3260 #define _BORV_0_2L 0xE7 // Maximum setting.
3261 #define _BORV_1_2L 0xEF
3262 #define _BORV_2_2L 0xF7
3263 #define _BORV_3_2L 0xFF // Minimum setting.
3265 //----------------------------- CONFIG2H Options -------------------------------
3267 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
3268 #define _WDT_ON_2H 0xFF // WDT enabled.
3269 #define _WDTPS_1_2H 0xE1 // 1:1.
3270 #define _WDTPS_2_2H 0xE3 // 1:2.
3271 #define _WDTPS_4_2H 0xE5 // 1:4.
3272 #define _WDTPS_8_2H 0xE7 // 1:8.
3273 #define _WDTPS_16_2H 0xE9 // 1:16.
3274 #define _WDTPS_32_2H 0xEB // 1:32.
3275 #define _WDTPS_64_2H 0xED // 1:64.
3276 #define _WDTPS_128_2H 0xEF // 1:128.
3277 #define _WDTPS_256_2H 0xF1 // 1:256.
3278 #define _WDTPS_512_2H 0xF3 // 1:512.
3279 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3280 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3281 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3282 #define _WDTPS_8192_2H 0xFB // 1:8192.
3283 #define _WDTPS_16384_2H 0xFD // 1:16384.
3284 #define _WDTPS_32768_2H 0xFF // 1:32768.
3286 //----------------------------- CONFIG3H Options -------------------------------
3288 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3289 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3290 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3291 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3292 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3293 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3294 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3295 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3297 //----------------------------- CONFIG4L Options -------------------------------
3299 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3300 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3301 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3302 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3303 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3304 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3305 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3306 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3308 //----------------------------- CONFIG5L Options -------------------------------
3310 #define _CP0_ON_5L 0xFE // Block 0 (000800-003FFFh) code-protected.
3311 #define _CP0_OFF_5L 0xFF // Block 0 (000800-003FFFh) not code-protected.
3312 #define _CP1_ON_5L 0xFD // Block 1 (004000-007FFFh) code-protected.
3313 #define _CP1_OFF_5L 0xFF // Block 1 (004000-007FFFh) not code-protected.
3314 #define _CP2_ON_5L 0xFB // Block 2 (008000-00BFFFh) code-protected.
3315 #define _CP2_OFF_5L 0xFF // Block 2 (008000-00BFFFh) not code-protected.
3317 //----------------------------- CONFIG5H Options -------------------------------
3319 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3320 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3321 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3322 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3324 //----------------------------- CONFIG6L Options -------------------------------
3326 #define _WRT0_ON_6L 0xFE // Block 0 (000800-003FFFh) write-protected.
3327 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-003FFFh) not write-protected.
3328 #define _WRT1_ON_6L 0xFD // Block 1 (004000-007FFFh) write-protected.
3329 #define _WRT1_OFF_6L 0xFF // Block 1 (004000-007FFFh) not write-protected.
3330 #define _WRT2_ON_6L 0xFB // Block 2 (008000-00BFFFh) write-protected.
3331 #define _WRT2_OFF_6L 0xFF // Block 2 (008000-00BFFFh) not write-protected.
3333 //----------------------------- CONFIG6H Options -------------------------------
3335 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3336 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3337 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0007FFh) write-protected.
3338 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0007FFh) not write-protected.
3339 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3340 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3342 //----------------------------- CONFIG7L Options -------------------------------
3344 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-003FFFh) protected from table reads executed in other blocks.
3345 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-003FFFh) not protected from table reads executed in other blocks.
3346 #define _EBTR1_ON_7L 0xFD // Block 1 (004000-007FFFh) protected from table reads executed in other blocks.
3347 #define _EBTR1_OFF_7L 0xFF // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks.
3348 #define _EBTR2_ON_7L 0xFB // Block 2 (008000-00BFFFh) protected from table reads executed in other blocks.
3349 #define _EBTR2_OFF_7L 0xFF // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks.
3351 //----------------------------- CONFIG7H Options -------------------------------
3353 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0007FFh) protected from table reads executed in other blocks.
3354 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks.
3356 //==============================================================================
3358 #define __DEVID1 0x3FFFFE
3359 #define __DEVID2 0x3FFFFF
3361 #define __IDLOC0 0x200000
3362 #define __IDLOC1 0x200001
3363 #define __IDLOC2 0x200002
3364 #define __IDLOC3 0x200003
3365 #define __IDLOC4 0x200004
3366 #define __IDLOC5 0x200005
3367 #define __IDLOC6 0x200006
3368 #define __IDLOC7 0x200007
3370 #endif // #ifndef __PIC18LF4525_H__