struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f882.h
blob891869269b15ccf1b36324ea3e5ed1ef05fd0f53
1 /*
2 * This declarations of the PIC16F882 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:01 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 __PIC16F882_H__
26 #define __PIC16F882_H__
28 //==============================================================================
30 // Register Addresses
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF_ADDR 0x0000
37 #define TMR0_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR_ADDR 0x0004
41 #define PORTA_ADDR 0x0005
42 #define PORTB_ADDR 0x0006
43 #define PORTC_ADDR 0x0007
44 #define PORTE_ADDR 0x0009
45 #define PCLATH_ADDR 0x000A
46 #define INTCON_ADDR 0x000B
47 #define PIR1_ADDR 0x000C
48 #define PIR2_ADDR 0x000D
49 #define TMR1_ADDR 0x000E
50 #define TMR1L_ADDR 0x000E
51 #define TMR1H_ADDR 0x000F
52 #define T1CON_ADDR 0x0010
53 #define TMR2_ADDR 0x0011
54 #define T2CON_ADDR 0x0012
55 #define SSPBUF_ADDR 0x0013
56 #define SSPCON_ADDR 0x0014
57 #define CCPR1_ADDR 0x0015
58 #define CCPR1L_ADDR 0x0015
59 #define CCPR1H_ADDR 0x0016
60 #define CCP1CON_ADDR 0x0017
61 #define RCSTA_ADDR 0x0018
62 #define TXREG_ADDR 0x0019
63 #define RCREG_ADDR 0x001A
64 #define CCPR2_ADDR 0x001B
65 #define CCPR2L_ADDR 0x001B
66 #define CCPR2H_ADDR 0x001C
67 #define CCP2CON_ADDR 0x001D
68 #define ADRESH_ADDR 0x001E
69 #define ADCON0_ADDR 0x001F
70 #define OPTION_REG_ADDR 0x0081
71 #define TRISA_ADDR 0x0085
72 #define TRISB_ADDR 0x0086
73 #define TRISC_ADDR 0x0087
74 #define TRISE_ADDR 0x0089
75 #define PIE1_ADDR 0x008C
76 #define PIE2_ADDR 0x008D
77 #define PCON_ADDR 0x008E
78 #define OSCCON_ADDR 0x008F
79 #define OSCTUNE_ADDR 0x0090
80 #define SSPCON2_ADDR 0x0091
81 #define PR2_ADDR 0x0092
82 #define MSK_ADDR 0x0093
83 #define SSPADD_ADDR 0x0093
84 #define SSPMSK_ADDR 0x0093
85 #define SSPSTAT_ADDR 0x0094
86 #define WPUB_ADDR 0x0095
87 #define IOCB_ADDR 0x0096
88 #define VRCON_ADDR 0x0097
89 #define TXSTA_ADDR 0x0098
90 #define SPBRG_ADDR 0x0099
91 #define SPBRGH_ADDR 0x009A
92 #define PWM1CON_ADDR 0x009B
93 #define ECCPAS_ADDR 0x009C
94 #define PSTRCON_ADDR 0x009D
95 #define ADRESL_ADDR 0x009E
96 #define ADCON1_ADDR 0x009F
97 #define WDTCON_ADDR 0x0105
98 #define CM1CON0_ADDR 0x0107
99 #define CM2CON0_ADDR 0x0108
100 #define CM2CON1_ADDR 0x0109
101 #define EEDAT_ADDR 0x010C
102 #define EEDATA_ADDR 0x010C
103 #define EEADR_ADDR 0x010D
104 #define EEDATH_ADDR 0x010E
105 #define EEADRH_ADDR 0x010F
106 #define SRCON_ADDR 0x0185
107 #define BAUDCTL_ADDR 0x0187
108 #define ANSEL_ADDR 0x0188
109 #define ANSELH_ADDR 0x0189
110 #define EECON1_ADDR 0x018C
111 #define EECON2_ADDR 0x018D
113 #endif // #ifndef NO_ADDR_DEFINES
115 //==============================================================================
117 // Register Definitions
119 //==============================================================================
121 extern __at(0x0000) __sfr INDF;
122 extern __at(0x0001) __sfr TMR0;
123 extern __at(0x0002) __sfr PCL;
125 //==============================================================================
126 // STATUS Bits
128 extern __at(0x0003) __sfr STATUS;
130 typedef union
132 struct
134 unsigned C : 1;
135 unsigned DC : 1;
136 unsigned Z : 1;
137 unsigned NOT_PD : 1;
138 unsigned NOT_TO : 1;
139 unsigned RP0 : 1;
140 unsigned RP1 : 1;
141 unsigned IRP : 1;
144 struct
146 unsigned : 5;
147 unsigned RP : 2;
148 unsigned : 1;
150 } __STATUSbits_t;
152 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
154 #define _C 0x01
155 #define _DC 0x02
156 #define _Z 0x04
157 #define _NOT_PD 0x08
158 #define _NOT_TO 0x10
159 #define _RP0 0x20
160 #define _RP1 0x40
161 #define _IRP 0x80
163 //==============================================================================
165 extern __at(0x0004) __sfr FSR;
167 //==============================================================================
168 // PORTA Bits
170 extern __at(0x0005) __sfr PORTA;
172 typedef struct
174 unsigned RA0 : 1;
175 unsigned RA1 : 1;
176 unsigned RA2 : 1;
177 unsigned RA3 : 1;
178 unsigned RA4 : 1;
179 unsigned RA5 : 1;
180 unsigned RA6 : 1;
181 unsigned RA7 : 1;
182 } __PORTAbits_t;
184 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
186 #define _RA0 0x01
187 #define _RA1 0x02
188 #define _RA2 0x04
189 #define _RA3 0x08
190 #define _RA4 0x10
191 #define _RA5 0x20
192 #define _RA6 0x40
193 #define _RA7 0x80
195 //==============================================================================
198 //==============================================================================
199 // PORTB Bits
201 extern __at(0x0006) __sfr PORTB;
203 typedef struct
205 unsigned RB0 : 1;
206 unsigned RB1 : 1;
207 unsigned RB2 : 1;
208 unsigned RB3 : 1;
209 unsigned RB4 : 1;
210 unsigned RB5 : 1;
211 unsigned RB6 : 1;
212 unsigned RB7 : 1;
213 } __PORTBbits_t;
215 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
217 #define _RB0 0x01
218 #define _RB1 0x02
219 #define _RB2 0x04
220 #define _RB3 0x08
221 #define _RB4 0x10
222 #define _RB5 0x20
223 #define _RB6 0x40
224 #define _RB7 0x80
226 //==============================================================================
229 //==============================================================================
230 // PORTC Bits
232 extern __at(0x0007) __sfr PORTC;
234 typedef struct
236 unsigned RC0 : 1;
237 unsigned RC1 : 1;
238 unsigned RC2 : 1;
239 unsigned RC3 : 1;
240 unsigned RC4 : 1;
241 unsigned RC5 : 1;
242 unsigned RC6 : 1;
243 unsigned RC7 : 1;
244 } __PORTCbits_t;
246 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
248 #define _RC0 0x01
249 #define _RC1 0x02
250 #define _RC2 0x04
251 #define _RC3 0x08
252 #define _RC4 0x10
253 #define _RC5 0x20
254 #define _RC6 0x40
255 #define _RC7 0x80
257 //==============================================================================
260 //==============================================================================
261 // PORTE Bits
263 extern __at(0x0009) __sfr PORTE;
265 typedef struct
267 unsigned : 1;
268 unsigned : 1;
269 unsigned : 1;
270 unsigned RE3 : 1;
271 unsigned : 1;
272 unsigned : 1;
273 unsigned : 1;
274 unsigned : 1;
275 } __PORTEbits_t;
277 extern __at(0x0009) volatile __PORTEbits_t PORTEbits;
279 #define _RE3 0x08
281 //==============================================================================
283 extern __at(0x000A) __sfr PCLATH;
285 //==============================================================================
286 // INTCON Bits
288 extern __at(0x000B) __sfr INTCON;
290 typedef union
292 struct
294 unsigned RBIF : 1;
295 unsigned INTF : 1;
296 unsigned T0IF : 1;
297 unsigned RBIE : 1;
298 unsigned INTE : 1;
299 unsigned T0IE : 1;
300 unsigned PEIE : 1;
301 unsigned GIE : 1;
304 struct
306 unsigned : 1;
307 unsigned : 1;
308 unsigned TMR0IF : 1;
309 unsigned : 1;
310 unsigned : 1;
311 unsigned TMR0IE : 1;
312 unsigned : 1;
313 unsigned : 1;
315 } __INTCONbits_t;
317 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
319 #define _RBIF 0x01
320 #define _INTF 0x02
321 #define _T0IF 0x04
322 #define _TMR0IF 0x04
323 #define _RBIE 0x08
324 #define _INTE 0x10
325 #define _T0IE 0x20
326 #define _TMR0IE 0x20
327 #define _PEIE 0x40
328 #define _GIE 0x80
330 //==============================================================================
333 //==============================================================================
334 // PIR1 Bits
336 extern __at(0x000C) __sfr PIR1;
338 typedef struct
340 unsigned TMR1IF : 1;
341 unsigned TMR2IF : 1;
342 unsigned CCP1IF : 1;
343 unsigned SSPIF : 1;
344 unsigned TXIF : 1;
345 unsigned RCIF : 1;
346 unsigned ADIF : 1;
347 unsigned : 1;
348 } __PIR1bits_t;
350 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
352 #define _TMR1IF 0x01
353 #define _TMR2IF 0x02
354 #define _CCP1IF 0x04
355 #define _SSPIF 0x08
356 #define _TXIF 0x10
357 #define _RCIF 0x20
358 #define _ADIF 0x40
360 //==============================================================================
363 //==============================================================================
364 // PIR2 Bits
366 extern __at(0x000D) __sfr PIR2;
368 typedef struct
370 unsigned CCP2IF : 1;
371 unsigned : 1;
372 unsigned ULPWUIF : 1;
373 unsigned BCLIF : 1;
374 unsigned EEIF : 1;
375 unsigned C1IF : 1;
376 unsigned C2IF : 1;
377 unsigned OSFIF : 1;
378 } __PIR2bits_t;
380 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
382 #define _CCP2IF 0x01
383 #define _ULPWUIF 0x04
384 #define _BCLIF 0x08
385 #define _EEIF 0x10
386 #define _C1IF 0x20
387 #define _C2IF 0x40
388 #define _OSFIF 0x80
390 //==============================================================================
392 extern __at(0x000E) __sfr TMR1;
393 extern __at(0x000E) __sfr TMR1L;
394 extern __at(0x000F) __sfr TMR1H;
396 //==============================================================================
397 // T1CON Bits
399 extern __at(0x0010) __sfr T1CON;
401 typedef union
403 struct
405 unsigned TMR1ON : 1;
406 unsigned TMR1CS : 1;
407 unsigned NOT_T1SYNC : 1;
408 unsigned T1OSCEN : 1;
409 unsigned T1CKPS0 : 1;
410 unsigned T1CKPS1 : 1;
411 unsigned TMR1GE : 1;
412 unsigned T1GINV : 1;
415 struct
417 unsigned : 1;
418 unsigned : 1;
419 unsigned T1INSYNC : 1;
420 unsigned : 1;
421 unsigned : 1;
422 unsigned : 1;
423 unsigned : 1;
424 unsigned T1GIV : 1;
427 struct
429 unsigned : 1;
430 unsigned : 1;
431 unsigned T1SYNC : 1;
432 unsigned : 1;
433 unsigned : 1;
434 unsigned : 1;
435 unsigned : 1;
436 unsigned : 1;
439 struct
441 unsigned : 4;
442 unsigned T1CKPS : 2;
443 unsigned : 2;
445 } __T1CONbits_t;
447 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
449 #define _TMR1ON 0x01
450 #define _TMR1CS 0x02
451 #define _NOT_T1SYNC 0x04
452 #define _T1INSYNC 0x04
453 #define _T1SYNC 0x04
454 #define _T1OSCEN 0x08
455 #define _T1CKPS0 0x10
456 #define _T1CKPS1 0x20
457 #define _TMR1GE 0x40
458 #define _T1GINV 0x80
459 #define _T1GIV 0x80
461 //==============================================================================
463 extern __at(0x0011) __sfr TMR2;
465 //==============================================================================
466 // T2CON Bits
468 extern __at(0x0012) __sfr T2CON;
470 typedef union
472 struct
474 unsigned T2CKPS0 : 1;
475 unsigned T2CKPS1 : 1;
476 unsigned TMR2ON : 1;
477 unsigned TOUTPS0 : 1;
478 unsigned TOUTPS1 : 1;
479 unsigned TOUTPS2 : 1;
480 unsigned TOUTPS3 : 1;
481 unsigned : 1;
484 struct
486 unsigned T2CKPS : 2;
487 unsigned : 6;
490 struct
492 unsigned : 3;
493 unsigned TOUTPS : 4;
494 unsigned : 1;
496 } __T2CONbits_t;
498 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
500 #define _T2CKPS0 0x01
501 #define _T2CKPS1 0x02
502 #define _TMR2ON 0x04
503 #define _TOUTPS0 0x08
504 #define _TOUTPS1 0x10
505 #define _TOUTPS2 0x20
506 #define _TOUTPS3 0x40
508 //==============================================================================
510 extern __at(0x0013) __sfr SSPBUF;
512 //==============================================================================
513 // SSPCON Bits
515 extern __at(0x0014) __sfr SSPCON;
517 typedef union
519 struct
521 unsigned SSPM0 : 1;
522 unsigned SSPM1 : 1;
523 unsigned SSPM2 : 1;
524 unsigned SSPM3 : 1;
525 unsigned CKP : 1;
526 unsigned SSPEN : 1;
527 unsigned SSPOV : 1;
528 unsigned WCOL : 1;
531 struct
533 unsigned SSPM : 4;
534 unsigned : 4;
536 } __SSPCONbits_t;
538 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
540 #define _SSPM0 0x01
541 #define _SSPM1 0x02
542 #define _SSPM2 0x04
543 #define _SSPM3 0x08
544 #define _CKP 0x10
545 #define _SSPEN 0x20
546 #define _SSPOV 0x40
547 #define _WCOL 0x80
549 //==============================================================================
551 extern __at(0x0015) __sfr CCPR1;
552 extern __at(0x0015) __sfr CCPR1L;
553 extern __at(0x0016) __sfr CCPR1H;
555 //==============================================================================
556 // CCP1CON Bits
558 extern __at(0x0017) __sfr CCP1CON;
560 typedef union
562 struct
564 unsigned CCP1M0 : 1;
565 unsigned CCP1M1 : 1;
566 unsigned CCP1M2 : 1;
567 unsigned CCP1M3 : 1;
568 unsigned DC1B0 : 1;
569 unsigned DC1B1 : 1;
570 unsigned P1M0 : 1;
571 unsigned P1M1 : 1;
574 struct
576 unsigned : 1;
577 unsigned : 1;
578 unsigned : 1;
579 unsigned : 1;
580 unsigned CCP1Y : 1;
581 unsigned CCP1X : 1;
582 unsigned : 1;
583 unsigned : 1;
586 struct
588 unsigned CCP1M : 4;
589 unsigned : 4;
592 struct
594 unsigned : 4;
595 unsigned DC1B : 2;
596 unsigned : 2;
599 struct
601 unsigned : 6;
602 unsigned P1M : 2;
604 } __CCP1CONbits_t;
606 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
608 #define _CCP1M0 0x01
609 #define _CCP1M1 0x02
610 #define _CCP1M2 0x04
611 #define _CCP1M3 0x08
612 #define _DC1B0 0x10
613 #define _CCP1Y 0x10
614 #define _DC1B1 0x20
615 #define _CCP1X 0x20
616 #define _P1M0 0x40
617 #define _P1M1 0x80
619 //==============================================================================
622 //==============================================================================
623 // RCSTA Bits
625 extern __at(0x0018) __sfr RCSTA;
627 typedef union
629 struct
631 unsigned RX9D : 1;
632 unsigned OERR : 1;
633 unsigned FERR : 1;
634 unsigned ADDEN : 1;
635 unsigned CREN : 1;
636 unsigned SREN : 1;
637 unsigned RX9 : 1;
638 unsigned SPEN : 1;
641 struct
643 unsigned RCD8 : 1;
644 unsigned : 1;
645 unsigned : 1;
646 unsigned : 1;
647 unsigned : 1;
648 unsigned : 1;
649 unsigned RC9 : 1;
650 unsigned : 1;
653 struct
655 unsigned : 1;
656 unsigned : 1;
657 unsigned : 1;
658 unsigned : 1;
659 unsigned : 1;
660 unsigned : 1;
661 unsigned NOT_RC8 : 1;
662 unsigned : 1;
665 struct
667 unsigned : 1;
668 unsigned : 1;
669 unsigned : 1;
670 unsigned : 1;
671 unsigned : 1;
672 unsigned : 1;
673 unsigned RC8_9 : 1;
674 unsigned : 1;
676 } __RCSTAbits_t;
678 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
680 #define _RX9D 0x01
681 #define _RCD8 0x01
682 #define _OERR 0x02
683 #define _FERR 0x04
684 #define _ADDEN 0x08
685 #define _CREN 0x10
686 #define _SREN 0x20
687 #define _RX9 0x40
688 #define _RC9 0x40
689 #define _NOT_RC8 0x40
690 #define _RC8_9 0x40
691 #define _SPEN 0x80
693 //==============================================================================
695 extern __at(0x0019) __sfr TXREG;
696 extern __at(0x001A) __sfr RCREG;
697 extern __at(0x001B) __sfr CCPR2;
698 extern __at(0x001B) __sfr CCPR2L;
699 extern __at(0x001C) __sfr CCPR2H;
701 //==============================================================================
702 // CCP2CON Bits
704 extern __at(0x001D) __sfr CCP2CON;
706 typedef union
708 struct
710 unsigned CCP2M0 : 1;
711 unsigned CCP2M1 : 1;
712 unsigned CCP2M2 : 1;
713 unsigned CCP2M3 : 1;
714 unsigned DC2B0 : 1;
715 unsigned DC2B1 : 1;
716 unsigned : 1;
717 unsigned : 1;
720 struct
722 unsigned : 1;
723 unsigned : 1;
724 unsigned : 1;
725 unsigned : 1;
726 unsigned CCP2Y : 1;
727 unsigned CCP2X : 1;
728 unsigned : 1;
729 unsigned : 1;
732 struct
734 unsigned CCP2M : 4;
735 unsigned : 4;
738 struct
740 unsigned : 4;
741 unsigned DC2B : 2;
742 unsigned : 2;
744 } __CCP2CONbits_t;
746 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
748 #define _CCP2M0 0x01
749 #define _CCP2M1 0x02
750 #define _CCP2M2 0x04
751 #define _CCP2M3 0x08
752 #define _DC2B0 0x10
753 #define _CCP2Y 0x10
754 #define _DC2B1 0x20
755 #define _CCP2X 0x20
757 //==============================================================================
759 extern __at(0x001E) __sfr ADRESH;
761 //==============================================================================
762 // ADCON0 Bits
764 extern __at(0x001F) __sfr ADCON0;
766 typedef union
768 struct
770 unsigned ADON : 1;
771 unsigned GO_NOT_DONE : 1;
772 unsigned CHS0 : 1;
773 unsigned CHS1 : 1;
774 unsigned CHS2 : 1;
775 unsigned CHS3 : 1;
776 unsigned ADCS0 : 1;
777 unsigned ADCS1 : 1;
780 struct
782 unsigned : 1;
783 unsigned GO : 1;
784 unsigned : 1;
785 unsigned : 1;
786 unsigned : 1;
787 unsigned : 1;
788 unsigned : 1;
789 unsigned : 1;
792 struct
794 unsigned : 1;
795 unsigned NOT_DONE : 1;
796 unsigned : 1;
797 unsigned : 1;
798 unsigned : 1;
799 unsigned : 1;
800 unsigned : 1;
801 unsigned : 1;
804 struct
806 unsigned : 1;
807 unsigned GO_DONE : 1;
808 unsigned : 1;
809 unsigned : 1;
810 unsigned : 1;
811 unsigned : 1;
812 unsigned : 1;
813 unsigned : 1;
816 struct
818 unsigned : 2;
819 unsigned CHS : 4;
820 unsigned : 2;
823 struct
825 unsigned : 6;
826 unsigned ADCS : 2;
828 } __ADCON0bits_t;
830 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
832 #define _ADON 0x01
833 #define _GO_NOT_DONE 0x02
834 #define _GO 0x02
835 #define _NOT_DONE 0x02
836 #define _GO_DONE 0x02
837 #define _CHS0 0x04
838 #define _CHS1 0x08
839 #define _CHS2 0x10
840 #define _CHS3 0x20
841 #define _ADCS0 0x40
842 #define _ADCS1 0x80
844 //==============================================================================
847 //==============================================================================
848 // OPTION_REG Bits
850 extern __at(0x0081) __sfr OPTION_REG;
852 typedef union
854 struct
856 unsigned PS0 : 1;
857 unsigned PS1 : 1;
858 unsigned PS2 : 1;
859 unsigned PSA : 1;
860 unsigned T0SE : 1;
861 unsigned T0CS : 1;
862 unsigned INTEDG : 1;
863 unsigned NOT_RBPU : 1;
866 struct
868 unsigned PS : 3;
869 unsigned : 5;
871 } __OPTION_REGbits_t;
873 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
875 #define _PS0 0x01
876 #define _PS1 0x02
877 #define _PS2 0x04
878 #define _PSA 0x08
879 #define _T0SE 0x10
880 #define _T0CS 0x20
881 #define _INTEDG 0x40
882 #define _NOT_RBPU 0x80
884 //==============================================================================
887 //==============================================================================
888 // TRISA Bits
890 extern __at(0x0085) __sfr TRISA;
892 typedef struct
894 unsigned TRISA0 : 1;
895 unsigned TRISA1 : 1;
896 unsigned TRISA2 : 1;
897 unsigned TRISA3 : 1;
898 unsigned TRISA4 : 1;
899 unsigned TRISA5 : 1;
900 unsigned TRISA6 : 1;
901 unsigned TRISA7 : 1;
902 } __TRISAbits_t;
904 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
906 #define _TRISA0 0x01
907 #define _TRISA1 0x02
908 #define _TRISA2 0x04
909 #define _TRISA3 0x08
910 #define _TRISA4 0x10
911 #define _TRISA5 0x20
912 #define _TRISA6 0x40
913 #define _TRISA7 0x80
915 //==============================================================================
918 //==============================================================================
919 // TRISB Bits
921 extern __at(0x0086) __sfr TRISB;
923 typedef struct
925 unsigned TRISB0 : 1;
926 unsigned TRISB1 : 1;
927 unsigned TRISB2 : 1;
928 unsigned TRISB3 : 1;
929 unsigned TRISB4 : 1;
930 unsigned TRISB5 : 1;
931 unsigned TRISB6 : 1;
932 unsigned TRISB7 : 1;
933 } __TRISBbits_t;
935 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
937 #define _TRISB0 0x01
938 #define _TRISB1 0x02
939 #define _TRISB2 0x04
940 #define _TRISB3 0x08
941 #define _TRISB4 0x10
942 #define _TRISB5 0x20
943 #define _TRISB6 0x40
944 #define _TRISB7 0x80
946 //==============================================================================
949 //==============================================================================
950 // TRISC Bits
952 extern __at(0x0087) __sfr TRISC;
954 typedef struct
956 unsigned TRISC0 : 1;
957 unsigned TRISC1 : 1;
958 unsigned TRISC2 : 1;
959 unsigned TRISC3 : 1;
960 unsigned TRISC4 : 1;
961 unsigned TRISC5 : 1;
962 unsigned TRISC6 : 1;
963 unsigned TRISC7 : 1;
964 } __TRISCbits_t;
966 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
968 #define _TRISC0 0x01
969 #define _TRISC1 0x02
970 #define _TRISC2 0x04
971 #define _TRISC3 0x08
972 #define _TRISC4 0x10
973 #define _TRISC5 0x20
974 #define _TRISC6 0x40
975 #define _TRISC7 0x80
977 //==============================================================================
980 //==============================================================================
981 // TRISE Bits
983 extern __at(0x0089) __sfr TRISE;
985 typedef struct
987 unsigned : 1;
988 unsigned : 1;
989 unsigned : 1;
990 unsigned TRISE3 : 1;
991 unsigned : 1;
992 unsigned : 1;
993 unsigned : 1;
994 unsigned : 1;
995 } __TRISEbits_t;
997 extern __at(0x0089) volatile __TRISEbits_t TRISEbits;
999 #define _TRISE3 0x08
1001 //==============================================================================
1004 //==============================================================================
1005 // PIE1 Bits
1007 extern __at(0x008C) __sfr PIE1;
1009 typedef struct
1011 unsigned TMR1IE : 1;
1012 unsigned TMR2IE : 1;
1013 unsigned CCP1IE : 1;
1014 unsigned SSPIE : 1;
1015 unsigned TXIE : 1;
1016 unsigned RCIE : 1;
1017 unsigned ADIE : 1;
1018 unsigned : 1;
1019 } __PIE1bits_t;
1021 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
1023 #define _TMR1IE 0x01
1024 #define _TMR2IE 0x02
1025 #define _CCP1IE 0x04
1026 #define _SSPIE 0x08
1027 #define _TXIE 0x10
1028 #define _RCIE 0x20
1029 #define _ADIE 0x40
1031 //==============================================================================
1034 //==============================================================================
1035 // PIE2 Bits
1037 extern __at(0x008D) __sfr PIE2;
1039 typedef struct
1041 unsigned CCP2IE : 1;
1042 unsigned : 1;
1043 unsigned ULPWUIE : 1;
1044 unsigned BCLIE : 1;
1045 unsigned EEIE : 1;
1046 unsigned C1IE : 1;
1047 unsigned C2IE : 1;
1048 unsigned OSFIE : 1;
1049 } __PIE2bits_t;
1051 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
1053 #define _CCP2IE 0x01
1054 #define _ULPWUIE 0x04
1055 #define _BCLIE 0x08
1056 #define _EEIE 0x10
1057 #define _C1IE 0x20
1058 #define _C2IE 0x40
1059 #define _OSFIE 0x80
1061 //==============================================================================
1064 //==============================================================================
1065 // PCON Bits
1067 extern __at(0x008E) __sfr PCON;
1069 typedef union
1071 struct
1073 unsigned NOT_BOR : 1;
1074 unsigned NOT_POR : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned SBOREN : 1;
1078 unsigned ULPWUE : 1;
1079 unsigned : 1;
1080 unsigned : 1;
1083 struct
1085 unsigned NOT_BO : 1;
1086 unsigned : 1;
1087 unsigned : 1;
1088 unsigned : 1;
1089 unsigned : 1;
1090 unsigned : 1;
1091 unsigned : 1;
1092 unsigned : 1;
1094 } __PCONbits_t;
1096 extern __at(0x008E) volatile __PCONbits_t PCONbits;
1098 #define _NOT_BOR 0x01
1099 #define _NOT_BO 0x01
1100 #define _NOT_POR 0x02
1101 #define _SBOREN 0x10
1102 #define _ULPWUE 0x20
1104 //==============================================================================
1107 //==============================================================================
1108 // OSCCON Bits
1110 extern __at(0x008F) __sfr OSCCON;
1112 typedef union
1114 struct
1116 unsigned SCS : 1;
1117 unsigned LTS : 1;
1118 unsigned HTS : 1;
1119 unsigned OSTS : 1;
1120 unsigned IRCF0 : 1;
1121 unsigned IRCF1 : 1;
1122 unsigned IRCF2 : 1;
1123 unsigned : 1;
1126 struct
1128 unsigned : 4;
1129 unsigned IRCF : 3;
1130 unsigned : 1;
1132 } __OSCCONbits_t;
1134 extern __at(0x008F) volatile __OSCCONbits_t OSCCONbits;
1136 #define _SCS 0x01
1137 #define _LTS 0x02
1138 #define _HTS 0x04
1139 #define _OSTS 0x08
1140 #define _IRCF0 0x10
1141 #define _IRCF1 0x20
1142 #define _IRCF2 0x40
1144 //==============================================================================
1147 //==============================================================================
1148 // OSCTUNE Bits
1150 extern __at(0x0090) __sfr OSCTUNE;
1152 typedef union
1154 struct
1156 unsigned TUN0 : 1;
1157 unsigned TUN1 : 1;
1158 unsigned TUN2 : 1;
1159 unsigned TUN3 : 1;
1160 unsigned TUN4 : 1;
1161 unsigned : 1;
1162 unsigned : 1;
1163 unsigned : 1;
1166 struct
1168 unsigned TUN : 5;
1169 unsigned : 3;
1171 } __OSCTUNEbits_t;
1173 extern __at(0x0090) volatile __OSCTUNEbits_t OSCTUNEbits;
1175 #define _TUN0 0x01
1176 #define _TUN1 0x02
1177 #define _TUN2 0x04
1178 #define _TUN3 0x08
1179 #define _TUN4 0x10
1181 //==============================================================================
1184 //==============================================================================
1185 // SSPCON2 Bits
1187 extern __at(0x0091) __sfr SSPCON2;
1189 typedef struct
1191 unsigned SEN : 1;
1192 unsigned RSEN : 1;
1193 unsigned PEN : 1;
1194 unsigned RCEN : 1;
1195 unsigned ACKEN : 1;
1196 unsigned ACKDT : 1;
1197 unsigned ACKSTAT : 1;
1198 unsigned GCEN : 1;
1199 } __SSPCON2bits_t;
1201 extern __at(0x0091) volatile __SSPCON2bits_t SSPCON2bits;
1203 #define _SEN 0x01
1204 #define _RSEN 0x02
1205 #define _PEN 0x04
1206 #define _RCEN 0x08
1207 #define _ACKEN 0x10
1208 #define _ACKDT 0x20
1209 #define _ACKSTAT 0x40
1210 #define _GCEN 0x80
1212 //==============================================================================
1214 extern __at(0x0092) __sfr PR2;
1216 //==============================================================================
1217 // MSK Bits
1219 extern __at(0x0093) __sfr MSK;
1221 typedef struct
1223 unsigned MSK0 : 1;
1224 unsigned MSK1 : 1;
1225 unsigned MSK2 : 1;
1226 unsigned MSK3 : 1;
1227 unsigned MSK4 : 1;
1228 unsigned MSK5 : 1;
1229 unsigned MSK6 : 1;
1230 unsigned MSK7 : 1;
1231 } __MSKbits_t;
1233 extern __at(0x0093) volatile __MSKbits_t MSKbits;
1235 #define _MSK0 0x01
1236 #define _MSK1 0x02
1237 #define _MSK2 0x04
1238 #define _MSK3 0x08
1239 #define _MSK4 0x10
1240 #define _MSK5 0x20
1241 #define _MSK6 0x40
1242 #define _MSK7 0x80
1244 //==============================================================================
1246 extern __at(0x0093) __sfr SSPADD;
1248 //==============================================================================
1249 // SSPMSK Bits
1251 extern __at(0x0093) __sfr SSPMSK;
1253 typedef struct
1255 unsigned MSK0 : 1;
1256 unsigned MSK1 : 1;
1257 unsigned MSK2 : 1;
1258 unsigned MSK3 : 1;
1259 unsigned MSK4 : 1;
1260 unsigned MSK5 : 1;
1261 unsigned MSK6 : 1;
1262 unsigned MSK7 : 1;
1263 } __SSPMSKbits_t;
1265 extern __at(0x0093) volatile __SSPMSKbits_t SSPMSKbits;
1267 #define _SSPMSK_MSK0 0x01
1268 #define _SSPMSK_MSK1 0x02
1269 #define _SSPMSK_MSK2 0x04
1270 #define _SSPMSK_MSK3 0x08
1271 #define _SSPMSK_MSK4 0x10
1272 #define _SSPMSK_MSK5 0x20
1273 #define _SSPMSK_MSK6 0x40
1274 #define _SSPMSK_MSK7 0x80
1276 //==============================================================================
1279 //==============================================================================
1280 // SSPSTAT Bits
1282 extern __at(0x0094) __sfr SSPSTAT;
1284 typedef union
1286 struct
1288 unsigned BF : 1;
1289 unsigned UA : 1;
1290 unsigned R_NOT_W : 1;
1291 unsigned S : 1;
1292 unsigned P : 1;
1293 unsigned D_NOT_A : 1;
1294 unsigned CKE : 1;
1295 unsigned SMP : 1;
1298 struct
1300 unsigned : 1;
1301 unsigned : 1;
1302 unsigned R : 1;
1303 unsigned I2C_START : 1;
1304 unsigned I2C_STOP : 1;
1305 unsigned D : 1;
1306 unsigned : 1;
1307 unsigned : 1;
1310 struct
1312 unsigned : 1;
1313 unsigned : 1;
1314 unsigned I2C_READ : 1;
1315 unsigned : 1;
1316 unsigned : 1;
1317 unsigned I2C_DATA : 1;
1318 unsigned : 1;
1319 unsigned : 1;
1322 struct
1324 unsigned : 1;
1325 unsigned : 1;
1326 unsigned NOT_W : 1;
1327 unsigned : 1;
1328 unsigned : 1;
1329 unsigned NOT_A : 1;
1330 unsigned : 1;
1331 unsigned : 1;
1334 struct
1336 unsigned : 1;
1337 unsigned : 1;
1338 unsigned NOT_WRITE : 1;
1339 unsigned : 1;
1340 unsigned : 1;
1341 unsigned NOT_ADDRESS : 1;
1342 unsigned : 1;
1343 unsigned : 1;
1346 struct
1348 unsigned : 1;
1349 unsigned : 1;
1350 unsigned R_W : 1;
1351 unsigned : 1;
1352 unsigned : 1;
1353 unsigned D_A : 1;
1354 unsigned : 1;
1355 unsigned : 1;
1358 struct
1360 unsigned : 1;
1361 unsigned : 1;
1362 unsigned READ_WRITE : 1;
1363 unsigned : 1;
1364 unsigned : 1;
1365 unsigned DATA_ADDRESS : 1;
1366 unsigned : 1;
1367 unsigned : 1;
1369 } __SSPSTATbits_t;
1371 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1373 #define _BF 0x01
1374 #define _UA 0x02
1375 #define _R_NOT_W 0x04
1376 #define _R 0x04
1377 #define _I2C_READ 0x04
1378 #define _NOT_W 0x04
1379 #define _NOT_WRITE 0x04
1380 #define _R_W 0x04
1381 #define _READ_WRITE 0x04
1382 #define _S 0x08
1383 #define _I2C_START 0x08
1384 #define _P 0x10
1385 #define _I2C_STOP 0x10
1386 #define _D_NOT_A 0x20
1387 #define _D 0x20
1388 #define _I2C_DATA 0x20
1389 #define _NOT_A 0x20
1390 #define _NOT_ADDRESS 0x20
1391 #define _D_A 0x20
1392 #define _DATA_ADDRESS 0x20
1393 #define _CKE 0x40
1394 #define _SMP 0x80
1396 //==============================================================================
1399 //==============================================================================
1400 // WPUB Bits
1402 extern __at(0x0095) __sfr WPUB;
1404 typedef struct
1406 unsigned WPUB0 : 1;
1407 unsigned WPUB1 : 1;
1408 unsigned WPUB2 : 1;
1409 unsigned WPUB3 : 1;
1410 unsigned WPUB4 : 1;
1411 unsigned WPUB5 : 1;
1412 unsigned WPUB6 : 1;
1413 unsigned WPUB7 : 1;
1414 } __WPUBbits_t;
1416 extern __at(0x0095) volatile __WPUBbits_t WPUBbits;
1418 #define _WPUB0 0x01
1419 #define _WPUB1 0x02
1420 #define _WPUB2 0x04
1421 #define _WPUB3 0x08
1422 #define _WPUB4 0x10
1423 #define _WPUB5 0x20
1424 #define _WPUB6 0x40
1425 #define _WPUB7 0x80
1427 //==============================================================================
1430 //==============================================================================
1431 // IOCB Bits
1433 extern __at(0x0096) __sfr IOCB;
1435 typedef struct
1437 unsigned IOCB0 : 1;
1438 unsigned IOCB1 : 1;
1439 unsigned IOCB2 : 1;
1440 unsigned IOCB3 : 1;
1441 unsigned IOCB4 : 1;
1442 unsigned IOCB5 : 1;
1443 unsigned IOCB6 : 1;
1444 unsigned IOCB7 : 1;
1445 } __IOCBbits_t;
1447 extern __at(0x0096) volatile __IOCBbits_t IOCBbits;
1449 #define _IOCB0 0x01
1450 #define _IOCB1 0x02
1451 #define _IOCB2 0x04
1452 #define _IOCB3 0x08
1453 #define _IOCB4 0x10
1454 #define _IOCB5 0x20
1455 #define _IOCB6 0x40
1456 #define _IOCB7 0x80
1458 //==============================================================================
1461 //==============================================================================
1462 // VRCON Bits
1464 extern __at(0x0097) __sfr VRCON;
1466 typedef union
1468 struct
1470 unsigned VR0 : 1;
1471 unsigned VR1 : 1;
1472 unsigned VR2 : 1;
1473 unsigned VR3 : 1;
1474 unsigned VRSS : 1;
1475 unsigned VRR : 1;
1476 unsigned VROE : 1;
1477 unsigned VREN : 1;
1480 struct
1482 unsigned VR : 4;
1483 unsigned : 4;
1485 } __VRCONbits_t;
1487 extern __at(0x0097) volatile __VRCONbits_t VRCONbits;
1489 #define _VR0 0x01
1490 #define _VR1 0x02
1491 #define _VR2 0x04
1492 #define _VR3 0x08
1493 #define _VRSS 0x10
1494 #define _VRR 0x20
1495 #define _VROE 0x40
1496 #define _VREN 0x80
1498 //==============================================================================
1501 //==============================================================================
1502 // TXSTA Bits
1504 extern __at(0x0098) __sfr TXSTA;
1506 typedef union
1508 struct
1510 unsigned TX9D : 1;
1511 unsigned TRMT : 1;
1512 unsigned BRGH : 1;
1513 unsigned SENDB : 1;
1514 unsigned SYNC : 1;
1515 unsigned TXEN : 1;
1516 unsigned TX9 : 1;
1517 unsigned CSRC : 1;
1520 struct
1522 unsigned TXD8 : 1;
1523 unsigned : 1;
1524 unsigned : 1;
1525 unsigned : 1;
1526 unsigned : 1;
1527 unsigned : 1;
1528 unsigned NOT_TX8 : 1;
1529 unsigned : 1;
1532 struct
1534 unsigned : 1;
1535 unsigned : 1;
1536 unsigned : 1;
1537 unsigned : 1;
1538 unsigned : 1;
1539 unsigned : 1;
1540 unsigned TX8_9 : 1;
1541 unsigned : 1;
1543 } __TXSTAbits_t;
1545 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1547 #define _TX9D 0x01
1548 #define _TXD8 0x01
1549 #define _TRMT 0x02
1550 #define _BRGH 0x04
1551 #define _SENDB 0x08
1552 #define _SYNC 0x10
1553 #define _TXEN 0x20
1554 #define _TX9 0x40
1555 #define _NOT_TX8 0x40
1556 #define _TX8_9 0x40
1557 #define _CSRC 0x80
1559 //==============================================================================
1562 //==============================================================================
1563 // SPBRG Bits
1565 extern __at(0x0099) __sfr SPBRG;
1567 typedef struct
1569 unsigned BRG0 : 1;
1570 unsigned BRG1 : 1;
1571 unsigned BRG2 : 1;
1572 unsigned BRG3 : 1;
1573 unsigned BRG4 : 1;
1574 unsigned BRG5 : 1;
1575 unsigned BRG6 : 1;
1576 unsigned BRG7 : 1;
1577 } __SPBRGbits_t;
1579 extern __at(0x0099) volatile __SPBRGbits_t SPBRGbits;
1581 #define _BRG0 0x01
1582 #define _BRG1 0x02
1583 #define _BRG2 0x04
1584 #define _BRG3 0x08
1585 #define _BRG4 0x10
1586 #define _BRG5 0x20
1587 #define _BRG6 0x40
1588 #define _BRG7 0x80
1590 //==============================================================================
1593 //==============================================================================
1594 // SPBRGH Bits
1596 extern __at(0x009A) __sfr SPBRGH;
1598 typedef struct
1600 unsigned BRG8 : 1;
1601 unsigned BRG9 : 1;
1602 unsigned BRG10 : 1;
1603 unsigned BRG11 : 1;
1604 unsigned BRG12 : 1;
1605 unsigned BRG13 : 1;
1606 unsigned BRG14 : 1;
1607 unsigned BRG15 : 1;
1608 } __SPBRGHbits_t;
1610 extern __at(0x009A) volatile __SPBRGHbits_t SPBRGHbits;
1612 #define _BRG8 0x01
1613 #define _BRG9 0x02
1614 #define _BRG10 0x04
1615 #define _BRG11 0x08
1616 #define _BRG12 0x10
1617 #define _BRG13 0x20
1618 #define _BRG14 0x40
1619 #define _BRG15 0x80
1621 //==============================================================================
1624 //==============================================================================
1625 // PWM1CON Bits
1627 extern __at(0x009B) __sfr PWM1CON;
1629 typedef union
1631 struct
1633 unsigned PDC0 : 1;
1634 unsigned PDC1 : 1;
1635 unsigned PDC2 : 1;
1636 unsigned PDC3 : 1;
1637 unsigned PDC4 : 1;
1638 unsigned PDC5 : 1;
1639 unsigned PDC6 : 1;
1640 unsigned PRSEN : 1;
1643 struct
1645 unsigned PDC : 7;
1646 unsigned : 1;
1648 } __PWM1CONbits_t;
1650 extern __at(0x009B) volatile __PWM1CONbits_t PWM1CONbits;
1652 #define _PDC0 0x01
1653 #define _PDC1 0x02
1654 #define _PDC2 0x04
1655 #define _PDC3 0x08
1656 #define _PDC4 0x10
1657 #define _PDC5 0x20
1658 #define _PDC6 0x40
1659 #define _PRSEN 0x80
1661 //==============================================================================
1664 //==============================================================================
1665 // ECCPAS Bits
1667 extern __at(0x009C) __sfr ECCPAS;
1669 typedef union
1671 struct
1673 unsigned PSSBD0 : 1;
1674 unsigned PSSBD1 : 1;
1675 unsigned PSSAC0 : 1;
1676 unsigned PSSAC1 : 1;
1677 unsigned ECCPAS0 : 1;
1678 unsigned ECCPAS1 : 1;
1679 unsigned ECCPAS2 : 1;
1680 unsigned ECCPASE : 1;
1683 struct
1685 unsigned PSSBD : 2;
1686 unsigned : 6;
1689 struct
1691 unsigned : 2;
1692 unsigned PSSAC : 2;
1693 unsigned : 4;
1696 struct
1698 unsigned : 4;
1699 unsigned ECCPAS : 3;
1700 unsigned : 1;
1702 } __ECCPASbits_t;
1704 extern __at(0x009C) volatile __ECCPASbits_t ECCPASbits;
1706 #define _PSSBD0 0x01
1707 #define _PSSBD1 0x02
1708 #define _PSSAC0 0x04
1709 #define _PSSAC1 0x08
1710 #define _ECCPAS0 0x10
1711 #define _ECCPAS1 0x20
1712 #define _ECCPAS2 0x40
1713 #define _ECCPASE 0x80
1715 //==============================================================================
1718 //==============================================================================
1719 // PSTRCON Bits
1721 extern __at(0x009D) __sfr PSTRCON;
1723 typedef struct
1725 unsigned STRA : 1;
1726 unsigned STRB : 1;
1727 unsigned STRC : 1;
1728 unsigned STRD : 1;
1729 unsigned STRSYNC : 1;
1730 unsigned : 1;
1731 unsigned : 1;
1732 unsigned : 1;
1733 } __PSTRCONbits_t;
1735 extern __at(0x009D) volatile __PSTRCONbits_t PSTRCONbits;
1737 #define _STRA 0x01
1738 #define _STRB 0x02
1739 #define _STRC 0x04
1740 #define _STRD 0x08
1741 #define _STRSYNC 0x10
1743 //==============================================================================
1745 extern __at(0x009E) __sfr ADRESL;
1747 //==============================================================================
1748 // ADCON1 Bits
1750 extern __at(0x009F) __sfr ADCON1;
1752 typedef union
1754 struct
1756 unsigned : 1;
1757 unsigned : 1;
1758 unsigned : 1;
1759 unsigned : 1;
1760 unsigned VCFG0 : 1;
1761 unsigned VCFG1 : 1;
1762 unsigned : 1;
1763 unsigned ADFM : 1;
1766 struct
1768 unsigned : 4;
1769 unsigned VCFG : 2;
1770 unsigned : 2;
1772 } __ADCON1bits_t;
1774 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1776 #define _VCFG0 0x10
1777 #define _VCFG1 0x20
1778 #define _ADFM 0x80
1780 //==============================================================================
1783 //==============================================================================
1784 // WDTCON Bits
1786 extern __at(0x0105) __sfr WDTCON;
1788 typedef union
1790 struct
1792 unsigned SWDTEN : 1;
1793 unsigned WDTPS0 : 1;
1794 unsigned WDTPS1 : 1;
1795 unsigned WDTPS2 : 1;
1796 unsigned WDTPS3 : 1;
1797 unsigned : 1;
1798 unsigned : 1;
1799 unsigned : 1;
1802 struct
1804 unsigned : 1;
1805 unsigned WDTPS : 4;
1806 unsigned : 3;
1808 } __WDTCONbits_t;
1810 extern __at(0x0105) volatile __WDTCONbits_t WDTCONbits;
1812 #define _SWDTEN 0x01
1813 #define _WDTPS0 0x02
1814 #define _WDTPS1 0x04
1815 #define _WDTPS2 0x08
1816 #define _WDTPS3 0x10
1818 //==============================================================================
1821 //==============================================================================
1822 // CM1CON0 Bits
1824 extern __at(0x0107) __sfr CM1CON0;
1826 typedef union
1828 struct
1830 unsigned C1CH0 : 1;
1831 unsigned C1CH1 : 1;
1832 unsigned C1R : 1;
1833 unsigned : 1;
1834 unsigned C1POL : 1;
1835 unsigned C1OE : 1;
1836 unsigned C1OUT : 1;
1837 unsigned C1ON : 1;
1840 struct
1842 unsigned C1CH : 2;
1843 unsigned : 6;
1845 } __CM1CON0bits_t;
1847 extern __at(0x0107) volatile __CM1CON0bits_t CM1CON0bits;
1849 #define _C1CH0 0x01
1850 #define _C1CH1 0x02
1851 #define _C1R 0x04
1852 #define _C1POL 0x10
1853 #define _C1OE 0x20
1854 #define _C1OUT 0x40
1855 #define _C1ON 0x80
1857 //==============================================================================
1860 //==============================================================================
1861 // CM2CON0 Bits
1863 extern __at(0x0108) __sfr CM2CON0;
1865 typedef union
1867 struct
1869 unsigned C2CH0 : 1;
1870 unsigned C2CH1 : 1;
1871 unsigned C2R : 1;
1872 unsigned : 1;
1873 unsigned C2POL : 1;
1874 unsigned C2OE : 1;
1875 unsigned C2OUT : 1;
1876 unsigned C2ON : 1;
1879 struct
1881 unsigned C2CH : 2;
1882 unsigned : 6;
1884 } __CM2CON0bits_t;
1886 extern __at(0x0108) volatile __CM2CON0bits_t CM2CON0bits;
1888 #define _C2CH0 0x01
1889 #define _C2CH1 0x02
1890 #define _C2R 0x04
1891 #define _C2POL 0x10
1892 #define _C2OE 0x20
1893 #define _C2OUT 0x40
1894 #define _C2ON 0x80
1896 //==============================================================================
1899 //==============================================================================
1900 // CM2CON1 Bits
1902 extern __at(0x0109) __sfr CM2CON1;
1904 typedef struct
1906 unsigned C2SYNC : 1;
1907 unsigned T1GSS : 1;
1908 unsigned : 1;
1909 unsigned : 1;
1910 unsigned C2RSEL : 1;
1911 unsigned C1RSEL : 1;
1912 unsigned MC2OUT : 1;
1913 unsigned MC1OUT : 1;
1914 } __CM2CON1bits_t;
1916 extern __at(0x0109) volatile __CM2CON1bits_t CM2CON1bits;
1918 #define _C2SYNC 0x01
1919 #define _T1GSS 0x02
1920 #define _C2RSEL 0x10
1921 #define _C1RSEL 0x20
1922 #define _MC2OUT 0x40
1923 #define _MC1OUT 0x80
1925 //==============================================================================
1927 extern __at(0x010C) __sfr EEDAT;
1928 extern __at(0x010C) __sfr EEDATA;
1929 extern __at(0x010D) __sfr EEADR;
1930 extern __at(0x010E) __sfr EEDATH;
1931 extern __at(0x010F) __sfr EEADRH;
1933 //==============================================================================
1934 // SRCON Bits
1936 extern __at(0x0185) __sfr SRCON;
1938 typedef union
1940 struct
1942 unsigned FVREN : 1;
1943 unsigned : 1;
1944 unsigned PULSR : 1;
1945 unsigned PULSS : 1;
1946 unsigned C2REN : 1;
1947 unsigned C1SEN : 1;
1948 unsigned SR0 : 1;
1949 unsigned SR1 : 1;
1952 struct
1954 unsigned : 6;
1955 unsigned SR : 2;
1957 } __SRCONbits_t;
1959 extern __at(0x0185) volatile __SRCONbits_t SRCONbits;
1961 #define _FVREN 0x01
1962 #define _PULSR 0x04
1963 #define _PULSS 0x08
1964 #define _C2REN 0x10
1965 #define _C1SEN 0x20
1966 #define _SR0 0x40
1967 #define _SR1 0x80
1969 //==============================================================================
1972 //==============================================================================
1973 // BAUDCTL Bits
1975 extern __at(0x0187) __sfr BAUDCTL;
1977 #define BAUDCON BAUDCTL
1979 typedef struct
1981 unsigned ABDEN : 1;
1982 unsigned WUE : 1;
1983 unsigned : 1;
1984 unsigned BRG16 : 1;
1985 unsigned SCKP : 1;
1986 unsigned : 1;
1987 unsigned RCIDL : 1;
1988 unsigned ABDOVF : 1;
1989 } __BAUDCTLbits_t;
1991 extern __at(0x0187) volatile __BAUDCTLbits_t BAUDCTLbits;
1993 #define BAUDCONbits BAUDCTLbits
1995 #define _ABDEN 0x01
1996 #define _WUE 0x02
1997 #define _BRG16 0x08
1998 #define _SCKP 0x10
1999 #define _RCIDL 0x40
2000 #define _ABDOVF 0x80
2002 //==============================================================================
2005 //==============================================================================
2006 // ANSEL Bits
2008 extern __at(0x0188) __sfr ANSEL;
2010 typedef union
2012 struct
2014 unsigned ANS0 : 1;
2015 unsigned ANS1 : 1;
2016 unsigned ANS2 : 1;
2017 unsigned ANS3 : 1;
2018 unsigned ANS4 : 1;
2019 unsigned : 1;
2020 unsigned : 1;
2021 unsigned : 1;
2024 struct
2026 unsigned ANS : 5;
2027 unsigned : 3;
2029 } __ANSELbits_t;
2031 extern __at(0x0188) volatile __ANSELbits_t ANSELbits;
2033 #define _ANS0 0x01
2034 #define _ANS1 0x02
2035 #define _ANS2 0x04
2036 #define _ANS3 0x08
2037 #define _ANS4 0x10
2039 //==============================================================================
2042 //==============================================================================
2043 // ANSELH Bits
2045 extern __at(0x0189) __sfr ANSELH;
2047 typedef struct
2049 unsigned ANS8 : 1;
2050 unsigned ANS9 : 1;
2051 unsigned ANS10 : 1;
2052 unsigned ANS11 : 1;
2053 unsigned ANS12 : 1;
2054 unsigned ANS13 : 1;
2055 unsigned : 1;
2056 unsigned : 1;
2057 } __ANSELHbits_t;
2059 extern __at(0x0189) volatile __ANSELHbits_t ANSELHbits;
2061 #define _ANS8 0x01
2062 #define _ANS9 0x02
2063 #define _ANS10 0x04
2064 #define _ANS11 0x08
2065 #define _ANS12 0x10
2066 #define _ANS13 0x20
2068 //==============================================================================
2071 //==============================================================================
2072 // EECON1 Bits
2074 extern __at(0x018C) __sfr EECON1;
2076 typedef struct
2078 unsigned RD : 1;
2079 unsigned WR : 1;
2080 unsigned WREN : 1;
2081 unsigned WRERR : 1;
2082 unsigned : 1;
2083 unsigned : 1;
2084 unsigned : 1;
2085 unsigned EEPGD : 1;
2086 } __EECON1bits_t;
2088 extern __at(0x018C) volatile __EECON1bits_t EECON1bits;
2090 #define _RD 0x01
2091 #define _WR 0x02
2092 #define _WREN 0x04
2093 #define _WRERR 0x08
2094 #define _EEPGD 0x80
2096 //==============================================================================
2098 extern __at(0x018D) __sfr EECON2;
2100 //==============================================================================
2102 // Configuration Bits
2104 //==============================================================================
2106 #define _CONFIG1 0x2007
2107 #define _CONFIG2 0x2008
2109 //----------------------------- CONFIG1 Options -------------------------------
2111 #define _FOSC_LP 0x3FF8 // LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2112 #define _LP_OSC 0x3FF8 // LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2113 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2114 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2115 #define _FOSC_HS 0x3FFA // HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2116 #define _HS_OSC 0x3FFA // HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2117 #define _FOSC_EC 0x3FFB // EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN.
2118 #define _EC_OSC 0x3FFB // EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN.
2119 #define _FOSC_INTRC_NOCLKOUT 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2120 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2121 #define _INTOSCIO 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2122 #define _FOSC_INTRC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2123 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2124 #define _INTOSC 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2125 #define _FOSC_EXTRC_NOCLKOUT 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2126 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2127 #define _EXTRCIO 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2128 #define _FOSC_EXTRC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2129 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2130 #define _EXTRC 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2131 #define _WDTE_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
2132 #define _WDT_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
2133 #define _WDTE_ON 0x3FFF // WDT enabled.
2134 #define _WDT_ON 0x3FFF // WDT enabled.
2135 #define _PWRTE_ON 0x3FEF // PWRT enabled.
2136 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
2137 #define _MCLRE_OFF 0x3FDF // RE3/MCLR pin function is digital input, MCLR internally tied to VDD.
2138 #define _MCLRE_ON 0x3FFF // RE3/MCLR pin function is MCLR.
2139 #define _CP_ON 0x3FBF // Program memory code protection is enabled.
2140 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
2141 #define _CPD_ON 0x3F7F // Data memory code protection is enabled.
2142 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
2143 #define _BOREN_OFF 0x3CFF // BOR disabled.
2144 #define _BOR_OFF 0x3CFF // BOR disabled.
2145 #define _BOREN_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
2146 #define _BOR_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
2147 #define _BOREN_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
2148 #define _BOR_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
2149 #define _BOREN_ON 0x3FFF // BOR enabled.
2150 #define _BOR_ON 0x3FFF // BOR enabled.
2151 #define _IESO_OFF 0x3BFF // Internal/External Switchover mode is disabled.
2152 #define _IESO_ON 0x3FFF // Internal/External Switchover mode is enabled.
2153 #define _FCMEN_OFF 0x37FF // Fail-Safe Clock Monitor is disabled.
2154 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
2155 #define _LVP_OFF 0x2FFF // RB3 pin has digital I/O, HV on MCLR must be used for programming.
2156 #define _LVP_ON 0x3FFF // RB3/PGM pin has PGM function, low voltage programming enabled.
2157 #define _DEBUG_ON 0x1FFF // In_Circuit Debugger enabled, RB6/ICSPCLK and RB7/ICSPDAT are dedicated to the debugger.
2158 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, RB6/ICSPCLK and RB7/ICSPDAT are general purpose I/O pins.
2160 //----------------------------- CONFIG2 Options -------------------------------
2162 #define _BOR4V_BOR21V 0x3EFF // Brown-out Reset set to 2.1V.
2163 #define _BOR21V 0x3EFF // Brown-out Reset set to 2.1V.
2164 #define _BOR4V_BOR40V 0x3FFF // Brown-out Reset set to 4.0V.
2165 #define _BOR40V 0x3FFF // Brown-out Reset set to 4.0V.
2166 #define _WRT_HALF 0x39FF // 0000h to 03FFh write protected, 0400h to 07FFh may be modified by EECON control.
2167 #define _WRT_1FOURTH 0x3BFF // 0000h to 00FFh write protected, 0100h to 07FFh may be modified by EECON control.
2168 #define _WRT_OFF 0x3FFF // Write protection off.
2170 //==============================================================================
2172 #define _DEVID1 0x2006
2174 #define _IDLOC0 0x2000
2175 #define _IDLOC1 0x2001
2176 #define _IDLOC2 0x2002
2177 #define _IDLOC3 0x2003
2179 //==============================================================================
2181 #ifndef NO_BIT_DEFINES
2183 #define ADON ADCON0bits.ADON // bit 0
2184 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
2185 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
2186 #define NOT_DONE ADCON0bits.NOT_DONE // bit 1, shadows bit in ADCON0bits
2187 #define GO_DONE ADCON0bits.GO_DONE // bit 1, shadows bit in ADCON0bits
2188 #define CHS0 ADCON0bits.CHS0 // bit 2
2189 #define CHS1 ADCON0bits.CHS1 // bit 3
2190 #define CHS2 ADCON0bits.CHS2 // bit 4
2191 #define CHS3 ADCON0bits.CHS3 // bit 5
2192 #define ADCS0 ADCON0bits.ADCS0 // bit 6
2193 #define ADCS1 ADCON0bits.ADCS1 // bit 7
2195 #define VCFG0 ADCON1bits.VCFG0 // bit 4
2196 #define VCFG1 ADCON1bits.VCFG1 // bit 5
2197 #define ADFM ADCON1bits.ADFM // bit 7
2199 #define ANS0 ANSELbits.ANS0 // bit 0
2200 #define ANS1 ANSELbits.ANS1 // bit 1
2201 #define ANS2 ANSELbits.ANS2 // bit 2
2202 #define ANS3 ANSELbits.ANS3 // bit 3
2203 #define ANS4 ANSELbits.ANS4 // bit 4
2205 #define ANS8 ANSELHbits.ANS8 // bit 0
2206 #define ANS9 ANSELHbits.ANS9 // bit 1
2207 #define ANS10 ANSELHbits.ANS10 // bit 2
2208 #define ANS11 ANSELHbits.ANS11 // bit 3
2209 #define ANS12 ANSELHbits.ANS12 // bit 4
2210 #define ANS13 ANSELHbits.ANS13 // bit 5
2212 #define ABDEN BAUDCTLbits.ABDEN // bit 0
2213 #define WUE BAUDCTLbits.WUE // bit 1
2214 #define BRG16 BAUDCTLbits.BRG16 // bit 3
2215 #define SCKP BAUDCTLbits.SCKP // bit 4
2216 #define RCIDL BAUDCTLbits.RCIDL // bit 6
2217 #define ABDOVF BAUDCTLbits.ABDOVF // bit 7
2219 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
2220 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
2221 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
2222 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
2223 #define DC1B0 CCP1CONbits.DC1B0 // bit 4, shadows bit in CCP1CONbits
2224 #define CCP1Y CCP1CONbits.CCP1Y // bit 4, shadows bit in CCP1CONbits
2225 #define DC1B1 CCP1CONbits.DC1B1 // bit 5, shadows bit in CCP1CONbits
2226 #define CCP1X CCP1CONbits.CCP1X // bit 5, shadows bit in CCP1CONbits
2227 #define P1M0 CCP1CONbits.P1M0 // bit 6
2228 #define P1M1 CCP1CONbits.P1M1 // bit 7
2230 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
2231 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
2232 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
2233 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
2234 #define DC2B0 CCP2CONbits.DC2B0 // bit 4, shadows bit in CCP2CONbits
2235 #define CCP2Y CCP2CONbits.CCP2Y // bit 4, shadows bit in CCP2CONbits
2236 #define DC2B1 CCP2CONbits.DC2B1 // bit 5, shadows bit in CCP2CONbits
2237 #define CCP2X CCP2CONbits.CCP2X // bit 5, shadows bit in CCP2CONbits
2239 #define C1CH0 CM1CON0bits.C1CH0 // bit 0
2240 #define C1CH1 CM1CON0bits.C1CH1 // bit 1
2241 #define C1R CM1CON0bits.C1R // bit 2
2242 #define C1POL CM1CON0bits.C1POL // bit 4
2243 #define C1OE CM1CON0bits.C1OE // bit 5
2244 #define C1OUT CM1CON0bits.C1OUT // bit 6
2245 #define C1ON CM1CON0bits.C1ON // bit 7
2247 #define C2CH0 CM2CON0bits.C2CH0 // bit 0
2248 #define C2CH1 CM2CON0bits.C2CH1 // bit 1
2249 #define C2R CM2CON0bits.C2R // bit 2
2250 #define C2POL CM2CON0bits.C2POL // bit 4
2251 #define C2OE CM2CON0bits.C2OE // bit 5
2252 #define C2OUT CM2CON0bits.C2OUT // bit 6
2253 #define C2ON CM2CON0bits.C2ON // bit 7
2255 #define C2SYNC CM2CON1bits.C2SYNC // bit 0
2256 #define T1GSS CM2CON1bits.T1GSS // bit 1
2257 #define C2RSEL CM2CON1bits.C2RSEL // bit 4
2258 #define C1RSEL CM2CON1bits.C1RSEL // bit 5
2259 #define MC2OUT CM2CON1bits.MC2OUT // bit 6
2260 #define MC1OUT CM2CON1bits.MC1OUT // bit 7
2262 #define PSSBD0 ECCPASbits.PSSBD0 // bit 0
2263 #define PSSBD1 ECCPASbits.PSSBD1 // bit 1
2264 #define PSSAC0 ECCPASbits.PSSAC0 // bit 2
2265 #define PSSAC1 ECCPASbits.PSSAC1 // bit 3
2266 #define ECCPAS0 ECCPASbits.ECCPAS0 // bit 4
2267 #define ECCPAS1 ECCPASbits.ECCPAS1 // bit 5
2268 #define ECCPAS2 ECCPASbits.ECCPAS2 // bit 6
2269 #define ECCPASE ECCPASbits.ECCPASE // bit 7
2271 #define RD EECON1bits.RD // bit 0
2272 #define WR EECON1bits.WR // bit 1
2273 #define WREN EECON1bits.WREN // bit 2
2274 #define WRERR EECON1bits.WRERR // bit 3
2275 #define EEPGD EECON1bits.EEPGD // bit 7
2277 #define RBIF INTCONbits.RBIF // bit 0
2278 #define INTF INTCONbits.INTF // bit 1
2279 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
2280 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
2281 #define RBIE INTCONbits.RBIE // bit 3
2282 #define INTE INTCONbits.INTE // bit 4
2283 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
2284 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
2285 #define PEIE INTCONbits.PEIE // bit 6
2286 #define GIE INTCONbits.GIE // bit 7
2288 #define IOCB0 IOCBbits.IOCB0 // bit 0
2289 #define IOCB1 IOCBbits.IOCB1 // bit 1
2290 #define IOCB2 IOCBbits.IOCB2 // bit 2
2291 #define IOCB3 IOCBbits.IOCB3 // bit 3
2292 #define IOCB4 IOCBbits.IOCB4 // bit 4
2293 #define IOCB5 IOCBbits.IOCB5 // bit 5
2294 #define IOCB6 IOCBbits.IOCB6 // bit 6
2295 #define IOCB7 IOCBbits.IOCB7 // bit 7
2297 #define MSK0 MSKbits.MSK0 // bit 0
2298 #define MSK1 MSKbits.MSK1 // bit 1
2299 #define MSK2 MSKbits.MSK2 // bit 2
2300 #define MSK3 MSKbits.MSK3 // bit 3
2301 #define MSK4 MSKbits.MSK4 // bit 4
2302 #define MSK5 MSKbits.MSK5 // bit 5
2303 #define MSK6 MSKbits.MSK6 // bit 6
2304 #define MSK7 MSKbits.MSK7 // bit 7
2306 #define PS0 OPTION_REGbits.PS0 // bit 0
2307 #define PS1 OPTION_REGbits.PS1 // bit 1
2308 #define PS2 OPTION_REGbits.PS2 // bit 2
2309 #define PSA OPTION_REGbits.PSA // bit 3
2310 #define T0SE OPTION_REGbits.T0SE // bit 4
2311 #define T0CS OPTION_REGbits.T0CS // bit 5
2312 #define INTEDG OPTION_REGbits.INTEDG // bit 6
2313 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
2315 #define SCS OSCCONbits.SCS // bit 0
2316 #define LTS OSCCONbits.LTS // bit 1
2317 #define HTS OSCCONbits.HTS // bit 2
2318 #define OSTS OSCCONbits.OSTS // bit 3
2319 #define IRCF0 OSCCONbits.IRCF0 // bit 4
2320 #define IRCF1 OSCCONbits.IRCF1 // bit 5
2321 #define IRCF2 OSCCONbits.IRCF2 // bit 6
2323 #define TUN0 OSCTUNEbits.TUN0 // bit 0
2324 #define TUN1 OSCTUNEbits.TUN1 // bit 1
2325 #define TUN2 OSCTUNEbits.TUN2 // bit 2
2326 #define TUN3 OSCTUNEbits.TUN3 // bit 3
2327 #define TUN4 OSCTUNEbits.TUN4 // bit 4
2329 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
2330 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
2331 #define NOT_POR PCONbits.NOT_POR // bit 1
2332 #define SBOREN PCONbits.SBOREN // bit 4
2333 #define ULPWUE PCONbits.ULPWUE // bit 5
2335 #define TMR1IE PIE1bits.TMR1IE // bit 0
2336 #define TMR2IE PIE1bits.TMR2IE // bit 1
2337 #define CCP1IE PIE1bits.CCP1IE // bit 2
2338 #define SSPIE PIE1bits.SSPIE // bit 3
2339 #define TXIE PIE1bits.TXIE // bit 4
2340 #define RCIE PIE1bits.RCIE // bit 5
2341 #define ADIE PIE1bits.ADIE // bit 6
2343 #define CCP2IE PIE2bits.CCP2IE // bit 0
2344 #define ULPWUIE PIE2bits.ULPWUIE // bit 2
2345 #define BCLIE PIE2bits.BCLIE // bit 3
2346 #define EEIE PIE2bits.EEIE // bit 4
2347 #define C1IE PIE2bits.C1IE // bit 5
2348 #define C2IE PIE2bits.C2IE // bit 6
2349 #define OSFIE PIE2bits.OSFIE // bit 7
2351 #define TMR1IF PIR1bits.TMR1IF // bit 0
2352 #define TMR2IF PIR1bits.TMR2IF // bit 1
2353 #define CCP1IF PIR1bits.CCP1IF // bit 2
2354 #define SSPIF PIR1bits.SSPIF // bit 3
2355 #define TXIF PIR1bits.TXIF // bit 4
2356 #define RCIF PIR1bits.RCIF // bit 5
2357 #define ADIF PIR1bits.ADIF // bit 6
2359 #define CCP2IF PIR2bits.CCP2IF // bit 0
2360 #define ULPWUIF PIR2bits.ULPWUIF // bit 2
2361 #define BCLIF PIR2bits.BCLIF // bit 3
2362 #define EEIF PIR2bits.EEIF // bit 4
2363 #define C1IF PIR2bits.C1IF // bit 5
2364 #define C2IF PIR2bits.C2IF // bit 6
2365 #define OSFIF PIR2bits.OSFIF // bit 7
2367 #define RA0 PORTAbits.RA0 // bit 0
2368 #define RA1 PORTAbits.RA1 // bit 1
2369 #define RA2 PORTAbits.RA2 // bit 2
2370 #define RA3 PORTAbits.RA3 // bit 3
2371 #define RA4 PORTAbits.RA4 // bit 4
2372 #define RA5 PORTAbits.RA5 // bit 5
2373 #define RA6 PORTAbits.RA6 // bit 6
2374 #define RA7 PORTAbits.RA7 // bit 7
2376 #define RB0 PORTBbits.RB0 // bit 0
2377 #define RB1 PORTBbits.RB1 // bit 1
2378 #define RB2 PORTBbits.RB2 // bit 2
2379 #define RB3 PORTBbits.RB3 // bit 3
2380 #define RB4 PORTBbits.RB4 // bit 4
2381 #define RB5 PORTBbits.RB5 // bit 5
2382 #define RB6 PORTBbits.RB6 // bit 6
2383 #define RB7 PORTBbits.RB7 // bit 7
2385 #define RC0 PORTCbits.RC0 // bit 0
2386 #define RC1 PORTCbits.RC1 // bit 1
2387 #define RC2 PORTCbits.RC2 // bit 2
2388 #define RC3 PORTCbits.RC3 // bit 3
2389 #define RC4 PORTCbits.RC4 // bit 4
2390 #define RC5 PORTCbits.RC5 // bit 5
2391 #define RC6 PORTCbits.RC6 // bit 6
2392 #define RC7 PORTCbits.RC7 // bit 7
2394 #define RE3 PORTEbits.RE3 // bit 3
2396 #define STRA PSTRCONbits.STRA // bit 0
2397 #define STRB PSTRCONbits.STRB // bit 1
2398 #define STRC PSTRCONbits.STRC // bit 2
2399 #define STRD PSTRCONbits.STRD // bit 3
2400 #define STRSYNC PSTRCONbits.STRSYNC // bit 4
2402 #define PDC0 PWM1CONbits.PDC0 // bit 0
2403 #define PDC1 PWM1CONbits.PDC1 // bit 1
2404 #define PDC2 PWM1CONbits.PDC2 // bit 2
2405 #define PDC3 PWM1CONbits.PDC3 // bit 3
2406 #define PDC4 PWM1CONbits.PDC4 // bit 4
2407 #define PDC5 PWM1CONbits.PDC5 // bit 5
2408 #define PDC6 PWM1CONbits.PDC6 // bit 6
2409 #define PRSEN PWM1CONbits.PRSEN // bit 7
2411 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
2412 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
2413 #define OERR RCSTAbits.OERR // bit 1
2414 #define FERR RCSTAbits.FERR // bit 2
2415 #define ADDEN RCSTAbits.ADDEN // bit 3
2416 #define CREN RCSTAbits.CREN // bit 4
2417 #define SREN RCSTAbits.SREN // bit 5
2418 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
2419 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
2420 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
2421 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
2422 #define SPEN RCSTAbits.SPEN // bit 7
2424 #define BRG0 SPBRGbits.BRG0 // bit 0
2425 #define BRG1 SPBRGbits.BRG1 // bit 1
2426 #define BRG2 SPBRGbits.BRG2 // bit 2
2427 #define BRG3 SPBRGbits.BRG3 // bit 3
2428 #define BRG4 SPBRGbits.BRG4 // bit 4
2429 #define BRG5 SPBRGbits.BRG5 // bit 5
2430 #define BRG6 SPBRGbits.BRG6 // bit 6
2431 #define BRG7 SPBRGbits.BRG7 // bit 7
2433 #define BRG8 SPBRGHbits.BRG8 // bit 0
2434 #define BRG9 SPBRGHbits.BRG9 // bit 1
2435 #define BRG10 SPBRGHbits.BRG10 // bit 2
2436 #define BRG11 SPBRGHbits.BRG11 // bit 3
2437 #define BRG12 SPBRGHbits.BRG12 // bit 4
2438 #define BRG13 SPBRGHbits.BRG13 // bit 5
2439 #define BRG14 SPBRGHbits.BRG14 // bit 6
2440 #define BRG15 SPBRGHbits.BRG15 // bit 7
2442 #define FVREN SRCONbits.FVREN // bit 0
2443 #define PULSR SRCONbits.PULSR // bit 2
2444 #define PULSS SRCONbits.PULSS // bit 3
2445 #define C2REN SRCONbits.C2REN // bit 4
2446 #define C1SEN SRCONbits.C1SEN // bit 5
2447 #define SR0 SRCONbits.SR0 // bit 6
2448 #define SR1 SRCONbits.SR1 // bit 7
2450 #define SSPM0 SSPCONbits.SSPM0 // bit 0
2451 #define SSPM1 SSPCONbits.SSPM1 // bit 1
2452 #define SSPM2 SSPCONbits.SSPM2 // bit 2
2453 #define SSPM3 SSPCONbits.SSPM3 // bit 3
2454 #define CKP SSPCONbits.CKP // bit 4
2455 #define SSPEN SSPCONbits.SSPEN // bit 5
2456 #define SSPOV SSPCONbits.SSPOV // bit 6
2457 #define WCOL SSPCONbits.WCOL // bit 7
2459 #define SEN SSPCON2bits.SEN // bit 0
2460 #define RSEN SSPCON2bits.RSEN // bit 1
2461 #define PEN SSPCON2bits.PEN // bit 2
2462 #define RCEN SSPCON2bits.RCEN // bit 3
2463 #define ACKEN SSPCON2bits.ACKEN // bit 4
2464 #define ACKDT SSPCON2bits.ACKDT // bit 5
2465 #define ACKSTAT SSPCON2bits.ACKSTAT // bit 6
2466 #define GCEN SSPCON2bits.GCEN // bit 7
2468 #define BF SSPSTATbits.BF // bit 0
2469 #define UA SSPSTATbits.UA // bit 1
2470 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
2471 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
2472 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
2473 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
2474 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
2475 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
2476 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
2477 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
2478 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
2479 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
2480 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
2481 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
2482 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
2483 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
2484 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
2485 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
2486 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
2487 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
2488 #define CKE SSPSTATbits.CKE // bit 6
2489 #define SMP SSPSTATbits.SMP // bit 7
2491 #define C STATUSbits.C // bit 0
2492 #define DC STATUSbits.DC // bit 1
2493 #define Z STATUSbits.Z // bit 2
2494 #define NOT_PD STATUSbits.NOT_PD // bit 3
2495 #define NOT_TO STATUSbits.NOT_TO // bit 4
2496 #define RP0 STATUSbits.RP0 // bit 5
2497 #define RP1 STATUSbits.RP1 // bit 6
2498 #define IRP STATUSbits.IRP // bit 7
2500 #define TMR1ON T1CONbits.TMR1ON // bit 0
2501 #define TMR1CS T1CONbits.TMR1CS // bit 1
2502 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
2503 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
2504 #define T1SYNC T1CONbits.T1SYNC // bit 2, shadows bit in T1CONbits
2505 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
2506 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
2507 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
2508 #define TMR1GE T1CONbits.TMR1GE // bit 6
2509 #define T1GINV T1CONbits.T1GINV // bit 7, shadows bit in T1CONbits
2510 #define T1GIV T1CONbits.T1GIV // bit 7, shadows bit in T1CONbits
2512 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
2513 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
2514 #define TMR2ON T2CONbits.TMR2ON // bit 2
2515 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
2516 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
2517 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
2518 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
2520 #define TRISA0 TRISAbits.TRISA0 // bit 0
2521 #define TRISA1 TRISAbits.TRISA1 // bit 1
2522 #define TRISA2 TRISAbits.TRISA2 // bit 2
2523 #define TRISA3 TRISAbits.TRISA3 // bit 3
2524 #define TRISA4 TRISAbits.TRISA4 // bit 4
2525 #define TRISA5 TRISAbits.TRISA5 // bit 5
2526 #define TRISA6 TRISAbits.TRISA6 // bit 6
2527 #define TRISA7 TRISAbits.TRISA7 // bit 7
2529 #define TRISB0 TRISBbits.TRISB0 // bit 0
2530 #define TRISB1 TRISBbits.TRISB1 // bit 1
2531 #define TRISB2 TRISBbits.TRISB2 // bit 2
2532 #define TRISB3 TRISBbits.TRISB3 // bit 3
2533 #define TRISB4 TRISBbits.TRISB4 // bit 4
2534 #define TRISB5 TRISBbits.TRISB5 // bit 5
2535 #define TRISB6 TRISBbits.TRISB6 // bit 6
2536 #define TRISB7 TRISBbits.TRISB7 // bit 7
2538 #define TRISC0 TRISCbits.TRISC0 // bit 0
2539 #define TRISC1 TRISCbits.TRISC1 // bit 1
2540 #define TRISC2 TRISCbits.TRISC2 // bit 2
2541 #define TRISC3 TRISCbits.TRISC3 // bit 3
2542 #define TRISC4 TRISCbits.TRISC4 // bit 4
2543 #define TRISC5 TRISCbits.TRISC5 // bit 5
2544 #define TRISC6 TRISCbits.TRISC6 // bit 6
2545 #define TRISC7 TRISCbits.TRISC7 // bit 7
2547 #define TRISE3 TRISEbits.TRISE3 // bit 3
2549 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
2550 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
2551 #define TRMT TXSTAbits.TRMT // bit 1
2552 #define BRGH TXSTAbits.BRGH // bit 2
2553 #define SENDB TXSTAbits.SENDB // bit 3
2554 #define SYNC TXSTAbits.SYNC // bit 4
2555 #define TXEN TXSTAbits.TXEN // bit 5
2556 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
2557 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
2558 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
2559 #define CSRC TXSTAbits.CSRC // bit 7
2561 #define VR0 VRCONbits.VR0 // bit 0
2562 #define VR1 VRCONbits.VR1 // bit 1
2563 #define VR2 VRCONbits.VR2 // bit 2
2564 #define VR3 VRCONbits.VR3 // bit 3
2565 #define VRSS VRCONbits.VRSS // bit 4
2566 #define VRR VRCONbits.VRR // bit 5
2567 #define VROE VRCONbits.VROE // bit 6
2568 #define VREN VRCONbits.VREN // bit 7
2570 #define SWDTEN WDTCONbits.SWDTEN // bit 0
2571 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
2572 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
2573 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
2574 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
2576 #define WPUB0 WPUBbits.WPUB0 // bit 0
2577 #define WPUB1 WPUBbits.WPUB1 // bit 1
2578 #define WPUB2 WPUBbits.WPUB2 // bit 2
2579 #define WPUB3 WPUBbits.WPUB3 // bit 3
2580 #define WPUB4 WPUBbits.WPUB4 // bit 4
2581 #define WPUB5 WPUBbits.WPUB5 // bit 5
2582 #define WPUB6 WPUBbits.WPUB6 // bit 6
2583 #define WPUB7 WPUBbits.WPUB7 // bit 7
2585 #endif // #ifndef NO_BIT_DEFINES
2587 #endif // #ifndef __PIC16F882_H__