struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f1826.h
blobc69934b57adb78ce0a168fa4046ef8fdb1c609e0
1 /*
2 * This declarations of the PIC16F1826 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:20 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 __PIC16F1826_H__
26 #define __PIC16F1826_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 TMR0_ADDR 0x0015
55 #define TMR1_ADDR 0x0016
56 #define TMR1L_ADDR 0x0016
57 #define TMR1H_ADDR 0x0017
58 #define T1CON_ADDR 0x0018
59 #define T1GCON_ADDR 0x0019
60 #define TMR2_ADDR 0x001A
61 #define PR2_ADDR 0x001B
62 #define T2CON_ADDR 0x001C
63 #define CPSCON0_ADDR 0x001E
64 #define CPSCON1_ADDR 0x001F
65 #define TRISA_ADDR 0x008C
66 #define TRISB_ADDR 0x008D
67 #define PIE1_ADDR 0x0091
68 #define PIE2_ADDR 0x0092
69 #define OPTION_REG_ADDR 0x0095
70 #define PCON_ADDR 0x0096
71 #define WDTCON_ADDR 0x0097
72 #define OSCTUNE_ADDR 0x0098
73 #define OSCCON_ADDR 0x0099
74 #define OSCSTAT_ADDR 0x009A
75 #define ADRES_ADDR 0x009B
76 #define ADRESL_ADDR 0x009B
77 #define ADRESH_ADDR 0x009C
78 #define ADCON0_ADDR 0x009D
79 #define ADCON1_ADDR 0x009E
80 #define LATA_ADDR 0x010C
81 #define LATB_ADDR 0x010D
82 #define CM1CON0_ADDR 0x0111
83 #define CM1CON1_ADDR 0x0112
84 #define CM2CON0_ADDR 0x0113
85 #define CM2CON1_ADDR 0x0114
86 #define CMOUT_ADDR 0x0115
87 #define BORCON_ADDR 0x0116
88 #define FVRCON_ADDR 0x0117
89 #define DACCON0_ADDR 0x0118
90 #define DACCON1_ADDR 0x0119
91 #define SRCON0_ADDR 0x011A
92 #define SRCON1_ADDR 0x011B
93 #define APFCON0_ADDR 0x011D
94 #define APFCON1_ADDR 0x011E
95 #define ANSELA_ADDR 0x018C
96 #define ANSELB_ADDR 0x018D
97 #define EEADR_ADDR 0x0191
98 #define EEADRL_ADDR 0x0191
99 #define EEADRH_ADDR 0x0192
100 #define EEDAT_ADDR 0x0193
101 #define EEDATL_ADDR 0x0193
102 #define EEDATH_ADDR 0x0194
103 #define EECON1_ADDR 0x0195
104 #define EECON2_ADDR 0x0196
105 #define RCREG_ADDR 0x0199
106 #define TXREG_ADDR 0x019A
107 #define SP1BRG_ADDR 0x019B
108 #define SP1BRGL_ADDR 0x019B
109 #define SPBRG_ADDR 0x019B
110 #define SPBRGL_ADDR 0x019B
111 #define SP1BRGH_ADDR 0x019C
112 #define SPBRGH_ADDR 0x019C
113 #define RCSTA_ADDR 0x019D
114 #define TXSTA_ADDR 0x019E
115 #define BAUDCON_ADDR 0x019F
116 #define WPUA_ADDR 0x020C
117 #define WPUB_ADDR 0x020D
118 #define SSP1BUF_ADDR 0x0211
119 #define SSPBUF_ADDR 0x0211
120 #define SSP1ADD_ADDR 0x0212
121 #define SSPADD_ADDR 0x0212
122 #define SSP1MSK_ADDR 0x0213
123 #define SSPMSK_ADDR 0x0213
124 #define SSP1STAT_ADDR 0x0214
125 #define SSPSTAT_ADDR 0x0214
126 #define SSP1CON1_ADDR 0x0215
127 #define SSPCON_ADDR 0x0215
128 #define SSPCON1_ADDR 0x0215
129 #define SSP1CON2_ADDR 0x0216
130 #define SSPCON2_ADDR 0x0216
131 #define SSP1CON3_ADDR 0x0217
132 #define SSPCON3_ADDR 0x0217
133 #define CCPR1_ADDR 0x0291
134 #define CCPR1L_ADDR 0x0291
135 #define CCPR1H_ADDR 0x0292
136 #define CCP1CON_ADDR 0x0293
137 #define PWM1CON_ADDR 0x0294
138 #define CCP1AS_ADDR 0x0295
139 #define ECCP1AS_ADDR 0x0295
140 #define PSTR1CON_ADDR 0x0296
141 #define IOCBP_ADDR 0x0394
142 #define IOCBN_ADDR 0x0395
143 #define IOCBF_ADDR 0x0396
144 #define CLKRCON_ADDR 0x039A
145 #define MDCON_ADDR 0x039C
146 #define MDSRC_ADDR 0x039D
147 #define MDCARL_ADDR 0x039E
148 #define MDCARH_ADDR 0x039F
149 #define STATUS_SHAD_ADDR 0x0FE4
150 #define WREG_SHAD_ADDR 0x0FE5
151 #define BSR_SHAD_ADDR 0x0FE6
152 #define PCLATH_SHAD_ADDR 0x0FE7
153 #define FSR0L_SHAD_ADDR 0x0FE8
154 #define FSR0H_SHAD_ADDR 0x0FE9
155 #define FSR1L_SHAD_ADDR 0x0FEA
156 #define FSR1H_SHAD_ADDR 0x0FEB
157 #define STKPTR_ADDR 0x0FED
158 #define TOSL_ADDR 0x0FEE
159 #define TOSH_ADDR 0x0FEF
161 #endif // #ifndef NO_ADDR_DEFINES
163 //==============================================================================
165 // Register Definitions
167 //==============================================================================
169 extern __at(0x0000) __sfr INDF0;
170 extern __at(0x0001) __sfr INDF1;
171 extern __at(0x0002) __sfr PCL;
173 //==============================================================================
174 // STATUS Bits
176 extern __at(0x0003) __sfr STATUS;
178 typedef struct
180 unsigned C : 1;
181 unsigned DC : 1;
182 unsigned Z : 1;
183 unsigned NOT_PD : 1;
184 unsigned NOT_TO : 1;
185 unsigned : 1;
186 unsigned : 1;
187 unsigned : 1;
188 } __STATUSbits_t;
190 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
192 #define _C 0x01
193 #define _DC 0x02
194 #define _Z 0x04
195 #define _NOT_PD 0x08
196 #define _NOT_TO 0x10
198 //==============================================================================
200 extern __at(0x0004) __sfr FSR0;
201 extern __at(0x0004) __sfr FSR0L;
202 extern __at(0x0005) __sfr FSR0H;
203 extern __at(0x0006) __sfr FSR1;
204 extern __at(0x0006) __sfr FSR1L;
205 extern __at(0x0007) __sfr FSR1H;
207 //==============================================================================
208 // BSR Bits
210 extern __at(0x0008) __sfr BSR;
212 typedef union
214 struct
216 unsigned BSR0 : 1;
217 unsigned BSR1 : 1;
218 unsigned BSR2 : 1;
219 unsigned BSR3 : 1;
220 unsigned BSR4 : 1;
221 unsigned : 1;
222 unsigned : 1;
223 unsigned : 1;
226 struct
228 unsigned BSR : 5;
229 unsigned : 3;
231 } __BSRbits_t;
233 extern __at(0x0008) volatile __BSRbits_t BSRbits;
235 #define _BSR0 0x01
236 #define _BSR1 0x02
237 #define _BSR2 0x04
238 #define _BSR3 0x08
239 #define _BSR4 0x10
241 //==============================================================================
243 extern __at(0x0009) __sfr WREG;
244 extern __at(0x000A) __sfr PCLATH;
246 //==============================================================================
247 // INTCON Bits
249 extern __at(0x000B) __sfr INTCON;
251 typedef union
253 struct
255 unsigned IOCIF : 1;
256 unsigned INTF : 1;
257 unsigned TMR0IF : 1;
258 unsigned IOCIE : 1;
259 unsigned INTE : 1;
260 unsigned TMR0IE : 1;
261 unsigned PEIE : 1;
262 unsigned GIE : 1;
265 struct
267 unsigned : 1;
268 unsigned : 1;
269 unsigned T0IF : 1;
270 unsigned : 1;
271 unsigned : 1;
272 unsigned T0IE : 1;
273 unsigned : 1;
274 unsigned : 1;
276 } __INTCONbits_t;
278 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
280 #define _IOCIF 0x01
281 #define _INTF 0x02
282 #define _TMR0IF 0x04
283 #define _T0IF 0x04
284 #define _IOCIE 0x08
285 #define _INTE 0x10
286 #define _TMR0IE 0x20
287 #define _T0IE 0x20
288 #define _PEIE 0x40
289 #define _GIE 0x80
291 //==============================================================================
294 //==============================================================================
295 // PORTA Bits
297 extern __at(0x000C) __sfr PORTA;
299 typedef struct
301 unsigned RA0 : 1;
302 unsigned RA1 : 1;
303 unsigned RA2 : 1;
304 unsigned RA3 : 1;
305 unsigned RA4 : 1;
306 unsigned RA5 : 1;
307 unsigned RA6 : 1;
308 unsigned RA7 : 1;
309 } __PORTAbits_t;
311 extern __at(0x000C) volatile __PORTAbits_t PORTAbits;
313 #define _RA0 0x01
314 #define _RA1 0x02
315 #define _RA2 0x04
316 #define _RA3 0x08
317 #define _RA4 0x10
318 #define _RA5 0x20
319 #define _RA6 0x40
320 #define _RA7 0x80
322 //==============================================================================
325 //==============================================================================
326 // PORTB Bits
328 extern __at(0x000D) __sfr PORTB;
330 typedef struct
332 unsigned RB0 : 1;
333 unsigned RB1 : 1;
334 unsigned RB2 : 1;
335 unsigned RB3 : 1;
336 unsigned RB4 : 1;
337 unsigned RB5 : 1;
338 unsigned RB6 : 1;
339 unsigned RB7 : 1;
340 } __PORTBbits_t;
342 extern __at(0x000D) volatile __PORTBbits_t PORTBbits;
344 #define _RB0 0x01
345 #define _RB1 0x02
346 #define _RB2 0x04
347 #define _RB3 0x08
348 #define _RB4 0x10
349 #define _RB5 0x20
350 #define _RB6 0x40
351 #define _RB7 0x80
353 //==============================================================================
356 //==============================================================================
357 // PIR1 Bits
359 extern __at(0x0011) __sfr PIR1;
361 typedef struct
363 unsigned TMR1IF : 1;
364 unsigned TMR2IF : 1;
365 unsigned CCP1IF : 1;
366 unsigned SSP1IF : 1;
367 unsigned TXIF : 1;
368 unsigned RCIF : 1;
369 unsigned ADIF : 1;
370 unsigned TMR1GIF : 1;
371 } __PIR1bits_t;
373 extern __at(0x0011) volatile __PIR1bits_t PIR1bits;
375 #define _TMR1IF 0x01
376 #define _TMR2IF 0x02
377 #define _CCP1IF 0x04
378 #define _SSP1IF 0x08
379 #define _TXIF 0x10
380 #define _RCIF 0x20
381 #define _ADIF 0x40
382 #define _TMR1GIF 0x80
384 //==============================================================================
387 //==============================================================================
388 // PIR2 Bits
390 extern __at(0x0012) __sfr PIR2;
392 typedef struct
394 unsigned : 1;
395 unsigned : 1;
396 unsigned : 1;
397 unsigned BCL1IF : 1;
398 unsigned EEIF : 1;
399 unsigned C1IF : 1;
400 unsigned C2IF : 1;
401 unsigned OSFIF : 1;
402 } __PIR2bits_t;
404 extern __at(0x0012) volatile __PIR2bits_t PIR2bits;
406 #define _BCL1IF 0x08
407 #define _EEIF 0x10
408 #define _C1IF 0x20
409 #define _C2IF 0x40
410 #define _OSFIF 0x80
412 //==============================================================================
414 extern __at(0x0015) __sfr TMR0;
415 extern __at(0x0016) __sfr TMR1;
416 extern __at(0x0016) __sfr TMR1L;
417 extern __at(0x0017) __sfr TMR1H;
419 //==============================================================================
420 // T1CON Bits
422 extern __at(0x0018) __sfr T1CON;
424 typedef union
426 struct
428 unsigned TMR1ON : 1;
429 unsigned : 1;
430 unsigned NOT_T1SYNC : 1;
431 unsigned T1OSCEN : 1;
432 unsigned T1CKPS0 : 1;
433 unsigned T1CKPS1 : 1;
434 unsigned TMR1CS0 : 1;
435 unsigned TMR1CS1 : 1;
438 struct
440 unsigned : 4;
441 unsigned T1CKPS : 2;
442 unsigned : 2;
445 struct
447 unsigned : 6;
448 unsigned TMR1CS : 2;
450 } __T1CONbits_t;
452 extern __at(0x0018) volatile __T1CONbits_t T1CONbits;
454 #define _TMR1ON 0x01
455 #define _NOT_T1SYNC 0x04
456 #define _T1OSCEN 0x08
457 #define _T1CKPS0 0x10
458 #define _T1CKPS1 0x20
459 #define _TMR1CS0 0x40
460 #define _TMR1CS1 0x80
462 //==============================================================================
465 //==============================================================================
466 // T1GCON Bits
468 extern __at(0x0019) __sfr T1GCON;
470 typedef union
472 struct
474 unsigned T1GSS0 : 1;
475 unsigned T1GSS1 : 1;
476 unsigned T1GVAL : 1;
477 unsigned T1GGO : 1;
478 unsigned T1GSPM : 1;
479 unsigned T1GTM : 1;
480 unsigned T1GPOL : 1;
481 unsigned TMR1GE : 1;
484 struct
486 unsigned T1GSS : 2;
487 unsigned : 6;
489 } __T1GCONbits_t;
491 extern __at(0x0019) volatile __T1GCONbits_t T1GCONbits;
493 #define _T1GSS0 0x01
494 #define _T1GSS1 0x02
495 #define _T1GVAL 0x04
496 #define _T1GGO 0x08
497 #define _T1GSPM 0x10
498 #define _T1GTM 0x20
499 #define _T1GPOL 0x40
500 #define _TMR1GE 0x80
502 //==============================================================================
504 extern __at(0x001A) __sfr TMR2;
505 extern __at(0x001B) __sfr PR2;
507 //==============================================================================
508 // T2CON Bits
510 extern __at(0x001C) __sfr T2CON;
512 typedef union
514 struct
516 unsigned T2CKPS0 : 1;
517 unsigned T2CKPS1 : 1;
518 unsigned TMR2ON : 1;
519 unsigned T2OUTPS0 : 1;
520 unsigned T2OUTPS1 : 1;
521 unsigned T2OUTPS2 : 1;
522 unsigned T2OUTPS3 : 1;
523 unsigned : 1;
526 struct
528 unsigned T2CKPS : 2;
529 unsigned : 6;
532 struct
534 unsigned : 3;
535 unsigned T2OUTPS : 4;
536 unsigned : 1;
538 } __T2CONbits_t;
540 extern __at(0x001C) volatile __T2CONbits_t T2CONbits;
542 #define _T2CKPS0 0x01
543 #define _T2CKPS1 0x02
544 #define _TMR2ON 0x04
545 #define _T2OUTPS0 0x08
546 #define _T2OUTPS1 0x10
547 #define _T2OUTPS2 0x20
548 #define _T2OUTPS3 0x40
550 //==============================================================================
553 //==============================================================================
554 // CPSCON0 Bits
556 extern __at(0x001E) __sfr CPSCON0;
558 typedef union
560 struct
562 unsigned T0XCS : 1;
563 unsigned CPSOUT : 1;
564 unsigned CPSRNG0 : 1;
565 unsigned CPSRNG1 : 1;
566 unsigned : 1;
567 unsigned : 1;
568 unsigned : 1;
569 unsigned CPSON : 1;
572 struct
574 unsigned : 2;
575 unsigned CPSRNG : 2;
576 unsigned : 4;
578 } __CPSCON0bits_t;
580 extern __at(0x001E) volatile __CPSCON0bits_t CPSCON0bits;
582 #define _T0XCS 0x01
583 #define _CPSOUT 0x02
584 #define _CPSRNG0 0x04
585 #define _CPSRNG1 0x08
586 #define _CPSON 0x80
588 //==============================================================================
591 //==============================================================================
592 // CPSCON1 Bits
594 extern __at(0x001F) __sfr CPSCON1;
596 typedef union
598 struct
600 unsigned CPSCH0 : 1;
601 unsigned CPSCH1 : 1;
602 unsigned CPSCH2 : 1;
603 unsigned CPSCH3 : 1;
604 unsigned : 1;
605 unsigned : 1;
606 unsigned : 1;
607 unsigned : 1;
610 struct
612 unsigned CPSCH : 4;
613 unsigned : 4;
615 } __CPSCON1bits_t;
617 extern __at(0x001F) volatile __CPSCON1bits_t CPSCON1bits;
619 #define _CPSCH0 0x01
620 #define _CPSCH1 0x02
621 #define _CPSCH2 0x04
622 #define _CPSCH3 0x08
624 //==============================================================================
627 //==============================================================================
628 // TRISA Bits
630 extern __at(0x008C) __sfr TRISA;
632 typedef struct
634 unsigned TRISA0 : 1;
635 unsigned TRISA1 : 1;
636 unsigned TRISA2 : 1;
637 unsigned TRISA3 : 1;
638 unsigned TRISA4 : 1;
639 unsigned TRISA5 : 1;
640 unsigned TRISA6 : 1;
641 unsigned TRISA7 : 1;
642 } __TRISAbits_t;
644 extern __at(0x008C) volatile __TRISAbits_t TRISAbits;
646 #define _TRISA0 0x01
647 #define _TRISA1 0x02
648 #define _TRISA2 0x04
649 #define _TRISA3 0x08
650 #define _TRISA4 0x10
651 #define _TRISA5 0x20
652 #define _TRISA6 0x40
653 #define _TRISA7 0x80
655 //==============================================================================
658 //==============================================================================
659 // TRISB Bits
661 extern __at(0x008D) __sfr TRISB;
663 typedef struct
665 unsigned TRISB0 : 1;
666 unsigned TRISB1 : 1;
667 unsigned TRISB2 : 1;
668 unsigned TRISB3 : 1;
669 unsigned TRISB4 : 1;
670 unsigned TRISB5 : 1;
671 unsigned TRISB6 : 1;
672 unsigned TRISB7 : 1;
673 } __TRISBbits_t;
675 extern __at(0x008D) volatile __TRISBbits_t TRISBbits;
677 #define _TRISB0 0x01
678 #define _TRISB1 0x02
679 #define _TRISB2 0x04
680 #define _TRISB3 0x08
681 #define _TRISB4 0x10
682 #define _TRISB5 0x20
683 #define _TRISB6 0x40
684 #define _TRISB7 0x80
686 //==============================================================================
689 //==============================================================================
690 // PIE1 Bits
692 extern __at(0x0091) __sfr PIE1;
694 typedef struct
696 unsigned TMR1IE : 1;
697 unsigned TMR2IE : 1;
698 unsigned CCP1IE : 1;
699 unsigned SSP1IE : 1;
700 unsigned TXIE : 1;
701 unsigned RCIE : 1;
702 unsigned ADIE : 1;
703 unsigned TMR1GIE : 1;
704 } __PIE1bits_t;
706 extern __at(0x0091) volatile __PIE1bits_t PIE1bits;
708 #define _TMR1IE 0x01
709 #define _TMR2IE 0x02
710 #define _CCP1IE 0x04
711 #define _SSP1IE 0x08
712 #define _TXIE 0x10
713 #define _RCIE 0x20
714 #define _ADIE 0x40
715 #define _TMR1GIE 0x80
717 //==============================================================================
720 //==============================================================================
721 // PIE2 Bits
723 extern __at(0x0092) __sfr PIE2;
725 typedef struct
727 unsigned : 1;
728 unsigned : 1;
729 unsigned : 1;
730 unsigned BCL1IE : 1;
731 unsigned EEIE : 1;
732 unsigned C1IE : 1;
733 unsigned C2IE : 1;
734 unsigned OSFIE : 1;
735 } __PIE2bits_t;
737 extern __at(0x0092) volatile __PIE2bits_t PIE2bits;
739 #define _BCL1IE 0x08
740 #define _EEIE 0x10
741 #define _C1IE 0x20
742 #define _C2IE 0x40
743 #define _OSFIE 0x80
745 //==============================================================================
748 //==============================================================================
749 // OPTION_REG Bits
751 extern __at(0x0095) __sfr OPTION_REG;
753 typedef union
755 struct
757 unsigned PS0 : 1;
758 unsigned PS1 : 1;
759 unsigned PS2 : 1;
760 unsigned PSA : 1;
761 unsigned TMR0SE : 1;
762 unsigned TMR0CS : 1;
763 unsigned INTEDG : 1;
764 unsigned NOT_WPUEN : 1;
767 struct
769 unsigned : 1;
770 unsigned : 1;
771 unsigned : 1;
772 unsigned : 1;
773 unsigned T0SE : 1;
774 unsigned T0CS : 1;
775 unsigned : 1;
776 unsigned : 1;
779 struct
781 unsigned PS : 3;
782 unsigned : 5;
784 } __OPTION_REGbits_t;
786 extern __at(0x0095) volatile __OPTION_REGbits_t OPTION_REGbits;
788 #define _PS0 0x01
789 #define _PS1 0x02
790 #define _PS2 0x04
791 #define _PSA 0x08
792 #define _TMR0SE 0x10
793 #define _T0SE 0x10
794 #define _TMR0CS 0x20
795 #define _T0CS 0x20
796 #define _INTEDG 0x40
797 #define _NOT_WPUEN 0x80
799 //==============================================================================
802 //==============================================================================
803 // PCON Bits
805 extern __at(0x0096) __sfr PCON;
807 typedef struct
809 unsigned NOT_BOR : 1;
810 unsigned NOT_POR : 1;
811 unsigned NOT_RI : 1;
812 unsigned NOT_RMCLR : 1;
813 unsigned : 1;
814 unsigned : 1;
815 unsigned STKUNF : 1;
816 unsigned STKOVF : 1;
817 } __PCONbits_t;
819 extern __at(0x0096) volatile __PCONbits_t PCONbits;
821 #define _NOT_BOR 0x01
822 #define _NOT_POR 0x02
823 #define _NOT_RI 0x04
824 #define _NOT_RMCLR 0x08
825 #define _STKUNF 0x40
826 #define _STKOVF 0x80
828 //==============================================================================
831 //==============================================================================
832 // WDTCON Bits
834 extern __at(0x0097) __sfr WDTCON;
836 typedef union
838 struct
840 unsigned SWDTEN : 1;
841 unsigned WDTPS0 : 1;
842 unsigned WDTPS1 : 1;
843 unsigned WDTPS2 : 1;
844 unsigned WDTPS3 : 1;
845 unsigned WDTPS4 : 1;
846 unsigned : 1;
847 unsigned : 1;
850 struct
852 unsigned : 1;
853 unsigned WDTPS : 5;
854 unsigned : 2;
856 } __WDTCONbits_t;
858 extern __at(0x0097) volatile __WDTCONbits_t WDTCONbits;
860 #define _SWDTEN 0x01
861 #define _WDTPS0 0x02
862 #define _WDTPS1 0x04
863 #define _WDTPS2 0x08
864 #define _WDTPS3 0x10
865 #define _WDTPS4 0x20
867 //==============================================================================
870 //==============================================================================
871 // OSCTUNE Bits
873 extern __at(0x0098) __sfr OSCTUNE;
875 typedef union
877 struct
879 unsigned TUN0 : 1;
880 unsigned TUN1 : 1;
881 unsigned TUN2 : 1;
882 unsigned TUN3 : 1;
883 unsigned TUN4 : 1;
884 unsigned TUN5 : 1;
885 unsigned : 1;
886 unsigned : 1;
889 struct
891 unsigned TUN : 6;
892 unsigned : 2;
894 } __OSCTUNEbits_t;
896 extern __at(0x0098) volatile __OSCTUNEbits_t OSCTUNEbits;
898 #define _TUN0 0x01
899 #define _TUN1 0x02
900 #define _TUN2 0x04
901 #define _TUN3 0x08
902 #define _TUN4 0x10
903 #define _TUN5 0x20
905 //==============================================================================
908 //==============================================================================
909 // OSCCON Bits
911 extern __at(0x0099) __sfr OSCCON;
913 typedef union
915 struct
917 unsigned SCS0 : 1;
918 unsigned SCS1 : 1;
919 unsigned : 1;
920 unsigned IRCF0 : 1;
921 unsigned IRCF1 : 1;
922 unsigned IRCF2 : 1;
923 unsigned IRCF3 : 1;
924 unsigned SPLLEN : 1;
927 struct
929 unsigned SCS : 2;
930 unsigned : 6;
933 struct
935 unsigned : 3;
936 unsigned IRCF : 4;
937 unsigned : 1;
939 } __OSCCONbits_t;
941 extern __at(0x0099) volatile __OSCCONbits_t OSCCONbits;
943 #define _SCS0 0x01
944 #define _SCS1 0x02
945 #define _IRCF0 0x08
946 #define _IRCF1 0x10
947 #define _IRCF2 0x20
948 #define _IRCF3 0x40
949 #define _SPLLEN 0x80
951 //==============================================================================
954 //==============================================================================
955 // OSCSTAT Bits
957 extern __at(0x009A) __sfr OSCSTAT;
959 typedef struct
961 unsigned HFIOFS : 1;
962 unsigned LFIOFR : 1;
963 unsigned MFIOFR : 1;
964 unsigned HFIOFL : 1;
965 unsigned HFIOFR : 1;
966 unsigned OSTS : 1;
967 unsigned PLLR : 1;
968 unsigned T1OSCR : 1;
969 } __OSCSTATbits_t;
971 extern __at(0x009A) volatile __OSCSTATbits_t OSCSTATbits;
973 #define _HFIOFS 0x01
974 #define _LFIOFR 0x02
975 #define _MFIOFR 0x04
976 #define _HFIOFL 0x08
977 #define _HFIOFR 0x10
978 #define _OSTS 0x20
979 #define _PLLR 0x40
980 #define _T1OSCR 0x80
982 //==============================================================================
984 extern __at(0x009B) __sfr ADRES;
985 extern __at(0x009B) __sfr ADRESL;
986 extern __at(0x009C) __sfr ADRESH;
988 //==============================================================================
989 // ADCON0 Bits
991 extern __at(0x009D) __sfr ADCON0;
993 typedef union
995 struct
997 unsigned ADON : 1;
998 unsigned GO_NOT_DONE : 1;
999 unsigned CHS0 : 1;
1000 unsigned CHS1 : 1;
1001 unsigned CHS2 : 1;
1002 unsigned CHS3 : 1;
1003 unsigned CHS4 : 1;
1004 unsigned : 1;
1007 struct
1009 unsigned : 1;
1010 unsigned ADGO : 1;
1011 unsigned : 1;
1012 unsigned : 1;
1013 unsigned : 1;
1014 unsigned : 1;
1015 unsigned : 1;
1016 unsigned : 1;
1019 struct
1021 unsigned : 1;
1022 unsigned GO : 1;
1023 unsigned : 1;
1024 unsigned : 1;
1025 unsigned : 1;
1026 unsigned : 1;
1027 unsigned : 1;
1028 unsigned : 1;
1031 struct
1033 unsigned : 2;
1034 unsigned CHS : 5;
1035 unsigned : 1;
1037 } __ADCON0bits_t;
1039 extern __at(0x009D) volatile __ADCON0bits_t ADCON0bits;
1041 #define _ADON 0x01
1042 #define _GO_NOT_DONE 0x02
1043 #define _ADGO 0x02
1044 #define _GO 0x02
1045 #define _CHS0 0x04
1046 #define _CHS1 0x08
1047 #define _CHS2 0x10
1048 #define _CHS3 0x20
1049 #define _CHS4 0x40
1051 //==============================================================================
1054 //==============================================================================
1055 // ADCON1 Bits
1057 extern __at(0x009E) __sfr ADCON1;
1059 typedef union
1061 struct
1063 unsigned ADPREF0 : 1;
1064 unsigned ADPREF1 : 1;
1065 unsigned ADNREF : 1;
1066 unsigned : 1;
1067 unsigned ADCS0 : 1;
1068 unsigned ADCS1 : 1;
1069 unsigned ADCS2 : 1;
1070 unsigned ADFM : 1;
1073 struct
1075 unsigned ADPREF : 2;
1076 unsigned : 6;
1079 struct
1081 unsigned : 4;
1082 unsigned ADCS : 3;
1083 unsigned : 1;
1085 } __ADCON1bits_t;
1087 extern __at(0x009E) volatile __ADCON1bits_t ADCON1bits;
1089 #define _ADPREF0 0x01
1090 #define _ADPREF1 0x02
1091 #define _ADNREF 0x04
1092 #define _ADCS0 0x10
1093 #define _ADCS1 0x20
1094 #define _ADCS2 0x40
1095 #define _ADFM 0x80
1097 //==============================================================================
1100 //==============================================================================
1101 // LATA Bits
1103 extern __at(0x010C) __sfr LATA;
1105 typedef struct
1107 unsigned LATA0 : 1;
1108 unsigned LATA1 : 1;
1109 unsigned LATA2 : 1;
1110 unsigned LATA3 : 1;
1111 unsigned LATA4 : 1;
1112 unsigned : 1;
1113 unsigned LATA6 : 1;
1114 unsigned LATA7 : 1;
1115 } __LATAbits_t;
1117 extern __at(0x010C) volatile __LATAbits_t LATAbits;
1119 #define _LATA0 0x01
1120 #define _LATA1 0x02
1121 #define _LATA2 0x04
1122 #define _LATA3 0x08
1123 #define _LATA4 0x10
1124 #define _LATA6 0x40
1125 #define _LATA7 0x80
1127 //==============================================================================
1130 //==============================================================================
1131 // LATB Bits
1133 extern __at(0x010D) __sfr LATB;
1135 typedef struct
1137 unsigned LATB0 : 1;
1138 unsigned LATB1 : 1;
1139 unsigned LATB2 : 1;
1140 unsigned LATB3 : 1;
1141 unsigned LATB4 : 1;
1142 unsigned LATB5 : 1;
1143 unsigned LATB6 : 1;
1144 unsigned LATB7 : 1;
1145 } __LATBbits_t;
1147 extern __at(0x010D) volatile __LATBbits_t LATBbits;
1149 #define _LATB0 0x01
1150 #define _LATB1 0x02
1151 #define _LATB2 0x04
1152 #define _LATB3 0x08
1153 #define _LATB4 0x10
1154 #define _LATB5 0x20
1155 #define _LATB6 0x40
1156 #define _LATB7 0x80
1158 //==============================================================================
1161 //==============================================================================
1162 // CM1CON0 Bits
1164 extern __at(0x0111) __sfr CM1CON0;
1166 typedef struct
1168 unsigned C1SYNC : 1;
1169 unsigned C1HYS : 1;
1170 unsigned C1SP : 1;
1171 unsigned : 1;
1172 unsigned C1POL : 1;
1173 unsigned C1OE : 1;
1174 unsigned C1OUT : 1;
1175 unsigned C1ON : 1;
1176 } __CM1CON0bits_t;
1178 extern __at(0x0111) volatile __CM1CON0bits_t CM1CON0bits;
1180 #define _C1SYNC 0x01
1181 #define _C1HYS 0x02
1182 #define _C1SP 0x04
1183 #define _C1POL 0x10
1184 #define _C1OE 0x20
1185 #define _C1OUT 0x40
1186 #define _C1ON 0x80
1188 //==============================================================================
1191 //==============================================================================
1192 // CM1CON1 Bits
1194 extern __at(0x0112) __sfr CM1CON1;
1196 typedef union
1198 struct
1200 unsigned C1NCH0 : 1;
1201 unsigned C1NCH1 : 1;
1202 unsigned : 1;
1203 unsigned : 1;
1204 unsigned C1PCH0 : 1;
1205 unsigned C1PCH1 : 1;
1206 unsigned C1INTN : 1;
1207 unsigned C1INTP : 1;
1210 struct
1212 unsigned C1NCH : 2;
1213 unsigned : 6;
1216 struct
1218 unsigned : 4;
1219 unsigned C1PCH : 2;
1220 unsigned : 2;
1222 } __CM1CON1bits_t;
1224 extern __at(0x0112) volatile __CM1CON1bits_t CM1CON1bits;
1226 #define _C1NCH0 0x01
1227 #define _C1NCH1 0x02
1228 #define _C1PCH0 0x10
1229 #define _C1PCH1 0x20
1230 #define _C1INTN 0x40
1231 #define _C1INTP 0x80
1233 //==============================================================================
1236 //==============================================================================
1237 // CM2CON0 Bits
1239 extern __at(0x0113) __sfr CM2CON0;
1241 typedef struct
1243 unsigned C2SYNC : 1;
1244 unsigned C2HYS : 1;
1245 unsigned C2SP : 1;
1246 unsigned : 1;
1247 unsigned C2POL : 1;
1248 unsigned C2OE : 1;
1249 unsigned C2OUT : 1;
1250 unsigned C2ON : 1;
1251 } __CM2CON0bits_t;
1253 extern __at(0x0113) volatile __CM2CON0bits_t CM2CON0bits;
1255 #define _C2SYNC 0x01
1256 #define _C2HYS 0x02
1257 #define _C2SP 0x04
1258 #define _C2POL 0x10
1259 #define _C2OE 0x20
1260 #define _C2OUT 0x40
1261 #define _C2ON 0x80
1263 //==============================================================================
1266 //==============================================================================
1267 // CM2CON1 Bits
1269 extern __at(0x0114) __sfr CM2CON1;
1271 typedef union
1273 struct
1275 unsigned C2NCH0 : 1;
1276 unsigned C2NCH1 : 1;
1277 unsigned : 1;
1278 unsigned : 1;
1279 unsigned C2PCH0 : 1;
1280 unsigned C2PCH1 : 1;
1281 unsigned C2INTN : 1;
1282 unsigned C2INTP : 1;
1285 struct
1287 unsigned C2NCH : 2;
1288 unsigned : 6;
1291 struct
1293 unsigned : 4;
1294 unsigned C2PCH : 2;
1295 unsigned : 2;
1297 } __CM2CON1bits_t;
1299 extern __at(0x0114) volatile __CM2CON1bits_t CM2CON1bits;
1301 #define _C2NCH0 0x01
1302 #define _C2NCH1 0x02
1303 #define _C2PCH0 0x10
1304 #define _C2PCH1 0x20
1305 #define _C2INTN 0x40
1306 #define _C2INTP 0x80
1308 //==============================================================================
1311 //==============================================================================
1312 // CMOUT Bits
1314 extern __at(0x0115) __sfr CMOUT;
1316 typedef struct
1318 unsigned MC1OUT : 1;
1319 unsigned MC2OUT : 1;
1320 unsigned : 1;
1321 unsigned : 1;
1322 unsigned : 1;
1323 unsigned : 1;
1324 unsigned : 1;
1325 unsigned : 1;
1326 } __CMOUTbits_t;
1328 extern __at(0x0115) volatile __CMOUTbits_t CMOUTbits;
1330 #define _MC1OUT 0x01
1331 #define _MC2OUT 0x02
1333 //==============================================================================
1336 //==============================================================================
1337 // BORCON Bits
1339 extern __at(0x0116) __sfr BORCON;
1341 typedef struct
1343 unsigned BORRDY : 1;
1344 unsigned : 1;
1345 unsigned : 1;
1346 unsigned : 1;
1347 unsigned : 1;
1348 unsigned : 1;
1349 unsigned : 1;
1350 unsigned SBOREN : 1;
1351 } __BORCONbits_t;
1353 extern __at(0x0116) volatile __BORCONbits_t BORCONbits;
1355 #define _BORRDY 0x01
1356 #define _SBOREN 0x80
1358 //==============================================================================
1361 //==============================================================================
1362 // FVRCON Bits
1364 extern __at(0x0117) __sfr FVRCON;
1366 typedef union
1368 struct
1370 unsigned ADFVR0 : 1;
1371 unsigned ADFVR1 : 1;
1372 unsigned CDAFVR0 : 1;
1373 unsigned CDAFVR1 : 1;
1374 unsigned TSRNG : 1;
1375 unsigned TSEN : 1;
1376 unsigned FVRRDY : 1;
1377 unsigned FVREN : 1;
1380 struct
1382 unsigned ADFVR : 2;
1383 unsigned : 6;
1386 struct
1388 unsigned : 2;
1389 unsigned CDAFVR : 2;
1390 unsigned : 4;
1392 } __FVRCONbits_t;
1394 extern __at(0x0117) volatile __FVRCONbits_t FVRCONbits;
1396 #define _ADFVR0 0x01
1397 #define _ADFVR1 0x02
1398 #define _CDAFVR0 0x04
1399 #define _CDAFVR1 0x08
1400 #define _TSRNG 0x10
1401 #define _TSEN 0x20
1402 #define _FVRRDY 0x40
1403 #define _FVREN 0x80
1405 //==============================================================================
1408 //==============================================================================
1409 // DACCON0 Bits
1411 extern __at(0x0118) __sfr DACCON0;
1413 typedef union
1415 struct
1417 unsigned DACNSS : 1;
1418 unsigned : 1;
1419 unsigned DACPSS0 : 1;
1420 unsigned DACPSS1 : 1;
1421 unsigned : 1;
1422 unsigned DACOE : 1;
1423 unsigned DACLPS : 1;
1424 unsigned DACEN : 1;
1427 struct
1429 unsigned : 2;
1430 unsigned DACPSS : 2;
1431 unsigned : 4;
1433 } __DACCON0bits_t;
1435 extern __at(0x0118) volatile __DACCON0bits_t DACCON0bits;
1437 #define _DACNSS 0x01
1438 #define _DACPSS0 0x04
1439 #define _DACPSS1 0x08
1440 #define _DACOE 0x20
1441 #define _DACLPS 0x40
1442 #define _DACEN 0x80
1444 //==============================================================================
1447 //==============================================================================
1448 // DACCON1 Bits
1450 extern __at(0x0119) __sfr DACCON1;
1452 typedef union
1454 struct
1456 unsigned DACR0 : 1;
1457 unsigned DACR1 : 1;
1458 unsigned DACR2 : 1;
1459 unsigned DACR3 : 1;
1460 unsigned DACR4 : 1;
1461 unsigned : 1;
1462 unsigned : 1;
1463 unsigned : 1;
1466 struct
1468 unsigned DACR : 5;
1469 unsigned : 3;
1471 } __DACCON1bits_t;
1473 extern __at(0x0119) volatile __DACCON1bits_t DACCON1bits;
1475 #define _DACR0 0x01
1476 #define _DACR1 0x02
1477 #define _DACR2 0x04
1478 #define _DACR3 0x08
1479 #define _DACR4 0x10
1481 //==============================================================================
1484 //==============================================================================
1485 // SRCON0 Bits
1487 extern __at(0x011A) __sfr SRCON0;
1489 typedef union
1491 struct
1493 unsigned SRPR : 1;
1494 unsigned SRPS : 1;
1495 unsigned SRNQEN : 1;
1496 unsigned SRQEN : 1;
1497 unsigned SRCLK0 : 1;
1498 unsigned SRCLK1 : 1;
1499 unsigned SRCLK2 : 1;
1500 unsigned SRLEN : 1;
1503 struct
1505 unsigned : 4;
1506 unsigned SRCLK : 3;
1507 unsigned : 1;
1509 } __SRCON0bits_t;
1511 extern __at(0x011A) volatile __SRCON0bits_t SRCON0bits;
1513 #define _SRPR 0x01
1514 #define _SRPS 0x02
1515 #define _SRNQEN 0x04
1516 #define _SRQEN 0x08
1517 #define _SRCLK0 0x10
1518 #define _SRCLK1 0x20
1519 #define _SRCLK2 0x40
1520 #define _SRLEN 0x80
1522 //==============================================================================
1525 //==============================================================================
1526 // SRCON1 Bits
1528 extern __at(0x011B) __sfr SRCON1;
1530 typedef struct
1532 unsigned SRRC1E : 1;
1533 unsigned SRRC2E : 1;
1534 unsigned SRRCKE : 1;
1535 unsigned SRRPE : 1;
1536 unsigned SRSC1E : 1;
1537 unsigned SRSC2E : 1;
1538 unsigned SRSCKE : 1;
1539 unsigned SRSPE : 1;
1540 } __SRCON1bits_t;
1542 extern __at(0x011B) volatile __SRCON1bits_t SRCON1bits;
1544 #define _SRRC1E 0x01
1545 #define _SRRC2E 0x02
1546 #define _SRRCKE 0x04
1547 #define _SRRPE 0x08
1548 #define _SRSC1E 0x10
1549 #define _SRSC2E 0x20
1550 #define _SRSCKE 0x40
1551 #define _SRSPE 0x80
1553 //==============================================================================
1556 //==============================================================================
1557 // APFCON0 Bits
1559 extern __at(0x011D) __sfr APFCON0;
1561 typedef struct
1563 unsigned CCP1SEL : 1;
1564 unsigned P1CSEL : 1;
1565 unsigned P1DSEL : 1;
1566 unsigned : 1;
1567 unsigned : 1;
1568 unsigned SS1SEL : 1;
1569 unsigned SDO1SEL : 1;
1570 unsigned RXDTSEL : 1;
1571 } __APFCON0bits_t;
1573 extern __at(0x011D) volatile __APFCON0bits_t APFCON0bits;
1575 #define _CCP1SEL 0x01
1576 #define _P1CSEL 0x02
1577 #define _P1DSEL 0x04
1578 #define _SS1SEL 0x20
1579 #define _SDO1SEL 0x40
1580 #define _RXDTSEL 0x80
1582 //==============================================================================
1585 //==============================================================================
1586 // APFCON1 Bits
1588 extern __at(0x011E) __sfr APFCON1;
1590 typedef struct
1592 unsigned TXCKSEL : 1;
1593 unsigned : 1;
1594 unsigned : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1597 unsigned : 1;
1598 unsigned : 1;
1599 unsigned : 1;
1600 } __APFCON1bits_t;
1602 extern __at(0x011E) volatile __APFCON1bits_t APFCON1bits;
1604 #define _TXCKSEL 0x01
1606 //==============================================================================
1609 //==============================================================================
1610 // ANSELA Bits
1612 extern __at(0x018C) __sfr ANSELA;
1614 typedef union
1616 struct
1618 unsigned ANSA0 : 1;
1619 unsigned ANSA1 : 1;
1620 unsigned ANSA2 : 1;
1621 unsigned ANSA3 : 1;
1622 unsigned ANSA4 : 1;
1623 unsigned : 1;
1624 unsigned : 1;
1625 unsigned : 1;
1628 struct
1630 unsigned ANSA : 5;
1631 unsigned : 3;
1633 } __ANSELAbits_t;
1635 extern __at(0x018C) volatile __ANSELAbits_t ANSELAbits;
1637 #define _ANSA0 0x01
1638 #define _ANSA1 0x02
1639 #define _ANSA2 0x04
1640 #define _ANSA3 0x08
1641 #define _ANSA4 0x10
1643 //==============================================================================
1646 //==============================================================================
1647 // ANSELB Bits
1649 extern __at(0x018D) __sfr ANSELB;
1651 typedef struct
1653 unsigned : 1;
1654 unsigned ANSB1 : 1;
1655 unsigned ANSB2 : 1;
1656 unsigned ANSB3 : 1;
1657 unsigned ANSB4 : 1;
1658 unsigned ANSB5 : 1;
1659 unsigned ANSB6 : 1;
1660 unsigned ANSB7 : 1;
1661 } __ANSELBbits_t;
1663 extern __at(0x018D) volatile __ANSELBbits_t ANSELBbits;
1665 #define _ANSB1 0x02
1666 #define _ANSB2 0x04
1667 #define _ANSB3 0x08
1668 #define _ANSB4 0x10
1669 #define _ANSB5 0x20
1670 #define _ANSB6 0x40
1671 #define _ANSB7 0x80
1673 //==============================================================================
1675 extern __at(0x0191) __sfr EEADR;
1676 extern __at(0x0191) __sfr EEADRL;
1677 extern __at(0x0192) __sfr EEADRH;
1678 extern __at(0x0193) __sfr EEDAT;
1679 extern __at(0x0193) __sfr EEDATL;
1680 extern __at(0x0194) __sfr EEDATH;
1682 //==============================================================================
1683 // EECON1 Bits
1685 extern __at(0x0195) __sfr EECON1;
1687 typedef struct
1689 unsigned RD : 1;
1690 unsigned WR : 1;
1691 unsigned WREN : 1;
1692 unsigned WRERR : 1;
1693 unsigned FREE : 1;
1694 unsigned LWLO : 1;
1695 unsigned CFGS : 1;
1696 unsigned EEPGD : 1;
1697 } __EECON1bits_t;
1699 extern __at(0x0195) volatile __EECON1bits_t EECON1bits;
1701 #define _RD 0x01
1702 #define _WR 0x02
1703 #define _WREN 0x04
1704 #define _WRERR 0x08
1705 #define _FREE 0x10
1706 #define _LWLO 0x20
1707 #define _CFGS 0x40
1708 #define _EEPGD 0x80
1710 //==============================================================================
1712 extern __at(0x0196) __sfr EECON2;
1713 extern __at(0x0199) __sfr RCREG;
1714 extern __at(0x019A) __sfr TXREG;
1715 extern __at(0x019B) __sfr SP1BRG;
1716 extern __at(0x019B) __sfr SP1BRGL;
1717 extern __at(0x019B) __sfr SPBRG;
1718 extern __at(0x019B) __sfr SPBRGL;
1719 extern __at(0x019C) __sfr SP1BRGH;
1720 extern __at(0x019C) __sfr SPBRGH;
1722 //==============================================================================
1723 // RCSTA Bits
1725 extern __at(0x019D) __sfr RCSTA;
1727 typedef struct
1729 unsigned RX9D : 1;
1730 unsigned OERR : 1;
1731 unsigned FERR : 1;
1732 unsigned ADDEN : 1;
1733 unsigned CREN : 1;
1734 unsigned SREN : 1;
1735 unsigned RX9 : 1;
1736 unsigned SPEN : 1;
1737 } __RCSTAbits_t;
1739 extern __at(0x019D) volatile __RCSTAbits_t RCSTAbits;
1741 #define _RX9D 0x01
1742 #define _OERR 0x02
1743 #define _FERR 0x04
1744 #define _ADDEN 0x08
1745 #define _CREN 0x10
1746 #define _SREN 0x20
1747 #define _RX9 0x40
1748 #define _SPEN 0x80
1750 //==============================================================================
1753 //==============================================================================
1754 // TXSTA Bits
1756 extern __at(0x019E) __sfr TXSTA;
1758 typedef struct
1760 unsigned TX9D : 1;
1761 unsigned TRMT : 1;
1762 unsigned BRGH : 1;
1763 unsigned SENDB : 1;
1764 unsigned SYNC : 1;
1765 unsigned TXEN : 1;
1766 unsigned TX9 : 1;
1767 unsigned CSRC : 1;
1768 } __TXSTAbits_t;
1770 extern __at(0x019E) volatile __TXSTAbits_t TXSTAbits;
1772 #define _TX9D 0x01
1773 #define _TRMT 0x02
1774 #define _BRGH 0x04
1775 #define _SENDB 0x08
1776 #define _SYNC 0x10
1777 #define _TXEN 0x20
1778 #define _TX9 0x40
1779 #define _CSRC 0x80
1781 //==============================================================================
1784 //==============================================================================
1785 // BAUDCON Bits
1787 extern __at(0x019F) __sfr BAUDCON;
1789 typedef struct
1791 unsigned ABDEN : 1;
1792 unsigned WUE : 1;
1793 unsigned : 1;
1794 unsigned BRG16 : 1;
1795 unsigned SCKP : 1;
1796 unsigned : 1;
1797 unsigned RCIDL : 1;
1798 unsigned ABDOVF : 1;
1799 } __BAUDCONbits_t;
1801 extern __at(0x019F) volatile __BAUDCONbits_t BAUDCONbits;
1803 #define _ABDEN 0x01
1804 #define _WUE 0x02
1805 #define _BRG16 0x08
1806 #define _SCKP 0x10
1807 #define _RCIDL 0x40
1808 #define _ABDOVF 0x80
1810 //==============================================================================
1813 //==============================================================================
1814 // WPUA Bits
1816 extern __at(0x020C) __sfr WPUA;
1818 typedef struct
1820 unsigned : 1;
1821 unsigned : 1;
1822 unsigned : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1825 unsigned WPUA5 : 1;
1826 unsigned : 1;
1827 unsigned : 1;
1828 } __WPUAbits_t;
1830 extern __at(0x020C) volatile __WPUAbits_t WPUAbits;
1832 #define _WPUA5 0x20
1834 //==============================================================================
1837 //==============================================================================
1838 // WPUB Bits
1840 extern __at(0x020D) __sfr WPUB;
1842 typedef struct
1844 unsigned WPUB0 : 1;
1845 unsigned WPUB1 : 1;
1846 unsigned WPUB2 : 1;
1847 unsigned WPUB3 : 1;
1848 unsigned WPUB4 : 1;
1849 unsigned WPUB5 : 1;
1850 unsigned WPUB6 : 1;
1851 unsigned WPUB7 : 1;
1852 } __WPUBbits_t;
1854 extern __at(0x020D) volatile __WPUBbits_t WPUBbits;
1856 #define _WPUB0 0x01
1857 #define _WPUB1 0x02
1858 #define _WPUB2 0x04
1859 #define _WPUB3 0x08
1860 #define _WPUB4 0x10
1861 #define _WPUB5 0x20
1862 #define _WPUB6 0x40
1863 #define _WPUB7 0x80
1865 //==============================================================================
1867 extern __at(0x0211) __sfr SSP1BUF;
1868 extern __at(0x0211) __sfr SSPBUF;
1869 extern __at(0x0212) __sfr SSP1ADD;
1870 extern __at(0x0212) __sfr SSPADD;
1871 extern __at(0x0213) __sfr SSP1MSK;
1872 extern __at(0x0213) __sfr SSPMSK;
1874 //==============================================================================
1875 // SSP1STAT Bits
1877 extern __at(0x0214) __sfr SSP1STAT;
1879 typedef struct
1881 unsigned BF : 1;
1882 unsigned UA : 1;
1883 unsigned R_NOT_W : 1;
1884 unsigned S : 1;
1885 unsigned P : 1;
1886 unsigned D_NOT_A : 1;
1887 unsigned CKE : 1;
1888 unsigned SMP : 1;
1889 } __SSP1STATbits_t;
1891 extern __at(0x0214) volatile __SSP1STATbits_t SSP1STATbits;
1893 #define _BF 0x01
1894 #define _UA 0x02
1895 #define _R_NOT_W 0x04
1896 #define _S 0x08
1897 #define _P 0x10
1898 #define _D_NOT_A 0x20
1899 #define _CKE 0x40
1900 #define _SMP 0x80
1902 //==============================================================================
1905 //==============================================================================
1906 // SSPSTAT Bits
1908 extern __at(0x0214) __sfr SSPSTAT;
1910 typedef struct
1912 unsigned BF : 1;
1913 unsigned UA : 1;
1914 unsigned R_NOT_W : 1;
1915 unsigned S : 1;
1916 unsigned P : 1;
1917 unsigned D_NOT_A : 1;
1918 unsigned CKE : 1;
1919 unsigned SMP : 1;
1920 } __SSPSTATbits_t;
1922 extern __at(0x0214) volatile __SSPSTATbits_t SSPSTATbits;
1924 #define _SSPSTAT_BF 0x01
1925 #define _SSPSTAT_UA 0x02
1926 #define _SSPSTAT_R_NOT_W 0x04
1927 #define _SSPSTAT_S 0x08
1928 #define _SSPSTAT_P 0x10
1929 #define _SSPSTAT_D_NOT_A 0x20
1930 #define _SSPSTAT_CKE 0x40
1931 #define _SSPSTAT_SMP 0x80
1933 //==============================================================================
1936 //==============================================================================
1937 // SSP1CON1 Bits
1939 extern __at(0x0215) __sfr SSP1CON1;
1941 typedef union
1943 struct
1945 unsigned SSPM0 : 1;
1946 unsigned SSPM1 : 1;
1947 unsigned SSPM2 : 1;
1948 unsigned SSPM3 : 1;
1949 unsigned CKP : 1;
1950 unsigned SSPEN : 1;
1951 unsigned SSPOV : 1;
1952 unsigned WCOL : 1;
1955 struct
1957 unsigned SSPM : 4;
1958 unsigned : 4;
1960 } __SSP1CON1bits_t;
1962 extern __at(0x0215) volatile __SSP1CON1bits_t SSP1CON1bits;
1964 #define _SSPM0 0x01
1965 #define _SSPM1 0x02
1966 #define _SSPM2 0x04
1967 #define _SSPM3 0x08
1968 #define _CKP 0x10
1969 #define _SSPEN 0x20
1970 #define _SSPOV 0x40
1971 #define _WCOL 0x80
1973 //==============================================================================
1976 //==============================================================================
1977 // SSPCON Bits
1979 extern __at(0x0215) __sfr SSPCON;
1981 typedef union
1983 struct
1985 unsigned SSPM0 : 1;
1986 unsigned SSPM1 : 1;
1987 unsigned SSPM2 : 1;
1988 unsigned SSPM3 : 1;
1989 unsigned CKP : 1;
1990 unsigned SSPEN : 1;
1991 unsigned SSPOV : 1;
1992 unsigned WCOL : 1;
1995 struct
1997 unsigned SSPM : 4;
1998 unsigned : 4;
2000 } __SSPCONbits_t;
2002 extern __at(0x0215) volatile __SSPCONbits_t SSPCONbits;
2004 #define _SSPCON_SSPM0 0x01
2005 #define _SSPCON_SSPM1 0x02
2006 #define _SSPCON_SSPM2 0x04
2007 #define _SSPCON_SSPM3 0x08
2008 #define _SSPCON_CKP 0x10
2009 #define _SSPCON_SSPEN 0x20
2010 #define _SSPCON_SSPOV 0x40
2011 #define _SSPCON_WCOL 0x80
2013 //==============================================================================
2016 //==============================================================================
2017 // SSPCON1 Bits
2019 extern __at(0x0215) __sfr SSPCON1;
2021 typedef union
2023 struct
2025 unsigned SSPM0 : 1;
2026 unsigned SSPM1 : 1;
2027 unsigned SSPM2 : 1;
2028 unsigned SSPM3 : 1;
2029 unsigned CKP : 1;
2030 unsigned SSPEN : 1;
2031 unsigned SSPOV : 1;
2032 unsigned WCOL : 1;
2035 struct
2037 unsigned SSPM : 4;
2038 unsigned : 4;
2040 } __SSPCON1bits_t;
2042 extern __at(0x0215) volatile __SSPCON1bits_t SSPCON1bits;
2044 #define _SSPCON1_SSPM0 0x01
2045 #define _SSPCON1_SSPM1 0x02
2046 #define _SSPCON1_SSPM2 0x04
2047 #define _SSPCON1_SSPM3 0x08
2048 #define _SSPCON1_CKP 0x10
2049 #define _SSPCON1_SSPEN 0x20
2050 #define _SSPCON1_SSPOV 0x40
2051 #define _SSPCON1_WCOL 0x80
2053 //==============================================================================
2056 //==============================================================================
2057 // SSP1CON2 Bits
2059 extern __at(0x0216) __sfr SSP1CON2;
2061 typedef struct
2063 unsigned SEN : 1;
2064 unsigned RSEN : 1;
2065 unsigned PEN : 1;
2066 unsigned RCEN : 1;
2067 unsigned ACKEN : 1;
2068 unsigned ACKDT : 1;
2069 unsigned ACKSTAT : 1;
2070 unsigned GCEN : 1;
2071 } __SSP1CON2bits_t;
2073 extern __at(0x0216) volatile __SSP1CON2bits_t SSP1CON2bits;
2075 #define _SEN 0x01
2076 #define _RSEN 0x02
2077 #define _PEN 0x04
2078 #define _RCEN 0x08
2079 #define _ACKEN 0x10
2080 #define _ACKDT 0x20
2081 #define _ACKSTAT 0x40
2082 #define _GCEN 0x80
2084 //==============================================================================
2087 //==============================================================================
2088 // SSPCON2 Bits
2090 extern __at(0x0216) __sfr SSPCON2;
2092 typedef struct
2094 unsigned SEN : 1;
2095 unsigned RSEN : 1;
2096 unsigned PEN : 1;
2097 unsigned RCEN : 1;
2098 unsigned ACKEN : 1;
2099 unsigned ACKDT : 1;
2100 unsigned ACKSTAT : 1;
2101 unsigned GCEN : 1;
2102 } __SSPCON2bits_t;
2104 extern __at(0x0216) volatile __SSPCON2bits_t SSPCON2bits;
2106 #define _SSPCON2_SEN 0x01
2107 #define _SSPCON2_RSEN 0x02
2108 #define _SSPCON2_PEN 0x04
2109 #define _SSPCON2_RCEN 0x08
2110 #define _SSPCON2_ACKEN 0x10
2111 #define _SSPCON2_ACKDT 0x20
2112 #define _SSPCON2_ACKSTAT 0x40
2113 #define _SSPCON2_GCEN 0x80
2115 //==============================================================================
2118 //==============================================================================
2119 // SSP1CON3 Bits
2121 extern __at(0x0217) __sfr SSP1CON3;
2123 typedef struct
2125 unsigned DHEN : 1;
2126 unsigned AHEN : 1;
2127 unsigned SBCDE : 1;
2128 unsigned SDAHT : 1;
2129 unsigned BOEN : 1;
2130 unsigned SCIE : 1;
2131 unsigned PCIE : 1;
2132 unsigned ACKTIM : 1;
2133 } __SSP1CON3bits_t;
2135 extern __at(0x0217) volatile __SSP1CON3bits_t SSP1CON3bits;
2137 #define _DHEN 0x01
2138 #define _AHEN 0x02
2139 #define _SBCDE 0x04
2140 #define _SDAHT 0x08
2141 #define _BOEN 0x10
2142 #define _SCIE 0x20
2143 #define _PCIE 0x40
2144 #define _ACKTIM 0x80
2146 //==============================================================================
2149 //==============================================================================
2150 // SSPCON3 Bits
2152 extern __at(0x0217) __sfr SSPCON3;
2154 typedef struct
2156 unsigned DHEN : 1;
2157 unsigned AHEN : 1;
2158 unsigned SBCDE : 1;
2159 unsigned SDAHT : 1;
2160 unsigned BOEN : 1;
2161 unsigned SCIE : 1;
2162 unsigned PCIE : 1;
2163 unsigned ACKTIM : 1;
2164 } __SSPCON3bits_t;
2166 extern __at(0x0217) volatile __SSPCON3bits_t SSPCON3bits;
2168 #define _SSPCON3_DHEN 0x01
2169 #define _SSPCON3_AHEN 0x02
2170 #define _SSPCON3_SBCDE 0x04
2171 #define _SSPCON3_SDAHT 0x08
2172 #define _SSPCON3_BOEN 0x10
2173 #define _SSPCON3_SCIE 0x20
2174 #define _SSPCON3_PCIE 0x40
2175 #define _SSPCON3_ACKTIM 0x80
2177 //==============================================================================
2179 extern __at(0x0291) __sfr CCPR1;
2180 extern __at(0x0291) __sfr CCPR1L;
2181 extern __at(0x0292) __sfr CCPR1H;
2183 //==============================================================================
2184 // CCP1CON Bits
2186 extern __at(0x0293) __sfr CCP1CON;
2188 typedef union
2190 struct
2192 unsigned CCP1M0 : 1;
2193 unsigned CCP1M1 : 1;
2194 unsigned CCP1M2 : 1;
2195 unsigned CCP1M3 : 1;
2196 unsigned DC1B0 : 1;
2197 unsigned DC1B1 : 1;
2198 unsigned P1M0 : 1;
2199 unsigned P1M1 : 1;
2202 struct
2204 unsigned CCP1M : 4;
2205 unsigned : 4;
2208 struct
2210 unsigned : 4;
2211 unsigned DC1B : 2;
2212 unsigned : 2;
2215 struct
2217 unsigned : 6;
2218 unsigned P1M : 2;
2220 } __CCP1CONbits_t;
2222 extern __at(0x0293) volatile __CCP1CONbits_t CCP1CONbits;
2224 #define _CCP1M0 0x01
2225 #define _CCP1M1 0x02
2226 #define _CCP1M2 0x04
2227 #define _CCP1M3 0x08
2228 #define _DC1B0 0x10
2229 #define _DC1B1 0x20
2230 #define _P1M0 0x40
2231 #define _P1M1 0x80
2233 //==============================================================================
2236 //==============================================================================
2237 // PWM1CON Bits
2239 extern __at(0x0294) __sfr PWM1CON;
2241 typedef union
2243 struct
2245 unsigned P1DC0 : 1;
2246 unsigned P1DC1 : 1;
2247 unsigned P1DC2 : 1;
2248 unsigned P1DC3 : 1;
2249 unsigned P1DC4 : 1;
2250 unsigned P1DC5 : 1;
2251 unsigned P1DC6 : 1;
2252 unsigned P1RSEN : 1;
2255 struct
2257 unsigned P1DC : 7;
2258 unsigned : 1;
2260 } __PWM1CONbits_t;
2262 extern __at(0x0294) volatile __PWM1CONbits_t PWM1CONbits;
2264 #define _P1DC0 0x01
2265 #define _P1DC1 0x02
2266 #define _P1DC2 0x04
2267 #define _P1DC3 0x08
2268 #define _P1DC4 0x10
2269 #define _P1DC5 0x20
2270 #define _P1DC6 0x40
2271 #define _P1RSEN 0x80
2273 //==============================================================================
2276 //==============================================================================
2277 // CCP1AS Bits
2279 extern __at(0x0295) __sfr CCP1AS;
2281 typedef union
2283 struct
2285 unsigned PSS1BD0 : 1;
2286 unsigned PSS1BD1 : 1;
2287 unsigned PSS1AC0 : 1;
2288 unsigned PSS1AC1 : 1;
2289 unsigned CCP1AS0 : 1;
2290 unsigned CCP1AS1 : 1;
2291 unsigned CCP1AS2 : 1;
2292 unsigned CCP1ASE : 1;
2295 struct
2297 unsigned PSS1BD : 2;
2298 unsigned : 6;
2301 struct
2303 unsigned : 2;
2304 unsigned PSS1AC : 2;
2305 unsigned : 4;
2308 struct
2310 unsigned : 4;
2311 unsigned CCP1AS : 3;
2312 unsigned : 1;
2314 } __CCP1ASbits_t;
2316 extern __at(0x0295) volatile __CCP1ASbits_t CCP1ASbits;
2318 #define _PSS1BD0 0x01
2319 #define _PSS1BD1 0x02
2320 #define _PSS1AC0 0x04
2321 #define _PSS1AC1 0x08
2322 #define _CCP1AS0 0x10
2323 #define _CCP1AS1 0x20
2324 #define _CCP1AS2 0x40
2325 #define _CCP1ASE 0x80
2327 //==============================================================================
2330 //==============================================================================
2331 // ECCP1AS Bits
2333 extern __at(0x0295) __sfr ECCP1AS;
2335 typedef union
2337 struct
2339 unsigned PSS1BD0 : 1;
2340 unsigned PSS1BD1 : 1;
2341 unsigned PSS1AC0 : 1;
2342 unsigned PSS1AC1 : 1;
2343 unsigned CCP1AS0 : 1;
2344 unsigned CCP1AS1 : 1;
2345 unsigned CCP1AS2 : 1;
2346 unsigned CCP1ASE : 1;
2349 struct
2351 unsigned PSS1BD : 2;
2352 unsigned : 6;
2355 struct
2357 unsigned : 2;
2358 unsigned PSS1AC : 2;
2359 unsigned : 4;
2362 struct
2364 unsigned : 4;
2365 unsigned CCP1AS : 3;
2366 unsigned : 1;
2368 } __ECCP1ASbits_t;
2370 extern __at(0x0295) volatile __ECCP1ASbits_t ECCP1ASbits;
2372 #define _ECCP1AS_PSS1BD0 0x01
2373 #define _ECCP1AS_PSS1BD1 0x02
2374 #define _ECCP1AS_PSS1AC0 0x04
2375 #define _ECCP1AS_PSS1AC1 0x08
2376 #define _ECCP1AS_CCP1AS0 0x10
2377 #define _ECCP1AS_CCP1AS1 0x20
2378 #define _ECCP1AS_CCP1AS2 0x40
2379 #define _ECCP1AS_CCP1ASE 0x80
2381 //==============================================================================
2384 //==============================================================================
2385 // PSTR1CON Bits
2387 extern __at(0x0296) __sfr PSTR1CON;
2389 typedef struct
2391 unsigned STR1A : 1;
2392 unsigned STR1B : 1;
2393 unsigned STR1C : 1;
2394 unsigned STR1D : 1;
2395 unsigned STR1SYNC : 1;
2396 unsigned : 1;
2397 unsigned : 1;
2398 unsigned : 1;
2399 } __PSTR1CONbits_t;
2401 extern __at(0x0296) volatile __PSTR1CONbits_t PSTR1CONbits;
2403 #define _STR1A 0x01
2404 #define _STR1B 0x02
2405 #define _STR1C 0x04
2406 #define _STR1D 0x08
2407 #define _STR1SYNC 0x10
2409 //==============================================================================
2412 //==============================================================================
2413 // IOCBP Bits
2415 extern __at(0x0394) __sfr IOCBP;
2417 typedef struct
2419 unsigned IOCBP0 : 1;
2420 unsigned IOCBP1 : 1;
2421 unsigned IOCBP2 : 1;
2422 unsigned IOCBP3 : 1;
2423 unsigned IOCBP4 : 1;
2424 unsigned IOCBP5 : 1;
2425 unsigned IOCBP6 : 1;
2426 unsigned IOCBP7 : 1;
2427 } __IOCBPbits_t;
2429 extern __at(0x0394) volatile __IOCBPbits_t IOCBPbits;
2431 #define _IOCBP0 0x01
2432 #define _IOCBP1 0x02
2433 #define _IOCBP2 0x04
2434 #define _IOCBP3 0x08
2435 #define _IOCBP4 0x10
2436 #define _IOCBP5 0x20
2437 #define _IOCBP6 0x40
2438 #define _IOCBP7 0x80
2440 //==============================================================================
2443 //==============================================================================
2444 // IOCBN Bits
2446 extern __at(0x0395) __sfr IOCBN;
2448 typedef struct
2450 unsigned IOCBN0 : 1;
2451 unsigned IOCBN1 : 1;
2452 unsigned IOCBN2 : 1;
2453 unsigned IOCBN3 : 1;
2454 unsigned IOCBN4 : 1;
2455 unsigned IOCBN5 : 1;
2456 unsigned IOCBN6 : 1;
2457 unsigned IOCBN7 : 1;
2458 } __IOCBNbits_t;
2460 extern __at(0x0395) volatile __IOCBNbits_t IOCBNbits;
2462 #define _IOCBN0 0x01
2463 #define _IOCBN1 0x02
2464 #define _IOCBN2 0x04
2465 #define _IOCBN3 0x08
2466 #define _IOCBN4 0x10
2467 #define _IOCBN5 0x20
2468 #define _IOCBN6 0x40
2469 #define _IOCBN7 0x80
2471 //==============================================================================
2474 //==============================================================================
2475 // IOCBF Bits
2477 extern __at(0x0396) __sfr IOCBF;
2479 typedef struct
2481 unsigned IOCBF0 : 1;
2482 unsigned IOCBF1 : 1;
2483 unsigned IOCBF2 : 1;
2484 unsigned IOCBF3 : 1;
2485 unsigned IOCBF4 : 1;
2486 unsigned IOCBF5 : 1;
2487 unsigned IOCBF6 : 1;
2488 unsigned IOCBF7 : 1;
2489 } __IOCBFbits_t;
2491 extern __at(0x0396) volatile __IOCBFbits_t IOCBFbits;
2493 #define _IOCBF0 0x01
2494 #define _IOCBF1 0x02
2495 #define _IOCBF2 0x04
2496 #define _IOCBF3 0x08
2497 #define _IOCBF4 0x10
2498 #define _IOCBF5 0x20
2499 #define _IOCBF6 0x40
2500 #define _IOCBF7 0x80
2502 //==============================================================================
2505 //==============================================================================
2506 // CLKRCON Bits
2508 extern __at(0x039A) __sfr CLKRCON;
2510 typedef union
2512 struct
2514 unsigned CLKRDIV0 : 1;
2515 unsigned CLKRDIV1 : 1;
2516 unsigned CLKRDIV2 : 1;
2517 unsigned CLKRDC0 : 1;
2518 unsigned CLKRDC1 : 1;
2519 unsigned CLKRSLR : 1;
2520 unsigned CLKROE : 1;
2521 unsigned CLKREN : 1;
2524 struct
2526 unsigned CLKRDIV : 3;
2527 unsigned : 5;
2530 struct
2532 unsigned : 3;
2533 unsigned CLKRDC : 2;
2534 unsigned : 3;
2536 } __CLKRCONbits_t;
2538 extern __at(0x039A) volatile __CLKRCONbits_t CLKRCONbits;
2540 #define _CLKRDIV0 0x01
2541 #define _CLKRDIV1 0x02
2542 #define _CLKRDIV2 0x04
2543 #define _CLKRDC0 0x08
2544 #define _CLKRDC1 0x10
2545 #define _CLKRSLR 0x20
2546 #define _CLKROE 0x40
2547 #define _CLKREN 0x80
2549 //==============================================================================
2552 //==============================================================================
2553 // MDCON Bits
2555 extern __at(0x039C) __sfr MDCON;
2557 typedef struct
2559 unsigned MDBIT : 1;
2560 unsigned : 1;
2561 unsigned : 1;
2562 unsigned MDOUT : 1;
2563 unsigned MDOPOL : 1;
2564 unsigned MDSLR : 1;
2565 unsigned MDOE : 1;
2566 unsigned MDEN : 1;
2567 } __MDCONbits_t;
2569 extern __at(0x039C) volatile __MDCONbits_t MDCONbits;
2571 #define _MDBIT 0x01
2572 #define _MDOUT 0x08
2573 #define _MDOPOL 0x10
2574 #define _MDSLR 0x20
2575 #define _MDOE 0x40
2576 #define _MDEN 0x80
2578 //==============================================================================
2581 //==============================================================================
2582 // MDSRC Bits
2584 extern __at(0x039D) __sfr MDSRC;
2586 typedef union
2588 struct
2590 unsigned MDMS0 : 1;
2591 unsigned MDMS1 : 1;
2592 unsigned MDMS2 : 1;
2593 unsigned MDMS3 : 1;
2594 unsigned : 1;
2595 unsigned : 1;
2596 unsigned : 1;
2597 unsigned MDMSODIS : 1;
2600 struct
2602 unsigned MDMS : 4;
2603 unsigned : 4;
2605 } __MDSRCbits_t;
2607 extern __at(0x039D) volatile __MDSRCbits_t MDSRCbits;
2609 #define _MDMS0 0x01
2610 #define _MDMS1 0x02
2611 #define _MDMS2 0x04
2612 #define _MDMS3 0x08
2613 #define _MDMSODIS 0x80
2615 //==============================================================================
2618 //==============================================================================
2619 // MDCARL Bits
2621 extern __at(0x039E) __sfr MDCARL;
2623 typedef union
2625 struct
2627 unsigned MDCL0 : 1;
2628 unsigned MDCL1 : 1;
2629 unsigned MDCL2 : 1;
2630 unsigned MDCL3 : 1;
2631 unsigned : 1;
2632 unsigned MDCLSYNC : 1;
2633 unsigned MDCLPOL : 1;
2634 unsigned MDCLODIS : 1;
2637 struct
2639 unsigned MDCL : 4;
2640 unsigned : 4;
2642 } __MDCARLbits_t;
2644 extern __at(0x039E) volatile __MDCARLbits_t MDCARLbits;
2646 #define _MDCL0 0x01
2647 #define _MDCL1 0x02
2648 #define _MDCL2 0x04
2649 #define _MDCL3 0x08
2650 #define _MDCLSYNC 0x20
2651 #define _MDCLPOL 0x40
2652 #define _MDCLODIS 0x80
2654 //==============================================================================
2657 //==============================================================================
2658 // MDCARH Bits
2660 extern __at(0x039F) __sfr MDCARH;
2662 typedef union
2664 struct
2666 unsigned MDCH0 : 1;
2667 unsigned MDCH1 : 1;
2668 unsigned MDCH2 : 1;
2669 unsigned MDCH3 : 1;
2670 unsigned : 1;
2671 unsigned MDCHSYNC : 1;
2672 unsigned MDCHPOL : 1;
2673 unsigned MDCHODIS : 1;
2676 struct
2678 unsigned MDCH : 4;
2679 unsigned : 4;
2681 } __MDCARHbits_t;
2683 extern __at(0x039F) volatile __MDCARHbits_t MDCARHbits;
2685 #define _MDCH0 0x01
2686 #define _MDCH1 0x02
2687 #define _MDCH2 0x04
2688 #define _MDCH3 0x08
2689 #define _MDCHSYNC 0x20
2690 #define _MDCHPOL 0x40
2691 #define _MDCHODIS 0x80
2693 //==============================================================================
2696 //==============================================================================
2697 // STATUS_SHAD Bits
2699 extern __at(0x0FE4) __sfr STATUS_SHAD;
2701 typedef struct
2703 unsigned C_SHAD : 1;
2704 unsigned DC_SHAD : 1;
2705 unsigned Z_SHAD : 1;
2706 unsigned : 1;
2707 unsigned : 1;
2708 unsigned : 1;
2709 unsigned : 1;
2710 unsigned : 1;
2711 } __STATUS_SHADbits_t;
2713 extern __at(0x0FE4) volatile __STATUS_SHADbits_t STATUS_SHADbits;
2715 #define _C_SHAD 0x01
2716 #define _DC_SHAD 0x02
2717 #define _Z_SHAD 0x04
2719 //==============================================================================
2721 extern __at(0x0FE5) __sfr WREG_SHAD;
2722 extern __at(0x0FE6) __sfr BSR_SHAD;
2723 extern __at(0x0FE7) __sfr PCLATH_SHAD;
2724 extern __at(0x0FE8) __sfr FSR0L_SHAD;
2725 extern __at(0x0FE9) __sfr FSR0H_SHAD;
2726 extern __at(0x0FEA) __sfr FSR1L_SHAD;
2727 extern __at(0x0FEB) __sfr FSR1H_SHAD;
2728 extern __at(0x0FED) __sfr STKPTR;
2729 extern __at(0x0FEE) __sfr TOSL;
2730 extern __at(0x0FEF) __sfr TOSH;
2732 //==============================================================================
2734 // Configuration Bits
2736 //==============================================================================
2738 #define _CONFIG1 0x8007
2739 #define _CONFIG2 0x8008
2741 //----------------------------- CONFIG1 Options -------------------------------
2743 #define _FOSC_LP 0x3FF8 // LP Oscillator, Low-power crystal connected between OSC1 and OSC2 pins.
2744 #define _FOSC_XT 0x3FF9 // XT Oscillator, Crystal/resonator connected between OSC1 and OSC2 pins.
2745 #define _FOSC_HS 0x3FFA // HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins.
2746 #define _FOSC_EXTRC 0x3FFB // EXTRC oscillator: External RC circuit connected to CLKIN pin.
2747 #define _FOSC_INTOSC 0x3FFC // INTOSC oscillator: I/O function on CLKIN pin.
2748 #define _FOSC_ECL 0x3FFD // ECL, External Clock, Low Power Mode (0-0.5 MHz): device clock supplied to CLKIN pin.
2749 #define _FOSC_ECM 0x3FFE // ECM, External Clock, Medium Power Mode (0.5-4 MHz): device clock supplied to CLKIN pin.
2750 #define _FOSC_ECH 0x3FFF // ECH, External Clock, High Power Mode (4-32 MHz): device clock supplied to CLKIN pin.
2751 #define _WDTE_OFF 0x3FE7 // WDT disabled.
2752 #define _WDTE_SWDTEN 0x3FEF // WDT controlled by the SWDTEN bit in the WDTCON register.
2753 #define _WDTE_NSLEEP 0x3FF7 // WDT enabled while running and disabled in Sleep.
2754 #define _WDTE_ON 0x3FFF // WDT enabled.
2755 #define _PWRTE_ON 0x3FDF // PWRT enabled.
2756 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
2757 #define _MCLRE_OFF 0x3FBF // MCLR/VPP pin function is digital input.
2758 #define _MCLRE_ON 0x3FFF // MCLR/VPP pin function is MCLR.
2759 #define _CP_ON 0x3F7F // Program memory code protection is enabled.
2760 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
2761 #define _CPD_ON 0x3EFF // Data memory code protection is enabled.
2762 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
2763 #define _BOREN_OFF 0x39FF // Brown-out Reset disabled.
2764 #define _BOREN_SBODEN 0x3BFF // Brown-out Reset controlled by the SBOREN bit in the BORCON register.
2765 #define _BOREN_NSLEEP 0x3DFF // Brown-out Reset enabled while running and disabled in Sleep.
2766 #define _BOREN_ON 0x3FFF // Brown-out Reset enabled.
2767 #define _CLKOUTEN_ON 0x37FF // CLKOUT function is enabled on the CLKOUT pin.
2768 #define _CLKOUTEN_OFF 0x3FFF // CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin.
2769 #define _IESO_OFF 0x2FFF // Internal/External Switchover mode is disabled.
2770 #define _IESO_ON 0x3FFF // Internal/External Switchover mode is enabled.
2771 #define _FCMEN_OFF 0x1FFF // Fail-Safe Clock Monitor is disabled.
2772 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
2774 //----------------------------- CONFIG2 Options -------------------------------
2776 #define _WRT_ALL 0x3FFC // 000h to 7FFh write protected, no addresses may be modified by EECON control.
2777 #define _WRT_HALF 0x3FFD // 000h to 3FFh write protected, 400h to 7FFh may be modified by EECON control.
2778 #define _WRT_BOOT 0x3FFE // 000h to 1FFh write protected, 200h to 7FFh may be modified by EECON control.
2779 #define _WRT_OFF 0x3FFF // Write protection off.
2780 #define _PLLEN_OFF 0x3EFF // 4x PLL disabled.
2781 #define _PLLEN_ON 0x3FFF // 4x PLL enabled.
2782 #define _STVREN_OFF 0x3DFF // Stack Overflow or Underflow will not cause a Reset.
2783 #define _STVREN_ON 0x3FFF // Stack Overflow or Underflow will cause a Reset.
2784 #define _BORV_HI 0x3BFF // Brown-out Reset Voltage (Vbor), high trip point selected.
2785 #define _BORV_LO 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
2786 #define _BORV_19 0x3FFF // Brown-out Reset Voltage (Vbor), low trip point selected.
2787 #define _DEBUG_ON 0x2FFF // In-Circuit Debugger enabled, ICSPCLK and ICSPDAT are dedicated to the debugger.
2788 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, ICSPCLK and ICSPDAT are general purpose I/O pins.
2789 #define _LVP_OFF 0x1FFF // High-voltage on MCLR/VPP must be used for programming.
2790 #define _LVP_ON 0x3FFF // Low-voltage programming enabled.
2792 //==============================================================================
2794 #define _DEVID1 0x8006
2796 #define _IDLOC0 0x8000
2797 #define _IDLOC1 0x8001
2798 #define _IDLOC2 0x8002
2799 #define _IDLOC3 0x8003
2801 //==============================================================================
2803 #ifndef NO_BIT_DEFINES
2805 #define ADON ADCON0bits.ADON // bit 0
2806 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
2807 #define ADGO ADCON0bits.ADGO // bit 1, shadows bit in ADCON0bits
2808 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
2809 #define CHS0 ADCON0bits.CHS0 // bit 2
2810 #define CHS1 ADCON0bits.CHS1 // bit 3
2811 #define CHS2 ADCON0bits.CHS2 // bit 4
2812 #define CHS3 ADCON0bits.CHS3 // bit 5
2813 #define CHS4 ADCON0bits.CHS4 // bit 6
2815 #define ADPREF0 ADCON1bits.ADPREF0 // bit 0
2816 #define ADPREF1 ADCON1bits.ADPREF1 // bit 1
2817 #define ADNREF ADCON1bits.ADNREF // bit 2
2818 #define ADCS0 ADCON1bits.ADCS0 // bit 4
2819 #define ADCS1 ADCON1bits.ADCS1 // bit 5
2820 #define ADCS2 ADCON1bits.ADCS2 // bit 6
2821 #define ADFM ADCON1bits.ADFM // bit 7
2823 #define ANSA0 ANSELAbits.ANSA0 // bit 0
2824 #define ANSA1 ANSELAbits.ANSA1 // bit 1
2825 #define ANSA2 ANSELAbits.ANSA2 // bit 2
2826 #define ANSA3 ANSELAbits.ANSA3 // bit 3
2827 #define ANSA4 ANSELAbits.ANSA4 // bit 4
2829 #define ANSB1 ANSELBbits.ANSB1 // bit 1
2830 #define ANSB2 ANSELBbits.ANSB2 // bit 2
2831 #define ANSB3 ANSELBbits.ANSB3 // bit 3
2832 #define ANSB4 ANSELBbits.ANSB4 // bit 4
2833 #define ANSB5 ANSELBbits.ANSB5 // bit 5
2834 #define ANSB6 ANSELBbits.ANSB6 // bit 6
2835 #define ANSB7 ANSELBbits.ANSB7 // bit 7
2837 #define CCP1SEL APFCON0bits.CCP1SEL // bit 0
2838 #define P1CSEL APFCON0bits.P1CSEL // bit 1
2839 #define P1DSEL APFCON0bits.P1DSEL // bit 2
2840 #define SS1SEL APFCON0bits.SS1SEL // bit 5
2841 #define SDO1SEL APFCON0bits.SDO1SEL // bit 6
2842 #define RXDTSEL APFCON0bits.RXDTSEL // bit 7
2844 #define TXCKSEL APFCON1bits.TXCKSEL // bit 0
2846 #define ABDEN BAUDCONbits.ABDEN // bit 0
2847 #define WUE BAUDCONbits.WUE // bit 1
2848 #define BRG16 BAUDCONbits.BRG16 // bit 3
2849 #define SCKP BAUDCONbits.SCKP // bit 4
2850 #define RCIDL BAUDCONbits.RCIDL // bit 6
2851 #define ABDOVF BAUDCONbits.ABDOVF // bit 7
2853 #define BORRDY BORCONbits.BORRDY // bit 0
2854 #define SBOREN BORCONbits.SBOREN // bit 7
2856 #define BSR0 BSRbits.BSR0 // bit 0
2857 #define BSR1 BSRbits.BSR1 // bit 1
2858 #define BSR2 BSRbits.BSR2 // bit 2
2859 #define BSR3 BSRbits.BSR3 // bit 3
2860 #define BSR4 BSRbits.BSR4 // bit 4
2862 #define PSS1BD0 CCP1ASbits.PSS1BD0 // bit 0
2863 #define PSS1BD1 CCP1ASbits.PSS1BD1 // bit 1
2864 #define PSS1AC0 CCP1ASbits.PSS1AC0 // bit 2
2865 #define PSS1AC1 CCP1ASbits.PSS1AC1 // bit 3
2866 #define CCP1AS0 CCP1ASbits.CCP1AS0 // bit 4
2867 #define CCP1AS1 CCP1ASbits.CCP1AS1 // bit 5
2868 #define CCP1AS2 CCP1ASbits.CCP1AS2 // bit 6
2869 #define CCP1ASE CCP1ASbits.CCP1ASE // bit 7
2871 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
2872 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
2873 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
2874 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
2875 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
2876 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
2877 #define P1M0 CCP1CONbits.P1M0 // bit 6
2878 #define P1M1 CCP1CONbits.P1M1 // bit 7
2880 #define CLKRDIV0 CLKRCONbits.CLKRDIV0 // bit 0
2881 #define CLKRDIV1 CLKRCONbits.CLKRDIV1 // bit 1
2882 #define CLKRDIV2 CLKRCONbits.CLKRDIV2 // bit 2
2883 #define CLKRDC0 CLKRCONbits.CLKRDC0 // bit 3
2884 #define CLKRDC1 CLKRCONbits.CLKRDC1 // bit 4
2885 #define CLKRSLR CLKRCONbits.CLKRSLR // bit 5
2886 #define CLKROE CLKRCONbits.CLKROE // bit 6
2887 #define CLKREN CLKRCONbits.CLKREN // bit 7
2889 #define C1SYNC CM1CON0bits.C1SYNC // bit 0
2890 #define C1HYS CM1CON0bits.C1HYS // bit 1
2891 #define C1SP CM1CON0bits.C1SP // bit 2
2892 #define C1POL CM1CON0bits.C1POL // bit 4
2893 #define C1OE CM1CON0bits.C1OE // bit 5
2894 #define C1OUT CM1CON0bits.C1OUT // bit 6
2895 #define C1ON CM1CON0bits.C1ON // bit 7
2897 #define C1NCH0 CM1CON1bits.C1NCH0 // bit 0
2898 #define C1NCH1 CM1CON1bits.C1NCH1 // bit 1
2899 #define C1PCH0 CM1CON1bits.C1PCH0 // bit 4
2900 #define C1PCH1 CM1CON1bits.C1PCH1 // bit 5
2901 #define C1INTN CM1CON1bits.C1INTN // bit 6
2902 #define C1INTP CM1CON1bits.C1INTP // bit 7
2904 #define C2SYNC CM2CON0bits.C2SYNC // bit 0
2905 #define C2HYS CM2CON0bits.C2HYS // bit 1
2906 #define C2SP CM2CON0bits.C2SP // bit 2
2907 #define C2POL CM2CON0bits.C2POL // bit 4
2908 #define C2OE CM2CON0bits.C2OE // bit 5
2909 #define C2OUT CM2CON0bits.C2OUT // bit 6
2910 #define C2ON CM2CON0bits.C2ON // bit 7
2912 #define C2NCH0 CM2CON1bits.C2NCH0 // bit 0
2913 #define C2NCH1 CM2CON1bits.C2NCH1 // bit 1
2914 #define C2PCH0 CM2CON1bits.C2PCH0 // bit 4
2915 #define C2PCH1 CM2CON1bits.C2PCH1 // bit 5
2916 #define C2INTN CM2CON1bits.C2INTN // bit 6
2917 #define C2INTP CM2CON1bits.C2INTP // bit 7
2919 #define MC1OUT CMOUTbits.MC1OUT // bit 0
2920 #define MC2OUT CMOUTbits.MC2OUT // bit 1
2922 #define T0XCS CPSCON0bits.T0XCS // bit 0
2923 #define CPSOUT CPSCON0bits.CPSOUT // bit 1
2924 #define CPSRNG0 CPSCON0bits.CPSRNG0 // bit 2
2925 #define CPSRNG1 CPSCON0bits.CPSRNG1 // bit 3
2926 #define CPSON CPSCON0bits.CPSON // bit 7
2928 #define CPSCH0 CPSCON1bits.CPSCH0 // bit 0
2929 #define CPSCH1 CPSCON1bits.CPSCH1 // bit 1
2930 #define CPSCH2 CPSCON1bits.CPSCH2 // bit 2
2931 #define CPSCH3 CPSCON1bits.CPSCH3 // bit 3
2933 #define DACNSS DACCON0bits.DACNSS // bit 0
2934 #define DACPSS0 DACCON0bits.DACPSS0 // bit 2
2935 #define DACPSS1 DACCON0bits.DACPSS1 // bit 3
2936 #define DACOE DACCON0bits.DACOE // bit 5
2937 #define DACLPS DACCON0bits.DACLPS // bit 6
2938 #define DACEN DACCON0bits.DACEN // bit 7
2940 #define DACR0 DACCON1bits.DACR0 // bit 0
2941 #define DACR1 DACCON1bits.DACR1 // bit 1
2942 #define DACR2 DACCON1bits.DACR2 // bit 2
2943 #define DACR3 DACCON1bits.DACR3 // bit 3
2944 #define DACR4 DACCON1bits.DACR4 // bit 4
2946 #define RD EECON1bits.RD // bit 0
2947 #define WR EECON1bits.WR // bit 1
2948 #define WREN EECON1bits.WREN // bit 2
2949 #define WRERR EECON1bits.WRERR // bit 3
2950 #define FREE EECON1bits.FREE // bit 4
2951 #define LWLO EECON1bits.LWLO // bit 5
2952 #define CFGS EECON1bits.CFGS // bit 6
2953 #define EEPGD EECON1bits.EEPGD // bit 7
2955 #define ADFVR0 FVRCONbits.ADFVR0 // bit 0
2956 #define ADFVR1 FVRCONbits.ADFVR1 // bit 1
2957 #define CDAFVR0 FVRCONbits.CDAFVR0 // bit 2
2958 #define CDAFVR1 FVRCONbits.CDAFVR1 // bit 3
2959 #define TSRNG FVRCONbits.TSRNG // bit 4
2960 #define TSEN FVRCONbits.TSEN // bit 5
2961 #define FVRRDY FVRCONbits.FVRRDY // bit 6
2962 #define FVREN FVRCONbits.FVREN // bit 7
2964 #define IOCIF INTCONbits.IOCIF // bit 0
2965 #define INTF INTCONbits.INTF // bit 1
2966 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
2967 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
2968 #define IOCIE INTCONbits.IOCIE // bit 3
2969 #define INTE INTCONbits.INTE // bit 4
2970 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
2971 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
2972 #define PEIE INTCONbits.PEIE // bit 6
2973 #define GIE INTCONbits.GIE // bit 7
2975 #define IOCBF0 IOCBFbits.IOCBF0 // bit 0
2976 #define IOCBF1 IOCBFbits.IOCBF1 // bit 1
2977 #define IOCBF2 IOCBFbits.IOCBF2 // bit 2
2978 #define IOCBF3 IOCBFbits.IOCBF3 // bit 3
2979 #define IOCBF4 IOCBFbits.IOCBF4 // bit 4
2980 #define IOCBF5 IOCBFbits.IOCBF5 // bit 5
2981 #define IOCBF6 IOCBFbits.IOCBF6 // bit 6
2982 #define IOCBF7 IOCBFbits.IOCBF7 // bit 7
2984 #define IOCBN0 IOCBNbits.IOCBN0 // bit 0
2985 #define IOCBN1 IOCBNbits.IOCBN1 // bit 1
2986 #define IOCBN2 IOCBNbits.IOCBN2 // bit 2
2987 #define IOCBN3 IOCBNbits.IOCBN3 // bit 3
2988 #define IOCBN4 IOCBNbits.IOCBN4 // bit 4
2989 #define IOCBN5 IOCBNbits.IOCBN5 // bit 5
2990 #define IOCBN6 IOCBNbits.IOCBN6 // bit 6
2991 #define IOCBN7 IOCBNbits.IOCBN7 // bit 7
2993 #define IOCBP0 IOCBPbits.IOCBP0 // bit 0
2994 #define IOCBP1 IOCBPbits.IOCBP1 // bit 1
2995 #define IOCBP2 IOCBPbits.IOCBP2 // bit 2
2996 #define IOCBP3 IOCBPbits.IOCBP3 // bit 3
2997 #define IOCBP4 IOCBPbits.IOCBP4 // bit 4
2998 #define IOCBP5 IOCBPbits.IOCBP5 // bit 5
2999 #define IOCBP6 IOCBPbits.IOCBP6 // bit 6
3000 #define IOCBP7 IOCBPbits.IOCBP7 // bit 7
3002 #define LATA0 LATAbits.LATA0 // bit 0
3003 #define LATA1 LATAbits.LATA1 // bit 1
3004 #define LATA2 LATAbits.LATA2 // bit 2
3005 #define LATA3 LATAbits.LATA3 // bit 3
3006 #define LATA4 LATAbits.LATA4 // bit 4
3007 #define LATA6 LATAbits.LATA6 // bit 6
3008 #define LATA7 LATAbits.LATA7 // bit 7
3010 #define LATB0 LATBbits.LATB0 // bit 0
3011 #define LATB1 LATBbits.LATB1 // bit 1
3012 #define LATB2 LATBbits.LATB2 // bit 2
3013 #define LATB3 LATBbits.LATB3 // bit 3
3014 #define LATB4 LATBbits.LATB4 // bit 4
3015 #define LATB5 LATBbits.LATB5 // bit 5
3016 #define LATB6 LATBbits.LATB6 // bit 6
3017 #define LATB7 LATBbits.LATB7 // bit 7
3019 #define MDCH0 MDCARHbits.MDCH0 // bit 0
3020 #define MDCH1 MDCARHbits.MDCH1 // bit 1
3021 #define MDCH2 MDCARHbits.MDCH2 // bit 2
3022 #define MDCH3 MDCARHbits.MDCH3 // bit 3
3023 #define MDCHSYNC MDCARHbits.MDCHSYNC // bit 5
3024 #define MDCHPOL MDCARHbits.MDCHPOL // bit 6
3025 #define MDCHODIS MDCARHbits.MDCHODIS // bit 7
3027 #define MDCL0 MDCARLbits.MDCL0 // bit 0
3028 #define MDCL1 MDCARLbits.MDCL1 // bit 1
3029 #define MDCL2 MDCARLbits.MDCL2 // bit 2
3030 #define MDCL3 MDCARLbits.MDCL3 // bit 3
3031 #define MDCLSYNC MDCARLbits.MDCLSYNC // bit 5
3032 #define MDCLPOL MDCARLbits.MDCLPOL // bit 6
3033 #define MDCLODIS MDCARLbits.MDCLODIS // bit 7
3035 #define MDBIT MDCONbits.MDBIT // bit 0
3036 #define MDOUT MDCONbits.MDOUT // bit 3
3037 #define MDOPOL MDCONbits.MDOPOL // bit 4
3038 #define MDSLR MDCONbits.MDSLR // bit 5
3039 #define MDOE MDCONbits.MDOE // bit 6
3040 #define MDEN MDCONbits.MDEN // bit 7
3042 #define MDMS0 MDSRCbits.MDMS0 // bit 0
3043 #define MDMS1 MDSRCbits.MDMS1 // bit 1
3044 #define MDMS2 MDSRCbits.MDMS2 // bit 2
3045 #define MDMS3 MDSRCbits.MDMS3 // bit 3
3046 #define MDMSODIS MDSRCbits.MDMSODIS // bit 7
3048 #define PS0 OPTION_REGbits.PS0 // bit 0
3049 #define PS1 OPTION_REGbits.PS1 // bit 1
3050 #define PS2 OPTION_REGbits.PS2 // bit 2
3051 #define PSA OPTION_REGbits.PSA // bit 3
3052 #define TMR0SE OPTION_REGbits.TMR0SE // bit 4, shadows bit in OPTION_REGbits
3053 #define T0SE OPTION_REGbits.T0SE // bit 4, shadows bit in OPTION_REGbits
3054 #define TMR0CS OPTION_REGbits.TMR0CS // bit 5, shadows bit in OPTION_REGbits
3055 #define T0CS OPTION_REGbits.T0CS // bit 5, shadows bit in OPTION_REGbits
3056 #define INTEDG OPTION_REGbits.INTEDG // bit 6
3057 #define NOT_WPUEN OPTION_REGbits.NOT_WPUEN // bit 7
3059 #define SCS0 OSCCONbits.SCS0 // bit 0
3060 #define SCS1 OSCCONbits.SCS1 // bit 1
3061 #define IRCF0 OSCCONbits.IRCF0 // bit 3
3062 #define IRCF1 OSCCONbits.IRCF1 // bit 4
3063 #define IRCF2 OSCCONbits.IRCF2 // bit 5
3064 #define IRCF3 OSCCONbits.IRCF3 // bit 6
3065 #define SPLLEN OSCCONbits.SPLLEN // bit 7
3067 #define HFIOFS OSCSTATbits.HFIOFS // bit 0
3068 #define LFIOFR OSCSTATbits.LFIOFR // bit 1
3069 #define MFIOFR OSCSTATbits.MFIOFR // bit 2
3070 #define HFIOFL OSCSTATbits.HFIOFL // bit 3
3071 #define HFIOFR OSCSTATbits.HFIOFR // bit 4
3072 #define OSTS OSCSTATbits.OSTS // bit 5
3073 #define PLLR OSCSTATbits.PLLR // bit 6
3074 #define T1OSCR OSCSTATbits.T1OSCR // bit 7
3076 #define TUN0 OSCTUNEbits.TUN0 // bit 0
3077 #define TUN1 OSCTUNEbits.TUN1 // bit 1
3078 #define TUN2 OSCTUNEbits.TUN2 // bit 2
3079 #define TUN3 OSCTUNEbits.TUN3 // bit 3
3080 #define TUN4 OSCTUNEbits.TUN4 // bit 4
3081 #define TUN5 OSCTUNEbits.TUN5 // bit 5
3083 #define NOT_BOR PCONbits.NOT_BOR // bit 0
3084 #define NOT_POR PCONbits.NOT_POR // bit 1
3085 #define NOT_RI PCONbits.NOT_RI // bit 2
3086 #define NOT_RMCLR PCONbits.NOT_RMCLR // bit 3
3087 #define STKUNF PCONbits.STKUNF // bit 6
3088 #define STKOVF PCONbits.STKOVF // bit 7
3090 #define TMR1IE PIE1bits.TMR1IE // bit 0
3091 #define TMR2IE PIE1bits.TMR2IE // bit 1
3092 #define CCP1IE PIE1bits.CCP1IE // bit 2
3093 #define SSP1IE PIE1bits.SSP1IE // bit 3
3094 #define TXIE PIE1bits.TXIE // bit 4
3095 #define RCIE PIE1bits.RCIE // bit 5
3096 #define ADIE PIE1bits.ADIE // bit 6
3097 #define TMR1GIE PIE1bits.TMR1GIE // bit 7
3099 #define BCL1IE PIE2bits.BCL1IE // bit 3
3100 #define EEIE PIE2bits.EEIE // bit 4
3101 #define C1IE PIE2bits.C1IE // bit 5
3102 #define C2IE PIE2bits.C2IE // bit 6
3103 #define OSFIE PIE2bits.OSFIE // bit 7
3105 #define TMR1IF PIR1bits.TMR1IF // bit 0
3106 #define TMR2IF PIR1bits.TMR2IF // bit 1
3107 #define CCP1IF PIR1bits.CCP1IF // bit 2
3108 #define SSP1IF PIR1bits.SSP1IF // bit 3
3109 #define TXIF PIR1bits.TXIF // bit 4
3110 #define RCIF PIR1bits.RCIF // bit 5
3111 #define ADIF PIR1bits.ADIF // bit 6
3112 #define TMR1GIF PIR1bits.TMR1GIF // bit 7
3114 #define BCL1IF PIR2bits.BCL1IF // bit 3
3115 #define EEIF PIR2bits.EEIF // bit 4
3116 #define C1IF PIR2bits.C1IF // bit 5
3117 #define C2IF PIR2bits.C2IF // bit 6
3118 #define OSFIF PIR2bits.OSFIF // bit 7
3120 #define RA0 PORTAbits.RA0 // bit 0
3121 #define RA1 PORTAbits.RA1 // bit 1
3122 #define RA2 PORTAbits.RA2 // bit 2
3123 #define RA3 PORTAbits.RA3 // bit 3
3124 #define RA4 PORTAbits.RA4 // bit 4
3125 #define RA5 PORTAbits.RA5 // bit 5
3126 #define RA6 PORTAbits.RA6 // bit 6
3127 #define RA7 PORTAbits.RA7 // bit 7
3129 #define RB0 PORTBbits.RB0 // bit 0
3130 #define RB1 PORTBbits.RB1 // bit 1
3131 #define RB2 PORTBbits.RB2 // bit 2
3132 #define RB3 PORTBbits.RB3 // bit 3
3133 #define RB4 PORTBbits.RB4 // bit 4
3134 #define RB5 PORTBbits.RB5 // bit 5
3135 #define RB6 PORTBbits.RB6 // bit 6
3136 #define RB7 PORTBbits.RB7 // bit 7
3138 #define STR1A PSTR1CONbits.STR1A // bit 0
3139 #define STR1B PSTR1CONbits.STR1B // bit 1
3140 #define STR1C PSTR1CONbits.STR1C // bit 2
3141 #define STR1D PSTR1CONbits.STR1D // bit 3
3142 #define STR1SYNC PSTR1CONbits.STR1SYNC // bit 4
3144 #define P1DC0 PWM1CONbits.P1DC0 // bit 0
3145 #define P1DC1 PWM1CONbits.P1DC1 // bit 1
3146 #define P1DC2 PWM1CONbits.P1DC2 // bit 2
3147 #define P1DC3 PWM1CONbits.P1DC3 // bit 3
3148 #define P1DC4 PWM1CONbits.P1DC4 // bit 4
3149 #define P1DC5 PWM1CONbits.P1DC5 // bit 5
3150 #define P1DC6 PWM1CONbits.P1DC6 // bit 6
3151 #define P1RSEN PWM1CONbits.P1RSEN // bit 7
3153 #define RX9D RCSTAbits.RX9D // bit 0
3154 #define OERR RCSTAbits.OERR // bit 1
3155 #define FERR RCSTAbits.FERR // bit 2
3156 #define ADDEN RCSTAbits.ADDEN // bit 3
3157 #define CREN RCSTAbits.CREN // bit 4
3158 #define SREN RCSTAbits.SREN // bit 5
3159 #define RX9 RCSTAbits.RX9 // bit 6
3160 #define SPEN RCSTAbits.SPEN // bit 7
3162 #define SRPR SRCON0bits.SRPR // bit 0
3163 #define SRPS SRCON0bits.SRPS // bit 1
3164 #define SRNQEN SRCON0bits.SRNQEN // bit 2
3165 #define SRQEN SRCON0bits.SRQEN // bit 3
3166 #define SRCLK0 SRCON0bits.SRCLK0 // bit 4
3167 #define SRCLK1 SRCON0bits.SRCLK1 // bit 5
3168 #define SRCLK2 SRCON0bits.SRCLK2 // bit 6
3169 #define SRLEN SRCON0bits.SRLEN // bit 7
3171 #define SRRC1E SRCON1bits.SRRC1E // bit 0
3172 #define SRRC2E SRCON1bits.SRRC2E // bit 1
3173 #define SRRCKE SRCON1bits.SRRCKE // bit 2
3174 #define SRRPE SRCON1bits.SRRPE // bit 3
3175 #define SRSC1E SRCON1bits.SRSC1E // bit 4
3176 #define SRSC2E SRCON1bits.SRSC2E // bit 5
3177 #define SRSCKE SRCON1bits.SRSCKE // bit 6
3178 #define SRSPE SRCON1bits.SRSPE // bit 7
3180 #define SSPM0 SSP1CON1bits.SSPM0 // bit 0
3181 #define SSPM1 SSP1CON1bits.SSPM1 // bit 1
3182 #define SSPM2 SSP1CON1bits.SSPM2 // bit 2
3183 #define SSPM3 SSP1CON1bits.SSPM3 // bit 3
3184 #define CKP SSP1CON1bits.CKP // bit 4
3185 #define SSPEN SSP1CON1bits.SSPEN // bit 5
3186 #define SSPOV SSP1CON1bits.SSPOV // bit 6
3187 #define WCOL SSP1CON1bits.WCOL // bit 7
3189 #define SEN SSP1CON2bits.SEN // bit 0
3190 #define RSEN SSP1CON2bits.RSEN // bit 1
3191 #define PEN SSP1CON2bits.PEN // bit 2
3192 #define RCEN SSP1CON2bits.RCEN // bit 3
3193 #define ACKEN SSP1CON2bits.ACKEN // bit 4
3194 #define ACKDT SSP1CON2bits.ACKDT // bit 5
3195 #define ACKSTAT SSP1CON2bits.ACKSTAT // bit 6
3196 #define GCEN SSP1CON2bits.GCEN // bit 7
3198 #define DHEN SSP1CON3bits.DHEN // bit 0
3199 #define AHEN SSP1CON3bits.AHEN // bit 1
3200 #define SBCDE SSP1CON3bits.SBCDE // bit 2
3201 #define SDAHT SSP1CON3bits.SDAHT // bit 3
3202 #define BOEN SSP1CON3bits.BOEN // bit 4
3203 #define SCIE SSP1CON3bits.SCIE // bit 5
3204 #define PCIE SSP1CON3bits.PCIE // bit 6
3205 #define ACKTIM SSP1CON3bits.ACKTIM // bit 7
3207 #define BF SSP1STATbits.BF // bit 0
3208 #define UA SSP1STATbits.UA // bit 1
3209 #define R_NOT_W SSP1STATbits.R_NOT_W // bit 2
3210 #define S SSP1STATbits.S // bit 3
3211 #define P SSP1STATbits.P // bit 4
3212 #define D_NOT_A SSP1STATbits.D_NOT_A // bit 5
3213 #define CKE SSP1STATbits.CKE // bit 6
3214 #define SMP SSP1STATbits.SMP // bit 7
3216 #define C STATUSbits.C // bit 0
3217 #define DC STATUSbits.DC // bit 1
3218 #define Z STATUSbits.Z // bit 2
3219 #define NOT_PD STATUSbits.NOT_PD // bit 3
3220 #define NOT_TO STATUSbits.NOT_TO // bit 4
3222 #define C_SHAD STATUS_SHADbits.C_SHAD // bit 0
3223 #define DC_SHAD STATUS_SHADbits.DC_SHAD // bit 1
3224 #define Z_SHAD STATUS_SHADbits.Z_SHAD // bit 2
3226 #define TMR1ON T1CONbits.TMR1ON // bit 0
3227 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
3228 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
3229 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
3230 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
3231 #define TMR1CS0 T1CONbits.TMR1CS0 // bit 6
3232 #define TMR1CS1 T1CONbits.TMR1CS1 // bit 7
3234 #define T1GSS0 T1GCONbits.T1GSS0 // bit 0
3235 #define T1GSS1 T1GCONbits.T1GSS1 // bit 1
3236 #define T1GVAL T1GCONbits.T1GVAL // bit 2
3237 #define T1GGO T1GCONbits.T1GGO // bit 3
3238 #define T1GSPM T1GCONbits.T1GSPM // bit 4
3239 #define T1GTM T1GCONbits.T1GTM // bit 5
3240 #define T1GPOL T1GCONbits.T1GPOL // bit 6
3241 #define TMR1GE T1GCONbits.TMR1GE // bit 7
3243 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
3244 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
3245 #define TMR2ON T2CONbits.TMR2ON // bit 2
3246 #define T2OUTPS0 T2CONbits.T2OUTPS0 // bit 3
3247 #define T2OUTPS1 T2CONbits.T2OUTPS1 // bit 4
3248 #define T2OUTPS2 T2CONbits.T2OUTPS2 // bit 5
3249 #define T2OUTPS3 T2CONbits.T2OUTPS3 // bit 6
3251 #define TRISA0 TRISAbits.TRISA0 // bit 0
3252 #define TRISA1 TRISAbits.TRISA1 // bit 1
3253 #define TRISA2 TRISAbits.TRISA2 // bit 2
3254 #define TRISA3 TRISAbits.TRISA3 // bit 3
3255 #define TRISA4 TRISAbits.TRISA4 // bit 4
3256 #define TRISA5 TRISAbits.TRISA5 // bit 5
3257 #define TRISA6 TRISAbits.TRISA6 // bit 6
3258 #define TRISA7 TRISAbits.TRISA7 // bit 7
3260 #define TRISB0 TRISBbits.TRISB0 // bit 0
3261 #define TRISB1 TRISBbits.TRISB1 // bit 1
3262 #define TRISB2 TRISBbits.TRISB2 // bit 2
3263 #define TRISB3 TRISBbits.TRISB3 // bit 3
3264 #define TRISB4 TRISBbits.TRISB4 // bit 4
3265 #define TRISB5 TRISBbits.TRISB5 // bit 5
3266 #define TRISB6 TRISBbits.TRISB6 // bit 6
3267 #define TRISB7 TRISBbits.TRISB7 // bit 7
3269 #define TX9D TXSTAbits.TX9D // bit 0
3270 #define TRMT TXSTAbits.TRMT // bit 1
3271 #define BRGH TXSTAbits.BRGH // bit 2
3272 #define SENDB TXSTAbits.SENDB // bit 3
3273 #define SYNC TXSTAbits.SYNC // bit 4
3274 #define TXEN TXSTAbits.TXEN // bit 5
3275 #define TX9 TXSTAbits.TX9 // bit 6
3276 #define CSRC TXSTAbits.CSRC // bit 7
3278 #define SWDTEN WDTCONbits.SWDTEN // bit 0
3279 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
3280 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
3281 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
3282 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
3283 #define WDTPS4 WDTCONbits.WDTPS4 // bit 5
3285 #define WPUA5 WPUAbits.WPUA5 // bit 5
3287 #define WPUB0 WPUBbits.WPUB0 // bit 0
3288 #define WPUB1 WPUBbits.WPUB1 // bit 1
3289 #define WPUB2 WPUBbits.WPUB2 // bit 2
3290 #define WPUB3 WPUBbits.WPUB3 // bit 3
3291 #define WPUB4 WPUBbits.WPUB4 // bit 4
3292 #define WPUB5 WPUBbits.WPUB5 // bit 5
3293 #define WPUB6 WPUBbits.WPUB6 // bit 6
3294 #define WPUB7 WPUBbits.WPUB7 // bit 7
3296 #endif // #ifndef NO_BIT_DEFINES
3298 #endif // #ifndef __PIC16F1826_H__