struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16lf1517.h
blob8ef84072ebecaa8846b7e950279ddfbd708163d1
1 /*
2 * This declarations of the PIC16LF1517 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:07 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 __PIC16LF1517_H__
26 #define __PIC16LF1517_H__
28 //==============================================================================
30 // Register Addresses
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF0_ADDR 0x0000
37 #define INDF1_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR0_ADDR 0x0004
41 #define FSR0L_ADDR 0x0004
42 #define FSR0H_ADDR 0x0005
43 #define FSR1_ADDR 0x0006
44 #define FSR1L_ADDR 0x0006
45 #define FSR1H_ADDR 0x0007
46 #define BSR_ADDR 0x0008
47 #define WREG_ADDR 0x0009
48 #define PCLATH_ADDR 0x000A
49 #define INTCON_ADDR 0x000B
50 #define PORTA_ADDR 0x000C
51 #define PORTB_ADDR 0x000D
52 #define PORTC_ADDR 0x000E
53 #define PORTD_ADDR 0x000F
54 #define PORTE_ADDR 0x0010
55 #define PIR1_ADDR 0x0011
56 #define PIR2_ADDR 0x0012
57 #define TMR0_ADDR 0x0015
58 #define TMR1_ADDR 0x0016
59 #define TMR1L_ADDR 0x0016
60 #define TMR1H_ADDR 0x0017
61 #define T1CON_ADDR 0x0018
62 #define T1GCON_ADDR 0x0019
63 #define TMR2_ADDR 0x001A
64 #define PR2_ADDR 0x001B
65 #define T2CON_ADDR 0x001C
66 #define TRISA_ADDR 0x008C
67 #define TRISB_ADDR 0x008D
68 #define TRISC_ADDR 0x008E
69 #define TRISD_ADDR 0x008F
70 #define TRISE_ADDR 0x0090
71 #define PIE1_ADDR 0x0091
72 #define PIE2_ADDR 0x0092
73 #define OPTION_REG_ADDR 0x0095
74 #define PCON_ADDR 0x0096
75 #define WDTCON_ADDR 0x0097
76 #define OSCCON_ADDR 0x0099
77 #define OSCSTAT_ADDR 0x009A
78 #define ADRES_ADDR 0x009B
79 #define ADRESL_ADDR 0x009B
80 #define ADRESH_ADDR 0x009C
81 #define ADCON0_ADDR 0x009D
82 #define ADCON1_ADDR 0x009E
83 #define LATA_ADDR 0x010C
84 #define LATB_ADDR 0x010D
85 #define LATC_ADDR 0x010E
86 #define LATD_ADDR 0x010F
87 #define LATE_ADDR 0x0110
88 #define BORCON_ADDR 0x0116
89 #define FVRCON_ADDR 0x0117
90 #define APFCON_ADDR 0x011D
91 #define ANSELA_ADDR 0x018C
92 #define ANSELB_ADDR 0x018D
93 #define ANSELC_ADDR 0x018E
94 #define ANSELD_ADDR 0x018F
95 #define ANSELE_ADDR 0x0190
96 #define PMADR_ADDR 0x0191
97 #define PMADRL_ADDR 0x0191
98 #define PMADRH_ADDR 0x0192
99 #define PMDAT_ADDR 0x0193
100 #define PMDATL_ADDR 0x0193
101 #define PMDATH_ADDR 0x0194
102 #define PMCON1_ADDR 0x0195
103 #define PMCON2_ADDR 0x0196
104 #define RCREG_ADDR 0x0199
105 #define TXREG_ADDR 0x019A
106 #define SP1BRG_ADDR 0x019B
107 #define SP1BRGL_ADDR 0x019B
108 #define SPBRG_ADDR 0x019B
109 #define SPBRGL_ADDR 0x019B
110 #define SP1BRGH_ADDR 0x019C
111 #define SPBRGH_ADDR 0x019C
112 #define RCSTA_ADDR 0x019D
113 #define TXSTA_ADDR 0x019E
114 #define BAUDCON_ADDR 0x019F
115 #define WPUB_ADDR 0x020D
116 #define WPUE_ADDR 0x0210
117 #define SSP1BUF_ADDR 0x0211
118 #define SSPBUF_ADDR 0x0211
119 #define SSP1ADD_ADDR 0x0212
120 #define SSPADD_ADDR 0x0212
121 #define SSP1MSK_ADDR 0x0213
122 #define SSPMSK_ADDR 0x0213
123 #define SSP1STAT_ADDR 0x0214
124 #define SSPSTAT_ADDR 0x0214
125 #define SSP1CON1_ADDR 0x0215
126 #define SSPCON_ADDR 0x0215
127 #define SSPCON1_ADDR 0x0215
128 #define SSP1CON2_ADDR 0x0216
129 #define SSPCON2_ADDR 0x0216
130 #define SSP1CON3_ADDR 0x0217
131 #define SSPCON3_ADDR 0x0217
132 #define CCPR1_ADDR 0x0291
133 #define CCPR1L_ADDR 0x0291
134 #define CCPR1H_ADDR 0x0292
135 #define CCP1CON_ADDR 0x0293
136 #define CCPR2_ADDR 0x0298
137 #define CCPR2L_ADDR 0x0298
138 #define CCPR2H_ADDR 0x0299
139 #define CCP2CON_ADDR 0x029A
140 #define IOCBP_ADDR 0x0394
141 #define IOCBN_ADDR 0x0395
142 #define IOCBF_ADDR 0x0396
143 #define STATUS_SHAD_ADDR 0x0FE4
144 #define WREG_SHAD_ADDR 0x0FE5
145 #define BSR_SHAD_ADDR 0x0FE6
146 #define PCLATH_SHAD_ADDR 0x0FE7
147 #define FSR0L_SHAD_ADDR 0x0FE8
148 #define FSR0H_SHAD_ADDR 0x0FE9
149 #define FSR1L_SHAD_ADDR 0x0FEA
150 #define FSR1H_SHAD_ADDR 0x0FEB
151 #define STKPTR_ADDR 0x0FED
152 #define TOSL_ADDR 0x0FEE
153 #define TOSH_ADDR 0x0FEF
155 #endif // #ifndef NO_ADDR_DEFINES
157 //==============================================================================
159 // Register Definitions
161 //==============================================================================
163 extern __at(0x0000) __sfr INDF0;
164 extern __at(0x0001) __sfr INDF1;
165 extern __at(0x0002) __sfr PCL;
167 //==============================================================================
168 // STATUS Bits
170 extern __at(0x0003) __sfr STATUS;
172 typedef struct
174 unsigned C : 1;
175 unsigned DC : 1;
176 unsigned Z : 1;
177 unsigned NOT_PD : 1;
178 unsigned NOT_TO : 1;
179 unsigned : 1;
180 unsigned : 1;
181 unsigned : 1;
182 } __STATUSbits_t;
184 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
186 #define _C 0x01
187 #define _DC 0x02
188 #define _Z 0x04
189 #define _NOT_PD 0x08
190 #define _NOT_TO 0x10
192 //==============================================================================
194 extern __at(0x0004) __sfr FSR0;
195 extern __at(0x0004) __sfr FSR0L;
196 extern __at(0x0005) __sfr FSR0H;
197 extern __at(0x0006) __sfr FSR1;
198 extern __at(0x0006) __sfr FSR1L;
199 extern __at(0x0007) __sfr FSR1H;
201 //==============================================================================
202 // BSR Bits
204 extern __at(0x0008) __sfr BSR;
206 typedef union
208 struct
210 unsigned BSR0 : 1;
211 unsigned BSR1 : 1;
212 unsigned BSR2 : 1;
213 unsigned BSR3 : 1;
214 unsigned BSR4 : 1;
215 unsigned : 1;
216 unsigned : 1;
217 unsigned : 1;
220 struct
222 unsigned BSR : 5;
223 unsigned : 3;
225 } __BSRbits_t;
227 extern __at(0x0008) volatile __BSRbits_t BSRbits;
229 #define _BSR0 0x01
230 #define _BSR1 0x02
231 #define _BSR2 0x04
232 #define _BSR3 0x08
233 #define _BSR4 0x10
235 //==============================================================================
237 extern __at(0x0009) __sfr WREG;
238 extern __at(0x000A) __sfr PCLATH;
240 //==============================================================================
241 // INTCON Bits
243 extern __at(0x000B) __sfr INTCON;
245 typedef union
247 struct
249 unsigned IOCIF : 1;
250 unsigned INTF : 1;
251 unsigned TMR0IF : 1;
252 unsigned IOCIE : 1;
253 unsigned INTE : 1;
254 unsigned TMR0IE : 1;
255 unsigned PEIE : 1;
256 unsigned GIE : 1;
259 struct
261 unsigned : 1;
262 unsigned : 1;
263 unsigned T0IF : 1;
264 unsigned : 1;
265 unsigned : 1;
266 unsigned T0IE : 1;
267 unsigned : 1;
268 unsigned : 1;
270 } __INTCONbits_t;
272 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
274 #define _IOCIF 0x01
275 #define _INTF 0x02
276 #define _TMR0IF 0x04
277 #define _T0IF 0x04
278 #define _IOCIE 0x08
279 #define _INTE 0x10
280 #define _TMR0IE 0x20
281 #define _T0IE 0x20
282 #define _PEIE 0x40
283 #define _GIE 0x80
285 //==============================================================================
288 //==============================================================================
289 // PORTA Bits
291 extern __at(0x000C) __sfr PORTA;
293 typedef struct
295 unsigned RA0 : 1;
296 unsigned RA1 : 1;
297 unsigned RA2 : 1;
298 unsigned RA3 : 1;
299 unsigned RA4 : 1;
300 unsigned RA5 : 1;
301 unsigned RA6 : 1;
302 unsigned RA7 : 1;
303 } __PORTAbits_t;
305 extern __at(0x000C) volatile __PORTAbits_t PORTAbits;
307 #define _RA0 0x01
308 #define _RA1 0x02
309 #define _RA2 0x04
310 #define _RA3 0x08
311 #define _RA4 0x10
312 #define _RA5 0x20
313 #define _RA6 0x40
314 #define _RA7 0x80
316 //==============================================================================
319 //==============================================================================
320 // PORTB Bits
322 extern __at(0x000D) __sfr PORTB;
324 typedef struct
326 unsigned RB0 : 1;
327 unsigned RB1 : 1;
328 unsigned RB2 : 1;
329 unsigned RB3 : 1;
330 unsigned RB4 : 1;
331 unsigned RB5 : 1;
332 unsigned RB6 : 1;
333 unsigned RB7 : 1;
334 } __PORTBbits_t;
336 extern __at(0x000D) volatile __PORTBbits_t PORTBbits;
338 #define _RB0 0x01
339 #define _RB1 0x02
340 #define _RB2 0x04
341 #define _RB3 0x08
342 #define _RB4 0x10
343 #define _RB5 0x20
344 #define _RB6 0x40
345 #define _RB7 0x80
347 //==============================================================================
350 //==============================================================================
351 // PORTC Bits
353 extern __at(0x000E) __sfr PORTC;
355 typedef struct
357 unsigned RC0 : 1;
358 unsigned RC1 : 1;
359 unsigned RC2 : 1;
360 unsigned RC3 : 1;
361 unsigned RC4 : 1;
362 unsigned RC5 : 1;
363 unsigned RC6 : 1;
364 unsigned RC7 : 1;
365 } __PORTCbits_t;
367 extern __at(0x000E) volatile __PORTCbits_t PORTCbits;
369 #define _RC0 0x01
370 #define _RC1 0x02
371 #define _RC2 0x04
372 #define _RC3 0x08
373 #define _RC4 0x10
374 #define _RC5 0x20
375 #define _RC6 0x40
376 #define _RC7 0x80
378 //==============================================================================
381 //==============================================================================
382 // PORTD Bits
384 extern __at(0x000F) __sfr PORTD;
386 typedef struct
388 unsigned RD0 : 1;
389 unsigned RD1 : 1;
390 unsigned RD2 : 1;
391 unsigned RD3 : 1;
392 unsigned RD4 : 1;
393 unsigned RD5 : 1;
394 unsigned RD6 : 1;
395 unsigned RD7 : 1;
396 } __PORTDbits_t;
398 extern __at(0x000F) volatile __PORTDbits_t PORTDbits;
400 #define _RD0 0x01
401 #define _RD1 0x02
402 #define _RD2 0x04
403 #define _RD3 0x08
404 #define _RD4 0x10
405 #define _RD5 0x20
406 #define _RD6 0x40
407 #define _RD7 0x80
409 //==============================================================================
412 //==============================================================================
413 // PORTE Bits
415 extern __at(0x0010) __sfr PORTE;
417 typedef union
419 struct
421 unsigned RE0 : 1;
422 unsigned RE1 : 1;
423 unsigned RE2 : 1;
424 unsigned RE3 : 1;
425 unsigned : 1;
426 unsigned : 1;
427 unsigned : 1;
428 unsigned : 1;
431 struct
433 unsigned RE : 4;
434 unsigned : 4;
436 } __PORTEbits_t;
438 extern __at(0x0010) volatile __PORTEbits_t PORTEbits;
440 #define _RE0 0x01
441 #define _RE1 0x02
442 #define _RE2 0x04
443 #define _RE3 0x08
445 //==============================================================================
448 //==============================================================================
449 // PIR1 Bits
451 extern __at(0x0011) __sfr PIR1;
453 typedef struct
455 unsigned TMR1IF : 1;
456 unsigned TMR2IF : 1;
457 unsigned CCP1IF : 1;
458 unsigned SSPIF : 1;
459 unsigned TXIF : 1;
460 unsigned RCIF : 1;
461 unsigned ADIF : 1;
462 unsigned TMR1GIF : 1;
463 } __PIR1bits_t;
465 extern __at(0x0011) volatile __PIR1bits_t PIR1bits;
467 #define _TMR1IF 0x01
468 #define _TMR2IF 0x02
469 #define _CCP1IF 0x04
470 #define _SSPIF 0x08
471 #define _TXIF 0x10
472 #define _RCIF 0x20
473 #define _ADIF 0x40
474 #define _TMR1GIF 0x80
476 //==============================================================================
479 //==============================================================================
480 // PIR2 Bits
482 extern __at(0x0012) __sfr PIR2;
484 typedef struct
486 unsigned CCP2IF : 1;
487 unsigned : 1;
488 unsigned : 1;
489 unsigned BCLIF : 1;
490 unsigned : 1;
491 unsigned : 1;
492 unsigned : 1;
493 unsigned OSFIF : 1;
494 } __PIR2bits_t;
496 extern __at(0x0012) volatile __PIR2bits_t PIR2bits;
498 #define _CCP2IF 0x01
499 #define _BCLIF 0x08
500 #define _OSFIF 0x80
502 //==============================================================================
504 extern __at(0x0015) __sfr TMR0;
505 extern __at(0x0016) __sfr TMR1;
506 extern __at(0x0016) __sfr TMR1L;
507 extern __at(0x0017) __sfr TMR1H;
509 //==============================================================================
510 // T1CON Bits
512 extern __at(0x0018) __sfr T1CON;
514 typedef union
516 struct
518 unsigned TMR1ON : 1;
519 unsigned : 1;
520 unsigned NOT_T1SYNC : 1;
521 unsigned T1OSCEN : 1;
522 unsigned T1CKPS0 : 1;
523 unsigned T1CKPS1 : 1;
524 unsigned TMR1CS0 : 1;
525 unsigned TMR1CS1 : 1;
528 struct
530 unsigned : 4;
531 unsigned T1CKPS : 2;
532 unsigned : 2;
535 struct
537 unsigned : 6;
538 unsigned TMR1CS : 2;
540 } __T1CONbits_t;
542 extern __at(0x0018) volatile __T1CONbits_t T1CONbits;
544 #define _TMR1ON 0x01
545 #define _NOT_T1SYNC 0x04
546 #define _T1OSCEN 0x08
547 #define _T1CKPS0 0x10
548 #define _T1CKPS1 0x20
549 #define _TMR1CS0 0x40
550 #define _TMR1CS1 0x80
552 //==============================================================================
555 //==============================================================================
556 // T1GCON Bits
558 extern __at(0x0019) __sfr T1GCON;
560 typedef union
562 struct
564 unsigned T1GSS0 : 1;
565 unsigned T1GSS1 : 1;
566 unsigned T1GVAL : 1;
567 unsigned T1GGO_NOT_DONE : 1;
568 unsigned T1GSPM : 1;
569 unsigned T1GTM : 1;
570 unsigned T1GPOL : 1;
571 unsigned TMR1GE : 1;
574 struct
576 unsigned T1GSS : 2;
577 unsigned : 6;
579 } __T1GCONbits_t;
581 extern __at(0x0019) volatile __T1GCONbits_t T1GCONbits;
583 #define _T1GSS0 0x01
584 #define _T1GSS1 0x02
585 #define _T1GVAL 0x04
586 #define _T1GGO_NOT_DONE 0x08
587 #define _T1GSPM 0x10
588 #define _T1GTM 0x20
589 #define _T1GPOL 0x40
590 #define _TMR1GE 0x80
592 //==============================================================================
594 extern __at(0x001A) __sfr TMR2;
595 extern __at(0x001B) __sfr PR2;
597 //==============================================================================
598 // T2CON Bits
600 extern __at(0x001C) __sfr T2CON;
602 typedef union
604 struct
606 unsigned T2CKPS0 : 1;
607 unsigned T2CKPS1 : 1;
608 unsigned TMR2ON : 1;
609 unsigned T2OUTPS0 : 1;
610 unsigned T2OUTPS1 : 1;
611 unsigned T2OUTPS2 : 1;
612 unsigned T2OUTPS3 : 1;
613 unsigned : 1;
616 struct
618 unsigned T2CKPS : 2;
619 unsigned : 6;
622 struct
624 unsigned : 3;
625 unsigned T2OUTPS : 4;
626 unsigned : 1;
628 } __T2CONbits_t;
630 extern __at(0x001C) volatile __T2CONbits_t T2CONbits;
632 #define _T2CKPS0 0x01
633 #define _T2CKPS1 0x02
634 #define _TMR2ON 0x04
635 #define _T2OUTPS0 0x08
636 #define _T2OUTPS1 0x10
637 #define _T2OUTPS2 0x20
638 #define _T2OUTPS3 0x40
640 //==============================================================================
643 //==============================================================================
644 // TRISA Bits
646 extern __at(0x008C) __sfr TRISA;
648 typedef struct
650 unsigned TRISA0 : 1;
651 unsigned TRISA1 : 1;
652 unsigned TRISA2 : 1;
653 unsigned TRISA3 : 1;
654 unsigned TRISA4 : 1;
655 unsigned TRISA5 : 1;
656 unsigned TRISA6 : 1;
657 unsigned TRISA7 : 1;
658 } __TRISAbits_t;
660 extern __at(0x008C) volatile __TRISAbits_t TRISAbits;
662 #define _TRISA0 0x01
663 #define _TRISA1 0x02
664 #define _TRISA2 0x04
665 #define _TRISA3 0x08
666 #define _TRISA4 0x10
667 #define _TRISA5 0x20
668 #define _TRISA6 0x40
669 #define _TRISA7 0x80
671 //==============================================================================
674 //==============================================================================
675 // TRISB Bits
677 extern __at(0x008D) __sfr TRISB;
679 typedef struct
681 unsigned TRISB0 : 1;
682 unsigned TRISB1 : 1;
683 unsigned TRISB2 : 1;
684 unsigned TRISB3 : 1;
685 unsigned TRISB4 : 1;
686 unsigned TRISB5 : 1;
687 unsigned TRISB6 : 1;
688 unsigned TRISB7 : 1;
689 } __TRISBbits_t;
691 extern __at(0x008D) volatile __TRISBbits_t TRISBbits;
693 #define _TRISB0 0x01
694 #define _TRISB1 0x02
695 #define _TRISB2 0x04
696 #define _TRISB3 0x08
697 #define _TRISB4 0x10
698 #define _TRISB5 0x20
699 #define _TRISB6 0x40
700 #define _TRISB7 0x80
702 //==============================================================================
705 //==============================================================================
706 // TRISC Bits
708 extern __at(0x008E) __sfr TRISC;
710 typedef struct
712 unsigned TRISC0 : 1;
713 unsigned TRISC1 : 1;
714 unsigned TRISC2 : 1;
715 unsigned TRISC3 : 1;
716 unsigned TRISC4 : 1;
717 unsigned TRISC5 : 1;
718 unsigned TRISC6 : 1;
719 unsigned TRISC7 : 1;
720 } __TRISCbits_t;
722 extern __at(0x008E) volatile __TRISCbits_t TRISCbits;
724 #define _TRISC0 0x01
725 #define _TRISC1 0x02
726 #define _TRISC2 0x04
727 #define _TRISC3 0x08
728 #define _TRISC4 0x10
729 #define _TRISC5 0x20
730 #define _TRISC6 0x40
731 #define _TRISC7 0x80
733 //==============================================================================
736 //==============================================================================
737 // TRISD Bits
739 extern __at(0x008F) __sfr TRISD;
741 typedef struct
743 unsigned TRISD0 : 1;
744 unsigned TRISD1 : 1;
745 unsigned TRISD2 : 1;
746 unsigned TRISD3 : 1;
747 unsigned TRISD4 : 1;
748 unsigned TRISD5 : 1;
749 unsigned TRISD6 : 1;
750 unsigned TRISD7 : 1;
751 } __TRISDbits_t;
753 extern __at(0x008F) volatile __TRISDbits_t TRISDbits;
755 #define _TRISD0 0x01
756 #define _TRISD1 0x02
757 #define _TRISD2 0x04
758 #define _TRISD3 0x08
759 #define _TRISD4 0x10
760 #define _TRISD5 0x20
761 #define _TRISD6 0x40
762 #define _TRISD7 0x80
764 //==============================================================================
767 //==============================================================================
768 // TRISE Bits
770 extern __at(0x0090) __sfr TRISE;
772 typedef union
774 struct
776 unsigned TRISE0 : 1;
777 unsigned TRISE1 : 1;
778 unsigned TRISE2 : 1;
779 unsigned : 1;
780 unsigned : 1;
781 unsigned : 1;
782 unsigned : 1;
783 unsigned : 1;
786 struct
788 unsigned TRISE : 3;
789 unsigned : 5;
791 } __TRISEbits_t;
793 extern __at(0x0090) volatile __TRISEbits_t TRISEbits;
795 #define _TRISE0 0x01
796 #define _TRISE1 0x02
797 #define _TRISE2 0x04
799 //==============================================================================
802 //==============================================================================
803 // PIE1 Bits
805 extern __at(0x0091) __sfr PIE1;
807 typedef struct
809 unsigned TMR1IE : 1;
810 unsigned TMR2IE : 1;
811 unsigned CCP1IE : 1;
812 unsigned SSPIE : 1;
813 unsigned TXIE : 1;
814 unsigned RCIE : 1;
815 unsigned ADIE : 1;
816 unsigned TMR1GIE : 1;
817 } __PIE1bits_t;
819 extern __at(0x0091) volatile __PIE1bits_t PIE1bits;
821 #define _TMR1IE 0x01
822 #define _TMR2IE 0x02
823 #define _CCP1IE 0x04
824 #define _SSPIE 0x08
825 #define _TXIE 0x10
826 #define _RCIE 0x20
827 #define _ADIE 0x40
828 #define _TMR1GIE 0x80
830 //==============================================================================
833 //==============================================================================
834 // PIE2 Bits
836 extern __at(0x0092) __sfr PIE2;
838 typedef struct
840 unsigned CCP2IE : 1;
841 unsigned : 1;
842 unsigned : 1;
843 unsigned BCLIE : 1;
844 unsigned : 1;
845 unsigned : 1;
846 unsigned : 1;
847 unsigned OSFIE : 1;
848 } __PIE2bits_t;
850 extern __at(0x0092) volatile __PIE2bits_t PIE2bits;
852 #define _CCP2IE 0x01
853 #define _BCLIE 0x08
854 #define _OSFIE 0x80
856 //==============================================================================
859 //==============================================================================
860 // OPTION_REG Bits
862 extern __at(0x0095) __sfr OPTION_REG;
864 typedef union
866 struct
868 unsigned PS0 : 1;
869 unsigned PS1 : 1;
870 unsigned PS2 : 1;
871 unsigned PSA : 1;
872 unsigned TMR0SE : 1;
873 unsigned TMR0CS : 1;
874 unsigned INTEDG : 1;
875 unsigned NOT_WPUEN : 1;
878 struct
880 unsigned : 1;
881 unsigned : 1;
882 unsigned : 1;
883 unsigned : 1;
884 unsigned T0SE : 1;
885 unsigned T0CS : 1;
886 unsigned : 1;
887 unsigned : 1;
890 struct
892 unsigned PS : 3;
893 unsigned : 5;
895 } __OPTION_REGbits_t;
897 extern __at(0x0095) volatile __OPTION_REGbits_t OPTION_REGbits;
899 #define _PS0 0x01
900 #define _PS1 0x02
901 #define _PS2 0x04
902 #define _PSA 0x08
903 #define _TMR0SE 0x10
904 #define _T0SE 0x10
905 #define _TMR0CS 0x20
906 #define _T0CS 0x20
907 #define _INTEDG 0x40
908 #define _NOT_WPUEN 0x80
910 //==============================================================================
913 //==============================================================================
914 // PCON Bits
916 extern __at(0x0096) __sfr PCON;
918 typedef struct
920 unsigned NOT_BOR : 1;
921 unsigned NOT_POR : 1;
922 unsigned NOT_RI : 1;
923 unsigned NOT_RMCLR : 1;
924 unsigned NOT_RWDT : 1;
925 unsigned : 1;
926 unsigned STKUNF : 1;
927 unsigned STKOVF : 1;
928 } __PCONbits_t;
930 extern __at(0x0096) volatile __PCONbits_t PCONbits;
932 #define _NOT_BOR 0x01
933 #define _NOT_POR 0x02
934 #define _NOT_RI 0x04
935 #define _NOT_RMCLR 0x08
936 #define _NOT_RWDT 0x10
937 #define _STKUNF 0x40
938 #define _STKOVF 0x80
940 //==============================================================================
943 //==============================================================================
944 // WDTCON Bits
946 extern __at(0x0097) __sfr WDTCON;
948 typedef union
950 struct
952 unsigned SWDTEN : 1;
953 unsigned WDTPS0 : 1;
954 unsigned WDTPS1 : 1;
955 unsigned WDTPS2 : 1;
956 unsigned WDTPS3 : 1;
957 unsigned WDTPS4 : 1;
958 unsigned : 1;
959 unsigned : 1;
962 struct
964 unsigned : 1;
965 unsigned WDTPS : 5;
966 unsigned : 2;
968 } __WDTCONbits_t;
970 extern __at(0x0097) volatile __WDTCONbits_t WDTCONbits;
972 #define _SWDTEN 0x01
973 #define _WDTPS0 0x02
974 #define _WDTPS1 0x04
975 #define _WDTPS2 0x08
976 #define _WDTPS3 0x10
977 #define _WDTPS4 0x20
979 //==============================================================================
982 //==============================================================================
983 // OSCCON Bits
985 extern __at(0x0099) __sfr OSCCON;
987 typedef union
989 struct
991 unsigned SCS0 : 1;
992 unsigned SCS1 : 1;
993 unsigned : 1;
994 unsigned IRCF0 : 1;
995 unsigned IRCF1 : 1;
996 unsigned IRCF2 : 1;
997 unsigned IRCF3 : 1;
998 unsigned : 1;
1001 struct
1003 unsigned SCS : 2;
1004 unsigned : 6;
1007 struct
1009 unsigned : 3;
1010 unsigned IRCF : 4;
1011 unsigned : 1;
1013 } __OSCCONbits_t;
1015 extern __at(0x0099) volatile __OSCCONbits_t OSCCONbits;
1017 #define _SCS0 0x01
1018 #define _SCS1 0x02
1019 #define _IRCF0 0x08
1020 #define _IRCF1 0x10
1021 #define _IRCF2 0x20
1022 #define _IRCF3 0x40
1024 //==============================================================================
1027 //==============================================================================
1028 // OSCSTAT Bits
1030 extern __at(0x009A) __sfr OSCSTAT;
1032 typedef union
1034 struct
1036 unsigned HFIOFS : 1;
1037 unsigned LFIOFR : 1;
1038 unsigned : 1;
1039 unsigned : 1;
1040 unsigned HFIOFR : 1;
1041 unsigned OSTS : 1;
1042 unsigned : 1;
1043 unsigned SOSCR : 1;
1046 struct
1048 unsigned : 1;
1049 unsigned : 1;
1050 unsigned : 1;
1051 unsigned : 1;
1052 unsigned : 1;
1053 unsigned : 1;
1054 unsigned : 1;
1055 unsigned T1OSCR : 1;
1057 } __OSCSTATbits_t;
1059 extern __at(0x009A) volatile __OSCSTATbits_t OSCSTATbits;
1061 #define _HFIOFS 0x01
1062 #define _LFIOFR 0x02
1063 #define _HFIOFR 0x10
1064 #define _OSTS 0x20
1065 #define _SOSCR 0x80
1066 #define _T1OSCR 0x80
1068 //==============================================================================
1070 extern __at(0x009B) __sfr ADRES;
1071 extern __at(0x009B) __sfr ADRESL;
1072 extern __at(0x009C) __sfr ADRESH;
1074 //==============================================================================
1075 // ADCON0 Bits
1077 extern __at(0x009D) __sfr ADCON0;
1079 typedef union
1081 struct
1083 unsigned ADON : 1;
1084 unsigned GO_NOT_DONE : 1;
1085 unsigned CHS0 : 1;
1086 unsigned CHS1 : 1;
1087 unsigned CHS2 : 1;
1088 unsigned CHS3 : 1;
1089 unsigned CHS4 : 1;
1090 unsigned : 1;
1093 struct
1095 unsigned : 1;
1096 unsigned ADGO : 1;
1097 unsigned : 1;
1098 unsigned : 1;
1099 unsigned : 1;
1100 unsigned : 1;
1101 unsigned : 1;
1102 unsigned : 1;
1105 struct
1107 unsigned : 1;
1108 unsigned GO : 1;
1109 unsigned : 1;
1110 unsigned : 1;
1111 unsigned : 1;
1112 unsigned : 1;
1113 unsigned : 1;
1114 unsigned : 1;
1117 struct
1119 unsigned : 2;
1120 unsigned CHS : 5;
1121 unsigned : 1;
1123 } __ADCON0bits_t;
1125 extern __at(0x009D) volatile __ADCON0bits_t ADCON0bits;
1127 #define _ADON 0x01
1128 #define _GO_NOT_DONE 0x02
1129 #define _ADGO 0x02
1130 #define _GO 0x02
1131 #define _CHS0 0x04
1132 #define _CHS1 0x08
1133 #define _CHS2 0x10
1134 #define _CHS3 0x20
1135 #define _CHS4 0x40
1137 //==============================================================================
1140 //==============================================================================
1141 // ADCON1 Bits
1143 extern __at(0x009E) __sfr ADCON1;
1145 typedef union
1147 struct
1149 unsigned ADPREF0 : 1;
1150 unsigned ADPREF1 : 1;
1151 unsigned : 1;
1152 unsigned : 1;
1153 unsigned ADCS0 : 1;
1154 unsigned ADCS1 : 1;
1155 unsigned ADCS2 : 1;
1156 unsigned ADFM : 1;
1159 struct
1161 unsigned ADPREF : 2;
1162 unsigned : 6;
1165 struct
1167 unsigned : 4;
1168 unsigned ADCS : 3;
1169 unsigned : 1;
1171 } __ADCON1bits_t;
1173 extern __at(0x009E) volatile __ADCON1bits_t ADCON1bits;
1175 #define _ADPREF0 0x01
1176 #define _ADPREF1 0x02
1177 #define _ADCS0 0x10
1178 #define _ADCS1 0x20
1179 #define _ADCS2 0x40
1180 #define _ADFM 0x80
1182 //==============================================================================
1185 //==============================================================================
1186 // LATA Bits
1188 extern __at(0x010C) __sfr LATA;
1190 typedef struct
1192 unsigned LATA0 : 1;
1193 unsigned LATA1 : 1;
1194 unsigned LATA2 : 1;
1195 unsigned LATA3 : 1;
1196 unsigned LATA4 : 1;
1197 unsigned LATA5 : 1;
1198 unsigned LATA6 : 1;
1199 unsigned LATA7 : 1;
1200 } __LATAbits_t;
1202 extern __at(0x010C) volatile __LATAbits_t LATAbits;
1204 #define _LATA0 0x01
1205 #define _LATA1 0x02
1206 #define _LATA2 0x04
1207 #define _LATA3 0x08
1208 #define _LATA4 0x10
1209 #define _LATA5 0x20
1210 #define _LATA6 0x40
1211 #define _LATA7 0x80
1213 //==============================================================================
1216 //==============================================================================
1217 // LATB Bits
1219 extern __at(0x010D) __sfr LATB;
1221 typedef struct
1223 unsigned LATB0 : 1;
1224 unsigned LATB1 : 1;
1225 unsigned LATB2 : 1;
1226 unsigned LATB3 : 1;
1227 unsigned LATB4 : 1;
1228 unsigned LATB5 : 1;
1229 unsigned LATB6 : 1;
1230 unsigned LATB7 : 1;
1231 } __LATBbits_t;
1233 extern __at(0x010D) volatile __LATBbits_t LATBbits;
1235 #define _LATB0 0x01
1236 #define _LATB1 0x02
1237 #define _LATB2 0x04
1238 #define _LATB3 0x08
1239 #define _LATB4 0x10
1240 #define _LATB5 0x20
1241 #define _LATB6 0x40
1242 #define _LATB7 0x80
1244 //==============================================================================
1247 //==============================================================================
1248 // LATC Bits
1250 extern __at(0x010E) __sfr LATC;
1252 typedef struct
1254 unsigned LATC0 : 1;
1255 unsigned LATC1 : 1;
1256 unsigned LATC2 : 1;
1257 unsigned LATC3 : 1;
1258 unsigned LATC4 : 1;
1259 unsigned LATC5 : 1;
1260 unsigned LATC6 : 1;
1261 unsigned LATC7 : 1;
1262 } __LATCbits_t;
1264 extern __at(0x010E) volatile __LATCbits_t LATCbits;
1266 #define _LATC0 0x01
1267 #define _LATC1 0x02
1268 #define _LATC2 0x04
1269 #define _LATC3 0x08
1270 #define _LATC4 0x10
1271 #define _LATC5 0x20
1272 #define _LATC6 0x40
1273 #define _LATC7 0x80
1275 //==============================================================================
1278 //==============================================================================
1279 // LATD Bits
1281 extern __at(0x010F) __sfr LATD;
1283 typedef struct
1285 unsigned LATD0 : 1;
1286 unsigned LATD1 : 1;
1287 unsigned LATD2 : 1;
1288 unsigned LATD3 : 1;
1289 unsigned LATD4 : 1;
1290 unsigned LATD5 : 1;
1291 unsigned LATD6 : 1;
1292 unsigned LATD7 : 1;
1293 } __LATDbits_t;
1295 extern __at(0x010F) volatile __LATDbits_t LATDbits;
1297 #define _LATD0 0x01
1298 #define _LATD1 0x02
1299 #define _LATD2 0x04
1300 #define _LATD3 0x08
1301 #define _LATD4 0x10
1302 #define _LATD5 0x20
1303 #define _LATD6 0x40
1304 #define _LATD7 0x80
1306 //==============================================================================
1309 //==============================================================================
1310 // LATE Bits
1312 extern __at(0x0110) __sfr LATE;
1314 typedef union
1316 struct
1318 unsigned LATE0 : 1;
1319 unsigned LATE1 : 1;
1320 unsigned LATE2 : 1;
1321 unsigned : 1;
1322 unsigned : 1;
1323 unsigned : 1;
1324 unsigned : 1;
1325 unsigned : 1;
1328 struct
1330 unsigned LATE : 3;
1331 unsigned : 5;
1333 } __LATEbits_t;
1335 extern __at(0x0110) volatile __LATEbits_t LATEbits;
1337 #define _LATE0 0x01
1338 #define _LATE1 0x02
1339 #define _LATE2 0x04
1341 //==============================================================================
1344 //==============================================================================
1345 // BORCON Bits
1347 extern __at(0x0116) __sfr BORCON;
1349 typedef struct
1351 unsigned BORRDY : 1;
1352 unsigned : 1;
1353 unsigned : 1;
1354 unsigned : 1;
1355 unsigned : 1;
1356 unsigned : 1;
1357 unsigned BORFS : 1;
1358 unsigned SBOREN : 1;
1359 } __BORCONbits_t;
1361 extern __at(0x0116) volatile __BORCONbits_t BORCONbits;
1363 #define _BORRDY 0x01
1364 #define _BORFS 0x40
1365 #define _SBOREN 0x80
1367 //==============================================================================
1370 //==============================================================================
1371 // FVRCON Bits
1373 extern __at(0x0117) __sfr FVRCON;
1375 typedef union
1377 struct
1379 unsigned ADFVR0 : 1;
1380 unsigned ADFVR1 : 1;
1381 unsigned : 1;
1382 unsigned : 1;
1383 unsigned TSRNG : 1;
1384 unsigned TSEN : 1;
1385 unsigned FVRRDY : 1;
1386 unsigned FVREN : 1;
1389 struct
1391 unsigned ADFVR : 2;
1392 unsigned : 6;
1394 } __FVRCONbits_t;
1396 extern __at(0x0117) volatile __FVRCONbits_t FVRCONbits;
1398 #define _ADFVR0 0x01
1399 #define _ADFVR1 0x02
1400 #define _TSRNG 0x10
1401 #define _TSEN 0x20
1402 #define _FVRRDY 0x40
1403 #define _FVREN 0x80
1405 //==============================================================================
1408 //==============================================================================
1409 // APFCON Bits
1411 extern __at(0x011D) __sfr APFCON;
1413 typedef struct
1415 unsigned CCP2SEL : 1;
1416 unsigned SSSEL : 1;
1417 unsigned : 1;
1418 unsigned : 1;
1419 unsigned : 1;
1420 unsigned : 1;
1421 unsigned : 1;
1422 unsigned : 1;
1423 } __APFCONbits_t;
1425 extern __at(0x011D) volatile __APFCONbits_t APFCONbits;
1427 #define _CCP2SEL 0x01
1428 #define _SSSEL 0x02
1430 //==============================================================================
1433 //==============================================================================
1434 // ANSELA Bits
1436 extern __at(0x018C) __sfr ANSELA;
1438 typedef struct
1440 unsigned ANSA0 : 1;
1441 unsigned ANSA1 : 1;
1442 unsigned ANSA2 : 1;
1443 unsigned ANSA3 : 1;
1444 unsigned : 1;
1445 unsigned ANSA5 : 1;
1446 unsigned : 1;
1447 unsigned : 1;
1448 } __ANSELAbits_t;
1450 extern __at(0x018C) volatile __ANSELAbits_t ANSELAbits;
1452 #define _ANSA0 0x01
1453 #define _ANSA1 0x02
1454 #define _ANSA2 0x04
1455 #define _ANSA3 0x08
1456 #define _ANSA5 0x20
1458 //==============================================================================
1461 //==============================================================================
1462 // ANSELB Bits
1464 extern __at(0x018D) __sfr ANSELB;
1466 typedef union
1468 struct
1470 unsigned ANSB0 : 1;
1471 unsigned ANSB1 : 1;
1472 unsigned ANSB2 : 1;
1473 unsigned ANSB3 : 1;
1474 unsigned ANSB4 : 1;
1475 unsigned ANSB5 : 1;
1476 unsigned : 1;
1477 unsigned : 1;
1480 struct
1482 unsigned ANSB : 6;
1483 unsigned : 2;
1485 } __ANSELBbits_t;
1487 extern __at(0x018D) volatile __ANSELBbits_t ANSELBbits;
1489 #define _ANSB0 0x01
1490 #define _ANSB1 0x02
1491 #define _ANSB2 0x04
1492 #define _ANSB3 0x08
1493 #define _ANSB4 0x10
1494 #define _ANSB5 0x20
1496 //==============================================================================
1499 //==============================================================================
1500 // ANSELC Bits
1502 extern __at(0x018E) __sfr ANSELC;
1504 typedef struct
1506 unsigned : 1;
1507 unsigned : 1;
1508 unsigned ANSC2 : 1;
1509 unsigned ANSC3 : 1;
1510 unsigned ANSC4 : 1;
1511 unsigned ANSC5 : 1;
1512 unsigned ANSC6 : 1;
1513 unsigned ANSC7 : 1;
1514 } __ANSELCbits_t;
1516 extern __at(0x018E) volatile __ANSELCbits_t ANSELCbits;
1518 #define _ANSC2 0x04
1519 #define _ANSC3 0x08
1520 #define _ANSC4 0x10
1521 #define _ANSC5 0x20
1522 #define _ANSC6 0x40
1523 #define _ANSC7 0x80
1525 //==============================================================================
1528 //==============================================================================
1529 // ANSELD Bits
1531 extern __at(0x018F) __sfr ANSELD;
1533 typedef struct
1535 unsigned ANSD0 : 1;
1536 unsigned ANSD1 : 1;
1537 unsigned ANSD2 : 1;
1538 unsigned ANSD3 : 1;
1539 unsigned ANSD4 : 1;
1540 unsigned ANSD5 : 1;
1541 unsigned ANSD6 : 1;
1542 unsigned ANSD7 : 1;
1543 } __ANSELDbits_t;
1545 extern __at(0x018F) volatile __ANSELDbits_t ANSELDbits;
1547 #define _ANSD0 0x01
1548 #define _ANSD1 0x02
1549 #define _ANSD2 0x04
1550 #define _ANSD3 0x08
1551 #define _ANSD4 0x10
1552 #define _ANSD5 0x20
1553 #define _ANSD6 0x40
1554 #define _ANSD7 0x80
1556 //==============================================================================
1559 //==============================================================================
1560 // ANSELE Bits
1562 extern __at(0x0190) __sfr ANSELE;
1564 typedef union
1566 struct
1568 unsigned ANSE0 : 1;
1569 unsigned ANSE1 : 1;
1570 unsigned ANSE2 : 1;
1571 unsigned : 1;
1572 unsigned : 1;
1573 unsigned : 1;
1574 unsigned : 1;
1575 unsigned : 1;
1578 struct
1580 unsigned ANSE : 3;
1581 unsigned : 5;
1583 } __ANSELEbits_t;
1585 extern __at(0x0190) volatile __ANSELEbits_t ANSELEbits;
1587 #define _ANSE0 0x01
1588 #define _ANSE1 0x02
1589 #define _ANSE2 0x04
1591 //==============================================================================
1593 extern __at(0x0191) __sfr PMADR;
1594 extern __at(0x0191) __sfr PMADRL;
1595 extern __at(0x0192) __sfr PMADRH;
1596 extern __at(0x0193) __sfr PMDAT;
1597 extern __at(0x0193) __sfr PMDATL;
1598 extern __at(0x0194) __sfr PMDATH;
1600 //==============================================================================
1601 // PMCON1 Bits
1603 extern __at(0x0195) __sfr PMCON1;
1605 typedef struct
1607 unsigned RD : 1;
1608 unsigned WR : 1;
1609 unsigned WREN : 1;
1610 unsigned WRERR : 1;
1611 unsigned FREE : 1;
1612 unsigned LWLO : 1;
1613 unsigned CFGS : 1;
1614 unsigned : 1;
1615 } __PMCON1bits_t;
1617 extern __at(0x0195) volatile __PMCON1bits_t PMCON1bits;
1619 #define _RD 0x01
1620 #define _WR 0x02
1621 #define _WREN 0x04
1622 #define _WRERR 0x08
1623 #define _FREE 0x10
1624 #define _LWLO 0x20
1625 #define _CFGS 0x40
1627 //==============================================================================
1629 extern __at(0x0196) __sfr PMCON2;
1630 extern __at(0x0199) __sfr RCREG;
1631 extern __at(0x019A) __sfr TXREG;
1632 extern __at(0x019B) __sfr SP1BRG;
1633 extern __at(0x019B) __sfr SP1BRGL;
1634 extern __at(0x019B) __sfr SPBRG;
1635 extern __at(0x019B) __sfr SPBRGL;
1636 extern __at(0x019C) __sfr SP1BRGH;
1637 extern __at(0x019C) __sfr SPBRGH;
1639 //==============================================================================
1640 // RCSTA Bits
1642 extern __at(0x019D) __sfr RCSTA;
1644 typedef struct
1646 unsigned RX9D : 1;
1647 unsigned OERR : 1;
1648 unsigned FERR : 1;
1649 unsigned ADDEN : 1;
1650 unsigned CREN : 1;
1651 unsigned SREN : 1;
1652 unsigned RX9 : 1;
1653 unsigned SPEN : 1;
1654 } __RCSTAbits_t;
1656 extern __at(0x019D) volatile __RCSTAbits_t RCSTAbits;
1658 #define _RX9D 0x01
1659 #define _OERR 0x02
1660 #define _FERR 0x04
1661 #define _ADDEN 0x08
1662 #define _CREN 0x10
1663 #define _SREN 0x20
1664 #define _RX9 0x40
1665 #define _SPEN 0x80
1667 //==============================================================================
1670 //==============================================================================
1671 // TXSTA Bits
1673 extern __at(0x019E) __sfr TXSTA;
1675 typedef struct
1677 unsigned TX9D : 1;
1678 unsigned TRMT : 1;
1679 unsigned BRGH : 1;
1680 unsigned SENDB : 1;
1681 unsigned SYNC : 1;
1682 unsigned TXEN : 1;
1683 unsigned TX9 : 1;
1684 unsigned CSRC : 1;
1685 } __TXSTAbits_t;
1687 extern __at(0x019E) volatile __TXSTAbits_t TXSTAbits;
1689 #define _TX9D 0x01
1690 #define _TRMT 0x02
1691 #define _BRGH 0x04
1692 #define _SENDB 0x08
1693 #define _SYNC 0x10
1694 #define _TXEN 0x20
1695 #define _TX9 0x40
1696 #define _CSRC 0x80
1698 //==============================================================================
1701 //==============================================================================
1702 // BAUDCON Bits
1704 extern __at(0x019F) __sfr BAUDCON;
1706 typedef struct
1708 unsigned ABDEN : 1;
1709 unsigned WUE : 1;
1710 unsigned : 1;
1711 unsigned BRG16 : 1;
1712 unsigned SCKP : 1;
1713 unsigned : 1;
1714 unsigned RCIDL : 1;
1715 unsigned ABDOVF : 1;
1716 } __BAUDCONbits_t;
1718 extern __at(0x019F) volatile __BAUDCONbits_t BAUDCONbits;
1720 #define _ABDEN 0x01
1721 #define _WUE 0x02
1722 #define _BRG16 0x08
1723 #define _SCKP 0x10
1724 #define _RCIDL 0x40
1725 #define _ABDOVF 0x80
1727 //==============================================================================
1730 //==============================================================================
1731 // WPUB Bits
1733 extern __at(0x020D) __sfr WPUB;
1735 typedef struct
1737 unsigned WPUB0 : 1;
1738 unsigned WPUB1 : 1;
1739 unsigned WPUB2 : 1;
1740 unsigned WPUB3 : 1;
1741 unsigned WPUB4 : 1;
1742 unsigned WPUB5 : 1;
1743 unsigned WPUB6 : 1;
1744 unsigned WPUB7 : 1;
1745 } __WPUBbits_t;
1747 extern __at(0x020D) volatile __WPUBbits_t WPUBbits;
1749 #define _WPUB0 0x01
1750 #define _WPUB1 0x02
1751 #define _WPUB2 0x04
1752 #define _WPUB3 0x08
1753 #define _WPUB4 0x10
1754 #define _WPUB5 0x20
1755 #define _WPUB6 0x40
1756 #define _WPUB7 0x80
1758 //==============================================================================
1761 //==============================================================================
1762 // WPUE Bits
1764 extern __at(0x0210) __sfr WPUE;
1766 typedef struct
1768 unsigned : 1;
1769 unsigned : 1;
1770 unsigned : 1;
1771 unsigned WPUE3 : 1;
1772 unsigned : 1;
1773 unsigned : 1;
1774 unsigned : 1;
1775 unsigned : 1;
1776 } __WPUEbits_t;
1778 extern __at(0x0210) volatile __WPUEbits_t WPUEbits;
1780 #define _WPUE3 0x08
1782 //==============================================================================
1784 extern __at(0x0211) __sfr SSP1BUF;
1785 extern __at(0x0211) __sfr SSPBUF;
1786 extern __at(0x0212) __sfr SSP1ADD;
1787 extern __at(0x0212) __sfr SSPADD;
1788 extern __at(0x0213) __sfr SSP1MSK;
1789 extern __at(0x0213) __sfr SSPMSK;
1791 //==============================================================================
1792 // SSP1STAT Bits
1794 extern __at(0x0214) __sfr SSP1STAT;
1796 typedef struct
1798 unsigned BF : 1;
1799 unsigned UA : 1;
1800 unsigned R_NOT_W : 1;
1801 unsigned S : 1;
1802 unsigned P : 1;
1803 unsigned D_NOT_A : 1;
1804 unsigned CKE : 1;
1805 unsigned SMP : 1;
1806 } __SSP1STATbits_t;
1808 extern __at(0x0214) volatile __SSP1STATbits_t SSP1STATbits;
1810 #define _BF 0x01
1811 #define _UA 0x02
1812 #define _R_NOT_W 0x04
1813 #define _S 0x08
1814 #define _P 0x10
1815 #define _D_NOT_A 0x20
1816 #define _CKE 0x40
1817 #define _SMP 0x80
1819 //==============================================================================
1822 //==============================================================================
1823 // SSPSTAT Bits
1825 extern __at(0x0214) __sfr SSPSTAT;
1827 typedef struct
1829 unsigned BF : 1;
1830 unsigned UA : 1;
1831 unsigned R_NOT_W : 1;
1832 unsigned S : 1;
1833 unsigned P : 1;
1834 unsigned D_NOT_A : 1;
1835 unsigned CKE : 1;
1836 unsigned SMP : 1;
1837 } __SSPSTATbits_t;
1839 extern __at(0x0214) volatile __SSPSTATbits_t SSPSTATbits;
1841 #define _SSPSTAT_BF 0x01
1842 #define _SSPSTAT_UA 0x02
1843 #define _SSPSTAT_R_NOT_W 0x04
1844 #define _SSPSTAT_S 0x08
1845 #define _SSPSTAT_P 0x10
1846 #define _SSPSTAT_D_NOT_A 0x20
1847 #define _SSPSTAT_CKE 0x40
1848 #define _SSPSTAT_SMP 0x80
1850 //==============================================================================
1853 //==============================================================================
1854 // SSP1CON1 Bits
1856 extern __at(0x0215) __sfr SSP1CON1;
1858 typedef union
1860 struct
1862 unsigned SSPM0 : 1;
1863 unsigned SSPM1 : 1;
1864 unsigned SSPM2 : 1;
1865 unsigned SSPM3 : 1;
1866 unsigned CKP : 1;
1867 unsigned SSPEN : 1;
1868 unsigned SSPOV : 1;
1869 unsigned WCOL : 1;
1872 struct
1874 unsigned SSPM : 4;
1875 unsigned : 4;
1877 } __SSP1CON1bits_t;
1879 extern __at(0x0215) volatile __SSP1CON1bits_t SSP1CON1bits;
1881 #define _SSPM0 0x01
1882 #define _SSPM1 0x02
1883 #define _SSPM2 0x04
1884 #define _SSPM3 0x08
1885 #define _CKP 0x10
1886 #define _SSPEN 0x20
1887 #define _SSPOV 0x40
1888 #define _WCOL 0x80
1890 //==============================================================================
1893 //==============================================================================
1894 // SSPCON Bits
1896 extern __at(0x0215) __sfr SSPCON;
1898 typedef union
1900 struct
1902 unsigned SSPM0 : 1;
1903 unsigned SSPM1 : 1;
1904 unsigned SSPM2 : 1;
1905 unsigned SSPM3 : 1;
1906 unsigned CKP : 1;
1907 unsigned SSPEN : 1;
1908 unsigned SSPOV : 1;
1909 unsigned WCOL : 1;
1912 struct
1914 unsigned SSPM : 4;
1915 unsigned : 4;
1917 } __SSPCONbits_t;
1919 extern __at(0x0215) volatile __SSPCONbits_t SSPCONbits;
1921 #define _SSPCON_SSPM0 0x01
1922 #define _SSPCON_SSPM1 0x02
1923 #define _SSPCON_SSPM2 0x04
1924 #define _SSPCON_SSPM3 0x08
1925 #define _SSPCON_CKP 0x10
1926 #define _SSPCON_SSPEN 0x20
1927 #define _SSPCON_SSPOV 0x40
1928 #define _SSPCON_WCOL 0x80
1930 //==============================================================================
1933 //==============================================================================
1934 // SSPCON1 Bits
1936 extern __at(0x0215) __sfr SSPCON1;
1938 typedef union
1940 struct
1942 unsigned SSPM0 : 1;
1943 unsigned SSPM1 : 1;
1944 unsigned SSPM2 : 1;
1945 unsigned SSPM3 : 1;
1946 unsigned CKP : 1;
1947 unsigned SSPEN : 1;
1948 unsigned SSPOV : 1;
1949 unsigned WCOL : 1;
1952 struct
1954 unsigned SSPM : 4;
1955 unsigned : 4;
1957 } __SSPCON1bits_t;
1959 extern __at(0x0215) volatile __SSPCON1bits_t SSPCON1bits;
1961 #define _SSPCON1_SSPM0 0x01
1962 #define _SSPCON1_SSPM1 0x02
1963 #define _SSPCON1_SSPM2 0x04
1964 #define _SSPCON1_SSPM3 0x08
1965 #define _SSPCON1_CKP 0x10
1966 #define _SSPCON1_SSPEN 0x20
1967 #define _SSPCON1_SSPOV 0x40
1968 #define _SSPCON1_WCOL 0x80
1970 //==============================================================================
1973 //==============================================================================
1974 // SSP1CON2 Bits
1976 extern __at(0x0216) __sfr SSP1CON2;
1978 typedef struct
1980 unsigned SEN : 1;
1981 unsigned RSEN : 1;
1982 unsigned PEN : 1;
1983 unsigned RCEN : 1;
1984 unsigned ACKEN : 1;
1985 unsigned ACKDT : 1;
1986 unsigned ACKSTAT : 1;
1987 unsigned GCEN : 1;
1988 } __SSP1CON2bits_t;
1990 extern __at(0x0216) volatile __SSP1CON2bits_t SSP1CON2bits;
1992 #define _SEN 0x01
1993 #define _RSEN 0x02
1994 #define _PEN 0x04
1995 #define _RCEN 0x08
1996 #define _ACKEN 0x10
1997 #define _ACKDT 0x20
1998 #define _ACKSTAT 0x40
1999 #define _GCEN 0x80
2001 //==============================================================================
2004 //==============================================================================
2005 // SSPCON2 Bits
2007 extern __at(0x0216) __sfr SSPCON2;
2009 typedef struct
2011 unsigned SEN : 1;
2012 unsigned RSEN : 1;
2013 unsigned PEN : 1;
2014 unsigned RCEN : 1;
2015 unsigned ACKEN : 1;
2016 unsigned ACKDT : 1;
2017 unsigned ACKSTAT : 1;
2018 unsigned GCEN : 1;
2019 } __SSPCON2bits_t;
2021 extern __at(0x0216) volatile __SSPCON2bits_t SSPCON2bits;
2023 #define _SSPCON2_SEN 0x01
2024 #define _SSPCON2_RSEN 0x02
2025 #define _SSPCON2_PEN 0x04
2026 #define _SSPCON2_RCEN 0x08
2027 #define _SSPCON2_ACKEN 0x10
2028 #define _SSPCON2_ACKDT 0x20
2029 #define _SSPCON2_ACKSTAT 0x40
2030 #define _SSPCON2_GCEN 0x80
2032 //==============================================================================
2035 //==============================================================================
2036 // SSP1CON3 Bits
2038 extern __at(0x0217) __sfr SSP1CON3;
2040 typedef struct
2042 unsigned DHEN : 1;
2043 unsigned AHEN : 1;
2044 unsigned SBCDE : 1;
2045 unsigned SDAHT : 1;
2046 unsigned BOEN : 1;
2047 unsigned SCIE : 1;
2048 unsigned PCIE : 1;
2049 unsigned ACKTIM : 1;
2050 } __SSP1CON3bits_t;
2052 extern __at(0x0217) volatile __SSP1CON3bits_t SSP1CON3bits;
2054 #define _DHEN 0x01
2055 #define _AHEN 0x02
2056 #define _SBCDE 0x04
2057 #define _SDAHT 0x08
2058 #define _BOEN 0x10
2059 #define _SCIE 0x20
2060 #define _PCIE 0x40
2061 #define _ACKTIM 0x80
2063 //==============================================================================
2066 //==============================================================================
2067 // SSPCON3 Bits
2069 extern __at(0x0217) __sfr SSPCON3;
2071 typedef struct
2073 unsigned DHEN : 1;
2074 unsigned AHEN : 1;
2075 unsigned SBCDE : 1;
2076 unsigned SDAHT : 1;
2077 unsigned BOEN : 1;
2078 unsigned SCIE : 1;
2079 unsigned PCIE : 1;
2080 unsigned ACKTIM : 1;
2081 } __SSPCON3bits_t;
2083 extern __at(0x0217) volatile __SSPCON3bits_t SSPCON3bits;
2085 #define _SSPCON3_DHEN 0x01
2086 #define _SSPCON3_AHEN 0x02
2087 #define _SSPCON3_SBCDE 0x04
2088 #define _SSPCON3_SDAHT 0x08
2089 #define _SSPCON3_BOEN 0x10
2090 #define _SSPCON3_SCIE 0x20
2091 #define _SSPCON3_PCIE 0x40
2092 #define _SSPCON3_ACKTIM 0x80
2094 //==============================================================================
2096 extern __at(0x0291) __sfr CCPR1;
2097 extern __at(0x0291) __sfr CCPR1L;
2098 extern __at(0x0292) __sfr CCPR1H;
2100 //==============================================================================
2101 // CCP1CON Bits
2103 extern __at(0x0293) __sfr CCP1CON;
2105 typedef union
2107 struct
2109 unsigned CCP1M0 : 1;
2110 unsigned CCP1M1 : 1;
2111 unsigned CCP1M2 : 1;
2112 unsigned CCP1M3 : 1;
2113 unsigned DC1B0 : 1;
2114 unsigned DC1B1 : 1;
2115 unsigned : 1;
2116 unsigned : 1;
2119 struct
2121 unsigned CCP1M : 4;
2122 unsigned : 4;
2125 struct
2127 unsigned : 4;
2128 unsigned DC1B : 2;
2129 unsigned : 2;
2131 } __CCP1CONbits_t;
2133 extern __at(0x0293) volatile __CCP1CONbits_t CCP1CONbits;
2135 #define _CCP1M0 0x01
2136 #define _CCP1M1 0x02
2137 #define _CCP1M2 0x04
2138 #define _CCP1M3 0x08
2139 #define _DC1B0 0x10
2140 #define _DC1B1 0x20
2142 //==============================================================================
2144 extern __at(0x0298) __sfr CCPR2;
2145 extern __at(0x0298) __sfr CCPR2L;
2146 extern __at(0x0299) __sfr CCPR2H;
2148 //==============================================================================
2149 // CCP2CON Bits
2151 extern __at(0x029A) __sfr CCP2CON;
2153 typedef union
2155 struct
2157 unsigned CCP2M0 : 1;
2158 unsigned CCP2M1 : 1;
2159 unsigned CCP2M2 : 1;
2160 unsigned CCP2M3 : 1;
2161 unsigned DC2B0 : 1;
2162 unsigned DC2B1 : 1;
2163 unsigned : 1;
2164 unsigned : 1;
2167 struct
2169 unsigned CCP2M : 4;
2170 unsigned : 4;
2173 struct
2175 unsigned : 4;
2176 unsigned DC2B : 2;
2177 unsigned : 2;
2179 } __CCP2CONbits_t;
2181 extern __at(0x029A) volatile __CCP2CONbits_t CCP2CONbits;
2183 #define _CCP2M0 0x01
2184 #define _CCP2M1 0x02
2185 #define _CCP2M2 0x04
2186 #define _CCP2M3 0x08
2187 #define _DC2B0 0x10
2188 #define _DC2B1 0x20
2190 //==============================================================================
2193 //==============================================================================
2194 // IOCBP Bits
2196 extern __at(0x0394) __sfr IOCBP;
2198 typedef struct
2200 unsigned IOCBP0 : 1;
2201 unsigned IOCBP1 : 1;
2202 unsigned IOCBP2 : 1;
2203 unsigned IOCBP3 : 1;
2204 unsigned IOCBP4 : 1;
2205 unsigned IOCBP5 : 1;
2206 unsigned IOCBP6 : 1;
2207 unsigned IOCBP7 : 1;
2208 } __IOCBPbits_t;
2210 extern __at(0x0394) volatile __IOCBPbits_t IOCBPbits;
2212 #define _IOCBP0 0x01
2213 #define _IOCBP1 0x02
2214 #define _IOCBP2 0x04
2215 #define _IOCBP3 0x08
2216 #define _IOCBP4 0x10
2217 #define _IOCBP5 0x20
2218 #define _IOCBP6 0x40
2219 #define _IOCBP7 0x80
2221 //==============================================================================
2224 //==============================================================================
2225 // IOCBN Bits
2227 extern __at(0x0395) __sfr IOCBN;
2229 typedef struct
2231 unsigned IOCBN0 : 1;
2232 unsigned IOCBN1 : 1;
2233 unsigned IOCBN2 : 1;
2234 unsigned IOCBN3 : 1;
2235 unsigned IOCBN4 : 1;
2236 unsigned IOCBN5 : 1;
2237 unsigned IOCBN6 : 1;
2238 unsigned IOCBN7 : 1;
2239 } __IOCBNbits_t;
2241 extern __at(0x0395) volatile __IOCBNbits_t IOCBNbits;
2243 #define _IOCBN0 0x01
2244 #define _IOCBN1 0x02
2245 #define _IOCBN2 0x04
2246 #define _IOCBN3 0x08
2247 #define _IOCBN4 0x10
2248 #define _IOCBN5 0x20
2249 #define _IOCBN6 0x40
2250 #define _IOCBN7 0x80
2252 //==============================================================================
2255 //==============================================================================
2256 // IOCBF Bits
2258 extern __at(0x0396) __sfr IOCBF;
2260 typedef struct
2262 unsigned IOCBF0 : 1;
2263 unsigned IOCBF1 : 1;
2264 unsigned IOCBF2 : 1;
2265 unsigned IOCBF3 : 1;
2266 unsigned IOCBF4 : 1;
2267 unsigned IOCBF5 : 1;
2268 unsigned IOCBF6 : 1;
2269 unsigned IOCBF7 : 1;
2270 } __IOCBFbits_t;
2272 extern __at(0x0396) volatile __IOCBFbits_t IOCBFbits;
2274 #define _IOCBF0 0x01
2275 #define _IOCBF1 0x02
2276 #define _IOCBF2 0x04
2277 #define _IOCBF3 0x08
2278 #define _IOCBF4 0x10
2279 #define _IOCBF5 0x20
2280 #define _IOCBF6 0x40
2281 #define _IOCBF7 0x80
2283 //==============================================================================
2286 //==============================================================================
2287 // STATUS_SHAD Bits
2289 extern __at(0x0FE4) __sfr STATUS_SHAD;
2291 typedef struct
2293 unsigned C_SHAD : 1;
2294 unsigned DC_SHAD : 1;
2295 unsigned Z_SHAD : 1;
2296 unsigned : 1;
2297 unsigned : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2300 unsigned : 1;
2301 } __STATUS_SHADbits_t;
2303 extern __at(0x0FE4) volatile __STATUS_SHADbits_t STATUS_SHADbits;
2305 #define _C_SHAD 0x01
2306 #define _DC_SHAD 0x02
2307 #define _Z_SHAD 0x04
2309 //==============================================================================
2311 extern __at(0x0FE5) __sfr WREG_SHAD;
2312 extern __at(0x0FE6) __sfr BSR_SHAD;
2313 extern __at(0x0FE7) __sfr PCLATH_SHAD;
2314 extern __at(0x0FE8) __sfr FSR0L_SHAD;
2315 extern __at(0x0FE9) __sfr FSR0H_SHAD;
2316 extern __at(0x0FEA) __sfr FSR1L_SHAD;
2317 extern __at(0x0FEB) __sfr FSR1H_SHAD;
2318 extern __at(0x0FED) __sfr STKPTR;
2319 extern __at(0x0FEE) __sfr TOSL;
2320 extern __at(0x0FEF) __sfr TOSH;
2322 //==============================================================================
2324 // Configuration Bits
2326 //==============================================================================
2328 #define _CONFIG1 0x8007
2329 #define _CONFIG2 0x8008
2331 //----------------------------- CONFIG1 Options -------------------------------
2333 #define _FOSC_LP 0x3FF8 // LP Oscillator, Low-power crystal connected between OSC1 and OSC2 pins.
2334 #define _FOSC_XT 0x3FF9 // XT Oscillator, Crystal/resonator connected between OSC1 and OSC2 pins.
2335 #define _FOSC_HS 0x3FFA // HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins.
2336 #define _FOSC_EXTRC 0x3FFB // EXTRC oscillator: External RC circuit connected to CLKIN pin.
2337 #define _FOSC_INTOSC 0x3FFC // INTOSC oscillator: I/O function on CLKIN pin.
2338 #define _FOSC_ECL 0x3FFD // ECL, External Clock, Low Power Mode (0-0.5 MHz): device clock supplied to CLKIN pin.
2339 #define _FOSC_ECM 0x3FFE // ECM, External Clock, Medium Power Mode (0.5-4 MHz): device clock supplied to CLKIN pin.
2340 #define _FOSC_ECH 0x3FFF // ECH, External Clock, High Power Mode (4-20 MHz): device clock supplied to CLKIN pin.
2341 #define _WDTE_OFF 0x3FE7 // WDT disabled.
2342 #define _WDTE_SWDTEN 0x3FEF // WDT controlled by the SWDTEN bit in the WDTCON register.
2343 #define _WDTE_NSLEEP 0x3FF7 // WDT enabled while running and disabled in Sleep.
2344 #define _WDTE_ON 0x3FFF // WDT enabled.
2345 #define _PWRTE_ON 0x3FDF // PWRT enabled.
2346 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
2347 #define _MCLRE_OFF 0x3FBF // MCLR/VPP pin function is digital input.
2348 #define _MCLRE_ON 0x3FFF // MCLR/VPP pin function is MCLR.
2349 #define _CP_ON 0x3F7F // Program memory code protection is enabled.
2350 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
2351 #define _BOREN_OFF 0x39FF // Brown-out Reset disabled.
2352 #define _BOREN_SBODEN 0x3BFF // Brown-out Reset controlled by the SBOREN bit in the BORCON register.
2353 #define _BOREN_NSLEEP 0x3DFF // Brown-out Reset enabled while running and disabled in Sleep.
2354 #define _BOREN_ON 0x3FFF // Brown-out Reset enabled.
2355 #define _CLKOUTEN_ON 0x37FF // CLKOUT function is enabled on the CLKOUT pin.
2356 #define _CLKOUTEN_OFF 0x3FFF // CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin.
2357 #define _IESO_OFF 0x2FFF // Internal/External Switchover mode is disabled.
2358 #define _IESO_ON 0x3FFF // Internal/External Switchover mode is enabled.
2359 #define _FCMEN_OFF 0x1FFF // Fail-Safe Clock Monitor is disabled.
2360 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
2362 //----------------------------- CONFIG2 Options -------------------------------
2364 #define _WRT_ALL 0x3FFC // 000h to 1FFFh write protected, no addresses may be modified by EECON control.
2365 #define _WRT_HALF 0x3FFD // 000h to FFFh write protected, 1000h to 1FFFh may be modified by EECON control.
2366 #define _WRT_BOOT 0x3FFE // 000h to 1FFh write protected, 200h to 1FFFh may be modified by EECON control.
2367 #define _WRT_OFF 0x3FFF // Write protection off.
2368 #define _STVREN_OFF 0x3DFF // Stack Overflow or Underflow will not cause a Reset.
2369 #define _STVREN_ON 0x3FFF // Stack Overflow or Underflow will cause a Reset.
2370 #define _BORV_HI 0x3BFF // Brown-out Reset Voltage (Vbor), high trip point selected.
2371 #define _BORV_LO 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
2372 #define _BORV_19 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
2373 #define _LPBOR_ON 0x37FF // Low-Power BOR is enabled.
2374 #define _LPBOR_OFF 0x3FFF // Low-Power BOR is disabled.
2375 #define _DEBUG_ON 0x2FFF // In-Circuit Debugger enabled, ICSPCLK and ICSPDAT are dedicated to the debugger.
2376 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, ICSPCLK and ICSPDAT are general purpose I/O pins.
2377 #define _LVP_OFF 0x1FFF // High-voltage on MCLR/VPP must be used for programming.
2378 #define _LVP_ON 0x3FFF // Low-voltage programming enabled.
2380 //==============================================================================
2382 #define _DEVID1 0x8006
2384 #define _IDLOC0 0x8000
2385 #define _IDLOC1 0x8001
2386 #define _IDLOC2 0x8002
2387 #define _IDLOC3 0x8003
2389 //==============================================================================
2391 #ifndef NO_BIT_DEFINES
2393 #define ADON ADCON0bits.ADON // bit 0
2394 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
2395 #define ADGO ADCON0bits.ADGO // bit 1, shadows bit in ADCON0bits
2396 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
2397 #define CHS0 ADCON0bits.CHS0 // bit 2
2398 #define CHS1 ADCON0bits.CHS1 // bit 3
2399 #define CHS2 ADCON0bits.CHS2 // bit 4
2400 #define CHS3 ADCON0bits.CHS3 // bit 5
2401 #define CHS4 ADCON0bits.CHS4 // bit 6
2403 #define ADPREF0 ADCON1bits.ADPREF0 // bit 0
2404 #define ADPREF1 ADCON1bits.ADPREF1 // bit 1
2405 #define ADCS0 ADCON1bits.ADCS0 // bit 4
2406 #define ADCS1 ADCON1bits.ADCS1 // bit 5
2407 #define ADCS2 ADCON1bits.ADCS2 // bit 6
2408 #define ADFM ADCON1bits.ADFM // bit 7
2410 #define ANSA0 ANSELAbits.ANSA0 // bit 0
2411 #define ANSA1 ANSELAbits.ANSA1 // bit 1
2412 #define ANSA2 ANSELAbits.ANSA2 // bit 2
2413 #define ANSA3 ANSELAbits.ANSA3 // bit 3
2414 #define ANSA5 ANSELAbits.ANSA5 // bit 5
2416 #define ANSB0 ANSELBbits.ANSB0 // bit 0
2417 #define ANSB1 ANSELBbits.ANSB1 // bit 1
2418 #define ANSB2 ANSELBbits.ANSB2 // bit 2
2419 #define ANSB3 ANSELBbits.ANSB3 // bit 3
2420 #define ANSB4 ANSELBbits.ANSB4 // bit 4
2421 #define ANSB5 ANSELBbits.ANSB5 // bit 5
2423 #define ANSC2 ANSELCbits.ANSC2 // bit 2
2424 #define ANSC3 ANSELCbits.ANSC3 // bit 3
2425 #define ANSC4 ANSELCbits.ANSC4 // bit 4
2426 #define ANSC5 ANSELCbits.ANSC5 // bit 5
2427 #define ANSC6 ANSELCbits.ANSC6 // bit 6
2428 #define ANSC7 ANSELCbits.ANSC7 // bit 7
2430 #define ANSD0 ANSELDbits.ANSD0 // bit 0
2431 #define ANSD1 ANSELDbits.ANSD1 // bit 1
2432 #define ANSD2 ANSELDbits.ANSD2 // bit 2
2433 #define ANSD3 ANSELDbits.ANSD3 // bit 3
2434 #define ANSD4 ANSELDbits.ANSD4 // bit 4
2435 #define ANSD5 ANSELDbits.ANSD5 // bit 5
2436 #define ANSD6 ANSELDbits.ANSD6 // bit 6
2437 #define ANSD7 ANSELDbits.ANSD7 // bit 7
2439 #define ANSE0 ANSELEbits.ANSE0 // bit 0
2440 #define ANSE1 ANSELEbits.ANSE1 // bit 1
2441 #define ANSE2 ANSELEbits.ANSE2 // bit 2
2443 #define CCP2SEL APFCONbits.CCP2SEL // bit 0
2444 #define SSSEL APFCONbits.SSSEL // bit 1
2446 #define ABDEN BAUDCONbits.ABDEN // bit 0
2447 #define WUE BAUDCONbits.WUE // bit 1
2448 #define BRG16 BAUDCONbits.BRG16 // bit 3
2449 #define SCKP BAUDCONbits.SCKP // bit 4
2450 #define RCIDL BAUDCONbits.RCIDL // bit 6
2451 #define ABDOVF BAUDCONbits.ABDOVF // bit 7
2453 #define BORRDY BORCONbits.BORRDY // bit 0
2454 #define BORFS BORCONbits.BORFS // bit 6
2455 #define SBOREN BORCONbits.SBOREN // bit 7
2457 #define BSR0 BSRbits.BSR0 // bit 0
2458 #define BSR1 BSRbits.BSR1 // bit 1
2459 #define BSR2 BSRbits.BSR2 // bit 2
2460 #define BSR3 BSRbits.BSR3 // bit 3
2461 #define BSR4 BSRbits.BSR4 // bit 4
2463 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
2464 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
2465 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
2466 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
2467 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
2468 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
2470 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
2471 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
2472 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
2473 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
2474 #define DC2B0 CCP2CONbits.DC2B0 // bit 4
2475 #define DC2B1 CCP2CONbits.DC2B1 // bit 5
2477 #define ADFVR0 FVRCONbits.ADFVR0 // bit 0
2478 #define ADFVR1 FVRCONbits.ADFVR1 // bit 1
2479 #define TSRNG FVRCONbits.TSRNG // bit 4
2480 #define TSEN FVRCONbits.TSEN // bit 5
2481 #define FVRRDY FVRCONbits.FVRRDY // bit 6
2482 #define FVREN FVRCONbits.FVREN // bit 7
2484 #define IOCIF INTCONbits.IOCIF // bit 0
2485 #define INTF INTCONbits.INTF // bit 1
2486 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
2487 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
2488 #define IOCIE INTCONbits.IOCIE // bit 3
2489 #define INTE INTCONbits.INTE // bit 4
2490 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
2491 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
2492 #define PEIE INTCONbits.PEIE // bit 6
2493 #define GIE INTCONbits.GIE // bit 7
2495 #define IOCBF0 IOCBFbits.IOCBF0 // bit 0
2496 #define IOCBF1 IOCBFbits.IOCBF1 // bit 1
2497 #define IOCBF2 IOCBFbits.IOCBF2 // bit 2
2498 #define IOCBF3 IOCBFbits.IOCBF3 // bit 3
2499 #define IOCBF4 IOCBFbits.IOCBF4 // bit 4
2500 #define IOCBF5 IOCBFbits.IOCBF5 // bit 5
2501 #define IOCBF6 IOCBFbits.IOCBF6 // bit 6
2502 #define IOCBF7 IOCBFbits.IOCBF7 // bit 7
2504 #define IOCBN0 IOCBNbits.IOCBN0 // bit 0
2505 #define IOCBN1 IOCBNbits.IOCBN1 // bit 1
2506 #define IOCBN2 IOCBNbits.IOCBN2 // bit 2
2507 #define IOCBN3 IOCBNbits.IOCBN3 // bit 3
2508 #define IOCBN4 IOCBNbits.IOCBN4 // bit 4
2509 #define IOCBN5 IOCBNbits.IOCBN5 // bit 5
2510 #define IOCBN6 IOCBNbits.IOCBN6 // bit 6
2511 #define IOCBN7 IOCBNbits.IOCBN7 // bit 7
2513 #define IOCBP0 IOCBPbits.IOCBP0 // bit 0
2514 #define IOCBP1 IOCBPbits.IOCBP1 // bit 1
2515 #define IOCBP2 IOCBPbits.IOCBP2 // bit 2
2516 #define IOCBP3 IOCBPbits.IOCBP3 // bit 3
2517 #define IOCBP4 IOCBPbits.IOCBP4 // bit 4
2518 #define IOCBP5 IOCBPbits.IOCBP5 // bit 5
2519 #define IOCBP6 IOCBPbits.IOCBP6 // bit 6
2520 #define IOCBP7 IOCBPbits.IOCBP7 // bit 7
2522 #define LATA0 LATAbits.LATA0 // bit 0
2523 #define LATA1 LATAbits.LATA1 // bit 1
2524 #define LATA2 LATAbits.LATA2 // bit 2
2525 #define LATA3 LATAbits.LATA3 // bit 3
2526 #define LATA4 LATAbits.LATA4 // bit 4
2527 #define LATA5 LATAbits.LATA5 // bit 5
2528 #define LATA6 LATAbits.LATA6 // bit 6
2529 #define LATA7 LATAbits.LATA7 // bit 7
2531 #define LATB0 LATBbits.LATB0 // bit 0
2532 #define LATB1 LATBbits.LATB1 // bit 1
2533 #define LATB2 LATBbits.LATB2 // bit 2
2534 #define LATB3 LATBbits.LATB3 // bit 3
2535 #define LATB4 LATBbits.LATB4 // bit 4
2536 #define LATB5 LATBbits.LATB5 // bit 5
2537 #define LATB6 LATBbits.LATB6 // bit 6
2538 #define LATB7 LATBbits.LATB7 // bit 7
2540 #define LATC0 LATCbits.LATC0 // bit 0
2541 #define LATC1 LATCbits.LATC1 // bit 1
2542 #define LATC2 LATCbits.LATC2 // bit 2
2543 #define LATC3 LATCbits.LATC3 // bit 3
2544 #define LATC4 LATCbits.LATC4 // bit 4
2545 #define LATC5 LATCbits.LATC5 // bit 5
2546 #define LATC6 LATCbits.LATC6 // bit 6
2547 #define LATC7 LATCbits.LATC7 // bit 7
2549 #define LATD0 LATDbits.LATD0 // bit 0
2550 #define LATD1 LATDbits.LATD1 // bit 1
2551 #define LATD2 LATDbits.LATD2 // bit 2
2552 #define LATD3 LATDbits.LATD3 // bit 3
2553 #define LATD4 LATDbits.LATD4 // bit 4
2554 #define LATD5 LATDbits.LATD5 // bit 5
2555 #define LATD6 LATDbits.LATD6 // bit 6
2556 #define LATD7 LATDbits.LATD7 // bit 7
2558 #define LATE0 LATEbits.LATE0 // bit 0
2559 #define LATE1 LATEbits.LATE1 // bit 1
2560 #define LATE2 LATEbits.LATE2 // bit 2
2562 #define PS0 OPTION_REGbits.PS0 // bit 0
2563 #define PS1 OPTION_REGbits.PS1 // bit 1
2564 #define PS2 OPTION_REGbits.PS2 // bit 2
2565 #define PSA OPTION_REGbits.PSA // bit 3
2566 #define TMR0SE OPTION_REGbits.TMR0SE // bit 4, shadows bit in OPTION_REGbits
2567 #define T0SE OPTION_REGbits.T0SE // bit 4, shadows bit in OPTION_REGbits
2568 #define TMR0CS OPTION_REGbits.TMR0CS // bit 5, shadows bit in OPTION_REGbits
2569 #define T0CS OPTION_REGbits.T0CS // bit 5, shadows bit in OPTION_REGbits
2570 #define INTEDG OPTION_REGbits.INTEDG // bit 6
2571 #define NOT_WPUEN OPTION_REGbits.NOT_WPUEN // bit 7
2573 #define SCS0 OSCCONbits.SCS0 // bit 0
2574 #define SCS1 OSCCONbits.SCS1 // bit 1
2575 #define IRCF0 OSCCONbits.IRCF0 // bit 3
2576 #define IRCF1 OSCCONbits.IRCF1 // bit 4
2577 #define IRCF2 OSCCONbits.IRCF2 // bit 5
2578 #define IRCF3 OSCCONbits.IRCF3 // bit 6
2580 #define HFIOFS OSCSTATbits.HFIOFS // bit 0
2581 #define LFIOFR OSCSTATbits.LFIOFR // bit 1
2582 #define HFIOFR OSCSTATbits.HFIOFR // bit 4
2583 #define OSTS OSCSTATbits.OSTS // bit 5
2584 #define SOSCR OSCSTATbits.SOSCR // bit 7, shadows bit in OSCSTATbits
2585 #define T1OSCR OSCSTATbits.T1OSCR // bit 7, shadows bit in OSCSTATbits
2587 #define NOT_BOR PCONbits.NOT_BOR // bit 0
2588 #define NOT_POR PCONbits.NOT_POR // bit 1
2589 #define NOT_RI PCONbits.NOT_RI // bit 2
2590 #define NOT_RMCLR PCONbits.NOT_RMCLR // bit 3
2591 #define NOT_RWDT PCONbits.NOT_RWDT // bit 4
2592 #define STKUNF PCONbits.STKUNF // bit 6
2593 #define STKOVF PCONbits.STKOVF // bit 7
2595 #define TMR1IE PIE1bits.TMR1IE // bit 0
2596 #define TMR2IE PIE1bits.TMR2IE // bit 1
2597 #define CCP1IE PIE1bits.CCP1IE // bit 2
2598 #define SSPIE PIE1bits.SSPIE // bit 3
2599 #define TXIE PIE1bits.TXIE // bit 4
2600 #define RCIE PIE1bits.RCIE // bit 5
2601 #define ADIE PIE1bits.ADIE // bit 6
2602 #define TMR1GIE PIE1bits.TMR1GIE // bit 7
2604 #define CCP2IE PIE2bits.CCP2IE // bit 0
2605 #define BCLIE PIE2bits.BCLIE // bit 3
2606 #define OSFIE PIE2bits.OSFIE // bit 7
2608 #define TMR1IF PIR1bits.TMR1IF // bit 0
2609 #define TMR2IF PIR1bits.TMR2IF // bit 1
2610 #define CCP1IF PIR1bits.CCP1IF // bit 2
2611 #define SSPIF PIR1bits.SSPIF // bit 3
2612 #define TXIF PIR1bits.TXIF // bit 4
2613 #define RCIF PIR1bits.RCIF // bit 5
2614 #define ADIF PIR1bits.ADIF // bit 6
2615 #define TMR1GIF PIR1bits.TMR1GIF // bit 7
2617 #define CCP2IF PIR2bits.CCP2IF // bit 0
2618 #define BCLIF PIR2bits.BCLIF // bit 3
2619 #define OSFIF PIR2bits.OSFIF // bit 7
2621 #define RD PMCON1bits.RD // bit 0
2622 #define WR PMCON1bits.WR // bit 1
2623 #define WREN PMCON1bits.WREN // bit 2
2624 #define WRERR PMCON1bits.WRERR // bit 3
2625 #define FREE PMCON1bits.FREE // bit 4
2626 #define LWLO PMCON1bits.LWLO // bit 5
2627 #define CFGS PMCON1bits.CFGS // bit 6
2629 #define RA0 PORTAbits.RA0 // bit 0
2630 #define RA1 PORTAbits.RA1 // bit 1
2631 #define RA2 PORTAbits.RA2 // bit 2
2632 #define RA3 PORTAbits.RA3 // bit 3
2633 #define RA4 PORTAbits.RA4 // bit 4
2634 #define RA5 PORTAbits.RA5 // bit 5
2635 #define RA6 PORTAbits.RA6 // bit 6
2636 #define RA7 PORTAbits.RA7 // bit 7
2638 #define RB0 PORTBbits.RB0 // bit 0
2639 #define RB1 PORTBbits.RB1 // bit 1
2640 #define RB2 PORTBbits.RB2 // bit 2
2641 #define RB3 PORTBbits.RB3 // bit 3
2642 #define RB4 PORTBbits.RB4 // bit 4
2643 #define RB5 PORTBbits.RB5 // bit 5
2644 #define RB6 PORTBbits.RB6 // bit 6
2645 #define RB7 PORTBbits.RB7 // bit 7
2647 #define RC0 PORTCbits.RC0 // bit 0
2648 #define RC1 PORTCbits.RC1 // bit 1
2649 #define RC2 PORTCbits.RC2 // bit 2
2650 #define RC3 PORTCbits.RC3 // bit 3
2651 #define RC4 PORTCbits.RC4 // bit 4
2652 #define RC5 PORTCbits.RC5 // bit 5
2653 #define RC6 PORTCbits.RC6 // bit 6
2654 #define RC7 PORTCbits.RC7 // bit 7
2656 #define RD0 PORTDbits.RD0 // bit 0
2657 #define RD1 PORTDbits.RD1 // bit 1
2658 #define RD2 PORTDbits.RD2 // bit 2
2659 #define RD3 PORTDbits.RD3 // bit 3
2660 #define RD4 PORTDbits.RD4 // bit 4
2661 #define RD5 PORTDbits.RD5 // bit 5
2662 #define RD6 PORTDbits.RD6 // bit 6
2663 #define RD7 PORTDbits.RD7 // bit 7
2665 #define RE0 PORTEbits.RE0 // bit 0
2666 #define RE1 PORTEbits.RE1 // bit 1
2667 #define RE2 PORTEbits.RE2 // bit 2
2668 #define RE3 PORTEbits.RE3 // bit 3
2670 #define RX9D RCSTAbits.RX9D // bit 0
2671 #define OERR RCSTAbits.OERR // bit 1
2672 #define FERR RCSTAbits.FERR // bit 2
2673 #define ADDEN RCSTAbits.ADDEN // bit 3
2674 #define CREN RCSTAbits.CREN // bit 4
2675 #define SREN RCSTAbits.SREN // bit 5
2676 #define RX9 RCSTAbits.RX9 // bit 6
2677 #define SPEN RCSTAbits.SPEN // bit 7
2679 #define SSPM0 SSP1CON1bits.SSPM0 // bit 0
2680 #define SSPM1 SSP1CON1bits.SSPM1 // bit 1
2681 #define SSPM2 SSP1CON1bits.SSPM2 // bit 2
2682 #define SSPM3 SSP1CON1bits.SSPM3 // bit 3
2683 #define CKP SSP1CON1bits.CKP // bit 4
2684 #define SSPEN SSP1CON1bits.SSPEN // bit 5
2685 #define SSPOV SSP1CON1bits.SSPOV // bit 6
2686 #define WCOL SSP1CON1bits.WCOL // bit 7
2688 #define SEN SSP1CON2bits.SEN // bit 0
2689 #define RSEN SSP1CON2bits.RSEN // bit 1
2690 #define PEN SSP1CON2bits.PEN // bit 2
2691 #define RCEN SSP1CON2bits.RCEN // bit 3
2692 #define ACKEN SSP1CON2bits.ACKEN // bit 4
2693 #define ACKDT SSP1CON2bits.ACKDT // bit 5
2694 #define ACKSTAT SSP1CON2bits.ACKSTAT // bit 6
2695 #define GCEN SSP1CON2bits.GCEN // bit 7
2697 #define DHEN SSP1CON3bits.DHEN // bit 0
2698 #define AHEN SSP1CON3bits.AHEN // bit 1
2699 #define SBCDE SSP1CON3bits.SBCDE // bit 2
2700 #define SDAHT SSP1CON3bits.SDAHT // bit 3
2701 #define BOEN SSP1CON3bits.BOEN // bit 4
2702 #define SCIE SSP1CON3bits.SCIE // bit 5
2703 #define PCIE SSP1CON3bits.PCIE // bit 6
2704 #define ACKTIM SSP1CON3bits.ACKTIM // bit 7
2706 #define BF SSP1STATbits.BF // bit 0
2707 #define UA SSP1STATbits.UA // bit 1
2708 #define R_NOT_W SSP1STATbits.R_NOT_W // bit 2
2709 #define S SSP1STATbits.S // bit 3
2710 #define P SSP1STATbits.P // bit 4
2711 #define D_NOT_A SSP1STATbits.D_NOT_A // bit 5
2712 #define CKE SSP1STATbits.CKE // bit 6
2713 #define SMP SSP1STATbits.SMP // bit 7
2715 #define C STATUSbits.C // bit 0
2716 #define DC STATUSbits.DC // bit 1
2717 #define Z STATUSbits.Z // bit 2
2718 #define NOT_PD STATUSbits.NOT_PD // bit 3
2719 #define NOT_TO STATUSbits.NOT_TO // bit 4
2721 #define C_SHAD STATUS_SHADbits.C_SHAD // bit 0
2722 #define DC_SHAD STATUS_SHADbits.DC_SHAD // bit 1
2723 #define Z_SHAD STATUS_SHADbits.Z_SHAD // bit 2
2725 #define TMR1ON T1CONbits.TMR1ON // bit 0
2726 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
2727 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
2728 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
2729 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
2730 #define TMR1CS0 T1CONbits.TMR1CS0 // bit 6
2731 #define TMR1CS1 T1CONbits.TMR1CS1 // bit 7
2733 #define T1GSS0 T1GCONbits.T1GSS0 // bit 0
2734 #define T1GSS1 T1GCONbits.T1GSS1 // bit 1
2735 #define T1GVAL T1GCONbits.T1GVAL // bit 2
2736 #define T1GGO_NOT_DONE T1GCONbits.T1GGO_NOT_DONE // bit 3
2737 #define T1GSPM T1GCONbits.T1GSPM // bit 4
2738 #define T1GTM T1GCONbits.T1GTM // bit 5
2739 #define T1GPOL T1GCONbits.T1GPOL // bit 6
2740 #define TMR1GE T1GCONbits.TMR1GE // bit 7
2742 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
2743 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
2744 #define TMR2ON T2CONbits.TMR2ON // bit 2
2745 #define T2OUTPS0 T2CONbits.T2OUTPS0 // bit 3
2746 #define T2OUTPS1 T2CONbits.T2OUTPS1 // bit 4
2747 #define T2OUTPS2 T2CONbits.T2OUTPS2 // bit 5
2748 #define T2OUTPS3 T2CONbits.T2OUTPS3 // bit 6
2750 #define TRISA0 TRISAbits.TRISA0 // bit 0
2751 #define TRISA1 TRISAbits.TRISA1 // bit 1
2752 #define TRISA2 TRISAbits.TRISA2 // bit 2
2753 #define TRISA3 TRISAbits.TRISA3 // bit 3
2754 #define TRISA4 TRISAbits.TRISA4 // bit 4
2755 #define TRISA5 TRISAbits.TRISA5 // bit 5
2756 #define TRISA6 TRISAbits.TRISA6 // bit 6
2757 #define TRISA7 TRISAbits.TRISA7 // bit 7
2759 #define TRISB0 TRISBbits.TRISB0 // bit 0
2760 #define TRISB1 TRISBbits.TRISB1 // bit 1
2761 #define TRISB2 TRISBbits.TRISB2 // bit 2
2762 #define TRISB3 TRISBbits.TRISB3 // bit 3
2763 #define TRISB4 TRISBbits.TRISB4 // bit 4
2764 #define TRISB5 TRISBbits.TRISB5 // bit 5
2765 #define TRISB6 TRISBbits.TRISB6 // bit 6
2766 #define TRISB7 TRISBbits.TRISB7 // bit 7
2768 #define TRISC0 TRISCbits.TRISC0 // bit 0
2769 #define TRISC1 TRISCbits.TRISC1 // bit 1
2770 #define TRISC2 TRISCbits.TRISC2 // bit 2
2771 #define TRISC3 TRISCbits.TRISC3 // bit 3
2772 #define TRISC4 TRISCbits.TRISC4 // bit 4
2773 #define TRISC5 TRISCbits.TRISC5 // bit 5
2774 #define TRISC6 TRISCbits.TRISC6 // bit 6
2775 #define TRISC7 TRISCbits.TRISC7 // bit 7
2777 #define TRISD0 TRISDbits.TRISD0 // bit 0
2778 #define TRISD1 TRISDbits.TRISD1 // bit 1
2779 #define TRISD2 TRISDbits.TRISD2 // bit 2
2780 #define TRISD3 TRISDbits.TRISD3 // bit 3
2781 #define TRISD4 TRISDbits.TRISD4 // bit 4
2782 #define TRISD5 TRISDbits.TRISD5 // bit 5
2783 #define TRISD6 TRISDbits.TRISD6 // bit 6
2784 #define TRISD7 TRISDbits.TRISD7 // bit 7
2786 #define TRISE0 TRISEbits.TRISE0 // bit 0
2787 #define TRISE1 TRISEbits.TRISE1 // bit 1
2788 #define TRISE2 TRISEbits.TRISE2 // bit 2
2790 #define TX9D TXSTAbits.TX9D // bit 0
2791 #define TRMT TXSTAbits.TRMT // bit 1
2792 #define BRGH TXSTAbits.BRGH // bit 2
2793 #define SENDB TXSTAbits.SENDB // bit 3
2794 #define SYNC TXSTAbits.SYNC // bit 4
2795 #define TXEN TXSTAbits.TXEN // bit 5
2796 #define TX9 TXSTAbits.TX9 // bit 6
2797 #define CSRC TXSTAbits.CSRC // bit 7
2799 #define SWDTEN WDTCONbits.SWDTEN // bit 0
2800 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
2801 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
2802 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
2803 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
2804 #define WDTPS4 WDTCONbits.WDTPS4 // bit 5
2806 #define WPUB0 WPUBbits.WPUB0 // bit 0
2807 #define WPUB1 WPUBbits.WPUB1 // bit 1
2808 #define WPUB2 WPUBbits.WPUB2 // bit 2
2809 #define WPUB3 WPUBbits.WPUB3 // bit 3
2810 #define WPUB4 WPUBbits.WPUB4 // bit 4
2811 #define WPUB5 WPUBbits.WPUB5 // bit 5
2812 #define WPUB6 WPUBbits.WPUB6 // bit 6
2813 #define WPUB7 WPUBbits.WPUB7 // bit 7
2815 #define WPUE3 WPUEbits.WPUE3 // bit 3
2817 #endif // #ifndef NO_BIT_DEFINES
2819 #endif // #ifndef __PIC16LF1517_H__