struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf2510.h
blob19a8cba4cd4d2fe87321821c36f5006412208e71
1 /*
2 * This declarations of the PIC18LF2510 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:00 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 __PIC18LF2510_H__
26 #define __PIC18LF2510_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 // PORTE Bits
321 extern __at(0x0F84) __sfr PORTE;
323 typedef union
325 struct
327 unsigned : 1;
328 unsigned : 1;
329 unsigned : 1;
330 unsigned RE3 : 1;
331 unsigned : 1;
332 unsigned : 1;
333 unsigned : 1;
334 unsigned : 1;
337 struct
339 unsigned : 1;
340 unsigned : 1;
341 unsigned : 1;
342 unsigned MCLR : 1;
343 unsigned : 1;
344 unsigned : 1;
345 unsigned : 1;
346 unsigned : 1;
349 struct
351 unsigned : 1;
352 unsigned : 1;
353 unsigned : 1;
354 unsigned NOT_MCLR : 1;
355 unsigned : 1;
356 unsigned : 1;
357 unsigned : 1;
358 unsigned : 1;
361 struct
363 unsigned : 1;
364 unsigned : 1;
365 unsigned : 1;
366 unsigned VPP : 1;
367 unsigned : 1;
368 unsigned : 1;
369 unsigned : 1;
370 unsigned : 1;
372 } __PORTEbits_t;
374 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
376 #define _RE3 0x08
377 #define _MCLR 0x08
378 #define _NOT_MCLR 0x08
379 #define _VPP 0x08
381 //==============================================================================
384 //==============================================================================
385 // LATA Bits
387 extern __at(0x0F89) __sfr LATA;
389 typedef struct
391 unsigned LATA0 : 1;
392 unsigned LATA1 : 1;
393 unsigned LATA2 : 1;
394 unsigned LATA3 : 1;
395 unsigned LATA4 : 1;
396 unsigned LATA5 : 1;
397 unsigned LATA6 : 1;
398 unsigned LATA7 : 1;
399 } __LATAbits_t;
401 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
403 #define _LATA0 0x01
404 #define _LATA1 0x02
405 #define _LATA2 0x04
406 #define _LATA3 0x08
407 #define _LATA4 0x10
408 #define _LATA5 0x20
409 #define _LATA6 0x40
410 #define _LATA7 0x80
412 //==============================================================================
415 //==============================================================================
416 // LATB Bits
418 extern __at(0x0F8A) __sfr LATB;
420 typedef struct
422 unsigned LATB0 : 1;
423 unsigned LATB1 : 1;
424 unsigned LATB2 : 1;
425 unsigned LATB3 : 1;
426 unsigned LATB4 : 1;
427 unsigned LATB5 : 1;
428 unsigned LATB6 : 1;
429 unsigned LATB7 : 1;
430 } __LATBbits_t;
432 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
434 #define _LATB0 0x01
435 #define _LATB1 0x02
436 #define _LATB2 0x04
437 #define _LATB3 0x08
438 #define _LATB4 0x10
439 #define _LATB5 0x20
440 #define _LATB6 0x40
441 #define _LATB7 0x80
443 //==============================================================================
446 //==============================================================================
447 // LATC Bits
449 extern __at(0x0F8B) __sfr LATC;
451 typedef struct
453 unsigned LATC0 : 1;
454 unsigned LATC1 : 1;
455 unsigned LATC2 : 1;
456 unsigned LATC3 : 1;
457 unsigned LATC4 : 1;
458 unsigned LATC5 : 1;
459 unsigned LATC6 : 1;
460 unsigned LATC7 : 1;
461 } __LATCbits_t;
463 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
465 #define _LATC0 0x01
466 #define _LATC1 0x02
467 #define _LATC2 0x04
468 #define _LATC3 0x08
469 #define _LATC4 0x10
470 #define _LATC5 0x20
471 #define _LATC6 0x40
472 #define _LATC7 0x80
474 //==============================================================================
477 //==============================================================================
478 // DDRA Bits
480 extern __at(0x0F92) __sfr DDRA;
482 typedef union
484 struct
486 unsigned TRISA0 : 1;
487 unsigned TRISA1 : 1;
488 unsigned TRISA2 : 1;
489 unsigned TRISA3 : 1;
490 unsigned TRISA4 : 1;
491 unsigned TRISA5 : 1;
492 unsigned TRISA6 : 1;
493 unsigned TRISA7 : 1;
496 struct
498 unsigned RA0 : 1;
499 unsigned RA1 : 1;
500 unsigned RA2 : 1;
501 unsigned RA3 : 1;
502 unsigned RA4 : 1;
503 unsigned RA5 : 1;
504 unsigned RA6 : 1;
505 unsigned RA7 : 1;
507 } __DDRAbits_t;
509 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
511 #define _TRISA0 0x01
512 #define _RA0 0x01
513 #define _TRISA1 0x02
514 #define _RA1 0x02
515 #define _TRISA2 0x04
516 #define _RA2 0x04
517 #define _TRISA3 0x08
518 #define _RA3 0x08
519 #define _TRISA4 0x10
520 #define _RA4 0x10
521 #define _TRISA5 0x20
522 #define _RA5 0x20
523 #define _TRISA6 0x40
524 #define _RA6 0x40
525 #define _TRISA7 0x80
526 #define _RA7 0x80
528 //==============================================================================
531 //==============================================================================
532 // TRISA Bits
534 extern __at(0x0F92) __sfr TRISA;
536 typedef union
538 struct
540 unsigned TRISA0 : 1;
541 unsigned TRISA1 : 1;
542 unsigned TRISA2 : 1;
543 unsigned TRISA3 : 1;
544 unsigned TRISA4 : 1;
545 unsigned TRISA5 : 1;
546 unsigned TRISA6 : 1;
547 unsigned TRISA7 : 1;
550 struct
552 unsigned RA0 : 1;
553 unsigned RA1 : 1;
554 unsigned RA2 : 1;
555 unsigned RA3 : 1;
556 unsigned RA4 : 1;
557 unsigned RA5 : 1;
558 unsigned RA6 : 1;
559 unsigned RA7 : 1;
561 } __TRISAbits_t;
563 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
565 #define _TRISA_TRISA0 0x01
566 #define _TRISA_RA0 0x01
567 #define _TRISA_TRISA1 0x02
568 #define _TRISA_RA1 0x02
569 #define _TRISA_TRISA2 0x04
570 #define _TRISA_RA2 0x04
571 #define _TRISA_TRISA3 0x08
572 #define _TRISA_RA3 0x08
573 #define _TRISA_TRISA4 0x10
574 #define _TRISA_RA4 0x10
575 #define _TRISA_TRISA5 0x20
576 #define _TRISA_RA5 0x20
577 #define _TRISA_TRISA6 0x40
578 #define _TRISA_RA6 0x40
579 #define _TRISA_TRISA7 0x80
580 #define _TRISA_RA7 0x80
582 //==============================================================================
585 //==============================================================================
586 // DDRB Bits
588 extern __at(0x0F93) __sfr DDRB;
590 typedef union
592 struct
594 unsigned TRISB0 : 1;
595 unsigned TRISB1 : 1;
596 unsigned TRISB2 : 1;
597 unsigned TRISB3 : 1;
598 unsigned TRISB4 : 1;
599 unsigned TRISB5 : 1;
600 unsigned TRISB6 : 1;
601 unsigned TRISB7 : 1;
604 struct
606 unsigned RB0 : 1;
607 unsigned RB1 : 1;
608 unsigned RB2 : 1;
609 unsigned RB3 : 1;
610 unsigned RB4 : 1;
611 unsigned RB5 : 1;
612 unsigned RB6 : 1;
613 unsigned RB7 : 1;
615 } __DDRBbits_t;
617 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
619 #define _TRISB0 0x01
620 #define _RB0 0x01
621 #define _TRISB1 0x02
622 #define _RB1 0x02
623 #define _TRISB2 0x04
624 #define _RB2 0x04
625 #define _TRISB3 0x08
626 #define _RB3 0x08
627 #define _TRISB4 0x10
628 #define _RB4 0x10
629 #define _TRISB5 0x20
630 #define _RB5 0x20
631 #define _TRISB6 0x40
632 #define _RB6 0x40
633 #define _TRISB7 0x80
634 #define _RB7 0x80
636 //==============================================================================
639 //==============================================================================
640 // TRISB Bits
642 extern __at(0x0F93) __sfr TRISB;
644 typedef union
646 struct
648 unsigned TRISB0 : 1;
649 unsigned TRISB1 : 1;
650 unsigned TRISB2 : 1;
651 unsigned TRISB3 : 1;
652 unsigned TRISB4 : 1;
653 unsigned TRISB5 : 1;
654 unsigned TRISB6 : 1;
655 unsigned TRISB7 : 1;
658 struct
660 unsigned RB0 : 1;
661 unsigned RB1 : 1;
662 unsigned RB2 : 1;
663 unsigned RB3 : 1;
664 unsigned RB4 : 1;
665 unsigned RB5 : 1;
666 unsigned RB6 : 1;
667 unsigned RB7 : 1;
669 } __TRISBbits_t;
671 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
673 #define _TRISB_TRISB0 0x01
674 #define _TRISB_RB0 0x01
675 #define _TRISB_TRISB1 0x02
676 #define _TRISB_RB1 0x02
677 #define _TRISB_TRISB2 0x04
678 #define _TRISB_RB2 0x04
679 #define _TRISB_TRISB3 0x08
680 #define _TRISB_RB3 0x08
681 #define _TRISB_TRISB4 0x10
682 #define _TRISB_RB4 0x10
683 #define _TRISB_TRISB5 0x20
684 #define _TRISB_RB5 0x20
685 #define _TRISB_TRISB6 0x40
686 #define _TRISB_RB6 0x40
687 #define _TRISB_TRISB7 0x80
688 #define _TRISB_RB7 0x80
690 //==============================================================================
693 //==============================================================================
694 // DDRC Bits
696 extern __at(0x0F94) __sfr DDRC;
698 typedef union
700 struct
702 unsigned TRISC0 : 1;
703 unsigned TRISC1 : 1;
704 unsigned TRISC2 : 1;
705 unsigned TRISC3 : 1;
706 unsigned TRISC4 : 1;
707 unsigned TRISC5 : 1;
708 unsigned TRISC6 : 1;
709 unsigned TRISC7 : 1;
712 struct
714 unsigned RC0 : 1;
715 unsigned RC1 : 1;
716 unsigned RC2 : 1;
717 unsigned RC3 : 1;
718 unsigned RC4 : 1;
719 unsigned RC5 : 1;
720 unsigned RC6 : 1;
721 unsigned RC7 : 1;
723 } __DDRCbits_t;
725 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
727 #define _TRISC0 0x01
728 #define _RC0 0x01
729 #define _TRISC1 0x02
730 #define _RC1 0x02
731 #define _TRISC2 0x04
732 #define _RC2 0x04
733 #define _TRISC3 0x08
734 #define _RC3 0x08
735 #define _TRISC4 0x10
736 #define _RC4 0x10
737 #define _TRISC5 0x20
738 #define _RC5 0x20
739 #define _TRISC6 0x40
740 #define _RC6 0x40
741 #define _TRISC7 0x80
742 #define _RC7 0x80
744 //==============================================================================
747 //==============================================================================
748 // TRISC Bits
750 extern __at(0x0F94) __sfr TRISC;
752 typedef union
754 struct
756 unsigned TRISC0 : 1;
757 unsigned TRISC1 : 1;
758 unsigned TRISC2 : 1;
759 unsigned TRISC3 : 1;
760 unsigned TRISC4 : 1;
761 unsigned TRISC5 : 1;
762 unsigned TRISC6 : 1;
763 unsigned TRISC7 : 1;
766 struct
768 unsigned RC0 : 1;
769 unsigned RC1 : 1;
770 unsigned RC2 : 1;
771 unsigned RC3 : 1;
772 unsigned RC4 : 1;
773 unsigned RC5 : 1;
774 unsigned RC6 : 1;
775 unsigned RC7 : 1;
777 } __TRISCbits_t;
779 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
781 #define _TRISC_TRISC0 0x01
782 #define _TRISC_RC0 0x01
783 #define _TRISC_TRISC1 0x02
784 #define _TRISC_RC1 0x02
785 #define _TRISC_TRISC2 0x04
786 #define _TRISC_RC2 0x04
787 #define _TRISC_TRISC3 0x08
788 #define _TRISC_RC3 0x08
789 #define _TRISC_TRISC4 0x10
790 #define _TRISC_RC4 0x10
791 #define _TRISC_TRISC5 0x20
792 #define _TRISC_RC5 0x20
793 #define _TRISC_TRISC6 0x40
794 #define _TRISC_RC6 0x40
795 #define _TRISC_TRISC7 0x80
796 #define _TRISC_RC7 0x80
798 //==============================================================================
801 //==============================================================================
802 // OSCTUNE Bits
804 extern __at(0x0F9B) __sfr OSCTUNE;
806 typedef union
808 struct
810 unsigned TUN0 : 1;
811 unsigned TUN1 : 1;
812 unsigned TUN2 : 1;
813 unsigned TUN3 : 1;
814 unsigned TUN4 : 1;
815 unsigned : 1;
816 unsigned PLLEN : 1;
817 unsigned INTSRC : 1;
820 struct
822 unsigned TUN : 5;
823 unsigned : 3;
825 } __OSCTUNEbits_t;
827 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
829 #define _TUN0 0x01
830 #define _TUN1 0x02
831 #define _TUN2 0x04
832 #define _TUN3 0x08
833 #define _TUN4 0x10
834 #define _PLLEN 0x40
835 #define _INTSRC 0x80
837 //==============================================================================
840 //==============================================================================
841 // PIE1 Bits
843 extern __at(0x0F9D) __sfr PIE1;
845 typedef struct
847 unsigned TMR1IE : 1;
848 unsigned TMR2IE : 1;
849 unsigned CCP1IE : 1;
850 unsigned SSPIE : 1;
851 unsigned TXIE : 1;
852 unsigned RCIE : 1;
853 unsigned ADIE : 1;
854 unsigned : 1;
855 } __PIE1bits_t;
857 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
859 #define _TMR1IE 0x01
860 #define _TMR2IE 0x02
861 #define _CCP1IE 0x04
862 #define _SSPIE 0x08
863 #define _TXIE 0x10
864 #define _RCIE 0x20
865 #define _ADIE 0x40
867 //==============================================================================
870 //==============================================================================
871 // PIR1 Bits
873 extern __at(0x0F9E) __sfr PIR1;
875 typedef struct
877 unsigned TMR1IF : 1;
878 unsigned TMR2IF : 1;
879 unsigned CCP1IF : 1;
880 unsigned SSPIF : 1;
881 unsigned TXIF : 1;
882 unsigned RCIF : 1;
883 unsigned ADIF : 1;
884 unsigned : 1;
885 } __PIR1bits_t;
887 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
889 #define _TMR1IF 0x01
890 #define _TMR2IF 0x02
891 #define _CCP1IF 0x04
892 #define _SSPIF 0x08
893 #define _TXIF 0x10
894 #define _RCIF 0x20
895 #define _ADIF 0x40
897 //==============================================================================
900 //==============================================================================
901 // IPR1 Bits
903 extern __at(0x0F9F) __sfr IPR1;
905 typedef struct
907 unsigned TMR1IP : 1;
908 unsigned TMR2IP : 1;
909 unsigned CCP1IP : 1;
910 unsigned SSPIP : 1;
911 unsigned TXIP : 1;
912 unsigned RCIP : 1;
913 unsigned ADIP : 1;
914 unsigned : 1;
915 } __IPR1bits_t;
917 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
919 #define _TMR1IP 0x01
920 #define _TMR2IP 0x02
921 #define _CCP1IP 0x04
922 #define _SSPIP 0x08
923 #define _TXIP 0x10
924 #define _RCIP 0x20
925 #define _ADIP 0x40
927 //==============================================================================
930 //==============================================================================
931 // PIE2 Bits
933 extern __at(0x0FA0) __sfr PIE2;
935 typedef union
937 struct
939 unsigned CCP2IE : 1;
940 unsigned TMR3IE : 1;
941 unsigned HLVDIE : 1;
942 unsigned BCLIE : 1;
943 unsigned : 1;
944 unsigned : 1;
945 unsigned CMIE : 1;
946 unsigned OSCFIE : 1;
949 struct
951 unsigned : 1;
952 unsigned : 1;
953 unsigned LVDIE : 1;
954 unsigned : 1;
955 unsigned : 1;
956 unsigned : 1;
957 unsigned : 1;
958 unsigned : 1;
960 } __PIE2bits_t;
962 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
964 #define _CCP2IE 0x01
965 #define _TMR3IE 0x02
966 #define _HLVDIE 0x04
967 #define _LVDIE 0x04
968 #define _BCLIE 0x08
969 #define _CMIE 0x40
970 #define _OSCFIE 0x80
972 //==============================================================================
975 //==============================================================================
976 // PIR2 Bits
978 extern __at(0x0FA1) __sfr PIR2;
980 typedef union
982 struct
984 unsigned CCP2IF : 1;
985 unsigned TMR3IF : 1;
986 unsigned HLVDIF : 1;
987 unsigned BCLIF : 1;
988 unsigned : 1;
989 unsigned : 1;
990 unsigned CMIF : 1;
991 unsigned OSCFIF : 1;
994 struct
996 unsigned : 1;
997 unsigned : 1;
998 unsigned LVDIF : 1;
999 unsigned : 1;
1000 unsigned : 1;
1001 unsigned : 1;
1002 unsigned : 1;
1003 unsigned : 1;
1005 } __PIR2bits_t;
1007 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1009 #define _CCP2IF 0x01
1010 #define _TMR3IF 0x02
1011 #define _HLVDIF 0x04
1012 #define _LVDIF 0x04
1013 #define _BCLIF 0x08
1014 #define _CMIF 0x40
1015 #define _OSCFIF 0x80
1017 //==============================================================================
1020 //==============================================================================
1021 // IPR2 Bits
1023 extern __at(0x0FA2) __sfr IPR2;
1025 typedef union
1027 struct
1029 unsigned CCP2IP : 1;
1030 unsigned TMR3IP : 1;
1031 unsigned HLVDIP : 1;
1032 unsigned BCLIP : 1;
1033 unsigned : 1;
1034 unsigned : 1;
1035 unsigned CMIP : 1;
1036 unsigned OSCFIP : 1;
1039 struct
1041 unsigned : 1;
1042 unsigned : 1;
1043 unsigned LVDIP : 1;
1044 unsigned : 1;
1045 unsigned : 1;
1046 unsigned : 1;
1047 unsigned : 1;
1048 unsigned : 1;
1050 } __IPR2bits_t;
1052 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1054 #define _CCP2IP 0x01
1055 #define _TMR3IP 0x02
1056 #define _HLVDIP 0x04
1057 #define _LVDIP 0x04
1058 #define _BCLIP 0x08
1059 #define _CMIP 0x40
1060 #define _OSCFIP 0x80
1062 //==============================================================================
1065 //==============================================================================
1066 // RCSTA Bits
1068 extern __at(0x0FAB) __sfr RCSTA;
1070 typedef union
1072 struct
1074 unsigned RX9D : 1;
1075 unsigned OERR : 1;
1076 unsigned FERR : 1;
1077 unsigned ADDEN : 1;
1078 unsigned CREN : 1;
1079 unsigned SREN : 1;
1080 unsigned RX9 : 1;
1081 unsigned SPEN : 1;
1084 struct
1086 unsigned : 1;
1087 unsigned : 1;
1088 unsigned : 1;
1089 unsigned ADEN : 1;
1090 unsigned : 1;
1091 unsigned : 1;
1092 unsigned : 1;
1093 unsigned : 1;
1095 } __RCSTAbits_t;
1097 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1099 #define _RX9D 0x01
1100 #define _OERR 0x02
1101 #define _FERR 0x04
1102 #define _ADDEN 0x08
1103 #define _ADEN 0x08
1104 #define _CREN 0x10
1105 #define _SREN 0x20
1106 #define _RX9 0x40
1107 #define _SPEN 0x80
1109 //==============================================================================
1112 //==============================================================================
1113 // TXSTA Bits
1115 extern __at(0x0FAC) __sfr TXSTA;
1117 typedef struct
1119 unsigned TX9D : 1;
1120 unsigned TRMT : 1;
1121 unsigned BRGH : 1;
1122 unsigned SENDB : 1;
1123 unsigned SYNC : 1;
1124 unsigned TXEN : 1;
1125 unsigned TX9 : 1;
1126 unsigned CSRC : 1;
1127 } __TXSTAbits_t;
1129 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1131 #define _TX9D 0x01
1132 #define _TRMT 0x02
1133 #define _BRGH 0x04
1134 #define _SENDB 0x08
1135 #define _SYNC 0x10
1136 #define _TXEN 0x20
1137 #define _TX9 0x40
1138 #define _CSRC 0x80
1140 //==============================================================================
1142 extern __at(0x0FAD) __sfr TXREG;
1143 extern __at(0x0FAE) __sfr RCREG;
1144 extern __at(0x0FAF) __sfr SPBRG;
1145 extern __at(0x0FB0) __sfr SPBRGH;
1147 //==============================================================================
1148 // T3CON Bits
1150 extern __at(0x0FB1) __sfr T3CON;
1152 typedef union
1154 struct
1156 unsigned TMR3ON : 1;
1157 unsigned TMR3CS : 1;
1158 unsigned NOT_T3SYNC : 1;
1159 unsigned T3CCP1 : 1;
1160 unsigned T3CKPS0 : 1;
1161 unsigned T3CKPS1 : 1;
1162 unsigned T3CCP2 : 1;
1163 unsigned RD16 : 1;
1166 struct
1168 unsigned : 1;
1169 unsigned : 1;
1170 unsigned T3SYNC : 1;
1171 unsigned : 1;
1172 unsigned : 1;
1173 unsigned : 1;
1174 unsigned : 1;
1175 unsigned : 1;
1178 struct
1180 unsigned : 4;
1181 unsigned T3CKPS : 2;
1182 unsigned : 2;
1184 } __T3CONbits_t;
1186 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1188 #define _T3CON_TMR3ON 0x01
1189 #define _T3CON_TMR3CS 0x02
1190 #define _T3CON_NOT_T3SYNC 0x04
1191 #define _T3CON_T3SYNC 0x04
1192 #define _T3CON_T3CCP1 0x08
1193 #define _T3CON_T3CKPS0 0x10
1194 #define _T3CON_T3CKPS1 0x20
1195 #define _T3CON_T3CCP2 0x40
1196 #define _T3CON_RD16 0x80
1198 //==============================================================================
1200 extern __at(0x0FB2) __sfr TMR3;
1201 extern __at(0x0FB2) __sfr TMR3L;
1202 extern __at(0x0FB3) __sfr TMR3H;
1204 //==============================================================================
1205 // CMCON Bits
1207 extern __at(0x0FB4) __sfr CMCON;
1209 typedef union
1211 struct
1213 unsigned CM0 : 1;
1214 unsigned CM1 : 1;
1215 unsigned CM2 : 1;
1216 unsigned CIS : 1;
1217 unsigned C1INV : 1;
1218 unsigned C2INV : 1;
1219 unsigned C1OUT : 1;
1220 unsigned C2OUT : 1;
1223 struct
1225 unsigned CM : 3;
1226 unsigned : 5;
1228 } __CMCONbits_t;
1230 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1232 #define _CM0 0x01
1233 #define _CM1 0x02
1234 #define _CM2 0x04
1235 #define _CIS 0x08
1236 #define _C1INV 0x10
1237 #define _C2INV 0x20
1238 #define _C1OUT 0x40
1239 #define _C2OUT 0x80
1241 //==============================================================================
1244 //==============================================================================
1245 // CVRCON Bits
1247 extern __at(0x0FB5) __sfr CVRCON;
1249 typedef union
1251 struct
1253 unsigned CVR0 : 1;
1254 unsigned CVR1 : 1;
1255 unsigned CVR2 : 1;
1256 unsigned CVR3 : 1;
1257 unsigned CVRSS : 1;
1258 unsigned CVRR : 1;
1259 unsigned CVROE : 1;
1260 unsigned CVREN : 1;
1263 struct
1265 unsigned CVR : 4;
1266 unsigned : 4;
1268 } __CVRCONbits_t;
1270 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1272 #define _CVR0 0x01
1273 #define _CVR1 0x02
1274 #define _CVR2 0x04
1275 #define _CVR3 0x08
1276 #define _CVRSS 0x10
1277 #define _CVRR 0x20
1278 #define _CVROE 0x40
1279 #define _CVREN 0x80
1281 //==============================================================================
1284 //==============================================================================
1285 // ECCP1AS Bits
1287 extern __at(0x0FB6) __sfr ECCP1AS;
1289 typedef union
1291 struct
1293 unsigned : 1;
1294 unsigned : 1;
1295 unsigned PSSAC0 : 1;
1296 unsigned PSSAC1 : 1;
1297 unsigned ECCPAS0 : 1;
1298 unsigned ECCPAS1 : 1;
1299 unsigned ECCPAS2 : 1;
1300 unsigned ECCPASE : 1;
1303 struct
1305 unsigned : 2;
1306 unsigned PSSAC : 2;
1307 unsigned : 4;
1310 struct
1312 unsigned : 4;
1313 unsigned ECCPAS : 3;
1314 unsigned : 1;
1316 } __ECCP1ASbits_t;
1318 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1320 #define _PSSAC0 0x04
1321 #define _PSSAC1 0x08
1322 #define _ECCPAS0 0x10
1323 #define _ECCPAS1 0x20
1324 #define _ECCPAS2 0x40
1325 #define _ECCPASE 0x80
1327 //==============================================================================
1330 //==============================================================================
1331 // ECCPAS Bits
1333 extern __at(0x0FB6) __sfr ECCPAS;
1335 typedef union
1337 struct
1339 unsigned : 1;
1340 unsigned : 1;
1341 unsigned PSSAC0 : 1;
1342 unsigned PSSAC1 : 1;
1343 unsigned ECCPAS0 : 1;
1344 unsigned ECCPAS1 : 1;
1345 unsigned ECCPAS2 : 1;
1346 unsigned ECCPASE : 1;
1349 struct
1351 unsigned : 2;
1352 unsigned PSSAC : 2;
1353 unsigned : 4;
1356 struct
1358 unsigned : 4;
1359 unsigned ECCPAS : 3;
1360 unsigned : 1;
1362 } __ECCPASbits_t;
1364 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1366 #define _ECCPAS_PSSAC0 0x04
1367 #define _ECCPAS_PSSAC1 0x08
1368 #define _ECCPAS_ECCPAS0 0x10
1369 #define _ECCPAS_ECCPAS1 0x20
1370 #define _ECCPAS_ECCPAS2 0x40
1371 #define _ECCPAS_ECCPASE 0x80
1373 //==============================================================================
1376 //==============================================================================
1377 // ECCP1DEL Bits
1379 extern __at(0x0FB7) __sfr ECCP1DEL;
1381 typedef struct
1383 unsigned : 1;
1384 unsigned : 1;
1385 unsigned : 1;
1386 unsigned : 1;
1387 unsigned : 1;
1388 unsigned : 1;
1389 unsigned : 1;
1390 unsigned PRSEN : 1;
1391 } __ECCP1DELbits_t;
1393 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1395 #define _PRSEN 0x80
1397 //==============================================================================
1400 //==============================================================================
1401 // PWM1CON Bits
1403 extern __at(0x0FB7) __sfr PWM1CON;
1405 typedef struct
1407 unsigned : 1;
1408 unsigned : 1;
1409 unsigned : 1;
1410 unsigned : 1;
1411 unsigned : 1;
1412 unsigned : 1;
1413 unsigned : 1;
1414 unsigned PRSEN : 1;
1415 } __PWM1CONbits_t;
1417 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1419 #define _PWM1CON_PRSEN 0x80
1421 //==============================================================================
1424 //==============================================================================
1425 // BAUDCON Bits
1427 extern __at(0x0FB8) __sfr BAUDCON;
1429 typedef union
1431 struct
1433 unsigned ABDEN : 1;
1434 unsigned WUE : 1;
1435 unsigned : 1;
1436 unsigned BRG16 : 1;
1437 unsigned TXCKP : 1;
1438 unsigned RXDTP : 1;
1439 unsigned RCIDL : 1;
1440 unsigned ABDOVF : 1;
1443 struct
1445 unsigned : 1;
1446 unsigned : 1;
1447 unsigned : 1;
1448 unsigned : 1;
1449 unsigned SCKP : 1;
1450 unsigned : 1;
1451 unsigned RCMT : 1;
1452 unsigned : 1;
1454 } __BAUDCONbits_t;
1456 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1458 #define _ABDEN 0x01
1459 #define _WUE 0x02
1460 #define _BRG16 0x08
1461 #define _TXCKP 0x10
1462 #define _SCKP 0x10
1463 #define _RXDTP 0x20
1464 #define _RCIDL 0x40
1465 #define _RCMT 0x40
1466 #define _ABDOVF 0x80
1468 //==============================================================================
1471 //==============================================================================
1472 // BAUDCTL Bits
1474 extern __at(0x0FB8) __sfr BAUDCTL;
1476 typedef union
1478 struct
1480 unsigned ABDEN : 1;
1481 unsigned WUE : 1;
1482 unsigned : 1;
1483 unsigned BRG16 : 1;
1484 unsigned TXCKP : 1;
1485 unsigned RXDTP : 1;
1486 unsigned RCIDL : 1;
1487 unsigned ABDOVF : 1;
1490 struct
1492 unsigned : 1;
1493 unsigned : 1;
1494 unsigned : 1;
1495 unsigned : 1;
1496 unsigned SCKP : 1;
1497 unsigned : 1;
1498 unsigned RCMT : 1;
1499 unsigned : 1;
1501 } __BAUDCTLbits_t;
1503 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1505 #define _BAUDCTL_ABDEN 0x01
1506 #define _BAUDCTL_WUE 0x02
1507 #define _BAUDCTL_BRG16 0x08
1508 #define _BAUDCTL_TXCKP 0x10
1509 #define _BAUDCTL_SCKP 0x10
1510 #define _BAUDCTL_RXDTP 0x20
1511 #define _BAUDCTL_RCIDL 0x40
1512 #define _BAUDCTL_RCMT 0x40
1513 #define _BAUDCTL_ABDOVF 0x80
1515 //==============================================================================
1518 //==============================================================================
1519 // CCP2CON Bits
1521 extern __at(0x0FBA) __sfr CCP2CON;
1523 typedef union
1525 struct
1527 unsigned CCP2M0 : 1;
1528 unsigned CCP2M1 : 1;
1529 unsigned CCP2M2 : 1;
1530 unsigned CCP2M3 : 1;
1531 unsigned CCP2Y : 1;
1532 unsigned CCP2X : 1;
1533 unsigned : 1;
1534 unsigned : 1;
1537 struct
1539 unsigned : 1;
1540 unsigned : 1;
1541 unsigned : 1;
1542 unsigned : 1;
1543 unsigned DC2B0 : 1;
1544 unsigned DC2B1 : 1;
1545 unsigned : 1;
1546 unsigned : 1;
1549 struct
1551 unsigned CCP2M : 4;
1552 unsigned : 4;
1555 struct
1557 unsigned : 4;
1558 unsigned DC2B : 2;
1559 unsigned : 2;
1561 } __CCP2CONbits_t;
1563 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1565 #define _CCP2M0 0x01
1566 #define _CCP2M1 0x02
1567 #define _CCP2M2 0x04
1568 #define _CCP2M3 0x08
1569 #define _CCP2Y 0x10
1570 #define _DC2B0 0x10
1571 #define _CCP2X 0x20
1572 #define _DC2B1 0x20
1574 //==============================================================================
1576 extern __at(0x0FBB) __sfr CCPR2;
1577 extern __at(0x0FBB) __sfr CCPR2L;
1578 extern __at(0x0FBC) __sfr CCPR2H;
1580 //==============================================================================
1581 // CCP1CON Bits
1583 extern __at(0x0FBD) __sfr CCP1CON;
1585 typedef union
1587 struct
1589 unsigned CCP1M0 : 1;
1590 unsigned CCP1M1 : 1;
1591 unsigned CCP1M2 : 1;
1592 unsigned CCP1M3 : 1;
1593 unsigned CCP1Y : 1;
1594 unsigned CCP1X : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1599 struct
1601 unsigned : 1;
1602 unsigned : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1605 unsigned DC1B0 : 1;
1606 unsigned DC1B1 : 1;
1607 unsigned : 1;
1608 unsigned : 1;
1611 struct
1613 unsigned CCP1M : 4;
1614 unsigned : 4;
1617 struct
1619 unsigned : 4;
1620 unsigned DC1B : 2;
1621 unsigned : 2;
1623 } __CCP1CONbits_t;
1625 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1627 #define _CCP1M0 0x01
1628 #define _CCP1M1 0x02
1629 #define _CCP1M2 0x04
1630 #define _CCP1M3 0x08
1631 #define _CCP1Y 0x10
1632 #define _DC1B0 0x10
1633 #define _CCP1X 0x20
1634 #define _DC1B1 0x20
1636 //==============================================================================
1638 extern __at(0x0FBE) __sfr CCPR1;
1639 extern __at(0x0FBE) __sfr CCPR1L;
1640 extern __at(0x0FBF) __sfr CCPR1H;
1642 //==============================================================================
1643 // ADCON2 Bits
1645 extern __at(0x0FC0) __sfr ADCON2;
1647 typedef union
1649 struct
1651 unsigned ADCS0 : 1;
1652 unsigned ADCS1 : 1;
1653 unsigned ADCS2 : 1;
1654 unsigned ACQT0 : 1;
1655 unsigned ACQT1 : 1;
1656 unsigned ACQT2 : 1;
1657 unsigned : 1;
1658 unsigned ADFM : 1;
1661 struct
1663 unsigned ADCS : 3;
1664 unsigned : 5;
1667 struct
1669 unsigned : 3;
1670 unsigned ACQT : 3;
1671 unsigned : 2;
1673 } __ADCON2bits_t;
1675 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1677 #define _ADCS0 0x01
1678 #define _ADCS1 0x02
1679 #define _ADCS2 0x04
1680 #define _ACQT0 0x08
1681 #define _ACQT1 0x10
1682 #define _ACQT2 0x20
1683 #define _ADFM 0x80
1685 //==============================================================================
1688 //==============================================================================
1689 // ADCON1 Bits
1691 extern __at(0x0FC1) __sfr ADCON1;
1693 typedef union
1695 struct
1697 unsigned PCFG0 : 1;
1698 unsigned PCFG1 : 1;
1699 unsigned PCFG2 : 1;
1700 unsigned PCFG3 : 1;
1701 unsigned VCFG0 : 1;
1702 unsigned VCFG1 : 1;
1703 unsigned : 1;
1704 unsigned : 1;
1707 struct
1709 unsigned PCFG : 4;
1710 unsigned : 4;
1713 struct
1715 unsigned : 4;
1716 unsigned VCFG : 2;
1717 unsigned : 2;
1719 } __ADCON1bits_t;
1721 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1723 #define _PCFG0 0x01
1724 #define _PCFG1 0x02
1725 #define _PCFG2 0x04
1726 #define _PCFG3 0x08
1727 #define _VCFG0 0x10
1728 #define _VCFG1 0x20
1730 //==============================================================================
1733 //==============================================================================
1734 // ADCON0 Bits
1736 extern __at(0x0FC2) __sfr ADCON0;
1738 typedef union
1740 struct
1742 unsigned ADON : 1;
1743 unsigned GO_NOT_DONE : 1;
1744 unsigned CHS0 : 1;
1745 unsigned CHS1 : 1;
1746 unsigned CHS2 : 1;
1747 unsigned CHS3 : 1;
1748 unsigned : 1;
1749 unsigned : 1;
1752 struct
1754 unsigned : 1;
1755 unsigned GO : 1;
1756 unsigned : 1;
1757 unsigned : 1;
1758 unsigned : 1;
1759 unsigned : 1;
1760 unsigned : 1;
1761 unsigned : 1;
1764 struct
1766 unsigned : 1;
1767 unsigned DONE : 1;
1768 unsigned : 1;
1769 unsigned : 1;
1770 unsigned : 1;
1771 unsigned : 1;
1772 unsigned : 1;
1773 unsigned : 1;
1776 struct
1778 unsigned : 1;
1779 unsigned NOT_DONE : 1;
1780 unsigned : 1;
1781 unsigned : 1;
1782 unsigned : 1;
1783 unsigned : 1;
1784 unsigned : 1;
1785 unsigned : 1;
1788 struct
1790 unsigned : 1;
1791 unsigned GO_DONE : 1;
1792 unsigned : 1;
1793 unsigned : 1;
1794 unsigned : 1;
1795 unsigned : 1;
1796 unsigned : 1;
1797 unsigned : 1;
1800 struct
1802 unsigned : 2;
1803 unsigned CHS : 4;
1804 unsigned : 2;
1806 } __ADCON0bits_t;
1808 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1810 #define _ADON 0x01
1811 #define _GO_NOT_DONE 0x02
1812 #define _GO 0x02
1813 #define _DONE 0x02
1814 #define _NOT_DONE 0x02
1815 #define _GO_DONE 0x02
1816 #define _CHS0 0x04
1817 #define _CHS1 0x08
1818 #define _CHS2 0x10
1819 #define _CHS3 0x20
1821 //==============================================================================
1823 extern __at(0x0FC3) __sfr ADRES;
1824 extern __at(0x0FC3) __sfr ADRESL;
1825 extern __at(0x0FC4) __sfr ADRESH;
1827 //==============================================================================
1828 // SSPCON2 Bits
1830 extern __at(0x0FC5) __sfr SSPCON2;
1832 typedef struct
1834 unsigned SEN : 1;
1835 unsigned RSEN : 1;
1836 unsigned PEN : 1;
1837 unsigned RCEN : 1;
1838 unsigned ACKEN : 1;
1839 unsigned ACKDT : 1;
1840 unsigned ACKSTAT : 1;
1841 unsigned GCEN : 1;
1842 } __SSPCON2bits_t;
1844 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1846 #define _SEN 0x01
1847 #define _RSEN 0x02
1848 #define _PEN 0x04
1849 #define _RCEN 0x08
1850 #define _ACKEN 0x10
1851 #define _ACKDT 0x20
1852 #define _ACKSTAT 0x40
1853 #define _GCEN 0x80
1855 //==============================================================================
1858 //==============================================================================
1859 // SSPCON1 Bits
1861 extern __at(0x0FC6) __sfr SSPCON1;
1863 typedef union
1865 struct
1867 unsigned SSPM0 : 1;
1868 unsigned SSPM1 : 1;
1869 unsigned SSPM2 : 1;
1870 unsigned SSPM3 : 1;
1871 unsigned CKP : 1;
1872 unsigned SSPEN : 1;
1873 unsigned SSPOV : 1;
1874 unsigned WCOL : 1;
1877 struct
1879 unsigned SSPM : 4;
1880 unsigned : 4;
1882 } __SSPCON1bits_t;
1884 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1886 #define _SSPM0 0x01
1887 #define _SSPM1 0x02
1888 #define _SSPM2 0x04
1889 #define _SSPM3 0x08
1890 #define _CKP 0x10
1891 #define _SSPEN 0x20
1892 #define _SSPOV 0x40
1893 #define _WCOL 0x80
1895 //==============================================================================
1898 //==============================================================================
1899 // SSPSTAT Bits
1901 extern __at(0x0FC7) __sfr SSPSTAT;
1903 typedef union
1905 struct
1907 unsigned BF : 1;
1908 unsigned UA : 1;
1909 unsigned R_NOT_W : 1;
1910 unsigned S : 1;
1911 unsigned P : 1;
1912 unsigned D_NOT_A : 1;
1913 unsigned CKE : 1;
1914 unsigned SMP : 1;
1917 struct
1919 unsigned : 1;
1920 unsigned : 1;
1921 unsigned R : 1;
1922 unsigned START : 1;
1923 unsigned STOP : 1;
1924 unsigned D : 1;
1925 unsigned : 1;
1926 unsigned : 1;
1929 struct
1931 unsigned : 1;
1932 unsigned : 1;
1933 unsigned NOT_W : 1;
1934 unsigned : 1;
1935 unsigned : 1;
1936 unsigned NOT_A : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1941 struct
1943 unsigned : 1;
1944 unsigned : 1;
1945 unsigned R_W : 1;
1946 unsigned : 1;
1947 unsigned : 1;
1948 unsigned D_A : 1;
1949 unsigned : 1;
1950 unsigned : 1;
1953 struct
1955 unsigned : 1;
1956 unsigned : 1;
1957 unsigned NOT_WRITE : 1;
1958 unsigned : 1;
1959 unsigned : 1;
1960 unsigned NOT_ADDRESS : 1;
1961 unsigned : 1;
1962 unsigned : 1;
1964 } __SSPSTATbits_t;
1966 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1968 #define _BF 0x01
1969 #define _UA 0x02
1970 #define _R_NOT_W 0x04
1971 #define _R 0x04
1972 #define _NOT_W 0x04
1973 #define _R_W 0x04
1974 #define _NOT_WRITE 0x04
1975 #define _S 0x08
1976 #define _START 0x08
1977 #define _P 0x10
1978 #define _STOP 0x10
1979 #define _D_NOT_A 0x20
1980 #define _D 0x20
1981 #define _NOT_A 0x20
1982 #define _D_A 0x20
1983 #define _NOT_ADDRESS 0x20
1984 #define _CKE 0x40
1985 #define _SMP 0x80
1987 //==============================================================================
1989 extern __at(0x0FC8) __sfr SSPADD;
1990 extern __at(0x0FC9) __sfr SSPBUF;
1992 //==============================================================================
1993 // T2CON Bits
1995 extern __at(0x0FCA) __sfr T2CON;
1997 typedef union
1999 struct
2001 unsigned T2CKPS0 : 1;
2002 unsigned T2CKPS1 : 1;
2003 unsigned TMR2ON : 1;
2004 unsigned T2OUTPS0 : 1;
2005 unsigned T2OUTPS1 : 1;
2006 unsigned T2OUTPS2 : 1;
2007 unsigned T2OUTPS3 : 1;
2008 unsigned : 1;
2011 struct
2013 unsigned : 1;
2014 unsigned : 1;
2015 unsigned : 1;
2016 unsigned TOUTPS0 : 1;
2017 unsigned TOUTPS1 : 1;
2018 unsigned TOUTPS2 : 1;
2019 unsigned TOUTPS3 : 1;
2020 unsigned : 1;
2023 struct
2025 unsigned T2CKPS : 2;
2026 unsigned : 6;
2029 struct
2031 unsigned : 3;
2032 unsigned TOUTPS : 4;
2033 unsigned : 1;
2036 struct
2038 unsigned : 3;
2039 unsigned T2OUTPS : 4;
2040 unsigned : 1;
2042 } __T2CONbits_t;
2044 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2046 #define _T2CKPS0 0x01
2047 #define _T2CKPS1 0x02
2048 #define _TMR2ON 0x04
2049 #define _T2OUTPS0 0x08
2050 #define _TOUTPS0 0x08
2051 #define _T2OUTPS1 0x10
2052 #define _TOUTPS1 0x10
2053 #define _T2OUTPS2 0x20
2054 #define _TOUTPS2 0x20
2055 #define _T2OUTPS3 0x40
2056 #define _TOUTPS3 0x40
2058 //==============================================================================
2060 extern __at(0x0FCB) __sfr PR2;
2061 extern __at(0x0FCC) __sfr TMR2;
2063 //==============================================================================
2064 // T1CON Bits
2066 extern __at(0x0FCD) __sfr T1CON;
2068 typedef union
2070 struct
2072 unsigned TMR1ON : 1;
2073 unsigned TMR1CS : 1;
2074 unsigned NOT_T1SYNC : 1;
2075 unsigned T1OSCEN : 1;
2076 unsigned T1CKPS0 : 1;
2077 unsigned T1CKPS1 : 1;
2078 unsigned T1RUN : 1;
2079 unsigned RD16 : 1;
2082 struct
2084 unsigned : 1;
2085 unsigned : 1;
2086 unsigned T1SYNC : 1;
2087 unsigned : 1;
2088 unsigned : 1;
2089 unsigned : 1;
2090 unsigned : 1;
2091 unsigned : 1;
2094 struct
2096 unsigned : 4;
2097 unsigned T1CKPS : 2;
2098 unsigned : 2;
2100 } __T1CONbits_t;
2102 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2104 #define _TMR1ON 0x01
2105 #define _TMR1CS 0x02
2106 #define _NOT_T1SYNC 0x04
2107 #define _T1SYNC 0x04
2108 #define _T1OSCEN 0x08
2109 #define _T1CKPS0 0x10
2110 #define _T1CKPS1 0x20
2111 #define _T1RUN 0x40
2112 #define _RD16 0x80
2114 //==============================================================================
2116 extern __at(0x0FCE) __sfr TMR1;
2117 extern __at(0x0FCE) __sfr TMR1L;
2118 extern __at(0x0FCF) __sfr TMR1H;
2120 //==============================================================================
2121 // RCON Bits
2123 extern __at(0x0FD0) __sfr RCON;
2125 typedef union
2127 struct
2129 unsigned NOT_BOR : 1;
2130 unsigned NOT_POR : 1;
2131 unsigned NOT_PD : 1;
2132 unsigned NOT_TO : 1;
2133 unsigned NOT_RI : 1;
2134 unsigned : 1;
2135 unsigned SBOREN : 1;
2136 unsigned IPEN : 1;
2139 struct
2141 unsigned BOR : 1;
2142 unsigned POR : 1;
2143 unsigned PD : 1;
2144 unsigned TO : 1;
2145 unsigned RI : 1;
2146 unsigned : 1;
2147 unsigned : 1;
2148 unsigned : 1;
2150 } __RCONbits_t;
2152 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2154 #define _NOT_BOR 0x01
2155 #define _BOR 0x01
2156 #define _NOT_POR 0x02
2157 #define _POR 0x02
2158 #define _NOT_PD 0x04
2159 #define _PD 0x04
2160 #define _NOT_TO 0x08
2161 #define _TO 0x08
2162 #define _NOT_RI 0x10
2163 #define _RI 0x10
2164 #define _SBOREN 0x40
2165 #define _IPEN 0x80
2167 //==============================================================================
2170 //==============================================================================
2171 // WDTCON Bits
2173 extern __at(0x0FD1) __sfr WDTCON;
2175 typedef union
2177 struct
2179 unsigned SWDTEN : 1;
2180 unsigned : 1;
2181 unsigned : 1;
2182 unsigned : 1;
2183 unsigned : 1;
2184 unsigned : 1;
2185 unsigned : 1;
2186 unsigned : 1;
2189 struct
2191 unsigned SWDTE : 1;
2192 unsigned : 1;
2193 unsigned : 1;
2194 unsigned : 1;
2195 unsigned : 1;
2196 unsigned : 1;
2197 unsigned : 1;
2198 unsigned : 1;
2200 } __WDTCONbits_t;
2202 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2204 #define _SWDTEN 0x01
2205 #define _SWDTE 0x01
2207 //==============================================================================
2210 //==============================================================================
2211 // HLVDCON Bits
2213 extern __at(0x0FD2) __sfr HLVDCON;
2215 typedef union
2217 struct
2219 unsigned HLVDL0 : 1;
2220 unsigned HLVDL1 : 1;
2221 unsigned HLVDL2 : 1;
2222 unsigned HLVDL3 : 1;
2223 unsigned HLVDEN : 1;
2224 unsigned IVRST : 1;
2225 unsigned : 1;
2226 unsigned VDIRMAG : 1;
2229 struct
2231 unsigned LVDL0 : 1;
2232 unsigned LVDL1 : 1;
2233 unsigned LVDL2 : 1;
2234 unsigned LVDL3 : 1;
2235 unsigned LVDEN : 1;
2236 unsigned IRVST : 1;
2237 unsigned : 1;
2238 unsigned : 1;
2241 struct
2243 unsigned LVV0 : 1;
2244 unsigned LVV1 : 1;
2245 unsigned LVV2 : 1;
2246 unsigned LVV3 : 1;
2247 unsigned : 1;
2248 unsigned BGST : 1;
2249 unsigned : 1;
2250 unsigned : 1;
2253 struct
2255 unsigned HLVDL : 4;
2256 unsigned : 4;
2259 struct
2261 unsigned LVV : 4;
2262 unsigned : 4;
2265 struct
2267 unsigned LVDL : 4;
2268 unsigned : 4;
2270 } __HLVDCONbits_t;
2272 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2274 #define _HLVDL0 0x01
2275 #define _LVDL0 0x01
2276 #define _LVV0 0x01
2277 #define _HLVDL1 0x02
2278 #define _LVDL1 0x02
2279 #define _LVV1 0x02
2280 #define _HLVDL2 0x04
2281 #define _LVDL2 0x04
2282 #define _LVV2 0x04
2283 #define _HLVDL3 0x08
2284 #define _LVDL3 0x08
2285 #define _LVV3 0x08
2286 #define _HLVDEN 0x10
2287 #define _LVDEN 0x10
2288 #define _IVRST 0x20
2289 #define _IRVST 0x20
2290 #define _BGST 0x20
2291 #define _VDIRMAG 0x80
2293 //==============================================================================
2296 //==============================================================================
2297 // LVDCON Bits
2299 extern __at(0x0FD2) __sfr LVDCON;
2301 typedef union
2303 struct
2305 unsigned HLVDL0 : 1;
2306 unsigned HLVDL1 : 1;
2307 unsigned HLVDL2 : 1;
2308 unsigned HLVDL3 : 1;
2309 unsigned HLVDEN : 1;
2310 unsigned IVRST : 1;
2311 unsigned : 1;
2312 unsigned VDIRMAG : 1;
2315 struct
2317 unsigned LVDL0 : 1;
2318 unsigned LVDL1 : 1;
2319 unsigned LVDL2 : 1;
2320 unsigned LVDL3 : 1;
2321 unsigned LVDEN : 1;
2322 unsigned IRVST : 1;
2323 unsigned : 1;
2324 unsigned : 1;
2327 struct
2329 unsigned LVV0 : 1;
2330 unsigned LVV1 : 1;
2331 unsigned LVV2 : 1;
2332 unsigned LVV3 : 1;
2333 unsigned : 1;
2334 unsigned BGST : 1;
2335 unsigned : 1;
2336 unsigned : 1;
2339 struct
2341 unsigned LVV : 4;
2342 unsigned : 4;
2345 struct
2347 unsigned HLVDL : 4;
2348 unsigned : 4;
2351 struct
2353 unsigned LVDL : 4;
2354 unsigned : 4;
2356 } __LVDCONbits_t;
2358 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2360 #define _LVDCON_HLVDL0 0x01
2361 #define _LVDCON_LVDL0 0x01
2362 #define _LVDCON_LVV0 0x01
2363 #define _LVDCON_HLVDL1 0x02
2364 #define _LVDCON_LVDL1 0x02
2365 #define _LVDCON_LVV1 0x02
2366 #define _LVDCON_HLVDL2 0x04
2367 #define _LVDCON_LVDL2 0x04
2368 #define _LVDCON_LVV2 0x04
2369 #define _LVDCON_HLVDL3 0x08
2370 #define _LVDCON_LVDL3 0x08
2371 #define _LVDCON_LVV3 0x08
2372 #define _LVDCON_HLVDEN 0x10
2373 #define _LVDCON_LVDEN 0x10
2374 #define _LVDCON_IVRST 0x20
2375 #define _LVDCON_IRVST 0x20
2376 #define _LVDCON_BGST 0x20
2377 #define _LVDCON_VDIRMAG 0x80
2379 //==============================================================================
2382 //==============================================================================
2383 // OSCCON Bits
2385 extern __at(0x0FD3) __sfr OSCCON;
2387 typedef union
2389 struct
2391 unsigned SCS0 : 1;
2392 unsigned SCS1 : 1;
2393 unsigned IOFS : 1;
2394 unsigned OSTS : 1;
2395 unsigned IRCF0 : 1;
2396 unsigned IRCF1 : 1;
2397 unsigned IRCF2 : 1;
2398 unsigned IDLEN : 1;
2401 struct
2403 unsigned : 1;
2404 unsigned : 1;
2405 unsigned FLTS : 1;
2406 unsigned : 1;
2407 unsigned : 1;
2408 unsigned : 1;
2409 unsigned : 1;
2410 unsigned : 1;
2413 struct
2415 unsigned SCS : 2;
2416 unsigned : 6;
2419 struct
2421 unsigned : 4;
2422 unsigned IRCF : 3;
2423 unsigned : 1;
2425 } __OSCCONbits_t;
2427 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2429 #define _SCS0 0x01
2430 #define _SCS1 0x02
2431 #define _IOFS 0x04
2432 #define _FLTS 0x04
2433 #define _OSTS 0x08
2434 #define _IRCF0 0x10
2435 #define _IRCF1 0x20
2436 #define _IRCF2 0x40
2437 #define _IDLEN 0x80
2439 //==============================================================================
2442 //==============================================================================
2443 // T0CON Bits
2445 extern __at(0x0FD5) __sfr T0CON;
2447 typedef union
2449 struct
2451 unsigned T0PS0 : 1;
2452 unsigned T0PS1 : 1;
2453 unsigned T0PS2 : 1;
2454 unsigned PSA : 1;
2455 unsigned T0SE : 1;
2456 unsigned T0CS : 1;
2457 unsigned T08BIT : 1;
2458 unsigned TMR0ON : 1;
2461 struct
2463 unsigned : 1;
2464 unsigned : 1;
2465 unsigned : 1;
2466 unsigned T0PS3 : 1;
2467 unsigned : 1;
2468 unsigned : 1;
2469 unsigned T016BIT : 1;
2470 unsigned : 1;
2473 struct
2475 unsigned T0PS : 4;
2476 unsigned : 4;
2478 } __T0CONbits_t;
2480 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2482 #define _T0PS0 0x01
2483 #define _T0PS1 0x02
2484 #define _T0PS2 0x04
2485 #define _PSA 0x08
2486 #define _T0PS3 0x08
2487 #define _T0SE 0x10
2488 #define _T0CS 0x20
2489 #define _T08BIT 0x40
2490 #define _T016BIT 0x40
2491 #define _TMR0ON 0x80
2493 //==============================================================================
2495 extern __at(0x0FD6) __sfr TMR0;
2496 extern __at(0x0FD6) __sfr TMR0L;
2497 extern __at(0x0FD7) __sfr TMR0H;
2499 //==============================================================================
2500 // STATUS Bits
2502 extern __at(0x0FD8) __sfr STATUS;
2504 typedef struct
2506 unsigned C : 1;
2507 unsigned DC : 1;
2508 unsigned Z : 1;
2509 unsigned OV : 1;
2510 unsigned N : 1;
2511 unsigned : 1;
2512 unsigned : 1;
2513 unsigned : 1;
2514 } __STATUSbits_t;
2516 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2518 #define _C 0x01
2519 #define _DC 0x02
2520 #define _Z 0x04
2521 #define _OV 0x08
2522 #define _N 0x10
2524 //==============================================================================
2526 extern __at(0x0FD9) __sfr FSR2L;
2527 extern __at(0x0FDA) __sfr FSR2H;
2528 extern __at(0x0FDB) __sfr PLUSW2;
2529 extern __at(0x0FDC) __sfr PREINC2;
2530 extern __at(0x0FDD) __sfr POSTDEC2;
2531 extern __at(0x0FDE) __sfr POSTINC2;
2532 extern __at(0x0FDF) __sfr INDF2;
2533 extern __at(0x0FE0) __sfr BSR;
2534 extern __at(0x0FE1) __sfr FSR1L;
2535 extern __at(0x0FE2) __sfr FSR1H;
2536 extern __at(0x0FE3) __sfr PLUSW1;
2537 extern __at(0x0FE4) __sfr PREINC1;
2538 extern __at(0x0FE5) __sfr POSTDEC1;
2539 extern __at(0x0FE6) __sfr POSTINC1;
2540 extern __at(0x0FE7) __sfr INDF1;
2541 extern __at(0x0FE8) __sfr WREG;
2542 extern __at(0x0FE9) __sfr FSR0L;
2543 extern __at(0x0FEA) __sfr FSR0H;
2544 extern __at(0x0FEB) __sfr PLUSW0;
2545 extern __at(0x0FEC) __sfr PREINC0;
2546 extern __at(0x0FED) __sfr POSTDEC0;
2547 extern __at(0x0FEE) __sfr POSTINC0;
2548 extern __at(0x0FEF) __sfr INDF0;
2550 //==============================================================================
2551 // INTCON3 Bits
2553 extern __at(0x0FF0) __sfr INTCON3;
2555 typedef union
2557 struct
2559 unsigned INT1IF : 1;
2560 unsigned INT2IF : 1;
2561 unsigned : 1;
2562 unsigned INT1IE : 1;
2563 unsigned INT2IE : 1;
2564 unsigned : 1;
2565 unsigned INT1IP : 1;
2566 unsigned INT2IP : 1;
2569 struct
2571 unsigned INT1F : 1;
2572 unsigned INT2F : 1;
2573 unsigned : 1;
2574 unsigned INT1E : 1;
2575 unsigned INT2E : 1;
2576 unsigned : 1;
2577 unsigned INT1P : 1;
2578 unsigned INT2P : 1;
2580 } __INTCON3bits_t;
2582 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2584 #define _INT1IF 0x01
2585 #define _INT1F 0x01
2586 #define _INT2IF 0x02
2587 #define _INT2F 0x02
2588 #define _INT1IE 0x08
2589 #define _INT1E 0x08
2590 #define _INT2IE 0x10
2591 #define _INT2E 0x10
2592 #define _INT1IP 0x40
2593 #define _INT1P 0x40
2594 #define _INT2IP 0x80
2595 #define _INT2P 0x80
2597 //==============================================================================
2600 //==============================================================================
2601 // INTCON2 Bits
2603 extern __at(0x0FF1) __sfr INTCON2;
2605 typedef union
2607 struct
2609 unsigned RBIP : 1;
2610 unsigned : 1;
2611 unsigned TMR0IP : 1;
2612 unsigned : 1;
2613 unsigned INTEDG2 : 1;
2614 unsigned INTEDG1 : 1;
2615 unsigned INTEDG0 : 1;
2616 unsigned NOT_RBPU : 1;
2619 struct
2621 unsigned : 1;
2622 unsigned : 1;
2623 unsigned : 1;
2624 unsigned : 1;
2625 unsigned : 1;
2626 unsigned : 1;
2627 unsigned : 1;
2628 unsigned RBPU : 1;
2630 } __INTCON2bits_t;
2632 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2634 #define _RBIP 0x01
2635 #define _TMR0IP 0x04
2636 #define _INTEDG2 0x10
2637 #define _INTEDG1 0x20
2638 #define _INTEDG0 0x40
2639 #define _NOT_RBPU 0x80
2640 #define _RBPU 0x80
2642 //==============================================================================
2645 //==============================================================================
2646 // INTCON Bits
2648 extern __at(0x0FF2) __sfr INTCON;
2650 typedef union
2652 struct
2654 unsigned RBIF : 1;
2655 unsigned INT0IF : 1;
2656 unsigned TMR0IF : 1;
2657 unsigned RBIE : 1;
2658 unsigned INT0IE : 1;
2659 unsigned TMR0IE : 1;
2660 unsigned PEIE_GIEL : 1;
2661 unsigned GIE_GIEH : 1;
2664 struct
2666 unsigned : 1;
2667 unsigned INT0F : 1;
2668 unsigned T0IF : 1;
2669 unsigned : 1;
2670 unsigned INT0E : 1;
2671 unsigned T0IE : 1;
2672 unsigned PEIE : 1;
2673 unsigned GIE : 1;
2676 struct
2678 unsigned : 1;
2679 unsigned : 1;
2680 unsigned : 1;
2681 unsigned : 1;
2682 unsigned : 1;
2683 unsigned : 1;
2684 unsigned GIEL : 1;
2685 unsigned GIEH : 1;
2687 } __INTCONbits_t;
2689 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2691 #define _RBIF 0x01
2692 #define _INT0IF 0x02
2693 #define _INT0F 0x02
2694 #define _TMR0IF 0x04
2695 #define _T0IF 0x04
2696 #define _RBIE 0x08
2697 #define _INT0IE 0x10
2698 #define _INT0E 0x10
2699 #define _TMR0IE 0x20
2700 #define _T0IE 0x20
2701 #define _PEIE_GIEL 0x40
2702 #define _PEIE 0x40
2703 #define _GIEL 0x40
2704 #define _GIE_GIEH 0x80
2705 #define _GIE 0x80
2706 #define _GIEH 0x80
2708 //==============================================================================
2710 extern __at(0x0FF3) __sfr PROD;
2711 extern __at(0x0FF3) __sfr PRODL;
2712 extern __at(0x0FF4) __sfr PRODH;
2713 extern __at(0x0FF5) __sfr TABLAT;
2714 extern __at(0x0FF6) __sfr TBLPTR;
2715 extern __at(0x0FF6) __sfr TBLPTRL;
2716 extern __at(0x0FF7) __sfr TBLPTRH;
2717 extern __at(0x0FF8) __sfr TBLPTRU;
2718 extern __at(0x0FF9) __sfr PC;
2719 extern __at(0x0FF9) __sfr PCL;
2720 extern __at(0x0FFA) __sfr PCLATH;
2721 extern __at(0x0FFB) __sfr PCLATU;
2723 //==============================================================================
2724 // STKPTR Bits
2726 extern __at(0x0FFC) __sfr STKPTR;
2728 typedef union
2730 struct
2732 unsigned SP0 : 1;
2733 unsigned SP1 : 1;
2734 unsigned SP2 : 1;
2735 unsigned SP3 : 1;
2736 unsigned SP4 : 1;
2737 unsigned : 1;
2738 unsigned STKUNF : 1;
2739 unsigned STKFUL : 1;
2742 struct
2744 unsigned : 1;
2745 unsigned : 1;
2746 unsigned : 1;
2747 unsigned : 1;
2748 unsigned : 1;
2749 unsigned : 1;
2750 unsigned : 1;
2751 unsigned STKOVF : 1;
2754 struct
2756 unsigned SP : 5;
2757 unsigned : 3;
2759 } __STKPTRbits_t;
2761 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2763 #define _SP0 0x01
2764 #define _SP1 0x02
2765 #define _SP2 0x04
2766 #define _SP3 0x08
2767 #define _SP4 0x10
2768 #define _STKUNF 0x40
2769 #define _STKFUL 0x80
2770 #define _STKOVF 0x80
2772 //==============================================================================
2774 extern __at(0x0FFD) __sfr TOS;
2775 extern __at(0x0FFD) __sfr TOSL;
2776 extern __at(0x0FFE) __sfr TOSH;
2777 extern __at(0x0FFF) __sfr TOSU;
2779 //==============================================================================
2781 // Configuration Bits
2783 //==============================================================================
2785 #define __CONFIG1H 0x300001
2786 #define __CONFIG2L 0x300002
2787 #define __CONFIG2H 0x300003
2788 #define __CONFIG3H 0x300005
2789 #define __CONFIG4L 0x300006
2790 #define __CONFIG5L 0x300008
2791 #define __CONFIG5H 0x300009
2792 #define __CONFIG6L 0x30000A
2793 #define __CONFIG6H 0x30000B
2794 #define __CONFIG7L 0x30000C
2795 #define __CONFIG7H 0x30000D
2797 //----------------------------- CONFIG1H Options -------------------------------
2799 #define _OSC_LP_1H 0xF0 // LP oscillator.
2800 #define _OSC_XT_1H 0xF1 // XT oscillator.
2801 #define _OSC_HS_1H 0xF2 // HS oscillator.
2802 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
2803 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2804 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6.
2805 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
2806 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6.
2807 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7.
2808 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7.
2809 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2810 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2811 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2812 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2814 //----------------------------- CONFIG2L Options -------------------------------
2816 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2817 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2818 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2819 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2820 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2821 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2822 #define _BORV_0_2L 0xE7 // Maximum setting.
2823 #define _BORV_1_2L 0xEF
2824 #define _BORV_2_2L 0xF7
2825 #define _BORV_3_2L 0xFF // Minimum setting.
2827 //----------------------------- CONFIG2H Options -------------------------------
2829 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2830 #define _WDT_ON_2H 0xFF // WDT enabled.
2831 #define _WDTPS_1_2H 0xE1 // 1:1.
2832 #define _WDTPS_2_2H 0xE3 // 1:2.
2833 #define _WDTPS_4_2H 0xE5 // 1:4.
2834 #define _WDTPS_8_2H 0xE7 // 1:8.
2835 #define _WDTPS_16_2H 0xE9 // 1:16.
2836 #define _WDTPS_32_2H 0xEB // 1:32.
2837 #define _WDTPS_64_2H 0xED // 1:64.
2838 #define _WDTPS_128_2H 0xEF // 1:128.
2839 #define _WDTPS_256_2H 0xF1 // 1:256.
2840 #define _WDTPS_512_2H 0xF3 // 1:512.
2841 #define _WDTPS_1024_2H 0xF5 // 1:1024.
2842 #define _WDTPS_2048_2H 0xF7 // 1:2048.
2843 #define _WDTPS_4096_2H 0xF9 // 1:4096.
2844 #define _WDTPS_8192_2H 0xFB // 1:8192.
2845 #define _WDTPS_16384_2H 0xFD // 1:16384.
2846 #define _WDTPS_32768_2H 0xFF // 1:32768.
2848 //----------------------------- CONFIG3H Options -------------------------------
2850 #define _CCP2MX_PORTBE_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2851 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2852 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
2853 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
2854 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
2855 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
2856 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled.
2857 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
2859 //----------------------------- CONFIG4L Options -------------------------------
2861 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
2862 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
2863 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
2864 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
2865 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
2866 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
2867 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2868 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2870 //----------------------------- CONFIG5L Options -------------------------------
2872 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected.
2873 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected.
2874 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected.
2875 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected.
2876 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected.
2877 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected.
2878 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected.
2879 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected.
2881 //----------------------------- CONFIG5H Options -------------------------------
2883 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected.
2884 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected.
2886 //----------------------------- CONFIG6L Options -------------------------------
2888 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected.
2889 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected.
2890 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected.
2891 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected.
2892 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected.
2893 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected.
2894 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected.
2895 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected.
2897 //----------------------------- CONFIG6H Options -------------------------------
2899 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
2900 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
2901 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) write-protected.
2902 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) not write-protected.
2904 //----------------------------- CONFIG7L Options -------------------------------
2906 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks.
2907 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks.
2908 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks.
2909 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks.
2910 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks.
2911 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks.
2912 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks.
2913 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks.
2915 //----------------------------- CONFIG7H Options -------------------------------
2917 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) protected from table reads executed in other blocks.
2918 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) not protected from table reads executed in other blocks.
2920 //==============================================================================
2922 #define __DEVID1 0x3FFFFE
2923 #define __DEVID2 0x3FFFFF
2925 #define __IDLOC0 0x200000
2926 #define __IDLOC1 0x200001
2927 #define __IDLOC2 0x200002
2928 #define __IDLOC3 0x200003
2929 #define __IDLOC4 0x200004
2930 #define __IDLOC5 0x200005
2931 #define __IDLOC6 0x200006
2932 #define __IDLOC7 0x200007
2934 #endif // #ifndef __PIC18LF2510_H__