Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f1847.h
blob6638ec4055cc3fcc6d588f30cdb798eb6e0d712d
1 /*
2 * This declarations of the PIC16F1847 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:21 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 __PIC16F1847_H__
26 #define __PIC16F1847_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 PIR1_ADDR 0x0011
53 #define PIR2_ADDR 0x0012
54 #define PIR3_ADDR 0x0013
55 #define PIR4_ADDR 0x0014
56 #define TMR0_ADDR 0x0015
57 #define TMR1_ADDR 0x0016
58 #define TMR1L_ADDR 0x0016
59 #define TMR1H_ADDR 0x0017
60 #define T1CON_ADDR 0x0018
61 #define T1GCON_ADDR 0x0019
62 #define TMR2_ADDR 0x001A
63 #define PR2_ADDR 0x001B
64 #define T2CON_ADDR 0x001C
65 #define CPSCON0_ADDR 0x001E
66 #define CPSCON1_ADDR 0x001F
67 #define TRISA_ADDR 0x008C
68 #define TRISB_ADDR 0x008D
69 #define PIE1_ADDR 0x0091
70 #define PIE2_ADDR 0x0092
71 #define PIE3_ADDR 0x0093
72 #define PIE4_ADDR 0x0094
73 #define OPTION_REG_ADDR 0x0095
74 #define PCON_ADDR 0x0096
75 #define WDTCON_ADDR 0x0097
76 #define OSCTUNE_ADDR 0x0098
77 #define OSCCON_ADDR 0x0099
78 #define OSCSTAT_ADDR 0x009A
79 #define ADRES_ADDR 0x009B
80 #define ADRESL_ADDR 0x009B
81 #define ADRESH_ADDR 0x009C
82 #define ADCON0_ADDR 0x009D
83 #define ADCON1_ADDR 0x009E
84 #define LATA_ADDR 0x010C
85 #define LATB_ADDR 0x010D
86 #define CM1CON0_ADDR 0x0111
87 #define CM1CON1_ADDR 0x0112
88 #define CM2CON0_ADDR 0x0113
89 #define CM2CON1_ADDR 0x0114
90 #define CMOUT_ADDR 0x0115
91 #define BORCON_ADDR 0x0116
92 #define FVRCON_ADDR 0x0117
93 #define DACCON0_ADDR 0x0118
94 #define DACCON1_ADDR 0x0119
95 #define SRCON0_ADDR 0x011A
96 #define SRCON1_ADDR 0x011B
97 #define APFCON0_ADDR 0x011D
98 #define APFCON1_ADDR 0x011E
99 #define ANSELA_ADDR 0x018C
100 #define ANSELB_ADDR 0x018D
101 #define EEADR_ADDR 0x0191
102 #define EEADRL_ADDR 0x0191
103 #define EEADRH_ADDR 0x0192
104 #define EEDAT_ADDR 0x0193
105 #define EEDATL_ADDR 0x0193
106 #define EEDATH_ADDR 0x0194
107 #define EECON1_ADDR 0x0195
108 #define EECON2_ADDR 0x0196
109 #define RCREG_ADDR 0x0199
110 #define TXREG_ADDR 0x019A
111 #define SP1BRG_ADDR 0x019B
112 #define SP1BRGL_ADDR 0x019B
113 #define SPBRG_ADDR 0x019B
114 #define SPBRGL_ADDR 0x019B
115 #define SP1BRGH_ADDR 0x019C
116 #define SPBRGH_ADDR 0x019C
117 #define RCSTA_ADDR 0x019D
118 #define TXSTA_ADDR 0x019E
119 #define BAUDCON_ADDR 0x019F
120 #define WPUA_ADDR 0x020C
121 #define WPUB_ADDR 0x020D
122 #define SSP1BUF_ADDR 0x0211
123 #define SSPBUF_ADDR 0x0211
124 #define SSP1ADD_ADDR 0x0212
125 #define SSPADD_ADDR 0x0212
126 #define SSP1MSK_ADDR 0x0213
127 #define SSPMSK_ADDR 0x0213
128 #define SSP1STAT_ADDR 0x0214
129 #define SSPSTAT_ADDR 0x0214
130 #define SSP1CON1_ADDR 0x0215
131 #define SSPCON_ADDR 0x0215
132 #define SSPCON1_ADDR 0x0215
133 #define SSP1CON2_ADDR 0x0216
134 #define SSPCON2_ADDR 0x0216
135 #define SSP1CON3_ADDR 0x0217
136 #define SSPCON3_ADDR 0x0217
137 #define SSP2BUF_ADDR 0x0219
138 #define SSP2ADD_ADDR 0x021A
139 #define SSP2MSK_ADDR 0x021B
140 #define SSP2STAT_ADDR 0x021C
141 #define SSP2CON1_ADDR 0x021D
142 #define SSP2CON2_ADDR 0x021E
143 #define SSP2CON3_ADDR 0x021F
144 #define CCPR1_ADDR 0x0291
145 #define CCPR1L_ADDR 0x0291
146 #define CCPR1H_ADDR 0x0292
147 #define CCP1CON_ADDR 0x0293
148 #define PWM1CON_ADDR 0x0294
149 #define CCP1AS_ADDR 0x0295
150 #define ECCP1AS_ADDR 0x0295
151 #define PSTR1CON_ADDR 0x0296
152 #define CCPR2_ADDR 0x0298
153 #define CCPR2L_ADDR 0x0298
154 #define CCPR2H_ADDR 0x0299
155 #define CCP2CON_ADDR 0x029A
156 #define PWM2CON_ADDR 0x029B
157 #define CCP2AS_ADDR 0x029C
158 #define ECCP2AS_ADDR 0x029C
159 #define PSTR2CON_ADDR 0x029D
160 #define CCPTMRS_ADDR 0x029E
161 #define CCPTMRS0_ADDR 0x029E
162 #define CCPR3_ADDR 0x0311
163 #define CCPR3L_ADDR 0x0311
164 #define CCPR3H_ADDR 0x0312
165 #define CCP3CON_ADDR 0x0313
166 #define CCPR4_ADDR 0x0318
167 #define CCPR4L_ADDR 0x0318
168 #define CCPR4H_ADDR 0x0319
169 #define CCP4CON_ADDR 0x031A
170 #define IOCBP_ADDR 0x0394
171 #define IOCBN_ADDR 0x0395
172 #define IOCBF_ADDR 0x0396
173 #define CLKRCON_ADDR 0x039A
174 #define MDCON_ADDR 0x039C
175 #define MDSRC_ADDR 0x039D
176 #define MDCARL_ADDR 0x039E
177 #define MDCARH_ADDR 0x039F
178 #define TMR4_ADDR 0x0415
179 #define PR4_ADDR 0x0416
180 #define T4CON_ADDR 0x0417
181 #define TMR6_ADDR 0x041C
182 #define PR6_ADDR 0x041D
183 #define T6CON_ADDR 0x041E
184 #define STATUS_SHAD_ADDR 0x0FE4
185 #define WREG_SHAD_ADDR 0x0FE5
186 #define BSR_SHAD_ADDR 0x0FE6
187 #define PCLATH_SHAD_ADDR 0x0FE7
188 #define FSR0L_SHAD_ADDR 0x0FE8
189 #define FSR0H_SHAD_ADDR 0x0FE9
190 #define FSR1L_SHAD_ADDR 0x0FEA
191 #define FSR1H_SHAD_ADDR 0x0FEB
192 #define STKPTR_ADDR 0x0FED
193 #define TOSL_ADDR 0x0FEE
194 #define TOSH_ADDR 0x0FEF
196 #endif // #ifndef NO_ADDR_DEFINES
198 //==============================================================================
200 // Register Definitions
202 //==============================================================================
204 extern __at(0x0000) __sfr INDF0;
205 extern __at(0x0001) __sfr INDF1;
206 extern __at(0x0002) __sfr PCL;
208 //==============================================================================
209 // STATUS Bits
211 extern __at(0x0003) __sfr STATUS;
213 typedef struct
215 unsigned C : 1;
216 unsigned DC : 1;
217 unsigned Z : 1;
218 unsigned NOT_PD : 1;
219 unsigned NOT_TO : 1;
220 unsigned : 1;
221 unsigned : 1;
222 unsigned : 1;
223 } __STATUSbits_t;
225 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
227 #define _C 0x01
228 #define _DC 0x02
229 #define _Z 0x04
230 #define _NOT_PD 0x08
231 #define _NOT_TO 0x10
233 //==============================================================================
235 extern __at(0x0004) __sfr FSR0;
236 extern __at(0x0004) __sfr FSR0L;
237 extern __at(0x0005) __sfr FSR0H;
238 extern __at(0x0006) __sfr FSR1;
239 extern __at(0x0006) __sfr FSR1L;
240 extern __at(0x0007) __sfr FSR1H;
242 //==============================================================================
243 // BSR Bits
245 extern __at(0x0008) __sfr BSR;
247 typedef union
249 struct
251 unsigned BSR0 : 1;
252 unsigned BSR1 : 1;
253 unsigned BSR2 : 1;
254 unsigned BSR3 : 1;
255 unsigned BSR4 : 1;
256 unsigned : 1;
257 unsigned : 1;
258 unsigned : 1;
261 struct
263 unsigned BSR : 5;
264 unsigned : 3;
266 } __BSRbits_t;
268 extern __at(0x0008) volatile __BSRbits_t BSRbits;
270 #define _BSR0 0x01
271 #define _BSR1 0x02
272 #define _BSR2 0x04
273 #define _BSR3 0x08
274 #define _BSR4 0x10
276 //==============================================================================
278 extern __at(0x0009) __sfr WREG;
279 extern __at(0x000A) __sfr PCLATH;
281 //==============================================================================
282 // INTCON Bits
284 extern __at(0x000B) __sfr INTCON;
286 typedef union
288 struct
290 unsigned IOCIF : 1;
291 unsigned INTF : 1;
292 unsigned TMR0IF : 1;
293 unsigned IOCIE : 1;
294 unsigned INTE : 1;
295 unsigned TMR0IE : 1;
296 unsigned PEIE : 1;
297 unsigned GIE : 1;
300 struct
302 unsigned : 1;
303 unsigned : 1;
304 unsigned T0IF : 1;
305 unsigned : 1;
306 unsigned : 1;
307 unsigned T0IE : 1;
308 unsigned : 1;
309 unsigned : 1;
311 } __INTCONbits_t;
313 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
315 #define _IOCIF 0x01
316 #define _INTF 0x02
317 #define _TMR0IF 0x04
318 #define _T0IF 0x04
319 #define _IOCIE 0x08
320 #define _INTE 0x10
321 #define _TMR0IE 0x20
322 #define _T0IE 0x20
323 #define _PEIE 0x40
324 #define _GIE 0x80
326 //==============================================================================
329 //==============================================================================
330 // PORTA Bits
332 extern __at(0x000C) __sfr PORTA;
334 typedef struct
336 unsigned RA0 : 1;
337 unsigned RA1 : 1;
338 unsigned RA2 : 1;
339 unsigned RA3 : 1;
340 unsigned RA4 : 1;
341 unsigned RA5 : 1;
342 unsigned RA6 : 1;
343 unsigned RA7 : 1;
344 } __PORTAbits_t;
346 extern __at(0x000C) volatile __PORTAbits_t PORTAbits;
348 #define _RA0 0x01
349 #define _RA1 0x02
350 #define _RA2 0x04
351 #define _RA3 0x08
352 #define _RA4 0x10
353 #define _RA5 0x20
354 #define _RA6 0x40
355 #define _RA7 0x80
357 //==============================================================================
360 //==============================================================================
361 // PORTB Bits
363 extern __at(0x000D) __sfr PORTB;
365 typedef struct
367 unsigned RB0 : 1;
368 unsigned RB1 : 1;
369 unsigned RB2 : 1;
370 unsigned RB3 : 1;
371 unsigned RB4 : 1;
372 unsigned RB5 : 1;
373 unsigned RB6 : 1;
374 unsigned RB7 : 1;
375 } __PORTBbits_t;
377 extern __at(0x000D) volatile __PORTBbits_t PORTBbits;
379 #define _RB0 0x01
380 #define _RB1 0x02
381 #define _RB2 0x04
382 #define _RB3 0x08
383 #define _RB4 0x10
384 #define _RB5 0x20
385 #define _RB6 0x40
386 #define _RB7 0x80
388 //==============================================================================
391 //==============================================================================
392 // PIR1 Bits
394 extern __at(0x0011) __sfr PIR1;
396 typedef struct
398 unsigned TMR1IF : 1;
399 unsigned TMR2IF : 1;
400 unsigned CCP1IF : 1;
401 unsigned SSP1IF : 1;
402 unsigned TXIF : 1;
403 unsigned RCIF : 1;
404 unsigned ADIF : 1;
405 unsigned TMR1GIF : 1;
406 } __PIR1bits_t;
408 extern __at(0x0011) volatile __PIR1bits_t PIR1bits;
410 #define _TMR1IF 0x01
411 #define _TMR2IF 0x02
412 #define _CCP1IF 0x04
413 #define _SSP1IF 0x08
414 #define _TXIF 0x10
415 #define _RCIF 0x20
416 #define _ADIF 0x40
417 #define _TMR1GIF 0x80
419 //==============================================================================
422 //==============================================================================
423 // PIR2 Bits
425 extern __at(0x0012) __sfr PIR2;
427 typedef struct
429 unsigned CCP2IF : 1;
430 unsigned : 1;
431 unsigned : 1;
432 unsigned BCL1IF : 1;
433 unsigned EEIF : 1;
434 unsigned C1IF : 1;
435 unsigned C2IF : 1;
436 unsigned OSFIF : 1;
437 } __PIR2bits_t;
439 extern __at(0x0012) volatile __PIR2bits_t PIR2bits;
441 #define _CCP2IF 0x01
442 #define _BCL1IF 0x08
443 #define _EEIF 0x10
444 #define _C1IF 0x20
445 #define _C2IF 0x40
446 #define _OSFIF 0x80
448 //==============================================================================
451 //==============================================================================
452 // PIR3 Bits
454 extern __at(0x0013) __sfr PIR3;
456 typedef struct
458 unsigned : 1;
459 unsigned TMR4IF : 1;
460 unsigned : 1;
461 unsigned TMR6IF : 1;
462 unsigned CCP3IF : 1;
463 unsigned CCP4IF : 1;
464 unsigned : 1;
465 unsigned : 1;
466 } __PIR3bits_t;
468 extern __at(0x0013) volatile __PIR3bits_t PIR3bits;
470 #define _TMR4IF 0x02
471 #define _TMR6IF 0x08
472 #define _CCP3IF 0x10
473 #define _CCP4IF 0x20
475 //==============================================================================
478 //==============================================================================
479 // PIR4 Bits
481 extern __at(0x0014) __sfr PIR4;
483 typedef struct
485 unsigned SSP2IF : 1;
486 unsigned BCL2IF : 1;
487 unsigned : 1;
488 unsigned : 1;
489 unsigned : 1;
490 unsigned : 1;
491 unsigned : 1;
492 unsigned : 1;
493 } __PIR4bits_t;
495 extern __at(0x0014) volatile __PIR4bits_t PIR4bits;
497 #define _SSP2IF 0x01
498 #define _BCL2IF 0x02
500 //==============================================================================
502 extern __at(0x0015) __sfr TMR0;
503 extern __at(0x0016) __sfr TMR1;
504 extern __at(0x0016) __sfr TMR1L;
505 extern __at(0x0017) __sfr TMR1H;
507 //==============================================================================
508 // T1CON Bits
510 extern __at(0x0018) __sfr T1CON;
512 typedef union
514 struct
516 unsigned TMR1ON : 1;
517 unsigned : 1;
518 unsigned NOT_T1SYNC : 1;
519 unsigned T1OSCEN : 1;
520 unsigned T1CKPS0 : 1;
521 unsigned T1CKPS1 : 1;
522 unsigned TMR1CS0 : 1;
523 unsigned TMR1CS1 : 1;
526 struct
528 unsigned : 4;
529 unsigned T1CKPS : 2;
530 unsigned : 2;
533 struct
535 unsigned : 6;
536 unsigned TMR1CS : 2;
538 } __T1CONbits_t;
540 extern __at(0x0018) volatile __T1CONbits_t T1CONbits;
542 #define _TMR1ON 0x01
543 #define _NOT_T1SYNC 0x04
544 #define _T1OSCEN 0x08
545 #define _T1CKPS0 0x10
546 #define _T1CKPS1 0x20
547 #define _TMR1CS0 0x40
548 #define _TMR1CS1 0x80
550 //==============================================================================
553 //==============================================================================
554 // T1GCON Bits
556 extern __at(0x0019) __sfr T1GCON;
558 typedef union
560 struct
562 unsigned T1GSS0 : 1;
563 unsigned T1GSS1 : 1;
564 unsigned T1GVAL : 1;
565 unsigned T1GGO_NOT_DONE : 1;
566 unsigned T1GSPM : 1;
567 unsigned T1GTM : 1;
568 unsigned T1GPOL : 1;
569 unsigned TMR1GE : 1;
572 struct
574 unsigned : 1;
575 unsigned : 1;
576 unsigned : 1;
577 unsigned T1GGO : 1;
578 unsigned : 1;
579 unsigned : 1;
580 unsigned : 1;
581 unsigned : 1;
584 struct
586 unsigned T1GSS : 2;
587 unsigned : 6;
589 } __T1GCONbits_t;
591 extern __at(0x0019) volatile __T1GCONbits_t T1GCONbits;
593 #define _T1GSS0 0x01
594 #define _T1GSS1 0x02
595 #define _T1GVAL 0x04
596 #define _T1GGO_NOT_DONE 0x08
597 #define _T1GGO 0x08
598 #define _T1GSPM 0x10
599 #define _T1GTM 0x20
600 #define _T1GPOL 0x40
601 #define _TMR1GE 0x80
603 //==============================================================================
605 extern __at(0x001A) __sfr TMR2;
606 extern __at(0x001B) __sfr PR2;
608 //==============================================================================
609 // T2CON Bits
611 extern __at(0x001C) __sfr T2CON;
613 typedef union
615 struct
617 unsigned T2CKPS0 : 1;
618 unsigned T2CKPS1 : 1;
619 unsigned TMR2ON : 1;
620 unsigned T2OUTPS0 : 1;
621 unsigned T2OUTPS1 : 1;
622 unsigned T2OUTPS2 : 1;
623 unsigned T2OUTPS3 : 1;
624 unsigned : 1;
627 struct
629 unsigned T2CKPS : 2;
630 unsigned : 6;
633 struct
635 unsigned : 3;
636 unsigned T2OUTPS : 4;
637 unsigned : 1;
639 } __T2CONbits_t;
641 extern __at(0x001C) volatile __T2CONbits_t T2CONbits;
643 #define _T2CKPS0 0x01
644 #define _T2CKPS1 0x02
645 #define _TMR2ON 0x04
646 #define _T2OUTPS0 0x08
647 #define _T2OUTPS1 0x10
648 #define _T2OUTPS2 0x20
649 #define _T2OUTPS3 0x40
651 //==============================================================================
654 //==============================================================================
655 // CPSCON0 Bits
657 extern __at(0x001E) __sfr CPSCON0;
659 typedef union
661 struct
663 unsigned T0XCS : 1;
664 unsigned CPSOUT : 1;
665 unsigned CPSRNG0 : 1;
666 unsigned CPSRNG1 : 1;
667 unsigned : 1;
668 unsigned : 1;
669 unsigned CPSRM : 1;
670 unsigned CPSON : 1;
673 struct
675 unsigned : 2;
676 unsigned CPSRNG : 2;
677 unsigned : 4;
679 } __CPSCON0bits_t;
681 extern __at(0x001E) volatile __CPSCON0bits_t CPSCON0bits;
683 #define _T0XCS 0x01
684 #define _CPSOUT 0x02
685 #define _CPSRNG0 0x04
686 #define _CPSRNG1 0x08
687 #define _CPSRM 0x40
688 #define _CPSON 0x80
690 //==============================================================================
693 //==============================================================================
694 // CPSCON1 Bits
696 extern __at(0x001F) __sfr CPSCON1;
698 typedef union
700 struct
702 unsigned CPSCH0 : 1;
703 unsigned CPSCH1 : 1;
704 unsigned CPSCH2 : 1;
705 unsigned CPSCH3 : 1;
706 unsigned : 1;
707 unsigned : 1;
708 unsigned : 1;
709 unsigned : 1;
712 struct
714 unsigned CPSCH : 4;
715 unsigned : 4;
717 } __CPSCON1bits_t;
719 extern __at(0x001F) volatile __CPSCON1bits_t CPSCON1bits;
721 #define _CPSCH0 0x01
722 #define _CPSCH1 0x02
723 #define _CPSCH2 0x04
724 #define _CPSCH3 0x08
726 //==============================================================================
729 //==============================================================================
730 // TRISA Bits
732 extern __at(0x008C) __sfr TRISA;
734 typedef struct
736 unsigned TRISA0 : 1;
737 unsigned TRISA1 : 1;
738 unsigned TRISA2 : 1;
739 unsigned TRISA3 : 1;
740 unsigned TRISA4 : 1;
741 unsigned TRISA5 : 1;
742 unsigned TRISA6 : 1;
743 unsigned TRISA7 : 1;
744 } __TRISAbits_t;
746 extern __at(0x008C) volatile __TRISAbits_t TRISAbits;
748 #define _TRISA0 0x01
749 #define _TRISA1 0x02
750 #define _TRISA2 0x04
751 #define _TRISA3 0x08
752 #define _TRISA4 0x10
753 #define _TRISA5 0x20
754 #define _TRISA6 0x40
755 #define _TRISA7 0x80
757 //==============================================================================
760 //==============================================================================
761 // TRISB Bits
763 extern __at(0x008D) __sfr TRISB;
765 typedef struct
767 unsigned TRISB0 : 1;
768 unsigned TRISB1 : 1;
769 unsigned TRISB2 : 1;
770 unsigned TRISB3 : 1;
771 unsigned TRISB4 : 1;
772 unsigned TRISB5 : 1;
773 unsigned TRISB6 : 1;
774 unsigned TRISB7 : 1;
775 } __TRISBbits_t;
777 extern __at(0x008D) volatile __TRISBbits_t TRISBbits;
779 #define _TRISB0 0x01
780 #define _TRISB1 0x02
781 #define _TRISB2 0x04
782 #define _TRISB3 0x08
783 #define _TRISB4 0x10
784 #define _TRISB5 0x20
785 #define _TRISB6 0x40
786 #define _TRISB7 0x80
788 //==============================================================================
791 //==============================================================================
792 // PIE1 Bits
794 extern __at(0x0091) __sfr PIE1;
796 typedef struct
798 unsigned TMR1IE : 1;
799 unsigned TMR2IE : 1;
800 unsigned CCP1IE : 1;
801 unsigned SSP1IE : 1;
802 unsigned TXIE : 1;
803 unsigned RCIE : 1;
804 unsigned ADIE : 1;
805 unsigned TMR1GIE : 1;
806 } __PIE1bits_t;
808 extern __at(0x0091) volatile __PIE1bits_t PIE1bits;
810 #define _TMR1IE 0x01
811 #define _TMR2IE 0x02
812 #define _CCP1IE 0x04
813 #define _SSP1IE 0x08
814 #define _TXIE 0x10
815 #define _RCIE 0x20
816 #define _ADIE 0x40
817 #define _TMR1GIE 0x80
819 //==============================================================================
822 //==============================================================================
823 // PIE2 Bits
825 extern __at(0x0092) __sfr PIE2;
827 typedef struct
829 unsigned CCP2IE : 1;
830 unsigned : 1;
831 unsigned : 1;
832 unsigned BCL1IE : 1;
833 unsigned EEIE : 1;
834 unsigned C1IE : 1;
835 unsigned C2IE : 1;
836 unsigned OSFIE : 1;
837 } __PIE2bits_t;
839 extern __at(0x0092) volatile __PIE2bits_t PIE2bits;
841 #define _CCP2IE 0x01
842 #define _BCL1IE 0x08
843 #define _EEIE 0x10
844 #define _C1IE 0x20
845 #define _C2IE 0x40
846 #define _OSFIE 0x80
848 //==============================================================================
851 //==============================================================================
852 // PIE3 Bits
854 extern __at(0x0093) __sfr PIE3;
856 typedef struct
858 unsigned : 1;
859 unsigned TMR4IE : 1;
860 unsigned : 1;
861 unsigned TMR6IE : 1;
862 unsigned CCP3IE : 1;
863 unsigned CCP4IE : 1;
864 unsigned : 1;
865 unsigned : 1;
866 } __PIE3bits_t;
868 extern __at(0x0093) volatile __PIE3bits_t PIE3bits;
870 #define _TMR4IE 0x02
871 #define _TMR6IE 0x08
872 #define _CCP3IE 0x10
873 #define _CCP4IE 0x20
875 //==============================================================================
878 //==============================================================================
879 // PIE4 Bits
881 extern __at(0x0094) __sfr PIE4;
883 typedef struct
885 unsigned SSP2IE : 1;
886 unsigned BCL2IE : 1;
887 unsigned : 1;
888 unsigned : 1;
889 unsigned : 1;
890 unsigned : 1;
891 unsigned : 1;
892 unsigned : 1;
893 } __PIE4bits_t;
895 extern __at(0x0094) volatile __PIE4bits_t PIE4bits;
897 #define _SSP2IE 0x01
898 #define _BCL2IE 0x02
900 //==============================================================================
903 //==============================================================================
904 // OPTION_REG Bits
906 extern __at(0x0095) __sfr OPTION_REG;
908 typedef union
910 struct
912 unsigned PS0 : 1;
913 unsigned PS1 : 1;
914 unsigned PS2 : 1;
915 unsigned PSA : 1;
916 unsigned TMR0SE : 1;
917 unsigned TMR0CS : 1;
918 unsigned INTEDG : 1;
919 unsigned NOT_WPUEN : 1;
922 struct
924 unsigned : 1;
925 unsigned : 1;
926 unsigned : 1;
927 unsigned : 1;
928 unsigned T0SE : 1;
929 unsigned T0CS : 1;
930 unsigned : 1;
931 unsigned : 1;
934 struct
936 unsigned PS : 3;
937 unsigned : 5;
939 } __OPTION_REGbits_t;
941 extern __at(0x0095) volatile __OPTION_REGbits_t OPTION_REGbits;
943 #define _PS0 0x01
944 #define _PS1 0x02
945 #define _PS2 0x04
946 #define _PSA 0x08
947 #define _TMR0SE 0x10
948 #define _T0SE 0x10
949 #define _TMR0CS 0x20
950 #define _T0CS 0x20
951 #define _INTEDG 0x40
952 #define _NOT_WPUEN 0x80
954 //==============================================================================
957 //==============================================================================
958 // PCON Bits
960 extern __at(0x0096) __sfr PCON;
962 typedef struct
964 unsigned NOT_BOR : 1;
965 unsigned NOT_POR : 1;
966 unsigned NOT_RI : 1;
967 unsigned NOT_RMCLR : 1;
968 unsigned : 1;
969 unsigned : 1;
970 unsigned STKUNF : 1;
971 unsigned STKOVF : 1;
972 } __PCONbits_t;
974 extern __at(0x0096) volatile __PCONbits_t PCONbits;
976 #define _NOT_BOR 0x01
977 #define _NOT_POR 0x02
978 #define _NOT_RI 0x04
979 #define _NOT_RMCLR 0x08
980 #define _STKUNF 0x40
981 #define _STKOVF 0x80
983 //==============================================================================
986 //==============================================================================
987 // WDTCON Bits
989 extern __at(0x0097) __sfr WDTCON;
991 typedef union
993 struct
995 unsigned SWDTEN : 1;
996 unsigned WDTPS0 : 1;
997 unsigned WDTPS1 : 1;
998 unsigned WDTPS2 : 1;
999 unsigned WDTPS3 : 1;
1000 unsigned WDTPS4 : 1;
1001 unsigned : 1;
1002 unsigned : 1;
1005 struct
1007 unsigned : 1;
1008 unsigned WDTPS : 5;
1009 unsigned : 2;
1011 } __WDTCONbits_t;
1013 extern __at(0x0097) volatile __WDTCONbits_t WDTCONbits;
1015 #define _SWDTEN 0x01
1016 #define _WDTPS0 0x02
1017 #define _WDTPS1 0x04
1018 #define _WDTPS2 0x08
1019 #define _WDTPS3 0x10
1020 #define _WDTPS4 0x20
1022 //==============================================================================
1025 //==============================================================================
1026 // OSCTUNE Bits
1028 extern __at(0x0098) __sfr OSCTUNE;
1030 typedef union
1032 struct
1034 unsigned TUN0 : 1;
1035 unsigned TUN1 : 1;
1036 unsigned TUN2 : 1;
1037 unsigned TUN3 : 1;
1038 unsigned TUN4 : 1;
1039 unsigned TUN5 : 1;
1040 unsigned : 1;
1041 unsigned : 1;
1044 struct
1046 unsigned TUN : 6;
1047 unsigned : 2;
1049 } __OSCTUNEbits_t;
1051 extern __at(0x0098) volatile __OSCTUNEbits_t OSCTUNEbits;
1053 #define _TUN0 0x01
1054 #define _TUN1 0x02
1055 #define _TUN2 0x04
1056 #define _TUN3 0x08
1057 #define _TUN4 0x10
1058 #define _TUN5 0x20
1060 //==============================================================================
1063 //==============================================================================
1064 // OSCCON Bits
1066 extern __at(0x0099) __sfr OSCCON;
1068 typedef union
1070 struct
1072 unsigned SCS0 : 1;
1073 unsigned SCS1 : 1;
1074 unsigned : 1;
1075 unsigned IRCF0 : 1;
1076 unsigned IRCF1 : 1;
1077 unsigned IRCF2 : 1;
1078 unsigned IRCF3 : 1;
1079 unsigned SPLLEN : 1;
1082 struct
1084 unsigned SCS : 2;
1085 unsigned : 6;
1088 struct
1090 unsigned : 3;
1091 unsigned IRCF : 4;
1092 unsigned : 1;
1094 } __OSCCONbits_t;
1096 extern __at(0x0099) volatile __OSCCONbits_t OSCCONbits;
1098 #define _SCS0 0x01
1099 #define _SCS1 0x02
1100 #define _IRCF0 0x08
1101 #define _IRCF1 0x10
1102 #define _IRCF2 0x20
1103 #define _IRCF3 0x40
1104 #define _SPLLEN 0x80
1106 //==============================================================================
1109 //==============================================================================
1110 // OSCSTAT Bits
1112 extern __at(0x009A) __sfr OSCSTAT;
1114 typedef struct
1116 unsigned HFIOFS : 1;
1117 unsigned LFIOFR : 1;
1118 unsigned MFIOFR : 1;
1119 unsigned HFIOFL : 1;
1120 unsigned HFIOFR : 1;
1121 unsigned OSTS : 1;
1122 unsigned PLLR : 1;
1123 unsigned T1OSCR : 1;
1124 } __OSCSTATbits_t;
1126 extern __at(0x009A) volatile __OSCSTATbits_t OSCSTATbits;
1128 #define _HFIOFS 0x01
1129 #define _LFIOFR 0x02
1130 #define _MFIOFR 0x04
1131 #define _HFIOFL 0x08
1132 #define _HFIOFR 0x10
1133 #define _OSTS 0x20
1134 #define _PLLR 0x40
1135 #define _T1OSCR 0x80
1137 //==============================================================================
1139 extern __at(0x009B) __sfr ADRES;
1140 extern __at(0x009B) __sfr ADRESL;
1141 extern __at(0x009C) __sfr ADRESH;
1143 //==============================================================================
1144 // ADCON0 Bits
1146 extern __at(0x009D) __sfr ADCON0;
1148 typedef union
1150 struct
1152 unsigned ADON : 1;
1153 unsigned GO_NOT_DONE : 1;
1154 unsigned CHS0 : 1;
1155 unsigned CHS1 : 1;
1156 unsigned CHS2 : 1;
1157 unsigned CHS3 : 1;
1158 unsigned CHS4 : 1;
1159 unsigned : 1;
1162 struct
1164 unsigned : 1;
1165 unsigned ADGO : 1;
1166 unsigned : 1;
1167 unsigned : 1;
1168 unsigned : 1;
1169 unsigned : 1;
1170 unsigned : 1;
1171 unsigned : 1;
1174 struct
1176 unsigned : 1;
1177 unsigned GO : 1;
1178 unsigned : 1;
1179 unsigned : 1;
1180 unsigned : 1;
1181 unsigned : 1;
1182 unsigned : 1;
1183 unsigned : 1;
1186 struct
1188 unsigned : 2;
1189 unsigned CHS : 5;
1190 unsigned : 1;
1192 } __ADCON0bits_t;
1194 extern __at(0x009D) volatile __ADCON0bits_t ADCON0bits;
1196 #define _ADON 0x01
1197 #define _GO_NOT_DONE 0x02
1198 #define _ADGO 0x02
1199 #define _GO 0x02
1200 #define _CHS0 0x04
1201 #define _CHS1 0x08
1202 #define _CHS2 0x10
1203 #define _CHS3 0x20
1204 #define _CHS4 0x40
1206 //==============================================================================
1209 //==============================================================================
1210 // ADCON1 Bits
1212 extern __at(0x009E) __sfr ADCON1;
1214 typedef union
1216 struct
1218 unsigned ADPREF0 : 1;
1219 unsigned ADPREF1 : 1;
1220 unsigned ADNREF : 1;
1221 unsigned : 1;
1222 unsigned ADCS0 : 1;
1223 unsigned ADCS1 : 1;
1224 unsigned ADCS2 : 1;
1225 unsigned ADFM : 1;
1228 struct
1230 unsigned ADPREF : 2;
1231 unsigned : 6;
1234 struct
1236 unsigned : 4;
1237 unsigned ADCS : 3;
1238 unsigned : 1;
1240 } __ADCON1bits_t;
1242 extern __at(0x009E) volatile __ADCON1bits_t ADCON1bits;
1244 #define _ADPREF0 0x01
1245 #define _ADPREF1 0x02
1246 #define _ADNREF 0x04
1247 #define _ADCS0 0x10
1248 #define _ADCS1 0x20
1249 #define _ADCS2 0x40
1250 #define _ADFM 0x80
1252 //==============================================================================
1255 //==============================================================================
1256 // LATA Bits
1258 extern __at(0x010C) __sfr LATA;
1260 typedef struct
1262 unsigned LATA0 : 1;
1263 unsigned LATA1 : 1;
1264 unsigned LATA2 : 1;
1265 unsigned LATA3 : 1;
1266 unsigned LATA4 : 1;
1267 unsigned : 1;
1268 unsigned LATA6 : 1;
1269 unsigned LATA7 : 1;
1270 } __LATAbits_t;
1272 extern __at(0x010C) volatile __LATAbits_t LATAbits;
1274 #define _LATA0 0x01
1275 #define _LATA1 0x02
1276 #define _LATA2 0x04
1277 #define _LATA3 0x08
1278 #define _LATA4 0x10
1279 #define _LATA6 0x40
1280 #define _LATA7 0x80
1282 //==============================================================================
1285 //==============================================================================
1286 // LATB Bits
1288 extern __at(0x010D) __sfr LATB;
1290 typedef struct
1292 unsigned LATB0 : 1;
1293 unsigned LATB1 : 1;
1294 unsigned LATB2 : 1;
1295 unsigned LATB3 : 1;
1296 unsigned LATB4 : 1;
1297 unsigned LATB5 : 1;
1298 unsigned LATB6 : 1;
1299 unsigned LATB7 : 1;
1300 } __LATBbits_t;
1302 extern __at(0x010D) volatile __LATBbits_t LATBbits;
1304 #define _LATB0 0x01
1305 #define _LATB1 0x02
1306 #define _LATB2 0x04
1307 #define _LATB3 0x08
1308 #define _LATB4 0x10
1309 #define _LATB5 0x20
1310 #define _LATB6 0x40
1311 #define _LATB7 0x80
1313 //==============================================================================
1316 //==============================================================================
1317 // CM1CON0 Bits
1319 extern __at(0x0111) __sfr CM1CON0;
1321 typedef struct
1323 unsigned C1SYNC : 1;
1324 unsigned C1HYS : 1;
1325 unsigned C1SP : 1;
1326 unsigned : 1;
1327 unsigned C1POL : 1;
1328 unsigned C1OE : 1;
1329 unsigned C1OUT : 1;
1330 unsigned C1ON : 1;
1331 } __CM1CON0bits_t;
1333 extern __at(0x0111) volatile __CM1CON0bits_t CM1CON0bits;
1335 #define _C1SYNC 0x01
1336 #define _C1HYS 0x02
1337 #define _C1SP 0x04
1338 #define _C1POL 0x10
1339 #define _C1OE 0x20
1340 #define _C1OUT 0x40
1341 #define _C1ON 0x80
1343 //==============================================================================
1346 //==============================================================================
1347 // CM1CON1 Bits
1349 extern __at(0x0112) __sfr CM1CON1;
1351 typedef union
1353 struct
1355 unsigned C1NCH0 : 1;
1356 unsigned C1NCH1 : 1;
1357 unsigned : 1;
1358 unsigned : 1;
1359 unsigned C1PCH0 : 1;
1360 unsigned C1PCH1 : 1;
1361 unsigned C1INTN : 1;
1362 unsigned C1INTP : 1;
1365 struct
1367 unsigned C1NCH : 2;
1368 unsigned : 6;
1371 struct
1373 unsigned : 4;
1374 unsigned C1PCH : 2;
1375 unsigned : 2;
1377 } __CM1CON1bits_t;
1379 extern __at(0x0112) volatile __CM1CON1bits_t CM1CON1bits;
1381 #define _C1NCH0 0x01
1382 #define _C1NCH1 0x02
1383 #define _C1PCH0 0x10
1384 #define _C1PCH1 0x20
1385 #define _C1INTN 0x40
1386 #define _C1INTP 0x80
1388 //==============================================================================
1391 //==============================================================================
1392 // CM2CON0 Bits
1394 extern __at(0x0113) __sfr CM2CON0;
1396 typedef struct
1398 unsigned C2SYNC : 1;
1399 unsigned C2HYS : 1;
1400 unsigned C2SP : 1;
1401 unsigned : 1;
1402 unsigned C2POL : 1;
1403 unsigned C2OE : 1;
1404 unsigned C2OUT : 1;
1405 unsigned C2ON : 1;
1406 } __CM2CON0bits_t;
1408 extern __at(0x0113) volatile __CM2CON0bits_t CM2CON0bits;
1410 #define _C2SYNC 0x01
1411 #define _C2HYS 0x02
1412 #define _C2SP 0x04
1413 #define _C2POL 0x10
1414 #define _C2OE 0x20
1415 #define _C2OUT 0x40
1416 #define _C2ON 0x80
1418 //==============================================================================
1421 //==============================================================================
1422 // CM2CON1 Bits
1424 extern __at(0x0114) __sfr CM2CON1;
1426 typedef union
1428 struct
1430 unsigned C2NCH0 : 1;
1431 unsigned C2NCH1 : 1;
1432 unsigned : 1;
1433 unsigned : 1;
1434 unsigned C2PCH0 : 1;
1435 unsigned C2PCH1 : 1;
1436 unsigned C2INTN : 1;
1437 unsigned C2INTP : 1;
1440 struct
1442 unsigned C2NCH : 2;
1443 unsigned : 6;
1446 struct
1448 unsigned : 4;
1449 unsigned C2PCH : 2;
1450 unsigned : 2;
1452 } __CM2CON1bits_t;
1454 extern __at(0x0114) volatile __CM2CON1bits_t CM2CON1bits;
1456 #define _C2NCH0 0x01
1457 #define _C2NCH1 0x02
1458 #define _C2PCH0 0x10
1459 #define _C2PCH1 0x20
1460 #define _C2INTN 0x40
1461 #define _C2INTP 0x80
1463 //==============================================================================
1466 //==============================================================================
1467 // CMOUT Bits
1469 extern __at(0x0115) __sfr CMOUT;
1471 typedef struct
1473 unsigned MC1OUT : 1;
1474 unsigned MC2OUT : 1;
1475 unsigned : 1;
1476 unsigned : 1;
1477 unsigned : 1;
1478 unsigned : 1;
1479 unsigned : 1;
1480 unsigned : 1;
1481 } __CMOUTbits_t;
1483 extern __at(0x0115) volatile __CMOUTbits_t CMOUTbits;
1485 #define _MC1OUT 0x01
1486 #define _MC2OUT 0x02
1488 //==============================================================================
1491 //==============================================================================
1492 // BORCON Bits
1494 extern __at(0x0116) __sfr BORCON;
1496 typedef struct
1498 unsigned BORRDY : 1;
1499 unsigned : 1;
1500 unsigned : 1;
1501 unsigned : 1;
1502 unsigned : 1;
1503 unsigned : 1;
1504 unsigned : 1;
1505 unsigned SBOREN : 1;
1506 } __BORCONbits_t;
1508 extern __at(0x0116) volatile __BORCONbits_t BORCONbits;
1510 #define _BORRDY 0x01
1511 #define _SBOREN 0x80
1513 //==============================================================================
1516 //==============================================================================
1517 // FVRCON Bits
1519 extern __at(0x0117) __sfr FVRCON;
1521 typedef union
1523 struct
1525 unsigned ADFVR0 : 1;
1526 unsigned ADFVR1 : 1;
1527 unsigned CDAFVR0 : 1;
1528 unsigned CDAFVR1 : 1;
1529 unsigned TSRNG : 1;
1530 unsigned TSEN : 1;
1531 unsigned FVRRDY : 1;
1532 unsigned FVREN : 1;
1535 struct
1537 unsigned ADFVR : 2;
1538 unsigned : 6;
1541 struct
1543 unsigned : 2;
1544 unsigned CDAFVR : 2;
1545 unsigned : 4;
1547 } __FVRCONbits_t;
1549 extern __at(0x0117) volatile __FVRCONbits_t FVRCONbits;
1551 #define _ADFVR0 0x01
1552 #define _ADFVR1 0x02
1553 #define _CDAFVR0 0x04
1554 #define _CDAFVR1 0x08
1555 #define _TSRNG 0x10
1556 #define _TSEN 0x20
1557 #define _FVRRDY 0x40
1558 #define _FVREN 0x80
1560 //==============================================================================
1563 //==============================================================================
1564 // DACCON0 Bits
1566 extern __at(0x0118) __sfr DACCON0;
1568 typedef union
1570 struct
1572 unsigned DACNSS : 1;
1573 unsigned : 1;
1574 unsigned DACPSS0 : 1;
1575 unsigned DACPSS1 : 1;
1576 unsigned : 1;
1577 unsigned DACOE : 1;
1578 unsigned DACLPS : 1;
1579 unsigned DACEN : 1;
1582 struct
1584 unsigned : 2;
1585 unsigned DACPSS : 2;
1586 unsigned : 4;
1588 } __DACCON0bits_t;
1590 extern __at(0x0118) volatile __DACCON0bits_t DACCON0bits;
1592 #define _DACNSS 0x01
1593 #define _DACPSS0 0x04
1594 #define _DACPSS1 0x08
1595 #define _DACOE 0x20
1596 #define _DACLPS 0x40
1597 #define _DACEN 0x80
1599 //==============================================================================
1602 //==============================================================================
1603 // DACCON1 Bits
1605 extern __at(0x0119) __sfr DACCON1;
1607 typedef union
1609 struct
1611 unsigned DACR0 : 1;
1612 unsigned DACR1 : 1;
1613 unsigned DACR2 : 1;
1614 unsigned DACR3 : 1;
1615 unsigned DACR4 : 1;
1616 unsigned : 1;
1617 unsigned : 1;
1618 unsigned : 1;
1621 struct
1623 unsigned DACR : 5;
1624 unsigned : 3;
1626 } __DACCON1bits_t;
1628 extern __at(0x0119) volatile __DACCON1bits_t DACCON1bits;
1630 #define _DACR0 0x01
1631 #define _DACR1 0x02
1632 #define _DACR2 0x04
1633 #define _DACR3 0x08
1634 #define _DACR4 0x10
1636 //==============================================================================
1639 //==============================================================================
1640 // SRCON0 Bits
1642 extern __at(0x011A) __sfr SRCON0;
1644 typedef union
1646 struct
1648 unsigned SRPR : 1;
1649 unsigned SRPS : 1;
1650 unsigned SRNQEN : 1;
1651 unsigned SRQEN : 1;
1652 unsigned SRCLK0 : 1;
1653 unsigned SRCLK1 : 1;
1654 unsigned SRCLK2 : 1;
1655 unsigned SRLEN : 1;
1658 struct
1660 unsigned : 4;
1661 unsigned SRCLK : 3;
1662 unsigned : 1;
1664 } __SRCON0bits_t;
1666 extern __at(0x011A) volatile __SRCON0bits_t SRCON0bits;
1668 #define _SRPR 0x01
1669 #define _SRPS 0x02
1670 #define _SRNQEN 0x04
1671 #define _SRQEN 0x08
1672 #define _SRCLK0 0x10
1673 #define _SRCLK1 0x20
1674 #define _SRCLK2 0x40
1675 #define _SRLEN 0x80
1677 //==============================================================================
1680 //==============================================================================
1681 // SRCON1 Bits
1683 extern __at(0x011B) __sfr SRCON1;
1685 typedef struct
1687 unsigned SRRC1E : 1;
1688 unsigned SRRC2E : 1;
1689 unsigned SRRCKE : 1;
1690 unsigned SRRPE : 1;
1691 unsigned SRSC1E : 1;
1692 unsigned SRSC2E : 1;
1693 unsigned SRSCKE : 1;
1694 unsigned SRSPE : 1;
1695 } __SRCON1bits_t;
1697 extern __at(0x011B) volatile __SRCON1bits_t SRCON1bits;
1699 #define _SRRC1E 0x01
1700 #define _SRRC2E 0x02
1701 #define _SRRCKE 0x04
1702 #define _SRRPE 0x08
1703 #define _SRSC1E 0x10
1704 #define _SRSC2E 0x20
1705 #define _SRSCKE 0x40
1706 #define _SRSPE 0x80
1708 //==============================================================================
1711 //==============================================================================
1712 // APFCON0 Bits
1714 extern __at(0x011D) __sfr APFCON0;
1716 typedef struct
1718 unsigned CCP1SEL : 1;
1719 unsigned P1CSEL : 1;
1720 unsigned P1DSEL : 1;
1721 unsigned CCP2SEL : 1;
1722 unsigned P2BSEL : 1;
1723 unsigned SS1SEL : 1;
1724 unsigned SDO1SEL : 1;
1725 unsigned RXDTSEL : 1;
1726 } __APFCON0bits_t;
1728 extern __at(0x011D) volatile __APFCON0bits_t APFCON0bits;
1730 #define _CCP1SEL 0x01
1731 #define _P1CSEL 0x02
1732 #define _P1DSEL 0x04
1733 #define _CCP2SEL 0x08
1734 #define _P2BSEL 0x10
1735 #define _SS1SEL 0x20
1736 #define _SDO1SEL 0x40
1737 #define _RXDTSEL 0x80
1739 //==============================================================================
1742 //==============================================================================
1743 // APFCON1 Bits
1745 extern __at(0x011E) __sfr APFCON1;
1747 typedef struct
1749 unsigned TXCKSEL : 1;
1750 unsigned : 1;
1751 unsigned : 1;
1752 unsigned : 1;
1753 unsigned : 1;
1754 unsigned : 1;
1755 unsigned : 1;
1756 unsigned : 1;
1757 } __APFCON1bits_t;
1759 extern __at(0x011E) volatile __APFCON1bits_t APFCON1bits;
1761 #define _TXCKSEL 0x01
1763 //==============================================================================
1766 //==============================================================================
1767 // ANSELA Bits
1769 extern __at(0x018C) __sfr ANSELA;
1771 typedef union
1773 struct
1775 unsigned ANSA0 : 1;
1776 unsigned ANSA1 : 1;
1777 unsigned ANSA2 : 1;
1778 unsigned ANSA3 : 1;
1779 unsigned ANSA4 : 1;
1780 unsigned : 1;
1781 unsigned : 1;
1782 unsigned : 1;
1785 struct
1787 unsigned ANSA : 5;
1788 unsigned : 3;
1790 } __ANSELAbits_t;
1792 extern __at(0x018C) volatile __ANSELAbits_t ANSELAbits;
1794 #define _ANSA0 0x01
1795 #define _ANSA1 0x02
1796 #define _ANSA2 0x04
1797 #define _ANSA3 0x08
1798 #define _ANSA4 0x10
1800 //==============================================================================
1803 //==============================================================================
1804 // ANSELB Bits
1806 extern __at(0x018D) __sfr ANSELB;
1808 typedef struct
1810 unsigned : 1;
1811 unsigned ANSB1 : 1;
1812 unsigned ANSB2 : 1;
1813 unsigned ANSB3 : 1;
1814 unsigned ANSB4 : 1;
1815 unsigned ANSB5 : 1;
1816 unsigned ANSB6 : 1;
1817 unsigned ANSB7 : 1;
1818 } __ANSELBbits_t;
1820 extern __at(0x018D) volatile __ANSELBbits_t ANSELBbits;
1822 #define _ANSB1 0x02
1823 #define _ANSB2 0x04
1824 #define _ANSB3 0x08
1825 #define _ANSB4 0x10
1826 #define _ANSB5 0x20
1827 #define _ANSB6 0x40
1828 #define _ANSB7 0x80
1830 //==============================================================================
1832 extern __at(0x0191) __sfr EEADR;
1833 extern __at(0x0191) __sfr EEADRL;
1834 extern __at(0x0192) __sfr EEADRH;
1835 extern __at(0x0193) __sfr EEDAT;
1836 extern __at(0x0193) __sfr EEDATL;
1837 extern __at(0x0194) __sfr EEDATH;
1839 //==============================================================================
1840 // EECON1 Bits
1842 extern __at(0x0195) __sfr EECON1;
1844 typedef struct
1846 unsigned RD : 1;
1847 unsigned WR : 1;
1848 unsigned WREN : 1;
1849 unsigned WRERR : 1;
1850 unsigned FREE : 1;
1851 unsigned LWLO : 1;
1852 unsigned CFGS : 1;
1853 unsigned EEPGD : 1;
1854 } __EECON1bits_t;
1856 extern __at(0x0195) volatile __EECON1bits_t EECON1bits;
1858 #define _RD 0x01
1859 #define _WR 0x02
1860 #define _WREN 0x04
1861 #define _WRERR 0x08
1862 #define _FREE 0x10
1863 #define _LWLO 0x20
1864 #define _CFGS 0x40
1865 #define _EEPGD 0x80
1867 //==============================================================================
1869 extern __at(0x0196) __sfr EECON2;
1870 extern __at(0x0199) __sfr RCREG;
1871 extern __at(0x019A) __sfr TXREG;
1872 extern __at(0x019B) __sfr SP1BRG;
1873 extern __at(0x019B) __sfr SP1BRGL;
1874 extern __at(0x019B) __sfr SPBRG;
1875 extern __at(0x019B) __sfr SPBRGL;
1876 extern __at(0x019C) __sfr SP1BRGH;
1877 extern __at(0x019C) __sfr SPBRGH;
1879 //==============================================================================
1880 // RCSTA Bits
1882 extern __at(0x019D) __sfr RCSTA;
1884 typedef struct
1886 unsigned RX9D : 1;
1887 unsigned OERR : 1;
1888 unsigned FERR : 1;
1889 unsigned ADDEN : 1;
1890 unsigned CREN : 1;
1891 unsigned SREN : 1;
1892 unsigned RX9 : 1;
1893 unsigned SPEN : 1;
1894 } __RCSTAbits_t;
1896 extern __at(0x019D) volatile __RCSTAbits_t RCSTAbits;
1898 #define _RX9D 0x01
1899 #define _OERR 0x02
1900 #define _FERR 0x04
1901 #define _ADDEN 0x08
1902 #define _CREN 0x10
1903 #define _SREN 0x20
1904 #define _RX9 0x40
1905 #define _SPEN 0x80
1907 //==============================================================================
1910 //==============================================================================
1911 // TXSTA Bits
1913 extern __at(0x019E) __sfr TXSTA;
1915 typedef struct
1917 unsigned TX9D : 1;
1918 unsigned TRMT : 1;
1919 unsigned BRGH : 1;
1920 unsigned SENDB : 1;
1921 unsigned SYNC : 1;
1922 unsigned TXEN : 1;
1923 unsigned TX9 : 1;
1924 unsigned CSRC : 1;
1925 } __TXSTAbits_t;
1927 extern __at(0x019E) volatile __TXSTAbits_t TXSTAbits;
1929 #define _TX9D 0x01
1930 #define _TRMT 0x02
1931 #define _BRGH 0x04
1932 #define _SENDB 0x08
1933 #define _SYNC 0x10
1934 #define _TXEN 0x20
1935 #define _TX9 0x40
1936 #define _CSRC 0x80
1938 //==============================================================================
1941 //==============================================================================
1942 // BAUDCON Bits
1944 extern __at(0x019F) __sfr BAUDCON;
1946 typedef struct
1948 unsigned ABDEN : 1;
1949 unsigned WUE : 1;
1950 unsigned : 1;
1951 unsigned BRG16 : 1;
1952 unsigned SCKP : 1;
1953 unsigned : 1;
1954 unsigned RCIDL : 1;
1955 unsigned ABDOVF : 1;
1956 } __BAUDCONbits_t;
1958 extern __at(0x019F) volatile __BAUDCONbits_t BAUDCONbits;
1960 #define _ABDEN 0x01
1961 #define _WUE 0x02
1962 #define _BRG16 0x08
1963 #define _SCKP 0x10
1964 #define _RCIDL 0x40
1965 #define _ABDOVF 0x80
1967 //==============================================================================
1970 //==============================================================================
1971 // WPUA Bits
1973 extern __at(0x020C) __sfr WPUA;
1975 typedef struct
1977 unsigned : 1;
1978 unsigned : 1;
1979 unsigned : 1;
1980 unsigned : 1;
1981 unsigned : 1;
1982 unsigned WPUA5 : 1;
1983 unsigned : 1;
1984 unsigned : 1;
1985 } __WPUAbits_t;
1987 extern __at(0x020C) volatile __WPUAbits_t WPUAbits;
1989 #define _WPUA5 0x20
1991 //==============================================================================
1994 //==============================================================================
1995 // WPUB Bits
1997 extern __at(0x020D) __sfr WPUB;
1999 typedef struct
2001 unsigned WPUB0 : 1;
2002 unsigned WPUB1 : 1;
2003 unsigned WPUB2 : 1;
2004 unsigned WPUB3 : 1;
2005 unsigned WPUB4 : 1;
2006 unsigned WPUB5 : 1;
2007 unsigned WPUB6 : 1;
2008 unsigned WPUB7 : 1;
2009 } __WPUBbits_t;
2011 extern __at(0x020D) volatile __WPUBbits_t WPUBbits;
2013 #define _WPUB0 0x01
2014 #define _WPUB1 0x02
2015 #define _WPUB2 0x04
2016 #define _WPUB3 0x08
2017 #define _WPUB4 0x10
2018 #define _WPUB5 0x20
2019 #define _WPUB6 0x40
2020 #define _WPUB7 0x80
2022 //==============================================================================
2024 extern __at(0x0211) __sfr SSP1BUF;
2025 extern __at(0x0211) __sfr SSPBUF;
2026 extern __at(0x0212) __sfr SSP1ADD;
2027 extern __at(0x0212) __sfr SSPADD;
2028 extern __at(0x0213) __sfr SSP1MSK;
2029 extern __at(0x0213) __sfr SSPMSK;
2031 //==============================================================================
2032 // SSP1STAT Bits
2034 extern __at(0x0214) __sfr SSP1STAT;
2036 typedef struct
2038 unsigned BF : 1;
2039 unsigned UA : 1;
2040 unsigned R_NOT_W : 1;
2041 unsigned S : 1;
2042 unsigned P : 1;
2043 unsigned D_NOT_A : 1;
2044 unsigned CKE : 1;
2045 unsigned SMP : 1;
2046 } __SSP1STATbits_t;
2048 extern __at(0x0214) volatile __SSP1STATbits_t SSP1STATbits;
2050 #define _BF 0x01
2051 #define _UA 0x02
2052 #define _R_NOT_W 0x04
2053 #define _S 0x08
2054 #define _P 0x10
2055 #define _D_NOT_A 0x20
2056 #define _CKE 0x40
2057 #define _SMP 0x80
2059 //==============================================================================
2062 //==============================================================================
2063 // SSPSTAT Bits
2065 extern __at(0x0214) __sfr SSPSTAT;
2067 typedef struct
2069 unsigned BF : 1;
2070 unsigned UA : 1;
2071 unsigned R_NOT_W : 1;
2072 unsigned S : 1;
2073 unsigned P : 1;
2074 unsigned D_NOT_A : 1;
2075 unsigned CKE : 1;
2076 unsigned SMP : 1;
2077 } __SSPSTATbits_t;
2079 extern __at(0x0214) volatile __SSPSTATbits_t SSPSTATbits;
2081 #define _SSPSTAT_BF 0x01
2082 #define _SSPSTAT_UA 0x02
2083 #define _SSPSTAT_R_NOT_W 0x04
2084 #define _SSPSTAT_S 0x08
2085 #define _SSPSTAT_P 0x10
2086 #define _SSPSTAT_D_NOT_A 0x20
2087 #define _SSPSTAT_CKE 0x40
2088 #define _SSPSTAT_SMP 0x80
2090 //==============================================================================
2093 //==============================================================================
2094 // SSP1CON1 Bits
2096 extern __at(0x0215) __sfr SSP1CON1;
2098 typedef union
2100 struct
2102 unsigned SSPM0 : 1;
2103 unsigned SSPM1 : 1;
2104 unsigned SSPM2 : 1;
2105 unsigned SSPM3 : 1;
2106 unsigned CKP : 1;
2107 unsigned SSPEN : 1;
2108 unsigned SSPOV : 1;
2109 unsigned WCOL : 1;
2112 struct
2114 unsigned SSPM : 4;
2115 unsigned : 4;
2117 } __SSP1CON1bits_t;
2119 extern __at(0x0215) volatile __SSP1CON1bits_t SSP1CON1bits;
2121 #define _SSPM0 0x01
2122 #define _SSPM1 0x02
2123 #define _SSPM2 0x04
2124 #define _SSPM3 0x08
2125 #define _CKP 0x10
2126 #define _SSPEN 0x20
2127 #define _SSPOV 0x40
2128 #define _WCOL 0x80
2130 //==============================================================================
2133 //==============================================================================
2134 // SSPCON Bits
2136 extern __at(0x0215) __sfr SSPCON;
2138 typedef union
2140 struct
2142 unsigned SSPM0 : 1;
2143 unsigned SSPM1 : 1;
2144 unsigned SSPM2 : 1;
2145 unsigned SSPM3 : 1;
2146 unsigned CKP : 1;
2147 unsigned SSPEN : 1;
2148 unsigned SSPOV : 1;
2149 unsigned WCOL : 1;
2152 struct
2154 unsigned SSPM : 4;
2155 unsigned : 4;
2157 } __SSPCONbits_t;
2159 extern __at(0x0215) volatile __SSPCONbits_t SSPCONbits;
2161 #define _SSPCON_SSPM0 0x01
2162 #define _SSPCON_SSPM1 0x02
2163 #define _SSPCON_SSPM2 0x04
2164 #define _SSPCON_SSPM3 0x08
2165 #define _SSPCON_CKP 0x10
2166 #define _SSPCON_SSPEN 0x20
2167 #define _SSPCON_SSPOV 0x40
2168 #define _SSPCON_WCOL 0x80
2170 //==============================================================================
2173 //==============================================================================
2174 // SSPCON1 Bits
2176 extern __at(0x0215) __sfr SSPCON1;
2178 typedef union
2180 struct
2182 unsigned SSPM0 : 1;
2183 unsigned SSPM1 : 1;
2184 unsigned SSPM2 : 1;
2185 unsigned SSPM3 : 1;
2186 unsigned CKP : 1;
2187 unsigned SSPEN : 1;
2188 unsigned SSPOV : 1;
2189 unsigned WCOL : 1;
2192 struct
2194 unsigned SSPM : 4;
2195 unsigned : 4;
2197 } __SSPCON1bits_t;
2199 extern __at(0x0215) volatile __SSPCON1bits_t SSPCON1bits;
2201 #define _SSPCON1_SSPM0 0x01
2202 #define _SSPCON1_SSPM1 0x02
2203 #define _SSPCON1_SSPM2 0x04
2204 #define _SSPCON1_SSPM3 0x08
2205 #define _SSPCON1_CKP 0x10
2206 #define _SSPCON1_SSPEN 0x20
2207 #define _SSPCON1_SSPOV 0x40
2208 #define _SSPCON1_WCOL 0x80
2210 //==============================================================================
2213 //==============================================================================
2214 // SSP1CON2 Bits
2216 extern __at(0x0216) __sfr SSP1CON2;
2218 typedef struct
2220 unsigned SEN : 1;
2221 unsigned RSEN : 1;
2222 unsigned PEN : 1;
2223 unsigned RCEN : 1;
2224 unsigned ACKEN : 1;
2225 unsigned ACKDT : 1;
2226 unsigned ACKSTAT : 1;
2227 unsigned GCEN : 1;
2228 } __SSP1CON2bits_t;
2230 extern __at(0x0216) volatile __SSP1CON2bits_t SSP1CON2bits;
2232 #define _SEN 0x01
2233 #define _RSEN 0x02
2234 #define _PEN 0x04
2235 #define _RCEN 0x08
2236 #define _ACKEN 0x10
2237 #define _ACKDT 0x20
2238 #define _ACKSTAT 0x40
2239 #define _GCEN 0x80
2241 //==============================================================================
2244 //==============================================================================
2245 // SSPCON2 Bits
2247 extern __at(0x0216) __sfr SSPCON2;
2249 typedef struct
2251 unsigned SEN : 1;
2252 unsigned RSEN : 1;
2253 unsigned PEN : 1;
2254 unsigned RCEN : 1;
2255 unsigned ACKEN : 1;
2256 unsigned ACKDT : 1;
2257 unsigned ACKSTAT : 1;
2258 unsigned GCEN : 1;
2259 } __SSPCON2bits_t;
2261 extern __at(0x0216) volatile __SSPCON2bits_t SSPCON2bits;
2263 #define _SSPCON2_SEN 0x01
2264 #define _SSPCON2_RSEN 0x02
2265 #define _SSPCON2_PEN 0x04
2266 #define _SSPCON2_RCEN 0x08
2267 #define _SSPCON2_ACKEN 0x10
2268 #define _SSPCON2_ACKDT 0x20
2269 #define _SSPCON2_ACKSTAT 0x40
2270 #define _SSPCON2_GCEN 0x80
2272 //==============================================================================
2275 //==============================================================================
2276 // SSP1CON3 Bits
2278 extern __at(0x0217) __sfr SSP1CON3;
2280 typedef struct
2282 unsigned DHEN : 1;
2283 unsigned AHEN : 1;
2284 unsigned SBCDE : 1;
2285 unsigned SDAHT : 1;
2286 unsigned BOEN : 1;
2287 unsigned SCIE : 1;
2288 unsigned PCIE : 1;
2289 unsigned ACKTIM : 1;
2290 } __SSP1CON3bits_t;
2292 extern __at(0x0217) volatile __SSP1CON3bits_t SSP1CON3bits;
2294 #define _DHEN 0x01
2295 #define _AHEN 0x02
2296 #define _SBCDE 0x04
2297 #define _SDAHT 0x08
2298 #define _BOEN 0x10
2299 #define _SCIE 0x20
2300 #define _PCIE 0x40
2301 #define _ACKTIM 0x80
2303 //==============================================================================
2306 //==============================================================================
2307 // SSPCON3 Bits
2309 extern __at(0x0217) __sfr SSPCON3;
2311 typedef struct
2313 unsigned DHEN : 1;
2314 unsigned AHEN : 1;
2315 unsigned SBCDE : 1;
2316 unsigned SDAHT : 1;
2317 unsigned BOEN : 1;
2318 unsigned SCIE : 1;
2319 unsigned PCIE : 1;
2320 unsigned ACKTIM : 1;
2321 } __SSPCON3bits_t;
2323 extern __at(0x0217) volatile __SSPCON3bits_t SSPCON3bits;
2325 #define _SSPCON3_DHEN 0x01
2326 #define _SSPCON3_AHEN 0x02
2327 #define _SSPCON3_SBCDE 0x04
2328 #define _SSPCON3_SDAHT 0x08
2329 #define _SSPCON3_BOEN 0x10
2330 #define _SSPCON3_SCIE 0x20
2331 #define _SSPCON3_PCIE 0x40
2332 #define _SSPCON3_ACKTIM 0x80
2334 //==============================================================================
2336 extern __at(0x0219) __sfr SSP2BUF;
2337 extern __at(0x021A) __sfr SSP2ADD;
2338 extern __at(0x021B) __sfr SSP2MSK;
2340 //==============================================================================
2341 // SSP2STAT Bits
2343 extern __at(0x021C) __sfr SSP2STAT;
2345 typedef struct
2347 unsigned BF : 1;
2348 unsigned UA : 1;
2349 unsigned R_NOT_W : 1;
2350 unsigned S : 1;
2351 unsigned P : 1;
2352 unsigned D_NOT_A : 1;
2353 unsigned CKE : 1;
2354 unsigned SMP : 1;
2355 } __SSP2STATbits_t;
2357 extern __at(0x021C) volatile __SSP2STATbits_t SSP2STATbits;
2359 #define _SSP2STAT_BF 0x01
2360 #define _SSP2STAT_UA 0x02
2361 #define _SSP2STAT_R_NOT_W 0x04
2362 #define _SSP2STAT_S 0x08
2363 #define _SSP2STAT_P 0x10
2364 #define _SSP2STAT_D_NOT_A 0x20
2365 #define _SSP2STAT_CKE 0x40
2366 #define _SSP2STAT_SMP 0x80
2368 //==============================================================================
2371 //==============================================================================
2372 // SSP2CON1 Bits
2374 extern __at(0x021D) __sfr SSP2CON1;
2376 typedef union
2378 struct
2380 unsigned SSPM0 : 1;
2381 unsigned SSPM1 : 1;
2382 unsigned SSPM2 : 1;
2383 unsigned SSPM3 : 1;
2384 unsigned CKP : 1;
2385 unsigned SSPEN : 1;
2386 unsigned SSPOV : 1;
2387 unsigned WCOL : 1;
2390 struct
2392 unsigned SSPM : 4;
2393 unsigned : 4;
2395 } __SSP2CON1bits_t;
2397 extern __at(0x021D) volatile __SSP2CON1bits_t SSP2CON1bits;
2399 #define _SSP2CON1_SSPM0 0x01
2400 #define _SSP2CON1_SSPM1 0x02
2401 #define _SSP2CON1_SSPM2 0x04
2402 #define _SSP2CON1_SSPM3 0x08
2403 #define _SSP2CON1_CKP 0x10
2404 #define _SSP2CON1_SSPEN 0x20
2405 #define _SSP2CON1_SSPOV 0x40
2406 #define _SSP2CON1_WCOL 0x80
2408 //==============================================================================
2411 //==============================================================================
2412 // SSP2CON2 Bits
2414 extern __at(0x021E) __sfr SSP2CON2;
2416 typedef struct
2418 unsigned SEN : 1;
2419 unsigned RSEN : 1;
2420 unsigned PEN : 1;
2421 unsigned RCEN : 1;
2422 unsigned ACKEN : 1;
2423 unsigned ACKDT : 1;
2424 unsigned ACKSTAT : 1;
2425 unsigned GCEN : 1;
2426 } __SSP2CON2bits_t;
2428 extern __at(0x021E) volatile __SSP2CON2bits_t SSP2CON2bits;
2430 #define _SSP2CON2_SEN 0x01
2431 #define _SSP2CON2_RSEN 0x02
2432 #define _SSP2CON2_PEN 0x04
2433 #define _SSP2CON2_RCEN 0x08
2434 #define _SSP2CON2_ACKEN 0x10
2435 #define _SSP2CON2_ACKDT 0x20
2436 #define _SSP2CON2_ACKSTAT 0x40
2437 #define _SSP2CON2_GCEN 0x80
2439 //==============================================================================
2442 //==============================================================================
2443 // SSP2CON3 Bits
2445 extern __at(0x021F) __sfr SSP2CON3;
2447 typedef struct
2449 unsigned DHEN : 1;
2450 unsigned AHEN : 1;
2451 unsigned SBCDE : 1;
2452 unsigned SDAHT : 1;
2453 unsigned BOEN : 1;
2454 unsigned SCIE : 1;
2455 unsigned PCIE : 1;
2456 unsigned ACKTIM : 1;
2457 } __SSP2CON3bits_t;
2459 extern __at(0x021F) volatile __SSP2CON3bits_t SSP2CON3bits;
2461 #define _SSP2CON3_DHEN 0x01
2462 #define _SSP2CON3_AHEN 0x02
2463 #define _SSP2CON3_SBCDE 0x04
2464 #define _SSP2CON3_SDAHT 0x08
2465 #define _SSP2CON3_BOEN 0x10
2466 #define _SSP2CON3_SCIE 0x20
2467 #define _SSP2CON3_PCIE 0x40
2468 #define _SSP2CON3_ACKTIM 0x80
2470 //==============================================================================
2472 extern __at(0x0291) __sfr CCPR1;
2473 extern __at(0x0291) __sfr CCPR1L;
2474 extern __at(0x0292) __sfr CCPR1H;
2476 //==============================================================================
2477 // CCP1CON Bits
2479 extern __at(0x0293) __sfr CCP1CON;
2481 typedef union
2483 struct
2485 unsigned CCP1M0 : 1;
2486 unsigned CCP1M1 : 1;
2487 unsigned CCP1M2 : 1;
2488 unsigned CCP1M3 : 1;
2489 unsigned DC1B0 : 1;
2490 unsigned DC1B1 : 1;
2491 unsigned P1M0 : 1;
2492 unsigned P1M1 : 1;
2495 struct
2497 unsigned CCP1M : 4;
2498 unsigned : 4;
2501 struct
2503 unsigned : 4;
2504 unsigned DC1B : 2;
2505 unsigned : 2;
2508 struct
2510 unsigned : 6;
2511 unsigned P1M : 2;
2513 } __CCP1CONbits_t;
2515 extern __at(0x0293) volatile __CCP1CONbits_t CCP1CONbits;
2517 #define _CCP1M0 0x01
2518 #define _CCP1M1 0x02
2519 #define _CCP1M2 0x04
2520 #define _CCP1M3 0x08
2521 #define _DC1B0 0x10
2522 #define _DC1B1 0x20
2523 #define _P1M0 0x40
2524 #define _P1M1 0x80
2526 //==============================================================================
2529 //==============================================================================
2530 // PWM1CON Bits
2532 extern __at(0x0294) __sfr PWM1CON;
2534 typedef union
2536 struct
2538 unsigned P1DC0 : 1;
2539 unsigned P1DC1 : 1;
2540 unsigned P1DC2 : 1;
2541 unsigned P1DC3 : 1;
2542 unsigned P1DC4 : 1;
2543 unsigned P1DC5 : 1;
2544 unsigned P1DC6 : 1;
2545 unsigned P1RSEN : 1;
2548 struct
2550 unsigned P1DC : 7;
2551 unsigned : 1;
2553 } __PWM1CONbits_t;
2555 extern __at(0x0294) volatile __PWM1CONbits_t PWM1CONbits;
2557 #define _P1DC0 0x01
2558 #define _P1DC1 0x02
2559 #define _P1DC2 0x04
2560 #define _P1DC3 0x08
2561 #define _P1DC4 0x10
2562 #define _P1DC5 0x20
2563 #define _P1DC6 0x40
2564 #define _P1RSEN 0x80
2566 //==============================================================================
2569 //==============================================================================
2570 // CCP1AS Bits
2572 extern __at(0x0295) __sfr CCP1AS;
2574 typedef union
2576 struct
2578 unsigned PSS1BD0 : 1;
2579 unsigned PSS1BD1 : 1;
2580 unsigned PSS1AC0 : 1;
2581 unsigned PSS1AC1 : 1;
2582 unsigned CCP1AS0 : 1;
2583 unsigned CCP1AS1 : 1;
2584 unsigned CCP1AS2 : 1;
2585 unsigned CCP1ASE : 1;
2588 struct
2590 unsigned PSS1BD : 2;
2591 unsigned : 6;
2594 struct
2596 unsigned : 2;
2597 unsigned PSS1AC : 2;
2598 unsigned : 4;
2601 struct
2603 unsigned : 4;
2604 unsigned CCP1AS : 3;
2605 unsigned : 1;
2607 } __CCP1ASbits_t;
2609 extern __at(0x0295) volatile __CCP1ASbits_t CCP1ASbits;
2611 #define _PSS1BD0 0x01
2612 #define _PSS1BD1 0x02
2613 #define _PSS1AC0 0x04
2614 #define _PSS1AC1 0x08
2615 #define _CCP1AS0 0x10
2616 #define _CCP1AS1 0x20
2617 #define _CCP1AS2 0x40
2618 #define _CCP1ASE 0x80
2620 //==============================================================================
2623 //==============================================================================
2624 // ECCP1AS Bits
2626 extern __at(0x0295) __sfr ECCP1AS;
2628 typedef union
2630 struct
2632 unsigned PSS1BD0 : 1;
2633 unsigned PSS1BD1 : 1;
2634 unsigned PSS1AC0 : 1;
2635 unsigned PSS1AC1 : 1;
2636 unsigned CCP1AS0 : 1;
2637 unsigned CCP1AS1 : 1;
2638 unsigned CCP1AS2 : 1;
2639 unsigned CCP1ASE : 1;
2642 struct
2644 unsigned PSS1BD : 2;
2645 unsigned : 6;
2648 struct
2650 unsigned : 2;
2651 unsigned PSS1AC : 2;
2652 unsigned : 4;
2655 struct
2657 unsigned : 4;
2658 unsigned CCP1AS : 3;
2659 unsigned : 1;
2661 } __ECCP1ASbits_t;
2663 extern __at(0x0295) volatile __ECCP1ASbits_t ECCP1ASbits;
2665 #define _ECCP1AS_PSS1BD0 0x01
2666 #define _ECCP1AS_PSS1BD1 0x02
2667 #define _ECCP1AS_PSS1AC0 0x04
2668 #define _ECCP1AS_PSS1AC1 0x08
2669 #define _ECCP1AS_CCP1AS0 0x10
2670 #define _ECCP1AS_CCP1AS1 0x20
2671 #define _ECCP1AS_CCP1AS2 0x40
2672 #define _ECCP1AS_CCP1ASE 0x80
2674 //==============================================================================
2677 //==============================================================================
2678 // PSTR1CON Bits
2680 extern __at(0x0296) __sfr PSTR1CON;
2682 typedef struct
2684 unsigned STR1A : 1;
2685 unsigned STR1B : 1;
2686 unsigned STR1C : 1;
2687 unsigned STR1D : 1;
2688 unsigned STR1SYNC : 1;
2689 unsigned : 1;
2690 unsigned : 1;
2691 unsigned : 1;
2692 } __PSTR1CONbits_t;
2694 extern __at(0x0296) volatile __PSTR1CONbits_t PSTR1CONbits;
2696 #define _STR1A 0x01
2697 #define _STR1B 0x02
2698 #define _STR1C 0x04
2699 #define _STR1D 0x08
2700 #define _STR1SYNC 0x10
2702 //==============================================================================
2704 extern __at(0x0298) __sfr CCPR2;
2705 extern __at(0x0298) __sfr CCPR2L;
2706 extern __at(0x0299) __sfr CCPR2H;
2708 //==============================================================================
2709 // CCP2CON Bits
2711 extern __at(0x029A) __sfr CCP2CON;
2713 typedef union
2715 struct
2717 unsigned CCP2M0 : 1;
2718 unsigned CCP2M1 : 1;
2719 unsigned CCP2M2 : 1;
2720 unsigned CCP2M3 : 1;
2721 unsigned DC2B0 : 1;
2722 unsigned DC2B1 : 1;
2723 unsigned P2M0 : 1;
2724 unsigned P2M1 : 1;
2727 struct
2729 unsigned CCP2M : 4;
2730 unsigned : 4;
2733 struct
2735 unsigned : 4;
2736 unsigned DC2B : 2;
2737 unsigned : 2;
2740 struct
2742 unsigned : 6;
2743 unsigned P2M : 2;
2745 } __CCP2CONbits_t;
2747 extern __at(0x029A) volatile __CCP2CONbits_t CCP2CONbits;
2749 #define _CCP2M0 0x01
2750 #define _CCP2M1 0x02
2751 #define _CCP2M2 0x04
2752 #define _CCP2M3 0x08
2753 #define _DC2B0 0x10
2754 #define _DC2B1 0x20
2755 #define _P2M0 0x40
2756 #define _P2M1 0x80
2758 //==============================================================================
2761 //==============================================================================
2762 // PWM2CON Bits
2764 extern __at(0x029B) __sfr PWM2CON;
2766 typedef union
2768 struct
2770 unsigned P2DC0 : 1;
2771 unsigned P2DC1 : 1;
2772 unsigned P2DC2 : 1;
2773 unsigned P2DC3 : 1;
2774 unsigned P2DC4 : 1;
2775 unsigned P2DC5 : 1;
2776 unsigned P2DC6 : 1;
2777 unsigned P2RSEN : 1;
2780 struct
2782 unsigned P2DC : 7;
2783 unsigned : 1;
2785 } __PWM2CONbits_t;
2787 extern __at(0x029B) volatile __PWM2CONbits_t PWM2CONbits;
2789 #define _P2DC0 0x01
2790 #define _P2DC1 0x02
2791 #define _P2DC2 0x04
2792 #define _P2DC3 0x08
2793 #define _P2DC4 0x10
2794 #define _P2DC5 0x20
2795 #define _P2DC6 0x40
2796 #define _P2RSEN 0x80
2798 //==============================================================================
2801 //==============================================================================
2802 // CCP2AS Bits
2804 extern __at(0x029C) __sfr CCP2AS;
2806 typedef union
2808 struct
2810 unsigned PSS2BD0 : 1;
2811 unsigned PSS2BD1 : 1;
2812 unsigned PSS2AC0 : 1;
2813 unsigned PSS2AC1 : 1;
2814 unsigned CCP2AS0 : 1;
2815 unsigned CCP2AS1 : 1;
2816 unsigned CCP2AS2 : 1;
2817 unsigned CCP2ASE : 1;
2820 struct
2822 unsigned PSS2BD : 2;
2823 unsigned : 6;
2826 struct
2828 unsigned : 2;
2829 unsigned PSS2AC : 2;
2830 unsigned : 4;
2833 struct
2835 unsigned : 4;
2836 unsigned CCP2AS : 3;
2837 unsigned : 1;
2839 } __CCP2ASbits_t;
2841 extern __at(0x029C) volatile __CCP2ASbits_t CCP2ASbits;
2843 #define _PSS2BD0 0x01
2844 #define _PSS2BD1 0x02
2845 #define _PSS2AC0 0x04
2846 #define _PSS2AC1 0x08
2847 #define _CCP2AS0 0x10
2848 #define _CCP2AS1 0x20
2849 #define _CCP2AS2 0x40
2850 #define _CCP2ASE 0x80
2852 //==============================================================================
2855 //==============================================================================
2856 // ECCP2AS Bits
2858 extern __at(0x029C) __sfr ECCP2AS;
2860 typedef union
2862 struct
2864 unsigned PSS2BD0 : 1;
2865 unsigned PSS2BD1 : 1;
2866 unsigned PSS2AC0 : 1;
2867 unsigned PSS2AC1 : 1;
2868 unsigned CCP2AS0 : 1;
2869 unsigned CCP2AS1 : 1;
2870 unsigned CCP2AS2 : 1;
2871 unsigned CCP2ASE : 1;
2874 struct
2876 unsigned PSS2BD : 2;
2877 unsigned : 6;
2880 struct
2882 unsigned : 2;
2883 unsigned PSS2AC : 2;
2884 unsigned : 4;
2887 struct
2889 unsigned : 4;
2890 unsigned CCP2AS : 3;
2891 unsigned : 1;
2893 } __ECCP2ASbits_t;
2895 extern __at(0x029C) volatile __ECCP2ASbits_t ECCP2ASbits;
2897 #define _ECCP2AS_PSS2BD0 0x01
2898 #define _ECCP2AS_PSS2BD1 0x02
2899 #define _ECCP2AS_PSS2AC0 0x04
2900 #define _ECCP2AS_PSS2AC1 0x08
2901 #define _ECCP2AS_CCP2AS0 0x10
2902 #define _ECCP2AS_CCP2AS1 0x20
2903 #define _ECCP2AS_CCP2AS2 0x40
2904 #define _ECCP2AS_CCP2ASE 0x80
2906 //==============================================================================
2909 //==============================================================================
2910 // PSTR2CON Bits
2912 extern __at(0x029D) __sfr PSTR2CON;
2914 typedef struct
2916 unsigned STR2A : 1;
2917 unsigned STR2B : 1;
2918 unsigned STR2C : 1;
2919 unsigned STR2D : 1;
2920 unsigned STR2SYNC : 1;
2921 unsigned : 1;
2922 unsigned : 1;
2923 unsigned : 1;
2924 } __PSTR2CONbits_t;
2926 extern __at(0x029D) volatile __PSTR2CONbits_t PSTR2CONbits;
2928 #define _STR2A 0x01
2929 #define _STR2B 0x02
2930 #define _STR2C 0x04
2931 #define _STR2D 0x08
2932 #define _STR2SYNC 0x10
2934 //==============================================================================
2937 //==============================================================================
2938 // CCPTMRS Bits
2940 extern __at(0x029E) __sfr CCPTMRS;
2942 typedef union
2944 struct
2946 unsigned C1TSEL0 : 1;
2947 unsigned C1TSEL1 : 1;
2948 unsigned C2TSEL0 : 1;
2949 unsigned C2TSEL1 : 1;
2950 unsigned C3TSEL0 : 1;
2951 unsigned C3TSEL1 : 1;
2952 unsigned C4TSEL0 : 1;
2953 unsigned C4TSEL1 : 1;
2956 struct
2958 unsigned C1TSEL : 2;
2959 unsigned : 6;
2962 struct
2964 unsigned : 2;
2965 unsigned C2TSEL : 2;
2966 unsigned : 4;
2969 struct
2971 unsigned : 4;
2972 unsigned C3TSEL : 2;
2973 unsigned : 2;
2976 struct
2978 unsigned : 6;
2979 unsigned C4TSEL : 2;
2981 } __CCPTMRSbits_t;
2983 extern __at(0x029E) volatile __CCPTMRSbits_t CCPTMRSbits;
2985 #define _C1TSEL0 0x01
2986 #define _C1TSEL1 0x02
2987 #define _C2TSEL0 0x04
2988 #define _C2TSEL1 0x08
2989 #define _C3TSEL0 0x10
2990 #define _C3TSEL1 0x20
2991 #define _C4TSEL0 0x40
2992 #define _C4TSEL1 0x80
2994 //==============================================================================
2997 //==============================================================================
2998 // CCPTMRS0 Bits
3000 extern __at(0x029E) __sfr CCPTMRS0;
3002 typedef union
3004 struct
3006 unsigned C1TSEL0 : 1;
3007 unsigned C1TSEL1 : 1;
3008 unsigned C2TSEL0 : 1;
3009 unsigned C2TSEL1 : 1;
3010 unsigned C3TSEL0 : 1;
3011 unsigned C3TSEL1 : 1;
3012 unsigned C4TSEL0 : 1;
3013 unsigned C4TSEL1 : 1;
3016 struct
3018 unsigned C1TSEL : 2;
3019 unsigned : 6;
3022 struct
3024 unsigned : 2;
3025 unsigned C2TSEL : 2;
3026 unsigned : 4;
3029 struct
3031 unsigned : 4;
3032 unsigned C3TSEL : 2;
3033 unsigned : 2;
3036 struct
3038 unsigned : 6;
3039 unsigned C4TSEL : 2;
3041 } __CCPTMRS0bits_t;
3043 extern __at(0x029E) volatile __CCPTMRS0bits_t CCPTMRS0bits;
3045 #define _CCPTMRS0_C1TSEL0 0x01
3046 #define _CCPTMRS0_C1TSEL1 0x02
3047 #define _CCPTMRS0_C2TSEL0 0x04
3048 #define _CCPTMRS0_C2TSEL1 0x08
3049 #define _CCPTMRS0_C3TSEL0 0x10
3050 #define _CCPTMRS0_C3TSEL1 0x20
3051 #define _CCPTMRS0_C4TSEL0 0x40
3052 #define _CCPTMRS0_C4TSEL1 0x80
3054 //==============================================================================
3056 extern __at(0x0311) __sfr CCPR3;
3057 extern __at(0x0311) __sfr CCPR3L;
3058 extern __at(0x0312) __sfr CCPR3H;
3060 //==============================================================================
3061 // CCP3CON Bits
3063 extern __at(0x0313) __sfr CCP3CON;
3065 typedef union
3067 struct
3069 unsigned CCP3M0 : 1;
3070 unsigned CCP3M1 : 1;
3071 unsigned CCP3M2 : 1;
3072 unsigned CCP3M3 : 1;
3073 unsigned DC3B0 : 1;
3074 unsigned DC3B1 : 1;
3075 unsigned : 1;
3076 unsigned : 1;
3079 struct
3081 unsigned CCP3M : 4;
3082 unsigned : 4;
3085 struct
3087 unsigned : 4;
3088 unsigned DC3B : 2;
3089 unsigned : 2;
3091 } __CCP3CONbits_t;
3093 extern __at(0x0313) volatile __CCP3CONbits_t CCP3CONbits;
3095 #define _CCP3M0 0x01
3096 #define _CCP3M1 0x02
3097 #define _CCP3M2 0x04
3098 #define _CCP3M3 0x08
3099 #define _DC3B0 0x10
3100 #define _DC3B1 0x20
3102 //==============================================================================
3104 extern __at(0x0318) __sfr CCPR4;
3105 extern __at(0x0318) __sfr CCPR4L;
3106 extern __at(0x0319) __sfr CCPR4H;
3108 //==============================================================================
3109 // CCP4CON Bits
3111 extern __at(0x031A) __sfr CCP4CON;
3113 typedef union
3115 struct
3117 unsigned CCP4M0 : 1;
3118 unsigned CCP4M1 : 1;
3119 unsigned CCP4M2 : 1;
3120 unsigned CCP4M3 : 1;
3121 unsigned DC4B0 : 1;
3122 unsigned DC4B1 : 1;
3123 unsigned : 1;
3124 unsigned : 1;
3127 struct
3129 unsigned CCP4M : 4;
3130 unsigned : 4;
3133 struct
3135 unsigned : 4;
3136 unsigned DC4B : 2;
3137 unsigned : 2;
3139 } __CCP4CONbits_t;
3141 extern __at(0x031A) volatile __CCP4CONbits_t CCP4CONbits;
3143 #define _CCP4M0 0x01
3144 #define _CCP4M1 0x02
3145 #define _CCP4M2 0x04
3146 #define _CCP4M3 0x08
3147 #define _DC4B0 0x10
3148 #define _DC4B1 0x20
3150 //==============================================================================
3153 //==============================================================================
3154 // IOCBP Bits
3156 extern __at(0x0394) __sfr IOCBP;
3158 typedef struct
3160 unsigned IOCBP0 : 1;
3161 unsigned IOCBP1 : 1;
3162 unsigned IOCBP2 : 1;
3163 unsigned IOCBP3 : 1;
3164 unsigned IOCBP4 : 1;
3165 unsigned IOCBP5 : 1;
3166 unsigned IOCBP6 : 1;
3167 unsigned IOCBP7 : 1;
3168 } __IOCBPbits_t;
3170 extern __at(0x0394) volatile __IOCBPbits_t IOCBPbits;
3172 #define _IOCBP0 0x01
3173 #define _IOCBP1 0x02
3174 #define _IOCBP2 0x04
3175 #define _IOCBP3 0x08
3176 #define _IOCBP4 0x10
3177 #define _IOCBP5 0x20
3178 #define _IOCBP6 0x40
3179 #define _IOCBP7 0x80
3181 //==============================================================================
3184 //==============================================================================
3185 // IOCBN Bits
3187 extern __at(0x0395) __sfr IOCBN;
3189 typedef struct
3191 unsigned IOCBN0 : 1;
3192 unsigned IOCBN1 : 1;
3193 unsigned IOCBN2 : 1;
3194 unsigned IOCBN3 : 1;
3195 unsigned IOCBN4 : 1;
3196 unsigned IOCBN5 : 1;
3197 unsigned IOCBN6 : 1;
3198 unsigned IOCBN7 : 1;
3199 } __IOCBNbits_t;
3201 extern __at(0x0395) volatile __IOCBNbits_t IOCBNbits;
3203 #define _IOCBN0 0x01
3204 #define _IOCBN1 0x02
3205 #define _IOCBN2 0x04
3206 #define _IOCBN3 0x08
3207 #define _IOCBN4 0x10
3208 #define _IOCBN5 0x20
3209 #define _IOCBN6 0x40
3210 #define _IOCBN7 0x80
3212 //==============================================================================
3215 //==============================================================================
3216 // IOCBF Bits
3218 extern __at(0x0396) __sfr IOCBF;
3220 typedef struct
3222 unsigned IOCBF0 : 1;
3223 unsigned IOCBF1 : 1;
3224 unsigned IOCBF2 : 1;
3225 unsigned IOCBF3 : 1;
3226 unsigned IOCBF4 : 1;
3227 unsigned IOCBF5 : 1;
3228 unsigned IOCBF6 : 1;
3229 unsigned IOCBF7 : 1;
3230 } __IOCBFbits_t;
3232 extern __at(0x0396) volatile __IOCBFbits_t IOCBFbits;
3234 #define _IOCBF0 0x01
3235 #define _IOCBF1 0x02
3236 #define _IOCBF2 0x04
3237 #define _IOCBF3 0x08
3238 #define _IOCBF4 0x10
3239 #define _IOCBF5 0x20
3240 #define _IOCBF6 0x40
3241 #define _IOCBF7 0x80
3243 //==============================================================================
3246 //==============================================================================
3247 // CLKRCON Bits
3249 extern __at(0x039A) __sfr CLKRCON;
3251 typedef union
3253 struct
3255 unsigned CLKRDIV0 : 1;
3256 unsigned CLKRDIV1 : 1;
3257 unsigned CLKRDIV2 : 1;
3258 unsigned CLKRDC0 : 1;
3259 unsigned CLKRDC1 : 1;
3260 unsigned CLKRSLR : 1;
3261 unsigned CLKROE : 1;
3262 unsigned CLKREN : 1;
3265 struct
3267 unsigned CLKRDIV : 3;
3268 unsigned : 5;
3271 struct
3273 unsigned : 3;
3274 unsigned CLKRDC : 2;
3275 unsigned : 3;
3277 } __CLKRCONbits_t;
3279 extern __at(0x039A) volatile __CLKRCONbits_t CLKRCONbits;
3281 #define _CLKRDIV0 0x01
3282 #define _CLKRDIV1 0x02
3283 #define _CLKRDIV2 0x04
3284 #define _CLKRDC0 0x08
3285 #define _CLKRDC1 0x10
3286 #define _CLKRSLR 0x20
3287 #define _CLKROE 0x40
3288 #define _CLKREN 0x80
3290 //==============================================================================
3293 //==============================================================================
3294 // MDCON Bits
3296 extern __at(0x039C) __sfr MDCON;
3298 typedef struct
3300 unsigned MDBIT : 1;
3301 unsigned : 1;
3302 unsigned : 1;
3303 unsigned MDOUT : 1;
3304 unsigned MDOPOL : 1;
3305 unsigned MDSLR : 1;
3306 unsigned MDOE : 1;
3307 unsigned MDEN : 1;
3308 } __MDCONbits_t;
3310 extern __at(0x039C) volatile __MDCONbits_t MDCONbits;
3312 #define _MDBIT 0x01
3313 #define _MDOUT 0x08
3314 #define _MDOPOL 0x10
3315 #define _MDSLR 0x20
3316 #define _MDOE 0x40
3317 #define _MDEN 0x80
3319 //==============================================================================
3322 //==============================================================================
3323 // MDSRC Bits
3325 extern __at(0x039D) __sfr MDSRC;
3327 typedef union
3329 struct
3331 unsigned MDMS0 : 1;
3332 unsigned MDMS1 : 1;
3333 unsigned MDMS2 : 1;
3334 unsigned MDMS3 : 1;
3335 unsigned : 1;
3336 unsigned : 1;
3337 unsigned : 1;
3338 unsigned MDMSODIS : 1;
3341 struct
3343 unsigned MDMS : 4;
3344 unsigned : 4;
3346 } __MDSRCbits_t;
3348 extern __at(0x039D) volatile __MDSRCbits_t MDSRCbits;
3350 #define _MDMS0 0x01
3351 #define _MDMS1 0x02
3352 #define _MDMS2 0x04
3353 #define _MDMS3 0x08
3354 #define _MDMSODIS 0x80
3356 //==============================================================================
3359 //==============================================================================
3360 // MDCARL Bits
3362 extern __at(0x039E) __sfr MDCARL;
3364 typedef union
3366 struct
3368 unsigned MDCL0 : 1;
3369 unsigned MDCL1 : 1;
3370 unsigned MDCL2 : 1;
3371 unsigned MDCL3 : 1;
3372 unsigned : 1;
3373 unsigned MDCLSYNC : 1;
3374 unsigned MDCLPOL : 1;
3375 unsigned MDCLODIS : 1;
3378 struct
3380 unsigned MDCL : 4;
3381 unsigned : 4;
3383 } __MDCARLbits_t;
3385 extern __at(0x039E) volatile __MDCARLbits_t MDCARLbits;
3387 #define _MDCL0 0x01
3388 #define _MDCL1 0x02
3389 #define _MDCL2 0x04
3390 #define _MDCL3 0x08
3391 #define _MDCLSYNC 0x20
3392 #define _MDCLPOL 0x40
3393 #define _MDCLODIS 0x80
3395 //==============================================================================
3398 //==============================================================================
3399 // MDCARH Bits
3401 extern __at(0x039F) __sfr MDCARH;
3403 typedef union
3405 struct
3407 unsigned MDCH0 : 1;
3408 unsigned MDCH1 : 1;
3409 unsigned MDCH2 : 1;
3410 unsigned MDCH3 : 1;
3411 unsigned : 1;
3412 unsigned MDCHSYNC : 1;
3413 unsigned MDCHPOL : 1;
3414 unsigned MDCHODIS : 1;
3417 struct
3419 unsigned MDCH : 4;
3420 unsigned : 4;
3422 } __MDCARHbits_t;
3424 extern __at(0x039F) volatile __MDCARHbits_t MDCARHbits;
3426 #define _MDCH0 0x01
3427 #define _MDCH1 0x02
3428 #define _MDCH2 0x04
3429 #define _MDCH3 0x08
3430 #define _MDCHSYNC 0x20
3431 #define _MDCHPOL 0x40
3432 #define _MDCHODIS 0x80
3434 //==============================================================================
3436 extern __at(0x0415) __sfr TMR4;
3437 extern __at(0x0416) __sfr PR4;
3439 //==============================================================================
3440 // T4CON Bits
3442 extern __at(0x0417) __sfr T4CON;
3444 typedef union
3446 struct
3448 unsigned T4CKPS0 : 1;
3449 unsigned T4CKPS1 : 1;
3450 unsigned TMR4ON : 1;
3451 unsigned T4OUTPS0 : 1;
3452 unsigned T4OUTPS1 : 1;
3453 unsigned T4OUTPS2 : 1;
3454 unsigned T4OUTPS3 : 1;
3455 unsigned : 1;
3458 struct
3460 unsigned T4CKPS : 2;
3461 unsigned : 6;
3464 struct
3466 unsigned : 3;
3467 unsigned T4OUTPS : 4;
3468 unsigned : 1;
3470 } __T4CONbits_t;
3472 extern __at(0x0417) volatile __T4CONbits_t T4CONbits;
3474 #define _T4CKPS0 0x01
3475 #define _T4CKPS1 0x02
3476 #define _TMR4ON 0x04
3477 #define _T4OUTPS0 0x08
3478 #define _T4OUTPS1 0x10
3479 #define _T4OUTPS2 0x20
3480 #define _T4OUTPS3 0x40
3482 //==============================================================================
3484 extern __at(0x041C) __sfr TMR6;
3485 extern __at(0x041D) __sfr PR6;
3487 //==============================================================================
3488 // T6CON Bits
3490 extern __at(0x041E) __sfr T6CON;
3492 typedef union
3494 struct
3496 unsigned T6CKPS0 : 1;
3497 unsigned T6CKPS1 : 1;
3498 unsigned TMR6ON : 1;
3499 unsigned T6OUTPS0 : 1;
3500 unsigned T6OUTPS1 : 1;
3501 unsigned T6OUTPS2 : 1;
3502 unsigned T6OUTPS3 : 1;
3503 unsigned : 1;
3506 struct
3508 unsigned T6CKPS : 2;
3509 unsigned : 6;
3512 struct
3514 unsigned : 3;
3515 unsigned T6OUTPS : 4;
3516 unsigned : 1;
3518 } __T6CONbits_t;
3520 extern __at(0x041E) volatile __T6CONbits_t T6CONbits;
3522 #define _T6CKPS0 0x01
3523 #define _T6CKPS1 0x02
3524 #define _TMR6ON 0x04
3525 #define _T6OUTPS0 0x08
3526 #define _T6OUTPS1 0x10
3527 #define _T6OUTPS2 0x20
3528 #define _T6OUTPS3 0x40
3530 //==============================================================================
3533 //==============================================================================
3534 // STATUS_SHAD Bits
3536 extern __at(0x0FE4) __sfr STATUS_SHAD;
3538 typedef struct
3540 unsigned C_SHAD : 1;
3541 unsigned DC_SHAD : 1;
3542 unsigned Z_SHAD : 1;
3543 unsigned : 1;
3544 unsigned : 1;
3545 unsigned : 1;
3546 unsigned : 1;
3547 unsigned : 1;
3548 } __STATUS_SHADbits_t;
3550 extern __at(0x0FE4) volatile __STATUS_SHADbits_t STATUS_SHADbits;
3552 #define _C_SHAD 0x01
3553 #define _DC_SHAD 0x02
3554 #define _Z_SHAD 0x04
3556 //==============================================================================
3558 extern __at(0x0FE5) __sfr WREG_SHAD;
3559 extern __at(0x0FE6) __sfr BSR_SHAD;
3560 extern __at(0x0FE7) __sfr PCLATH_SHAD;
3561 extern __at(0x0FE8) __sfr FSR0L_SHAD;
3562 extern __at(0x0FE9) __sfr FSR0H_SHAD;
3563 extern __at(0x0FEA) __sfr FSR1L_SHAD;
3564 extern __at(0x0FEB) __sfr FSR1H_SHAD;
3565 extern __at(0x0FED) __sfr STKPTR;
3566 extern __at(0x0FEE) __sfr TOSL;
3567 extern __at(0x0FEF) __sfr TOSH;
3569 //==============================================================================
3571 // Configuration Bits
3573 //==============================================================================
3575 #define _CONFIG1 0x8007
3576 #define _CONFIG2 0x8008
3578 //----------------------------- CONFIG1 Options -------------------------------
3580 #define _FOSC_LP 0x3FF8 // LP Oscillator, Low-power crystal connected between OSC1 and OSC2 pins.
3581 #define _FOSC_XT 0x3FF9 // XT Oscillator, Crystal/resonator connected between OSC1 and OSC2 pins.
3582 #define _FOSC_HS 0x3FFA // HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins.
3583 #define _FOSC_EXTRC 0x3FFB // EXTRC oscillator: External RC circuit connected to CLKIN pin.
3584 #define _FOSC_INTOSC 0x3FFC // INTOSC oscillator: I/O function on CLKIN pin.
3585 #define _FOSC_ECL 0x3FFD // ECL, External Clock, Low Power Mode (0-0.5 MHz): device clock supplied to CLKIN pin.
3586 #define _FOSC_ECM 0x3FFE // ECM, External Clock, Medium Power Mode (0.5-4 MHz): device clock supplied to CLKIN pin.
3587 #define _FOSC_ECH 0x3FFF // ECH, External Clock, High Power Mode (4-32 MHz): device clock supplied to CLKIN pin.
3588 #define _WDTE_OFF 0x3FE7 // WDT disabled.
3589 #define _WDTE_SWDTEN 0x3FEF // WDT controlled by the SWDTEN bit in the WDTCON register.
3590 #define _WDTE_NSLEEP 0x3FF7 // WDT enabled while running and disabled in Sleep.
3591 #define _WDTE_ON 0x3FFF // WDT enabled.
3592 #define _PWRTE_ON 0x3FDF // PWRT enabled.
3593 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
3594 #define _MCLRE_OFF 0x3FBF // MCLR/VPP pin function is digital input.
3595 #define _MCLRE_ON 0x3FFF // MCLR/VPP pin function is MCLR.
3596 #define _CP_ON 0x3F7F // Program memory code protection is enabled.
3597 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
3598 #define _CPD_ON 0x3EFF // Data memory code protection is enabled.
3599 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
3600 #define _BOREN_OFF 0x39FF // Brown-out Reset disabled.
3601 #define _BOREN_SBODEN 0x3BFF // Brown-out Reset controlled by the SBOREN bit in the BORCON register.
3602 #define _BOREN_NSLEEP 0x3DFF // Brown-out Reset enabled while running and disabled in Sleep.
3603 #define _BOREN_ON 0x3FFF // Brown-out Reset enabled.
3604 #define _CLKOUTEN_ON 0x37FF // CLKOUT function is enabled on the CLKOUT pin.
3605 #define _CLKOUTEN_OFF 0x3FFF // CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin.
3606 #define _IESO_OFF 0x2FFF // Internal/External Switchover mode is disabled.
3607 #define _IESO_ON 0x3FFF // Internal/External Switchover mode is enabled.
3608 #define _FCMEN_OFF 0x1FFF // Fail-Safe Clock Monitor is disabled.
3609 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
3611 //----------------------------- CONFIG2 Options -------------------------------
3613 #define _WRT_ALL 0x3FFC // 000h to FFFh write protected, no addresses may be modified by EECON control.
3614 #define _WRT_HALF 0x3FFD // 000h to 7FFh write protected, 800h to FFFh may be modified by EECON control.
3615 #define _WRT_BOOT 0x3FFE // 000h to 1FFh write protected, 200h to FFFh may be modified by EECON control.
3616 #define _WRT_OFF 0x3FFF // Write protection off.
3617 #define _PLLEN_OFF 0x3EFF // 4x PLL disabled.
3618 #define _PLLEN_ON 0x3FFF // 4x PLL enabled.
3619 #define _STVREN_OFF 0x3DFF // Stack Overflow or Underflow will not cause a Reset.
3620 #define _STVREN_ON 0x3FFF // Stack Overflow or Underflow will cause a Reset.
3621 #define _BORV_HI 0x3BFF // Brown-out Reset Voltage (Vbor), high trip point selected.
3622 #define _BORV_LO 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
3623 #define _BORV_19 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
3624 #define _DEBUG_ON 0x2FFF // In-Circuit Debugger enabled, ICSPCLK and ICSPDAT are dedicated to the debugger.
3625 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, ICSPCLK and ICSPDAT are general purpose I/O pins.
3626 #define _LVP_OFF 0x1FFF // High-voltage on MCLR/VPP must be used for programming.
3627 #define _LVP_ON 0x3FFF // Low-voltage programming enabled.
3629 //==============================================================================
3631 #define _DEVID1 0x8006
3633 #define _IDLOC0 0x8000
3634 #define _IDLOC1 0x8001
3635 #define _IDLOC2 0x8002
3636 #define _IDLOC3 0x8003
3638 //==============================================================================
3640 #ifndef NO_BIT_DEFINES
3642 #define ADON ADCON0bits.ADON // bit 0
3643 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
3644 #define ADGO ADCON0bits.ADGO // bit 1, shadows bit in ADCON0bits
3645 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
3646 #define CHS0 ADCON0bits.CHS0 // bit 2
3647 #define CHS1 ADCON0bits.CHS1 // bit 3
3648 #define CHS2 ADCON0bits.CHS2 // bit 4
3649 #define CHS3 ADCON0bits.CHS3 // bit 5
3650 #define CHS4 ADCON0bits.CHS4 // bit 6
3652 #define ADPREF0 ADCON1bits.ADPREF0 // bit 0
3653 #define ADPREF1 ADCON1bits.ADPREF1 // bit 1
3654 #define ADNREF ADCON1bits.ADNREF // bit 2
3655 #define ADCS0 ADCON1bits.ADCS0 // bit 4
3656 #define ADCS1 ADCON1bits.ADCS1 // bit 5
3657 #define ADCS2 ADCON1bits.ADCS2 // bit 6
3658 #define ADFM ADCON1bits.ADFM // bit 7
3660 #define ANSA0 ANSELAbits.ANSA0 // bit 0
3661 #define ANSA1 ANSELAbits.ANSA1 // bit 1
3662 #define ANSA2 ANSELAbits.ANSA2 // bit 2
3663 #define ANSA3 ANSELAbits.ANSA3 // bit 3
3664 #define ANSA4 ANSELAbits.ANSA4 // bit 4
3666 #define ANSB1 ANSELBbits.ANSB1 // bit 1
3667 #define ANSB2 ANSELBbits.ANSB2 // bit 2
3668 #define ANSB3 ANSELBbits.ANSB3 // bit 3
3669 #define ANSB4 ANSELBbits.ANSB4 // bit 4
3670 #define ANSB5 ANSELBbits.ANSB5 // bit 5
3671 #define ANSB6 ANSELBbits.ANSB6 // bit 6
3672 #define ANSB7 ANSELBbits.ANSB7 // bit 7
3674 #define CCP1SEL APFCON0bits.CCP1SEL // bit 0
3675 #define P1CSEL APFCON0bits.P1CSEL // bit 1
3676 #define P1DSEL APFCON0bits.P1DSEL // bit 2
3677 #define CCP2SEL APFCON0bits.CCP2SEL // bit 3
3678 #define P2BSEL APFCON0bits.P2BSEL // bit 4
3679 #define SS1SEL APFCON0bits.SS1SEL // bit 5
3680 #define SDO1SEL APFCON0bits.SDO1SEL // bit 6
3681 #define RXDTSEL APFCON0bits.RXDTSEL // bit 7
3683 #define TXCKSEL APFCON1bits.TXCKSEL // bit 0
3685 #define ABDEN BAUDCONbits.ABDEN // bit 0
3686 #define WUE BAUDCONbits.WUE // bit 1
3687 #define BRG16 BAUDCONbits.BRG16 // bit 3
3688 #define SCKP BAUDCONbits.SCKP // bit 4
3689 #define RCIDL BAUDCONbits.RCIDL // bit 6
3690 #define ABDOVF BAUDCONbits.ABDOVF // bit 7
3692 #define BORRDY BORCONbits.BORRDY // bit 0
3693 #define SBOREN BORCONbits.SBOREN // bit 7
3695 #define BSR0 BSRbits.BSR0 // bit 0
3696 #define BSR1 BSRbits.BSR1 // bit 1
3697 #define BSR2 BSRbits.BSR2 // bit 2
3698 #define BSR3 BSRbits.BSR3 // bit 3
3699 #define BSR4 BSRbits.BSR4 // bit 4
3701 #define PSS1BD0 CCP1ASbits.PSS1BD0 // bit 0
3702 #define PSS1BD1 CCP1ASbits.PSS1BD1 // bit 1
3703 #define PSS1AC0 CCP1ASbits.PSS1AC0 // bit 2
3704 #define PSS1AC1 CCP1ASbits.PSS1AC1 // bit 3
3705 #define CCP1AS0 CCP1ASbits.CCP1AS0 // bit 4
3706 #define CCP1AS1 CCP1ASbits.CCP1AS1 // bit 5
3707 #define CCP1AS2 CCP1ASbits.CCP1AS2 // bit 6
3708 #define CCP1ASE CCP1ASbits.CCP1ASE // bit 7
3710 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
3711 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
3712 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
3713 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
3714 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
3715 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
3716 #define P1M0 CCP1CONbits.P1M0 // bit 6
3717 #define P1M1 CCP1CONbits.P1M1 // bit 7
3719 #define PSS2BD0 CCP2ASbits.PSS2BD0 // bit 0
3720 #define PSS2BD1 CCP2ASbits.PSS2BD1 // bit 1
3721 #define PSS2AC0 CCP2ASbits.PSS2AC0 // bit 2
3722 #define PSS2AC1 CCP2ASbits.PSS2AC1 // bit 3
3723 #define CCP2AS0 CCP2ASbits.CCP2AS0 // bit 4
3724 #define CCP2AS1 CCP2ASbits.CCP2AS1 // bit 5
3725 #define CCP2AS2 CCP2ASbits.CCP2AS2 // bit 6
3726 #define CCP2ASE CCP2ASbits.CCP2ASE // bit 7
3728 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
3729 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
3730 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
3731 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
3732 #define DC2B0 CCP2CONbits.DC2B0 // bit 4
3733 #define DC2B1 CCP2CONbits.DC2B1 // bit 5
3734 #define P2M0 CCP2CONbits.P2M0 // bit 6
3735 #define P2M1 CCP2CONbits.P2M1 // bit 7
3737 #define CCP3M0 CCP3CONbits.CCP3M0 // bit 0
3738 #define CCP3M1 CCP3CONbits.CCP3M1 // bit 1
3739 #define CCP3M2 CCP3CONbits.CCP3M2 // bit 2
3740 #define CCP3M3 CCP3CONbits.CCP3M3 // bit 3
3741 #define DC3B0 CCP3CONbits.DC3B0 // bit 4
3742 #define DC3B1 CCP3CONbits.DC3B1 // bit 5
3744 #define CCP4M0 CCP4CONbits.CCP4M0 // bit 0
3745 #define CCP4M1 CCP4CONbits.CCP4M1 // bit 1
3746 #define CCP4M2 CCP4CONbits.CCP4M2 // bit 2
3747 #define CCP4M3 CCP4CONbits.CCP4M3 // bit 3
3748 #define DC4B0 CCP4CONbits.DC4B0 // bit 4
3749 #define DC4B1 CCP4CONbits.DC4B1 // bit 5
3751 #define C1TSEL0 CCPTMRSbits.C1TSEL0 // bit 0
3752 #define C1TSEL1 CCPTMRSbits.C1TSEL1 // bit 1
3753 #define C2TSEL0 CCPTMRSbits.C2TSEL0 // bit 2
3754 #define C2TSEL1 CCPTMRSbits.C2TSEL1 // bit 3
3755 #define C3TSEL0 CCPTMRSbits.C3TSEL0 // bit 4
3756 #define C3TSEL1 CCPTMRSbits.C3TSEL1 // bit 5
3757 #define C4TSEL0 CCPTMRSbits.C4TSEL0 // bit 6
3758 #define C4TSEL1 CCPTMRSbits.C4TSEL1 // bit 7
3760 #define CLKRDIV0 CLKRCONbits.CLKRDIV0 // bit 0
3761 #define CLKRDIV1 CLKRCONbits.CLKRDIV1 // bit 1
3762 #define CLKRDIV2 CLKRCONbits.CLKRDIV2 // bit 2
3763 #define CLKRDC0 CLKRCONbits.CLKRDC0 // bit 3
3764 #define CLKRDC1 CLKRCONbits.CLKRDC1 // bit 4
3765 #define CLKRSLR CLKRCONbits.CLKRSLR // bit 5
3766 #define CLKROE CLKRCONbits.CLKROE // bit 6
3767 #define CLKREN CLKRCONbits.CLKREN // bit 7
3769 #define C1SYNC CM1CON0bits.C1SYNC // bit 0
3770 #define C1HYS CM1CON0bits.C1HYS // bit 1
3771 #define C1SP CM1CON0bits.C1SP // bit 2
3772 #define C1POL CM1CON0bits.C1POL // bit 4
3773 #define C1OE CM1CON0bits.C1OE // bit 5
3774 #define C1OUT CM1CON0bits.C1OUT // bit 6
3775 #define C1ON CM1CON0bits.C1ON // bit 7
3777 #define C1NCH0 CM1CON1bits.C1NCH0 // bit 0
3778 #define C1NCH1 CM1CON1bits.C1NCH1 // bit 1
3779 #define C1PCH0 CM1CON1bits.C1PCH0 // bit 4
3780 #define C1PCH1 CM1CON1bits.C1PCH1 // bit 5
3781 #define C1INTN CM1CON1bits.C1INTN // bit 6
3782 #define C1INTP CM1CON1bits.C1INTP // bit 7
3784 #define C2SYNC CM2CON0bits.C2SYNC // bit 0
3785 #define C2HYS CM2CON0bits.C2HYS // bit 1
3786 #define C2SP CM2CON0bits.C2SP // bit 2
3787 #define C2POL CM2CON0bits.C2POL // bit 4
3788 #define C2OE CM2CON0bits.C2OE // bit 5
3789 #define C2OUT CM2CON0bits.C2OUT // bit 6
3790 #define C2ON CM2CON0bits.C2ON // bit 7
3792 #define C2NCH0 CM2CON1bits.C2NCH0 // bit 0
3793 #define C2NCH1 CM2CON1bits.C2NCH1 // bit 1
3794 #define C2PCH0 CM2CON1bits.C2PCH0 // bit 4
3795 #define C2PCH1 CM2CON1bits.C2PCH1 // bit 5
3796 #define C2INTN CM2CON1bits.C2INTN // bit 6
3797 #define C2INTP CM2CON1bits.C2INTP // bit 7
3799 #define MC1OUT CMOUTbits.MC1OUT // bit 0
3800 #define MC2OUT CMOUTbits.MC2OUT // bit 1
3802 #define T0XCS CPSCON0bits.T0XCS // bit 0
3803 #define CPSOUT CPSCON0bits.CPSOUT // bit 1
3804 #define CPSRNG0 CPSCON0bits.CPSRNG0 // bit 2
3805 #define CPSRNG1 CPSCON0bits.CPSRNG1 // bit 3
3806 #define CPSRM CPSCON0bits.CPSRM // bit 6
3807 #define CPSON CPSCON0bits.CPSON // bit 7
3809 #define CPSCH0 CPSCON1bits.CPSCH0 // bit 0
3810 #define CPSCH1 CPSCON1bits.CPSCH1 // bit 1
3811 #define CPSCH2 CPSCON1bits.CPSCH2 // bit 2
3812 #define CPSCH3 CPSCON1bits.CPSCH3 // bit 3
3814 #define DACNSS DACCON0bits.DACNSS // bit 0
3815 #define DACPSS0 DACCON0bits.DACPSS0 // bit 2
3816 #define DACPSS1 DACCON0bits.DACPSS1 // bit 3
3817 #define DACOE DACCON0bits.DACOE // bit 5
3818 #define DACLPS DACCON0bits.DACLPS // bit 6
3819 #define DACEN DACCON0bits.DACEN // bit 7
3821 #define DACR0 DACCON1bits.DACR0 // bit 0
3822 #define DACR1 DACCON1bits.DACR1 // bit 1
3823 #define DACR2 DACCON1bits.DACR2 // bit 2
3824 #define DACR3 DACCON1bits.DACR3 // bit 3
3825 #define DACR4 DACCON1bits.DACR4 // bit 4
3827 #define RD EECON1bits.RD // bit 0
3828 #define WR EECON1bits.WR // bit 1
3829 #define WREN EECON1bits.WREN // bit 2
3830 #define WRERR EECON1bits.WRERR // bit 3
3831 #define FREE EECON1bits.FREE // bit 4
3832 #define LWLO EECON1bits.LWLO // bit 5
3833 #define CFGS EECON1bits.CFGS // bit 6
3834 #define EEPGD EECON1bits.EEPGD // bit 7
3836 #define ADFVR0 FVRCONbits.ADFVR0 // bit 0
3837 #define ADFVR1 FVRCONbits.ADFVR1 // bit 1
3838 #define CDAFVR0 FVRCONbits.CDAFVR0 // bit 2
3839 #define CDAFVR1 FVRCONbits.CDAFVR1 // bit 3
3840 #define TSRNG FVRCONbits.TSRNG // bit 4
3841 #define TSEN FVRCONbits.TSEN // bit 5
3842 #define FVRRDY FVRCONbits.FVRRDY // bit 6
3843 #define FVREN FVRCONbits.FVREN // bit 7
3845 #define IOCIF INTCONbits.IOCIF // bit 0
3846 #define INTF INTCONbits.INTF // bit 1
3847 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
3848 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
3849 #define IOCIE INTCONbits.IOCIE // bit 3
3850 #define INTE INTCONbits.INTE // bit 4
3851 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
3852 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
3853 #define PEIE INTCONbits.PEIE // bit 6
3854 #define GIE INTCONbits.GIE // bit 7
3856 #define IOCBF0 IOCBFbits.IOCBF0 // bit 0
3857 #define IOCBF1 IOCBFbits.IOCBF1 // bit 1
3858 #define IOCBF2 IOCBFbits.IOCBF2 // bit 2
3859 #define IOCBF3 IOCBFbits.IOCBF3 // bit 3
3860 #define IOCBF4 IOCBFbits.IOCBF4 // bit 4
3861 #define IOCBF5 IOCBFbits.IOCBF5 // bit 5
3862 #define IOCBF6 IOCBFbits.IOCBF6 // bit 6
3863 #define IOCBF7 IOCBFbits.IOCBF7 // bit 7
3865 #define IOCBN0 IOCBNbits.IOCBN0 // bit 0
3866 #define IOCBN1 IOCBNbits.IOCBN1 // bit 1
3867 #define IOCBN2 IOCBNbits.IOCBN2 // bit 2
3868 #define IOCBN3 IOCBNbits.IOCBN3 // bit 3
3869 #define IOCBN4 IOCBNbits.IOCBN4 // bit 4
3870 #define IOCBN5 IOCBNbits.IOCBN5 // bit 5
3871 #define IOCBN6 IOCBNbits.IOCBN6 // bit 6
3872 #define IOCBN7 IOCBNbits.IOCBN7 // bit 7
3874 #define IOCBP0 IOCBPbits.IOCBP0 // bit 0
3875 #define IOCBP1 IOCBPbits.IOCBP1 // bit 1
3876 #define IOCBP2 IOCBPbits.IOCBP2 // bit 2
3877 #define IOCBP3 IOCBPbits.IOCBP3 // bit 3
3878 #define IOCBP4 IOCBPbits.IOCBP4 // bit 4
3879 #define IOCBP5 IOCBPbits.IOCBP5 // bit 5
3880 #define IOCBP6 IOCBPbits.IOCBP6 // bit 6
3881 #define IOCBP7 IOCBPbits.IOCBP7 // bit 7
3883 #define LATA0 LATAbits.LATA0 // bit 0
3884 #define LATA1 LATAbits.LATA1 // bit 1
3885 #define LATA2 LATAbits.LATA2 // bit 2
3886 #define LATA3 LATAbits.LATA3 // bit 3
3887 #define LATA4 LATAbits.LATA4 // bit 4
3888 #define LATA6 LATAbits.LATA6 // bit 6
3889 #define LATA7 LATAbits.LATA7 // bit 7
3891 #define LATB0 LATBbits.LATB0 // bit 0
3892 #define LATB1 LATBbits.LATB1 // bit 1
3893 #define LATB2 LATBbits.LATB2 // bit 2
3894 #define LATB3 LATBbits.LATB3 // bit 3
3895 #define LATB4 LATBbits.LATB4 // bit 4
3896 #define LATB5 LATBbits.LATB5 // bit 5
3897 #define LATB6 LATBbits.LATB6 // bit 6
3898 #define LATB7 LATBbits.LATB7 // bit 7
3900 #define MDCH0 MDCARHbits.MDCH0 // bit 0
3901 #define MDCH1 MDCARHbits.MDCH1 // bit 1
3902 #define MDCH2 MDCARHbits.MDCH2 // bit 2
3903 #define MDCH3 MDCARHbits.MDCH3 // bit 3
3904 #define MDCHSYNC MDCARHbits.MDCHSYNC // bit 5
3905 #define MDCHPOL MDCARHbits.MDCHPOL // bit 6
3906 #define MDCHODIS MDCARHbits.MDCHODIS // bit 7
3908 #define MDCL0 MDCARLbits.MDCL0 // bit 0
3909 #define MDCL1 MDCARLbits.MDCL1 // bit 1
3910 #define MDCL2 MDCARLbits.MDCL2 // bit 2
3911 #define MDCL3 MDCARLbits.MDCL3 // bit 3
3912 #define MDCLSYNC MDCARLbits.MDCLSYNC // bit 5
3913 #define MDCLPOL MDCARLbits.MDCLPOL // bit 6
3914 #define MDCLODIS MDCARLbits.MDCLODIS // bit 7
3916 #define MDBIT MDCONbits.MDBIT // bit 0
3917 #define MDOUT MDCONbits.MDOUT // bit 3
3918 #define MDOPOL MDCONbits.MDOPOL // bit 4
3919 #define MDSLR MDCONbits.MDSLR // bit 5
3920 #define MDOE MDCONbits.MDOE // bit 6
3921 #define MDEN MDCONbits.MDEN // bit 7
3923 #define MDMS0 MDSRCbits.MDMS0 // bit 0
3924 #define MDMS1 MDSRCbits.MDMS1 // bit 1
3925 #define MDMS2 MDSRCbits.MDMS2 // bit 2
3926 #define MDMS3 MDSRCbits.MDMS3 // bit 3
3927 #define MDMSODIS MDSRCbits.MDMSODIS // bit 7
3929 #define PS0 OPTION_REGbits.PS0 // bit 0
3930 #define PS1 OPTION_REGbits.PS1 // bit 1
3931 #define PS2 OPTION_REGbits.PS2 // bit 2
3932 #define PSA OPTION_REGbits.PSA // bit 3
3933 #define TMR0SE OPTION_REGbits.TMR0SE // bit 4, shadows bit in OPTION_REGbits
3934 #define T0SE OPTION_REGbits.T0SE // bit 4, shadows bit in OPTION_REGbits
3935 #define TMR0CS OPTION_REGbits.TMR0CS // bit 5, shadows bit in OPTION_REGbits
3936 #define T0CS OPTION_REGbits.T0CS // bit 5, shadows bit in OPTION_REGbits
3937 #define INTEDG OPTION_REGbits.INTEDG // bit 6
3938 #define NOT_WPUEN OPTION_REGbits.NOT_WPUEN // bit 7
3940 #define SCS0 OSCCONbits.SCS0 // bit 0
3941 #define SCS1 OSCCONbits.SCS1 // bit 1
3942 #define IRCF0 OSCCONbits.IRCF0 // bit 3
3943 #define IRCF1 OSCCONbits.IRCF1 // bit 4
3944 #define IRCF2 OSCCONbits.IRCF2 // bit 5
3945 #define IRCF3 OSCCONbits.IRCF3 // bit 6
3946 #define SPLLEN OSCCONbits.SPLLEN // bit 7
3948 #define HFIOFS OSCSTATbits.HFIOFS // bit 0
3949 #define LFIOFR OSCSTATbits.LFIOFR // bit 1
3950 #define MFIOFR OSCSTATbits.MFIOFR // bit 2
3951 #define HFIOFL OSCSTATbits.HFIOFL // bit 3
3952 #define HFIOFR OSCSTATbits.HFIOFR // bit 4
3953 #define OSTS OSCSTATbits.OSTS // bit 5
3954 #define PLLR OSCSTATbits.PLLR // bit 6
3955 #define T1OSCR OSCSTATbits.T1OSCR // bit 7
3957 #define TUN0 OSCTUNEbits.TUN0 // bit 0
3958 #define TUN1 OSCTUNEbits.TUN1 // bit 1
3959 #define TUN2 OSCTUNEbits.TUN2 // bit 2
3960 #define TUN3 OSCTUNEbits.TUN3 // bit 3
3961 #define TUN4 OSCTUNEbits.TUN4 // bit 4
3962 #define TUN5 OSCTUNEbits.TUN5 // bit 5
3964 #define NOT_BOR PCONbits.NOT_BOR // bit 0
3965 #define NOT_POR PCONbits.NOT_POR // bit 1
3966 #define NOT_RI PCONbits.NOT_RI // bit 2
3967 #define NOT_RMCLR PCONbits.NOT_RMCLR // bit 3
3968 #define STKUNF PCONbits.STKUNF // bit 6
3969 #define STKOVF PCONbits.STKOVF // bit 7
3971 #define TMR1IE PIE1bits.TMR1IE // bit 0
3972 #define TMR2IE PIE1bits.TMR2IE // bit 1
3973 #define CCP1IE PIE1bits.CCP1IE // bit 2
3974 #define SSP1IE PIE1bits.SSP1IE // bit 3
3975 #define TXIE PIE1bits.TXIE // bit 4
3976 #define RCIE PIE1bits.RCIE // bit 5
3977 #define ADIE PIE1bits.ADIE // bit 6
3978 #define TMR1GIE PIE1bits.TMR1GIE // bit 7
3980 #define CCP2IE PIE2bits.CCP2IE // bit 0
3981 #define BCL1IE PIE2bits.BCL1IE // bit 3
3982 #define EEIE PIE2bits.EEIE // bit 4
3983 #define C1IE PIE2bits.C1IE // bit 5
3984 #define C2IE PIE2bits.C2IE // bit 6
3985 #define OSFIE PIE2bits.OSFIE // bit 7
3987 #define TMR4IE PIE3bits.TMR4IE // bit 1
3988 #define TMR6IE PIE3bits.TMR6IE // bit 3
3989 #define CCP3IE PIE3bits.CCP3IE // bit 4
3990 #define CCP4IE PIE3bits.CCP4IE // bit 5
3992 #define SSP2IE PIE4bits.SSP2IE // bit 0
3993 #define BCL2IE PIE4bits.BCL2IE // bit 1
3995 #define TMR1IF PIR1bits.TMR1IF // bit 0
3996 #define TMR2IF PIR1bits.TMR2IF // bit 1
3997 #define CCP1IF PIR1bits.CCP1IF // bit 2
3998 #define SSP1IF PIR1bits.SSP1IF // bit 3
3999 #define TXIF PIR1bits.TXIF // bit 4
4000 #define RCIF PIR1bits.RCIF // bit 5
4001 #define ADIF PIR1bits.ADIF // bit 6
4002 #define TMR1GIF PIR1bits.TMR1GIF // bit 7
4004 #define CCP2IF PIR2bits.CCP2IF // bit 0
4005 #define BCL1IF PIR2bits.BCL1IF // bit 3
4006 #define EEIF PIR2bits.EEIF // bit 4
4007 #define C1IF PIR2bits.C1IF // bit 5
4008 #define C2IF PIR2bits.C2IF // bit 6
4009 #define OSFIF PIR2bits.OSFIF // bit 7
4011 #define TMR4IF PIR3bits.TMR4IF // bit 1
4012 #define TMR6IF PIR3bits.TMR6IF // bit 3
4013 #define CCP3IF PIR3bits.CCP3IF // bit 4
4014 #define CCP4IF PIR3bits.CCP4IF // bit 5
4016 #define SSP2IF PIR4bits.SSP2IF // bit 0
4017 #define BCL2IF PIR4bits.BCL2IF // bit 1
4019 #define RA0 PORTAbits.RA0 // bit 0
4020 #define RA1 PORTAbits.RA1 // bit 1
4021 #define RA2 PORTAbits.RA2 // bit 2
4022 #define RA3 PORTAbits.RA3 // bit 3
4023 #define RA4 PORTAbits.RA4 // bit 4
4024 #define RA5 PORTAbits.RA5 // bit 5
4025 #define RA6 PORTAbits.RA6 // bit 6
4026 #define RA7 PORTAbits.RA7 // bit 7
4028 #define RB0 PORTBbits.RB0 // bit 0
4029 #define RB1 PORTBbits.RB1 // bit 1
4030 #define RB2 PORTBbits.RB2 // bit 2
4031 #define RB3 PORTBbits.RB3 // bit 3
4032 #define RB4 PORTBbits.RB4 // bit 4
4033 #define RB5 PORTBbits.RB5 // bit 5
4034 #define RB6 PORTBbits.RB6 // bit 6
4035 #define RB7 PORTBbits.RB7 // bit 7
4037 #define STR1A PSTR1CONbits.STR1A // bit 0
4038 #define STR1B PSTR1CONbits.STR1B // bit 1
4039 #define STR1C PSTR1CONbits.STR1C // bit 2
4040 #define STR1D PSTR1CONbits.STR1D // bit 3
4041 #define STR1SYNC PSTR1CONbits.STR1SYNC // bit 4
4043 #define STR2A PSTR2CONbits.STR2A // bit 0
4044 #define STR2B PSTR2CONbits.STR2B // bit 1
4045 #define STR2C PSTR2CONbits.STR2C // bit 2
4046 #define STR2D PSTR2CONbits.STR2D // bit 3
4047 #define STR2SYNC PSTR2CONbits.STR2SYNC // bit 4
4049 #define P1DC0 PWM1CONbits.P1DC0 // bit 0
4050 #define P1DC1 PWM1CONbits.P1DC1 // bit 1
4051 #define P1DC2 PWM1CONbits.P1DC2 // bit 2
4052 #define P1DC3 PWM1CONbits.P1DC3 // bit 3
4053 #define P1DC4 PWM1CONbits.P1DC4 // bit 4
4054 #define P1DC5 PWM1CONbits.P1DC5 // bit 5
4055 #define P1DC6 PWM1CONbits.P1DC6 // bit 6
4056 #define P1RSEN PWM1CONbits.P1RSEN // bit 7
4058 #define P2DC0 PWM2CONbits.P2DC0 // bit 0
4059 #define P2DC1 PWM2CONbits.P2DC1 // bit 1
4060 #define P2DC2 PWM2CONbits.P2DC2 // bit 2
4061 #define P2DC3 PWM2CONbits.P2DC3 // bit 3
4062 #define P2DC4 PWM2CONbits.P2DC4 // bit 4
4063 #define P2DC5 PWM2CONbits.P2DC5 // bit 5
4064 #define P2DC6 PWM2CONbits.P2DC6 // bit 6
4065 #define P2RSEN PWM2CONbits.P2RSEN // bit 7
4067 #define RX9D RCSTAbits.RX9D // bit 0
4068 #define OERR RCSTAbits.OERR // bit 1
4069 #define FERR RCSTAbits.FERR // bit 2
4070 #define ADDEN RCSTAbits.ADDEN // bit 3
4071 #define CREN RCSTAbits.CREN // bit 4
4072 #define SREN RCSTAbits.SREN // bit 5
4073 #define RX9 RCSTAbits.RX9 // bit 6
4074 #define SPEN RCSTAbits.SPEN // bit 7
4076 #define SRPR SRCON0bits.SRPR // bit 0
4077 #define SRPS SRCON0bits.SRPS // bit 1
4078 #define SRNQEN SRCON0bits.SRNQEN // bit 2
4079 #define SRQEN SRCON0bits.SRQEN // bit 3
4080 #define SRCLK0 SRCON0bits.SRCLK0 // bit 4
4081 #define SRCLK1 SRCON0bits.SRCLK1 // bit 5
4082 #define SRCLK2 SRCON0bits.SRCLK2 // bit 6
4083 #define SRLEN SRCON0bits.SRLEN // bit 7
4085 #define SRRC1E SRCON1bits.SRRC1E // bit 0
4086 #define SRRC2E SRCON1bits.SRRC2E // bit 1
4087 #define SRRCKE SRCON1bits.SRRCKE // bit 2
4088 #define SRRPE SRCON1bits.SRRPE // bit 3
4089 #define SRSC1E SRCON1bits.SRSC1E // bit 4
4090 #define SRSC2E SRCON1bits.SRSC2E // bit 5
4091 #define SRSCKE SRCON1bits.SRSCKE // bit 6
4092 #define SRSPE SRCON1bits.SRSPE // bit 7
4094 #define SSPM0 SSP1CON1bits.SSPM0 // bit 0
4095 #define SSPM1 SSP1CON1bits.SSPM1 // bit 1
4096 #define SSPM2 SSP1CON1bits.SSPM2 // bit 2
4097 #define SSPM3 SSP1CON1bits.SSPM3 // bit 3
4098 #define CKP SSP1CON1bits.CKP // bit 4
4099 #define SSPEN SSP1CON1bits.SSPEN // bit 5
4100 #define SSPOV SSP1CON1bits.SSPOV // bit 6
4101 #define WCOL SSP1CON1bits.WCOL // bit 7
4103 #define SEN SSP1CON2bits.SEN // bit 0
4104 #define RSEN SSP1CON2bits.RSEN // bit 1
4105 #define PEN SSP1CON2bits.PEN // bit 2
4106 #define RCEN SSP1CON2bits.RCEN // bit 3
4107 #define ACKEN SSP1CON2bits.ACKEN // bit 4
4108 #define ACKDT SSP1CON2bits.ACKDT // bit 5
4109 #define ACKSTAT SSP1CON2bits.ACKSTAT // bit 6
4110 #define GCEN SSP1CON2bits.GCEN // bit 7
4112 #define DHEN SSP1CON3bits.DHEN // bit 0
4113 #define AHEN SSP1CON3bits.AHEN // bit 1
4114 #define SBCDE SSP1CON3bits.SBCDE // bit 2
4115 #define SDAHT SSP1CON3bits.SDAHT // bit 3
4116 #define BOEN SSP1CON3bits.BOEN // bit 4
4117 #define SCIE SSP1CON3bits.SCIE // bit 5
4118 #define PCIE SSP1CON3bits.PCIE // bit 6
4119 #define ACKTIM SSP1CON3bits.ACKTIM // bit 7
4121 #define BF SSP1STATbits.BF // bit 0
4122 #define UA SSP1STATbits.UA // bit 1
4123 #define R_NOT_W SSP1STATbits.R_NOT_W // bit 2
4124 #define S SSP1STATbits.S // bit 3
4125 #define P SSP1STATbits.P // bit 4
4126 #define D_NOT_A SSP1STATbits.D_NOT_A // bit 5
4127 #define CKE SSP1STATbits.CKE // bit 6
4128 #define SMP SSP1STATbits.SMP // bit 7
4130 #define C STATUSbits.C // bit 0
4131 #define DC STATUSbits.DC // bit 1
4132 #define Z STATUSbits.Z // bit 2
4133 #define NOT_PD STATUSbits.NOT_PD // bit 3
4134 #define NOT_TO STATUSbits.NOT_TO // bit 4
4136 #define C_SHAD STATUS_SHADbits.C_SHAD // bit 0
4137 #define DC_SHAD STATUS_SHADbits.DC_SHAD // bit 1
4138 #define Z_SHAD STATUS_SHADbits.Z_SHAD // bit 2
4140 #define TMR1ON T1CONbits.TMR1ON // bit 0
4141 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
4142 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
4143 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
4144 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
4145 #define TMR1CS0 T1CONbits.TMR1CS0 // bit 6
4146 #define TMR1CS1 T1CONbits.TMR1CS1 // bit 7
4148 #define T1GSS0 T1GCONbits.T1GSS0 // bit 0
4149 #define T1GSS1 T1GCONbits.T1GSS1 // bit 1
4150 #define T1GVAL T1GCONbits.T1GVAL // bit 2
4151 #define T1GGO_NOT_DONE T1GCONbits.T1GGO_NOT_DONE // bit 3, shadows bit in T1GCONbits
4152 #define T1GGO T1GCONbits.T1GGO // bit 3, shadows bit in T1GCONbits
4153 #define T1GSPM T1GCONbits.T1GSPM // bit 4
4154 #define T1GTM T1GCONbits.T1GTM // bit 5
4155 #define T1GPOL T1GCONbits.T1GPOL // bit 6
4156 #define TMR1GE T1GCONbits.TMR1GE // bit 7
4158 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
4159 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
4160 #define TMR2ON T2CONbits.TMR2ON // bit 2
4161 #define T2OUTPS0 T2CONbits.T2OUTPS0 // bit 3
4162 #define T2OUTPS1 T2CONbits.T2OUTPS1 // bit 4
4163 #define T2OUTPS2 T2CONbits.T2OUTPS2 // bit 5
4164 #define T2OUTPS3 T2CONbits.T2OUTPS3 // bit 6
4166 #define T4CKPS0 T4CONbits.T4CKPS0 // bit 0
4167 #define T4CKPS1 T4CONbits.T4CKPS1 // bit 1
4168 #define TMR4ON T4CONbits.TMR4ON // bit 2
4169 #define T4OUTPS0 T4CONbits.T4OUTPS0 // bit 3
4170 #define T4OUTPS1 T4CONbits.T4OUTPS1 // bit 4
4171 #define T4OUTPS2 T4CONbits.T4OUTPS2 // bit 5
4172 #define T4OUTPS3 T4CONbits.T4OUTPS3 // bit 6
4174 #define T6CKPS0 T6CONbits.T6CKPS0 // bit 0
4175 #define T6CKPS1 T6CONbits.T6CKPS1 // bit 1
4176 #define TMR6ON T6CONbits.TMR6ON // bit 2
4177 #define T6OUTPS0 T6CONbits.T6OUTPS0 // bit 3
4178 #define T6OUTPS1 T6CONbits.T6OUTPS1 // bit 4
4179 #define T6OUTPS2 T6CONbits.T6OUTPS2 // bit 5
4180 #define T6OUTPS3 T6CONbits.T6OUTPS3 // bit 6
4182 #define TRISA0 TRISAbits.TRISA0 // bit 0
4183 #define TRISA1 TRISAbits.TRISA1 // bit 1
4184 #define TRISA2 TRISAbits.TRISA2 // bit 2
4185 #define TRISA3 TRISAbits.TRISA3 // bit 3
4186 #define TRISA4 TRISAbits.TRISA4 // bit 4
4187 #define TRISA5 TRISAbits.TRISA5 // bit 5
4188 #define TRISA6 TRISAbits.TRISA6 // bit 6
4189 #define TRISA7 TRISAbits.TRISA7 // bit 7
4191 #define TRISB0 TRISBbits.TRISB0 // bit 0
4192 #define TRISB1 TRISBbits.TRISB1 // bit 1
4193 #define TRISB2 TRISBbits.TRISB2 // bit 2
4194 #define TRISB3 TRISBbits.TRISB3 // bit 3
4195 #define TRISB4 TRISBbits.TRISB4 // bit 4
4196 #define TRISB5 TRISBbits.TRISB5 // bit 5
4197 #define TRISB6 TRISBbits.TRISB6 // bit 6
4198 #define TRISB7 TRISBbits.TRISB7 // bit 7
4200 #define TX9D TXSTAbits.TX9D // bit 0
4201 #define TRMT TXSTAbits.TRMT // bit 1
4202 #define BRGH TXSTAbits.BRGH // bit 2
4203 #define SENDB TXSTAbits.SENDB // bit 3
4204 #define SYNC TXSTAbits.SYNC // bit 4
4205 #define TXEN TXSTAbits.TXEN // bit 5
4206 #define TX9 TXSTAbits.TX9 // bit 6
4207 #define CSRC TXSTAbits.CSRC // bit 7
4209 #define SWDTEN WDTCONbits.SWDTEN // bit 0
4210 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
4211 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
4212 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
4213 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
4214 #define WDTPS4 WDTCONbits.WDTPS4 // bit 5
4216 #define WPUA5 WPUAbits.WPUA5 // bit 5
4218 #define WPUB0 WPUBbits.WPUB0 // bit 0
4219 #define WPUB1 WPUBbits.WPUB1 // bit 1
4220 #define WPUB2 WPUBbits.WPUB2 // bit 2
4221 #define WPUB3 WPUBbits.WPUB3 // bit 3
4222 #define WPUB4 WPUBbits.WPUB4 // bit 4
4223 #define WPUB5 WPUBbits.WPUB5 // bit 5
4224 #define WPUB6 WPUBbits.WPUB6 // bit 6
4225 #define WPUB7 WPUBbits.WPUB7 // bit 7
4227 #endif // #ifndef NO_BIT_DEFINES
4229 #endif // #ifndef __PIC16F1847_H__