struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf1330.h
blobd9468bde001e1f1f290a2a6881d0eab7a5e43f09
1 /*
2 * This declarations of the PIC18LF1330 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 __PIC18LF1330_H__
26 #define __PIC18LF1330_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 TX : 1;
61 unsigned RX : 1;
62 unsigned AN2 : 1;
63 unsigned MCLR : 1;
64 unsigned OSC2 : 1;
65 unsigned OSC1 : 1;
68 struct
70 unsigned INT0 : 1;
71 unsigned INT1 : 1;
72 unsigned CK : 1;
73 unsigned : 1;
74 unsigned T0CKI : 1;
75 unsigned NOT_MCLR : 1;
76 unsigned CLKO : 1;
77 unsigned CLKI : 1;
80 struct
82 unsigned KBI0 : 1;
83 unsigned KBI1 : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned VREFP : 1;
87 unsigned : 1;
88 unsigned T1OSO : 1;
89 unsigned T1OSI : 1;
92 struct
94 unsigned CMP0 : 1;
95 unsigned : 1;
96 unsigned : 1;
97 unsigned : 1;
98 unsigned : 1;
99 unsigned : 1;
100 unsigned AN3 : 1;
101 unsigned : 1;
104 struct
106 unsigned : 1;
107 unsigned : 1;
108 unsigned : 1;
109 unsigned : 1;
110 unsigned : 1;
111 unsigned : 1;
112 unsigned T1CKI : 1;
113 unsigned : 1;
116 struct
118 unsigned INT : 2;
119 unsigned : 6;
122 struct
124 unsigned KBI : 2;
125 unsigned : 6;
127 } __PORTAbits_t;
129 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
131 #define _PORTA_RA0 0x01
132 #define _PORTA_AN0 0x01
133 #define _PORTA_INT0 0x01
134 #define _PORTA_KBI0 0x01
135 #define _PORTA_CMP0 0x01
136 #define _PORTA_RA1 0x02
137 #define _PORTA_AN1 0x02
138 #define _PORTA_INT1 0x02
139 #define _PORTA_KBI1 0x02
140 #define _PORTA_RA2 0x04
141 #define _PORTA_TX 0x04
142 #define _PORTA_CK 0x04
143 #define _PORTA_RA3 0x08
144 #define _PORTA_RX 0x08
145 #define _PORTA_RA4 0x10
146 #define _PORTA_AN2 0x10
147 #define _PORTA_T0CKI 0x10
148 #define _PORTA_VREFP 0x10
149 #define _PORTA_RA5 0x20
150 #define _PORTA_MCLR 0x20
151 #define _PORTA_NOT_MCLR 0x20
152 #define _PORTA_RA6 0x40
153 #define _PORTA_OSC2 0x40
154 #define _PORTA_CLKO 0x40
155 #define _PORTA_T1OSO 0x40
156 #define _PORTA_AN3 0x40
157 #define _PORTA_T1CKI 0x40
158 #define _PORTA_RA7 0x80
159 #define _PORTA_OSC1 0x80
160 #define _PORTA_CLKI 0x80
161 #define _PORTA_T1OSI 0x80
163 //==============================================================================
166 //==============================================================================
167 // PORTB Bits
169 extern __at(0x0F81) __sfr PORTB;
171 typedef union
173 struct
175 unsigned RB0 : 1;
176 unsigned RB1 : 1;
177 unsigned RB2 : 1;
178 unsigned RB3 : 1;
179 unsigned RB4 : 1;
180 unsigned RB5 : 1;
181 unsigned RB6 : 1;
182 unsigned RB7 : 1;
185 struct
187 unsigned PWM0 : 1;
188 unsigned PWM1 : 1;
189 unsigned INT2 : 1;
190 unsigned INT3 : 1;
191 unsigned PWM2 : 1;
192 unsigned PWM3 : 1;
193 unsigned PWM4 : 1;
194 unsigned PWM5 : 1;
197 struct
199 unsigned : 1;
200 unsigned : 1;
201 unsigned KBI2 : 1;
202 unsigned KBI3 : 1;
203 unsigned : 1;
204 unsigned : 1;
205 unsigned PGC : 1;
206 unsigned PGD : 1;
209 struct
211 unsigned : 1;
212 unsigned : 1;
213 unsigned CMP2 : 1;
214 unsigned CMP1 : 1;
215 unsigned : 1;
216 unsigned : 1;
217 unsigned : 1;
218 unsigned : 1;
221 struct
223 unsigned : 1;
224 unsigned : 1;
225 unsigned T1OSO : 1;
226 unsigned T1OSI : 1;
227 unsigned : 1;
228 unsigned : 1;
229 unsigned : 1;
230 unsigned : 1;
233 struct
235 unsigned : 1;
236 unsigned : 1;
237 unsigned T1CKI : 1;
238 unsigned : 1;
239 unsigned : 1;
240 unsigned : 1;
241 unsigned : 1;
242 unsigned : 1;
244 } __PORTBbits_t;
246 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
248 #define _PORTB_RB0 0x01
249 #define _PORTB_PWM0 0x01
250 #define _PORTB_RB1 0x02
251 #define _PORTB_PWM1 0x02
252 #define _PORTB_RB2 0x04
253 #define _PORTB_INT2 0x04
254 #define _PORTB_KBI2 0x04
255 #define _PORTB_CMP2 0x04
256 #define _PORTB_T1OSO 0x04
257 #define _PORTB_T1CKI 0x04
258 #define _PORTB_RB3 0x08
259 #define _PORTB_INT3 0x08
260 #define _PORTB_KBI3 0x08
261 #define _PORTB_CMP1 0x08
262 #define _PORTB_T1OSI 0x08
263 #define _PORTB_RB4 0x10
264 #define _PORTB_PWM2 0x10
265 #define _PORTB_RB5 0x20
266 #define _PORTB_PWM3 0x20
267 #define _PORTB_RB6 0x40
268 #define _PORTB_PWM4 0x40
269 #define _PORTB_PGC 0x40
270 #define _PORTB_RB7 0x80
271 #define _PORTB_PWM5 0x80
272 #define _PORTB_PGD 0x80
274 //==============================================================================
277 //==============================================================================
278 // OVDCONS Bits
280 extern __at(0x0F82) __sfr OVDCONS;
282 typedef union
284 struct
286 unsigned POUT0 : 1;
287 unsigned POUT1 : 1;
288 unsigned POUT2 : 1;
289 unsigned POUT3 : 1;
290 unsigned POUT4 : 1;
291 unsigned POUT5 : 1;
292 unsigned : 1;
293 unsigned : 1;
296 struct
298 unsigned POUT : 6;
299 unsigned : 2;
301 } __OVDCONSbits_t;
303 extern __at(0x0F82) volatile __OVDCONSbits_t OVDCONSbits;
305 #define _POUT0 0x01
306 #define _POUT1 0x02
307 #define _POUT2 0x04
308 #define _POUT3 0x08
309 #define _POUT4 0x10
310 #define _POUT5 0x20
312 //==============================================================================
315 //==============================================================================
316 // OVDCOND Bits
318 extern __at(0x0F83) __sfr OVDCOND;
320 typedef union
322 struct
324 unsigned POVD0 : 1;
325 unsigned POVD1 : 1;
326 unsigned POVD2 : 1;
327 unsigned POVD3 : 1;
328 unsigned POVD4 : 1;
329 unsigned POVD5 : 1;
330 unsigned : 1;
331 unsigned : 1;
334 struct
336 unsigned POVD : 6;
337 unsigned : 2;
339 } __OVDCONDbits_t;
341 extern __at(0x0F83) volatile __OVDCONDbits_t OVDCONDbits;
343 #define _POVD0 0x01
344 #define _POVD1 0x02
345 #define _POVD2 0x04
346 #define _POVD3 0x08
347 #define _POVD4 0x10
348 #define _POVD5 0x20
350 //==============================================================================
353 //==============================================================================
354 // DTCON Bits
356 extern __at(0x0F84) __sfr DTCON;
358 typedef union
360 struct
362 unsigned DT0 : 1;
363 unsigned DT1 : 1;
364 unsigned DT2 : 1;
365 unsigned DT3 : 1;
366 unsigned DT4 : 1;
367 unsigned DT5 : 1;
368 unsigned DTPS0 : 1;
369 unsigned DTPS1 : 1;
372 struct
374 unsigned DT : 6;
375 unsigned : 2;
378 struct
380 unsigned : 6;
381 unsigned DTPS : 2;
383 } __DTCONbits_t;
385 extern __at(0x0F84) volatile __DTCONbits_t DTCONbits;
387 #define _DT0 0x01
388 #define _DT1 0x02
389 #define _DT2 0x04
390 #define _DT3 0x08
391 #define _DT4 0x10
392 #define _DT5 0x20
393 #define _DTPS0 0x40
394 #define _DTPS1 0x80
396 //==============================================================================
399 //==============================================================================
400 // PWMCON1 Bits
402 extern __at(0x0F85) __sfr PWMCON1;
404 typedef union
406 struct
408 unsigned OSYNC : 1;
409 unsigned UDIS : 1;
410 unsigned : 1;
411 unsigned SEVTDIR : 1;
412 unsigned SEVOPS0 : 1;
413 unsigned SEVOPS1 : 1;
414 unsigned SEVOPS2 : 1;
415 unsigned SEVOPS3 : 1;
418 struct
420 unsigned : 4;
421 unsigned SEVOPS : 4;
423 } __PWMCON1bits_t;
425 extern __at(0x0F85) volatile __PWMCON1bits_t PWMCON1bits;
427 #define _OSYNC 0x01
428 #define _UDIS 0x02
429 #define _SEVTDIR 0x08
430 #define _SEVOPS0 0x10
431 #define _SEVOPS1 0x20
432 #define _SEVOPS2 0x40
433 #define _SEVOPS3 0x80
435 //==============================================================================
438 //==============================================================================
439 // PWMCON0 Bits
441 extern __at(0x0F86) __sfr PWMCON0;
443 typedef union
445 struct
447 unsigned PMOD0 : 1;
448 unsigned PMOD1 : 1;
449 unsigned PMOD2 : 1;
450 unsigned : 1;
451 unsigned PWMEN0 : 1;
452 unsigned PWMEN1 : 1;
453 unsigned PWMEN2 : 1;
454 unsigned : 1;
457 struct
459 unsigned PMOD : 3;
460 unsigned : 5;
463 struct
465 unsigned : 4;
466 unsigned PWMEN : 3;
467 unsigned : 1;
469 } __PWMCON0bits_t;
471 extern __at(0x0F86) volatile __PWMCON0bits_t PWMCON0bits;
473 #define _PMOD0 0x01
474 #define _PMOD1 0x02
475 #define _PMOD2 0x04
476 #define _PWMEN0 0x10
477 #define _PWMEN1 0x20
478 #define _PWMEN2 0x40
480 //==============================================================================
482 extern __at(0x0F87) __sfr SEVTCMPH;
483 extern __at(0x0F88) __sfr SEVTCMPL;
485 //==============================================================================
486 // LATA Bits
488 extern __at(0x0F89) __sfr LATA;
490 typedef struct
492 unsigned LATA0 : 1;
493 unsigned LATA1 : 1;
494 unsigned LATA2 : 1;
495 unsigned LATA3 : 1;
496 unsigned LATA4 : 1;
497 unsigned LATA5 : 1;
498 unsigned LATA6 : 1;
499 unsigned LATA7 : 1;
500 } __LATAbits_t;
502 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
504 #define _LATA0 0x01
505 #define _LATA1 0x02
506 #define _LATA2 0x04
507 #define _LATA3 0x08
508 #define _LATA4 0x10
509 #define _LATA5 0x20
510 #define _LATA6 0x40
511 #define _LATA7 0x80
513 //==============================================================================
516 //==============================================================================
517 // LATB Bits
519 extern __at(0x0F8A) __sfr LATB;
521 typedef struct
523 unsigned LATB0 : 1;
524 unsigned LATB1 : 1;
525 unsigned LATB2 : 1;
526 unsigned LATB3 : 1;
527 unsigned LATB4 : 1;
528 unsigned LATB5 : 1;
529 unsigned LATB6 : 1;
530 unsigned LATB7 : 1;
531 } __LATBbits_t;
533 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
535 #define _LATB0 0x01
536 #define _LATB1 0x02
537 #define _LATB2 0x04
538 #define _LATB3 0x08
539 #define _LATB4 0x10
540 #define _LATB5 0x20
541 #define _LATB6 0x40
542 #define _LATB7 0x80
544 //==============================================================================
547 //==============================================================================
548 // FLTCONFIG Bits
550 extern __at(0x0F8B) __sfr FLTCONFIG;
552 typedef struct
554 unsigned FLTAEN : 1;
555 unsigned FLTAMOD : 1;
556 unsigned FLTAS : 1;
557 unsigned : 1;
558 unsigned : 1;
559 unsigned : 1;
560 unsigned : 1;
561 unsigned BRFEN : 1;
562 } __FLTCONFIGbits_t;
564 extern __at(0x0F8B) volatile __FLTCONFIGbits_t FLTCONFIGbits;
566 #define _FLTAEN 0x01
567 #define _FLTAMOD 0x02
568 #define _FLTAS 0x04
569 #define _BRFEN 0x80
571 //==============================================================================
573 extern __at(0x0F8C) __sfr PDC2H;
574 extern __at(0x0F8D) __sfr PDC2L;
575 extern __at(0x0F8E) __sfr PDC1H;
576 extern __at(0x0F8F) __sfr PDC1L;
577 extern __at(0x0F90) __sfr PDC0H;
578 extern __at(0x0F91) __sfr PDC0L;
580 //==============================================================================
581 // DDRA Bits
583 extern __at(0x0F92) __sfr DDRA;
585 typedef union
587 struct
589 unsigned TRISA0 : 1;
590 unsigned TRISA1 : 1;
591 unsigned TRISA2 : 1;
592 unsigned TRISA3 : 1;
593 unsigned TRISA4 : 1;
594 unsigned TRISA5 : 1;
595 unsigned TRISA6 : 1;
596 unsigned TRISA7 : 1;
599 struct
601 unsigned RA0 : 1;
602 unsigned RA1 : 1;
603 unsigned RA2 : 1;
604 unsigned RA3 : 1;
605 unsigned RA4 : 1;
606 unsigned RA5 : 1;
607 unsigned RA6 : 1;
608 unsigned RA7 : 1;
610 } __DDRAbits_t;
612 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
614 #define _TRISA0 0x01
615 #define _RA0 0x01
616 #define _TRISA1 0x02
617 #define _RA1 0x02
618 #define _TRISA2 0x04
619 #define _RA2 0x04
620 #define _TRISA3 0x08
621 #define _RA3 0x08
622 #define _TRISA4 0x10
623 #define _RA4 0x10
624 #define _TRISA5 0x20
625 #define _RA5 0x20
626 #define _TRISA6 0x40
627 #define _RA6 0x40
628 #define _TRISA7 0x80
629 #define _RA7 0x80
631 //==============================================================================
634 //==============================================================================
635 // TRISA Bits
637 extern __at(0x0F92) __sfr TRISA;
639 typedef union
641 struct
643 unsigned TRISA0 : 1;
644 unsigned TRISA1 : 1;
645 unsigned TRISA2 : 1;
646 unsigned TRISA3 : 1;
647 unsigned TRISA4 : 1;
648 unsigned TRISA5 : 1;
649 unsigned TRISA6 : 1;
650 unsigned TRISA7 : 1;
653 struct
655 unsigned RA0 : 1;
656 unsigned RA1 : 1;
657 unsigned RA2 : 1;
658 unsigned RA3 : 1;
659 unsigned RA4 : 1;
660 unsigned RA5 : 1;
661 unsigned RA6 : 1;
662 unsigned RA7 : 1;
664 } __TRISAbits_t;
666 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
668 #define _TRISA_TRISA0 0x01
669 #define _TRISA_RA0 0x01
670 #define _TRISA_TRISA1 0x02
671 #define _TRISA_RA1 0x02
672 #define _TRISA_TRISA2 0x04
673 #define _TRISA_RA2 0x04
674 #define _TRISA_TRISA3 0x08
675 #define _TRISA_RA3 0x08
676 #define _TRISA_TRISA4 0x10
677 #define _TRISA_RA4 0x10
678 #define _TRISA_TRISA5 0x20
679 #define _TRISA_RA5 0x20
680 #define _TRISA_TRISA6 0x40
681 #define _TRISA_RA6 0x40
682 #define _TRISA_TRISA7 0x80
683 #define _TRISA_RA7 0x80
685 //==============================================================================
688 //==============================================================================
689 // DDRB Bits
691 extern __at(0x0F93) __sfr DDRB;
693 typedef union
695 struct
697 unsigned TRISB0 : 1;
698 unsigned TRISB1 : 1;
699 unsigned TRISB2 : 1;
700 unsigned TRISB3 : 1;
701 unsigned TRISB4 : 1;
702 unsigned TRISB5 : 1;
703 unsigned TRISB6 : 1;
704 unsigned TRISB7 : 1;
707 struct
709 unsigned RB0 : 1;
710 unsigned RB1 : 1;
711 unsigned RB2 : 1;
712 unsigned RB3 : 1;
713 unsigned RB4 : 1;
714 unsigned RB5 : 1;
715 unsigned RB6 : 1;
716 unsigned RB7 : 1;
718 } __DDRBbits_t;
720 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
722 #define _TRISB0 0x01
723 #define _RB0 0x01
724 #define _TRISB1 0x02
725 #define _RB1 0x02
726 #define _TRISB2 0x04
727 #define _RB2 0x04
728 #define _TRISB3 0x08
729 #define _RB3 0x08
730 #define _TRISB4 0x10
731 #define _RB4 0x10
732 #define _TRISB5 0x20
733 #define _RB5 0x20
734 #define _TRISB6 0x40
735 #define _RB6 0x40
736 #define _TRISB7 0x80
737 #define _RB7 0x80
739 //==============================================================================
742 //==============================================================================
743 // TRISB Bits
745 extern __at(0x0F93) __sfr TRISB;
747 typedef union
749 struct
751 unsigned TRISB0 : 1;
752 unsigned TRISB1 : 1;
753 unsigned TRISB2 : 1;
754 unsigned TRISB3 : 1;
755 unsigned TRISB4 : 1;
756 unsigned TRISB5 : 1;
757 unsigned TRISB6 : 1;
758 unsigned TRISB7 : 1;
761 struct
763 unsigned RB0 : 1;
764 unsigned RB1 : 1;
765 unsigned RB2 : 1;
766 unsigned RB3 : 1;
767 unsigned RB4 : 1;
768 unsigned RB5 : 1;
769 unsigned RB6 : 1;
770 unsigned RB7 : 1;
772 } __TRISBbits_t;
774 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
776 #define _TRISB_TRISB0 0x01
777 #define _TRISB_RB0 0x01
778 #define _TRISB_TRISB1 0x02
779 #define _TRISB_RB1 0x02
780 #define _TRISB_TRISB2 0x04
781 #define _TRISB_RB2 0x04
782 #define _TRISB_TRISB3 0x08
783 #define _TRISB_RB3 0x08
784 #define _TRISB_TRISB4 0x10
785 #define _TRISB_RB4 0x10
786 #define _TRISB_TRISB5 0x20
787 #define _TRISB_RB5 0x20
788 #define _TRISB_TRISB6 0x40
789 #define _TRISB_RB6 0x40
790 #define _TRISB_TRISB7 0x80
791 #define _TRISB_RB7 0x80
793 //==============================================================================
795 extern __at(0x0F95) __sfr PTPERH;
796 extern __at(0x0F96) __sfr PTPERL;
797 extern __at(0x0F97) __sfr PTMRH;
798 extern __at(0x0F98) __sfr PTMRL;
800 //==============================================================================
801 // PTCON1 Bits
803 extern __at(0x0F99) __sfr PTCON1;
805 typedef struct
807 unsigned : 1;
808 unsigned : 1;
809 unsigned : 1;
810 unsigned : 1;
811 unsigned : 1;
812 unsigned : 1;
813 unsigned PTDIR : 1;
814 unsigned PTEN : 1;
815 } __PTCON1bits_t;
817 extern __at(0x0F99) volatile __PTCON1bits_t PTCON1bits;
819 #define _PTDIR 0x40
820 #define _PTEN 0x80
822 //==============================================================================
825 //==============================================================================
826 // PTCON0 Bits
828 extern __at(0x0F9A) __sfr PTCON0;
830 typedef union
832 struct
834 unsigned PTMOD0 : 1;
835 unsigned PTMOD1 : 1;
836 unsigned PTCKPS0 : 1;
837 unsigned PTCKPS1 : 1;
838 unsigned PTOPS0 : 1;
839 unsigned PTOPS1 : 1;
840 unsigned PTOPS2 : 1;
841 unsigned PTOPS3 : 1;
844 struct
846 unsigned PTMOD : 2;
847 unsigned : 6;
850 struct
852 unsigned : 2;
853 unsigned PTCKPS : 2;
854 unsigned : 4;
857 struct
859 unsigned : 4;
860 unsigned PTOPS : 4;
862 } __PTCON0bits_t;
864 extern __at(0x0F9A) volatile __PTCON0bits_t PTCON0bits;
866 #define _PTMOD0 0x01
867 #define _PTMOD1 0x02
868 #define _PTCKPS0 0x04
869 #define _PTCKPS1 0x08
870 #define _PTOPS0 0x10
871 #define _PTOPS1 0x20
872 #define _PTOPS2 0x40
873 #define _PTOPS3 0x80
875 //==============================================================================
878 //==============================================================================
879 // OSCTUNE Bits
881 extern __at(0x0F9B) __sfr OSCTUNE;
883 typedef union
885 struct
887 unsigned TUN0 : 1;
888 unsigned TUN1 : 1;
889 unsigned TUN2 : 1;
890 unsigned TUN3 : 1;
891 unsigned TUN4 : 1;
892 unsigned : 1;
893 unsigned PLLEN : 1;
894 unsigned INTSRC : 1;
897 struct
899 unsigned TUN : 5;
900 unsigned : 3;
902 } __OSCTUNEbits_t;
904 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
906 #define _TUN0 0x01
907 #define _TUN1 0x02
908 #define _TUN2 0x04
909 #define _TUN3 0x08
910 #define _TUN4 0x10
911 #define _PLLEN 0x40
912 #define _INTSRC 0x80
914 //==============================================================================
917 //==============================================================================
918 // PIE1 Bits
920 extern __at(0x0F9D) __sfr PIE1;
922 typedef struct
924 unsigned TMR1IE : 1;
925 unsigned CMP0IE : 1;
926 unsigned CMP1IE : 1;
927 unsigned CMP2IE : 1;
928 unsigned TXIE : 1;
929 unsigned RCIE : 1;
930 unsigned ADIE : 1;
931 unsigned : 1;
932 } __PIE1bits_t;
934 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
936 #define _TMR1IE 0x01
937 #define _CMP0IE 0x02
938 #define _CMP1IE 0x04
939 #define _CMP2IE 0x08
940 #define _TXIE 0x10
941 #define _RCIE 0x20
942 #define _ADIE 0x40
944 //==============================================================================
947 //==============================================================================
948 // PIR1 Bits
950 extern __at(0x0F9E) __sfr PIR1;
952 typedef struct
954 unsigned TMR1IF : 1;
955 unsigned CMP0IF : 1;
956 unsigned CMP1IF : 1;
957 unsigned CMP2IF : 1;
958 unsigned TXIF : 1;
959 unsigned RCIF : 1;
960 unsigned ADIF : 1;
961 unsigned : 1;
962 } __PIR1bits_t;
964 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
966 #define _TMR1IF 0x01
967 #define _CMP0IF 0x02
968 #define _CMP1IF 0x04
969 #define _CMP2IF 0x08
970 #define _TXIF 0x10
971 #define _RCIF 0x20
972 #define _ADIF 0x40
974 //==============================================================================
977 //==============================================================================
978 // IPR1 Bits
980 extern __at(0x0F9F) __sfr IPR1;
982 typedef struct
984 unsigned TMR1IP : 1;
985 unsigned CMP0IP : 1;
986 unsigned CMP1IP : 1;
987 unsigned CMP2IP : 1;
988 unsigned TXIP : 1;
989 unsigned RCIP : 1;
990 unsigned ADIP : 1;
991 unsigned : 1;
992 } __IPR1bits_t;
994 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
996 #define _TMR1IP 0x01
997 #define _CMP0IP 0x02
998 #define _CMP1IP 0x04
999 #define _CMP2IP 0x08
1000 #define _TXIP 0x10
1001 #define _RCIP 0x20
1002 #define _ADIP 0x40
1004 //==============================================================================
1007 //==============================================================================
1008 // PIE2 Bits
1010 extern __at(0x0FA0) __sfr PIE2;
1012 typedef struct
1014 unsigned : 1;
1015 unsigned : 1;
1016 unsigned LVDIE : 1;
1017 unsigned : 1;
1018 unsigned EEIE : 1;
1019 unsigned : 1;
1020 unsigned : 1;
1021 unsigned OSCFIE : 1;
1022 } __PIE2bits_t;
1024 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1026 #define _LVDIE 0x04
1027 #define _EEIE 0x10
1028 #define _OSCFIE 0x80
1030 //==============================================================================
1033 //==============================================================================
1034 // PIR2 Bits
1036 extern __at(0x0FA1) __sfr PIR2;
1038 typedef struct
1040 unsigned : 1;
1041 unsigned : 1;
1042 unsigned LVDIF : 1;
1043 unsigned : 1;
1044 unsigned EEIF : 1;
1045 unsigned : 1;
1046 unsigned : 1;
1047 unsigned OSCFIF : 1;
1048 } __PIR2bits_t;
1050 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1052 #define _LVDIF 0x04
1053 #define _EEIF 0x10
1054 #define _OSCFIF 0x80
1056 //==============================================================================
1059 //==============================================================================
1060 // IPR2 Bits
1062 extern __at(0x0FA2) __sfr IPR2;
1064 typedef struct
1066 unsigned : 1;
1067 unsigned : 1;
1068 unsigned LVDIP : 1;
1069 unsigned : 1;
1070 unsigned EEIP : 1;
1071 unsigned : 1;
1072 unsigned : 1;
1073 unsigned OSCFIP : 1;
1074 } __IPR2bits_t;
1076 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1078 #define _LVDIP 0x04
1079 #define _EEIP 0x10
1080 #define _OSCFIP 0x80
1082 //==============================================================================
1085 //==============================================================================
1086 // PIE3 Bits
1088 extern __at(0x0FA3) __sfr PIE3;
1090 typedef struct
1092 unsigned : 1;
1093 unsigned : 1;
1094 unsigned : 1;
1095 unsigned : 1;
1096 unsigned PTIE : 1;
1097 unsigned : 1;
1098 unsigned : 1;
1099 unsigned : 1;
1100 } __PIE3bits_t;
1102 extern __at(0x0FA3) volatile __PIE3bits_t PIE3bits;
1104 #define _PTIE 0x10
1106 //==============================================================================
1109 //==============================================================================
1110 // PIR3 Bits
1112 extern __at(0x0FA4) __sfr PIR3;
1114 typedef struct
1116 unsigned : 1;
1117 unsigned : 1;
1118 unsigned : 1;
1119 unsigned : 1;
1120 unsigned PTIF : 1;
1121 unsigned : 1;
1122 unsigned : 1;
1123 unsigned : 1;
1124 } __PIR3bits_t;
1126 extern __at(0x0FA4) volatile __PIR3bits_t PIR3bits;
1128 #define _PTIF 0x10
1130 //==============================================================================
1133 //==============================================================================
1134 // IPR3 Bits
1136 extern __at(0x0FA5) __sfr IPR3;
1138 typedef struct
1140 unsigned : 1;
1141 unsigned : 1;
1142 unsigned : 1;
1143 unsigned : 1;
1144 unsigned PTIP : 1;
1145 unsigned : 1;
1146 unsigned : 1;
1147 unsigned : 1;
1148 } __IPR3bits_t;
1150 extern __at(0x0FA5) volatile __IPR3bits_t IPR3bits;
1152 #define _PTIP 0x10
1154 //==============================================================================
1157 //==============================================================================
1158 // EECON1 Bits
1160 extern __at(0x0FA6) __sfr EECON1;
1162 typedef struct
1164 unsigned RD : 1;
1165 unsigned WR : 1;
1166 unsigned WREN : 1;
1167 unsigned WRERR : 1;
1168 unsigned FREE : 1;
1169 unsigned : 1;
1170 unsigned CFGS : 1;
1171 unsigned EEPGD : 1;
1172 } __EECON1bits_t;
1174 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1176 #define _RD 0x01
1177 #define _WR 0x02
1178 #define _WREN 0x04
1179 #define _WRERR 0x08
1180 #define _FREE 0x10
1181 #define _CFGS 0x40
1182 #define _EEPGD 0x80
1184 //==============================================================================
1186 extern __at(0x0FA7) __sfr EECON2;
1187 extern __at(0x0FA8) __sfr EEDATA;
1188 extern __at(0x0FA9) __sfr EEADR;
1190 //==============================================================================
1191 // RCSTA Bits
1193 extern __at(0x0FAB) __sfr RCSTA;
1195 typedef union
1197 struct
1199 unsigned RX9D : 1;
1200 unsigned OERR : 1;
1201 unsigned FERR : 1;
1202 unsigned ADEN : 1;
1203 unsigned CREN : 1;
1204 unsigned SREN : 1;
1205 unsigned RX9 : 1;
1206 unsigned SPEN : 1;
1209 struct
1211 unsigned : 1;
1212 unsigned : 1;
1213 unsigned : 1;
1214 unsigned ADDEN : 1;
1215 unsigned : 1;
1216 unsigned : 1;
1217 unsigned : 1;
1218 unsigned : 1;
1220 } __RCSTAbits_t;
1222 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1224 #define _RX9D 0x01
1225 #define _OERR 0x02
1226 #define _FERR 0x04
1227 #define _ADEN 0x08
1228 #define _ADDEN 0x08
1229 #define _CREN 0x10
1230 #define _SREN 0x20
1231 #define _RX9 0x40
1232 #define _SPEN 0x80
1234 //==============================================================================
1237 //==============================================================================
1238 // TXSTA Bits
1240 extern __at(0x0FAC) __sfr TXSTA;
1242 typedef struct
1244 unsigned TX9D : 1;
1245 unsigned TRMT : 1;
1246 unsigned BRGH : 1;
1247 unsigned SENDB : 1;
1248 unsigned SYNC : 1;
1249 unsigned TXEN : 1;
1250 unsigned TX9 : 1;
1251 unsigned CSRC : 1;
1252 } __TXSTAbits_t;
1254 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1256 #define _TX9D 0x01
1257 #define _TRMT 0x02
1258 #define _BRGH 0x04
1259 #define _SENDB 0x08
1260 #define _SYNC 0x10
1261 #define _TXEN 0x20
1262 #define _TX9 0x40
1263 #define _CSRC 0x80
1265 //==============================================================================
1267 extern __at(0x0FAD) __sfr TXREG;
1268 extern __at(0x0FAE) __sfr RCREG;
1269 extern __at(0x0FAF) __sfr SPBRG;
1270 extern __at(0x0FB0) __sfr SPBRGH;
1272 //==============================================================================
1273 // CMCON Bits
1275 extern __at(0x0FB4) __sfr CMCON;
1277 typedef union
1279 struct
1281 unsigned CMEN0 : 1;
1282 unsigned CMEN1 : 1;
1283 unsigned CMEN2 : 1;
1284 unsigned : 1;
1285 unsigned : 1;
1286 unsigned C0OUT : 1;
1287 unsigned C1OUT : 1;
1288 unsigned C2OUT : 1;
1291 struct
1293 unsigned CMEN : 3;
1294 unsigned : 5;
1296 } __CMCONbits_t;
1298 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits;
1300 #define _CMEN0 0x01
1301 #define _CMEN1 0x02
1302 #define _CMEN2 0x04
1303 #define _C0OUT 0x20
1304 #define _C1OUT 0x40
1305 #define _C2OUT 0x80
1307 //==============================================================================
1310 //==============================================================================
1311 // CVRCON Bits
1313 extern __at(0x0FB5) __sfr CVRCON;
1315 typedef union
1317 struct
1319 unsigned CVR0 : 1;
1320 unsigned CVR1 : 1;
1321 unsigned CVR2 : 1;
1322 unsigned CVR3 : 1;
1323 unsigned CVRSS : 1;
1324 unsigned CVRR : 1;
1325 unsigned : 1;
1326 unsigned CVREN : 1;
1329 struct
1331 unsigned : 1;
1332 unsigned : 1;
1333 unsigned : 1;
1334 unsigned : 1;
1335 unsigned CVREF : 1;
1336 unsigned : 1;
1337 unsigned : 1;
1338 unsigned : 1;
1341 struct
1343 unsigned CVR : 4;
1344 unsigned : 4;
1346 } __CVRCONbits_t;
1348 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits;
1350 #define _CVR0 0x01
1351 #define _CVR1 0x02
1352 #define _CVR2 0x04
1353 #define _CVR3 0x08
1354 #define _CVRSS 0x10
1355 #define _CVREF 0x10
1356 #define _CVRR 0x20
1357 #define _CVREN 0x80
1359 //==============================================================================
1362 //==============================================================================
1363 // BAUDCON Bits
1365 extern __at(0x0FB8) __sfr BAUDCON;
1367 typedef union
1369 struct
1371 unsigned ABDEN : 1;
1372 unsigned WUE : 1;
1373 unsigned : 1;
1374 unsigned BRG16 : 1;
1375 unsigned TXCKP : 1;
1376 unsigned RXDTP : 1;
1377 unsigned RCIDL : 1;
1378 unsigned ABDOVF : 1;
1381 struct
1383 unsigned : 1;
1384 unsigned : 1;
1385 unsigned : 1;
1386 unsigned : 1;
1387 unsigned SCKP : 1;
1388 unsigned : 1;
1389 unsigned RCMT : 1;
1390 unsigned : 1;
1392 } __BAUDCONbits_t;
1394 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1396 #define _ABDEN 0x01
1397 #define _WUE 0x02
1398 #define _BRG16 0x08
1399 #define _TXCKP 0x10
1400 #define _SCKP 0x10
1401 #define _RXDTP 0x20
1402 #define _RCIDL 0x40
1403 #define _RCMT 0x40
1404 #define _ABDOVF 0x80
1406 //==============================================================================
1409 //==============================================================================
1410 // BAUDCTL Bits
1412 extern __at(0x0FB8) __sfr BAUDCTL;
1414 typedef union
1416 struct
1418 unsigned ABDEN : 1;
1419 unsigned WUE : 1;
1420 unsigned : 1;
1421 unsigned BRG16 : 1;
1422 unsigned TXCKP : 1;
1423 unsigned RXDTP : 1;
1424 unsigned RCIDL : 1;
1425 unsigned ABDOVF : 1;
1428 struct
1430 unsigned : 1;
1431 unsigned : 1;
1432 unsigned : 1;
1433 unsigned : 1;
1434 unsigned SCKP : 1;
1435 unsigned : 1;
1436 unsigned RCMT : 1;
1437 unsigned : 1;
1439 } __BAUDCTLbits_t;
1441 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1443 #define _BAUDCTL_ABDEN 0x01
1444 #define _BAUDCTL_WUE 0x02
1445 #define _BAUDCTL_BRG16 0x08
1446 #define _BAUDCTL_TXCKP 0x10
1447 #define _BAUDCTL_SCKP 0x10
1448 #define _BAUDCTL_RXDTP 0x20
1449 #define _BAUDCTL_RCIDL 0x40
1450 #define _BAUDCTL_RCMT 0x40
1451 #define _BAUDCTL_ABDOVF 0x80
1453 //==============================================================================
1456 //==============================================================================
1457 // ADCON2 Bits
1459 extern __at(0x0FC0) __sfr ADCON2;
1461 typedef union
1463 struct
1465 unsigned ADCS0 : 1;
1466 unsigned ADCS1 : 1;
1467 unsigned ADCS2 : 1;
1468 unsigned ACQT0 : 1;
1469 unsigned ACQT1 : 1;
1470 unsigned ACQT2 : 1;
1471 unsigned : 1;
1472 unsigned ADFM : 1;
1475 struct
1477 unsigned ADCS : 3;
1478 unsigned : 5;
1481 struct
1483 unsigned : 3;
1484 unsigned ACQT : 3;
1485 unsigned : 2;
1487 } __ADCON2bits_t;
1489 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1491 #define _ADCS0 0x01
1492 #define _ADCS1 0x02
1493 #define _ADCS2 0x04
1494 #define _ACQT0 0x08
1495 #define _ACQT1 0x10
1496 #define _ACQT2 0x20
1497 #define _ADFM 0x80
1499 //==============================================================================
1502 //==============================================================================
1503 // ADCON1 Bits
1505 extern __at(0x0FC1) __sfr ADCON1;
1507 typedef union
1509 struct
1511 unsigned PCFG0 : 1;
1512 unsigned PCFG1 : 1;
1513 unsigned PCFG2 : 1;
1514 unsigned PCFG3 : 1;
1515 unsigned VCFG : 1;
1516 unsigned : 1;
1517 unsigned : 1;
1518 unsigned : 1;
1521 struct
1523 unsigned : 1;
1524 unsigned : 1;
1525 unsigned : 1;
1526 unsigned : 1;
1527 unsigned VCFG0 : 1;
1528 unsigned : 1;
1529 unsigned : 1;
1530 unsigned : 1;
1533 struct
1535 unsigned PCFG : 4;
1536 unsigned : 4;
1538 } __ADCON1bits_t;
1540 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1542 #define _PCFG0 0x01
1543 #define _PCFG1 0x02
1544 #define _PCFG2 0x04
1545 #define _PCFG3 0x08
1546 #define _VCFG 0x10
1547 #define _VCFG0 0x10
1549 //==============================================================================
1552 //==============================================================================
1553 // ADCON0 Bits
1555 extern __at(0x0FC2) __sfr ADCON0;
1557 typedef union
1559 struct
1561 unsigned ADON : 1;
1562 unsigned GO_NOT_DONE : 1;
1563 unsigned CHS0 : 1;
1564 unsigned CHS1 : 1;
1565 unsigned : 1;
1566 unsigned : 1;
1567 unsigned : 1;
1568 unsigned SEVTEN : 1;
1571 struct
1573 unsigned : 1;
1574 unsigned GO : 1;
1575 unsigned : 1;
1576 unsigned : 1;
1577 unsigned : 1;
1578 unsigned : 1;
1579 unsigned : 1;
1580 unsigned : 1;
1583 struct
1585 unsigned : 1;
1586 unsigned DONE : 1;
1587 unsigned : 1;
1588 unsigned : 1;
1589 unsigned : 1;
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned : 1;
1595 struct
1597 unsigned : 1;
1598 unsigned NOT_DONE : 1;
1599 unsigned : 1;
1600 unsigned : 1;
1601 unsigned : 1;
1602 unsigned : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1607 struct
1609 unsigned : 1;
1610 unsigned GO_DONE : 1;
1611 unsigned : 1;
1612 unsigned : 1;
1613 unsigned : 1;
1614 unsigned : 1;
1615 unsigned : 1;
1616 unsigned : 1;
1619 struct
1621 unsigned : 2;
1622 unsigned CHS : 2;
1623 unsigned : 4;
1625 } __ADCON0bits_t;
1627 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1629 #define _ADON 0x01
1630 #define _GO_NOT_DONE 0x02
1631 #define _GO 0x02
1632 #define _DONE 0x02
1633 #define _NOT_DONE 0x02
1634 #define _GO_DONE 0x02
1635 #define _CHS0 0x04
1636 #define _CHS1 0x08
1637 #define _SEVTEN 0x80
1639 //==============================================================================
1641 extern __at(0x0FC3) __sfr ADRES;
1642 extern __at(0x0FC3) __sfr ADRESL;
1643 extern __at(0x0FC4) __sfr ADRESH;
1645 //==============================================================================
1646 // T1CON Bits
1648 extern __at(0x0FCD) __sfr T1CON;
1650 typedef union
1652 struct
1654 unsigned TMR1ON : 1;
1655 unsigned TMR1CS : 1;
1656 unsigned NOT_T1SYNC : 1;
1657 unsigned T1OSCEN : 1;
1658 unsigned T1CKPS0 : 1;
1659 unsigned T1CKPS1 : 1;
1660 unsigned T1RUN : 1;
1661 unsigned RD16 : 1;
1664 struct
1666 unsigned : 1;
1667 unsigned : 1;
1668 unsigned T1SYNC : 1;
1669 unsigned : 1;
1670 unsigned : 1;
1671 unsigned : 1;
1672 unsigned : 1;
1673 unsigned : 1;
1676 struct
1678 unsigned : 4;
1679 unsigned T1CKPS : 2;
1680 unsigned : 2;
1682 } __T1CONbits_t;
1684 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1686 #define _TMR1ON 0x01
1687 #define _TMR1CS 0x02
1688 #define _NOT_T1SYNC 0x04
1689 #define _T1SYNC 0x04
1690 #define _T1OSCEN 0x08
1691 #define _T1CKPS0 0x10
1692 #define _T1CKPS1 0x20
1693 #define _T1RUN 0x40
1694 #define _RD16 0x80
1696 //==============================================================================
1698 extern __at(0x0FCE) __sfr TMR1;
1699 extern __at(0x0FCE) __sfr TMR1L;
1700 extern __at(0x0FCF) __sfr TMR1H;
1702 //==============================================================================
1703 // RCON Bits
1705 extern __at(0x0FD0) __sfr RCON;
1707 typedef union
1709 struct
1711 unsigned NOT_BOR : 1;
1712 unsigned NOT_POR : 1;
1713 unsigned NOT_PD : 1;
1714 unsigned NOT_TO : 1;
1715 unsigned NOT_RI : 1;
1716 unsigned : 1;
1717 unsigned SBOREN : 1;
1718 unsigned IPEN : 1;
1721 struct
1723 unsigned BOR : 1;
1724 unsigned POR : 1;
1725 unsigned PD : 1;
1726 unsigned TO : 1;
1727 unsigned RI : 1;
1728 unsigned : 1;
1729 unsigned : 1;
1730 unsigned : 1;
1732 } __RCONbits_t;
1734 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1736 #define _NOT_BOR 0x01
1737 #define _BOR 0x01
1738 #define _NOT_POR 0x02
1739 #define _POR 0x02
1740 #define _NOT_PD 0x04
1741 #define _PD 0x04
1742 #define _NOT_TO 0x08
1743 #define _TO 0x08
1744 #define _NOT_RI 0x10
1745 #define _RI 0x10
1746 #define _SBOREN 0x40
1747 #define _IPEN 0x80
1749 //==============================================================================
1752 //==============================================================================
1753 // WDTCON Bits
1755 extern __at(0x0FD1) __sfr WDTCON;
1757 typedef union
1759 struct
1761 unsigned SWDTEN : 1;
1762 unsigned : 1;
1763 unsigned : 1;
1764 unsigned : 1;
1765 unsigned : 1;
1766 unsigned : 1;
1767 unsigned : 1;
1768 unsigned : 1;
1771 struct
1773 unsigned SWDTE : 1;
1774 unsigned : 1;
1775 unsigned : 1;
1776 unsigned : 1;
1777 unsigned : 1;
1778 unsigned : 1;
1779 unsigned : 1;
1780 unsigned : 1;
1782 } __WDTCONbits_t;
1784 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
1786 #define _SWDTEN 0x01
1787 #define _SWDTE 0x01
1789 //==============================================================================
1792 //==============================================================================
1793 // LVDCON Bits
1795 extern __at(0x0FD2) __sfr LVDCON;
1797 typedef union
1799 struct
1801 unsigned LVDL0 : 1;
1802 unsigned LVDL1 : 1;
1803 unsigned LVDL2 : 1;
1804 unsigned LVDL3 : 1;
1805 unsigned LVDEN : 1;
1806 unsigned IRVST : 1;
1807 unsigned : 1;
1808 unsigned : 1;
1811 struct
1813 unsigned : 1;
1814 unsigned : 1;
1815 unsigned : 1;
1816 unsigned : 1;
1817 unsigned : 1;
1818 unsigned IVRST : 1;
1819 unsigned : 1;
1820 unsigned : 1;
1823 struct
1825 unsigned LVDL : 4;
1826 unsigned : 4;
1828 } __LVDCONbits_t;
1830 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
1832 #define _LVDL0 0x01
1833 #define _LVDL1 0x02
1834 #define _LVDL2 0x04
1835 #define _LVDL3 0x08
1836 #define _LVDEN 0x10
1837 #define _IRVST 0x20
1838 #define _IVRST 0x20
1840 //==============================================================================
1843 //==============================================================================
1844 // OSCCON Bits
1846 extern __at(0x0FD3) __sfr OSCCON;
1848 typedef union
1850 struct
1852 unsigned SCS0 : 1;
1853 unsigned SCS1 : 1;
1854 unsigned IOFS : 1;
1855 unsigned OSTS : 1;
1856 unsigned IRCF0 : 1;
1857 unsigned IRCF1 : 1;
1858 unsigned IRCF2 : 1;
1859 unsigned IDLEN : 1;
1862 struct
1864 unsigned : 1;
1865 unsigned : 1;
1866 unsigned FLTS : 1;
1867 unsigned : 1;
1868 unsigned : 1;
1869 unsigned : 1;
1870 unsigned : 1;
1871 unsigned : 1;
1874 struct
1876 unsigned SCS : 2;
1877 unsigned : 6;
1880 struct
1882 unsigned : 4;
1883 unsigned IRCF : 3;
1884 unsigned : 1;
1886 } __OSCCONbits_t;
1888 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
1890 #define _SCS0 0x01
1891 #define _SCS1 0x02
1892 #define _IOFS 0x04
1893 #define _FLTS 0x04
1894 #define _OSTS 0x08
1895 #define _IRCF0 0x10
1896 #define _IRCF1 0x20
1897 #define _IRCF2 0x40
1898 #define _IDLEN 0x80
1900 //==============================================================================
1903 //==============================================================================
1904 // T0CON Bits
1906 extern __at(0x0FD5) __sfr T0CON;
1908 typedef union
1910 struct
1912 unsigned T0PS0 : 1;
1913 unsigned T0PS1 : 1;
1914 unsigned T0PS2 : 1;
1915 unsigned PSA : 1;
1916 unsigned T0SE : 1;
1917 unsigned T0CS : 1;
1918 unsigned T016BIT : 1;
1919 unsigned TMR0ON : 1;
1922 struct
1924 unsigned : 1;
1925 unsigned : 1;
1926 unsigned : 1;
1927 unsigned : 1;
1928 unsigned : 1;
1929 unsigned : 1;
1930 unsigned T08BIT : 1;
1931 unsigned : 1;
1934 struct
1936 unsigned T0PS : 3;
1937 unsigned : 5;
1939 } __T0CONbits_t;
1941 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
1943 #define _T0PS0 0x01
1944 #define _T0PS1 0x02
1945 #define _T0PS2 0x04
1946 #define _PSA 0x08
1947 #define _T0SE 0x10
1948 #define _T0CS 0x20
1949 #define _T016BIT 0x40
1950 #define _T08BIT 0x40
1951 #define _TMR0ON 0x80
1953 //==============================================================================
1955 extern __at(0x0FD6) __sfr TMR0;
1956 extern __at(0x0FD6) __sfr TMR0L;
1957 extern __at(0x0FD7) __sfr TMR0H;
1959 //==============================================================================
1960 // STATUS Bits
1962 extern __at(0x0FD8) __sfr STATUS;
1964 typedef struct
1966 unsigned C : 1;
1967 unsigned DC : 1;
1968 unsigned Z : 1;
1969 unsigned OV : 1;
1970 unsigned N : 1;
1971 unsigned : 1;
1972 unsigned : 1;
1973 unsigned : 1;
1974 } __STATUSbits_t;
1976 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
1978 #define _C 0x01
1979 #define _DC 0x02
1980 #define _Z 0x04
1981 #define _OV 0x08
1982 #define _N 0x10
1984 //==============================================================================
1986 extern __at(0x0FD9) __sfr FSR2L;
1987 extern __at(0x0FDA) __sfr FSR2H;
1988 extern __at(0x0FDB) __sfr PLUSW2;
1989 extern __at(0x0FDC) __sfr PREINC2;
1990 extern __at(0x0FDD) __sfr POSTDEC2;
1991 extern __at(0x0FDE) __sfr POSTINC2;
1992 extern __at(0x0FDF) __sfr INDF2;
1993 extern __at(0x0FE0) __sfr BSR;
1994 extern __at(0x0FE1) __sfr FSR1L;
1995 extern __at(0x0FE2) __sfr FSR1H;
1996 extern __at(0x0FE3) __sfr PLUSW1;
1997 extern __at(0x0FE4) __sfr PREINC1;
1998 extern __at(0x0FE5) __sfr POSTDEC1;
1999 extern __at(0x0FE6) __sfr POSTINC1;
2000 extern __at(0x0FE7) __sfr INDF1;
2001 extern __at(0x0FE8) __sfr WREG;
2002 extern __at(0x0FE9) __sfr FSR0L;
2003 extern __at(0x0FEA) __sfr FSR0H;
2004 extern __at(0x0FEB) __sfr PLUSW0;
2005 extern __at(0x0FEC) __sfr PREINC0;
2006 extern __at(0x0FED) __sfr POSTDEC0;
2007 extern __at(0x0FEE) __sfr POSTINC0;
2008 extern __at(0x0FEF) __sfr INDF0;
2010 //==============================================================================
2011 // INTCON3 Bits
2013 extern __at(0x0FF0) __sfr INTCON3;
2015 typedef union
2017 struct
2019 unsigned INT1IF : 1;
2020 unsigned INT2IF : 1;
2021 unsigned INT3IF : 1;
2022 unsigned INT1IE : 1;
2023 unsigned INT2IE : 1;
2024 unsigned INT3IE : 1;
2025 unsigned INT1IP : 1;
2026 unsigned INT2IP : 1;
2029 struct
2031 unsigned INT1F : 1;
2032 unsigned INT2F : 1;
2033 unsigned INT3F : 1;
2034 unsigned INT1E : 1;
2035 unsigned INT2E : 1;
2036 unsigned INT3E : 1;
2037 unsigned INT1P : 1;
2038 unsigned INT2P : 1;
2040 } __INTCON3bits_t;
2042 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2044 #define _INT1IF 0x01
2045 #define _INT1F 0x01
2046 #define _INT2IF 0x02
2047 #define _INT2F 0x02
2048 #define _INT3IF 0x04
2049 #define _INT3F 0x04
2050 #define _INT1IE 0x08
2051 #define _INT1E 0x08
2052 #define _INT2IE 0x10
2053 #define _INT2E 0x10
2054 #define _INT3IE 0x20
2055 #define _INT3E 0x20
2056 #define _INT1IP 0x40
2057 #define _INT1P 0x40
2058 #define _INT2IP 0x80
2059 #define _INT2P 0x80
2061 //==============================================================================
2064 //==============================================================================
2065 // INTCON2 Bits
2067 extern __at(0x0FF1) __sfr INTCON2;
2069 typedef union
2071 struct
2073 unsigned RBIP : 1;
2074 unsigned INT3IP : 1;
2075 unsigned TMR0IP : 1;
2076 unsigned INTEDG3 : 1;
2077 unsigned INTEDG2 : 1;
2078 unsigned INTEDG1 : 1;
2079 unsigned INTEDG0 : 1;
2080 unsigned NOT_RBPU : 1;
2083 struct
2085 unsigned : 1;
2086 unsigned INT3P : 1;
2087 unsigned : 1;
2088 unsigned : 1;
2089 unsigned : 1;
2090 unsigned : 1;
2091 unsigned : 1;
2092 unsigned RBPU : 1;
2094 } __INTCON2bits_t;
2096 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2098 #define _RBIP 0x01
2099 #define _INT3IP 0x02
2100 #define _INT3P 0x02
2101 #define _TMR0IP 0x04
2102 #define _INTEDG3 0x08
2103 #define _INTEDG2 0x10
2104 #define _INTEDG1 0x20
2105 #define _INTEDG0 0x40
2106 #define _NOT_RBPU 0x80
2107 #define _RBPU 0x80
2109 //==============================================================================
2112 //==============================================================================
2113 // INTCON Bits
2115 extern __at(0x0FF2) __sfr INTCON;
2117 typedef union
2119 struct
2121 unsigned RBIF : 1;
2122 unsigned INT0IF : 1;
2123 unsigned TMR0IF : 1;
2124 unsigned RBIE : 1;
2125 unsigned INT0IE : 1;
2126 unsigned TMR0IE : 1;
2127 unsigned PEIE_GIEL : 1;
2128 unsigned GIE_GIEH : 1;
2131 struct
2133 unsigned : 1;
2134 unsigned INT0F : 1;
2135 unsigned T0IF : 1;
2136 unsigned : 1;
2137 unsigned INT0E : 1;
2138 unsigned T0IE : 1;
2139 unsigned PEIE : 1;
2140 unsigned GIE : 1;
2143 struct
2145 unsigned : 1;
2146 unsigned : 1;
2147 unsigned : 1;
2148 unsigned : 1;
2149 unsigned : 1;
2150 unsigned : 1;
2151 unsigned GIEL : 1;
2152 unsigned GIEH : 1;
2154 } __INTCONbits_t;
2156 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2158 #define _RBIF 0x01
2159 #define _INT0IF 0x02
2160 #define _INT0F 0x02
2161 #define _TMR0IF 0x04
2162 #define _T0IF 0x04
2163 #define _RBIE 0x08
2164 #define _INT0IE 0x10
2165 #define _INT0E 0x10
2166 #define _TMR0IE 0x20
2167 #define _T0IE 0x20
2168 #define _PEIE_GIEL 0x40
2169 #define _PEIE 0x40
2170 #define _GIEL 0x40
2171 #define _GIE_GIEH 0x80
2172 #define _GIE 0x80
2173 #define _GIEH 0x80
2175 //==============================================================================
2177 extern __at(0x0FF3) __sfr PROD;
2178 extern __at(0x0FF3) __sfr PRODL;
2179 extern __at(0x0FF4) __sfr PRODH;
2180 extern __at(0x0FF5) __sfr TABLAT;
2181 extern __at(0x0FF6) __sfr TBLPTR;
2182 extern __at(0x0FF6) __sfr TBLPTRL;
2183 extern __at(0x0FF7) __sfr TBLPTRH;
2184 extern __at(0x0FF8) __sfr TBLPTRU;
2185 extern __at(0x0FF9) __sfr PC;
2186 extern __at(0x0FF9) __sfr PCL;
2187 extern __at(0x0FFA) __sfr PCLATH;
2188 extern __at(0x0FFB) __sfr PCLATU;
2190 //==============================================================================
2191 // STKPTR Bits
2193 extern __at(0x0FFC) __sfr STKPTR;
2195 typedef union
2197 struct
2199 unsigned SP0 : 1;
2200 unsigned SP1 : 1;
2201 unsigned SP2 : 1;
2202 unsigned SP3 : 1;
2203 unsigned SP4 : 1;
2204 unsigned : 1;
2205 unsigned STKUNF : 1;
2206 unsigned STKFUL : 1;
2209 struct
2211 unsigned : 1;
2212 unsigned : 1;
2213 unsigned : 1;
2214 unsigned : 1;
2215 unsigned : 1;
2216 unsigned : 1;
2217 unsigned : 1;
2218 unsigned STKOVF : 1;
2221 struct
2223 unsigned SP : 5;
2224 unsigned : 3;
2226 } __STKPTRbits_t;
2228 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2230 #define _SP0 0x01
2231 #define _SP1 0x02
2232 #define _SP2 0x04
2233 #define _SP3 0x08
2234 #define _SP4 0x10
2235 #define _STKUNF 0x40
2236 #define _STKFUL 0x80
2237 #define _STKOVF 0x80
2239 //==============================================================================
2241 extern __at(0x0FFD) __sfr TOS;
2242 extern __at(0x0FFD) __sfr TOSL;
2243 extern __at(0x0FFE) __sfr TOSH;
2244 extern __at(0x0FFF) __sfr TOSU;
2246 //==============================================================================
2248 // Configuration Bits
2250 //==============================================================================
2252 #define __CONFIG1H 0x300001
2253 #define __CONFIG2L 0x300002
2254 #define __CONFIG2H 0x300003
2255 #define __CONFIG3L 0x300004
2256 #define __CONFIG3H 0x300005
2257 #define __CONFIG4L 0x300006
2258 #define __CONFIG5L 0x300008
2259 #define __CONFIG5H 0x300009
2260 #define __CONFIG6L 0x30000A
2261 #define __CONFIG6H 0x30000B
2262 #define __CONFIG7L 0x30000C
2263 #define __CONFIG7H 0x30000D
2265 //----------------------------- CONFIG1H Options -------------------------------
2267 #define _OSC_LP_1H 0xF0 // LP Oscillator.
2268 #define _OSC_XT_1H 0xF1 // XT Oscillator.
2269 #define _OSC_HS_1H 0xF2 // HS Oscillator.
2270 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6.
2271 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6.
2272 #define _OSC_ECIO_1H 0xF5 // EC oscillator, port function on RA6.
2273 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1).
2274 #define _OSC_RCIO_1H 0xF7 // External RC oscillator, port function on RA6.
2275 #define _OSC_INTIO2_1H 0xF8 // Internal oscillator, port function on RA6 and RA7.
2276 #define _OSC_INTIO1_1H 0xF9 // Internal oscillator, CLKO function on RA6, port function on RA7.
2277 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2278 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2279 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2280 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2282 //----------------------------- CONFIG2L Options -------------------------------
2284 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2285 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2286 #define _BOR_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2287 #define _BOR_SBORENCTRL_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2288 #define _BOR_BOACTIVE_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2289 #define _BOR_BOHW_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2290 #define _BORV_0_2L 0xE7 // Maximum setting.
2291 #define _BORV_1_2L 0xEF
2292 #define _BORV_2_2L 0xF7
2293 #define _BORV_3_2L 0xFF // Minimum setting.
2295 //----------------------------- CONFIG2H Options -------------------------------
2297 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2298 #define _WDT_ON_2H 0xFF // WDT enabled.
2299 #define _WDTPS_1_2H 0xE1 // 1:1.
2300 #define _WDTPS_2_2H 0xE3 // 1:2.
2301 #define _WDTPS_4_2H 0xE5 // 1:4.
2302 #define _WDTPS_8_2H 0xE7 // 1:8.
2303 #define _WDTPS_16_2H 0xE9 // 1:16.
2304 #define _WDTPS_32_2H 0xEB // 1:32.
2305 #define _WDTPS_64_2H 0xED // 1:64.
2306 #define _WDTPS_128_2H 0xEF // 1:128.
2307 #define _WDTPS_256_2H 0xF1 // 1:256.
2308 #define _WDTPS_512_2H 0xF3 // 1:512.
2309 #define _WDTPS_1024_2H 0xF5 // 1:1024.
2310 #define _WDTPS_2048_2H 0xF7 // 1:2048.
2311 #define _WDTPS_4096_2H 0xF9 // 1:4096.
2312 #define _WDTPS_8192_2H 0xFB // 1:8192.
2313 #define _WDTPS_16384_2H 0xFD // 1:16384.
2314 #define _WDTPS_32768_2H 0xFF // 1:32768.
2316 //----------------------------- CONFIG3L Options -------------------------------
2318 #define _PWMPIN_ON_3L 0xFD // PWM outputs drive active states upon Reset.
2319 #define _PWMPIN_OFF_3L 0xFF // PWM outputs disabled upon Reset.
2320 #define _LPOL_LOW_3L 0xFB // PWM0, PWM2 and PWM4 are active-low.
2321 #define _LPOL_HIGH_3L 0xFF // PWM0, PWM2 and PWM4 are active-high (default).
2322 #define _HPOL_LOW_3L 0xF7 // PWM1, PWM3 and PWM5 are active-low.
2323 #define _HPOL_HIGH_3L 0xFF // PWM1, PWM3 and PWM5 are active-high (default).
2325 //----------------------------- CONFIG3H Options -------------------------------
2327 #define _FLTAMX_RA7_3H 0xFE // FLTA input is muxed onto RA7.
2328 #define _FLTAMX_RA5_3H 0xFF // FLTA input is muxed onto RA5.
2329 #define _T1OSCMX_LOW_3H 0xF7 // T1OSO/T1CKI pin resides on RB2.
2330 #define _T1OSCMX_HIGH_3H 0xFF // T1OSO/T1CKI pin resides on RA6.
2331 #define _MCLRE_OFF_3H 0x7F // RA5 input pin enabled, MCLR pin disabled.
2332 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA5 input pin disabled.
2334 //----------------------------- CONFIG4L Options -------------------------------
2336 #define _STVREN_OFF_4L 0xFE // Reset on stack overflow/underflow disabled.
2337 #define _STVREN_ON_4L 0xFF // Reset on stack overflow/underflow enabled.
2338 #define _BBSIZ_BB256_4L 0xCF // 256 Words (512 Bytes) Boot Block size.
2339 #define _BBSIZ_BB512_4L 0xDF // 512 Words (1024 Bytes) Boot Block size.
2340 #define _BBSIZ_BB1K_4L 0xFF // 1K Words (2048 Bytes) Boot Block size.
2341 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled.
2342 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
2343 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2344 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2346 //----------------------------- CONFIG5L Options -------------------------------
2348 #define _CP0_ON_5L 0xFE // Block 0 is code-protected.
2349 #define _CP0_OFF_5L 0xFF // Block 0 is not code-protected.
2350 #define _CP1_ON_5L 0xFD // Block 1 is code-protected.
2351 #define _CP1_OFF_5L 0xFF // Block 1 is not code-protected.
2353 //----------------------------- CONFIG5H Options -------------------------------
2355 #define _CPB_ON_5H 0xBF // Boot Block is code-protected.
2356 #define _CPB_OFF_5H 0xFF // Boot Block is not code-protected.
2357 #define _CPD_ON_5H 0x7F // Data EEPROM is code-protected.
2358 #define _CPD_OFF_5H 0xFF // Data EEPROM is not code-protected.
2360 //----------------------------- CONFIG6L Options -------------------------------
2362 #define _WRT0_ON_6L 0xFE // Block 0 is write-protected.
2363 #define _WRT0_OFF_6L 0xFF // Block 0 is not write-protected.
2364 #define _WRT1_ON_6L 0xFD // Block 1 is write-protected.
2365 #define _WRT1_OFF_6L 0xFF // Block 1 is not write-protected.
2367 //----------------------------- CONFIG6H Options -------------------------------
2369 #define _WRTC_ON_6H 0xDF // Configuration registers are write-protected.
2370 #define _WRTC_OFF_6H 0xFF // Configuration registers are not write-protected.
2371 #define _WRTB_ON_6H 0xBF // Boot Block is write-protected.
2372 #define _WRTB_OFF_6H 0xFF // Boot Block is not write-protected.
2373 #define _WRTD_ON_6H 0x7F // Data EEPROM is write-protected.
2374 #define _WRTD_OFF_6H 0xFF // Data EEPROM is not write-protected.
2376 //----------------------------- CONFIG7L Options -------------------------------
2378 #define _EBTR0_ON_7L 0xFE // Block 0 is protected from table reads executed in other blocks.
2379 #define _EBTR0_OFF_7L 0xFF // Block 0 is not protected from table reads executed in other blocks.
2380 #define _EBTR1_ON_7L 0xFD // Block 1 is protected from table reads executed in other blocks.
2381 #define _EBTR1_OFF_7L 0xFF // Block 1 is not protected from table reads executed in other blocks.
2383 //----------------------------- CONFIG7H Options -------------------------------
2385 #define _EBTRB_ON_7H 0xBF // Boot Block is protected from table reads executed in other blocks.
2386 #define _EBTRB_OFF_7H 0xFF // Boot Block is not protected from table reads executed in other blocks.
2388 //==============================================================================
2390 #define __DEVID1 0x3FFFFE
2391 #define __DEVID2 0x3FFFFF
2393 #define __IDLOC0 0x200000
2394 #define __IDLOC1 0x200001
2395 #define __IDLOC2 0x200002
2396 #define __IDLOC3 0x200003
2397 #define __IDLOC4 0x200004
2398 #define __IDLOC5 0x200005
2399 #define __IDLOC6 0x200006
2400 #define __IDLOC7 0x200007
2402 #endif // #ifndef __PIC18LF1330_H__