struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf2320.h
blob917cf17dfa6465df5bd12a1af4a70ec806499e6a
1 /*
2 * This declarations of the PIC18LF2320 MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:59 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 __PIC18LF2320_H__
26 #define __PIC18LF2320_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 CLKO : 1;
65 unsigned CLKI : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned VREFM : 1;
73 unsigned VREFP : 1;
74 unsigned C1OUT : 1;
75 unsigned SS : 1;
76 unsigned OSC2 : 1;
77 unsigned OSC1 : 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 C2OUT : 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_VREFM 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_C1OUT 0x10
133 #define _PORTA_RA5 0x20
134 #define _PORTA_AN4 0x20
135 #define _PORTA_SS 0x20
136 #define _PORTA_NOT_SS 0x20
137 #define _PORTA_LVDIN 0x20
138 #define _PORTA_C2OUT 0x20
139 #define _PORTA_RA6 0x40
140 #define _PORTA_CLKO 0x40
141 #define _PORTA_OSC2 0x40
142 #define _PORTA_RA7 0x80
143 #define _PORTA_CLKI 0x80
144 #define _PORTA_OSC1 0x80
146 //==============================================================================
149 //==============================================================================
150 // PORTB Bits
152 extern __at(0x0F81) __sfr PORTB;
154 typedef union
156 struct
158 unsigned RB0 : 1;
159 unsigned RB1 : 1;
160 unsigned RB2 : 1;
161 unsigned RB3 : 1;
162 unsigned RB4 : 1;
163 unsigned RB5 : 1;
164 unsigned RB6 : 1;
165 unsigned RB7 : 1;
168 struct
170 unsigned INT0 : 1;
171 unsigned INT1 : 1;
172 unsigned INT2 : 1;
173 unsigned CCP2 : 1;
174 unsigned KBI0 : 1;
175 unsigned KBI1 : 1;
176 unsigned KBI2 : 1;
177 unsigned KBI3 : 1;
180 struct
182 unsigned AN12 : 1;
183 unsigned AN10 : 1;
184 unsigned AN8 : 1;
185 unsigned AN9 : 1;
186 unsigned AN11 : 1;
187 unsigned PGM : 1;
188 unsigned PGC : 1;
189 unsigned PGD : 1;
192 struct
194 unsigned : 1;
195 unsigned : 1;
196 unsigned : 1;
197 unsigned CCP2A : 1;
198 unsigned : 1;
199 unsigned : 1;
200 unsigned : 1;
201 unsigned : 1;
204 struct
206 unsigned INT : 3;
207 unsigned : 5;
210 struct
212 unsigned : 4;
213 unsigned KBI : 4;
215 } __PORTBbits_t;
217 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
219 #define _PORTB_RB0 0x01
220 #define _PORTB_INT0 0x01
221 #define _PORTB_AN12 0x01
222 #define _PORTB_RB1 0x02
223 #define _PORTB_INT1 0x02
224 #define _PORTB_AN10 0x02
225 #define _PORTB_RB2 0x04
226 #define _PORTB_INT2 0x04
227 #define _PORTB_AN8 0x04
228 #define _PORTB_RB3 0x08
229 #define _PORTB_CCP2 0x08
230 #define _PORTB_AN9 0x08
231 #define _PORTB_CCP2A 0x08
232 #define _PORTB_RB4 0x10
233 #define _PORTB_KBI0 0x10
234 #define _PORTB_AN11 0x10
235 #define _PORTB_RB5 0x20
236 #define _PORTB_KBI1 0x20
237 #define _PORTB_PGM 0x20
238 #define _PORTB_RB6 0x40
239 #define _PORTB_KBI2 0x40
240 #define _PORTB_PGC 0x40
241 #define _PORTB_RB7 0x80
242 #define _PORTB_KBI3 0x80
243 #define _PORTB_PGD 0x80
245 //==============================================================================
248 //==============================================================================
249 // PORTC Bits
251 extern __at(0x0F82) __sfr PORTC;
253 typedef union
255 struct
257 unsigned RC0 : 1;
258 unsigned RC1 : 1;
259 unsigned RC2 : 1;
260 unsigned RC3 : 1;
261 unsigned RC4 : 1;
262 unsigned RC5 : 1;
263 unsigned RC6 : 1;
264 unsigned RC7 : 1;
267 struct
269 unsigned T1OSO : 1;
270 unsigned T1OSI : 1;
271 unsigned CCP1 : 1;
272 unsigned SCK : 1;
273 unsigned SDI : 1;
274 unsigned SDO : 1;
275 unsigned TX : 1;
276 unsigned RX : 1;
279 struct
281 unsigned T13CKI : 1;
282 unsigned CCP2 : 1;
283 unsigned P1A : 1;
284 unsigned SCL : 1;
285 unsigned SDA : 1;
286 unsigned : 1;
287 unsigned CK : 1;
288 unsigned : 1;
291 struct
293 unsigned T1CKI : 1;
294 unsigned : 1;
295 unsigned : 1;
296 unsigned : 1;
297 unsigned : 1;
298 unsigned : 1;
299 unsigned : 1;
300 unsigned : 1;
302 } __PORTCbits_t;
304 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
306 #define _PORTC_RC0 0x01
307 #define _PORTC_T1OSO 0x01
308 #define _PORTC_T13CKI 0x01
309 #define _PORTC_T1CKI 0x01
310 #define _PORTC_RC1 0x02
311 #define _PORTC_T1OSI 0x02
312 #define _PORTC_CCP2 0x02
313 #define _PORTC_RC2 0x04
314 #define _PORTC_CCP1 0x04
315 #define _PORTC_P1A 0x04
316 #define _PORTC_RC3 0x08
317 #define _PORTC_SCK 0x08
318 #define _PORTC_SCL 0x08
319 #define _PORTC_RC4 0x10
320 #define _PORTC_SDI 0x10
321 #define _PORTC_SDA 0x10
322 #define _PORTC_RC5 0x20
323 #define _PORTC_SDO 0x20
324 #define _PORTC_RC6 0x40
325 #define _PORTC_TX 0x40
326 #define _PORTC_CK 0x40
327 #define _PORTC_RC7 0x80
328 #define _PORTC_RX 0x80
330 //==============================================================================
333 //==============================================================================
334 // LATA Bits
336 extern __at(0x0F89) __sfr LATA;
338 typedef struct
340 unsigned LATA0 : 1;
341 unsigned LATA1 : 1;
342 unsigned LATA2 : 1;
343 unsigned LATA3 : 1;
344 unsigned LATA4 : 1;
345 unsigned LATA5 : 1;
346 unsigned LATA6 : 1;
347 unsigned LATA7 : 1;
348 } __LATAbits_t;
350 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
352 #define _LATA0 0x01
353 #define _LATA1 0x02
354 #define _LATA2 0x04
355 #define _LATA3 0x08
356 #define _LATA4 0x10
357 #define _LATA5 0x20
358 #define _LATA6 0x40
359 #define _LATA7 0x80
361 //==============================================================================
364 //==============================================================================
365 // LATB Bits
367 extern __at(0x0F8A) __sfr LATB;
369 typedef struct
371 unsigned LATB0 : 1;
372 unsigned LATB1 : 1;
373 unsigned LATB2 : 1;
374 unsigned LATB3 : 1;
375 unsigned LATB4 : 1;
376 unsigned LATB5 : 1;
377 unsigned LATB6 : 1;
378 unsigned LATB7 : 1;
379 } __LATBbits_t;
381 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
383 #define _LATB0 0x01
384 #define _LATB1 0x02
385 #define _LATB2 0x04
386 #define _LATB3 0x08
387 #define _LATB4 0x10
388 #define _LATB5 0x20
389 #define _LATB6 0x40
390 #define _LATB7 0x80
392 //==============================================================================
395 //==============================================================================
396 // LATC Bits
398 extern __at(0x0F8B) __sfr LATC;
400 typedef struct
402 unsigned LATC0 : 1;
403 unsigned LATC1 : 1;
404 unsigned LATC2 : 1;
405 unsigned LATC3 : 1;
406 unsigned LATC4 : 1;
407 unsigned LATC5 : 1;
408 unsigned LATC6 : 1;
409 unsigned LATC7 : 1;
410 } __LATCbits_t;
412 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
414 #define _LATC0 0x01
415 #define _LATC1 0x02
416 #define _LATC2 0x04
417 #define _LATC3 0x08
418 #define _LATC4 0x10
419 #define _LATC5 0x20
420 #define _LATC6 0x40
421 #define _LATC7 0x80
423 //==============================================================================
426 //==============================================================================
427 // DDRA Bits
429 extern __at(0x0F92) __sfr DDRA;
431 typedef union
433 struct
435 unsigned TRISA0 : 1;
436 unsigned TRISA1 : 1;
437 unsigned TRISA2 : 1;
438 unsigned TRISA3 : 1;
439 unsigned TRISA4 : 1;
440 unsigned TRISA5 : 1;
441 unsigned TRISA6 : 1;
442 unsigned TRISA7 : 1;
445 struct
447 unsigned RA0 : 1;
448 unsigned RA1 : 1;
449 unsigned RA2 : 1;
450 unsigned RA3 : 1;
451 unsigned RA4 : 1;
452 unsigned RA5 : 1;
453 unsigned RA6 : 1;
454 unsigned RA7 : 1;
456 } __DDRAbits_t;
458 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
460 #define _TRISA0 0x01
461 #define _RA0 0x01
462 #define _TRISA1 0x02
463 #define _RA1 0x02
464 #define _TRISA2 0x04
465 #define _RA2 0x04
466 #define _TRISA3 0x08
467 #define _RA3 0x08
468 #define _TRISA4 0x10
469 #define _RA4 0x10
470 #define _TRISA5 0x20
471 #define _RA5 0x20
472 #define _TRISA6 0x40
473 #define _RA6 0x40
474 #define _TRISA7 0x80
475 #define _RA7 0x80
477 //==============================================================================
480 //==============================================================================
481 // TRISA Bits
483 extern __at(0x0F92) __sfr TRISA;
485 typedef union
487 struct
489 unsigned TRISA0 : 1;
490 unsigned TRISA1 : 1;
491 unsigned TRISA2 : 1;
492 unsigned TRISA3 : 1;
493 unsigned TRISA4 : 1;
494 unsigned TRISA5 : 1;
495 unsigned TRISA6 : 1;
496 unsigned TRISA7 : 1;
499 struct
501 unsigned RA0 : 1;
502 unsigned RA1 : 1;
503 unsigned RA2 : 1;
504 unsigned RA3 : 1;
505 unsigned RA4 : 1;
506 unsigned RA5 : 1;
507 unsigned RA6 : 1;
508 unsigned RA7 : 1;
510 } __TRISAbits_t;
512 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
514 #define _TRISA_TRISA0 0x01
515 #define _TRISA_RA0 0x01
516 #define _TRISA_TRISA1 0x02
517 #define _TRISA_RA1 0x02
518 #define _TRISA_TRISA2 0x04
519 #define _TRISA_RA2 0x04
520 #define _TRISA_TRISA3 0x08
521 #define _TRISA_RA3 0x08
522 #define _TRISA_TRISA4 0x10
523 #define _TRISA_RA4 0x10
524 #define _TRISA_TRISA5 0x20
525 #define _TRISA_RA5 0x20
526 #define _TRISA_TRISA6 0x40
527 #define _TRISA_RA6 0x40
528 #define _TRISA_TRISA7 0x80
529 #define _TRISA_RA7 0x80
531 //==============================================================================
534 //==============================================================================
535 // DDRB Bits
537 extern __at(0x0F93) __sfr DDRB;
539 typedef union
541 struct
543 unsigned TRISB0 : 1;
544 unsigned TRISB1 : 1;
545 unsigned TRISB2 : 1;
546 unsigned TRISB3 : 1;
547 unsigned TRISB4 : 1;
548 unsigned TRISB5 : 1;
549 unsigned TRISB6 : 1;
550 unsigned TRISB7 : 1;
553 struct
555 unsigned RB0 : 1;
556 unsigned RB1 : 1;
557 unsigned RB2 : 1;
558 unsigned RB3 : 1;
559 unsigned RB4 : 1;
560 unsigned RB5 : 1;
561 unsigned RB6 : 1;
562 unsigned RB7 : 1;
564 } __DDRBbits_t;
566 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
568 #define _TRISB0 0x01
569 #define _RB0 0x01
570 #define _TRISB1 0x02
571 #define _RB1 0x02
572 #define _TRISB2 0x04
573 #define _RB2 0x04
574 #define _TRISB3 0x08
575 #define _RB3 0x08
576 #define _TRISB4 0x10
577 #define _RB4 0x10
578 #define _TRISB5 0x20
579 #define _RB5 0x20
580 #define _TRISB6 0x40
581 #define _RB6 0x40
582 #define _TRISB7 0x80
583 #define _RB7 0x80
585 //==============================================================================
588 //==============================================================================
589 // TRISB Bits
591 extern __at(0x0F93) __sfr TRISB;
593 typedef union
595 struct
597 unsigned TRISB0 : 1;
598 unsigned TRISB1 : 1;
599 unsigned TRISB2 : 1;
600 unsigned TRISB3 : 1;
601 unsigned TRISB4 : 1;
602 unsigned TRISB5 : 1;
603 unsigned TRISB6 : 1;
604 unsigned TRISB7 : 1;
607 struct
609 unsigned RB0 : 1;
610 unsigned RB1 : 1;
611 unsigned RB2 : 1;
612 unsigned RB3 : 1;
613 unsigned RB4 : 1;
614 unsigned RB5 : 1;
615 unsigned RB6 : 1;
616 unsigned RB7 : 1;
618 } __TRISBbits_t;
620 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
622 #define _TRISB_TRISB0 0x01
623 #define _TRISB_RB0 0x01
624 #define _TRISB_TRISB1 0x02
625 #define _TRISB_RB1 0x02
626 #define _TRISB_TRISB2 0x04
627 #define _TRISB_RB2 0x04
628 #define _TRISB_TRISB3 0x08
629 #define _TRISB_RB3 0x08
630 #define _TRISB_TRISB4 0x10
631 #define _TRISB_RB4 0x10
632 #define _TRISB_TRISB5 0x20
633 #define _TRISB_RB5 0x20
634 #define _TRISB_TRISB6 0x40
635 #define _TRISB_RB6 0x40
636 #define _TRISB_TRISB7 0x80
637 #define _TRISB_RB7 0x80
639 //==============================================================================
642 //==============================================================================
643 // DDRC Bits
645 extern __at(0x0F94) __sfr DDRC;
647 typedef union
649 struct
651 unsigned TRISC0 : 1;
652 unsigned TRISC1 : 1;
653 unsigned TRISC2 : 1;
654 unsigned TRISC3 : 1;
655 unsigned TRISC4 : 1;
656 unsigned TRISC5 : 1;
657 unsigned TRISC6 : 1;
658 unsigned TRISC7 : 1;
661 struct
663 unsigned RC0 : 1;
664 unsigned RC1 : 1;
665 unsigned RC2 : 1;
666 unsigned RC3 : 1;
667 unsigned RC4 : 1;
668 unsigned RC5 : 1;
669 unsigned RC6 : 1;
670 unsigned RC7 : 1;
672 } __DDRCbits_t;
674 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
676 #define _TRISC0 0x01
677 #define _RC0 0x01
678 #define _TRISC1 0x02
679 #define _RC1 0x02
680 #define _TRISC2 0x04
681 #define _RC2 0x04
682 #define _TRISC3 0x08
683 #define _RC3 0x08
684 #define _TRISC4 0x10
685 #define _RC4 0x10
686 #define _TRISC5 0x20
687 #define _RC5 0x20
688 #define _TRISC6 0x40
689 #define _RC6 0x40
690 #define _TRISC7 0x80
691 #define _RC7 0x80
693 //==============================================================================
696 //==============================================================================
697 // TRISC Bits
699 extern __at(0x0F94) __sfr TRISC;
701 typedef union
703 struct
705 unsigned TRISC0 : 1;
706 unsigned TRISC1 : 1;
707 unsigned TRISC2 : 1;
708 unsigned TRISC3 : 1;
709 unsigned TRISC4 : 1;
710 unsigned TRISC5 : 1;
711 unsigned TRISC6 : 1;
712 unsigned TRISC7 : 1;
715 struct
717 unsigned RC0 : 1;
718 unsigned RC1 : 1;
719 unsigned RC2 : 1;
720 unsigned RC3 : 1;
721 unsigned RC4 : 1;
722 unsigned RC5 : 1;
723 unsigned RC6 : 1;
724 unsigned RC7 : 1;
726 } __TRISCbits_t;
728 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
730 #define _TRISC_TRISC0 0x01
731 #define _TRISC_RC0 0x01
732 #define _TRISC_TRISC1 0x02
733 #define _TRISC_RC1 0x02
734 #define _TRISC_TRISC2 0x04
735 #define _TRISC_RC2 0x04
736 #define _TRISC_TRISC3 0x08
737 #define _TRISC_RC3 0x08
738 #define _TRISC_TRISC4 0x10
739 #define _TRISC_RC4 0x10
740 #define _TRISC_TRISC5 0x20
741 #define _TRISC_RC5 0x20
742 #define _TRISC_TRISC6 0x40
743 #define _TRISC_RC6 0x40
744 #define _TRISC_TRISC7 0x80
745 #define _TRISC_RC7 0x80
747 //==============================================================================
750 //==============================================================================
751 // OSCTUN2 Bits
753 extern __at(0x0F9A) __sfr OSCTUN2;
755 typedef union
757 struct
759 unsigned TUN0 : 1;
760 unsigned TUN1 : 1;
761 unsigned TUN2 : 1;
762 unsigned TUN3 : 1;
763 unsigned TUN4 : 1;
764 unsigned TUN5 : 1;
765 unsigned : 1;
766 unsigned TUNSEL : 1;
769 struct
771 unsigned TUN : 6;
772 unsigned : 2;
774 } __OSCTUN2bits_t;
776 extern __at(0x0F9A) volatile __OSCTUN2bits_t OSCTUN2bits;
778 #define _TUN0 0x01
779 #define _TUN1 0x02
780 #define _TUN2 0x04
781 #define _TUN3 0x08
782 #define _TUN4 0x10
783 #define _TUN5 0x20
784 #define _TUNSEL 0x80
786 //==============================================================================
789 //==============================================================================
790 // OSCTUNE Bits
792 extern __at(0x0F9B) __sfr OSCTUNE;
794 typedef union
796 struct
798 unsigned TUN0 : 1;
799 unsigned TUN1 : 1;
800 unsigned TUN2 : 1;
801 unsigned TUN3 : 1;
802 unsigned TUN4 : 1;
803 unsigned TUN5 : 1;
804 unsigned : 1;
805 unsigned : 1;
808 struct
810 unsigned TUN : 6;
811 unsigned : 2;
813 } __OSCTUNEbits_t;
815 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
817 #define _OSCTUNE_TUN0 0x01
818 #define _OSCTUNE_TUN1 0x02
819 #define _OSCTUNE_TUN2 0x04
820 #define _OSCTUNE_TUN3 0x08
821 #define _OSCTUNE_TUN4 0x10
822 #define _OSCTUNE_TUN5 0x20
824 //==============================================================================
827 //==============================================================================
828 // PIE1 Bits
830 extern __at(0x0F9D) __sfr PIE1;
832 typedef struct
834 unsigned TMR1IE : 1;
835 unsigned TMR2IE : 1;
836 unsigned CCP1IE : 1;
837 unsigned SSPIE : 1;
838 unsigned TXIE : 1;
839 unsigned RCIE : 1;
840 unsigned ADIE : 1;
841 unsigned : 1;
842 } __PIE1bits_t;
844 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
846 #define _TMR1IE 0x01
847 #define _TMR2IE 0x02
848 #define _CCP1IE 0x04
849 #define _SSPIE 0x08
850 #define _TXIE 0x10
851 #define _RCIE 0x20
852 #define _ADIE 0x40
854 //==============================================================================
857 //==============================================================================
858 // PIR1 Bits
860 extern __at(0x0F9E) __sfr PIR1;
862 typedef struct
864 unsigned TMR1IF : 1;
865 unsigned TMR2IF : 1;
866 unsigned CCP1IF : 1;
867 unsigned SSPIF : 1;
868 unsigned TXIF : 1;
869 unsigned RCIF : 1;
870 unsigned ADIF : 1;
871 unsigned : 1;
872 } __PIR1bits_t;
874 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
876 #define _TMR1IF 0x01
877 #define _TMR2IF 0x02
878 #define _CCP1IF 0x04
879 #define _SSPIF 0x08
880 #define _TXIF 0x10
881 #define _RCIF 0x20
882 #define _ADIF 0x40
884 //==============================================================================
887 //==============================================================================
888 // IPR1 Bits
890 extern __at(0x0F9F) __sfr IPR1;
892 typedef struct
894 unsigned TMR1IP : 1;
895 unsigned TMR2IP : 1;
896 unsigned CCP1IP : 1;
897 unsigned SSPIP : 1;
898 unsigned TXIP : 1;
899 unsigned RCIP : 1;
900 unsigned ADIP : 1;
901 unsigned : 1;
902 } __IPR1bits_t;
904 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
906 #define _TMR1IP 0x01
907 #define _TMR2IP 0x02
908 #define _CCP1IP 0x04
909 #define _SSPIP 0x08
910 #define _TXIP 0x10
911 #define _RCIP 0x20
912 #define _ADIP 0x40
914 //==============================================================================
917 //==============================================================================
918 // PIE2 Bits
920 extern __at(0x0FA0) __sfr PIE2;
922 typedef struct
924 unsigned CCP2IE : 1;
925 unsigned TMR3IE : 1;
926 unsigned LVDIE : 1;
927 unsigned BCLIE : 1;
928 unsigned EEIE : 1;
929 unsigned : 1;
930 unsigned CMIE : 1;
931 unsigned OSCFIE : 1;
932 } __PIE2bits_t;
934 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
936 #define _CCP2IE 0x01
937 #define _TMR3IE 0x02
938 #define _LVDIE 0x04
939 #define _BCLIE 0x08
940 #define _EEIE 0x10
941 #define _CMIE 0x40
942 #define _OSCFIE 0x80
944 //==============================================================================
947 //==============================================================================
948 // PIR2 Bits
950 extern __at(0x0FA1) __sfr PIR2;
952 typedef struct
954 unsigned CCP2IF : 1;
955 unsigned TMR3IF : 1;
956 unsigned LVDIF : 1;
957 unsigned BCLIF : 1;
958 unsigned EEIF : 1;
959 unsigned : 1;
960 unsigned CMIF : 1;
961 unsigned OSCFIF : 1;
962 } __PIR2bits_t;
964 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
966 #define _CCP2IF 0x01
967 #define _TMR3IF 0x02
968 #define _LVDIF 0x04
969 #define _BCLIF 0x08
970 #define _EEIF 0x10
971 #define _CMIF 0x40
972 #define _OSCFIF 0x80
974 //==============================================================================
977 //==============================================================================
978 // IPR2 Bits
980 extern __at(0x0FA2) __sfr IPR2;
982 typedef struct
984 unsigned CCP2IP : 1;
985 unsigned TMR3IP : 1;
986 unsigned LVDIP : 1;
987 unsigned BCLIP : 1;
988 unsigned EEIP : 1;
989 unsigned : 1;
990 unsigned CMIP : 1;
991 unsigned OSCFIP : 1;
992 } __IPR2bits_t;
994 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
996 #define _CCP2IP 0x01
997 #define _TMR3IP 0x02
998 #define _LVDIP 0x04
999 #define _BCLIP 0x08
1000 #define _EEIP 0x10
1001 #define _CMIP 0x40
1002 #define _OSCFIP 0x80
1004 //==============================================================================
1007 //==============================================================================
1008 // EECON1 Bits
1010 extern __at(0x0FA6) __sfr EECON1;
1012 typedef struct
1014 unsigned RD : 1;
1015 unsigned WR : 1;
1016 unsigned WREN : 1;
1017 unsigned WRERR : 1;
1018 unsigned FREE : 1;
1019 unsigned : 1;
1020 unsigned CFGS : 1;
1021 unsigned EEPGD : 1;
1022 } __EECON1bits_t;
1024 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1026 #define _RD 0x01
1027 #define _WR 0x02
1028 #define _WREN 0x04
1029 #define _WRERR 0x08
1030 #define _FREE 0x10
1031 #define _CFGS 0x40
1032 #define _EEPGD 0x80
1034 //==============================================================================
1036 extern __at(0x0FA7) __sfr EECON2;
1037 extern __at(0x0FA8) __sfr EEDATA;
1038 extern __at(0x0FA9) __sfr EEADR;
1040 //==============================================================================
1041 // RCSTA Bits
1043 extern __at(0x0FAB) __sfr RCSTA;
1045 typedef union
1047 struct
1049 unsigned RX9D : 1;
1050 unsigned OERR : 1;
1051 unsigned FERR : 1;
1052 unsigned ADDEN : 1;
1053 unsigned CREN : 1;
1054 unsigned SREN : 1;
1055 unsigned RX9 : 1;
1056 unsigned SPEN : 1;
1059 struct
1061 unsigned : 1;
1062 unsigned : 1;
1063 unsigned : 1;
1064 unsigned ADEN : 1;
1065 unsigned : 1;
1066 unsigned : 1;
1067 unsigned : 1;
1068 unsigned : 1;
1070 } __RCSTAbits_t;
1072 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1074 #define _RX9D 0x01
1075 #define _OERR 0x02
1076 #define _FERR 0x04
1077 #define _ADDEN 0x08
1078 #define _ADEN 0x08
1079 #define _CREN 0x10
1080 #define _SREN 0x20
1081 #define _RX9 0x40
1082 #define _SPEN 0x80
1084 //==============================================================================
1087 //==============================================================================
1088 // TXSTA Bits
1090 extern __at(0x0FAC) __sfr TXSTA;
1092 typedef struct
1094 unsigned TX9D : 1;
1095 unsigned TRMT : 1;
1096 unsigned BRGH : 1;
1097 unsigned : 1;
1098 unsigned SYNC : 1;
1099 unsigned TXEN : 1;
1100 unsigned TX9 : 1;
1101 unsigned CSRC : 1;
1102 } __TXSTAbits_t;
1104 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1106 #define _TX9D 0x01
1107 #define _TRMT 0x02
1108 #define _BRGH 0x04
1109 #define _SYNC 0x10
1110 #define _TXEN 0x20
1111 #define _TX9 0x40
1112 #define _CSRC 0x80
1114 //==============================================================================
1116 extern __at(0x0FAD) __sfr TXREG;
1117 extern __at(0x0FAE) __sfr RCREG;
1118 extern __at(0x0FAF) __sfr SPBRG;
1120 //==============================================================================
1121 // T3CON Bits
1123 extern __at(0x0FB1) __sfr T3CON;
1125 typedef union
1127 struct
1129 unsigned TMR3ON : 1;
1130 unsigned TMR3CS : 1;
1131 unsigned NOT_T3SYNC : 1;
1132 unsigned T3CCP1 : 1;
1133 unsigned T3CKPS0 : 1;
1134 unsigned T3CKPS1 : 1;
1135 unsigned T3CCP2 : 1;
1136 unsigned RD16 : 1;
1139 struct
1141 unsigned : 1;
1142 unsigned : 1;
1143 unsigned T3SYNC : 1;
1144 unsigned : 1;
1145 unsigned : 1;
1146 unsigned : 1;
1147 unsigned : 1;
1148 unsigned : 1;
1151 struct
1153 unsigned : 4;
1154 unsigned T3CKPS : 2;
1155 unsigned : 2;
1157 } __T3CONbits_t;
1159 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1161 #define _T3CON_TMR3ON 0x01
1162 #define _T3CON_TMR3CS 0x02
1163 #define _T3CON_NOT_T3SYNC 0x04
1164 #define _T3CON_T3SYNC 0x04
1165 #define _T3CON_T3CCP1 0x08
1166 #define _T3CON_T3CKPS0 0x10
1167 #define _T3CON_T3CKPS1 0x20
1168 #define _T3CON_T3CCP2 0x40
1169 #define _T3CON_RD16 0x80
1171 //==============================================================================
1173 extern __at(0x0FB2) __sfr TMR3;
1174 extern __at(0x0FB2) __sfr TMR3L;
1175 extern __at(0x0FB3) __sfr TMR3H;
1177 //==============================================================================
1178 // CMCON Bits
1180 extern __at(0x0FB4) __sfr CMCON;
1182 typedef union
1184 struct
1186 unsigned CM0 : 1;
1187 unsigned CM1 : 1;
1188 unsigned CM2 : 1;
1189 unsigned CIS : 1;
1190 unsigned C1INV : 1;
1191 unsigned C2INV : 1;
1192 unsigned C1OUT : 1;
1193 unsigned C2OUT : 1;
1196 struct
1198 unsigned CM : 3;
1199 unsigned : 5;
1201 } __CMCONbits_t;
1203 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1205 #define _CM0 0x01
1206 #define _CM1 0x02
1207 #define _CM2 0x04
1208 #define _CIS 0x08
1209 #define _C1INV 0x10
1210 #define _C2INV 0x20
1211 #define _C1OUT 0x40
1212 #define _C2OUT 0x80
1214 //==============================================================================
1217 //==============================================================================
1218 // CVRCON Bits
1220 extern __at(0x0FB5) __sfr CVRCON;
1222 typedef union
1224 struct
1226 unsigned CVR0 : 1;
1227 unsigned CVR1 : 1;
1228 unsigned CVR2 : 1;
1229 unsigned CVR3 : 1;
1230 unsigned : 1;
1231 unsigned CVRR : 1;
1232 unsigned CVROE : 1;
1233 unsigned CVREN : 1;
1236 struct
1238 unsigned CVR : 4;
1239 unsigned : 4;
1241 } __CVRCONbits_t;
1243 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1245 #define _CVR0 0x01
1246 #define _CVR1 0x02
1247 #define _CVR2 0x04
1248 #define _CVR3 0x08
1249 #define _CVRR 0x20
1250 #define _CVROE 0x40
1251 #define _CVREN 0x80
1253 //==============================================================================
1256 //==============================================================================
1257 // CCP2CON Bits
1259 extern __at(0x0FBA) __sfr CCP2CON;
1261 typedef union
1263 struct
1265 unsigned CCP2M0 : 1;
1266 unsigned CCP2M1 : 1;
1267 unsigned CCP2M2 : 1;
1268 unsigned CCP2M3 : 1;
1269 unsigned DC2B0 : 1;
1270 unsigned DC2B1 : 1;
1271 unsigned : 1;
1272 unsigned : 1;
1275 struct
1277 unsigned : 1;
1278 unsigned : 1;
1279 unsigned : 1;
1280 unsigned : 1;
1281 unsigned CCP2Y : 1;
1282 unsigned CCP2X : 1;
1283 unsigned : 1;
1284 unsigned : 1;
1287 struct
1289 unsigned : 1;
1290 unsigned : 1;
1291 unsigned : 1;
1292 unsigned : 1;
1293 unsigned DCP2Y : 1;
1294 unsigned DCP2X : 1;
1295 unsigned : 1;
1296 unsigned : 1;
1299 struct
1301 unsigned CCP2M : 4;
1302 unsigned : 4;
1305 struct
1307 unsigned : 4;
1308 unsigned DC2B : 2;
1309 unsigned : 2;
1311 } __CCP2CONbits_t;
1313 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1315 #define _CCP2M0 0x01
1316 #define _CCP2M1 0x02
1317 #define _CCP2M2 0x04
1318 #define _CCP2M3 0x08
1319 #define _DC2B0 0x10
1320 #define _CCP2Y 0x10
1321 #define _DCP2Y 0x10
1322 #define _DC2B1 0x20
1323 #define _CCP2X 0x20
1324 #define _DCP2X 0x20
1326 //==============================================================================
1328 extern __at(0x0FBB) __sfr CCPR2;
1329 extern __at(0x0FBB) __sfr CCPR2L;
1330 extern __at(0x0FBC) __sfr CCPR2H;
1332 //==============================================================================
1333 // CCP1CON Bits
1335 extern __at(0x0FBD) __sfr CCP1CON;
1337 typedef union
1339 struct
1341 unsigned CCP1M0 : 1;
1342 unsigned CCP1M1 : 1;
1343 unsigned CCP1M2 : 1;
1344 unsigned CCP1M3 : 1;
1345 unsigned DC1B0 : 1;
1346 unsigned DC1B1 : 1;
1347 unsigned : 1;
1348 unsigned : 1;
1351 struct
1353 unsigned : 1;
1354 unsigned : 1;
1355 unsigned : 1;
1356 unsigned : 1;
1357 unsigned CCP1Y : 1;
1358 unsigned CCP1X : 1;
1359 unsigned : 1;
1360 unsigned : 1;
1363 struct
1365 unsigned : 1;
1366 unsigned : 1;
1367 unsigned : 1;
1368 unsigned : 1;
1369 unsigned DCP1Y : 1;
1370 unsigned DCP1X : 1;
1371 unsigned : 1;
1372 unsigned : 1;
1375 struct
1377 unsigned CCP1M : 4;
1378 unsigned : 4;
1381 struct
1383 unsigned : 4;
1384 unsigned DC1B : 2;
1385 unsigned : 2;
1387 } __CCP1CONbits_t;
1389 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1391 #define _CCP1M0 0x01
1392 #define _CCP1M1 0x02
1393 #define _CCP1M2 0x04
1394 #define _CCP1M3 0x08
1395 #define _DC1B0 0x10
1396 #define _CCP1Y 0x10
1397 #define _DCP1Y 0x10
1398 #define _DC1B1 0x20
1399 #define _CCP1X 0x20
1400 #define _DCP1X 0x20
1402 //==============================================================================
1404 extern __at(0x0FBE) __sfr CCPR1;
1405 extern __at(0x0FBE) __sfr CCPR1L;
1406 extern __at(0x0FBF) __sfr CCPR1H;
1408 //==============================================================================
1409 // ADCON2 Bits
1411 extern __at(0x0FC0) __sfr ADCON2;
1413 typedef union
1415 struct
1417 unsigned ADCS0 : 1;
1418 unsigned ADCS1 : 1;
1419 unsigned ADCS2 : 1;
1420 unsigned ACQT0 : 1;
1421 unsigned ACQT1 : 1;
1422 unsigned ACQT2 : 1;
1423 unsigned : 1;
1424 unsigned ADFM : 1;
1427 struct
1429 unsigned ADCS : 3;
1430 unsigned : 5;
1433 struct
1435 unsigned : 3;
1436 unsigned ACQT : 3;
1437 unsigned : 2;
1439 } __ADCON2bits_t;
1441 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1443 #define _ADCS0 0x01
1444 #define _ADCS1 0x02
1445 #define _ADCS2 0x04
1446 #define _ACQT0 0x08
1447 #define _ACQT1 0x10
1448 #define _ACQT2 0x20
1449 #define _ADFM 0x80
1451 //==============================================================================
1454 //==============================================================================
1455 // ADCON1 Bits
1457 extern __at(0x0FC1) __sfr ADCON1;
1459 typedef union
1461 struct
1463 unsigned PCFG0 : 1;
1464 unsigned PCFG1 : 1;
1465 unsigned PCFG2 : 1;
1466 unsigned PCFG3 : 1;
1467 unsigned VCFG0 : 1;
1468 unsigned VCFG1 : 1;
1469 unsigned : 1;
1470 unsigned : 1;
1473 struct
1475 unsigned PCFG : 4;
1476 unsigned : 4;
1479 struct
1481 unsigned : 4;
1482 unsigned VCFG : 2;
1483 unsigned : 2;
1485 } __ADCON1bits_t;
1487 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1489 #define _PCFG0 0x01
1490 #define _PCFG1 0x02
1491 #define _PCFG2 0x04
1492 #define _PCFG3 0x08
1493 #define _VCFG0 0x10
1494 #define _VCFG1 0x20
1496 //==============================================================================
1499 //==============================================================================
1500 // ADCON0 Bits
1502 extern __at(0x0FC2) __sfr ADCON0;
1504 typedef union
1506 struct
1508 unsigned ADON : 1;
1509 unsigned GO_NOT_DONE : 1;
1510 unsigned CHS0 : 1;
1511 unsigned CHS1 : 1;
1512 unsigned CHS2 : 1;
1513 unsigned CHS3 : 1;
1514 unsigned : 1;
1515 unsigned : 1;
1518 struct
1520 unsigned : 1;
1521 unsigned GO : 1;
1522 unsigned : 1;
1523 unsigned : 1;
1524 unsigned : 1;
1525 unsigned : 1;
1526 unsigned : 1;
1527 unsigned : 1;
1530 struct
1532 unsigned : 1;
1533 unsigned DONE : 1;
1534 unsigned : 1;
1535 unsigned : 1;
1536 unsigned : 1;
1537 unsigned : 1;
1538 unsigned : 1;
1539 unsigned : 1;
1542 struct
1544 unsigned : 1;
1545 unsigned NOT_DONE : 1;
1546 unsigned : 1;
1547 unsigned : 1;
1548 unsigned : 1;
1549 unsigned : 1;
1550 unsigned : 1;
1551 unsigned : 1;
1554 struct
1556 unsigned : 1;
1557 unsigned GO_DONE : 1;
1558 unsigned : 1;
1559 unsigned : 1;
1560 unsigned : 1;
1561 unsigned : 1;
1562 unsigned : 1;
1563 unsigned : 1;
1566 struct
1568 unsigned : 2;
1569 unsigned CHS : 4;
1570 unsigned : 2;
1572 } __ADCON0bits_t;
1574 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1576 #define _ADON 0x01
1577 #define _GO_NOT_DONE 0x02
1578 #define _GO 0x02
1579 #define _DONE 0x02
1580 #define _NOT_DONE 0x02
1581 #define _GO_DONE 0x02
1582 #define _CHS0 0x04
1583 #define _CHS1 0x08
1584 #define _CHS2 0x10
1585 #define _CHS3 0x20
1587 //==============================================================================
1589 extern __at(0x0FC3) __sfr ADRES;
1590 extern __at(0x0FC3) __sfr ADRESL;
1591 extern __at(0x0FC4) __sfr ADRESH;
1593 //==============================================================================
1594 // SSPCON2 Bits
1596 extern __at(0x0FC5) __sfr SSPCON2;
1598 typedef struct
1600 unsigned SEN : 1;
1601 unsigned RSEN : 1;
1602 unsigned PEN : 1;
1603 unsigned RCEN : 1;
1604 unsigned ACKEN : 1;
1605 unsigned ACKDT : 1;
1606 unsigned ACKSTAT : 1;
1607 unsigned GCEN : 1;
1608 } __SSPCON2bits_t;
1610 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1612 #define _SEN 0x01
1613 #define _RSEN 0x02
1614 #define _PEN 0x04
1615 #define _RCEN 0x08
1616 #define _ACKEN 0x10
1617 #define _ACKDT 0x20
1618 #define _ACKSTAT 0x40
1619 #define _GCEN 0x80
1621 //==============================================================================
1624 //==============================================================================
1625 // SSPCON1 Bits
1627 extern __at(0x0FC6) __sfr SSPCON1;
1629 typedef union
1631 struct
1633 unsigned SSPM0 : 1;
1634 unsigned SSPM1 : 1;
1635 unsigned SSPM2 : 1;
1636 unsigned SSPM3 : 1;
1637 unsigned CKP : 1;
1638 unsigned SSPEN : 1;
1639 unsigned SSPOV : 1;
1640 unsigned WCOL : 1;
1643 struct
1645 unsigned SSPM : 4;
1646 unsigned : 4;
1648 } __SSPCON1bits_t;
1650 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1652 #define _SSPM0 0x01
1653 #define _SSPM1 0x02
1654 #define _SSPM2 0x04
1655 #define _SSPM3 0x08
1656 #define _CKP 0x10
1657 #define _SSPEN 0x20
1658 #define _SSPOV 0x40
1659 #define _WCOL 0x80
1661 //==============================================================================
1664 //==============================================================================
1665 // SSPSTAT Bits
1667 extern __at(0x0FC7) __sfr SSPSTAT;
1669 typedef union
1671 struct
1673 unsigned BF : 1;
1674 unsigned UA : 1;
1675 unsigned R_NOT_W : 1;
1676 unsigned S : 1;
1677 unsigned P : 1;
1678 unsigned D_NOT_A : 1;
1679 unsigned CKE : 1;
1680 unsigned SMP : 1;
1683 struct
1685 unsigned : 1;
1686 unsigned : 1;
1687 unsigned I2C_READ : 1;
1688 unsigned I2C_START : 1;
1689 unsigned I2C_STOP : 1;
1690 unsigned I2C_DATA : 1;
1691 unsigned : 1;
1692 unsigned : 1;
1695 struct
1697 unsigned : 1;
1698 unsigned : 1;
1699 unsigned R : 1;
1700 unsigned : 1;
1701 unsigned : 1;
1702 unsigned D : 1;
1703 unsigned : 1;
1704 unsigned : 1;
1707 struct
1709 unsigned : 1;
1710 unsigned : 1;
1711 unsigned READ_WRITE : 1;
1712 unsigned : 1;
1713 unsigned : 1;
1714 unsigned DATA_ADDRESS : 1;
1715 unsigned : 1;
1716 unsigned : 1;
1719 struct
1721 unsigned : 1;
1722 unsigned : 1;
1723 unsigned NOT_WRITE : 1;
1724 unsigned : 1;
1725 unsigned : 1;
1726 unsigned NOT_ADDRESS : 1;
1727 unsigned : 1;
1728 unsigned : 1;
1731 struct
1733 unsigned : 1;
1734 unsigned : 1;
1735 unsigned NOT_W : 1;
1736 unsigned : 1;
1737 unsigned : 1;
1738 unsigned NOT_A : 1;
1739 unsigned : 1;
1740 unsigned : 1;
1743 struct
1745 unsigned : 1;
1746 unsigned : 1;
1747 unsigned R_W : 1;
1748 unsigned : 1;
1749 unsigned : 1;
1750 unsigned D_A : 1;
1751 unsigned : 1;
1752 unsigned : 1;
1755 struct
1757 unsigned : 1;
1758 unsigned : 1;
1759 unsigned : 1;
1760 unsigned : 1;
1761 unsigned : 1;
1762 unsigned I2C_DAT : 1;
1763 unsigned : 1;
1764 unsigned : 1;
1766 } __SSPSTATbits_t;
1768 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1770 #define _BF 0x01
1771 #define _UA 0x02
1772 #define _R_NOT_W 0x04
1773 #define _I2C_READ 0x04
1774 #define _R 0x04
1775 #define _READ_WRITE 0x04
1776 #define _NOT_WRITE 0x04
1777 #define _NOT_W 0x04
1778 #define _R_W 0x04
1779 #define _S 0x08
1780 #define _I2C_START 0x08
1781 #define _P 0x10
1782 #define _I2C_STOP 0x10
1783 #define _D_NOT_A 0x20
1784 #define _I2C_DATA 0x20
1785 #define _D 0x20
1786 #define _DATA_ADDRESS 0x20
1787 #define _NOT_ADDRESS 0x20
1788 #define _NOT_A 0x20
1789 #define _D_A 0x20
1790 #define _I2C_DAT 0x20
1791 #define _CKE 0x40
1792 #define _SMP 0x80
1794 //==============================================================================
1796 extern __at(0x0FC8) __sfr SSPADD;
1797 extern __at(0x0FC9) __sfr SSPBUF;
1799 //==============================================================================
1800 // T2CON Bits
1802 extern __at(0x0FCA) __sfr T2CON;
1804 typedef union
1806 struct
1808 unsigned T2CKPS0 : 1;
1809 unsigned T2CKPS1 : 1;
1810 unsigned TMR2ON : 1;
1811 unsigned TOUTPS0 : 1;
1812 unsigned TOUTPS1 : 1;
1813 unsigned TOUTPS2 : 1;
1814 unsigned TOUTPS3 : 1;
1815 unsigned : 1;
1818 struct
1820 unsigned T2CKPS : 2;
1821 unsigned : 6;
1824 struct
1826 unsigned : 3;
1827 unsigned TOUTPS : 4;
1828 unsigned : 1;
1830 } __T2CONbits_t;
1832 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
1834 #define _T2CKPS0 0x01
1835 #define _T2CKPS1 0x02
1836 #define _TMR2ON 0x04
1837 #define _TOUTPS0 0x08
1838 #define _TOUTPS1 0x10
1839 #define _TOUTPS2 0x20
1840 #define _TOUTPS3 0x40
1842 //==============================================================================
1844 extern __at(0x0FCB) __sfr PR2;
1845 extern __at(0x0FCC) __sfr TMR2;
1847 //==============================================================================
1848 // T1CON Bits
1850 extern __at(0x0FCD) __sfr T1CON;
1852 typedef union
1854 struct
1856 unsigned TMR1ON : 1;
1857 unsigned TMR1CS : 1;
1858 unsigned NOT_T1SYNC : 1;
1859 unsigned T1OSCEN : 1;
1860 unsigned T1CKPS0 : 1;
1861 unsigned T1CKPS1 : 1;
1862 unsigned T1RUN : 1;
1863 unsigned RD16 : 1;
1866 struct
1868 unsigned : 1;
1869 unsigned : 1;
1870 unsigned T1SYNC : 1;
1871 unsigned : 1;
1872 unsigned : 1;
1873 unsigned : 1;
1874 unsigned : 1;
1875 unsigned : 1;
1878 struct
1880 unsigned : 4;
1881 unsigned T1CKPS : 2;
1882 unsigned : 2;
1884 } __T1CONbits_t;
1886 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1888 #define _TMR1ON 0x01
1889 #define _TMR1CS 0x02
1890 #define _NOT_T1SYNC 0x04
1891 #define _T1SYNC 0x04
1892 #define _T1OSCEN 0x08
1893 #define _T1CKPS0 0x10
1894 #define _T1CKPS1 0x20
1895 #define _T1RUN 0x40
1896 #define _RD16 0x80
1898 //==============================================================================
1900 extern __at(0x0FCE) __sfr TMR1;
1901 extern __at(0x0FCE) __sfr TMR1L;
1902 extern __at(0x0FCF) __sfr TMR1H;
1904 //==============================================================================
1905 // RCON Bits
1907 extern __at(0x0FD0) __sfr RCON;
1909 typedef union
1911 struct
1913 unsigned NOT_BOR : 1;
1914 unsigned NOT_POR : 1;
1915 unsigned NOT_PD : 1;
1916 unsigned NOT_TO : 1;
1917 unsigned NOT_RI : 1;
1918 unsigned : 1;
1919 unsigned : 1;
1920 unsigned IPEN : 1;
1923 struct
1925 unsigned BOR : 1;
1926 unsigned POR : 1;
1927 unsigned PD : 1;
1928 unsigned TO : 1;
1929 unsigned RI : 1;
1930 unsigned : 1;
1931 unsigned : 1;
1932 unsigned : 1;
1934 } __RCONbits_t;
1936 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1938 #define _NOT_BOR 0x01
1939 #define _BOR 0x01
1940 #define _NOT_POR 0x02
1941 #define _POR 0x02
1942 #define _NOT_PD 0x04
1943 #define _PD 0x04
1944 #define _NOT_TO 0x08
1945 #define _TO 0x08
1946 #define _NOT_RI 0x10
1947 #define _RI 0x10
1948 #define _IPEN 0x80
1950 //==============================================================================
1953 //==============================================================================
1954 // WDTCON Bits
1956 extern __at(0x0FD1) __sfr WDTCON;
1958 typedef union
1960 struct
1962 unsigned SWDTEN : 1;
1963 unsigned : 1;
1964 unsigned : 1;
1965 unsigned : 1;
1966 unsigned : 1;
1967 unsigned : 1;
1968 unsigned : 1;
1969 unsigned : 1;
1972 struct
1974 unsigned SWDTE : 1;
1975 unsigned : 1;
1976 unsigned : 1;
1977 unsigned : 1;
1978 unsigned : 1;
1979 unsigned : 1;
1980 unsigned : 1;
1981 unsigned : 1;
1983 } __WDTCONbits_t;
1985 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
1987 #define _SWDTEN 0x01
1988 #define _SWDTE 0x01
1990 //==============================================================================
1993 //==============================================================================
1994 // LVDCON Bits
1996 extern __at(0x0FD2) __sfr LVDCON;
1998 typedef union
2000 struct
2002 unsigned LVDL0 : 1;
2003 unsigned LVDL1 : 1;
2004 unsigned LVDL2 : 1;
2005 unsigned LVDL3 : 1;
2006 unsigned LVDEN : 1;
2007 unsigned IRVST : 1;
2008 unsigned : 1;
2009 unsigned : 1;
2012 struct
2014 unsigned : 1;
2015 unsigned : 1;
2016 unsigned : 1;
2017 unsigned : 1;
2018 unsigned : 1;
2019 unsigned IVRST : 1;
2020 unsigned : 1;
2021 unsigned : 1;
2024 struct
2026 unsigned LVDL : 4;
2027 unsigned : 4;
2029 } __LVDCONbits_t;
2031 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2033 #define _LVDL0 0x01
2034 #define _LVDL1 0x02
2035 #define _LVDL2 0x04
2036 #define _LVDL3 0x08
2037 #define _LVDEN 0x10
2038 #define _IRVST 0x20
2039 #define _IVRST 0x20
2041 //==============================================================================
2044 //==============================================================================
2045 // OSCCON Bits
2047 extern __at(0x0FD3) __sfr OSCCON;
2049 typedef union
2051 struct
2053 unsigned SCS0 : 1;
2054 unsigned SCS1 : 1;
2055 unsigned IOFS : 1;
2056 unsigned OSTS : 1;
2057 unsigned IRCF0 : 1;
2058 unsigned IRCF1 : 1;
2059 unsigned IRCF2 : 1;
2060 unsigned IDLEN : 1;
2063 struct
2065 unsigned SCS : 1;
2066 unsigned : 1;
2067 unsigned FLTS : 1;
2068 unsigned : 1;
2069 unsigned : 1;
2070 unsigned : 1;
2071 unsigned : 1;
2072 unsigned : 1;
2075 struct
2077 unsigned : 4;
2078 unsigned IRCF : 3;
2079 unsigned : 1;
2081 } __OSCCONbits_t;
2083 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2085 #define _SCS0 0x01
2086 #define _SCS 0x01
2087 #define _SCS1 0x02
2088 #define _IOFS 0x04
2089 #define _FLTS 0x04
2090 #define _OSTS 0x08
2091 #define _IRCF0 0x10
2092 #define _IRCF1 0x20
2093 #define _IRCF2 0x40
2094 #define _IDLEN 0x80
2096 //==============================================================================
2099 //==============================================================================
2100 // T0CON Bits
2102 extern __at(0x0FD5) __sfr T0CON;
2104 typedef union
2106 struct
2108 unsigned T0PS0 : 1;
2109 unsigned T0PS1 : 1;
2110 unsigned T0PS2 : 1;
2111 unsigned PSA : 1;
2112 unsigned T0SE : 1;
2113 unsigned T0CS : 1;
2114 unsigned T08BIT : 1;
2115 unsigned TMR0ON : 1;
2118 struct
2120 unsigned : 1;
2121 unsigned : 1;
2122 unsigned : 1;
2123 unsigned T0PS3 : 1;
2124 unsigned : 1;
2125 unsigned : 1;
2126 unsigned T016BIT : 1;
2127 unsigned : 1;
2130 struct
2132 unsigned T0PS : 4;
2133 unsigned : 4;
2135 } __T0CONbits_t;
2137 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2139 #define _T0PS0 0x01
2140 #define _T0PS1 0x02
2141 #define _T0PS2 0x04
2142 #define _PSA 0x08
2143 #define _T0PS3 0x08
2144 #define _T0SE 0x10
2145 #define _T0CS 0x20
2146 #define _T08BIT 0x40
2147 #define _T016BIT 0x40
2148 #define _TMR0ON 0x80
2150 //==============================================================================
2152 extern __at(0x0FD6) __sfr TMR0;
2153 extern __at(0x0FD6) __sfr TMR0L;
2154 extern __at(0x0FD7) __sfr TMR0H;
2156 //==============================================================================
2157 // STATUS Bits
2159 extern __at(0x0FD8) __sfr STATUS;
2161 typedef struct
2163 unsigned C : 1;
2164 unsigned DC : 1;
2165 unsigned Z : 1;
2166 unsigned OV : 1;
2167 unsigned N : 1;
2168 unsigned : 1;
2169 unsigned : 1;
2170 unsigned : 1;
2171 } __STATUSbits_t;
2173 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2175 #define _C 0x01
2176 #define _DC 0x02
2177 #define _Z 0x04
2178 #define _OV 0x08
2179 #define _N 0x10
2181 //==============================================================================
2183 extern __at(0x0FD9) __sfr FSR2L;
2184 extern __at(0x0FDA) __sfr FSR2H;
2185 extern __at(0x0FDB) __sfr PLUSW2;
2186 extern __at(0x0FDC) __sfr PREINC2;
2187 extern __at(0x0FDD) __sfr POSTDEC2;
2188 extern __at(0x0FDE) __sfr POSTINC2;
2189 extern __at(0x0FDF) __sfr INDF2;
2190 extern __at(0x0FE0) __sfr BSR;
2191 extern __at(0x0FE1) __sfr FSR1L;
2192 extern __at(0x0FE2) __sfr FSR1H;
2193 extern __at(0x0FE3) __sfr PLUSW1;
2194 extern __at(0x0FE4) __sfr PREINC1;
2195 extern __at(0x0FE5) __sfr POSTDEC1;
2196 extern __at(0x0FE6) __sfr POSTINC1;
2197 extern __at(0x0FE7) __sfr INDF1;
2198 extern __at(0x0FE8) __sfr WREG;
2199 extern __at(0x0FE9) __sfr FSR0L;
2200 extern __at(0x0FEA) __sfr FSR0H;
2201 extern __at(0x0FEB) __sfr PLUSW0;
2202 extern __at(0x0FEC) __sfr PREINC0;
2203 extern __at(0x0FED) __sfr POSTDEC0;
2204 extern __at(0x0FEE) __sfr POSTINC0;
2205 extern __at(0x0FEF) __sfr INDF0;
2207 //==============================================================================
2208 // INTCON3 Bits
2210 extern __at(0x0FF0) __sfr INTCON3;
2212 typedef union
2214 struct
2216 unsigned INT1IF : 1;
2217 unsigned INT2IF : 1;
2218 unsigned : 1;
2219 unsigned INT1IE : 1;
2220 unsigned INT2IE : 1;
2221 unsigned : 1;
2222 unsigned INT1IP : 1;
2223 unsigned INT2IP : 1;
2226 struct
2228 unsigned INT1F : 1;
2229 unsigned INT2F : 1;
2230 unsigned : 1;
2231 unsigned INT1E : 1;
2232 unsigned INT2E : 1;
2233 unsigned : 1;
2234 unsigned INT1P : 1;
2235 unsigned INT2P : 1;
2237 } __INTCON3bits_t;
2239 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2241 #define _INT1IF 0x01
2242 #define _INT1F 0x01
2243 #define _INT2IF 0x02
2244 #define _INT2F 0x02
2245 #define _INT1IE 0x08
2246 #define _INT1E 0x08
2247 #define _INT2IE 0x10
2248 #define _INT2E 0x10
2249 #define _INT1IP 0x40
2250 #define _INT1P 0x40
2251 #define _INT2IP 0x80
2252 #define _INT2P 0x80
2254 //==============================================================================
2257 //==============================================================================
2258 // INTCON2 Bits
2260 extern __at(0x0FF1) __sfr INTCON2;
2262 typedef union
2264 struct
2266 unsigned RBIP : 1;
2267 unsigned : 1;
2268 unsigned TMR0IP : 1;
2269 unsigned : 1;
2270 unsigned INTEDG2 : 1;
2271 unsigned INTEDG1 : 1;
2272 unsigned INTEDG0 : 1;
2273 unsigned NOT_RBPU : 1;
2276 struct
2278 unsigned : 1;
2279 unsigned : 1;
2280 unsigned T0IP : 1;
2281 unsigned : 1;
2282 unsigned : 1;
2283 unsigned : 1;
2284 unsigned : 1;
2285 unsigned RBPU : 1;
2287 } __INTCON2bits_t;
2289 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2291 #define _RBIP 0x01
2292 #define _TMR0IP 0x04
2293 #define _T0IP 0x04
2294 #define _INTEDG2 0x10
2295 #define _INTEDG1 0x20
2296 #define _INTEDG0 0x40
2297 #define _NOT_RBPU 0x80
2298 #define _RBPU 0x80
2300 //==============================================================================
2303 //==============================================================================
2304 // INTCON Bits
2306 extern __at(0x0FF2) __sfr INTCON;
2308 typedef union
2310 struct
2312 unsigned RBIF : 1;
2313 unsigned INT0IF : 1;
2314 unsigned TMR0IF : 1;
2315 unsigned RBIE : 1;
2316 unsigned INT0IE : 1;
2317 unsigned TMR0IE : 1;
2318 unsigned PEIE_GIEL : 1;
2319 unsigned GIE_GIEH : 1;
2322 struct
2324 unsigned : 1;
2325 unsigned INT0F : 1;
2326 unsigned T0IF : 1;
2327 unsigned : 1;
2328 unsigned INT0E : 1;
2329 unsigned T0IE : 1;
2330 unsigned PEIE : 1;
2331 unsigned GIE : 1;
2334 struct
2336 unsigned : 1;
2337 unsigned INTF : 1;
2338 unsigned : 1;
2339 unsigned : 1;
2340 unsigned INTE : 1;
2341 unsigned : 1;
2342 unsigned GIEL : 1;
2343 unsigned GIEH : 1;
2345 } __INTCONbits_t;
2347 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2349 #define _RBIF 0x01
2350 #define _INT0IF 0x02
2351 #define _INT0F 0x02
2352 #define _INTF 0x02
2353 #define _TMR0IF 0x04
2354 #define _T0IF 0x04
2355 #define _RBIE 0x08
2356 #define _INT0IE 0x10
2357 #define _INT0E 0x10
2358 #define _INTE 0x10
2359 #define _TMR0IE 0x20
2360 #define _T0IE 0x20
2361 #define _PEIE_GIEL 0x40
2362 #define _PEIE 0x40
2363 #define _GIEL 0x40
2364 #define _GIE_GIEH 0x80
2365 #define _GIE 0x80
2366 #define _GIEH 0x80
2368 //==============================================================================
2370 extern __at(0x0FF3) __sfr PROD;
2371 extern __at(0x0FF3) __sfr PRODL;
2372 extern __at(0x0FF4) __sfr PRODH;
2373 extern __at(0x0FF5) __sfr TABLAT;
2374 extern __at(0x0FF6) __sfr TBLPTR;
2375 extern __at(0x0FF6) __sfr TBLPTRL;
2376 extern __at(0x0FF7) __sfr TBLPTRH;
2377 extern __at(0x0FF8) __sfr TBLPTRU;
2378 extern __at(0x0FF9) __sfr PC;
2379 extern __at(0x0FF9) __sfr PCL;
2380 extern __at(0x0FFA) __sfr PCLATH;
2381 extern __at(0x0FFB) __sfr PCLATU;
2383 //==============================================================================
2384 // STKPTR Bits
2386 extern __at(0x0FFC) __sfr STKPTR;
2388 typedef union
2390 struct
2392 unsigned STKPTR0 : 1;
2393 unsigned STKPTR1 : 1;
2394 unsigned STKPTR2 : 1;
2395 unsigned STKPTR3 : 1;
2396 unsigned STKPTR4 : 1;
2397 unsigned : 1;
2398 unsigned STKUNF : 1;
2399 unsigned STKFUL : 1;
2402 struct
2404 unsigned SP0 : 1;
2405 unsigned SP1 : 1;
2406 unsigned SP2 : 1;
2407 unsigned SP3 : 1;
2408 unsigned SP4 : 1;
2409 unsigned : 1;
2410 unsigned : 1;
2411 unsigned STKOVF : 1;
2414 struct
2416 unsigned SP : 5;
2417 unsigned : 3;
2420 struct
2422 unsigned STKPTR : 5;
2423 unsigned : 3;
2425 } __STKPTRbits_t;
2427 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2429 #define _STKPTR0 0x01
2430 #define _SP0 0x01
2431 #define _STKPTR1 0x02
2432 #define _SP1 0x02
2433 #define _STKPTR2 0x04
2434 #define _SP2 0x04
2435 #define _STKPTR3 0x08
2436 #define _SP3 0x08
2437 #define _STKPTR4 0x10
2438 #define _SP4 0x10
2439 #define _STKUNF 0x40
2440 #define _STKFUL 0x80
2441 #define _STKOVF 0x80
2443 //==============================================================================
2445 extern __at(0x0FFD) __sfr TOS;
2446 extern __at(0x0FFD) __sfr TOSL;
2447 extern __at(0x0FFE) __sfr TOSH;
2448 extern __at(0x0FFF) __sfr TOSU;
2450 //==============================================================================
2452 // Configuration Bits
2454 //==============================================================================
2456 #define __CONFIG1H 0x300001
2457 #define __CONFIG2L 0x300002
2458 #define __CONFIG2H 0x300003
2459 #define __CONFIG3H 0x300005
2460 #define __CONFIG4L 0x300006
2461 #define __CONFIG5L 0x300008
2462 #define __CONFIG5H 0x300009
2463 #define __CONFIG6L 0x30000A
2464 #define __CONFIG6H 0x30000B
2465 #define __CONFIG7L 0x30000C
2466 #define __CONFIG7H 0x30000D
2468 //----------------------------- CONFIG1H Options -------------------------------
2470 #define _LP_OSC 0xF0 // LP Oscillator.
2471 #define _LP_OSC_1H 0xF0 // LP Oscillator.
2472 #define _XT_OSC 0xF1 // XT Oscillator.
2473 #define _XT_OSC_1H 0xF1 // XT Oscillator.
2474 #define _HS_OSC 0xF2 // HS Oscillator.
2475 #define _HS_OSC_1H 0xF2 // HS Oscillator.
2476 #define _EC_OSC 0xF4 // EC oscillator, CLKO function on RA6.
2477 #define _EC_OSC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2478 #define _ECIOP_OSC 0xF5 // EC oscillator, port function on RA6.
2479 #define _ECIOP_OSC_1H 0xF5 // EC oscillator, port function on RA6.
2480 #define _ECIO_OSC_1H 0xF5 // EC oscillator, port function on RA6.
2481 #define _HSPLL_OSC 0xF6 // HS oscillator, PLL enabled (clock frequency = 4 x FOSC1).
2482 #define _HSPLL_OSC_1H 0xF6 // HS oscillator, PLL enabled (clock frequency = 4 x FOSC1).
2483 #define _RCIO_OSC 0xF7 // External RC oscillator, port function on RA6.
2484 #define _RCIO_OSC_1H 0xF7 // External RC oscillator, port function on RA6.
2485 #define _INTIO2_OSC 0xF8 // Internal RC oscillator, port function on RA6 and port function on RA7.
2486 #define _INTIO2_OSC_1H 0xF8 // Internal RC oscillator, port function on RA6 and port function on RA7.
2487 #define _INTIO1_OSC 0xF9 // Internal RC oscillator, CLKO function on RA6 and port function on RA7.
2488 #define _INTIO1_OSC_1H 0xF9 // Internal RC oscillator, CLKO function on RA6 and port function on RA7.
2489 #define _RC_OSC 0xFC // External RC oscillator, CLKO function on RA6.
2490 #define _RC_OSC_1H 0xFC // External RC oscillator, CLKO function on RA6.
2491 #define _FSCM_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2492 #define _FSCM_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2493 #define _IESO_OFF_1H 0x7F // Internal/External Switchover mode disabled.
2494 #define _IESO_ON_1H 0xFF // Internal/External Switchover mode enabled.
2496 //----------------------------- CONFIG2L Options -------------------------------
2498 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2499 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2500 #define _BOR_OFF_2L 0xFD // Brown-out Reset disabled.
2501 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled.
2502 #define _BORV_45_2L 0xF3 // VBOR set to 4.5V.
2503 #define _BORV_42_2L 0xF7 // VBOR set to 4.2V.
2504 #define _BORV_27_2L 0xFB // VBOR set to 2.7V.
2505 #define _BORV_20_2L 0xFF // VBOR set to 2.0V.
2507 //----------------------------- CONFIG2H Options -------------------------------
2509 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2510 #define _WDT_ON_2H 0xFF // WDT enabled.
2511 #define _WDTPS_1_2H 0xE1 // 1:1.
2512 #define _WDTPS_2_2H 0xE3 // 1:2.
2513 #define _WDTPS_4_2H 0xE5 // 1:4.
2514 #define _WDTPS_8_2H 0xE7 // 1:8.
2515 #define _WDTPS_16_2H 0xE9 // 1:16.
2516 #define _WDTPS_32_2H 0xEB // 1:32.
2517 #define _WDTPS_64_2H 0xED // 1:64.
2518 #define _WDTPS_128_2H 0xEF // 1:128.
2519 #define _WDTPS_256_2H 0xF1 // 1:256.
2520 #define _WDTPS_512_2H 0xF3 // 1:512.
2521 #define _1K 0xF5 // 1:1024.
2522 #define _WDTPS_1K_2H 0xF5 // 1:1024.
2523 #define _2K 0xF7 // 1:2048.
2524 #define _WDTPS_2K_2H 0xF7 // 1:2048.
2525 #define _4K 0xF9 // 1:4096.
2526 #define _WDTPS_4K_2H 0xF9 // 1:4096.
2527 #define _8K 0xFB // 1:8192.
2528 #define _WDTPS_8K_2H 0xFB // 1:8192.
2529 #define _16K 0xFD // 1:16384.
2530 #define _WDTPS_16K_2H 0xFD // 1:16384.
2531 #define _32K 0xFF // 1:32768.
2532 #define _WDTPS_32K_2H 0xFF // 1:32768.
2534 //----------------------------- CONFIG3H Options -------------------------------
2536 #define _CCP2MX_OFF 0xFE // CCP2 input/output is multiplexed with RB3.
2537 #define _CCP2MX_OFF_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2538 #define _CCP2MX_B3 0xFE // CCP2 input/output is multiplexed with RB3.
2539 #define _CCP2MX_B3_3H 0xFE // CCP2 input/output is multiplexed with RB3.
2540 #define _CCP2MX_ON 0xFF // CCP2 input/output is multiplexed with RC1.
2541 #define _CCP2MX_ON_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2542 #define _CCP2MX_C1 0xFF // CCP2 input/output is multiplexed with RC1.
2543 #define _CCP2MX_C1_3H 0xFF // CCP2 input/output is multiplexed with RC1.
2544 #define _PBAD_DIG_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
2545 #define _PBAD_ANA_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
2546 #define _MCLRE_OFF_3H 0x7F // MCLR disabled; RE3 input is enabled in 40-pin devices only (PIC18F4X20).
2547 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
2549 //----------------------------- CONFIG4L Options -------------------------------
2551 #define _STVR_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
2552 #define _STVR_ON_4L 0xFF // Stack full/underflow will cause Reset.
2553 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
2554 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
2555 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2556 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2558 //----------------------------- CONFIG5L Options -------------------------------
2560 #define _CP0_ON_5L 0xFE // Block 0 (000200-0007FFh) code-protected.
2561 #define _CP0_OFF_5L 0xFF // Block 0 (000200-0007FFh) not code-protected.
2562 #define _CP1_ON_5L 0xFD // Block 1 (000800-000FFFh) code-protected.
2563 #define _CP1_OFF_5L 0xFF // Block 1 (000800-000FFFh) not code-protected.
2564 #define _CP2_ON_5L 0xFB // Block 2 (001000-0017FFh) code-protected.
2565 #define _CP2_OFF_5L 0xFF // Block 2 (001000-0017FFh) not code-protected.
2566 #define _CP3_ON_5L 0xF7 // Block 3 (001800-001FFFh) code-protected.
2567 #define _CP3_OFF_5L 0xFF // Block 3 (001800-001FFFh) not code-protected.
2569 //----------------------------- CONFIG5H Options -------------------------------
2571 #define _CPB_ON_5H 0xBF // Boot block (000000-0001FFh) is code-protected.
2572 #define _CPB_OFF_5H 0xFF // Boot block (000000-0001FFh) is not code-protected.
2573 #define _CPD_ON_5H 0x7F // Data EEPROM is code-protected.
2574 #define _CPD_OFF_5H 0xFF // Data EEPROM is not code-protected.
2576 //----------------------------- CONFIG6L Options -------------------------------
2578 #define _WRT0_ON_6L 0xFE // Block 0 (000200-0007FFh) write-protected.
2579 #define _WRT0_OFF_6L 0xFF // Block 0 (000200-0007FFh) not write-protected.
2580 #define _WRT1_ON_6L 0xFD // Block 1 (000800-000FFFh) write-protected.
2581 #define _WRT1_OFF_6L 0xFF // Block 1 (000800-000FFFh) not write-protected.
2582 #define _WRT2_ON_6L 0xFB // Block 2 (001000-0017FFh) write-protected.
2583 #define _WRT2_OFF_6L 0xFF // Block 2 (001000-0017FFh) not write-protected.
2584 #define _WRT3_ON_6L 0xF7 // Block 3 (001800-001FFFh) write-protected.
2585 #define _WRT3_OFF_6L 0xFF // Block 3 (001800-001FFFh) not write-protected.
2587 //----------------------------- CONFIG6H Options -------------------------------
2589 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) are write-protected.
2590 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) are not write-protected.
2591 #define _WRTB_ON_6H 0xBF // Boot block (000000-0001FFh) is write-protected.
2592 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0001FFh) is not write-protected.
2593 #define _WRTD_ON_6H 0x7F // Data EEPROM is write-protected.
2594 #define _WRTD_OFF_6H 0xFF // Data EEPROM is not write-protected.
2596 //----------------------------- CONFIG7L Options -------------------------------
2598 #define _EBTR0_ON_7L 0xFE // Block 0 (000200-0007FFh) protected from table reads executed in other blocks.
2599 #define _EBTR0_OFF_7L 0xFF // Block 0 (000200-0007FFh) not protected from table reads executed in other blocks.
2600 #define _EBTR1_ON_7L 0xFD // Block 1 (000800-000FFFh) protected from table reads executed in other blocks.
2601 #define _EBTR1_OFF_7L 0xFF // Block 1 (000800-000FFFh) not protected from table reads executed in other blocks.
2602 #define _EBTR2_ON_7L 0xFB // Block 2 (001000-0017FFh) protected from table reads executed in other blocks.
2603 #define _EBTR2_OFF_7L 0xFF // Block 2 (001000-0017FFh) not protected from table reads executed in other blocks.
2604 #define _EBTR3_ON_7L 0xF7 // Block 3 (001800-001FFFh) protected from table reads executed in other blocks.
2605 #define _EBTR3_OFF_7L 0xFF // Block 3 (001800-001FFFh) not protected from table reads executed in other blocks.
2607 //----------------------------- CONFIG7H Options -------------------------------
2609 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0001FFh) is protected from table reads executed in other blocks.
2610 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0001FFh) is not protected from table reads executed in other blocks.
2612 //==============================================================================
2614 #define __DEVID1 0x3FFFFE
2615 #define __DEVID2 0x3FFFFF
2617 #define __IDLOC0 0x200000
2618 #define __IDLOC1 0x200001
2619 #define __IDLOC2 0x200002
2620 #define __IDLOC3 0x200003
2621 #define __IDLOC4 0x200004
2622 #define __IDLOC5 0x200005
2623 #define __IDLOC6 0x200006
2624 #define __IDLOC7 0x200007
2626 #endif // #ifndef __PIC18LF2320_H__