Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf4510.h
blobe0a2e6b249a7d01754509c765e52f6583d1e14d2
1 /*
2 * This declarations of the PIC18LF4510 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:03 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 __PIC18LF4510_H__
26 #define __PIC18LF4510_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 AN0 : 1;
59 unsigned AN1 : 1;
60 unsigned AN2 : 1;
61 unsigned AN3 : 1;
62 unsigned T0CKI : 1;
63 unsigned AN4 : 1;
64 unsigned OSC2 : 1;
65 unsigned OSC1 : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned VREFN : 1;
73 unsigned VREFP : 1;
74 unsigned : 1;
75 unsigned SS : 1;
76 unsigned CLKO : 1;
77 unsigned CLKI : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned CVREF : 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_AN0 0x01
121 #define _PORTA_RA1 0x02
122 #define _PORTA_AN1 0x02
123 #define _PORTA_RA2 0x04
124 #define _PORTA_AN2 0x04
125 #define _PORTA_VREFN 0x04
126 #define _PORTA_CVREF 0x04
127 #define _PORTA_RA3 0x08
128 #define _PORTA_AN3 0x08
129 #define _PORTA_VREFP 0x08
130 #define _PORTA_RA4 0x10
131 #define _PORTA_T0CKI 0x10
132 #define _PORTA_RA5 0x20
133 #define _PORTA_AN4 0x20
134 #define _PORTA_SS 0x20
135 #define _PORTA_NOT_SS 0x20
136 #define _PORTA_LVDIN 0x20
137 #define _PORTA_HLVDIN 0x20
138 #define _PORTA_RA6 0x40
139 #define _PORTA_OSC2 0x40
140 #define _PORTA_CLKO 0x40
141 #define _PORTA_RA7 0x80
142 #define _PORTA_OSC1 0x80
143 #define _PORTA_CLKI 0x80
145 //==============================================================================
148 //==============================================================================
149 // PORTB Bits
151 extern __at(0x0F81) __sfr PORTB;
153 typedef union
155 struct
157 unsigned RB0 : 1;
158 unsigned RB1 : 1;
159 unsigned RB2 : 1;
160 unsigned RB3 : 1;
161 unsigned RB4 : 1;
162 unsigned RB5 : 1;
163 unsigned RB6 : 1;
164 unsigned RB7 : 1;
167 struct
169 unsigned INT0 : 1;
170 unsigned INT1 : 1;
171 unsigned INT2 : 1;
172 unsigned CCP2 : 1;
173 unsigned KBI0 : 1;
174 unsigned KBI1 : 1;
175 unsigned KBI2 : 1;
176 unsigned KBI3 : 1;
179 struct
181 unsigned AN12 : 1;
182 unsigned AN10 : 1;
183 unsigned AN8 : 1;
184 unsigned AN9 : 1;
185 unsigned AN11 : 1;
186 unsigned PGM : 1;
187 unsigned PGC : 1;
188 unsigned PGD : 1;
191 struct
193 unsigned INT : 3;
194 unsigned : 5;
197 struct
199 unsigned : 4;
200 unsigned KBI : 4;
202 } __PORTBbits_t;
204 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
206 #define _PORTB_RB0 0x01
207 #define _PORTB_INT0 0x01
208 #define _PORTB_AN12 0x01
209 #define _PORTB_RB1 0x02
210 #define _PORTB_INT1 0x02
211 #define _PORTB_AN10 0x02
212 #define _PORTB_RB2 0x04
213 #define _PORTB_INT2 0x04
214 #define _PORTB_AN8 0x04
215 #define _PORTB_RB3 0x08
216 #define _PORTB_CCP2 0x08
217 #define _PORTB_AN9 0x08
218 #define _PORTB_RB4 0x10
219 #define _PORTB_KBI0 0x10
220 #define _PORTB_AN11 0x10
221 #define _PORTB_RB5 0x20
222 #define _PORTB_KBI1 0x20
223 #define _PORTB_PGM 0x20
224 #define _PORTB_RB6 0x40
225 #define _PORTB_KBI2 0x40
226 #define _PORTB_PGC 0x40
227 #define _PORTB_RB7 0x80
228 #define _PORTB_KBI3 0x80
229 #define _PORTB_PGD 0x80
231 //==============================================================================
234 //==============================================================================
235 // PORTC Bits
237 extern __at(0x0F82) __sfr PORTC;
239 typedef union
241 struct
243 unsigned RC0 : 1;
244 unsigned RC1 : 1;
245 unsigned RC2 : 1;
246 unsigned RC3 : 1;
247 unsigned RC4 : 1;
248 unsigned RC5 : 1;
249 unsigned RC6 : 1;
250 unsigned RC7 : 1;
253 struct
255 unsigned T1OSO : 1;
256 unsigned T1OSI : 1;
257 unsigned CCP1 : 1;
258 unsigned SCK : 1;
259 unsigned SDI : 1;
260 unsigned SDO : 1;
261 unsigned TX : 1;
262 unsigned RX : 1;
265 struct
267 unsigned T13CKI : 1;
268 unsigned CCP2 : 1;
269 unsigned : 1;
270 unsigned SCL : 1;
271 unsigned SDA : 1;
272 unsigned : 1;
273 unsigned CK : 1;
274 unsigned : 1;
277 struct
279 unsigned T1CKI : 1;
280 unsigned : 1;
281 unsigned : 1;
282 unsigned : 1;
283 unsigned : 1;
284 unsigned : 1;
285 unsigned : 1;
286 unsigned : 1;
288 } __PORTCbits_t;
290 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
292 #define _PORTC_RC0 0x01
293 #define _PORTC_T1OSO 0x01
294 #define _PORTC_T13CKI 0x01
295 #define _PORTC_T1CKI 0x01
296 #define _PORTC_RC1 0x02
297 #define _PORTC_T1OSI 0x02
298 #define _PORTC_CCP2 0x02
299 #define _PORTC_RC2 0x04
300 #define _PORTC_CCP1 0x04
301 #define _PORTC_RC3 0x08
302 #define _PORTC_SCK 0x08
303 #define _PORTC_SCL 0x08
304 #define _PORTC_RC4 0x10
305 #define _PORTC_SDI 0x10
306 #define _PORTC_SDA 0x10
307 #define _PORTC_RC5 0x20
308 #define _PORTC_SDO 0x20
309 #define _PORTC_RC6 0x40
310 #define _PORTC_TX 0x40
311 #define _PORTC_CK 0x40
312 #define _PORTC_RC7 0x80
313 #define _PORTC_RX 0x80
315 //==============================================================================
318 //==============================================================================
319 // PORTD Bits
321 extern __at(0x0F83) __sfr PORTD;
323 typedef union
325 struct
327 unsigned RD0 : 1;
328 unsigned RD1 : 1;
329 unsigned RD2 : 1;
330 unsigned RD3 : 1;
331 unsigned RD4 : 1;
332 unsigned RD5 : 1;
333 unsigned RD6 : 1;
334 unsigned RD7 : 1;
337 struct
339 unsigned PSP0 : 1;
340 unsigned PSP1 : 1;
341 unsigned PSP2 : 1;
342 unsigned PSP3 : 1;
343 unsigned PSP4 : 1;
344 unsigned PSP5 : 1;
345 unsigned PSP6 : 1;
346 unsigned PSP7 : 1;
349 struct
351 unsigned : 1;
352 unsigned : 1;
353 unsigned : 1;
354 unsigned : 1;
355 unsigned : 1;
356 unsigned P1B : 1;
357 unsigned P1C : 1;
358 unsigned P1D : 1;
360 } __PORTDbits_t;
362 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
364 #define _PORTD_RD0 0x01
365 #define _PORTD_PSP0 0x01
366 #define _PORTD_RD1 0x02
367 #define _PORTD_PSP1 0x02
368 #define _PORTD_RD2 0x04
369 #define _PORTD_PSP2 0x04
370 #define _PORTD_RD3 0x08
371 #define _PORTD_PSP3 0x08
372 #define _PORTD_RD4 0x10
373 #define _PORTD_PSP4 0x10
374 #define _PORTD_RD5 0x20
375 #define _PORTD_PSP5 0x20
376 #define _PORTD_P1B 0x20
377 #define _PORTD_RD6 0x40
378 #define _PORTD_PSP6 0x40
379 #define _PORTD_P1C 0x40
380 #define _PORTD_RD7 0x80
381 #define _PORTD_PSP7 0x80
382 #define _PORTD_P1D 0x80
384 //==============================================================================
387 //==============================================================================
388 // PORTE Bits
390 extern __at(0x0F84) __sfr PORTE;
392 typedef union
394 struct
396 unsigned RE0 : 1;
397 unsigned RE1 : 1;
398 unsigned RE2 : 1;
399 unsigned RE3 : 1;
400 unsigned : 1;
401 unsigned : 1;
402 unsigned : 1;
403 unsigned : 1;
406 struct
408 unsigned RD : 1;
409 unsigned WR : 1;
410 unsigned CS : 1;
411 unsigned MCLR : 1;
412 unsigned : 1;
413 unsigned : 1;
414 unsigned : 1;
415 unsigned : 1;
418 struct
420 unsigned NOT_RD : 1;
421 unsigned NOT_WR : 1;
422 unsigned NOT_CS : 1;
423 unsigned NOT_MCLR : 1;
424 unsigned : 1;
425 unsigned : 1;
426 unsigned : 1;
427 unsigned : 1;
430 struct
432 unsigned AN5 : 1;
433 unsigned AN6 : 1;
434 unsigned AN7 : 1;
435 unsigned VPP : 1;
436 unsigned : 1;
437 unsigned : 1;
438 unsigned : 1;
439 unsigned : 1;
442 struct
444 unsigned RE : 4;
445 unsigned : 4;
447 } __PORTEbits_t;
449 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
451 #define _PORTE_RE0 0x01
452 #define _PORTE_RD 0x01
453 #define _PORTE_NOT_RD 0x01
454 #define _PORTE_AN5 0x01
455 #define _PORTE_RE1 0x02
456 #define _PORTE_WR 0x02
457 #define _PORTE_NOT_WR 0x02
458 #define _PORTE_AN6 0x02
459 #define _PORTE_RE2 0x04
460 #define _PORTE_CS 0x04
461 #define _PORTE_NOT_CS 0x04
462 #define _PORTE_AN7 0x04
463 #define _PORTE_RE3 0x08
464 #define _PORTE_MCLR 0x08
465 #define _PORTE_NOT_MCLR 0x08
466 #define _PORTE_VPP 0x08
468 //==============================================================================
471 //==============================================================================
472 // LATA Bits
474 extern __at(0x0F89) __sfr LATA;
476 typedef struct
478 unsigned LATA0 : 1;
479 unsigned LATA1 : 1;
480 unsigned LATA2 : 1;
481 unsigned LATA3 : 1;
482 unsigned LATA4 : 1;
483 unsigned LATA5 : 1;
484 unsigned LATA6 : 1;
485 unsigned LATA7 : 1;
486 } __LATAbits_t;
488 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
490 #define _LATA0 0x01
491 #define _LATA1 0x02
492 #define _LATA2 0x04
493 #define _LATA3 0x08
494 #define _LATA4 0x10
495 #define _LATA5 0x20
496 #define _LATA6 0x40
497 #define _LATA7 0x80
499 //==============================================================================
502 //==============================================================================
503 // LATB Bits
505 extern __at(0x0F8A) __sfr LATB;
507 typedef struct
509 unsigned LATB0 : 1;
510 unsigned LATB1 : 1;
511 unsigned LATB2 : 1;
512 unsigned LATB3 : 1;
513 unsigned LATB4 : 1;
514 unsigned LATB5 : 1;
515 unsigned LATB6 : 1;
516 unsigned LATB7 : 1;
517 } __LATBbits_t;
519 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
521 #define _LATB0 0x01
522 #define _LATB1 0x02
523 #define _LATB2 0x04
524 #define _LATB3 0x08
525 #define _LATB4 0x10
526 #define _LATB5 0x20
527 #define _LATB6 0x40
528 #define _LATB7 0x80
530 //==============================================================================
533 //==============================================================================
534 // LATC Bits
536 extern __at(0x0F8B) __sfr LATC;
538 typedef struct
540 unsigned LATC0 : 1;
541 unsigned LATC1 : 1;
542 unsigned LATC2 : 1;
543 unsigned LATC3 : 1;
544 unsigned LATC4 : 1;
545 unsigned LATC5 : 1;
546 unsigned LATC6 : 1;
547 unsigned LATC7 : 1;
548 } __LATCbits_t;
550 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
552 #define _LATC0 0x01
553 #define _LATC1 0x02
554 #define _LATC2 0x04
555 #define _LATC3 0x08
556 #define _LATC4 0x10
557 #define _LATC5 0x20
558 #define _LATC6 0x40
559 #define _LATC7 0x80
561 //==============================================================================
564 //==============================================================================
565 // LATD Bits
567 extern __at(0x0F8C) __sfr LATD;
569 typedef struct
571 unsigned LATD0 : 1;
572 unsigned LATD1 : 1;
573 unsigned LATD2 : 1;
574 unsigned LATD3 : 1;
575 unsigned LATD4 : 1;
576 unsigned LATD5 : 1;
577 unsigned LATD6 : 1;
578 unsigned LATD7 : 1;
579 } __LATDbits_t;
581 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
583 #define _LATD0 0x01
584 #define _LATD1 0x02
585 #define _LATD2 0x04
586 #define _LATD3 0x08
587 #define _LATD4 0x10
588 #define _LATD5 0x20
589 #define _LATD6 0x40
590 #define _LATD7 0x80
592 //==============================================================================
595 //==============================================================================
596 // LATE Bits
598 extern __at(0x0F8D) __sfr LATE;
600 typedef union
602 struct
604 unsigned LATE0 : 1;
605 unsigned LATE1 : 1;
606 unsigned LATE2 : 1;
607 unsigned : 1;
608 unsigned : 1;
609 unsigned : 1;
610 unsigned : 1;
611 unsigned : 1;
614 struct
616 unsigned LATE : 3;
617 unsigned : 5;
619 } __LATEbits_t;
621 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
623 #define _LATE0 0x01
624 #define _LATE1 0x02
625 #define _LATE2 0x04
627 //==============================================================================
630 //==============================================================================
631 // DDRA Bits
633 extern __at(0x0F92) __sfr DDRA;
635 typedef union
637 struct
639 unsigned TRISA0 : 1;
640 unsigned TRISA1 : 1;
641 unsigned TRISA2 : 1;
642 unsigned TRISA3 : 1;
643 unsigned TRISA4 : 1;
644 unsigned TRISA5 : 1;
645 unsigned TRISA6 : 1;
646 unsigned TRISA7 : 1;
649 struct
651 unsigned RA0 : 1;
652 unsigned RA1 : 1;
653 unsigned RA2 : 1;
654 unsigned RA3 : 1;
655 unsigned RA4 : 1;
656 unsigned RA5 : 1;
657 unsigned RA6 : 1;
658 unsigned RA7 : 1;
660 } __DDRAbits_t;
662 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
664 #define _TRISA0 0x01
665 #define _RA0 0x01
666 #define _TRISA1 0x02
667 #define _RA1 0x02
668 #define _TRISA2 0x04
669 #define _RA2 0x04
670 #define _TRISA3 0x08
671 #define _RA3 0x08
672 #define _TRISA4 0x10
673 #define _RA4 0x10
674 #define _TRISA5 0x20
675 #define _RA5 0x20
676 #define _TRISA6 0x40
677 #define _RA6 0x40
678 #define _TRISA7 0x80
679 #define _RA7 0x80
681 //==============================================================================
684 //==============================================================================
685 // TRISA Bits
687 extern __at(0x0F92) __sfr TRISA;
689 typedef union
691 struct
693 unsigned TRISA0 : 1;
694 unsigned TRISA1 : 1;
695 unsigned TRISA2 : 1;
696 unsigned TRISA3 : 1;
697 unsigned TRISA4 : 1;
698 unsigned TRISA5 : 1;
699 unsigned TRISA6 : 1;
700 unsigned TRISA7 : 1;
703 struct
705 unsigned RA0 : 1;
706 unsigned RA1 : 1;
707 unsigned RA2 : 1;
708 unsigned RA3 : 1;
709 unsigned RA4 : 1;
710 unsigned RA5 : 1;
711 unsigned RA6 : 1;
712 unsigned RA7 : 1;
714 } __TRISAbits_t;
716 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
718 #define _TRISA_TRISA0 0x01
719 #define _TRISA_RA0 0x01
720 #define _TRISA_TRISA1 0x02
721 #define _TRISA_RA1 0x02
722 #define _TRISA_TRISA2 0x04
723 #define _TRISA_RA2 0x04
724 #define _TRISA_TRISA3 0x08
725 #define _TRISA_RA3 0x08
726 #define _TRISA_TRISA4 0x10
727 #define _TRISA_RA4 0x10
728 #define _TRISA_TRISA5 0x20
729 #define _TRISA_RA5 0x20
730 #define _TRISA_TRISA6 0x40
731 #define _TRISA_RA6 0x40
732 #define _TRISA_TRISA7 0x80
733 #define _TRISA_RA7 0x80
735 //==============================================================================
738 //==============================================================================
739 // DDRB Bits
741 extern __at(0x0F93) __sfr DDRB;
743 typedef union
745 struct
747 unsigned TRISB0 : 1;
748 unsigned TRISB1 : 1;
749 unsigned TRISB2 : 1;
750 unsigned TRISB3 : 1;
751 unsigned TRISB4 : 1;
752 unsigned TRISB5 : 1;
753 unsigned TRISB6 : 1;
754 unsigned TRISB7 : 1;
757 struct
759 unsigned RB0 : 1;
760 unsigned RB1 : 1;
761 unsigned RB2 : 1;
762 unsigned RB3 : 1;
763 unsigned RB4 : 1;
764 unsigned RB5 : 1;
765 unsigned RB6 : 1;
766 unsigned RB7 : 1;
768 } __DDRBbits_t;
770 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
772 #define _TRISB0 0x01
773 #define _RB0 0x01
774 #define _TRISB1 0x02
775 #define _RB1 0x02
776 #define _TRISB2 0x04
777 #define _RB2 0x04
778 #define _TRISB3 0x08
779 #define _RB3 0x08
780 #define _TRISB4 0x10
781 #define _RB4 0x10
782 #define _TRISB5 0x20
783 #define _RB5 0x20
784 #define _TRISB6 0x40
785 #define _RB6 0x40
786 #define _TRISB7 0x80
787 #define _RB7 0x80
789 //==============================================================================
792 //==============================================================================
793 // TRISB Bits
795 extern __at(0x0F93) __sfr TRISB;
797 typedef union
799 struct
801 unsigned TRISB0 : 1;
802 unsigned TRISB1 : 1;
803 unsigned TRISB2 : 1;
804 unsigned TRISB3 : 1;
805 unsigned TRISB4 : 1;
806 unsigned TRISB5 : 1;
807 unsigned TRISB6 : 1;
808 unsigned TRISB7 : 1;
811 struct
813 unsigned RB0 : 1;
814 unsigned RB1 : 1;
815 unsigned RB2 : 1;
816 unsigned RB3 : 1;
817 unsigned RB4 : 1;
818 unsigned RB5 : 1;
819 unsigned RB6 : 1;
820 unsigned RB7 : 1;
822 } __TRISBbits_t;
824 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
826 #define _TRISB_TRISB0 0x01
827 #define _TRISB_RB0 0x01
828 #define _TRISB_TRISB1 0x02
829 #define _TRISB_RB1 0x02
830 #define _TRISB_TRISB2 0x04
831 #define _TRISB_RB2 0x04
832 #define _TRISB_TRISB3 0x08
833 #define _TRISB_RB3 0x08
834 #define _TRISB_TRISB4 0x10
835 #define _TRISB_RB4 0x10
836 #define _TRISB_TRISB5 0x20
837 #define _TRISB_RB5 0x20
838 #define _TRISB_TRISB6 0x40
839 #define _TRISB_RB6 0x40
840 #define _TRISB_TRISB7 0x80
841 #define _TRISB_RB7 0x80
843 //==============================================================================
846 //==============================================================================
847 // DDRC Bits
849 extern __at(0x0F94) __sfr DDRC;
851 typedef union
853 struct
855 unsigned TRISC0 : 1;
856 unsigned TRISC1 : 1;
857 unsigned TRISC2 : 1;
858 unsigned TRISC3 : 1;
859 unsigned TRISC4 : 1;
860 unsigned TRISC5 : 1;
861 unsigned TRISC6 : 1;
862 unsigned TRISC7 : 1;
865 struct
867 unsigned RC0 : 1;
868 unsigned RC1 : 1;
869 unsigned RC2 : 1;
870 unsigned RC3 : 1;
871 unsigned RC4 : 1;
872 unsigned RC5 : 1;
873 unsigned RC6 : 1;
874 unsigned RC7 : 1;
876 } __DDRCbits_t;
878 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
880 #define _TRISC0 0x01
881 #define _RC0 0x01
882 #define _TRISC1 0x02
883 #define _RC1 0x02
884 #define _TRISC2 0x04
885 #define _RC2 0x04
886 #define _TRISC3 0x08
887 #define _RC3 0x08
888 #define _TRISC4 0x10
889 #define _RC4 0x10
890 #define _TRISC5 0x20
891 #define _RC5 0x20
892 #define _TRISC6 0x40
893 #define _RC6 0x40
894 #define _TRISC7 0x80
895 #define _RC7 0x80
897 //==============================================================================
900 //==============================================================================
901 // TRISC Bits
903 extern __at(0x0F94) __sfr TRISC;
905 typedef union
907 struct
909 unsigned TRISC0 : 1;
910 unsigned TRISC1 : 1;
911 unsigned TRISC2 : 1;
912 unsigned TRISC3 : 1;
913 unsigned TRISC4 : 1;
914 unsigned TRISC5 : 1;
915 unsigned TRISC6 : 1;
916 unsigned TRISC7 : 1;
919 struct
921 unsigned RC0 : 1;
922 unsigned RC1 : 1;
923 unsigned RC2 : 1;
924 unsigned RC3 : 1;
925 unsigned RC4 : 1;
926 unsigned RC5 : 1;
927 unsigned RC6 : 1;
928 unsigned RC7 : 1;
930 } __TRISCbits_t;
932 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
934 #define _TRISC_TRISC0 0x01
935 #define _TRISC_RC0 0x01
936 #define _TRISC_TRISC1 0x02
937 #define _TRISC_RC1 0x02
938 #define _TRISC_TRISC2 0x04
939 #define _TRISC_RC2 0x04
940 #define _TRISC_TRISC3 0x08
941 #define _TRISC_RC3 0x08
942 #define _TRISC_TRISC4 0x10
943 #define _TRISC_RC4 0x10
944 #define _TRISC_TRISC5 0x20
945 #define _TRISC_RC5 0x20
946 #define _TRISC_TRISC6 0x40
947 #define _TRISC_RC6 0x40
948 #define _TRISC_TRISC7 0x80
949 #define _TRISC_RC7 0x80
951 //==============================================================================
954 //==============================================================================
955 // DDRD Bits
957 extern __at(0x0F95) __sfr DDRD;
959 typedef union
961 struct
963 unsigned TRISD0 : 1;
964 unsigned TRISD1 : 1;
965 unsigned TRISD2 : 1;
966 unsigned TRISD3 : 1;
967 unsigned TRISD4 : 1;
968 unsigned TRISD5 : 1;
969 unsigned TRISD6 : 1;
970 unsigned TRISD7 : 1;
973 struct
975 unsigned RD0 : 1;
976 unsigned RD1 : 1;
977 unsigned RD2 : 1;
978 unsigned RD3 : 1;
979 unsigned RD4 : 1;
980 unsigned RD5 : 1;
981 unsigned RD6 : 1;
982 unsigned RD7 : 1;
984 } __DDRDbits_t;
986 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
988 #define _TRISD0 0x01
989 #define _RD0 0x01
990 #define _TRISD1 0x02
991 #define _RD1 0x02
992 #define _TRISD2 0x04
993 #define _RD2 0x04
994 #define _TRISD3 0x08
995 #define _RD3 0x08
996 #define _TRISD4 0x10
997 #define _RD4 0x10
998 #define _TRISD5 0x20
999 #define _RD5 0x20
1000 #define _TRISD6 0x40
1001 #define _RD6 0x40
1002 #define _TRISD7 0x80
1003 #define _RD7 0x80
1005 //==============================================================================
1008 //==============================================================================
1009 // TRISD Bits
1011 extern __at(0x0F95) __sfr TRISD;
1013 typedef union
1015 struct
1017 unsigned TRISD0 : 1;
1018 unsigned TRISD1 : 1;
1019 unsigned TRISD2 : 1;
1020 unsigned TRISD3 : 1;
1021 unsigned TRISD4 : 1;
1022 unsigned TRISD5 : 1;
1023 unsigned TRISD6 : 1;
1024 unsigned TRISD7 : 1;
1027 struct
1029 unsigned RD0 : 1;
1030 unsigned RD1 : 1;
1031 unsigned RD2 : 1;
1032 unsigned RD3 : 1;
1033 unsigned RD4 : 1;
1034 unsigned RD5 : 1;
1035 unsigned RD6 : 1;
1036 unsigned RD7 : 1;
1038 } __TRISDbits_t;
1040 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
1042 #define _TRISD_TRISD0 0x01
1043 #define _TRISD_RD0 0x01
1044 #define _TRISD_TRISD1 0x02
1045 #define _TRISD_RD1 0x02
1046 #define _TRISD_TRISD2 0x04
1047 #define _TRISD_RD2 0x04
1048 #define _TRISD_TRISD3 0x08
1049 #define _TRISD_RD3 0x08
1050 #define _TRISD_TRISD4 0x10
1051 #define _TRISD_RD4 0x10
1052 #define _TRISD_TRISD5 0x20
1053 #define _TRISD_RD5 0x20
1054 #define _TRISD_TRISD6 0x40
1055 #define _TRISD_RD6 0x40
1056 #define _TRISD_TRISD7 0x80
1057 #define _TRISD_RD7 0x80
1059 //==============================================================================
1062 //==============================================================================
1063 // DDRE Bits
1065 extern __at(0x0F96) __sfr DDRE;
1067 typedef union
1069 struct
1071 unsigned TRISE0 : 1;
1072 unsigned TRISE1 : 1;
1073 unsigned TRISE2 : 1;
1074 unsigned RE3 : 1;
1075 unsigned PSPMODE : 1;
1076 unsigned IBOV : 1;
1077 unsigned OBF : 1;
1078 unsigned IBF : 1;
1081 struct
1083 unsigned RE0 : 1;
1084 unsigned RE1 : 1;
1085 unsigned RE2 : 1;
1086 unsigned : 1;
1087 unsigned : 1;
1088 unsigned : 1;
1089 unsigned : 1;
1090 unsigned : 1;
1093 struct
1095 unsigned RE : 4;
1096 unsigned : 4;
1099 struct
1101 unsigned TRISE : 3;
1102 unsigned : 5;
1104 } __DDREbits_t;
1106 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1108 #define _TRISE0 0x01
1109 #define _RE0 0x01
1110 #define _TRISE1 0x02
1111 #define _RE1 0x02
1112 #define _TRISE2 0x04
1113 #define _RE2 0x04
1114 #define _RE3 0x08
1115 #define _PSPMODE 0x10
1116 #define _IBOV 0x20
1117 #define _OBF 0x40
1118 #define _IBF 0x80
1120 //==============================================================================
1123 //==============================================================================
1124 // TRISE Bits
1126 extern __at(0x0F96) __sfr TRISE;
1128 typedef union
1130 struct
1132 unsigned TRISE0 : 1;
1133 unsigned TRISE1 : 1;
1134 unsigned TRISE2 : 1;
1135 unsigned RE3 : 1;
1136 unsigned PSPMODE : 1;
1137 unsigned IBOV : 1;
1138 unsigned OBF : 1;
1139 unsigned IBF : 1;
1142 struct
1144 unsigned RE0 : 1;
1145 unsigned RE1 : 1;
1146 unsigned RE2 : 1;
1147 unsigned : 1;
1148 unsigned : 1;
1149 unsigned : 1;
1150 unsigned : 1;
1151 unsigned : 1;
1154 struct
1156 unsigned TRISE : 3;
1157 unsigned : 5;
1160 struct
1162 unsigned RE : 4;
1163 unsigned : 4;
1165 } __TRISEbits_t;
1167 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1169 #define _TRISE_TRISE0 0x01
1170 #define _TRISE_RE0 0x01
1171 #define _TRISE_TRISE1 0x02
1172 #define _TRISE_RE1 0x02
1173 #define _TRISE_TRISE2 0x04
1174 #define _TRISE_RE2 0x04
1175 #define _TRISE_RE3 0x08
1176 #define _TRISE_PSPMODE 0x10
1177 #define _TRISE_IBOV 0x20
1178 #define _TRISE_OBF 0x40
1179 #define _TRISE_IBF 0x80
1181 //==============================================================================
1184 //==============================================================================
1185 // OSCTUNE Bits
1187 extern __at(0x0F9B) __sfr OSCTUNE;
1189 typedef union
1191 struct
1193 unsigned TUN0 : 1;
1194 unsigned TUN1 : 1;
1195 unsigned TUN2 : 1;
1196 unsigned TUN3 : 1;
1197 unsigned TUN4 : 1;
1198 unsigned : 1;
1199 unsigned PLLEN : 1;
1200 unsigned INTSRC : 1;
1203 struct
1205 unsigned TUN : 5;
1206 unsigned : 3;
1208 } __OSCTUNEbits_t;
1210 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1212 #define _TUN0 0x01
1213 #define _TUN1 0x02
1214 #define _TUN2 0x04
1215 #define _TUN3 0x08
1216 #define _TUN4 0x10
1217 #define _PLLEN 0x40
1218 #define _INTSRC 0x80
1220 //==============================================================================
1223 //==============================================================================
1224 // PIE1 Bits
1226 extern __at(0x0F9D) __sfr PIE1;
1228 typedef struct
1230 unsigned TMR1IE : 1;
1231 unsigned TMR2IE : 1;
1232 unsigned CCP1IE : 1;
1233 unsigned SSPIE : 1;
1234 unsigned TXIE : 1;
1235 unsigned RCIE : 1;
1236 unsigned ADIE : 1;
1237 unsigned PSPIE : 1;
1238 } __PIE1bits_t;
1240 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1242 #define _TMR1IE 0x01
1243 #define _TMR2IE 0x02
1244 #define _CCP1IE 0x04
1245 #define _SSPIE 0x08
1246 #define _TXIE 0x10
1247 #define _RCIE 0x20
1248 #define _ADIE 0x40
1249 #define _PSPIE 0x80
1251 //==============================================================================
1254 //==============================================================================
1255 // PIR1 Bits
1257 extern __at(0x0F9E) __sfr PIR1;
1259 typedef struct
1261 unsigned TMR1IF : 1;
1262 unsigned TMR2IF : 1;
1263 unsigned CCP1IF : 1;
1264 unsigned SSPIF : 1;
1265 unsigned TXIF : 1;
1266 unsigned RCIF : 1;
1267 unsigned ADIF : 1;
1268 unsigned PSPIF : 1;
1269 } __PIR1bits_t;
1271 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1273 #define _TMR1IF 0x01
1274 #define _TMR2IF 0x02
1275 #define _CCP1IF 0x04
1276 #define _SSPIF 0x08
1277 #define _TXIF 0x10
1278 #define _RCIF 0x20
1279 #define _ADIF 0x40
1280 #define _PSPIF 0x80
1282 //==============================================================================
1285 //==============================================================================
1286 // IPR1 Bits
1288 extern __at(0x0F9F) __sfr IPR1;
1290 typedef struct
1292 unsigned TMR1IP : 1;
1293 unsigned TMR2IP : 1;
1294 unsigned CCP1IP : 1;
1295 unsigned SSPIP : 1;
1296 unsigned TXIP : 1;
1297 unsigned RCIP : 1;
1298 unsigned ADIP : 1;
1299 unsigned PSPIP : 1;
1300 } __IPR1bits_t;
1302 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1304 #define _TMR1IP 0x01
1305 #define _TMR2IP 0x02
1306 #define _CCP1IP 0x04
1307 #define _SSPIP 0x08
1308 #define _TXIP 0x10
1309 #define _RCIP 0x20
1310 #define _ADIP 0x40
1311 #define _PSPIP 0x80
1313 //==============================================================================
1316 //==============================================================================
1317 // PIE2 Bits
1319 extern __at(0x0FA0) __sfr PIE2;
1321 typedef union
1323 struct
1325 unsigned CCP2IE : 1;
1326 unsigned TMR3IE : 1;
1327 unsigned HLVDIE : 1;
1328 unsigned BCLIE : 1;
1329 unsigned : 1;
1330 unsigned : 1;
1331 unsigned CMIE : 1;
1332 unsigned OSCFIE : 1;
1335 struct
1337 unsigned : 1;
1338 unsigned : 1;
1339 unsigned LVDIE : 1;
1340 unsigned : 1;
1341 unsigned : 1;
1342 unsigned : 1;
1343 unsigned : 1;
1344 unsigned : 1;
1346 } __PIE2bits_t;
1348 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1350 #define _CCP2IE 0x01
1351 #define _TMR3IE 0x02
1352 #define _HLVDIE 0x04
1353 #define _LVDIE 0x04
1354 #define _BCLIE 0x08
1355 #define _CMIE 0x40
1356 #define _OSCFIE 0x80
1358 //==============================================================================
1361 //==============================================================================
1362 // PIR2 Bits
1364 extern __at(0x0FA1) __sfr PIR2;
1366 typedef union
1368 struct
1370 unsigned CCP2IF : 1;
1371 unsigned TMR3IF : 1;
1372 unsigned HLVDIF : 1;
1373 unsigned BCLIF : 1;
1374 unsigned : 1;
1375 unsigned : 1;
1376 unsigned CMIF : 1;
1377 unsigned OSCFIF : 1;
1380 struct
1382 unsigned : 1;
1383 unsigned : 1;
1384 unsigned LVDIF : 1;
1385 unsigned : 1;
1386 unsigned : 1;
1387 unsigned : 1;
1388 unsigned : 1;
1389 unsigned : 1;
1391 } __PIR2bits_t;
1393 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1395 #define _CCP2IF 0x01
1396 #define _TMR3IF 0x02
1397 #define _HLVDIF 0x04
1398 #define _LVDIF 0x04
1399 #define _BCLIF 0x08
1400 #define _CMIF 0x40
1401 #define _OSCFIF 0x80
1403 //==============================================================================
1406 //==============================================================================
1407 // IPR2 Bits
1409 extern __at(0x0FA2) __sfr IPR2;
1411 typedef union
1413 struct
1415 unsigned CCP2IP : 1;
1416 unsigned TMR3IP : 1;
1417 unsigned HLVDIP : 1;
1418 unsigned BCLIP : 1;
1419 unsigned : 1;
1420 unsigned : 1;
1421 unsigned CMIP : 1;
1422 unsigned OSCFIP : 1;
1425 struct
1427 unsigned : 1;
1428 unsigned : 1;
1429 unsigned LVDIP : 1;
1430 unsigned : 1;
1431 unsigned : 1;
1432 unsigned : 1;
1433 unsigned : 1;
1434 unsigned : 1;
1436 } __IPR2bits_t;
1438 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1440 #define _CCP2IP 0x01
1441 #define _TMR3IP 0x02
1442 #define _HLVDIP 0x04
1443 #define _LVDIP 0x04
1444 #define _BCLIP 0x08
1445 #define _CMIP 0x40
1446 #define _OSCFIP 0x80
1448 //==============================================================================
1451 //==============================================================================
1452 // RCSTA Bits
1454 extern __at(0x0FAB) __sfr RCSTA;
1456 typedef union
1458 struct
1460 unsigned RX9D : 1;
1461 unsigned OERR : 1;
1462 unsigned FERR : 1;
1463 unsigned ADDEN : 1;
1464 unsigned CREN : 1;
1465 unsigned SREN : 1;
1466 unsigned RX9 : 1;
1467 unsigned SPEN : 1;
1470 struct
1472 unsigned : 1;
1473 unsigned : 1;
1474 unsigned : 1;
1475 unsigned ADEN : 1;
1476 unsigned : 1;
1477 unsigned : 1;
1478 unsigned : 1;
1479 unsigned : 1;
1481 } __RCSTAbits_t;
1483 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1485 #define _RX9D 0x01
1486 #define _OERR 0x02
1487 #define _FERR 0x04
1488 #define _ADDEN 0x08
1489 #define _ADEN 0x08
1490 #define _CREN 0x10
1491 #define _SREN 0x20
1492 #define _RX9 0x40
1493 #define _SPEN 0x80
1495 //==============================================================================
1498 //==============================================================================
1499 // TXSTA Bits
1501 extern __at(0x0FAC) __sfr TXSTA;
1503 typedef struct
1505 unsigned TX9D : 1;
1506 unsigned TRMT : 1;
1507 unsigned BRGH : 1;
1508 unsigned SENDB : 1;
1509 unsigned SYNC : 1;
1510 unsigned TXEN : 1;
1511 unsigned TX9 : 1;
1512 unsigned CSRC : 1;
1513 } __TXSTAbits_t;
1515 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1517 #define _TX9D 0x01
1518 #define _TRMT 0x02
1519 #define _BRGH 0x04
1520 #define _SENDB 0x08
1521 #define _SYNC 0x10
1522 #define _TXEN 0x20
1523 #define _TX9 0x40
1524 #define _CSRC 0x80
1526 //==============================================================================
1528 extern __at(0x0FAD) __sfr TXREG;
1529 extern __at(0x0FAE) __sfr RCREG;
1530 extern __at(0x0FAF) __sfr SPBRG;
1531 extern __at(0x0FB0) __sfr SPBRGH;
1533 //==============================================================================
1534 // T3CON Bits
1536 extern __at(0x0FB1) __sfr T3CON;
1538 typedef union
1540 struct
1542 unsigned TMR3ON : 1;
1543 unsigned TMR3CS : 1;
1544 unsigned NOT_T3SYNC : 1;
1545 unsigned T3CCP1 : 1;
1546 unsigned T3CKPS0 : 1;
1547 unsigned T3CKPS1 : 1;
1548 unsigned T3CCP2 : 1;
1549 unsigned RD16 : 1;
1552 struct
1554 unsigned : 1;
1555 unsigned : 1;
1556 unsigned T3SYNC : 1;
1557 unsigned : 1;
1558 unsigned : 1;
1559 unsigned : 1;
1560 unsigned : 1;
1561 unsigned : 1;
1564 struct
1566 unsigned : 4;
1567 unsigned T3CKPS : 2;
1568 unsigned : 2;
1570 } __T3CONbits_t;
1572 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1574 #define _T3CON_TMR3ON 0x01
1575 #define _T3CON_TMR3CS 0x02
1576 #define _T3CON_NOT_T3SYNC 0x04
1577 #define _T3CON_T3SYNC 0x04
1578 #define _T3CON_T3CCP1 0x08
1579 #define _T3CON_T3CKPS0 0x10
1580 #define _T3CON_T3CKPS1 0x20
1581 #define _T3CON_T3CCP2 0x40
1582 #define _T3CON_RD16 0x80
1584 //==============================================================================
1586 extern __at(0x0FB2) __sfr TMR3;
1587 extern __at(0x0FB2) __sfr TMR3L;
1588 extern __at(0x0FB3) __sfr TMR3H;
1590 //==============================================================================
1591 // CMCON Bits
1593 extern __at(0x0FB4) __sfr CMCON;
1595 typedef union
1597 struct
1599 unsigned CM0 : 1;
1600 unsigned CM1 : 1;
1601 unsigned CM2 : 1;
1602 unsigned CIS : 1;
1603 unsigned C1INV : 1;
1604 unsigned C2INV : 1;
1605 unsigned C1OUT : 1;
1606 unsigned C2OUT : 1;
1609 struct
1611 unsigned CM : 3;
1612 unsigned : 5;
1614 } __CMCONbits_t;
1616 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1618 #define _CM0 0x01
1619 #define _CM1 0x02
1620 #define _CM2 0x04
1621 #define _CIS 0x08
1622 #define _C1INV 0x10
1623 #define _C2INV 0x20
1624 #define _C1OUT 0x40
1625 #define _C2OUT 0x80
1627 //==============================================================================
1630 //==============================================================================
1631 // CVRCON Bits
1633 extern __at(0x0FB5) __sfr CVRCON;
1635 typedef union
1637 struct
1639 unsigned CVR0 : 1;
1640 unsigned CVR1 : 1;
1641 unsigned CVR2 : 1;
1642 unsigned CVR3 : 1;
1643 unsigned CVRSS : 1;
1644 unsigned CVRR : 1;
1645 unsigned CVROE : 1;
1646 unsigned CVREN : 1;
1649 struct
1651 unsigned CVR : 4;
1652 unsigned : 4;
1654 } __CVRCONbits_t;
1656 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1658 #define _CVR0 0x01
1659 #define _CVR1 0x02
1660 #define _CVR2 0x04
1661 #define _CVR3 0x08
1662 #define _CVRSS 0x10
1663 #define _CVRR 0x20
1664 #define _CVROE 0x40
1665 #define _CVREN 0x80
1667 //==============================================================================
1670 //==============================================================================
1671 // ECCP1AS Bits
1673 extern __at(0x0FB6) __sfr ECCP1AS;
1675 typedef union
1677 struct
1679 unsigned PSSBD0 : 1;
1680 unsigned PSSBD1 : 1;
1681 unsigned PSSAC0 : 1;
1682 unsigned PSSAC1 : 1;
1683 unsigned ECCPAS0 : 1;
1684 unsigned ECCPAS1 : 1;
1685 unsigned ECCPAS2 : 1;
1686 unsigned ECCPASE : 1;
1689 struct
1691 unsigned PSSBD : 2;
1692 unsigned : 6;
1695 struct
1697 unsigned : 2;
1698 unsigned PSSAC : 2;
1699 unsigned : 4;
1702 struct
1704 unsigned : 4;
1705 unsigned ECCPAS : 3;
1706 unsigned : 1;
1708 } __ECCP1ASbits_t;
1710 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1712 #define _PSSBD0 0x01
1713 #define _PSSBD1 0x02
1714 #define _PSSAC0 0x04
1715 #define _PSSAC1 0x08
1716 #define _ECCPAS0 0x10
1717 #define _ECCPAS1 0x20
1718 #define _ECCPAS2 0x40
1719 #define _ECCPASE 0x80
1721 //==============================================================================
1724 //==============================================================================
1725 // ECCPAS Bits
1727 extern __at(0x0FB6) __sfr ECCPAS;
1729 typedef union
1731 struct
1733 unsigned PSSBD0 : 1;
1734 unsigned PSSBD1 : 1;
1735 unsigned PSSAC0 : 1;
1736 unsigned PSSAC1 : 1;
1737 unsigned ECCPAS0 : 1;
1738 unsigned ECCPAS1 : 1;
1739 unsigned ECCPAS2 : 1;
1740 unsigned ECCPASE : 1;
1743 struct
1745 unsigned PSSBD : 2;
1746 unsigned : 6;
1749 struct
1751 unsigned : 2;
1752 unsigned PSSAC : 2;
1753 unsigned : 4;
1756 struct
1758 unsigned : 4;
1759 unsigned ECCPAS : 3;
1760 unsigned : 1;
1762 } __ECCPASbits_t;
1764 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1766 #define _ECCPAS_PSSBD0 0x01
1767 #define _ECCPAS_PSSBD1 0x02
1768 #define _ECCPAS_PSSAC0 0x04
1769 #define _ECCPAS_PSSAC1 0x08
1770 #define _ECCPAS_ECCPAS0 0x10
1771 #define _ECCPAS_ECCPAS1 0x20
1772 #define _ECCPAS_ECCPAS2 0x40
1773 #define _ECCPAS_ECCPASE 0x80
1775 //==============================================================================
1778 //==============================================================================
1779 // PWM1CON Bits
1781 extern __at(0x0FB7) __sfr PWM1CON;
1783 typedef union
1785 struct
1787 unsigned PDC0 : 1;
1788 unsigned PDC1 : 1;
1789 unsigned PDC2 : 1;
1790 unsigned PDC3 : 1;
1791 unsigned PDC4 : 1;
1792 unsigned PDC5 : 1;
1793 unsigned PDC6 : 1;
1794 unsigned PRSEN : 1;
1797 struct
1799 unsigned PDC : 7;
1800 unsigned : 1;
1802 } __PWM1CONbits_t;
1804 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1806 #define _PDC0 0x01
1807 #define _PDC1 0x02
1808 #define _PDC2 0x04
1809 #define _PDC3 0x08
1810 #define _PDC4 0x10
1811 #define _PDC5 0x20
1812 #define _PDC6 0x40
1813 #define _PRSEN 0x80
1815 //==============================================================================
1818 //==============================================================================
1819 // BAUDCON Bits
1821 extern __at(0x0FB8) __sfr BAUDCON;
1823 typedef union
1825 struct
1827 unsigned ABDEN : 1;
1828 unsigned WUE : 1;
1829 unsigned : 1;
1830 unsigned BRG16 : 1;
1831 unsigned TXCKP : 1;
1832 unsigned RXDTP : 1;
1833 unsigned RCIDL : 1;
1834 unsigned ABDOVF : 1;
1837 struct
1839 unsigned : 1;
1840 unsigned : 1;
1841 unsigned : 1;
1842 unsigned : 1;
1843 unsigned SCKP : 1;
1844 unsigned : 1;
1845 unsigned RCMT : 1;
1846 unsigned : 1;
1848 } __BAUDCONbits_t;
1850 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1852 #define _ABDEN 0x01
1853 #define _WUE 0x02
1854 #define _BRG16 0x08
1855 #define _TXCKP 0x10
1856 #define _SCKP 0x10
1857 #define _RXDTP 0x20
1858 #define _RCIDL 0x40
1859 #define _RCMT 0x40
1860 #define _ABDOVF 0x80
1862 //==============================================================================
1865 //==============================================================================
1866 // BAUDCTL Bits
1868 extern __at(0x0FB8) __sfr BAUDCTL;
1870 typedef union
1872 struct
1874 unsigned ABDEN : 1;
1875 unsigned WUE : 1;
1876 unsigned : 1;
1877 unsigned BRG16 : 1;
1878 unsigned TXCKP : 1;
1879 unsigned RXDTP : 1;
1880 unsigned RCIDL : 1;
1881 unsigned ABDOVF : 1;
1884 struct
1886 unsigned : 1;
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned : 1;
1890 unsigned SCKP : 1;
1891 unsigned : 1;
1892 unsigned RCMT : 1;
1893 unsigned : 1;
1895 } __BAUDCTLbits_t;
1897 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1899 #define _BAUDCTL_ABDEN 0x01
1900 #define _BAUDCTL_WUE 0x02
1901 #define _BAUDCTL_BRG16 0x08
1902 #define _BAUDCTL_TXCKP 0x10
1903 #define _BAUDCTL_SCKP 0x10
1904 #define _BAUDCTL_RXDTP 0x20
1905 #define _BAUDCTL_RCIDL 0x40
1906 #define _BAUDCTL_RCMT 0x40
1907 #define _BAUDCTL_ABDOVF 0x80
1909 //==============================================================================
1912 //==============================================================================
1913 // CCP2CON Bits
1915 extern __at(0x0FBA) __sfr CCP2CON;
1917 typedef union
1919 struct
1921 unsigned CCP2M0 : 1;
1922 unsigned CCP2M1 : 1;
1923 unsigned CCP2M2 : 1;
1924 unsigned CCP2M3 : 1;
1925 unsigned CCP2Y : 1;
1926 unsigned CCP2X : 1;
1927 unsigned : 1;
1928 unsigned : 1;
1931 struct
1933 unsigned : 1;
1934 unsigned : 1;
1935 unsigned : 1;
1936 unsigned : 1;
1937 unsigned DC2B0 : 1;
1938 unsigned DC2B1 : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1943 struct
1945 unsigned CCP2M : 4;
1946 unsigned : 4;
1949 struct
1951 unsigned : 4;
1952 unsigned DC2B : 2;
1953 unsigned : 2;
1955 } __CCP2CONbits_t;
1957 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1959 #define _CCP2M0 0x01
1960 #define _CCP2M1 0x02
1961 #define _CCP2M2 0x04
1962 #define _CCP2M3 0x08
1963 #define _CCP2Y 0x10
1964 #define _DC2B0 0x10
1965 #define _CCP2X 0x20
1966 #define _DC2B1 0x20
1968 //==============================================================================
1970 extern __at(0x0FBB) __sfr CCPR2;
1971 extern __at(0x0FBB) __sfr CCPR2L;
1972 extern __at(0x0FBC) __sfr CCPR2H;
1974 //==============================================================================
1975 // CCP1CON Bits
1977 extern __at(0x0FBD) __sfr CCP1CON;
1979 typedef union
1981 struct
1983 unsigned CCP1M0 : 1;
1984 unsigned CCP1M1 : 1;
1985 unsigned CCP1M2 : 1;
1986 unsigned CCP1M3 : 1;
1987 unsigned CCP1Y : 1;
1988 unsigned CCP1X : 1;
1989 unsigned P1M0 : 1;
1990 unsigned P1M1 : 1;
1993 struct
1995 unsigned : 1;
1996 unsigned : 1;
1997 unsigned : 1;
1998 unsigned : 1;
1999 unsigned DC1B0 : 1;
2000 unsigned DC1B1 : 1;
2001 unsigned : 1;
2002 unsigned : 1;
2005 struct
2007 unsigned CCP1M : 4;
2008 unsigned : 4;
2011 struct
2013 unsigned : 4;
2014 unsigned DC1B : 2;
2015 unsigned : 2;
2018 struct
2020 unsigned : 6;
2021 unsigned P1M : 2;
2023 } __CCP1CONbits_t;
2025 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2027 #define _CCP1M0 0x01
2028 #define _CCP1M1 0x02
2029 #define _CCP1M2 0x04
2030 #define _CCP1M3 0x08
2031 #define _CCP1Y 0x10
2032 #define _DC1B0 0x10
2033 #define _CCP1X 0x20
2034 #define _DC1B1 0x20
2035 #define _P1M0 0x40
2036 #define _P1M1 0x80
2038 //==============================================================================
2040 extern __at(0x0FBE) __sfr CCPR1;
2041 extern __at(0x0FBE) __sfr CCPR1L;
2042 extern __at(0x0FBF) __sfr CCPR1H;
2044 //==============================================================================
2045 // ADCON2 Bits
2047 extern __at(0x0FC0) __sfr ADCON2;
2049 typedef union
2051 struct
2053 unsigned ADCS0 : 1;
2054 unsigned ADCS1 : 1;
2055 unsigned ADCS2 : 1;
2056 unsigned ACQT0 : 1;
2057 unsigned ACQT1 : 1;
2058 unsigned ACQT2 : 1;
2059 unsigned : 1;
2060 unsigned ADFM : 1;
2063 struct
2065 unsigned ADCS : 3;
2066 unsigned : 5;
2069 struct
2071 unsigned : 3;
2072 unsigned ACQT : 3;
2073 unsigned : 2;
2075 } __ADCON2bits_t;
2077 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2079 #define _ADCS0 0x01
2080 #define _ADCS1 0x02
2081 #define _ADCS2 0x04
2082 #define _ACQT0 0x08
2083 #define _ACQT1 0x10
2084 #define _ACQT2 0x20
2085 #define _ADFM 0x80
2087 //==============================================================================
2090 //==============================================================================
2091 // ADCON1 Bits
2093 extern __at(0x0FC1) __sfr ADCON1;
2095 typedef union
2097 struct
2099 unsigned PCFG0 : 1;
2100 unsigned PCFG1 : 1;
2101 unsigned PCFG2 : 1;
2102 unsigned PCFG3 : 1;
2103 unsigned VCFG0 : 1;
2104 unsigned VCFG1 : 1;
2105 unsigned : 1;
2106 unsigned : 1;
2109 struct
2111 unsigned PCFG : 4;
2112 unsigned : 4;
2115 struct
2117 unsigned : 4;
2118 unsigned VCFG : 2;
2119 unsigned : 2;
2121 } __ADCON1bits_t;
2123 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2125 #define _PCFG0 0x01
2126 #define _PCFG1 0x02
2127 #define _PCFG2 0x04
2128 #define _PCFG3 0x08
2129 #define _VCFG0 0x10
2130 #define _VCFG1 0x20
2132 //==============================================================================
2135 //==============================================================================
2136 // ADCON0 Bits
2138 extern __at(0x0FC2) __sfr ADCON0;
2140 typedef union
2142 struct
2144 unsigned ADON : 1;
2145 unsigned GO_NOT_DONE : 1;
2146 unsigned CHS0 : 1;
2147 unsigned CHS1 : 1;
2148 unsigned CHS2 : 1;
2149 unsigned CHS3 : 1;
2150 unsigned : 1;
2151 unsigned : 1;
2154 struct
2156 unsigned : 1;
2157 unsigned GO : 1;
2158 unsigned : 1;
2159 unsigned : 1;
2160 unsigned : 1;
2161 unsigned : 1;
2162 unsigned : 1;
2163 unsigned : 1;
2166 struct
2168 unsigned : 1;
2169 unsigned DONE : 1;
2170 unsigned : 1;
2171 unsigned : 1;
2172 unsigned : 1;
2173 unsigned : 1;
2174 unsigned : 1;
2175 unsigned : 1;
2178 struct
2180 unsigned : 1;
2181 unsigned NOT_DONE : 1;
2182 unsigned : 1;
2183 unsigned : 1;
2184 unsigned : 1;
2185 unsigned : 1;
2186 unsigned : 1;
2187 unsigned : 1;
2190 struct
2192 unsigned : 1;
2193 unsigned GO_DONE : 1;
2194 unsigned : 1;
2195 unsigned : 1;
2196 unsigned : 1;
2197 unsigned : 1;
2198 unsigned : 1;
2199 unsigned : 1;
2202 struct
2204 unsigned : 2;
2205 unsigned CHS : 4;
2206 unsigned : 2;
2208 } __ADCON0bits_t;
2210 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2212 #define _ADON 0x01
2213 #define _GO_NOT_DONE 0x02
2214 #define _GO 0x02
2215 #define _DONE 0x02
2216 #define _NOT_DONE 0x02
2217 #define _GO_DONE 0x02
2218 #define _CHS0 0x04
2219 #define _CHS1 0x08
2220 #define _CHS2 0x10
2221 #define _CHS3 0x20
2223 //==============================================================================
2225 extern __at(0x0FC3) __sfr ADRES;
2226 extern __at(0x0FC3) __sfr ADRESL;
2227 extern __at(0x0FC4) __sfr ADRESH;
2229 //==============================================================================
2230 // SSPCON2 Bits
2232 extern __at(0x0FC5) __sfr SSPCON2;
2234 typedef struct
2236 unsigned SEN : 1;
2237 unsigned RSEN : 1;
2238 unsigned PEN : 1;
2239 unsigned RCEN : 1;
2240 unsigned ACKEN : 1;
2241 unsigned ACKDT : 1;
2242 unsigned ACKSTAT : 1;
2243 unsigned GCEN : 1;
2244 } __SSPCON2bits_t;
2246 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2248 #define _SEN 0x01
2249 #define _RSEN 0x02
2250 #define _PEN 0x04
2251 #define _RCEN 0x08
2252 #define _ACKEN 0x10
2253 #define _ACKDT 0x20
2254 #define _ACKSTAT 0x40
2255 #define _GCEN 0x80
2257 //==============================================================================
2260 //==============================================================================
2261 // SSPCON1 Bits
2263 extern __at(0x0FC6) __sfr SSPCON1;
2265 typedef union
2267 struct
2269 unsigned SSPM0 : 1;
2270 unsigned SSPM1 : 1;
2271 unsigned SSPM2 : 1;
2272 unsigned SSPM3 : 1;
2273 unsigned CKP : 1;
2274 unsigned SSPEN : 1;
2275 unsigned SSPOV : 1;
2276 unsigned WCOL : 1;
2279 struct
2281 unsigned SSPM : 4;
2282 unsigned : 4;
2284 } __SSPCON1bits_t;
2286 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2288 #define _SSPM0 0x01
2289 #define _SSPM1 0x02
2290 #define _SSPM2 0x04
2291 #define _SSPM3 0x08
2292 #define _CKP 0x10
2293 #define _SSPEN 0x20
2294 #define _SSPOV 0x40
2295 #define _WCOL 0x80
2297 //==============================================================================
2300 //==============================================================================
2301 // SSPSTAT Bits
2303 extern __at(0x0FC7) __sfr SSPSTAT;
2305 typedef union
2307 struct
2309 unsigned BF : 1;
2310 unsigned UA : 1;
2311 unsigned R_NOT_W : 1;
2312 unsigned S : 1;
2313 unsigned P : 1;
2314 unsigned D_NOT_A : 1;
2315 unsigned CKE : 1;
2316 unsigned SMP : 1;
2319 struct
2321 unsigned : 1;
2322 unsigned : 1;
2323 unsigned R : 1;
2324 unsigned START : 1;
2325 unsigned STOP : 1;
2326 unsigned D : 1;
2327 unsigned : 1;
2328 unsigned : 1;
2331 struct
2333 unsigned : 1;
2334 unsigned : 1;
2335 unsigned NOT_W : 1;
2336 unsigned : 1;
2337 unsigned : 1;
2338 unsigned NOT_A : 1;
2339 unsigned : 1;
2340 unsigned : 1;
2343 struct
2345 unsigned : 1;
2346 unsigned : 1;
2347 unsigned R_W : 1;
2348 unsigned : 1;
2349 unsigned : 1;
2350 unsigned D_A : 1;
2351 unsigned : 1;
2352 unsigned : 1;
2355 struct
2357 unsigned : 1;
2358 unsigned : 1;
2359 unsigned NOT_WRITE : 1;
2360 unsigned : 1;
2361 unsigned : 1;
2362 unsigned NOT_ADDRESS : 1;
2363 unsigned : 1;
2364 unsigned : 1;
2366 } __SSPSTATbits_t;
2368 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2370 #define _BF 0x01
2371 #define _UA 0x02
2372 #define _R_NOT_W 0x04
2373 #define _R 0x04
2374 #define _NOT_W 0x04
2375 #define _R_W 0x04
2376 #define _NOT_WRITE 0x04
2377 #define _S 0x08
2378 #define _START 0x08
2379 #define _P 0x10
2380 #define _STOP 0x10
2381 #define _D_NOT_A 0x20
2382 #define _D 0x20
2383 #define _NOT_A 0x20
2384 #define _D_A 0x20
2385 #define _NOT_ADDRESS 0x20
2386 #define _CKE 0x40
2387 #define _SMP 0x80
2389 //==============================================================================
2391 extern __at(0x0FC8) __sfr SSPADD;
2392 extern __at(0x0FC9) __sfr SSPBUF;
2394 //==============================================================================
2395 // T2CON Bits
2397 extern __at(0x0FCA) __sfr T2CON;
2399 typedef union
2401 struct
2403 unsigned T2CKPS0 : 1;
2404 unsigned T2CKPS1 : 1;
2405 unsigned TMR2ON : 1;
2406 unsigned T2OUTPS0 : 1;
2407 unsigned T2OUTPS1 : 1;
2408 unsigned T2OUTPS2 : 1;
2409 unsigned T2OUTPS3 : 1;
2410 unsigned : 1;
2413 struct
2415 unsigned : 1;
2416 unsigned : 1;
2417 unsigned : 1;
2418 unsigned TOUTPS0 : 1;
2419 unsigned TOUTPS1 : 1;
2420 unsigned TOUTPS2 : 1;
2421 unsigned TOUTPS3 : 1;
2422 unsigned : 1;
2425 struct
2427 unsigned T2CKPS : 2;
2428 unsigned : 6;
2431 struct
2433 unsigned : 3;
2434 unsigned T2OUTPS : 4;
2435 unsigned : 1;
2438 struct
2440 unsigned : 3;
2441 unsigned TOUTPS : 4;
2442 unsigned : 1;
2444 } __T2CONbits_t;
2446 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2448 #define _T2CKPS0 0x01
2449 #define _T2CKPS1 0x02
2450 #define _TMR2ON 0x04
2451 #define _T2OUTPS0 0x08
2452 #define _TOUTPS0 0x08
2453 #define _T2OUTPS1 0x10
2454 #define _TOUTPS1 0x10
2455 #define _T2OUTPS2 0x20
2456 #define _TOUTPS2 0x20
2457 #define _T2OUTPS3 0x40
2458 #define _TOUTPS3 0x40
2460 //==============================================================================
2462 extern __at(0x0FCB) __sfr PR2;
2463 extern __at(0x0FCC) __sfr TMR2;
2465 //==============================================================================
2466 // T1CON Bits
2468 extern __at(0x0FCD) __sfr T1CON;
2470 typedef union
2472 struct
2474 unsigned TMR1ON : 1;
2475 unsigned TMR1CS : 1;
2476 unsigned NOT_T1SYNC : 1;
2477 unsigned T1OSCEN : 1;
2478 unsigned T1CKPS0 : 1;
2479 unsigned T1CKPS1 : 1;
2480 unsigned T1RUN : 1;
2481 unsigned RD16 : 1;
2484 struct
2486 unsigned : 1;
2487 unsigned : 1;
2488 unsigned T1SYNC : 1;
2489 unsigned : 1;
2490 unsigned : 1;
2491 unsigned : 1;
2492 unsigned : 1;
2493 unsigned : 1;
2496 struct
2498 unsigned : 4;
2499 unsigned T1CKPS : 2;
2500 unsigned : 2;
2502 } __T1CONbits_t;
2504 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2506 #define _TMR1ON 0x01
2507 #define _TMR1CS 0x02
2508 #define _NOT_T1SYNC 0x04
2509 #define _T1SYNC 0x04
2510 #define _T1OSCEN 0x08
2511 #define _T1CKPS0 0x10
2512 #define _T1CKPS1 0x20
2513 #define _T1RUN 0x40
2514 #define _RD16 0x80
2516 //==============================================================================
2518 extern __at(0x0FCE) __sfr TMR1;
2519 extern __at(0x0FCE) __sfr TMR1L;
2520 extern __at(0x0FCF) __sfr TMR1H;
2522 //==============================================================================
2523 // RCON Bits
2525 extern __at(0x0FD0) __sfr RCON;
2527 typedef union
2529 struct
2531 unsigned NOT_BOR : 1;
2532 unsigned NOT_POR : 1;
2533 unsigned NOT_PD : 1;
2534 unsigned NOT_TO : 1;
2535 unsigned NOT_RI : 1;
2536 unsigned : 1;
2537 unsigned SBOREN : 1;
2538 unsigned IPEN : 1;
2541 struct
2543 unsigned BOR : 1;
2544 unsigned POR : 1;
2545 unsigned PD : 1;
2546 unsigned TO : 1;
2547 unsigned RI : 1;
2548 unsigned : 1;
2549 unsigned : 1;
2550 unsigned : 1;
2552 } __RCONbits_t;
2554 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2556 #define _NOT_BOR 0x01
2557 #define _BOR 0x01
2558 #define _NOT_POR 0x02
2559 #define _POR 0x02
2560 #define _NOT_PD 0x04
2561 #define _PD 0x04
2562 #define _NOT_TO 0x08
2563 #define _TO 0x08
2564 #define _NOT_RI 0x10
2565 #define _RI 0x10
2566 #define _SBOREN 0x40
2567 #define _IPEN 0x80
2569 //==============================================================================
2572 //==============================================================================
2573 // WDTCON Bits
2575 extern __at(0x0FD1) __sfr WDTCON;
2577 typedef union
2579 struct
2581 unsigned SWDTEN : 1;
2582 unsigned : 1;
2583 unsigned : 1;
2584 unsigned : 1;
2585 unsigned : 1;
2586 unsigned : 1;
2587 unsigned : 1;
2588 unsigned : 1;
2591 struct
2593 unsigned SWDTE : 1;
2594 unsigned : 1;
2595 unsigned : 1;
2596 unsigned : 1;
2597 unsigned : 1;
2598 unsigned : 1;
2599 unsigned : 1;
2600 unsigned : 1;
2602 } __WDTCONbits_t;
2604 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2606 #define _SWDTEN 0x01
2607 #define _SWDTE 0x01
2609 //==============================================================================
2612 //==============================================================================
2613 // HLVDCON Bits
2615 extern __at(0x0FD2) __sfr HLVDCON;
2617 typedef union
2619 struct
2621 unsigned HLVDL0 : 1;
2622 unsigned HLVDL1 : 1;
2623 unsigned HLVDL2 : 1;
2624 unsigned HLVDL3 : 1;
2625 unsigned HLVDEN : 1;
2626 unsigned IVRST : 1;
2627 unsigned : 1;
2628 unsigned VDIRMAG : 1;
2631 struct
2633 unsigned LVDL0 : 1;
2634 unsigned LVDL1 : 1;
2635 unsigned LVDL2 : 1;
2636 unsigned LVDL3 : 1;
2637 unsigned LVDEN : 1;
2638 unsigned IRVST : 1;
2639 unsigned : 1;
2640 unsigned : 1;
2643 struct
2645 unsigned LVV0 : 1;
2646 unsigned LVV1 : 1;
2647 unsigned LVV2 : 1;
2648 unsigned LVV3 : 1;
2649 unsigned : 1;
2650 unsigned BGST : 1;
2651 unsigned : 1;
2652 unsigned : 1;
2655 struct
2657 unsigned HLVDL : 4;
2658 unsigned : 4;
2661 struct
2663 unsigned LVV : 4;
2664 unsigned : 4;
2667 struct
2669 unsigned LVDL : 4;
2670 unsigned : 4;
2672 } __HLVDCONbits_t;
2674 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2676 #define _HLVDL0 0x01
2677 #define _LVDL0 0x01
2678 #define _LVV0 0x01
2679 #define _HLVDL1 0x02
2680 #define _LVDL1 0x02
2681 #define _LVV1 0x02
2682 #define _HLVDL2 0x04
2683 #define _LVDL2 0x04
2684 #define _LVV2 0x04
2685 #define _HLVDL3 0x08
2686 #define _LVDL3 0x08
2687 #define _LVV3 0x08
2688 #define _HLVDEN 0x10
2689 #define _LVDEN 0x10
2690 #define _IVRST 0x20
2691 #define _IRVST 0x20
2692 #define _BGST 0x20
2693 #define _VDIRMAG 0x80
2695 //==============================================================================
2698 //==============================================================================
2699 // LVDCON Bits
2701 extern __at(0x0FD2) __sfr LVDCON;
2703 typedef union
2705 struct
2707 unsigned HLVDL0 : 1;
2708 unsigned HLVDL1 : 1;
2709 unsigned HLVDL2 : 1;
2710 unsigned HLVDL3 : 1;
2711 unsigned HLVDEN : 1;
2712 unsigned IVRST : 1;
2713 unsigned : 1;
2714 unsigned VDIRMAG : 1;
2717 struct
2719 unsigned LVDL0 : 1;
2720 unsigned LVDL1 : 1;
2721 unsigned LVDL2 : 1;
2722 unsigned LVDL3 : 1;
2723 unsigned LVDEN : 1;
2724 unsigned IRVST : 1;
2725 unsigned : 1;
2726 unsigned : 1;
2729 struct
2731 unsigned LVV0 : 1;
2732 unsigned LVV1 : 1;
2733 unsigned LVV2 : 1;
2734 unsigned LVV3 : 1;
2735 unsigned : 1;
2736 unsigned BGST : 1;
2737 unsigned : 1;
2738 unsigned : 1;
2741 struct
2743 unsigned LVV : 4;
2744 unsigned : 4;
2747 struct
2749 unsigned HLVDL : 4;
2750 unsigned : 4;
2753 struct
2755 unsigned LVDL : 4;
2756 unsigned : 4;
2758 } __LVDCONbits_t;
2760 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2762 #define _LVDCON_HLVDL0 0x01
2763 #define _LVDCON_LVDL0 0x01
2764 #define _LVDCON_LVV0 0x01
2765 #define _LVDCON_HLVDL1 0x02
2766 #define _LVDCON_LVDL1 0x02
2767 #define _LVDCON_LVV1 0x02
2768 #define _LVDCON_HLVDL2 0x04
2769 #define _LVDCON_LVDL2 0x04
2770 #define _LVDCON_LVV2 0x04
2771 #define _LVDCON_HLVDL3 0x08
2772 #define _LVDCON_LVDL3 0x08
2773 #define _LVDCON_LVV3 0x08
2774 #define _LVDCON_HLVDEN 0x10
2775 #define _LVDCON_LVDEN 0x10
2776 #define _LVDCON_IVRST 0x20
2777 #define _LVDCON_IRVST 0x20
2778 #define _LVDCON_BGST 0x20
2779 #define _LVDCON_VDIRMAG 0x80
2781 //==============================================================================
2784 //==============================================================================
2785 // OSCCON Bits
2787 extern __at(0x0FD3) __sfr OSCCON;
2789 typedef union
2791 struct
2793 unsigned SCS0 : 1;
2794 unsigned SCS1 : 1;
2795 unsigned IOFS : 1;
2796 unsigned OSTS : 1;
2797 unsigned IRCF0 : 1;
2798 unsigned IRCF1 : 1;
2799 unsigned IRCF2 : 1;
2800 unsigned IDLEN : 1;
2803 struct
2805 unsigned : 1;
2806 unsigned : 1;
2807 unsigned FLTS : 1;
2808 unsigned : 1;
2809 unsigned : 1;
2810 unsigned : 1;
2811 unsigned : 1;
2812 unsigned : 1;
2815 struct
2817 unsigned SCS : 2;
2818 unsigned : 6;
2821 struct
2823 unsigned : 4;
2824 unsigned IRCF : 3;
2825 unsigned : 1;
2827 } __OSCCONbits_t;
2829 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2831 #define _SCS0 0x01
2832 #define _SCS1 0x02
2833 #define _IOFS 0x04
2834 #define _FLTS 0x04
2835 #define _OSTS 0x08
2836 #define _IRCF0 0x10
2837 #define _IRCF1 0x20
2838 #define _IRCF2 0x40
2839 #define _IDLEN 0x80
2841 //==============================================================================
2844 //==============================================================================
2845 // T0CON Bits
2847 extern __at(0x0FD5) __sfr T0CON;
2849 typedef union
2851 struct
2853 unsigned T0PS0 : 1;
2854 unsigned T0PS1 : 1;
2855 unsigned T0PS2 : 1;
2856 unsigned PSA : 1;
2857 unsigned T0SE : 1;
2858 unsigned T0CS : 1;
2859 unsigned T08BIT : 1;
2860 unsigned TMR0ON : 1;
2863 struct
2865 unsigned : 1;
2866 unsigned : 1;
2867 unsigned : 1;
2868 unsigned T0PS3 : 1;
2869 unsigned : 1;
2870 unsigned : 1;
2871 unsigned T016BIT : 1;
2872 unsigned : 1;
2875 struct
2877 unsigned T0PS : 4;
2878 unsigned : 4;
2880 } __T0CONbits_t;
2882 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2884 #define _T0PS0 0x01
2885 #define _T0PS1 0x02
2886 #define _T0PS2 0x04
2887 #define _PSA 0x08
2888 #define _T0PS3 0x08
2889 #define _T0SE 0x10
2890 #define _T0CS 0x20
2891 #define _T08BIT 0x40
2892 #define _T016BIT 0x40
2893 #define _TMR0ON 0x80
2895 //==============================================================================
2897 extern __at(0x0FD6) __sfr TMR0;
2898 extern __at(0x0FD6) __sfr TMR0L;
2899 extern __at(0x0FD7) __sfr TMR0H;
2901 //==============================================================================
2902 // STATUS Bits
2904 extern __at(0x0FD8) __sfr STATUS;
2906 typedef struct
2908 unsigned C : 1;
2909 unsigned DC : 1;
2910 unsigned Z : 1;
2911 unsigned OV : 1;
2912 unsigned N : 1;
2913 unsigned : 1;
2914 unsigned : 1;
2915 unsigned : 1;
2916 } __STATUSbits_t;
2918 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2920 #define _C 0x01
2921 #define _DC 0x02
2922 #define _Z 0x04
2923 #define _OV 0x08
2924 #define _N 0x10
2926 //==============================================================================
2928 extern __at(0x0FD9) __sfr FSR2L;
2929 extern __at(0x0FDA) __sfr FSR2H;
2930 extern __at(0x0FDB) __sfr PLUSW2;
2931 extern __at(0x0FDC) __sfr PREINC2;
2932 extern __at(0x0FDD) __sfr POSTDEC2;
2933 extern __at(0x0FDE) __sfr POSTINC2;
2934 extern __at(0x0FDF) __sfr INDF2;
2935 extern __at(0x0FE0) __sfr BSR;
2936 extern __at(0x0FE1) __sfr FSR1L;
2937 extern __at(0x0FE2) __sfr FSR1H;
2938 extern __at(0x0FE3) __sfr PLUSW1;
2939 extern __at(0x0FE4) __sfr PREINC1;
2940 extern __at(0x0FE5) __sfr POSTDEC1;
2941 extern __at(0x0FE6) __sfr POSTINC1;
2942 extern __at(0x0FE7) __sfr INDF1;
2943 extern __at(0x0FE8) __sfr WREG;
2944 extern __at(0x0FE9) __sfr FSR0L;
2945 extern __at(0x0FEA) __sfr FSR0H;
2946 extern __at(0x0FEB) __sfr PLUSW0;
2947 extern __at(0x0FEC) __sfr PREINC0;
2948 extern __at(0x0FED) __sfr POSTDEC0;
2949 extern __at(0x0FEE) __sfr POSTINC0;
2950 extern __at(0x0FEF) __sfr INDF0;
2952 //==============================================================================
2953 // INTCON3 Bits
2955 extern __at(0x0FF0) __sfr INTCON3;
2957 typedef union
2959 struct
2961 unsigned INT1IF : 1;
2962 unsigned INT2IF : 1;
2963 unsigned : 1;
2964 unsigned INT1IE : 1;
2965 unsigned INT2IE : 1;
2966 unsigned : 1;
2967 unsigned INT1IP : 1;
2968 unsigned INT2IP : 1;
2971 struct
2973 unsigned INT1F : 1;
2974 unsigned INT2F : 1;
2975 unsigned : 1;
2976 unsigned INT1E : 1;
2977 unsigned INT2E : 1;
2978 unsigned : 1;
2979 unsigned INT1P : 1;
2980 unsigned INT2P : 1;
2982 } __INTCON3bits_t;
2984 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2986 #define _INT1IF 0x01
2987 #define _INT1F 0x01
2988 #define _INT2IF 0x02
2989 #define _INT2F 0x02
2990 #define _INT1IE 0x08
2991 #define _INT1E 0x08
2992 #define _INT2IE 0x10
2993 #define _INT2E 0x10
2994 #define _INT1IP 0x40
2995 #define _INT1P 0x40
2996 #define _INT2IP 0x80
2997 #define _INT2P 0x80
2999 //==============================================================================
3002 //==============================================================================
3003 // INTCON2 Bits
3005 extern __at(0x0FF1) __sfr INTCON2;
3007 typedef union
3009 struct
3011 unsigned RBIP : 1;
3012 unsigned : 1;
3013 unsigned TMR0IP : 1;
3014 unsigned : 1;
3015 unsigned INTEDG2 : 1;
3016 unsigned INTEDG1 : 1;
3017 unsigned INTEDG0 : 1;
3018 unsigned NOT_RBPU : 1;
3021 struct
3023 unsigned : 1;
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned : 1;
3027 unsigned : 1;
3028 unsigned : 1;
3029 unsigned : 1;
3030 unsigned RBPU : 1;
3032 } __INTCON2bits_t;
3034 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
3036 #define _RBIP 0x01
3037 #define _TMR0IP 0x04
3038 #define _INTEDG2 0x10
3039 #define _INTEDG1 0x20
3040 #define _INTEDG0 0x40
3041 #define _NOT_RBPU 0x80
3042 #define _RBPU 0x80
3044 //==============================================================================
3047 //==============================================================================
3048 // INTCON Bits
3050 extern __at(0x0FF2) __sfr INTCON;
3052 typedef union
3054 struct
3056 unsigned RBIF : 1;
3057 unsigned INT0IF : 1;
3058 unsigned TMR0IF : 1;
3059 unsigned RBIE : 1;
3060 unsigned INT0IE : 1;
3061 unsigned TMR0IE : 1;
3062 unsigned PEIE_GIEL : 1;
3063 unsigned GIE_GIEH : 1;
3066 struct
3068 unsigned : 1;
3069 unsigned INT0F : 1;
3070 unsigned T0IF : 1;
3071 unsigned : 1;
3072 unsigned INT0E : 1;
3073 unsigned T0IE : 1;
3074 unsigned PEIE : 1;
3075 unsigned GIE : 1;
3078 struct
3080 unsigned : 1;
3081 unsigned : 1;
3082 unsigned : 1;
3083 unsigned : 1;
3084 unsigned : 1;
3085 unsigned : 1;
3086 unsigned GIEL : 1;
3087 unsigned GIEH : 1;
3089 } __INTCONbits_t;
3091 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3093 #define _RBIF 0x01
3094 #define _INT0IF 0x02
3095 #define _INT0F 0x02
3096 #define _TMR0IF 0x04
3097 #define _T0IF 0x04
3098 #define _RBIE 0x08
3099 #define _INT0IE 0x10
3100 #define _INT0E 0x10
3101 #define _TMR0IE 0x20
3102 #define _T0IE 0x20
3103 #define _PEIE_GIEL 0x40
3104 #define _PEIE 0x40
3105 #define _GIEL 0x40
3106 #define _GIE_GIEH 0x80
3107 #define _GIE 0x80
3108 #define _GIEH 0x80
3110 //==============================================================================
3112 extern __at(0x0FF3) __sfr PROD;
3113 extern __at(0x0FF3) __sfr PRODL;
3114 extern __at(0x0FF4) __sfr PRODH;
3115 extern __at(0x0FF5) __sfr TABLAT;
3116 extern __at(0x0FF6) __sfr TBLPTR;
3117 extern __at(0x0FF6) __sfr TBLPTRL;
3118 extern __at(0x0FF7) __sfr TBLPTRH;
3119 extern __at(0x0FF8) __sfr TBLPTRU;
3120 extern __at(0x0FF9) __sfr PC;
3121 extern __at(0x0FF9) __sfr PCL;
3122 extern __at(0x0FFA) __sfr PCLATH;
3123 extern __at(0x0FFB) __sfr PCLATU;
3125 //==============================================================================
3126 // STKPTR Bits
3128 extern __at(0x0FFC) __sfr STKPTR;
3130 typedef union
3132 struct
3134 unsigned SP0 : 1;
3135 unsigned SP1 : 1;
3136 unsigned SP2 : 1;
3137 unsigned SP3 : 1;
3138 unsigned SP4 : 1;
3139 unsigned : 1;
3140 unsigned STKUNF : 1;
3141 unsigned STKFUL : 1;
3144 struct
3146 unsigned : 1;
3147 unsigned : 1;
3148 unsigned : 1;
3149 unsigned : 1;
3150 unsigned : 1;
3151 unsigned : 1;
3152 unsigned : 1;
3153 unsigned STKOVF : 1;
3156 struct
3158 unsigned SP : 5;
3159 unsigned : 3;
3161 } __STKPTRbits_t;
3163 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3165 #define _SP0 0x01
3166 #define _SP1 0x02
3167 #define _SP2 0x04
3168 #define _SP3 0x08
3169 #define _SP4 0x10
3170 #define _STKUNF 0x40
3171 #define _STKFUL 0x80
3172 #define _STKOVF 0x80
3174 //==============================================================================
3176 extern __at(0x0FFD) __sfr TOS;
3177 extern __at(0x0FFD) __sfr TOSL;
3178 extern __at(0x0FFE) __sfr TOSH;
3179 extern __at(0x0FFF) __sfr TOSU;
3181 //==============================================================================
3183 // Configuration Bits
3185 //==============================================================================
3187 #define __CONFIG1H 0x300001
3188 #define __CONFIG2L 0x300002
3189 #define __CONFIG2H 0x300003
3190 #define __CONFIG3H 0x300005
3191 #define __CONFIG4L 0x300006
3192 #define __CONFIG5L 0x300008
3193 #define __CONFIG5H 0x300009
3194 #define __CONFIG6L 0x30000A
3195 #define __CONFIG6H 0x30000B
3196 #define __CONFIG7L 0x30000C
3197 #define __CONFIG7H 0x30000D
3199 //----------------------------- CONFIG1H Options -------------------------------
3201 #define _OSC_LP_1H 0xF0 // LP oscillator.
3202 #define _OSC_XT_1H 0xF1 // XT oscillator.
3203 #define _OSC_HS_1H 0xF2 // HS oscillator.
3204 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
3205 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
3206 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
3207 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
3208 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
3209 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
3210 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7.
3211 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3212 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3213 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3214 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3216 //----------------------------- CONFIG2L Options -------------------------------
3218 #define _PWRT_ON_2L 0xFE // PWRT enabled.
3219 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
3220 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3221 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3222 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3223 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3224 #define _BORV_0_2L 0xE7 // Maximum setting.
3225 #define _BORV_1_2L 0xEF
3226 #define _BORV_2_2L 0xF7
3227 #define _BORV_3_2L 0xFF // Minimum setting.
3229 //----------------------------- CONFIG2H Options -------------------------------
3231 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
3232 #define _WDT_ON_2H 0xFF // WDT enabled.
3233 #define _WDTPS_1_2H 0xE1 // 1:1.
3234 #define _WDTPS_2_2H 0xE3 // 1:2.
3235 #define _WDTPS_4_2H 0xE5 // 1:4.
3236 #define _WDTPS_8_2H 0xE7 // 1:8.
3237 #define _WDTPS_16_2H 0xE9 // 1:16.
3238 #define _WDTPS_32_2H 0xEB // 1:32.
3239 #define _WDTPS_64_2H 0xED // 1:64.
3240 #define _WDTPS_128_2H 0xEF // 1:128.
3241 #define _WDTPS_256_2H 0xF1 // 1:256.
3242 #define _WDTPS_512_2H 0xF3 // 1:512.
3243 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3244 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3245 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3246 #define _WDTPS_8192_2H 0xFB // 1:8192.
3247 #define _WDTPS_16384_2H 0xFD // 1:16384.
3248 #define _WDTPS_32768_2H 0xFF // 1:32768.
3250 //----------------------------- CONFIG3H Options -------------------------------
3252 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
3253 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
3254 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
3255 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3256 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3257 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3258 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
3259 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3261 //----------------------------- CONFIG4L Options -------------------------------
3263 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3264 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3265 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3266 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3267 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3268 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3269 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3270 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3272 //----------------------------- CONFIG5L Options -------------------------------
3274 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected.
3275 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected.
3276 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected.
3277 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected.
3278 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected.
3279 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected.
3280 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected.
3281 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected.
3283 //----------------------------- CONFIG5H Options -------------------------------
3285 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
3286 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
3288 //----------------------------- CONFIG6L Options -------------------------------
3290 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected.
3291 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected.
3292 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected.
3293 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected.
3294 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected.
3295 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected.
3296 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected.
3297 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected.
3299 //----------------------------- CONFIG6H Options -------------------------------
3301 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
3302 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
3303 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) write-protected.
3304 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) not write-protected.
3306 //----------------------------- CONFIG7L Options -------------------------------
3308 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
3309 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
3310 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
3311 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
3312 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
3313 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
3314 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
3315 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
3317 //----------------------------- CONFIG7H Options -------------------------------
3319 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) protected from table reads executed in other blocks.
3320 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) not protected from table reads executed in other blocks.
3322 //==============================================================================
3324 #define __DEVID1 0x3FFFFE
3325 #define __DEVID2 0x3FFFFF
3327 #define __IDLOC0 0x200000
3328 #define __IDLOC1 0x200001
3329 #define __IDLOC2 0x200002
3330 #define __IDLOC3 0x200003
3331 #define __IDLOC4 0x200004
3332 #define __IDLOC5 0x200005
3333 #define __IDLOC6 0x200006
3334 #define __IDLOC7 0x200007
3336 #endif // #ifndef __PIC18LF4510_H__