struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f2620.h
blobd3d677bc6c12d934390e3860bcf39f89ce5cbeff
1 /*
2 * This declarations of the PIC18F2620 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:45 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 __PIC18F2620_H__
26 #define __PIC18F2620_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // PORTA Bits
40 extern __at(0x0F80) __sfr PORTA;
42 typedef union
44 struct
46 unsigned RA0 : 1;
47 unsigned RA1 : 1;
48 unsigned RA2 : 1;
49 unsigned RA3 : 1;
50 unsigned RA4 : 1;
51 unsigned RA5 : 1;
52 unsigned RA6 : 1;
53 unsigned RA7 : 1;
56 struct
58 unsigned : 1;
59 unsigned : 1;
60 unsigned : 1;
61 unsigned : 1;
62 unsigned T0CKI : 1;
63 unsigned AN4 : 1;
64 unsigned : 1;
65 unsigned : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned : 1;
73 unsigned : 1;
74 unsigned : 1;
75 unsigned SS : 1;
76 unsigned : 1;
77 unsigned : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned NOT_SS : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned : 1;
95 unsigned : 1;
96 unsigned : 1;
97 unsigned : 1;
98 unsigned : 1;
99 unsigned LVDIN : 1;
100 unsigned : 1;
101 unsigned : 1;
104 struct
106 unsigned : 1;
107 unsigned : 1;
108 unsigned : 1;
109 unsigned : 1;
110 unsigned : 1;
111 unsigned HLVDIN : 1;
112 unsigned : 1;
113 unsigned : 1;
115 } __PORTAbits_t;
117 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
119 #define _PORTA_RA0 0x01
120 #define _PORTA_RA1 0x02
121 #define _PORTA_RA2 0x04
122 #define _PORTA_RA3 0x08
123 #define _PORTA_RA4 0x10
124 #define _PORTA_T0CKI 0x10
125 #define _PORTA_RA5 0x20
126 #define _PORTA_AN4 0x20
127 #define _PORTA_SS 0x20
128 #define _PORTA_NOT_SS 0x20
129 #define _PORTA_LVDIN 0x20
130 #define _PORTA_HLVDIN 0x20
131 #define _PORTA_RA6 0x40
132 #define _PORTA_RA7 0x80
134 //==============================================================================
137 //==============================================================================
138 // PORTB Bits
140 extern __at(0x0F81) __sfr PORTB;
142 typedef union
144 struct
146 unsigned RB0 : 1;
147 unsigned RB1 : 1;
148 unsigned RB2 : 1;
149 unsigned RB3 : 1;
150 unsigned RB4 : 1;
151 unsigned RB5 : 1;
152 unsigned RB6 : 1;
153 unsigned RB7 : 1;
156 struct
158 unsigned INT0 : 1;
159 unsigned INT1 : 1;
160 unsigned INT2 : 1;
161 unsigned CCP2 : 1;
162 unsigned KBI0 : 1;
163 unsigned KBI1 : 1;
164 unsigned KBI2 : 1;
165 unsigned KBI3 : 1;
168 struct
170 unsigned AN12 : 1;
171 unsigned AN10 : 1;
172 unsigned AN8 : 1;
173 unsigned AN9 : 1;
174 unsigned AN11 : 1;
175 unsigned PGM : 1;
176 unsigned PGC : 1;
177 unsigned PGD : 1;
180 struct
182 unsigned INT : 3;
183 unsigned : 5;
186 struct
188 unsigned : 4;
189 unsigned KBI : 4;
191 } __PORTBbits_t;
193 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
195 #define _PORTB_RB0 0x01
196 #define _PORTB_INT0 0x01
197 #define _PORTB_AN12 0x01
198 #define _PORTB_RB1 0x02
199 #define _PORTB_INT1 0x02
200 #define _PORTB_AN10 0x02
201 #define _PORTB_RB2 0x04
202 #define _PORTB_INT2 0x04
203 #define _PORTB_AN8 0x04
204 #define _PORTB_RB3 0x08
205 #define _PORTB_CCP2 0x08
206 #define _PORTB_AN9 0x08
207 #define _PORTB_RB4 0x10
208 #define _PORTB_KBI0 0x10
209 #define _PORTB_AN11 0x10
210 #define _PORTB_RB5 0x20
211 #define _PORTB_KBI1 0x20
212 #define _PORTB_PGM 0x20
213 #define _PORTB_RB6 0x40
214 #define _PORTB_KBI2 0x40
215 #define _PORTB_PGC 0x40
216 #define _PORTB_RB7 0x80
217 #define _PORTB_KBI3 0x80
218 #define _PORTB_PGD 0x80
220 //==============================================================================
223 //==============================================================================
224 // PORTC Bits
226 extern __at(0x0F82) __sfr PORTC;
228 typedef union
230 struct
232 unsigned RC0 : 1;
233 unsigned RC1 : 1;
234 unsigned RC2 : 1;
235 unsigned RC3 : 1;
236 unsigned RC4 : 1;
237 unsigned RC5 : 1;
238 unsigned RC6 : 1;
239 unsigned RC7 : 1;
242 struct
244 unsigned T1OSO : 1;
245 unsigned T1OSI : 1;
246 unsigned CCP1 : 1;
247 unsigned SCK : 1;
248 unsigned SDI : 1;
249 unsigned SDO : 1;
250 unsigned TX : 1;
251 unsigned RX : 1;
254 struct
256 unsigned T13CKI : 1;
257 unsigned CCP2 : 1;
258 unsigned : 1;
259 unsigned SCL : 1;
260 unsigned SDA : 1;
261 unsigned : 1;
262 unsigned CK : 1;
263 unsigned : 1;
266 struct
268 unsigned T1CKI : 1;
269 unsigned : 1;
270 unsigned : 1;
271 unsigned : 1;
272 unsigned : 1;
273 unsigned : 1;
274 unsigned : 1;
275 unsigned : 1;
277 } __PORTCbits_t;
279 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
281 #define _PORTC_RC0 0x01
282 #define _PORTC_T1OSO 0x01
283 #define _PORTC_T13CKI 0x01
284 #define _PORTC_T1CKI 0x01
285 #define _PORTC_RC1 0x02
286 #define _PORTC_T1OSI 0x02
287 #define _PORTC_CCP2 0x02
288 #define _PORTC_RC2 0x04
289 #define _PORTC_CCP1 0x04
290 #define _PORTC_RC3 0x08
291 #define _PORTC_SCK 0x08
292 #define _PORTC_SCL 0x08
293 #define _PORTC_RC4 0x10
294 #define _PORTC_SDI 0x10
295 #define _PORTC_SDA 0x10
296 #define _PORTC_RC5 0x20
297 #define _PORTC_SDO 0x20
298 #define _PORTC_RC6 0x40
299 #define _PORTC_TX 0x40
300 #define _PORTC_CK 0x40
301 #define _PORTC_RC7 0x80
302 #define _PORTC_RX 0x80
304 //==============================================================================
307 //==============================================================================
308 // PORTE Bits
310 extern __at(0x0F84) __sfr PORTE;
312 typedef union
314 struct
316 unsigned : 1;
317 unsigned : 1;
318 unsigned : 1;
319 unsigned RE3 : 1;
320 unsigned : 1;
321 unsigned : 1;
322 unsigned : 1;
323 unsigned : 1;
326 struct
328 unsigned : 1;
329 unsigned : 1;
330 unsigned : 1;
331 unsigned MCLR : 1;
332 unsigned : 1;
333 unsigned : 1;
334 unsigned : 1;
335 unsigned : 1;
338 struct
340 unsigned : 1;
341 unsigned : 1;
342 unsigned : 1;
343 unsigned NOT_MCLR : 1;
344 unsigned : 1;
345 unsigned : 1;
346 unsigned : 1;
347 unsigned : 1;
350 struct
352 unsigned : 1;
353 unsigned : 1;
354 unsigned : 1;
355 unsigned VPP : 1;
356 unsigned : 1;
357 unsigned : 1;
358 unsigned : 1;
359 unsigned : 1;
361 } __PORTEbits_t;
363 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
365 #define _RE3 0x08
366 #define _MCLR 0x08
367 #define _NOT_MCLR 0x08
368 #define _VPP 0x08
370 //==============================================================================
373 //==============================================================================
374 // LATA Bits
376 extern __at(0x0F89) __sfr LATA;
378 typedef struct
380 unsigned LATA0 : 1;
381 unsigned LATA1 : 1;
382 unsigned LATA2 : 1;
383 unsigned LATA3 : 1;
384 unsigned LATA4 : 1;
385 unsigned LATA5 : 1;
386 unsigned LATA6 : 1;
387 unsigned LATA7 : 1;
388 } __LATAbits_t;
390 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
392 #define _LATA0 0x01
393 #define _LATA1 0x02
394 #define _LATA2 0x04
395 #define _LATA3 0x08
396 #define _LATA4 0x10
397 #define _LATA5 0x20
398 #define _LATA6 0x40
399 #define _LATA7 0x80
401 //==============================================================================
404 //==============================================================================
405 // LATB Bits
407 extern __at(0x0F8A) __sfr LATB;
409 typedef struct
411 unsigned LATB0 : 1;
412 unsigned LATB1 : 1;
413 unsigned LATB2 : 1;
414 unsigned LATB3 : 1;
415 unsigned LATB4 : 1;
416 unsigned LATB5 : 1;
417 unsigned LATB6 : 1;
418 unsigned LATB7 : 1;
419 } __LATBbits_t;
421 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
423 #define _LATB0 0x01
424 #define _LATB1 0x02
425 #define _LATB2 0x04
426 #define _LATB3 0x08
427 #define _LATB4 0x10
428 #define _LATB5 0x20
429 #define _LATB6 0x40
430 #define _LATB7 0x80
432 //==============================================================================
435 //==============================================================================
436 // LATC Bits
438 extern __at(0x0F8B) __sfr LATC;
440 typedef struct
442 unsigned LATC0 : 1;
443 unsigned LATC1 : 1;
444 unsigned LATC2 : 1;
445 unsigned LATC3 : 1;
446 unsigned LATC4 : 1;
447 unsigned LATC5 : 1;
448 unsigned LATC6 : 1;
449 unsigned LATC7 : 1;
450 } __LATCbits_t;
452 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
454 #define _LATC0 0x01
455 #define _LATC1 0x02
456 #define _LATC2 0x04
457 #define _LATC3 0x08
458 #define _LATC4 0x10
459 #define _LATC5 0x20
460 #define _LATC6 0x40
461 #define _LATC7 0x80
463 //==============================================================================
466 //==============================================================================
467 // DDRA Bits
469 extern __at(0x0F92) __sfr DDRA;
471 typedef union
473 struct
475 unsigned TRISA0 : 1;
476 unsigned TRISA1 : 1;
477 unsigned TRISA2 : 1;
478 unsigned TRISA3 : 1;
479 unsigned TRISA4 : 1;
480 unsigned TRISA5 : 1;
481 unsigned TRISA6 : 1;
482 unsigned TRISA7 : 1;
485 struct
487 unsigned RA0 : 1;
488 unsigned RA1 : 1;
489 unsigned RA2 : 1;
490 unsigned RA3 : 1;
491 unsigned RA4 : 1;
492 unsigned RA5 : 1;
493 unsigned RA6 : 1;
494 unsigned RA7 : 1;
496 } __DDRAbits_t;
498 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
500 #define _TRISA0 0x01
501 #define _RA0 0x01
502 #define _TRISA1 0x02
503 #define _RA1 0x02
504 #define _TRISA2 0x04
505 #define _RA2 0x04
506 #define _TRISA3 0x08
507 #define _RA3 0x08
508 #define _TRISA4 0x10
509 #define _RA4 0x10
510 #define _TRISA5 0x20
511 #define _RA5 0x20
512 #define _TRISA6 0x40
513 #define _RA6 0x40
514 #define _TRISA7 0x80
515 #define _RA7 0x80
517 //==============================================================================
520 //==============================================================================
521 // TRISA Bits
523 extern __at(0x0F92) __sfr TRISA;
525 typedef union
527 struct
529 unsigned TRISA0 : 1;
530 unsigned TRISA1 : 1;
531 unsigned TRISA2 : 1;
532 unsigned TRISA3 : 1;
533 unsigned TRISA4 : 1;
534 unsigned TRISA5 : 1;
535 unsigned TRISA6 : 1;
536 unsigned TRISA7 : 1;
539 struct
541 unsigned RA0 : 1;
542 unsigned RA1 : 1;
543 unsigned RA2 : 1;
544 unsigned RA3 : 1;
545 unsigned RA4 : 1;
546 unsigned RA5 : 1;
547 unsigned RA6 : 1;
548 unsigned RA7 : 1;
550 } __TRISAbits_t;
552 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
554 #define _TRISA_TRISA0 0x01
555 #define _TRISA_RA0 0x01
556 #define _TRISA_TRISA1 0x02
557 #define _TRISA_RA1 0x02
558 #define _TRISA_TRISA2 0x04
559 #define _TRISA_RA2 0x04
560 #define _TRISA_TRISA3 0x08
561 #define _TRISA_RA3 0x08
562 #define _TRISA_TRISA4 0x10
563 #define _TRISA_RA4 0x10
564 #define _TRISA_TRISA5 0x20
565 #define _TRISA_RA5 0x20
566 #define _TRISA_TRISA6 0x40
567 #define _TRISA_RA6 0x40
568 #define _TRISA_TRISA7 0x80
569 #define _TRISA_RA7 0x80
571 //==============================================================================
574 //==============================================================================
575 // DDRB Bits
577 extern __at(0x0F93) __sfr DDRB;
579 typedef union
581 struct
583 unsigned TRISB0 : 1;
584 unsigned TRISB1 : 1;
585 unsigned TRISB2 : 1;
586 unsigned TRISB3 : 1;
587 unsigned TRISB4 : 1;
588 unsigned TRISB5 : 1;
589 unsigned TRISB6 : 1;
590 unsigned TRISB7 : 1;
593 struct
595 unsigned RB0 : 1;
596 unsigned RB1 : 1;
597 unsigned RB2 : 1;
598 unsigned RB3 : 1;
599 unsigned RB4 : 1;
600 unsigned RB5 : 1;
601 unsigned RB6 : 1;
602 unsigned RB7 : 1;
604 } __DDRBbits_t;
606 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
608 #define _TRISB0 0x01
609 #define _RB0 0x01
610 #define _TRISB1 0x02
611 #define _RB1 0x02
612 #define _TRISB2 0x04
613 #define _RB2 0x04
614 #define _TRISB3 0x08
615 #define _RB3 0x08
616 #define _TRISB4 0x10
617 #define _RB4 0x10
618 #define _TRISB5 0x20
619 #define _RB5 0x20
620 #define _TRISB6 0x40
621 #define _RB6 0x40
622 #define _TRISB7 0x80
623 #define _RB7 0x80
625 //==============================================================================
628 //==============================================================================
629 // TRISB Bits
631 extern __at(0x0F93) __sfr TRISB;
633 typedef union
635 struct
637 unsigned TRISB0 : 1;
638 unsigned TRISB1 : 1;
639 unsigned TRISB2 : 1;
640 unsigned TRISB3 : 1;
641 unsigned TRISB4 : 1;
642 unsigned TRISB5 : 1;
643 unsigned TRISB6 : 1;
644 unsigned TRISB7 : 1;
647 struct
649 unsigned RB0 : 1;
650 unsigned RB1 : 1;
651 unsigned RB2 : 1;
652 unsigned RB3 : 1;
653 unsigned RB4 : 1;
654 unsigned RB5 : 1;
655 unsigned RB6 : 1;
656 unsigned RB7 : 1;
658 } __TRISBbits_t;
660 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
662 #define _TRISB_TRISB0 0x01
663 #define _TRISB_RB0 0x01
664 #define _TRISB_TRISB1 0x02
665 #define _TRISB_RB1 0x02
666 #define _TRISB_TRISB2 0x04
667 #define _TRISB_RB2 0x04
668 #define _TRISB_TRISB3 0x08
669 #define _TRISB_RB3 0x08
670 #define _TRISB_TRISB4 0x10
671 #define _TRISB_RB4 0x10
672 #define _TRISB_TRISB5 0x20
673 #define _TRISB_RB5 0x20
674 #define _TRISB_TRISB6 0x40
675 #define _TRISB_RB6 0x40
676 #define _TRISB_TRISB7 0x80
677 #define _TRISB_RB7 0x80
679 //==============================================================================
682 //==============================================================================
683 // DDRC Bits
685 extern __at(0x0F94) __sfr DDRC;
687 typedef union
689 struct
691 unsigned TRISC0 : 1;
692 unsigned TRISC1 : 1;
693 unsigned TRISC2 : 1;
694 unsigned TRISC3 : 1;
695 unsigned TRISC4 : 1;
696 unsigned TRISC5 : 1;
697 unsigned TRISC6 : 1;
698 unsigned TRISC7 : 1;
701 struct
703 unsigned RC0 : 1;
704 unsigned RC1 : 1;
705 unsigned RC2 : 1;
706 unsigned RC3 : 1;
707 unsigned RC4 : 1;
708 unsigned RC5 : 1;
709 unsigned RC6 : 1;
710 unsigned RC7 : 1;
712 } __DDRCbits_t;
714 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
716 #define _TRISC0 0x01
717 #define _RC0 0x01
718 #define _TRISC1 0x02
719 #define _RC1 0x02
720 #define _TRISC2 0x04
721 #define _RC2 0x04
722 #define _TRISC3 0x08
723 #define _RC3 0x08
724 #define _TRISC4 0x10
725 #define _RC4 0x10
726 #define _TRISC5 0x20
727 #define _RC5 0x20
728 #define _TRISC6 0x40
729 #define _RC6 0x40
730 #define _TRISC7 0x80
731 #define _RC7 0x80
733 //==============================================================================
736 //==============================================================================
737 // TRISC Bits
739 extern __at(0x0F94) __sfr TRISC;
741 typedef union
743 struct
745 unsigned TRISC0 : 1;
746 unsigned TRISC1 : 1;
747 unsigned TRISC2 : 1;
748 unsigned TRISC3 : 1;
749 unsigned TRISC4 : 1;
750 unsigned TRISC5 : 1;
751 unsigned TRISC6 : 1;
752 unsigned TRISC7 : 1;
755 struct
757 unsigned RC0 : 1;
758 unsigned RC1 : 1;
759 unsigned RC2 : 1;
760 unsigned RC3 : 1;
761 unsigned RC4 : 1;
762 unsigned RC5 : 1;
763 unsigned RC6 : 1;
764 unsigned RC7 : 1;
766 } __TRISCbits_t;
768 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
770 #define _TRISC_TRISC0 0x01
771 #define _TRISC_RC0 0x01
772 #define _TRISC_TRISC1 0x02
773 #define _TRISC_RC1 0x02
774 #define _TRISC_TRISC2 0x04
775 #define _TRISC_RC2 0x04
776 #define _TRISC_TRISC3 0x08
777 #define _TRISC_RC3 0x08
778 #define _TRISC_TRISC4 0x10
779 #define _TRISC_RC4 0x10
780 #define _TRISC_TRISC5 0x20
781 #define _TRISC_RC5 0x20
782 #define _TRISC_TRISC6 0x40
783 #define _TRISC_RC6 0x40
784 #define _TRISC_TRISC7 0x80
785 #define _TRISC_RC7 0x80
787 //==============================================================================
790 //==============================================================================
791 // OSCTUNE Bits
793 extern __at(0x0F9B) __sfr OSCTUNE;
795 typedef union
797 struct
799 unsigned TUN0 : 1;
800 unsigned TUN1 : 1;
801 unsigned TUN2 : 1;
802 unsigned TUN3 : 1;
803 unsigned TUN4 : 1;
804 unsigned : 1;
805 unsigned PLLEN : 1;
806 unsigned INTSRC : 1;
809 struct
811 unsigned TUN : 5;
812 unsigned : 3;
814 } __OSCTUNEbits_t;
816 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
818 #define _TUN0 0x01
819 #define _TUN1 0x02
820 #define _TUN2 0x04
821 #define _TUN3 0x08
822 #define _TUN4 0x10
823 #define _PLLEN 0x40
824 #define _INTSRC 0x80
826 //==============================================================================
829 //==============================================================================
830 // PIE1 Bits
832 extern __at(0x0F9D) __sfr PIE1;
834 typedef struct
836 unsigned TMR1IE : 1;
837 unsigned TMR2IE : 1;
838 unsigned CCP1IE : 1;
839 unsigned SSPIE : 1;
840 unsigned TXIE : 1;
841 unsigned RCIE : 1;
842 unsigned ADIE : 1;
843 unsigned : 1;
844 } __PIE1bits_t;
846 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
848 #define _TMR1IE 0x01
849 #define _TMR2IE 0x02
850 #define _CCP1IE 0x04
851 #define _SSPIE 0x08
852 #define _TXIE 0x10
853 #define _RCIE 0x20
854 #define _ADIE 0x40
856 //==============================================================================
859 //==============================================================================
860 // PIR1 Bits
862 extern __at(0x0F9E) __sfr PIR1;
864 typedef struct
866 unsigned TMR1IF : 1;
867 unsigned TMR2IF : 1;
868 unsigned CCP1IF : 1;
869 unsigned SSPIF : 1;
870 unsigned TXIF : 1;
871 unsigned RCIF : 1;
872 unsigned ADIF : 1;
873 unsigned : 1;
874 } __PIR1bits_t;
876 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
878 #define _TMR1IF 0x01
879 #define _TMR2IF 0x02
880 #define _CCP1IF 0x04
881 #define _SSPIF 0x08
882 #define _TXIF 0x10
883 #define _RCIF 0x20
884 #define _ADIF 0x40
886 //==============================================================================
889 //==============================================================================
890 // IPR1 Bits
892 extern __at(0x0F9F) __sfr IPR1;
894 typedef struct
896 unsigned TMR1IP : 1;
897 unsigned TMR2IP : 1;
898 unsigned CCP1IP : 1;
899 unsigned SSPIP : 1;
900 unsigned TXIP : 1;
901 unsigned RCIP : 1;
902 unsigned ADIP : 1;
903 unsigned : 1;
904 } __IPR1bits_t;
906 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
908 #define _TMR1IP 0x01
909 #define _TMR2IP 0x02
910 #define _CCP1IP 0x04
911 #define _SSPIP 0x08
912 #define _TXIP 0x10
913 #define _RCIP 0x20
914 #define _ADIP 0x40
916 //==============================================================================
919 //==============================================================================
920 // PIE2 Bits
922 extern __at(0x0FA0) __sfr PIE2;
924 typedef union
926 struct
928 unsigned CCP2IE : 1;
929 unsigned TMR3IE : 1;
930 unsigned HLVDIE : 1;
931 unsigned BCLIE : 1;
932 unsigned EEIE : 1;
933 unsigned : 1;
934 unsigned CMIE : 1;
935 unsigned OSCFIE : 1;
938 struct
940 unsigned : 1;
941 unsigned : 1;
942 unsigned LVDIE : 1;
943 unsigned : 1;
944 unsigned : 1;
945 unsigned : 1;
946 unsigned : 1;
947 unsigned : 1;
949 } __PIE2bits_t;
951 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
953 #define _CCP2IE 0x01
954 #define _TMR3IE 0x02
955 #define _HLVDIE 0x04
956 #define _LVDIE 0x04
957 #define _BCLIE 0x08
958 #define _EEIE 0x10
959 #define _CMIE 0x40
960 #define _OSCFIE 0x80
962 //==============================================================================
965 //==============================================================================
966 // PIR2 Bits
968 extern __at(0x0FA1) __sfr PIR2;
970 typedef union
972 struct
974 unsigned CCP2IF : 1;
975 unsigned TMR3IF : 1;
976 unsigned HLVDIF : 1;
977 unsigned BCLIF : 1;
978 unsigned EEIF : 1;
979 unsigned : 1;
980 unsigned CMIF : 1;
981 unsigned OSCFIF : 1;
984 struct
986 unsigned : 1;
987 unsigned : 1;
988 unsigned LVDIF : 1;
989 unsigned : 1;
990 unsigned : 1;
991 unsigned : 1;
992 unsigned : 1;
993 unsigned : 1;
995 } __PIR2bits_t;
997 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
999 #define _CCP2IF 0x01
1000 #define _TMR3IF 0x02
1001 #define _HLVDIF 0x04
1002 #define _LVDIF 0x04
1003 #define _BCLIF 0x08
1004 #define _EEIF 0x10
1005 #define _CMIF 0x40
1006 #define _OSCFIF 0x80
1008 //==============================================================================
1011 //==============================================================================
1012 // IPR2 Bits
1014 extern __at(0x0FA2) __sfr IPR2;
1016 typedef union
1018 struct
1020 unsigned CCP2IP : 1;
1021 unsigned TMR3IP : 1;
1022 unsigned HLVDIP : 1;
1023 unsigned BCLIP : 1;
1024 unsigned EEIP : 1;
1025 unsigned : 1;
1026 unsigned CMIP : 1;
1027 unsigned OSCFIP : 1;
1030 struct
1032 unsigned : 1;
1033 unsigned : 1;
1034 unsigned LVDIP : 1;
1035 unsigned : 1;
1036 unsigned : 1;
1037 unsigned : 1;
1038 unsigned : 1;
1039 unsigned : 1;
1041 } __IPR2bits_t;
1043 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1045 #define _CCP2IP 0x01
1046 #define _TMR3IP 0x02
1047 #define _HLVDIP 0x04
1048 #define _LVDIP 0x04
1049 #define _BCLIP 0x08
1050 #define _EEIP 0x10
1051 #define _CMIP 0x40
1052 #define _OSCFIP 0x80
1054 //==============================================================================
1057 //==============================================================================
1058 // EECON1 Bits
1060 extern __at(0x0FA6) __sfr EECON1;
1062 typedef struct
1064 unsigned RD : 1;
1065 unsigned WR : 1;
1066 unsigned WREN : 1;
1067 unsigned WRERR : 1;
1068 unsigned FREE : 1;
1069 unsigned : 1;
1070 unsigned CFGS : 1;
1071 unsigned EEPGD : 1;
1072 } __EECON1bits_t;
1074 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1076 #define _RD 0x01
1077 #define _WR 0x02
1078 #define _WREN 0x04
1079 #define _WRERR 0x08
1080 #define _FREE 0x10
1081 #define _CFGS 0x40
1082 #define _EEPGD 0x80
1084 //==============================================================================
1086 extern __at(0x0FA7) __sfr EECON2;
1087 extern __at(0x0FA8) __sfr EEDATA;
1088 extern __at(0x0FA9) __sfr EEADR;
1089 extern __at(0x0FAA) __sfr EEADRH;
1091 //==============================================================================
1092 // RCSTA Bits
1094 extern __at(0x0FAB) __sfr RCSTA;
1096 typedef union
1098 struct
1100 unsigned RX9D : 1;
1101 unsigned OERR : 1;
1102 unsigned FERR : 1;
1103 unsigned ADDEN : 1;
1104 unsigned CREN : 1;
1105 unsigned SREN : 1;
1106 unsigned RX9 : 1;
1107 unsigned SPEN : 1;
1110 struct
1112 unsigned : 1;
1113 unsigned : 1;
1114 unsigned : 1;
1115 unsigned ADEN : 1;
1116 unsigned : 1;
1117 unsigned : 1;
1118 unsigned : 1;
1119 unsigned : 1;
1121 } __RCSTAbits_t;
1123 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1125 #define _RX9D 0x01
1126 #define _OERR 0x02
1127 #define _FERR 0x04
1128 #define _ADDEN 0x08
1129 #define _ADEN 0x08
1130 #define _CREN 0x10
1131 #define _SREN 0x20
1132 #define _RX9 0x40
1133 #define _SPEN 0x80
1135 //==============================================================================
1138 //==============================================================================
1139 // TXSTA Bits
1141 extern __at(0x0FAC) __sfr TXSTA;
1143 typedef struct
1145 unsigned TX9D : 1;
1146 unsigned TRMT : 1;
1147 unsigned BRGH : 1;
1148 unsigned SENDB : 1;
1149 unsigned SYNC : 1;
1150 unsigned TXEN : 1;
1151 unsigned TX9 : 1;
1152 unsigned CSRC : 1;
1153 } __TXSTAbits_t;
1155 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1157 #define _TX9D 0x01
1158 #define _TRMT 0x02
1159 #define _BRGH 0x04
1160 #define _SENDB 0x08
1161 #define _SYNC 0x10
1162 #define _TXEN 0x20
1163 #define _TX9 0x40
1164 #define _CSRC 0x80
1166 //==============================================================================
1168 extern __at(0x0FAD) __sfr TXREG;
1169 extern __at(0x0FAE) __sfr RCREG;
1170 extern __at(0x0FAF) __sfr SPBRG;
1171 extern __at(0x0FB0) __sfr SPBRGH;
1173 //==============================================================================
1174 // T3CON Bits
1176 extern __at(0x0FB1) __sfr T3CON;
1178 typedef union
1180 struct
1182 unsigned TMR3ON : 1;
1183 unsigned TMR3CS : 1;
1184 unsigned NOT_T3SYNC : 1;
1185 unsigned T3CCP1 : 1;
1186 unsigned T3CKPS0 : 1;
1187 unsigned T3CKPS1 : 1;
1188 unsigned T3CCP2 : 1;
1189 unsigned RD16 : 1;
1192 struct
1194 unsigned : 1;
1195 unsigned : 1;
1196 unsigned T3SYNC : 1;
1197 unsigned : 1;
1198 unsigned : 1;
1199 unsigned : 1;
1200 unsigned : 1;
1201 unsigned : 1;
1204 struct
1206 unsigned : 4;
1207 unsigned T3CKPS : 2;
1208 unsigned : 2;
1210 } __T3CONbits_t;
1212 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1214 #define _T3CON_TMR3ON 0x01
1215 #define _T3CON_TMR3CS 0x02
1216 #define _T3CON_NOT_T3SYNC 0x04
1217 #define _T3CON_T3SYNC 0x04
1218 #define _T3CON_T3CCP1 0x08
1219 #define _T3CON_T3CKPS0 0x10
1220 #define _T3CON_T3CKPS1 0x20
1221 #define _T3CON_T3CCP2 0x40
1222 #define _T3CON_RD16 0x80
1224 //==============================================================================
1226 extern __at(0x0FB2) __sfr TMR3;
1227 extern __at(0x0FB2) __sfr TMR3L;
1228 extern __at(0x0FB3) __sfr TMR3H;
1230 //==============================================================================
1231 // CMCON Bits
1233 extern __at(0x0FB4) __sfr CMCON;
1235 typedef union
1237 struct
1239 unsigned CM0 : 1;
1240 unsigned CM1 : 1;
1241 unsigned CM2 : 1;
1242 unsigned CIS : 1;
1243 unsigned C1INV : 1;
1244 unsigned C2INV : 1;
1245 unsigned C1OUT : 1;
1246 unsigned C2OUT : 1;
1249 struct
1251 unsigned CM : 3;
1252 unsigned : 5;
1254 } __CMCONbits_t;
1256 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1258 #define _CM0 0x01
1259 #define _CM1 0x02
1260 #define _CM2 0x04
1261 #define _CIS 0x08
1262 #define _C1INV 0x10
1263 #define _C2INV 0x20
1264 #define _C1OUT 0x40
1265 #define _C2OUT 0x80
1267 //==============================================================================
1270 //==============================================================================
1271 // CVRCON Bits
1273 extern __at(0x0FB5) __sfr CVRCON;
1275 typedef union
1277 struct
1279 unsigned CVR0 : 1;
1280 unsigned CVR1 : 1;
1281 unsigned CVR2 : 1;
1282 unsigned CVR3 : 1;
1283 unsigned CVRSS : 1;
1284 unsigned CVRR : 1;
1285 unsigned CVROE : 1;
1286 unsigned CVREN : 1;
1289 struct
1291 unsigned CVR : 4;
1292 unsigned : 4;
1294 } __CVRCONbits_t;
1296 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1298 #define _CVR0 0x01
1299 #define _CVR1 0x02
1300 #define _CVR2 0x04
1301 #define _CVR3 0x08
1302 #define _CVRSS 0x10
1303 #define _CVRR 0x20
1304 #define _CVROE 0x40
1305 #define _CVREN 0x80
1307 //==============================================================================
1310 //==============================================================================
1311 // ECCP1AS Bits
1313 extern __at(0x0FB6) __sfr ECCP1AS;
1315 typedef union
1317 struct
1319 unsigned : 1;
1320 unsigned : 1;
1321 unsigned PSSAC0 : 1;
1322 unsigned PSSAC1 : 1;
1323 unsigned ECCPAS0 : 1;
1324 unsigned ECCPAS1 : 1;
1325 unsigned ECCPAS2 : 1;
1326 unsigned ECCPASE : 1;
1329 struct
1331 unsigned : 2;
1332 unsigned PSSAC : 2;
1333 unsigned : 4;
1336 struct
1338 unsigned : 4;
1339 unsigned ECCPAS : 3;
1340 unsigned : 1;
1342 } __ECCP1ASbits_t;
1344 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1346 #define _PSSAC0 0x04
1347 #define _PSSAC1 0x08
1348 #define _ECCPAS0 0x10
1349 #define _ECCPAS1 0x20
1350 #define _ECCPAS2 0x40
1351 #define _ECCPASE 0x80
1353 //==============================================================================
1356 //==============================================================================
1357 // ECCPAS Bits
1359 extern __at(0x0FB6) __sfr ECCPAS;
1361 typedef union
1363 struct
1365 unsigned : 1;
1366 unsigned : 1;
1367 unsigned PSSAC0 : 1;
1368 unsigned PSSAC1 : 1;
1369 unsigned ECCPAS0 : 1;
1370 unsigned ECCPAS1 : 1;
1371 unsigned ECCPAS2 : 1;
1372 unsigned ECCPASE : 1;
1375 struct
1377 unsigned : 2;
1378 unsigned PSSAC : 2;
1379 unsigned : 4;
1382 struct
1384 unsigned : 4;
1385 unsigned ECCPAS : 3;
1386 unsigned : 1;
1388 } __ECCPASbits_t;
1390 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1392 #define _ECCPAS_PSSAC0 0x04
1393 #define _ECCPAS_PSSAC1 0x08
1394 #define _ECCPAS_ECCPAS0 0x10
1395 #define _ECCPAS_ECCPAS1 0x20
1396 #define _ECCPAS_ECCPAS2 0x40
1397 #define _ECCPAS_ECCPASE 0x80
1399 //==============================================================================
1402 //==============================================================================
1403 // ECCP1DEL Bits
1405 extern __at(0x0FB7) __sfr ECCP1DEL;
1407 typedef struct
1409 unsigned : 1;
1410 unsigned : 1;
1411 unsigned : 1;
1412 unsigned : 1;
1413 unsigned : 1;
1414 unsigned : 1;
1415 unsigned : 1;
1416 unsigned PRSEN : 1;
1417 } __ECCP1DELbits_t;
1419 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits;
1421 #define _PRSEN 0x80
1423 //==============================================================================
1426 //==============================================================================
1427 // PWM1CON Bits
1429 extern __at(0x0FB7) __sfr PWM1CON;
1431 typedef struct
1433 unsigned : 1;
1434 unsigned : 1;
1435 unsigned : 1;
1436 unsigned : 1;
1437 unsigned : 1;
1438 unsigned : 1;
1439 unsigned : 1;
1440 unsigned PRSEN : 1;
1441 } __PWM1CONbits_t;
1443 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1445 #define _PWM1CON_PRSEN 0x80
1447 //==============================================================================
1450 //==============================================================================
1451 // BAUDCON Bits
1453 extern __at(0x0FB8) __sfr BAUDCON;
1455 typedef union
1457 struct
1459 unsigned ABDEN : 1;
1460 unsigned WUE : 1;
1461 unsigned : 1;
1462 unsigned BRG16 : 1;
1463 unsigned TXCKP : 1;
1464 unsigned RXDTP : 1;
1465 unsigned RCIDL : 1;
1466 unsigned ABDOVF : 1;
1469 struct
1471 unsigned : 1;
1472 unsigned : 1;
1473 unsigned : 1;
1474 unsigned : 1;
1475 unsigned SCKP : 1;
1476 unsigned RXCKP : 1;
1477 unsigned RCMT : 1;
1478 unsigned : 1;
1480 } __BAUDCONbits_t;
1482 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1484 #define _ABDEN 0x01
1485 #define _WUE 0x02
1486 #define _BRG16 0x08
1487 #define _TXCKP 0x10
1488 #define _SCKP 0x10
1489 #define _RXDTP 0x20
1490 #define _RXCKP 0x20
1491 #define _RCIDL 0x40
1492 #define _RCMT 0x40
1493 #define _ABDOVF 0x80
1495 //==============================================================================
1498 //==============================================================================
1499 // BAUDCTL Bits
1501 extern __at(0x0FB8) __sfr BAUDCTL;
1503 typedef union
1505 struct
1507 unsigned ABDEN : 1;
1508 unsigned WUE : 1;
1509 unsigned : 1;
1510 unsigned BRG16 : 1;
1511 unsigned TXCKP : 1;
1512 unsigned RXDTP : 1;
1513 unsigned RCIDL : 1;
1514 unsigned ABDOVF : 1;
1517 struct
1519 unsigned : 1;
1520 unsigned : 1;
1521 unsigned : 1;
1522 unsigned : 1;
1523 unsigned SCKP : 1;
1524 unsigned RXCKP : 1;
1525 unsigned RCMT : 1;
1526 unsigned : 1;
1528 } __BAUDCTLbits_t;
1530 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1532 #define _BAUDCTL_ABDEN 0x01
1533 #define _BAUDCTL_WUE 0x02
1534 #define _BAUDCTL_BRG16 0x08
1535 #define _BAUDCTL_TXCKP 0x10
1536 #define _BAUDCTL_SCKP 0x10
1537 #define _BAUDCTL_RXDTP 0x20
1538 #define _BAUDCTL_RXCKP 0x20
1539 #define _BAUDCTL_RCIDL 0x40
1540 #define _BAUDCTL_RCMT 0x40
1541 #define _BAUDCTL_ABDOVF 0x80
1543 //==============================================================================
1546 //==============================================================================
1547 // CCP2CON Bits
1549 extern __at(0x0FBA) __sfr CCP2CON;
1551 typedef union
1553 struct
1555 unsigned CCP2M0 : 1;
1556 unsigned CCP2M1 : 1;
1557 unsigned CCP2M2 : 1;
1558 unsigned CCP2M3 : 1;
1559 unsigned CCP2Y : 1;
1560 unsigned CCP2X : 1;
1561 unsigned : 1;
1562 unsigned : 1;
1565 struct
1567 unsigned : 1;
1568 unsigned : 1;
1569 unsigned : 1;
1570 unsigned : 1;
1571 unsigned DC2B0 : 1;
1572 unsigned DC2B1 : 1;
1573 unsigned : 1;
1574 unsigned : 1;
1577 struct
1579 unsigned CCP2M : 4;
1580 unsigned : 4;
1583 struct
1585 unsigned : 4;
1586 unsigned DC2B : 2;
1587 unsigned : 2;
1589 } __CCP2CONbits_t;
1591 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1593 #define _CCP2M0 0x01
1594 #define _CCP2M1 0x02
1595 #define _CCP2M2 0x04
1596 #define _CCP2M3 0x08
1597 #define _CCP2Y 0x10
1598 #define _DC2B0 0x10
1599 #define _CCP2X 0x20
1600 #define _DC2B1 0x20
1602 //==============================================================================
1604 extern __at(0x0FBB) __sfr CCPR2;
1605 extern __at(0x0FBB) __sfr CCPR2L;
1606 extern __at(0x0FBC) __sfr CCPR2H;
1608 //==============================================================================
1609 // CCP1CON Bits
1611 extern __at(0x0FBD) __sfr CCP1CON;
1613 typedef union
1615 struct
1617 unsigned CCP1M0 : 1;
1618 unsigned CCP1M1 : 1;
1619 unsigned CCP1M2 : 1;
1620 unsigned CCP1M3 : 1;
1621 unsigned CCP1Y : 1;
1622 unsigned CCP1X : 1;
1623 unsigned : 1;
1624 unsigned : 1;
1627 struct
1629 unsigned : 1;
1630 unsigned : 1;
1631 unsigned : 1;
1632 unsigned : 1;
1633 unsigned DC1B0 : 1;
1634 unsigned DC1B1 : 1;
1635 unsigned : 1;
1636 unsigned : 1;
1639 struct
1641 unsigned CCP1M : 4;
1642 unsigned : 4;
1645 struct
1647 unsigned : 4;
1648 unsigned DC1B : 2;
1649 unsigned : 2;
1651 } __CCP1CONbits_t;
1653 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1655 #define _CCP1M0 0x01
1656 #define _CCP1M1 0x02
1657 #define _CCP1M2 0x04
1658 #define _CCP1M3 0x08
1659 #define _CCP1Y 0x10
1660 #define _DC1B0 0x10
1661 #define _CCP1X 0x20
1662 #define _DC1B1 0x20
1664 //==============================================================================
1666 extern __at(0x0FBE) __sfr CCPR1;
1667 extern __at(0x0FBE) __sfr CCPR1L;
1668 extern __at(0x0FBF) __sfr CCPR1H;
1670 //==============================================================================
1671 // ADCON2 Bits
1673 extern __at(0x0FC0) __sfr ADCON2;
1675 typedef union
1677 struct
1679 unsigned ADCS0 : 1;
1680 unsigned ADCS1 : 1;
1681 unsigned ADCS2 : 1;
1682 unsigned ACQT0 : 1;
1683 unsigned ACQT1 : 1;
1684 unsigned ACQT2 : 1;
1685 unsigned : 1;
1686 unsigned ADFM : 1;
1689 struct
1691 unsigned ADCS : 3;
1692 unsigned : 5;
1695 struct
1697 unsigned : 3;
1698 unsigned ACQT : 3;
1699 unsigned : 2;
1701 } __ADCON2bits_t;
1703 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1705 #define _ADCS0 0x01
1706 #define _ADCS1 0x02
1707 #define _ADCS2 0x04
1708 #define _ACQT0 0x08
1709 #define _ACQT1 0x10
1710 #define _ACQT2 0x20
1711 #define _ADFM 0x80
1713 //==============================================================================
1716 //==============================================================================
1717 // ADCON1 Bits
1719 extern __at(0x0FC1) __sfr ADCON1;
1721 typedef union
1723 struct
1725 unsigned PCFG0 : 1;
1726 unsigned PCFG1 : 1;
1727 unsigned PCFG2 : 1;
1728 unsigned PCFG3 : 1;
1729 unsigned VCFG0 : 1;
1730 unsigned VCFG1 : 1;
1731 unsigned : 1;
1732 unsigned : 1;
1735 struct
1737 unsigned PCFG : 4;
1738 unsigned : 4;
1741 struct
1743 unsigned : 4;
1744 unsigned VCFG : 2;
1745 unsigned : 2;
1747 } __ADCON1bits_t;
1749 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1751 #define _PCFG0 0x01
1752 #define _PCFG1 0x02
1753 #define _PCFG2 0x04
1754 #define _PCFG3 0x08
1755 #define _VCFG0 0x10
1756 #define _VCFG1 0x20
1758 //==============================================================================
1761 //==============================================================================
1762 // ADCON0 Bits
1764 extern __at(0x0FC2) __sfr ADCON0;
1766 typedef union
1768 struct
1770 unsigned ADON : 1;
1771 unsigned GO_NOT_DONE : 1;
1772 unsigned CHS0 : 1;
1773 unsigned CHS1 : 1;
1774 unsigned CHS2 : 1;
1775 unsigned CHS3 : 1;
1776 unsigned : 1;
1777 unsigned : 1;
1780 struct
1782 unsigned : 1;
1783 unsigned GO : 1;
1784 unsigned : 1;
1785 unsigned : 1;
1786 unsigned : 1;
1787 unsigned : 1;
1788 unsigned : 1;
1789 unsigned : 1;
1792 struct
1794 unsigned : 1;
1795 unsigned DONE : 1;
1796 unsigned : 1;
1797 unsigned : 1;
1798 unsigned : 1;
1799 unsigned : 1;
1800 unsigned : 1;
1801 unsigned : 1;
1804 struct
1806 unsigned : 1;
1807 unsigned NOT_DONE : 1;
1808 unsigned : 1;
1809 unsigned : 1;
1810 unsigned : 1;
1811 unsigned : 1;
1812 unsigned : 1;
1813 unsigned : 1;
1816 struct
1818 unsigned : 1;
1819 unsigned GO_DONE : 1;
1820 unsigned : 1;
1821 unsigned : 1;
1822 unsigned : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1825 unsigned : 1;
1828 struct
1830 unsigned : 2;
1831 unsigned CHS : 4;
1832 unsigned : 2;
1834 } __ADCON0bits_t;
1836 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1838 #define _ADON 0x01
1839 #define _GO_NOT_DONE 0x02
1840 #define _GO 0x02
1841 #define _DONE 0x02
1842 #define _NOT_DONE 0x02
1843 #define _GO_DONE 0x02
1844 #define _CHS0 0x04
1845 #define _CHS1 0x08
1846 #define _CHS2 0x10
1847 #define _CHS3 0x20
1849 //==============================================================================
1851 extern __at(0x0FC3) __sfr ADRES;
1852 extern __at(0x0FC3) __sfr ADRESL;
1853 extern __at(0x0FC4) __sfr ADRESH;
1855 //==============================================================================
1856 // SSPCON2 Bits
1858 extern __at(0x0FC5) __sfr SSPCON2;
1860 typedef struct
1862 unsigned SEN : 1;
1863 unsigned RSEN : 1;
1864 unsigned PEN : 1;
1865 unsigned RCEN : 1;
1866 unsigned ACKEN : 1;
1867 unsigned ACKDT : 1;
1868 unsigned ACKSTAT : 1;
1869 unsigned GCEN : 1;
1870 } __SSPCON2bits_t;
1872 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1874 #define _SEN 0x01
1875 #define _RSEN 0x02
1876 #define _PEN 0x04
1877 #define _RCEN 0x08
1878 #define _ACKEN 0x10
1879 #define _ACKDT 0x20
1880 #define _ACKSTAT 0x40
1881 #define _GCEN 0x80
1883 //==============================================================================
1886 //==============================================================================
1887 // SSPCON1 Bits
1889 extern __at(0x0FC6) __sfr SSPCON1;
1891 typedef union
1893 struct
1895 unsigned SSPM0 : 1;
1896 unsigned SSPM1 : 1;
1897 unsigned SSPM2 : 1;
1898 unsigned SSPM3 : 1;
1899 unsigned CKP : 1;
1900 unsigned SSPEN : 1;
1901 unsigned SSPOV : 1;
1902 unsigned WCOL : 1;
1905 struct
1907 unsigned SSPM : 4;
1908 unsigned : 4;
1910 } __SSPCON1bits_t;
1912 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1914 #define _SSPM0 0x01
1915 #define _SSPM1 0x02
1916 #define _SSPM2 0x04
1917 #define _SSPM3 0x08
1918 #define _CKP 0x10
1919 #define _SSPEN 0x20
1920 #define _SSPOV 0x40
1921 #define _WCOL 0x80
1923 //==============================================================================
1926 //==============================================================================
1927 // SSPSTAT Bits
1929 extern __at(0x0FC7) __sfr SSPSTAT;
1931 typedef union
1933 struct
1935 unsigned BF : 1;
1936 unsigned UA : 1;
1937 unsigned R_NOT_W : 1;
1938 unsigned S : 1;
1939 unsigned P : 1;
1940 unsigned D_NOT_A : 1;
1941 unsigned CKE : 1;
1942 unsigned SMP : 1;
1945 struct
1947 unsigned : 1;
1948 unsigned : 1;
1949 unsigned R : 1;
1950 unsigned : 1;
1951 unsigned : 1;
1952 unsigned D : 1;
1953 unsigned : 1;
1954 unsigned : 1;
1957 struct
1959 unsigned : 1;
1960 unsigned : 1;
1961 unsigned NOT_W : 1;
1962 unsigned : 1;
1963 unsigned : 1;
1964 unsigned NOT_A : 1;
1965 unsigned : 1;
1966 unsigned : 1;
1969 struct
1971 unsigned : 1;
1972 unsigned : 1;
1973 unsigned R_W : 1;
1974 unsigned : 1;
1975 unsigned : 1;
1976 unsigned D_A : 1;
1977 unsigned : 1;
1978 unsigned : 1;
1981 struct
1983 unsigned : 1;
1984 unsigned : 1;
1985 unsigned NOT_WRITE : 1;
1986 unsigned : 1;
1987 unsigned : 1;
1988 unsigned NOT_ADDRESS : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1992 } __SSPSTATbits_t;
1994 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1996 #define _BF 0x01
1997 #define _UA 0x02
1998 #define _R_NOT_W 0x04
1999 #define _R 0x04
2000 #define _NOT_W 0x04
2001 #define _R_W 0x04
2002 #define _NOT_WRITE 0x04
2003 #define _S 0x08
2004 #define _P 0x10
2005 #define _D_NOT_A 0x20
2006 #define _D 0x20
2007 #define _NOT_A 0x20
2008 #define _D_A 0x20
2009 #define _NOT_ADDRESS 0x20
2010 #define _CKE 0x40
2011 #define _SMP 0x80
2013 //==============================================================================
2015 extern __at(0x0FC8) __sfr SSPADD;
2016 extern __at(0x0FC9) __sfr SSPBUF;
2018 //==============================================================================
2019 // T2CON Bits
2021 extern __at(0x0FCA) __sfr T2CON;
2023 typedef union
2025 struct
2027 unsigned T2CKPS0 : 1;
2028 unsigned T2CKPS1 : 1;
2029 unsigned TMR2ON : 1;
2030 unsigned T2OUTPS0 : 1;
2031 unsigned T2OUTPS1 : 1;
2032 unsigned T2OUTPS2 : 1;
2033 unsigned T2OUTPS3 : 1;
2034 unsigned : 1;
2037 struct
2039 unsigned T2CKPS : 2;
2040 unsigned : 6;
2043 struct
2045 unsigned : 3;
2046 unsigned T2OUTPS : 4;
2047 unsigned : 1;
2049 } __T2CONbits_t;
2051 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2053 #define _T2CKPS0 0x01
2054 #define _T2CKPS1 0x02
2055 #define _TMR2ON 0x04
2056 #define _T2OUTPS0 0x08
2057 #define _T2OUTPS1 0x10
2058 #define _T2OUTPS2 0x20
2059 #define _T2OUTPS3 0x40
2061 //==============================================================================
2063 extern __at(0x0FCB) __sfr PR2;
2064 extern __at(0x0FCC) __sfr TMR2;
2066 //==============================================================================
2067 // T1CON Bits
2069 extern __at(0x0FCD) __sfr T1CON;
2071 typedef union
2073 struct
2075 unsigned TMR1ON : 1;
2076 unsigned TMR1CS : 1;
2077 unsigned NOT_T1SYNC : 1;
2078 unsigned T1OSCEN : 1;
2079 unsigned T1CKPS0 : 1;
2080 unsigned T1CKPS1 : 1;
2081 unsigned T1RUN : 1;
2082 unsigned RD16 : 1;
2085 struct
2087 unsigned : 1;
2088 unsigned : 1;
2089 unsigned T1SYNC : 1;
2090 unsigned : 1;
2091 unsigned : 1;
2092 unsigned : 1;
2093 unsigned : 1;
2094 unsigned : 1;
2097 struct
2099 unsigned : 4;
2100 unsigned T1CKPS : 2;
2101 unsigned : 2;
2103 } __T1CONbits_t;
2105 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2107 #define _TMR1ON 0x01
2108 #define _TMR1CS 0x02
2109 #define _NOT_T1SYNC 0x04
2110 #define _T1SYNC 0x04
2111 #define _T1OSCEN 0x08
2112 #define _T1CKPS0 0x10
2113 #define _T1CKPS1 0x20
2114 #define _T1RUN 0x40
2115 #define _RD16 0x80
2117 //==============================================================================
2119 extern __at(0x0FCE) __sfr TMR1;
2120 extern __at(0x0FCE) __sfr TMR1L;
2121 extern __at(0x0FCF) __sfr TMR1H;
2123 //==============================================================================
2124 // RCON Bits
2126 extern __at(0x0FD0) __sfr RCON;
2128 typedef union
2130 struct
2132 unsigned NOT_BOR : 1;
2133 unsigned NOT_POR : 1;
2134 unsigned NOT_PD : 1;
2135 unsigned NOT_TO : 1;
2136 unsigned NOT_RI : 1;
2137 unsigned : 1;
2138 unsigned SBOREN : 1;
2139 unsigned IPEN : 1;
2142 struct
2144 unsigned BOR : 1;
2145 unsigned POR : 1;
2146 unsigned PD : 1;
2147 unsigned TO : 1;
2148 unsigned RI : 1;
2149 unsigned : 1;
2150 unsigned : 1;
2151 unsigned : 1;
2153 } __RCONbits_t;
2155 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2157 #define _NOT_BOR 0x01
2158 #define _BOR 0x01
2159 #define _NOT_POR 0x02
2160 #define _POR 0x02
2161 #define _NOT_PD 0x04
2162 #define _PD 0x04
2163 #define _NOT_TO 0x08
2164 #define _TO 0x08
2165 #define _NOT_RI 0x10
2166 #define _RI 0x10
2167 #define _SBOREN 0x40
2168 #define _IPEN 0x80
2170 //==============================================================================
2173 //==============================================================================
2174 // WDTCON Bits
2176 extern __at(0x0FD1) __sfr WDTCON;
2178 typedef union
2180 struct
2182 unsigned SWDTEN : 1;
2183 unsigned : 1;
2184 unsigned : 1;
2185 unsigned : 1;
2186 unsigned : 1;
2187 unsigned : 1;
2188 unsigned : 1;
2189 unsigned : 1;
2192 struct
2194 unsigned SWDTE : 1;
2195 unsigned : 1;
2196 unsigned : 1;
2197 unsigned : 1;
2198 unsigned : 1;
2199 unsigned : 1;
2200 unsigned : 1;
2201 unsigned : 1;
2203 } __WDTCONbits_t;
2205 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2207 #define _SWDTEN 0x01
2208 #define _SWDTE 0x01
2210 //==============================================================================
2213 //==============================================================================
2214 // HLVDCON Bits
2216 extern __at(0x0FD2) __sfr HLVDCON;
2218 typedef union
2220 struct
2222 unsigned HLVDL0 : 1;
2223 unsigned HLVDL1 : 1;
2224 unsigned HLVDL2 : 1;
2225 unsigned HLVDL3 : 1;
2226 unsigned HLVDEN : 1;
2227 unsigned IVRST : 1;
2228 unsigned : 1;
2229 unsigned VDIRMAG : 1;
2232 struct
2234 unsigned LVDL0 : 1;
2235 unsigned LVDL1 : 1;
2236 unsigned LVDL2 : 1;
2237 unsigned LVDL3 : 1;
2238 unsigned LVDEN : 1;
2239 unsigned IRVST : 1;
2240 unsigned : 1;
2241 unsigned : 1;
2244 struct
2246 unsigned LVV0 : 1;
2247 unsigned LVV1 : 1;
2248 unsigned LVV2 : 1;
2249 unsigned LVV3 : 1;
2250 unsigned : 1;
2251 unsigned BGST : 1;
2252 unsigned : 1;
2253 unsigned : 1;
2256 struct
2258 unsigned LVDL : 4;
2259 unsigned : 4;
2262 struct
2264 unsigned HLVDL : 4;
2265 unsigned : 4;
2268 struct
2270 unsigned LVV : 4;
2271 unsigned : 4;
2273 } __HLVDCONbits_t;
2275 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2277 #define _HLVDL0 0x01
2278 #define _LVDL0 0x01
2279 #define _LVV0 0x01
2280 #define _HLVDL1 0x02
2281 #define _LVDL1 0x02
2282 #define _LVV1 0x02
2283 #define _HLVDL2 0x04
2284 #define _LVDL2 0x04
2285 #define _LVV2 0x04
2286 #define _HLVDL3 0x08
2287 #define _LVDL3 0x08
2288 #define _LVV3 0x08
2289 #define _HLVDEN 0x10
2290 #define _LVDEN 0x10
2291 #define _IVRST 0x20
2292 #define _IRVST 0x20
2293 #define _BGST 0x20
2294 #define _VDIRMAG 0x80
2296 //==============================================================================
2299 //==============================================================================
2300 // LVDCON Bits
2302 extern __at(0x0FD2) __sfr LVDCON;
2304 typedef union
2306 struct
2308 unsigned HLVDL0 : 1;
2309 unsigned HLVDL1 : 1;
2310 unsigned HLVDL2 : 1;
2311 unsigned HLVDL3 : 1;
2312 unsigned HLVDEN : 1;
2313 unsigned IVRST : 1;
2314 unsigned : 1;
2315 unsigned VDIRMAG : 1;
2318 struct
2320 unsigned LVDL0 : 1;
2321 unsigned LVDL1 : 1;
2322 unsigned LVDL2 : 1;
2323 unsigned LVDL3 : 1;
2324 unsigned LVDEN : 1;
2325 unsigned IRVST : 1;
2326 unsigned : 1;
2327 unsigned : 1;
2330 struct
2332 unsigned LVV0 : 1;
2333 unsigned LVV1 : 1;
2334 unsigned LVV2 : 1;
2335 unsigned LVV3 : 1;
2336 unsigned : 1;
2337 unsigned BGST : 1;
2338 unsigned : 1;
2339 unsigned : 1;
2342 struct
2344 unsigned LVDL : 4;
2345 unsigned : 4;
2348 struct
2350 unsigned LVV : 4;
2351 unsigned : 4;
2354 struct
2356 unsigned HLVDL : 4;
2357 unsigned : 4;
2359 } __LVDCONbits_t;
2361 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2363 #define _LVDCON_HLVDL0 0x01
2364 #define _LVDCON_LVDL0 0x01
2365 #define _LVDCON_LVV0 0x01
2366 #define _LVDCON_HLVDL1 0x02
2367 #define _LVDCON_LVDL1 0x02
2368 #define _LVDCON_LVV1 0x02
2369 #define _LVDCON_HLVDL2 0x04
2370 #define _LVDCON_LVDL2 0x04
2371 #define _LVDCON_LVV2 0x04
2372 #define _LVDCON_HLVDL3 0x08
2373 #define _LVDCON_LVDL3 0x08
2374 #define _LVDCON_LVV3 0x08
2375 #define _LVDCON_HLVDEN 0x10
2376 #define _LVDCON_LVDEN 0x10
2377 #define _LVDCON_IVRST 0x20
2378 #define _LVDCON_IRVST 0x20
2379 #define _LVDCON_BGST 0x20
2380 #define _LVDCON_VDIRMAG 0x80
2382 //==============================================================================
2385 //==============================================================================
2386 // OSCCON Bits
2388 extern __at(0x0FD3) __sfr OSCCON;
2390 typedef union
2392 struct
2394 unsigned SCS0 : 1;
2395 unsigned SCS1 : 1;
2396 unsigned IOFS : 1;
2397 unsigned OSTS : 1;
2398 unsigned IRCF0 : 1;
2399 unsigned IRCF1 : 1;
2400 unsigned IRCF2 : 1;
2401 unsigned IDLEN : 1;
2404 struct
2406 unsigned SCS : 2;
2407 unsigned : 6;
2410 struct
2412 unsigned : 4;
2413 unsigned IRCF : 3;
2414 unsigned : 1;
2416 } __OSCCONbits_t;
2418 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2420 #define _SCS0 0x01
2421 #define _SCS1 0x02
2422 #define _IOFS 0x04
2423 #define _OSTS 0x08
2424 #define _IRCF0 0x10
2425 #define _IRCF1 0x20
2426 #define _IRCF2 0x40
2427 #define _IDLEN 0x80
2429 //==============================================================================
2432 //==============================================================================
2433 // T0CON Bits
2435 extern __at(0x0FD5) __sfr T0CON;
2437 typedef union
2439 struct
2441 unsigned T0PS0 : 1;
2442 unsigned T0PS1 : 1;
2443 unsigned T0PS2 : 1;
2444 unsigned PSA : 1;
2445 unsigned T0SE : 1;
2446 unsigned T0CS : 1;
2447 unsigned T08BIT : 1;
2448 unsigned TMR0ON : 1;
2451 struct
2453 unsigned : 1;
2454 unsigned : 1;
2455 unsigned : 1;
2456 unsigned : 1;
2457 unsigned : 1;
2458 unsigned : 1;
2459 unsigned T016BIT : 1;
2460 unsigned : 1;
2463 struct
2465 unsigned T0PS : 3;
2466 unsigned : 5;
2468 } __T0CONbits_t;
2470 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2472 #define _T0PS0 0x01
2473 #define _T0PS1 0x02
2474 #define _T0PS2 0x04
2475 #define _PSA 0x08
2476 #define _T0SE 0x10
2477 #define _T0CS 0x20
2478 #define _T08BIT 0x40
2479 #define _T016BIT 0x40
2480 #define _TMR0ON 0x80
2482 //==============================================================================
2484 extern __at(0x0FD6) __sfr TMR0;
2485 extern __at(0x0FD6) __sfr TMR0L;
2486 extern __at(0x0FD7) __sfr TMR0H;
2488 //==============================================================================
2489 // STATUS Bits
2491 extern __at(0x0FD8) __sfr STATUS;
2493 typedef struct
2495 unsigned C : 1;
2496 unsigned DC : 1;
2497 unsigned Z : 1;
2498 unsigned OV : 1;
2499 unsigned N : 1;
2500 unsigned : 1;
2501 unsigned : 1;
2502 unsigned : 1;
2503 } __STATUSbits_t;
2505 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2507 #define _C 0x01
2508 #define _DC 0x02
2509 #define _Z 0x04
2510 #define _OV 0x08
2511 #define _N 0x10
2513 //==============================================================================
2515 extern __at(0x0FD9) __sfr FSR2L;
2516 extern __at(0x0FDA) __sfr FSR2H;
2517 extern __at(0x0FDB) __sfr PLUSW2;
2518 extern __at(0x0FDC) __sfr PREINC2;
2519 extern __at(0x0FDD) __sfr POSTDEC2;
2520 extern __at(0x0FDE) __sfr POSTINC2;
2521 extern __at(0x0FDF) __sfr INDF2;
2522 extern __at(0x0FE0) __sfr BSR;
2523 extern __at(0x0FE1) __sfr FSR1L;
2524 extern __at(0x0FE2) __sfr FSR1H;
2525 extern __at(0x0FE3) __sfr PLUSW1;
2526 extern __at(0x0FE4) __sfr PREINC1;
2527 extern __at(0x0FE5) __sfr POSTDEC1;
2528 extern __at(0x0FE6) __sfr POSTINC1;
2529 extern __at(0x0FE7) __sfr INDF1;
2530 extern __at(0x0FE8) __sfr WREG;
2531 extern __at(0x0FE9) __sfr FSR0L;
2532 extern __at(0x0FEA) __sfr FSR0H;
2533 extern __at(0x0FEB) __sfr PLUSW0;
2534 extern __at(0x0FEC) __sfr PREINC0;
2535 extern __at(0x0FED) __sfr POSTDEC0;
2536 extern __at(0x0FEE) __sfr POSTINC0;
2537 extern __at(0x0FEF) __sfr INDF0;
2539 //==============================================================================
2540 // INTCON3 Bits
2542 extern __at(0x0FF0) __sfr INTCON3;
2544 typedef union
2546 struct
2548 unsigned INT1IF : 1;
2549 unsigned INT2IF : 1;
2550 unsigned : 1;
2551 unsigned INT1IE : 1;
2552 unsigned INT2IE : 1;
2553 unsigned : 1;
2554 unsigned INT1IP : 1;
2555 unsigned INT2IP : 1;
2558 struct
2560 unsigned INT1F : 1;
2561 unsigned INT2F : 1;
2562 unsigned : 1;
2563 unsigned INT1E : 1;
2564 unsigned INT2E : 1;
2565 unsigned : 1;
2566 unsigned INT1P : 1;
2567 unsigned INT2P : 1;
2569 } __INTCON3bits_t;
2571 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2573 #define _INT1IF 0x01
2574 #define _INT1F 0x01
2575 #define _INT2IF 0x02
2576 #define _INT2F 0x02
2577 #define _INT1IE 0x08
2578 #define _INT1E 0x08
2579 #define _INT2IE 0x10
2580 #define _INT2E 0x10
2581 #define _INT1IP 0x40
2582 #define _INT1P 0x40
2583 #define _INT2IP 0x80
2584 #define _INT2P 0x80
2586 //==============================================================================
2589 //==============================================================================
2590 // INTCON2 Bits
2592 extern __at(0x0FF1) __sfr INTCON2;
2594 typedef union
2596 struct
2598 unsigned RBIP : 1;
2599 unsigned : 1;
2600 unsigned TMR0IP : 1;
2601 unsigned : 1;
2602 unsigned INTEDG2 : 1;
2603 unsigned INTEDG1 : 1;
2604 unsigned INTEDG0 : 1;
2605 unsigned NOT_RBPU : 1;
2608 struct
2610 unsigned : 1;
2611 unsigned : 1;
2612 unsigned : 1;
2613 unsigned : 1;
2614 unsigned : 1;
2615 unsigned : 1;
2616 unsigned : 1;
2617 unsigned RBPU : 1;
2619 } __INTCON2bits_t;
2621 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2623 #define _RBIP 0x01
2624 #define _TMR0IP 0x04
2625 #define _INTEDG2 0x10
2626 #define _INTEDG1 0x20
2627 #define _INTEDG0 0x40
2628 #define _NOT_RBPU 0x80
2629 #define _RBPU 0x80
2631 //==============================================================================
2634 //==============================================================================
2635 // INTCON Bits
2637 extern __at(0x0FF2) __sfr INTCON;
2639 typedef union
2641 struct
2643 unsigned RBIF : 1;
2644 unsigned INT0IF : 1;
2645 unsigned TMR0IF : 1;
2646 unsigned RBIE : 1;
2647 unsigned INT0IE : 1;
2648 unsigned TMR0IE : 1;
2649 unsigned PEIE_GIEL : 1;
2650 unsigned GIE_GIEH : 1;
2653 struct
2655 unsigned : 1;
2656 unsigned INT0F : 1;
2657 unsigned T0IF : 1;
2658 unsigned : 1;
2659 unsigned INT0E : 1;
2660 unsigned T0IE : 1;
2661 unsigned PEIE : 1;
2662 unsigned GIE : 1;
2665 struct
2667 unsigned : 1;
2668 unsigned : 1;
2669 unsigned : 1;
2670 unsigned : 1;
2671 unsigned : 1;
2672 unsigned : 1;
2673 unsigned GIEL : 1;
2674 unsigned GIEH : 1;
2676 } __INTCONbits_t;
2678 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2680 #define _RBIF 0x01
2681 #define _INT0IF 0x02
2682 #define _INT0F 0x02
2683 #define _TMR0IF 0x04
2684 #define _T0IF 0x04
2685 #define _RBIE 0x08
2686 #define _INT0IE 0x10
2687 #define _INT0E 0x10
2688 #define _TMR0IE 0x20
2689 #define _T0IE 0x20
2690 #define _PEIE_GIEL 0x40
2691 #define _PEIE 0x40
2692 #define _GIEL 0x40
2693 #define _GIE_GIEH 0x80
2694 #define _GIE 0x80
2695 #define _GIEH 0x80
2697 //==============================================================================
2699 extern __at(0x0FF3) __sfr PROD;
2700 extern __at(0x0FF3) __sfr PRODL;
2701 extern __at(0x0FF4) __sfr PRODH;
2702 extern __at(0x0FF5) __sfr TABLAT;
2703 extern __at(0x0FF6) __sfr TBLPTR;
2704 extern __at(0x0FF6) __sfr TBLPTRL;
2705 extern __at(0x0FF7) __sfr TBLPTRH;
2706 extern __at(0x0FF8) __sfr TBLPTRU;
2707 extern __at(0x0FF9) __sfr PC;
2708 extern __at(0x0FF9) __sfr PCL;
2709 extern __at(0x0FFA) __sfr PCLATH;
2710 extern __at(0x0FFB) __sfr PCLATU;
2712 //==============================================================================
2713 // STKPTR Bits
2715 extern __at(0x0FFC) __sfr STKPTR;
2717 typedef union
2719 struct
2721 unsigned STKPTR0 : 1;
2722 unsigned STKPTR1 : 1;
2723 unsigned STKPTR2 : 1;
2724 unsigned STKPTR3 : 1;
2725 unsigned STKPTR4 : 1;
2726 unsigned : 1;
2727 unsigned STKUNF : 1;
2728 unsigned STKFUL : 1;
2731 struct
2733 unsigned SP0 : 1;
2734 unsigned SP1 : 1;
2735 unsigned SP2 : 1;
2736 unsigned SP3 : 1;
2737 unsigned SP4 : 1;
2738 unsigned : 1;
2739 unsigned : 1;
2740 unsigned STKOVF : 1;
2743 struct
2745 unsigned STKPTR : 5;
2746 unsigned : 3;
2749 struct
2751 unsigned SP : 5;
2752 unsigned : 3;
2754 } __STKPTRbits_t;
2756 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2758 #define _STKPTR0 0x01
2759 #define _SP0 0x01
2760 #define _STKPTR1 0x02
2761 #define _SP1 0x02
2762 #define _STKPTR2 0x04
2763 #define _SP2 0x04
2764 #define _STKPTR3 0x08
2765 #define _SP3 0x08
2766 #define _STKPTR4 0x10
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, CLKOUT 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, CLKOUT 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-003FFFh) code-protected.
2873 #define _CP0_OFF_5L 0xFF // Block 0 (000800-003FFFh) not code-protected.
2874 #define _CP1_ON_5L 0xFD // Block 1 (004000-007FFFh) code-protected.
2875 #define _CP1_OFF_5L 0xFF // Block 1 (004000-007FFFh) not code-protected.
2876 #define _CP2_ON_5L 0xFB // Block 2 (008000-00BFFFh) code-protected.
2877 #define _CP2_OFF_5L 0xFF // Block 2 (008000-00BFFFh) not code-protected.
2878 #define _CP3_ON_5L 0xF7 // Block 3 (00C000-00FFFFh) code-protected.
2879 #define _CP3_OFF_5L 0xFF // Block 3 (00C000-00FFFFh) 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.
2885 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
2886 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
2888 //----------------------------- CONFIG6L Options -------------------------------
2890 #define _WRT0_ON_6L 0xFE // Block 0 (000800-003FFFh) write-protected.
2891 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-003FFFh) not write-protected.
2892 #define _WRT1_ON_6L 0xFD // Block 1 (004000-007FFFh) write-protected.
2893 #define _WRT1_OFF_6L 0xFF // Block 1 (004000-007FFFh) not write-protected.
2894 #define _WRT2_ON_6L 0xFB // Block 2 (008000-00BFFFh) write-protected.
2895 #define _WRT2_OFF_6L 0xFF // Block 2 (008000-00BFFFh) not write-protected.
2896 #define _WRT3_ON_6L 0xF7 // Block 3 (00C000-00FFFFh) write-protected.
2897 #define _WRT3_OFF_6L 0xFF // Block 3 (00C000-00FFFFh) not write-protected.
2899 //----------------------------- CONFIG6H Options -------------------------------
2901 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
2902 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
2903 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0007FFh) write-protected.
2904 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0007FFh) not write-protected.
2905 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
2906 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
2908 //----------------------------- CONFIG7L Options -------------------------------
2910 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-003FFFh) protected from table reads executed in other blocks.
2911 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-003FFFh) not protected from table reads executed in other blocks.
2912 #define _EBTR1_ON_7L 0xFD // Block 1 (004000-007FFFh) protected from table reads executed in other blocks.
2913 #define _EBTR1_OFF_7L 0xFF // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks.
2914 #define _EBTR2_ON_7L 0xFB // Block 2 (008000-00BFFFh) protected from table reads executed in other blocks.
2915 #define _EBTR2_OFF_7L 0xFF // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks.
2916 #define _EBTR3_ON_7L 0xF7 // Block 3 (00C000-00FFFFh) protected from table reads executed in other blocks.
2917 #define _EBTR3_OFF_7L 0xFF // Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks.
2919 //----------------------------- CONFIG7H Options -------------------------------
2921 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0007FFh) protected from table reads executed in other blocks.
2922 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks.
2924 //==============================================================================
2926 #define __DEVID1 0x3FFFFE
2927 #define __DEVID2 0x3FFFFF
2929 #define __IDLOC0 0x200000
2930 #define __IDLOC1 0x200001
2931 #define __IDLOC2 0x200002
2932 #define __IDLOC3 0x200003
2933 #define __IDLOC4 0x200004
2934 #define __IDLOC5 0x200005
2935 #define __IDLOC6 0x200006
2936 #define __IDLOC7 0x200007
2938 #endif // #ifndef __PIC18F2620_H__