Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f884.h
blobde315e84babcb264c2fa10de0bbcbc4d5518ffc3
1 /*
2 * This declarations of the PIC16F884 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 __PIC16F884_H__
26 #define __PIC16F884_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 PORTD_ADDR 0x0008
45 #define PORTE_ADDR 0x0009
46 #define PCLATH_ADDR 0x000A
47 #define INTCON_ADDR 0x000B
48 #define PIR1_ADDR 0x000C
49 #define PIR2_ADDR 0x000D
50 #define TMR1_ADDR 0x000E
51 #define TMR1L_ADDR 0x000E
52 #define TMR1H_ADDR 0x000F
53 #define T1CON_ADDR 0x0010
54 #define TMR2_ADDR 0x0011
55 #define T2CON_ADDR 0x0012
56 #define SSPBUF_ADDR 0x0013
57 #define SSPCON_ADDR 0x0014
58 #define CCPR1_ADDR 0x0015
59 #define CCPR1L_ADDR 0x0015
60 #define CCPR1H_ADDR 0x0016
61 #define CCP1CON_ADDR 0x0017
62 #define RCSTA_ADDR 0x0018
63 #define TXREG_ADDR 0x0019
64 #define RCREG_ADDR 0x001A
65 #define CCPR2_ADDR 0x001B
66 #define CCPR2L_ADDR 0x001B
67 #define CCPR2H_ADDR 0x001C
68 #define CCP2CON_ADDR 0x001D
69 #define ADRESH_ADDR 0x001E
70 #define ADCON0_ADDR 0x001F
71 #define OPTION_REG_ADDR 0x0081
72 #define TRISA_ADDR 0x0085
73 #define TRISB_ADDR 0x0086
74 #define TRISC_ADDR 0x0087
75 #define TRISD_ADDR 0x0088
76 #define TRISE_ADDR 0x0089
77 #define PIE1_ADDR 0x008C
78 #define PIE2_ADDR 0x008D
79 #define PCON_ADDR 0x008E
80 #define OSCCON_ADDR 0x008F
81 #define OSCTUNE_ADDR 0x0090
82 #define SSPCON2_ADDR 0x0091
83 #define PR2_ADDR 0x0092
84 #define MSK_ADDR 0x0093
85 #define SSPADD_ADDR 0x0093
86 #define SSPMSK_ADDR 0x0093
87 #define SSPSTAT_ADDR 0x0094
88 #define WPUB_ADDR 0x0095
89 #define IOCB_ADDR 0x0096
90 #define VRCON_ADDR 0x0097
91 #define TXSTA_ADDR 0x0098
92 #define SPBRG_ADDR 0x0099
93 #define SPBRGH_ADDR 0x009A
94 #define PWM1CON_ADDR 0x009B
95 #define ECCPAS_ADDR 0x009C
96 #define PSTRCON_ADDR 0x009D
97 #define ADRESL_ADDR 0x009E
98 #define ADCON1_ADDR 0x009F
99 #define WDTCON_ADDR 0x0105
100 #define CM1CON0_ADDR 0x0107
101 #define CM2CON0_ADDR 0x0108
102 #define CM2CON1_ADDR 0x0109
103 #define EEDAT_ADDR 0x010C
104 #define EEDATA_ADDR 0x010C
105 #define EEADR_ADDR 0x010D
106 #define EEDATH_ADDR 0x010E
107 #define EEADRH_ADDR 0x010F
108 #define SRCON_ADDR 0x0185
109 #define BAUDCTL_ADDR 0x0187
110 #define ANSEL_ADDR 0x0188
111 #define ANSELH_ADDR 0x0189
112 #define EECON1_ADDR 0x018C
113 #define EECON2_ADDR 0x018D
115 #endif // #ifndef NO_ADDR_DEFINES
117 //==============================================================================
119 // Register Definitions
121 //==============================================================================
123 extern __at(0x0000) __sfr INDF;
124 extern __at(0x0001) __sfr TMR0;
125 extern __at(0x0002) __sfr PCL;
127 //==============================================================================
128 // STATUS Bits
130 extern __at(0x0003) __sfr STATUS;
132 typedef union
134 struct
136 unsigned C : 1;
137 unsigned DC : 1;
138 unsigned Z : 1;
139 unsigned NOT_PD : 1;
140 unsigned NOT_TO : 1;
141 unsigned RP0 : 1;
142 unsigned RP1 : 1;
143 unsigned IRP : 1;
146 struct
148 unsigned : 5;
149 unsigned RP : 2;
150 unsigned : 1;
152 } __STATUSbits_t;
154 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
156 #define _C 0x01
157 #define _DC 0x02
158 #define _Z 0x04
159 #define _NOT_PD 0x08
160 #define _NOT_TO 0x10
161 #define _RP0 0x20
162 #define _RP1 0x40
163 #define _IRP 0x80
165 //==============================================================================
167 extern __at(0x0004) __sfr FSR;
169 //==============================================================================
170 // PORTA Bits
172 extern __at(0x0005) __sfr PORTA;
174 typedef struct
176 unsigned RA0 : 1;
177 unsigned RA1 : 1;
178 unsigned RA2 : 1;
179 unsigned RA3 : 1;
180 unsigned RA4 : 1;
181 unsigned RA5 : 1;
182 unsigned RA6 : 1;
183 unsigned RA7 : 1;
184 } __PORTAbits_t;
186 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
188 #define _RA0 0x01
189 #define _RA1 0x02
190 #define _RA2 0x04
191 #define _RA3 0x08
192 #define _RA4 0x10
193 #define _RA5 0x20
194 #define _RA6 0x40
195 #define _RA7 0x80
197 //==============================================================================
200 //==============================================================================
201 // PORTB Bits
203 extern __at(0x0006) __sfr PORTB;
205 typedef struct
207 unsigned RB0 : 1;
208 unsigned RB1 : 1;
209 unsigned RB2 : 1;
210 unsigned RB3 : 1;
211 unsigned RB4 : 1;
212 unsigned RB5 : 1;
213 unsigned RB6 : 1;
214 unsigned RB7 : 1;
215 } __PORTBbits_t;
217 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
219 #define _RB0 0x01
220 #define _RB1 0x02
221 #define _RB2 0x04
222 #define _RB3 0x08
223 #define _RB4 0x10
224 #define _RB5 0x20
225 #define _RB6 0x40
226 #define _RB7 0x80
228 //==============================================================================
231 //==============================================================================
232 // PORTC Bits
234 extern __at(0x0007) __sfr PORTC;
236 typedef struct
238 unsigned RC0 : 1;
239 unsigned RC1 : 1;
240 unsigned RC2 : 1;
241 unsigned RC3 : 1;
242 unsigned RC4 : 1;
243 unsigned RC5 : 1;
244 unsigned RC6 : 1;
245 unsigned RC7 : 1;
246 } __PORTCbits_t;
248 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
250 #define _RC0 0x01
251 #define _RC1 0x02
252 #define _RC2 0x04
253 #define _RC3 0x08
254 #define _RC4 0x10
255 #define _RC5 0x20
256 #define _RC6 0x40
257 #define _RC7 0x80
259 //==============================================================================
262 //==============================================================================
263 // PORTD Bits
265 extern __at(0x0008) __sfr PORTD;
267 typedef struct
269 unsigned RD0 : 1;
270 unsigned RD1 : 1;
271 unsigned RD2 : 1;
272 unsigned RD3 : 1;
273 unsigned RD4 : 1;
274 unsigned RD5 : 1;
275 unsigned RD6 : 1;
276 unsigned RD7 : 1;
277 } __PORTDbits_t;
279 extern __at(0x0008) volatile __PORTDbits_t PORTDbits;
281 #define _RD0 0x01
282 #define _RD1 0x02
283 #define _RD2 0x04
284 #define _RD3 0x08
285 #define _RD4 0x10
286 #define _RD5 0x20
287 #define _RD6 0x40
288 #define _RD7 0x80
290 //==============================================================================
293 //==============================================================================
294 // PORTE Bits
296 extern __at(0x0009) __sfr PORTE;
298 typedef union
300 struct
302 unsigned RE0 : 1;
303 unsigned RE1 : 1;
304 unsigned RE2 : 1;
305 unsigned RE3 : 1;
306 unsigned : 1;
307 unsigned : 1;
308 unsigned : 1;
309 unsigned : 1;
312 struct
314 unsigned RE : 4;
315 unsigned : 4;
317 } __PORTEbits_t;
319 extern __at(0x0009) volatile __PORTEbits_t PORTEbits;
321 #define _RE0 0x01
322 #define _RE1 0x02
323 #define _RE2 0x04
324 #define _RE3 0x08
326 //==============================================================================
328 extern __at(0x000A) __sfr PCLATH;
330 //==============================================================================
331 // INTCON Bits
333 extern __at(0x000B) __sfr INTCON;
335 typedef union
337 struct
339 unsigned RBIF : 1;
340 unsigned INTF : 1;
341 unsigned T0IF : 1;
342 unsigned RBIE : 1;
343 unsigned INTE : 1;
344 unsigned T0IE : 1;
345 unsigned PEIE : 1;
346 unsigned GIE : 1;
349 struct
351 unsigned : 1;
352 unsigned : 1;
353 unsigned TMR0IF : 1;
354 unsigned : 1;
355 unsigned : 1;
356 unsigned TMR0IE : 1;
357 unsigned : 1;
358 unsigned : 1;
360 } __INTCONbits_t;
362 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
364 #define _RBIF 0x01
365 #define _INTF 0x02
366 #define _T0IF 0x04
367 #define _TMR0IF 0x04
368 #define _RBIE 0x08
369 #define _INTE 0x10
370 #define _T0IE 0x20
371 #define _TMR0IE 0x20
372 #define _PEIE 0x40
373 #define _GIE 0x80
375 //==============================================================================
378 //==============================================================================
379 // PIR1 Bits
381 extern __at(0x000C) __sfr PIR1;
383 typedef struct
385 unsigned TMR1IF : 1;
386 unsigned TMR2IF : 1;
387 unsigned CCP1IF : 1;
388 unsigned SSPIF : 1;
389 unsigned TXIF : 1;
390 unsigned RCIF : 1;
391 unsigned ADIF : 1;
392 unsigned : 1;
393 } __PIR1bits_t;
395 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
397 #define _TMR1IF 0x01
398 #define _TMR2IF 0x02
399 #define _CCP1IF 0x04
400 #define _SSPIF 0x08
401 #define _TXIF 0x10
402 #define _RCIF 0x20
403 #define _ADIF 0x40
405 //==============================================================================
408 //==============================================================================
409 // PIR2 Bits
411 extern __at(0x000D) __sfr PIR2;
413 typedef struct
415 unsigned CCP2IF : 1;
416 unsigned : 1;
417 unsigned ULPWUIF : 1;
418 unsigned BCLIF : 1;
419 unsigned EEIF : 1;
420 unsigned C1IF : 1;
421 unsigned C2IF : 1;
422 unsigned OSFIF : 1;
423 } __PIR2bits_t;
425 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
427 #define _CCP2IF 0x01
428 #define _ULPWUIF 0x04
429 #define _BCLIF 0x08
430 #define _EEIF 0x10
431 #define _C1IF 0x20
432 #define _C2IF 0x40
433 #define _OSFIF 0x80
435 //==============================================================================
437 extern __at(0x000E) __sfr TMR1;
438 extern __at(0x000E) __sfr TMR1L;
439 extern __at(0x000F) __sfr TMR1H;
441 //==============================================================================
442 // T1CON Bits
444 extern __at(0x0010) __sfr T1CON;
446 typedef union
448 struct
450 unsigned TMR1ON : 1;
451 unsigned TMR1CS : 1;
452 unsigned NOT_T1SYNC : 1;
453 unsigned T1OSCEN : 1;
454 unsigned T1CKPS0 : 1;
455 unsigned T1CKPS1 : 1;
456 unsigned TMR1GE : 1;
457 unsigned T1GINV : 1;
460 struct
462 unsigned : 1;
463 unsigned : 1;
464 unsigned T1INSYNC : 1;
465 unsigned : 1;
466 unsigned : 1;
467 unsigned : 1;
468 unsigned : 1;
469 unsigned T1GIV : 1;
472 struct
474 unsigned : 1;
475 unsigned : 1;
476 unsigned T1SYNC : 1;
477 unsigned : 1;
478 unsigned : 1;
479 unsigned : 1;
480 unsigned : 1;
481 unsigned : 1;
484 struct
486 unsigned : 4;
487 unsigned T1CKPS : 2;
488 unsigned : 2;
490 } __T1CONbits_t;
492 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
494 #define _TMR1ON 0x01
495 #define _TMR1CS 0x02
496 #define _NOT_T1SYNC 0x04
497 #define _T1INSYNC 0x04
498 #define _T1SYNC 0x04
499 #define _T1OSCEN 0x08
500 #define _T1CKPS0 0x10
501 #define _T1CKPS1 0x20
502 #define _TMR1GE 0x40
503 #define _T1GINV 0x80
504 #define _T1GIV 0x80
506 //==============================================================================
508 extern __at(0x0011) __sfr TMR2;
510 //==============================================================================
511 // T2CON Bits
513 extern __at(0x0012) __sfr T2CON;
515 typedef union
517 struct
519 unsigned T2CKPS0 : 1;
520 unsigned T2CKPS1 : 1;
521 unsigned TMR2ON : 1;
522 unsigned TOUTPS0 : 1;
523 unsigned TOUTPS1 : 1;
524 unsigned TOUTPS2 : 1;
525 unsigned TOUTPS3 : 1;
526 unsigned : 1;
529 struct
531 unsigned T2CKPS : 2;
532 unsigned : 6;
535 struct
537 unsigned : 3;
538 unsigned TOUTPS : 4;
539 unsigned : 1;
541 } __T2CONbits_t;
543 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
545 #define _T2CKPS0 0x01
546 #define _T2CKPS1 0x02
547 #define _TMR2ON 0x04
548 #define _TOUTPS0 0x08
549 #define _TOUTPS1 0x10
550 #define _TOUTPS2 0x20
551 #define _TOUTPS3 0x40
553 //==============================================================================
555 extern __at(0x0013) __sfr SSPBUF;
557 //==============================================================================
558 // SSPCON Bits
560 extern __at(0x0014) __sfr SSPCON;
562 typedef union
564 struct
566 unsigned SSPM0 : 1;
567 unsigned SSPM1 : 1;
568 unsigned SSPM2 : 1;
569 unsigned SSPM3 : 1;
570 unsigned CKP : 1;
571 unsigned SSPEN : 1;
572 unsigned SSPOV : 1;
573 unsigned WCOL : 1;
576 struct
578 unsigned SSPM : 4;
579 unsigned : 4;
581 } __SSPCONbits_t;
583 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
585 #define _SSPM0 0x01
586 #define _SSPM1 0x02
587 #define _SSPM2 0x04
588 #define _SSPM3 0x08
589 #define _CKP 0x10
590 #define _SSPEN 0x20
591 #define _SSPOV 0x40
592 #define _WCOL 0x80
594 //==============================================================================
596 extern __at(0x0015) __sfr CCPR1;
597 extern __at(0x0015) __sfr CCPR1L;
598 extern __at(0x0016) __sfr CCPR1H;
600 //==============================================================================
601 // CCP1CON Bits
603 extern __at(0x0017) __sfr CCP1CON;
605 typedef union
607 struct
609 unsigned CCP1M0 : 1;
610 unsigned CCP1M1 : 1;
611 unsigned CCP1M2 : 1;
612 unsigned CCP1M3 : 1;
613 unsigned DC1B0 : 1;
614 unsigned DC1B1 : 1;
615 unsigned P1M0 : 1;
616 unsigned P1M1 : 1;
619 struct
621 unsigned : 1;
622 unsigned : 1;
623 unsigned : 1;
624 unsigned : 1;
625 unsigned CCP1Y : 1;
626 unsigned CCP1X : 1;
627 unsigned : 1;
628 unsigned : 1;
631 struct
633 unsigned CCP1M : 4;
634 unsigned : 4;
637 struct
639 unsigned : 4;
640 unsigned DC1B : 2;
641 unsigned : 2;
644 struct
646 unsigned : 6;
647 unsigned P1M : 2;
649 } __CCP1CONbits_t;
651 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
653 #define _CCP1M0 0x01
654 #define _CCP1M1 0x02
655 #define _CCP1M2 0x04
656 #define _CCP1M3 0x08
657 #define _DC1B0 0x10
658 #define _CCP1Y 0x10
659 #define _DC1B1 0x20
660 #define _CCP1X 0x20
661 #define _P1M0 0x40
662 #define _P1M1 0x80
664 //==============================================================================
667 //==============================================================================
668 // RCSTA Bits
670 extern __at(0x0018) __sfr RCSTA;
672 typedef union
674 struct
676 unsigned RX9D : 1;
677 unsigned OERR : 1;
678 unsigned FERR : 1;
679 unsigned ADDEN : 1;
680 unsigned CREN : 1;
681 unsigned SREN : 1;
682 unsigned RX9 : 1;
683 unsigned SPEN : 1;
686 struct
688 unsigned RCD8 : 1;
689 unsigned : 1;
690 unsigned : 1;
691 unsigned : 1;
692 unsigned : 1;
693 unsigned : 1;
694 unsigned RC9 : 1;
695 unsigned : 1;
698 struct
700 unsigned : 1;
701 unsigned : 1;
702 unsigned : 1;
703 unsigned : 1;
704 unsigned : 1;
705 unsigned : 1;
706 unsigned NOT_RC8 : 1;
707 unsigned : 1;
710 struct
712 unsigned : 1;
713 unsigned : 1;
714 unsigned : 1;
715 unsigned : 1;
716 unsigned : 1;
717 unsigned : 1;
718 unsigned RC8_9 : 1;
719 unsigned : 1;
721 } __RCSTAbits_t;
723 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
725 #define _RX9D 0x01
726 #define _RCD8 0x01
727 #define _OERR 0x02
728 #define _FERR 0x04
729 #define _ADDEN 0x08
730 #define _CREN 0x10
731 #define _SREN 0x20
732 #define _RX9 0x40
733 #define _RC9 0x40
734 #define _NOT_RC8 0x40
735 #define _RC8_9 0x40
736 #define _SPEN 0x80
738 //==============================================================================
740 extern __at(0x0019) __sfr TXREG;
741 extern __at(0x001A) __sfr RCREG;
742 extern __at(0x001B) __sfr CCPR2;
743 extern __at(0x001B) __sfr CCPR2L;
744 extern __at(0x001C) __sfr CCPR2H;
746 //==============================================================================
747 // CCP2CON Bits
749 extern __at(0x001D) __sfr CCP2CON;
751 typedef union
753 struct
755 unsigned CCP2M0 : 1;
756 unsigned CCP2M1 : 1;
757 unsigned CCP2M2 : 1;
758 unsigned CCP2M3 : 1;
759 unsigned DC2B0 : 1;
760 unsigned DC2B1 : 1;
761 unsigned : 1;
762 unsigned : 1;
765 struct
767 unsigned : 1;
768 unsigned : 1;
769 unsigned : 1;
770 unsigned : 1;
771 unsigned CCP2Y : 1;
772 unsigned CCP2X : 1;
773 unsigned : 1;
774 unsigned : 1;
777 struct
779 unsigned CCP2M : 4;
780 unsigned : 4;
783 struct
785 unsigned : 4;
786 unsigned DC2B : 2;
787 unsigned : 2;
789 } __CCP2CONbits_t;
791 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
793 #define _CCP2M0 0x01
794 #define _CCP2M1 0x02
795 #define _CCP2M2 0x04
796 #define _CCP2M3 0x08
797 #define _DC2B0 0x10
798 #define _CCP2Y 0x10
799 #define _DC2B1 0x20
800 #define _CCP2X 0x20
802 //==============================================================================
804 extern __at(0x001E) __sfr ADRESH;
806 //==============================================================================
807 // ADCON0 Bits
809 extern __at(0x001F) __sfr ADCON0;
811 typedef union
813 struct
815 unsigned ADON : 1;
816 unsigned GO_NOT_DONE : 1;
817 unsigned CHS0 : 1;
818 unsigned CHS1 : 1;
819 unsigned CHS2 : 1;
820 unsigned CHS3 : 1;
821 unsigned ADCS0 : 1;
822 unsigned ADCS1 : 1;
825 struct
827 unsigned : 1;
828 unsigned GO : 1;
829 unsigned : 1;
830 unsigned : 1;
831 unsigned : 1;
832 unsigned : 1;
833 unsigned : 1;
834 unsigned : 1;
837 struct
839 unsigned : 1;
840 unsigned NOT_DONE : 1;
841 unsigned : 1;
842 unsigned : 1;
843 unsigned : 1;
844 unsigned : 1;
845 unsigned : 1;
846 unsigned : 1;
849 struct
851 unsigned : 1;
852 unsigned GO_DONE : 1;
853 unsigned : 1;
854 unsigned : 1;
855 unsigned : 1;
856 unsigned : 1;
857 unsigned : 1;
858 unsigned : 1;
861 struct
863 unsigned : 2;
864 unsigned CHS : 4;
865 unsigned : 2;
868 struct
870 unsigned : 6;
871 unsigned ADCS : 2;
873 } __ADCON0bits_t;
875 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
877 #define _ADON 0x01
878 #define _GO_NOT_DONE 0x02
879 #define _GO 0x02
880 #define _NOT_DONE 0x02
881 #define _GO_DONE 0x02
882 #define _CHS0 0x04
883 #define _CHS1 0x08
884 #define _CHS2 0x10
885 #define _CHS3 0x20
886 #define _ADCS0 0x40
887 #define _ADCS1 0x80
889 //==============================================================================
892 //==============================================================================
893 // OPTION_REG Bits
895 extern __at(0x0081) __sfr OPTION_REG;
897 typedef union
899 struct
901 unsigned PS0 : 1;
902 unsigned PS1 : 1;
903 unsigned PS2 : 1;
904 unsigned PSA : 1;
905 unsigned T0SE : 1;
906 unsigned T0CS : 1;
907 unsigned INTEDG : 1;
908 unsigned NOT_RBPU : 1;
911 struct
913 unsigned PS : 3;
914 unsigned : 5;
916 } __OPTION_REGbits_t;
918 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
920 #define _PS0 0x01
921 #define _PS1 0x02
922 #define _PS2 0x04
923 #define _PSA 0x08
924 #define _T0SE 0x10
925 #define _T0CS 0x20
926 #define _INTEDG 0x40
927 #define _NOT_RBPU 0x80
929 //==============================================================================
932 //==============================================================================
933 // TRISA Bits
935 extern __at(0x0085) __sfr TRISA;
937 typedef struct
939 unsigned TRISA0 : 1;
940 unsigned TRISA1 : 1;
941 unsigned TRISA2 : 1;
942 unsigned TRISA3 : 1;
943 unsigned TRISA4 : 1;
944 unsigned TRISA5 : 1;
945 unsigned TRISA6 : 1;
946 unsigned TRISA7 : 1;
947 } __TRISAbits_t;
949 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
951 #define _TRISA0 0x01
952 #define _TRISA1 0x02
953 #define _TRISA2 0x04
954 #define _TRISA3 0x08
955 #define _TRISA4 0x10
956 #define _TRISA5 0x20
957 #define _TRISA6 0x40
958 #define _TRISA7 0x80
960 //==============================================================================
963 //==============================================================================
964 // TRISB Bits
966 extern __at(0x0086) __sfr TRISB;
968 typedef struct
970 unsigned TRISB0 : 1;
971 unsigned TRISB1 : 1;
972 unsigned TRISB2 : 1;
973 unsigned TRISB3 : 1;
974 unsigned TRISB4 : 1;
975 unsigned TRISB5 : 1;
976 unsigned TRISB6 : 1;
977 unsigned TRISB7 : 1;
978 } __TRISBbits_t;
980 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
982 #define _TRISB0 0x01
983 #define _TRISB1 0x02
984 #define _TRISB2 0x04
985 #define _TRISB3 0x08
986 #define _TRISB4 0x10
987 #define _TRISB5 0x20
988 #define _TRISB6 0x40
989 #define _TRISB7 0x80
991 //==============================================================================
994 //==============================================================================
995 // TRISC Bits
997 extern __at(0x0087) __sfr TRISC;
999 typedef struct
1001 unsigned TRISC0 : 1;
1002 unsigned TRISC1 : 1;
1003 unsigned TRISC2 : 1;
1004 unsigned TRISC3 : 1;
1005 unsigned TRISC4 : 1;
1006 unsigned TRISC5 : 1;
1007 unsigned TRISC6 : 1;
1008 unsigned TRISC7 : 1;
1009 } __TRISCbits_t;
1011 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
1013 #define _TRISC0 0x01
1014 #define _TRISC1 0x02
1015 #define _TRISC2 0x04
1016 #define _TRISC3 0x08
1017 #define _TRISC4 0x10
1018 #define _TRISC5 0x20
1019 #define _TRISC6 0x40
1020 #define _TRISC7 0x80
1022 //==============================================================================
1025 //==============================================================================
1026 // TRISD Bits
1028 extern __at(0x0088) __sfr TRISD;
1030 typedef struct
1032 unsigned TRISD0 : 1;
1033 unsigned TRISD1 : 1;
1034 unsigned TRISD2 : 1;
1035 unsigned TRISD3 : 1;
1036 unsigned TRISD4 : 1;
1037 unsigned TRISD5 : 1;
1038 unsigned TRISD6 : 1;
1039 unsigned TRISD7 : 1;
1040 } __TRISDbits_t;
1042 extern __at(0x0088) volatile __TRISDbits_t TRISDbits;
1044 #define _TRISD0 0x01
1045 #define _TRISD1 0x02
1046 #define _TRISD2 0x04
1047 #define _TRISD3 0x08
1048 #define _TRISD4 0x10
1049 #define _TRISD5 0x20
1050 #define _TRISD6 0x40
1051 #define _TRISD7 0x80
1053 //==============================================================================
1056 //==============================================================================
1057 // TRISE Bits
1059 extern __at(0x0089) __sfr TRISE;
1061 typedef union
1063 struct
1065 unsigned TRISE0 : 1;
1066 unsigned TRISE1 : 1;
1067 unsigned TRISE2 : 1;
1068 unsigned TRISE3 : 1;
1069 unsigned : 1;
1070 unsigned : 1;
1071 unsigned : 1;
1072 unsigned : 1;
1075 struct
1077 unsigned TRISE : 4;
1078 unsigned : 4;
1080 } __TRISEbits_t;
1082 extern __at(0x0089) volatile __TRISEbits_t TRISEbits;
1084 #define _TRISE0 0x01
1085 #define _TRISE1 0x02
1086 #define _TRISE2 0x04
1087 #define _TRISE3 0x08
1089 //==============================================================================
1092 //==============================================================================
1093 // PIE1 Bits
1095 extern __at(0x008C) __sfr PIE1;
1097 typedef struct
1099 unsigned TMR1IE : 1;
1100 unsigned TMR2IE : 1;
1101 unsigned CCP1IE : 1;
1102 unsigned SSPIE : 1;
1103 unsigned TXIE : 1;
1104 unsigned RCIE : 1;
1105 unsigned ADIE : 1;
1106 unsigned : 1;
1107 } __PIE1bits_t;
1109 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
1111 #define _TMR1IE 0x01
1112 #define _TMR2IE 0x02
1113 #define _CCP1IE 0x04
1114 #define _SSPIE 0x08
1115 #define _TXIE 0x10
1116 #define _RCIE 0x20
1117 #define _ADIE 0x40
1119 //==============================================================================
1122 //==============================================================================
1123 // PIE2 Bits
1125 extern __at(0x008D) __sfr PIE2;
1127 typedef struct
1129 unsigned CCP2IE : 1;
1130 unsigned : 1;
1131 unsigned ULPWUIE : 1;
1132 unsigned BCLIE : 1;
1133 unsigned EEIE : 1;
1134 unsigned C1IE : 1;
1135 unsigned C2IE : 1;
1136 unsigned OSFIE : 1;
1137 } __PIE2bits_t;
1139 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
1141 #define _CCP2IE 0x01
1142 #define _ULPWUIE 0x04
1143 #define _BCLIE 0x08
1144 #define _EEIE 0x10
1145 #define _C1IE 0x20
1146 #define _C2IE 0x40
1147 #define _OSFIE 0x80
1149 //==============================================================================
1152 //==============================================================================
1153 // PCON Bits
1155 extern __at(0x008E) __sfr PCON;
1157 typedef union
1159 struct
1161 unsigned NOT_BOR : 1;
1162 unsigned NOT_POR : 1;
1163 unsigned : 1;
1164 unsigned : 1;
1165 unsigned SBOREN : 1;
1166 unsigned ULPWUE : 1;
1167 unsigned : 1;
1168 unsigned : 1;
1171 struct
1173 unsigned NOT_BO : 1;
1174 unsigned : 1;
1175 unsigned : 1;
1176 unsigned : 1;
1177 unsigned : 1;
1178 unsigned : 1;
1179 unsigned : 1;
1180 unsigned : 1;
1182 } __PCONbits_t;
1184 extern __at(0x008E) volatile __PCONbits_t PCONbits;
1186 #define _NOT_BOR 0x01
1187 #define _NOT_BO 0x01
1188 #define _NOT_POR 0x02
1189 #define _SBOREN 0x10
1190 #define _ULPWUE 0x20
1192 //==============================================================================
1195 //==============================================================================
1196 // OSCCON Bits
1198 extern __at(0x008F) __sfr OSCCON;
1200 typedef union
1202 struct
1204 unsigned SCS : 1;
1205 unsigned LTS : 1;
1206 unsigned HTS : 1;
1207 unsigned OSTS : 1;
1208 unsigned IRCF0 : 1;
1209 unsigned IRCF1 : 1;
1210 unsigned IRCF2 : 1;
1211 unsigned : 1;
1214 struct
1216 unsigned : 4;
1217 unsigned IRCF : 3;
1218 unsigned : 1;
1220 } __OSCCONbits_t;
1222 extern __at(0x008F) volatile __OSCCONbits_t OSCCONbits;
1224 #define _SCS 0x01
1225 #define _LTS 0x02
1226 #define _HTS 0x04
1227 #define _OSTS 0x08
1228 #define _IRCF0 0x10
1229 #define _IRCF1 0x20
1230 #define _IRCF2 0x40
1232 //==============================================================================
1235 //==============================================================================
1236 // OSCTUNE Bits
1238 extern __at(0x0090) __sfr OSCTUNE;
1240 typedef union
1242 struct
1244 unsigned TUN0 : 1;
1245 unsigned TUN1 : 1;
1246 unsigned TUN2 : 1;
1247 unsigned TUN3 : 1;
1248 unsigned TUN4 : 1;
1249 unsigned : 1;
1250 unsigned : 1;
1251 unsigned : 1;
1254 struct
1256 unsigned TUN : 5;
1257 unsigned : 3;
1259 } __OSCTUNEbits_t;
1261 extern __at(0x0090) volatile __OSCTUNEbits_t OSCTUNEbits;
1263 #define _TUN0 0x01
1264 #define _TUN1 0x02
1265 #define _TUN2 0x04
1266 #define _TUN3 0x08
1267 #define _TUN4 0x10
1269 //==============================================================================
1272 //==============================================================================
1273 // SSPCON2 Bits
1275 extern __at(0x0091) __sfr SSPCON2;
1277 typedef struct
1279 unsigned SEN : 1;
1280 unsigned RSEN : 1;
1281 unsigned PEN : 1;
1282 unsigned RCEN : 1;
1283 unsigned ACKEN : 1;
1284 unsigned ACKDT : 1;
1285 unsigned ACKSTAT : 1;
1286 unsigned GCEN : 1;
1287 } __SSPCON2bits_t;
1289 extern __at(0x0091) volatile __SSPCON2bits_t SSPCON2bits;
1291 #define _SEN 0x01
1292 #define _RSEN 0x02
1293 #define _PEN 0x04
1294 #define _RCEN 0x08
1295 #define _ACKEN 0x10
1296 #define _ACKDT 0x20
1297 #define _ACKSTAT 0x40
1298 #define _GCEN 0x80
1300 //==============================================================================
1302 extern __at(0x0092) __sfr PR2;
1304 //==============================================================================
1305 // MSK Bits
1307 extern __at(0x0093) __sfr MSK;
1309 typedef struct
1311 unsigned MSK0 : 1;
1312 unsigned MSK1 : 1;
1313 unsigned MSK2 : 1;
1314 unsigned MSK3 : 1;
1315 unsigned MSK4 : 1;
1316 unsigned MSK5 : 1;
1317 unsigned MSK6 : 1;
1318 unsigned MSK7 : 1;
1319 } __MSKbits_t;
1321 extern __at(0x0093) volatile __MSKbits_t MSKbits;
1323 #define _MSK0 0x01
1324 #define _MSK1 0x02
1325 #define _MSK2 0x04
1326 #define _MSK3 0x08
1327 #define _MSK4 0x10
1328 #define _MSK5 0x20
1329 #define _MSK6 0x40
1330 #define _MSK7 0x80
1332 //==============================================================================
1334 extern __at(0x0093) __sfr SSPADD;
1336 //==============================================================================
1337 // SSPMSK Bits
1339 extern __at(0x0093) __sfr SSPMSK;
1341 typedef struct
1343 unsigned MSK0 : 1;
1344 unsigned MSK1 : 1;
1345 unsigned MSK2 : 1;
1346 unsigned MSK3 : 1;
1347 unsigned MSK4 : 1;
1348 unsigned MSK5 : 1;
1349 unsigned MSK6 : 1;
1350 unsigned MSK7 : 1;
1351 } __SSPMSKbits_t;
1353 extern __at(0x0093) volatile __SSPMSKbits_t SSPMSKbits;
1355 #define _SSPMSK_MSK0 0x01
1356 #define _SSPMSK_MSK1 0x02
1357 #define _SSPMSK_MSK2 0x04
1358 #define _SSPMSK_MSK3 0x08
1359 #define _SSPMSK_MSK4 0x10
1360 #define _SSPMSK_MSK5 0x20
1361 #define _SSPMSK_MSK6 0x40
1362 #define _SSPMSK_MSK7 0x80
1364 //==============================================================================
1367 //==============================================================================
1368 // SSPSTAT Bits
1370 extern __at(0x0094) __sfr SSPSTAT;
1372 typedef union
1374 struct
1376 unsigned BF : 1;
1377 unsigned UA : 1;
1378 unsigned R_NOT_W : 1;
1379 unsigned S : 1;
1380 unsigned P : 1;
1381 unsigned D_NOT_A : 1;
1382 unsigned CKE : 1;
1383 unsigned SMP : 1;
1386 struct
1388 unsigned : 1;
1389 unsigned : 1;
1390 unsigned R : 1;
1391 unsigned I2C_START : 1;
1392 unsigned I2C_STOP : 1;
1393 unsigned D : 1;
1394 unsigned : 1;
1395 unsigned : 1;
1398 struct
1400 unsigned : 1;
1401 unsigned : 1;
1402 unsigned I2C_READ : 1;
1403 unsigned : 1;
1404 unsigned : 1;
1405 unsigned I2C_DATA : 1;
1406 unsigned : 1;
1407 unsigned : 1;
1410 struct
1412 unsigned : 1;
1413 unsigned : 1;
1414 unsigned NOT_W : 1;
1415 unsigned : 1;
1416 unsigned : 1;
1417 unsigned NOT_A : 1;
1418 unsigned : 1;
1419 unsigned : 1;
1422 struct
1424 unsigned : 1;
1425 unsigned : 1;
1426 unsigned NOT_WRITE : 1;
1427 unsigned : 1;
1428 unsigned : 1;
1429 unsigned NOT_ADDRESS : 1;
1430 unsigned : 1;
1431 unsigned : 1;
1434 struct
1436 unsigned : 1;
1437 unsigned : 1;
1438 unsigned R_W : 1;
1439 unsigned : 1;
1440 unsigned : 1;
1441 unsigned D_A : 1;
1442 unsigned : 1;
1443 unsigned : 1;
1446 struct
1448 unsigned : 1;
1449 unsigned : 1;
1450 unsigned READ_WRITE : 1;
1451 unsigned : 1;
1452 unsigned : 1;
1453 unsigned DATA_ADDRESS : 1;
1454 unsigned : 1;
1455 unsigned : 1;
1457 } __SSPSTATbits_t;
1459 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1461 #define _BF 0x01
1462 #define _UA 0x02
1463 #define _R_NOT_W 0x04
1464 #define _R 0x04
1465 #define _I2C_READ 0x04
1466 #define _NOT_W 0x04
1467 #define _NOT_WRITE 0x04
1468 #define _R_W 0x04
1469 #define _READ_WRITE 0x04
1470 #define _S 0x08
1471 #define _I2C_START 0x08
1472 #define _P 0x10
1473 #define _I2C_STOP 0x10
1474 #define _D_NOT_A 0x20
1475 #define _D 0x20
1476 #define _I2C_DATA 0x20
1477 #define _NOT_A 0x20
1478 #define _NOT_ADDRESS 0x20
1479 #define _D_A 0x20
1480 #define _DATA_ADDRESS 0x20
1481 #define _CKE 0x40
1482 #define _SMP 0x80
1484 //==============================================================================
1487 //==============================================================================
1488 // WPUB Bits
1490 extern __at(0x0095) __sfr WPUB;
1492 typedef struct
1494 unsigned WPUB0 : 1;
1495 unsigned WPUB1 : 1;
1496 unsigned WPUB2 : 1;
1497 unsigned WPUB3 : 1;
1498 unsigned WPUB4 : 1;
1499 unsigned WPUB5 : 1;
1500 unsigned WPUB6 : 1;
1501 unsigned WPUB7 : 1;
1502 } __WPUBbits_t;
1504 extern __at(0x0095) volatile __WPUBbits_t WPUBbits;
1506 #define _WPUB0 0x01
1507 #define _WPUB1 0x02
1508 #define _WPUB2 0x04
1509 #define _WPUB3 0x08
1510 #define _WPUB4 0x10
1511 #define _WPUB5 0x20
1512 #define _WPUB6 0x40
1513 #define _WPUB7 0x80
1515 //==============================================================================
1518 //==============================================================================
1519 // IOCB Bits
1521 extern __at(0x0096) __sfr IOCB;
1523 typedef struct
1525 unsigned IOCB0 : 1;
1526 unsigned IOCB1 : 1;
1527 unsigned IOCB2 : 1;
1528 unsigned IOCB3 : 1;
1529 unsigned IOCB4 : 1;
1530 unsigned IOCB5 : 1;
1531 unsigned IOCB6 : 1;
1532 unsigned IOCB7 : 1;
1533 } __IOCBbits_t;
1535 extern __at(0x0096) volatile __IOCBbits_t IOCBbits;
1537 #define _IOCB0 0x01
1538 #define _IOCB1 0x02
1539 #define _IOCB2 0x04
1540 #define _IOCB3 0x08
1541 #define _IOCB4 0x10
1542 #define _IOCB5 0x20
1543 #define _IOCB6 0x40
1544 #define _IOCB7 0x80
1546 //==============================================================================
1549 //==============================================================================
1550 // VRCON Bits
1552 extern __at(0x0097) __sfr VRCON;
1554 typedef union
1556 struct
1558 unsigned VR0 : 1;
1559 unsigned VR1 : 1;
1560 unsigned VR2 : 1;
1561 unsigned VR3 : 1;
1562 unsigned VRSS : 1;
1563 unsigned VRR : 1;
1564 unsigned VROE : 1;
1565 unsigned VREN : 1;
1568 struct
1570 unsigned VR : 4;
1571 unsigned : 4;
1573 } __VRCONbits_t;
1575 extern __at(0x0097) volatile __VRCONbits_t VRCONbits;
1577 #define _VR0 0x01
1578 #define _VR1 0x02
1579 #define _VR2 0x04
1580 #define _VR3 0x08
1581 #define _VRSS 0x10
1582 #define _VRR 0x20
1583 #define _VROE 0x40
1584 #define _VREN 0x80
1586 //==============================================================================
1589 //==============================================================================
1590 // TXSTA Bits
1592 extern __at(0x0098) __sfr TXSTA;
1594 typedef union
1596 struct
1598 unsigned TX9D : 1;
1599 unsigned TRMT : 1;
1600 unsigned BRGH : 1;
1601 unsigned SENDB : 1;
1602 unsigned SYNC : 1;
1603 unsigned TXEN : 1;
1604 unsigned TX9 : 1;
1605 unsigned CSRC : 1;
1608 struct
1610 unsigned TXD8 : 1;
1611 unsigned : 1;
1612 unsigned : 1;
1613 unsigned : 1;
1614 unsigned : 1;
1615 unsigned : 1;
1616 unsigned NOT_TX8 : 1;
1617 unsigned : 1;
1620 struct
1622 unsigned : 1;
1623 unsigned : 1;
1624 unsigned : 1;
1625 unsigned : 1;
1626 unsigned : 1;
1627 unsigned : 1;
1628 unsigned TX8_9 : 1;
1629 unsigned : 1;
1631 } __TXSTAbits_t;
1633 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1635 #define _TX9D 0x01
1636 #define _TXD8 0x01
1637 #define _TRMT 0x02
1638 #define _BRGH 0x04
1639 #define _SENDB 0x08
1640 #define _SYNC 0x10
1641 #define _TXEN 0x20
1642 #define _TX9 0x40
1643 #define _NOT_TX8 0x40
1644 #define _TX8_9 0x40
1645 #define _CSRC 0x80
1647 //==============================================================================
1650 //==============================================================================
1651 // SPBRG Bits
1653 extern __at(0x0099) __sfr SPBRG;
1655 typedef struct
1657 unsigned BRG0 : 1;
1658 unsigned BRG1 : 1;
1659 unsigned BRG2 : 1;
1660 unsigned BRG3 : 1;
1661 unsigned BRG4 : 1;
1662 unsigned BRG5 : 1;
1663 unsigned BRG6 : 1;
1664 unsigned BRG7 : 1;
1665 } __SPBRGbits_t;
1667 extern __at(0x0099) volatile __SPBRGbits_t SPBRGbits;
1669 #define _BRG0 0x01
1670 #define _BRG1 0x02
1671 #define _BRG2 0x04
1672 #define _BRG3 0x08
1673 #define _BRG4 0x10
1674 #define _BRG5 0x20
1675 #define _BRG6 0x40
1676 #define _BRG7 0x80
1678 //==============================================================================
1681 //==============================================================================
1682 // SPBRGH Bits
1684 extern __at(0x009A) __sfr SPBRGH;
1686 typedef struct
1688 unsigned BRG8 : 1;
1689 unsigned BRG9 : 1;
1690 unsigned BRG10 : 1;
1691 unsigned BRG11 : 1;
1692 unsigned BRG12 : 1;
1693 unsigned BRG13 : 1;
1694 unsigned BRG14 : 1;
1695 unsigned BRG15 : 1;
1696 } __SPBRGHbits_t;
1698 extern __at(0x009A) volatile __SPBRGHbits_t SPBRGHbits;
1700 #define _BRG8 0x01
1701 #define _BRG9 0x02
1702 #define _BRG10 0x04
1703 #define _BRG11 0x08
1704 #define _BRG12 0x10
1705 #define _BRG13 0x20
1706 #define _BRG14 0x40
1707 #define _BRG15 0x80
1709 //==============================================================================
1712 //==============================================================================
1713 // PWM1CON Bits
1715 extern __at(0x009B) __sfr PWM1CON;
1717 typedef union
1719 struct
1721 unsigned PDC0 : 1;
1722 unsigned PDC1 : 1;
1723 unsigned PDC2 : 1;
1724 unsigned PDC3 : 1;
1725 unsigned PDC4 : 1;
1726 unsigned PDC5 : 1;
1727 unsigned PDC6 : 1;
1728 unsigned PRSEN : 1;
1731 struct
1733 unsigned PDC : 7;
1734 unsigned : 1;
1736 } __PWM1CONbits_t;
1738 extern __at(0x009B) volatile __PWM1CONbits_t PWM1CONbits;
1740 #define _PDC0 0x01
1741 #define _PDC1 0x02
1742 #define _PDC2 0x04
1743 #define _PDC3 0x08
1744 #define _PDC4 0x10
1745 #define _PDC5 0x20
1746 #define _PDC6 0x40
1747 #define _PRSEN 0x80
1749 //==============================================================================
1752 //==============================================================================
1753 // ECCPAS Bits
1755 extern __at(0x009C) __sfr ECCPAS;
1757 typedef union
1759 struct
1761 unsigned PSSBD0 : 1;
1762 unsigned PSSBD1 : 1;
1763 unsigned PSSAC0 : 1;
1764 unsigned PSSAC1 : 1;
1765 unsigned ECCPAS0 : 1;
1766 unsigned ECCPAS1 : 1;
1767 unsigned ECCPAS2 : 1;
1768 unsigned ECCPASE : 1;
1771 struct
1773 unsigned PSSBD : 2;
1774 unsigned : 6;
1777 struct
1779 unsigned : 2;
1780 unsigned PSSAC : 2;
1781 unsigned : 4;
1784 struct
1786 unsigned : 4;
1787 unsigned ECCPAS : 3;
1788 unsigned : 1;
1790 } __ECCPASbits_t;
1792 extern __at(0x009C) volatile __ECCPASbits_t ECCPASbits;
1794 #define _PSSBD0 0x01
1795 #define _PSSBD1 0x02
1796 #define _PSSAC0 0x04
1797 #define _PSSAC1 0x08
1798 #define _ECCPAS0 0x10
1799 #define _ECCPAS1 0x20
1800 #define _ECCPAS2 0x40
1801 #define _ECCPASE 0x80
1803 //==============================================================================
1806 //==============================================================================
1807 // PSTRCON Bits
1809 extern __at(0x009D) __sfr PSTRCON;
1811 typedef struct
1813 unsigned STRA : 1;
1814 unsigned STRB : 1;
1815 unsigned STRC : 1;
1816 unsigned STRD : 1;
1817 unsigned STRSYNC : 1;
1818 unsigned : 1;
1819 unsigned : 1;
1820 unsigned : 1;
1821 } __PSTRCONbits_t;
1823 extern __at(0x009D) volatile __PSTRCONbits_t PSTRCONbits;
1825 #define _STRA 0x01
1826 #define _STRB 0x02
1827 #define _STRC 0x04
1828 #define _STRD 0x08
1829 #define _STRSYNC 0x10
1831 //==============================================================================
1833 extern __at(0x009E) __sfr ADRESL;
1835 //==============================================================================
1836 // ADCON1 Bits
1838 extern __at(0x009F) __sfr ADCON1;
1840 typedef union
1842 struct
1844 unsigned : 1;
1845 unsigned : 1;
1846 unsigned : 1;
1847 unsigned : 1;
1848 unsigned VCFG0 : 1;
1849 unsigned VCFG1 : 1;
1850 unsigned : 1;
1851 unsigned ADFM : 1;
1854 struct
1856 unsigned : 4;
1857 unsigned VCFG : 2;
1858 unsigned : 2;
1860 } __ADCON1bits_t;
1862 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1864 #define _VCFG0 0x10
1865 #define _VCFG1 0x20
1866 #define _ADFM 0x80
1868 //==============================================================================
1871 //==============================================================================
1872 // WDTCON Bits
1874 extern __at(0x0105) __sfr WDTCON;
1876 typedef union
1878 struct
1880 unsigned SWDTEN : 1;
1881 unsigned WDTPS0 : 1;
1882 unsigned WDTPS1 : 1;
1883 unsigned WDTPS2 : 1;
1884 unsigned WDTPS3 : 1;
1885 unsigned : 1;
1886 unsigned : 1;
1887 unsigned : 1;
1890 struct
1892 unsigned : 1;
1893 unsigned WDTPS : 4;
1894 unsigned : 3;
1896 } __WDTCONbits_t;
1898 extern __at(0x0105) volatile __WDTCONbits_t WDTCONbits;
1900 #define _SWDTEN 0x01
1901 #define _WDTPS0 0x02
1902 #define _WDTPS1 0x04
1903 #define _WDTPS2 0x08
1904 #define _WDTPS3 0x10
1906 //==============================================================================
1909 //==============================================================================
1910 // CM1CON0 Bits
1912 extern __at(0x0107) __sfr CM1CON0;
1914 typedef union
1916 struct
1918 unsigned C1CH0 : 1;
1919 unsigned C1CH1 : 1;
1920 unsigned C1R : 1;
1921 unsigned : 1;
1922 unsigned C1POL : 1;
1923 unsigned C1OE : 1;
1924 unsigned C1OUT : 1;
1925 unsigned C1ON : 1;
1928 struct
1930 unsigned C1CH : 2;
1931 unsigned : 6;
1933 } __CM1CON0bits_t;
1935 extern __at(0x0107) volatile __CM1CON0bits_t CM1CON0bits;
1937 #define _C1CH0 0x01
1938 #define _C1CH1 0x02
1939 #define _C1R 0x04
1940 #define _C1POL 0x10
1941 #define _C1OE 0x20
1942 #define _C1OUT 0x40
1943 #define _C1ON 0x80
1945 //==============================================================================
1948 //==============================================================================
1949 // CM2CON0 Bits
1951 extern __at(0x0108) __sfr CM2CON0;
1953 typedef union
1955 struct
1957 unsigned C2CH0 : 1;
1958 unsigned C2CH1 : 1;
1959 unsigned C2R : 1;
1960 unsigned : 1;
1961 unsigned C2POL : 1;
1962 unsigned C2OE : 1;
1963 unsigned C2OUT : 1;
1964 unsigned C2ON : 1;
1967 struct
1969 unsigned C2CH : 2;
1970 unsigned : 6;
1972 } __CM2CON0bits_t;
1974 extern __at(0x0108) volatile __CM2CON0bits_t CM2CON0bits;
1976 #define _C2CH0 0x01
1977 #define _C2CH1 0x02
1978 #define _C2R 0x04
1979 #define _C2POL 0x10
1980 #define _C2OE 0x20
1981 #define _C2OUT 0x40
1982 #define _C2ON 0x80
1984 //==============================================================================
1987 //==============================================================================
1988 // CM2CON1 Bits
1990 extern __at(0x0109) __sfr CM2CON1;
1992 typedef struct
1994 unsigned C2SYNC : 1;
1995 unsigned T1GSS : 1;
1996 unsigned : 1;
1997 unsigned : 1;
1998 unsigned C2RSEL : 1;
1999 unsigned C1RSEL : 1;
2000 unsigned MC2OUT : 1;
2001 unsigned MC1OUT : 1;
2002 } __CM2CON1bits_t;
2004 extern __at(0x0109) volatile __CM2CON1bits_t CM2CON1bits;
2006 #define _C2SYNC 0x01
2007 #define _T1GSS 0x02
2008 #define _C2RSEL 0x10
2009 #define _C1RSEL 0x20
2010 #define _MC2OUT 0x40
2011 #define _MC1OUT 0x80
2013 //==============================================================================
2015 extern __at(0x010C) __sfr EEDAT;
2016 extern __at(0x010C) __sfr EEDATA;
2017 extern __at(0x010D) __sfr EEADR;
2018 extern __at(0x010E) __sfr EEDATH;
2019 extern __at(0x010F) __sfr EEADRH;
2021 //==============================================================================
2022 // SRCON Bits
2024 extern __at(0x0185) __sfr SRCON;
2026 typedef union
2028 struct
2030 unsigned FVREN : 1;
2031 unsigned : 1;
2032 unsigned PULSR : 1;
2033 unsigned PULSS : 1;
2034 unsigned C2REN : 1;
2035 unsigned C1SEN : 1;
2036 unsigned SR0 : 1;
2037 unsigned SR1 : 1;
2040 struct
2042 unsigned : 6;
2043 unsigned SR : 2;
2045 } __SRCONbits_t;
2047 extern __at(0x0185) volatile __SRCONbits_t SRCONbits;
2049 #define _FVREN 0x01
2050 #define _PULSR 0x04
2051 #define _PULSS 0x08
2052 #define _C2REN 0x10
2053 #define _C1SEN 0x20
2054 #define _SR0 0x40
2055 #define _SR1 0x80
2057 //==============================================================================
2060 //==============================================================================
2061 // BAUDCTL Bits
2063 extern __at(0x0187) __sfr BAUDCTL;
2065 #define BAUDCON BAUDCTL
2067 typedef struct
2069 unsigned ABDEN : 1;
2070 unsigned WUE : 1;
2071 unsigned : 1;
2072 unsigned BRG16 : 1;
2073 unsigned SCKP : 1;
2074 unsigned : 1;
2075 unsigned RCIDL : 1;
2076 unsigned ABDOVF : 1;
2077 } __BAUDCTLbits_t;
2079 extern __at(0x0187) volatile __BAUDCTLbits_t BAUDCTLbits;
2081 #define BAUDCONbits BAUDCTLbits
2083 #define _ABDEN 0x01
2084 #define _WUE 0x02
2085 #define _BRG16 0x08
2086 #define _SCKP 0x10
2087 #define _RCIDL 0x40
2088 #define _ABDOVF 0x80
2090 //==============================================================================
2093 //==============================================================================
2094 // ANSEL Bits
2096 extern __at(0x0188) __sfr ANSEL;
2098 typedef struct
2100 unsigned ANS0 : 1;
2101 unsigned ANS1 : 1;
2102 unsigned ANS2 : 1;
2103 unsigned ANS3 : 1;
2104 unsigned ANS4 : 1;
2105 unsigned ANS5 : 1;
2106 unsigned ANS6 : 1;
2107 unsigned ANS7 : 1;
2108 } __ANSELbits_t;
2110 extern __at(0x0188) volatile __ANSELbits_t ANSELbits;
2112 #define _ANS0 0x01
2113 #define _ANS1 0x02
2114 #define _ANS2 0x04
2115 #define _ANS3 0x08
2116 #define _ANS4 0x10
2117 #define _ANS5 0x20
2118 #define _ANS6 0x40
2119 #define _ANS7 0x80
2121 //==============================================================================
2124 //==============================================================================
2125 // ANSELH Bits
2127 extern __at(0x0189) __sfr ANSELH;
2129 typedef struct
2131 unsigned ANS8 : 1;
2132 unsigned ANS9 : 1;
2133 unsigned ANS10 : 1;
2134 unsigned ANS11 : 1;
2135 unsigned ANS12 : 1;
2136 unsigned ANS13 : 1;
2137 unsigned : 1;
2138 unsigned : 1;
2139 } __ANSELHbits_t;
2141 extern __at(0x0189) volatile __ANSELHbits_t ANSELHbits;
2143 #define _ANS8 0x01
2144 #define _ANS9 0x02
2145 #define _ANS10 0x04
2146 #define _ANS11 0x08
2147 #define _ANS12 0x10
2148 #define _ANS13 0x20
2150 //==============================================================================
2153 //==============================================================================
2154 // EECON1 Bits
2156 extern __at(0x018C) __sfr EECON1;
2158 typedef struct
2160 unsigned RD : 1;
2161 unsigned WR : 1;
2162 unsigned WREN : 1;
2163 unsigned WRERR : 1;
2164 unsigned : 1;
2165 unsigned : 1;
2166 unsigned : 1;
2167 unsigned EEPGD : 1;
2168 } __EECON1bits_t;
2170 extern __at(0x018C) volatile __EECON1bits_t EECON1bits;
2172 #define _RD 0x01
2173 #define _WR 0x02
2174 #define _WREN 0x04
2175 #define _WRERR 0x08
2176 #define _EEPGD 0x80
2178 //==============================================================================
2180 extern __at(0x018D) __sfr EECON2;
2182 //==============================================================================
2184 // Configuration Bits
2186 //==============================================================================
2188 #define _CONFIG1 0x2007
2189 #define _CONFIG2 0x2008
2191 //----------------------------- CONFIG1 Options -------------------------------
2193 #define _FOSC_LP 0x3FF8 // LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2194 #define _LP_OSC 0x3FF8 // LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2195 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2196 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2197 #define _FOSC_HS 0x3FFA // HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2198 #define _HS_OSC 0x3FFA // HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN.
2199 #define _FOSC_EC 0x3FFB // EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN.
2200 #define _EC_OSC 0x3FFB // EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN.
2201 #define _FOSC_INTRC_NOCLKOUT 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2202 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2203 #define _INTOSCIO 0x3FFC // INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2204 #define _FOSC_INTRC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2205 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2206 #define _INTOSC 0x3FFD // INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN.
2207 #define _FOSC_EXTRC_NOCLKOUT 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2208 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2209 #define _EXTRCIO 0x3FFE // RCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2210 #define _FOSC_EXTRC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2211 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2212 #define _EXTRC 0x3FFF // RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, RC on RA7/OSC1/CLKIN.
2213 #define _WDTE_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
2214 #define _WDT_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
2215 #define _WDTE_ON 0x3FFF // WDT enabled.
2216 #define _WDT_ON 0x3FFF // WDT enabled.
2217 #define _PWRTE_ON 0x3FEF // PWRT enabled.
2218 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
2219 #define _MCLRE_OFF 0x3FDF // RE3/MCLR pin function is digital input, MCLR internally tied to VDD.
2220 #define _MCLRE_ON 0x3FFF // RE3/MCLR pin function is MCLR.
2221 #define _CP_ON 0x3FBF // Program memory code protection is enabled.
2222 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
2223 #define _CPD_ON 0x3F7F // Data memory code protection is enabled.
2224 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
2225 #define _BOREN_OFF 0x3CFF // BOR disabled.
2226 #define _BOR_OFF 0x3CFF // BOR disabled.
2227 #define _BOREN_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
2228 #define _BOR_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
2229 #define _BOREN_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
2230 #define _BOR_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
2231 #define _BOREN_ON 0x3FFF // BOR enabled.
2232 #define _BOR_ON 0x3FFF // BOR enabled.
2233 #define _IESO_OFF 0x3BFF // Internal/External Switchover mode is disabled.
2234 #define _IESO_ON 0x3FFF // Internal/External Switchover mode is enabled.
2235 #define _FCMEN_OFF 0x37FF // Fail-Safe Clock Monitor is disabled.
2236 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
2237 #define _LVP_OFF 0x2FFF // RB3 pin has digital I/O, HV on MCLR must be used for programming.
2238 #define _LVP_ON 0x3FFF // RB3/PGM pin has PGM function, low voltage programming enabled.
2239 #define _DEBUG_ON 0x1FFF // In_Circuit Debugger enabled, RB6/ICSPCLK and RB7/ICSPDAT are dedicated to the debugger.
2240 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, RB6/ICSPCLK and RB7/ICSPDAT are general purpose I/O pins.
2242 //----------------------------- CONFIG2 Options -------------------------------
2244 #define _BOR4V_BOR21V 0x3EFF // Brown-out Reset set to 2.1V.
2245 #define _BOR21V 0x3EFF // Brown-out Reset set to 2.1V.
2246 #define _BOR4V_BOR40V 0x3FFF // Brown-out Reset set to 4.0V.
2247 #define _BOR40V 0x3FFF // Brown-out Reset set to 4.0V.
2248 #define _WRT_HALF 0x39FF // 0000h to 07FFh write protected, 0800h to 0FFFh may be modified by EECON control.
2249 #define _WRT_1FOURTH 0x3BFF // 0000h to 03FFh write protected, 0400h to 0FFFh may be modified by EECON control.
2250 #define _WRT_256 0x3DFF // 0000h to 00FFh write protected, 0100h to 0FFFh may be modified by EECON control.
2251 #define _WRT_OFF 0x3FFF // Write protection off.
2253 //==============================================================================
2255 #define _DEVID1 0x2006
2257 #define _IDLOC0 0x2000
2258 #define _IDLOC1 0x2001
2259 #define _IDLOC2 0x2002
2260 #define _IDLOC3 0x2003
2262 //==============================================================================
2264 #ifndef NO_BIT_DEFINES
2266 #define ADON ADCON0bits.ADON // bit 0
2267 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
2268 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
2269 #define NOT_DONE ADCON0bits.NOT_DONE // bit 1, shadows bit in ADCON0bits
2270 #define GO_DONE ADCON0bits.GO_DONE // bit 1, shadows bit in ADCON0bits
2271 #define CHS0 ADCON0bits.CHS0 // bit 2
2272 #define CHS1 ADCON0bits.CHS1 // bit 3
2273 #define CHS2 ADCON0bits.CHS2 // bit 4
2274 #define CHS3 ADCON0bits.CHS3 // bit 5
2275 #define ADCS0 ADCON0bits.ADCS0 // bit 6
2276 #define ADCS1 ADCON0bits.ADCS1 // bit 7
2278 #define VCFG0 ADCON1bits.VCFG0 // bit 4
2279 #define VCFG1 ADCON1bits.VCFG1 // bit 5
2280 #define ADFM ADCON1bits.ADFM // bit 7
2282 #define ANS0 ANSELbits.ANS0 // bit 0
2283 #define ANS1 ANSELbits.ANS1 // bit 1
2284 #define ANS2 ANSELbits.ANS2 // bit 2
2285 #define ANS3 ANSELbits.ANS3 // bit 3
2286 #define ANS4 ANSELbits.ANS4 // bit 4
2287 #define ANS5 ANSELbits.ANS5 // bit 5
2288 #define ANS6 ANSELbits.ANS6 // bit 6
2289 #define ANS7 ANSELbits.ANS7 // bit 7
2291 #define ANS8 ANSELHbits.ANS8 // bit 0
2292 #define ANS9 ANSELHbits.ANS9 // bit 1
2293 #define ANS10 ANSELHbits.ANS10 // bit 2
2294 #define ANS11 ANSELHbits.ANS11 // bit 3
2295 #define ANS12 ANSELHbits.ANS12 // bit 4
2296 #define ANS13 ANSELHbits.ANS13 // bit 5
2298 #define ABDEN BAUDCTLbits.ABDEN // bit 0
2299 #define WUE BAUDCTLbits.WUE // bit 1
2300 #define BRG16 BAUDCTLbits.BRG16 // bit 3
2301 #define SCKP BAUDCTLbits.SCKP // bit 4
2302 #define RCIDL BAUDCTLbits.RCIDL // bit 6
2303 #define ABDOVF BAUDCTLbits.ABDOVF // bit 7
2305 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
2306 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
2307 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
2308 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
2309 #define DC1B0 CCP1CONbits.DC1B0 // bit 4, shadows bit in CCP1CONbits
2310 #define CCP1Y CCP1CONbits.CCP1Y // bit 4, shadows bit in CCP1CONbits
2311 #define DC1B1 CCP1CONbits.DC1B1 // bit 5, shadows bit in CCP1CONbits
2312 #define CCP1X CCP1CONbits.CCP1X // bit 5, shadows bit in CCP1CONbits
2313 #define P1M0 CCP1CONbits.P1M0 // bit 6
2314 #define P1M1 CCP1CONbits.P1M1 // bit 7
2316 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
2317 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
2318 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
2319 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
2320 #define DC2B0 CCP2CONbits.DC2B0 // bit 4, shadows bit in CCP2CONbits
2321 #define CCP2Y CCP2CONbits.CCP2Y // bit 4, shadows bit in CCP2CONbits
2322 #define DC2B1 CCP2CONbits.DC2B1 // bit 5, shadows bit in CCP2CONbits
2323 #define CCP2X CCP2CONbits.CCP2X // bit 5, shadows bit in CCP2CONbits
2325 #define C1CH0 CM1CON0bits.C1CH0 // bit 0
2326 #define C1CH1 CM1CON0bits.C1CH1 // bit 1
2327 #define C1R CM1CON0bits.C1R // bit 2
2328 #define C1POL CM1CON0bits.C1POL // bit 4
2329 #define C1OE CM1CON0bits.C1OE // bit 5
2330 #define C1OUT CM1CON0bits.C1OUT // bit 6
2331 #define C1ON CM1CON0bits.C1ON // bit 7
2333 #define C2CH0 CM2CON0bits.C2CH0 // bit 0
2334 #define C2CH1 CM2CON0bits.C2CH1 // bit 1
2335 #define C2R CM2CON0bits.C2R // bit 2
2336 #define C2POL CM2CON0bits.C2POL // bit 4
2337 #define C2OE CM2CON0bits.C2OE // bit 5
2338 #define C2OUT CM2CON0bits.C2OUT // bit 6
2339 #define C2ON CM2CON0bits.C2ON // bit 7
2341 #define C2SYNC CM2CON1bits.C2SYNC // bit 0
2342 #define T1GSS CM2CON1bits.T1GSS // bit 1
2343 #define C2RSEL CM2CON1bits.C2RSEL // bit 4
2344 #define C1RSEL CM2CON1bits.C1RSEL // bit 5
2345 #define MC2OUT CM2CON1bits.MC2OUT // bit 6
2346 #define MC1OUT CM2CON1bits.MC1OUT // bit 7
2348 #define PSSBD0 ECCPASbits.PSSBD0 // bit 0
2349 #define PSSBD1 ECCPASbits.PSSBD1 // bit 1
2350 #define PSSAC0 ECCPASbits.PSSAC0 // bit 2
2351 #define PSSAC1 ECCPASbits.PSSAC1 // bit 3
2352 #define ECCPAS0 ECCPASbits.ECCPAS0 // bit 4
2353 #define ECCPAS1 ECCPASbits.ECCPAS1 // bit 5
2354 #define ECCPAS2 ECCPASbits.ECCPAS2 // bit 6
2355 #define ECCPASE ECCPASbits.ECCPASE // bit 7
2357 #define RD EECON1bits.RD // bit 0
2358 #define WR EECON1bits.WR // bit 1
2359 #define WREN EECON1bits.WREN // bit 2
2360 #define WRERR EECON1bits.WRERR // bit 3
2361 #define EEPGD EECON1bits.EEPGD // bit 7
2363 #define RBIF INTCONbits.RBIF // bit 0
2364 #define INTF INTCONbits.INTF // bit 1
2365 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
2366 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
2367 #define RBIE INTCONbits.RBIE // bit 3
2368 #define INTE INTCONbits.INTE // bit 4
2369 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
2370 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
2371 #define PEIE INTCONbits.PEIE // bit 6
2372 #define GIE INTCONbits.GIE // bit 7
2374 #define IOCB0 IOCBbits.IOCB0 // bit 0
2375 #define IOCB1 IOCBbits.IOCB1 // bit 1
2376 #define IOCB2 IOCBbits.IOCB2 // bit 2
2377 #define IOCB3 IOCBbits.IOCB3 // bit 3
2378 #define IOCB4 IOCBbits.IOCB4 // bit 4
2379 #define IOCB5 IOCBbits.IOCB5 // bit 5
2380 #define IOCB6 IOCBbits.IOCB6 // bit 6
2381 #define IOCB7 IOCBbits.IOCB7 // bit 7
2383 #define MSK0 MSKbits.MSK0 // bit 0
2384 #define MSK1 MSKbits.MSK1 // bit 1
2385 #define MSK2 MSKbits.MSK2 // bit 2
2386 #define MSK3 MSKbits.MSK3 // bit 3
2387 #define MSK4 MSKbits.MSK4 // bit 4
2388 #define MSK5 MSKbits.MSK5 // bit 5
2389 #define MSK6 MSKbits.MSK6 // bit 6
2390 #define MSK7 MSKbits.MSK7 // bit 7
2392 #define PS0 OPTION_REGbits.PS0 // bit 0
2393 #define PS1 OPTION_REGbits.PS1 // bit 1
2394 #define PS2 OPTION_REGbits.PS2 // bit 2
2395 #define PSA OPTION_REGbits.PSA // bit 3
2396 #define T0SE OPTION_REGbits.T0SE // bit 4
2397 #define T0CS OPTION_REGbits.T0CS // bit 5
2398 #define INTEDG OPTION_REGbits.INTEDG // bit 6
2399 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
2401 #define SCS OSCCONbits.SCS // bit 0
2402 #define LTS OSCCONbits.LTS // bit 1
2403 #define HTS OSCCONbits.HTS // bit 2
2404 #define OSTS OSCCONbits.OSTS // bit 3
2405 #define IRCF0 OSCCONbits.IRCF0 // bit 4
2406 #define IRCF1 OSCCONbits.IRCF1 // bit 5
2407 #define IRCF2 OSCCONbits.IRCF2 // bit 6
2409 #define TUN0 OSCTUNEbits.TUN0 // bit 0
2410 #define TUN1 OSCTUNEbits.TUN1 // bit 1
2411 #define TUN2 OSCTUNEbits.TUN2 // bit 2
2412 #define TUN3 OSCTUNEbits.TUN3 // bit 3
2413 #define TUN4 OSCTUNEbits.TUN4 // bit 4
2415 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
2416 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
2417 #define NOT_POR PCONbits.NOT_POR // bit 1
2418 #define SBOREN PCONbits.SBOREN // bit 4
2419 #define ULPWUE PCONbits.ULPWUE // bit 5
2421 #define TMR1IE PIE1bits.TMR1IE // bit 0
2422 #define TMR2IE PIE1bits.TMR2IE // bit 1
2423 #define CCP1IE PIE1bits.CCP1IE // bit 2
2424 #define SSPIE PIE1bits.SSPIE // bit 3
2425 #define TXIE PIE1bits.TXIE // bit 4
2426 #define RCIE PIE1bits.RCIE // bit 5
2427 #define ADIE PIE1bits.ADIE // bit 6
2429 #define CCP2IE PIE2bits.CCP2IE // bit 0
2430 #define ULPWUIE PIE2bits.ULPWUIE // bit 2
2431 #define BCLIE PIE2bits.BCLIE // bit 3
2432 #define EEIE PIE2bits.EEIE // bit 4
2433 #define C1IE PIE2bits.C1IE // bit 5
2434 #define C2IE PIE2bits.C2IE // bit 6
2435 #define OSFIE PIE2bits.OSFIE // bit 7
2437 #define TMR1IF PIR1bits.TMR1IF // bit 0
2438 #define TMR2IF PIR1bits.TMR2IF // bit 1
2439 #define CCP1IF PIR1bits.CCP1IF // bit 2
2440 #define SSPIF PIR1bits.SSPIF // bit 3
2441 #define TXIF PIR1bits.TXIF // bit 4
2442 #define RCIF PIR1bits.RCIF // bit 5
2443 #define ADIF PIR1bits.ADIF // bit 6
2445 #define CCP2IF PIR2bits.CCP2IF // bit 0
2446 #define ULPWUIF PIR2bits.ULPWUIF // bit 2
2447 #define BCLIF PIR2bits.BCLIF // bit 3
2448 #define EEIF PIR2bits.EEIF // bit 4
2449 #define C1IF PIR2bits.C1IF // bit 5
2450 #define C2IF PIR2bits.C2IF // bit 6
2451 #define OSFIF PIR2bits.OSFIF // bit 7
2453 #define RA0 PORTAbits.RA0 // bit 0
2454 #define RA1 PORTAbits.RA1 // bit 1
2455 #define RA2 PORTAbits.RA2 // bit 2
2456 #define RA3 PORTAbits.RA3 // bit 3
2457 #define RA4 PORTAbits.RA4 // bit 4
2458 #define RA5 PORTAbits.RA5 // bit 5
2459 #define RA6 PORTAbits.RA6 // bit 6
2460 #define RA7 PORTAbits.RA7 // bit 7
2462 #define RB0 PORTBbits.RB0 // bit 0
2463 #define RB1 PORTBbits.RB1 // bit 1
2464 #define RB2 PORTBbits.RB2 // bit 2
2465 #define RB3 PORTBbits.RB3 // bit 3
2466 #define RB4 PORTBbits.RB4 // bit 4
2467 #define RB5 PORTBbits.RB5 // bit 5
2468 #define RB6 PORTBbits.RB6 // bit 6
2469 #define RB7 PORTBbits.RB7 // bit 7
2471 #define RC0 PORTCbits.RC0 // bit 0
2472 #define RC1 PORTCbits.RC1 // bit 1
2473 #define RC2 PORTCbits.RC2 // bit 2
2474 #define RC3 PORTCbits.RC3 // bit 3
2475 #define RC4 PORTCbits.RC4 // bit 4
2476 #define RC5 PORTCbits.RC5 // bit 5
2477 #define RC6 PORTCbits.RC6 // bit 6
2478 #define RC7 PORTCbits.RC7 // bit 7
2480 #define RD0 PORTDbits.RD0 // bit 0
2481 #define RD1 PORTDbits.RD1 // bit 1
2482 #define RD2 PORTDbits.RD2 // bit 2
2483 #define RD3 PORTDbits.RD3 // bit 3
2484 #define RD4 PORTDbits.RD4 // bit 4
2485 #define RD5 PORTDbits.RD5 // bit 5
2486 #define RD6 PORTDbits.RD6 // bit 6
2487 #define RD7 PORTDbits.RD7 // bit 7
2489 #define RE0 PORTEbits.RE0 // bit 0
2490 #define RE1 PORTEbits.RE1 // bit 1
2491 #define RE2 PORTEbits.RE2 // bit 2
2492 #define RE3 PORTEbits.RE3 // bit 3
2494 #define STRA PSTRCONbits.STRA // bit 0
2495 #define STRB PSTRCONbits.STRB // bit 1
2496 #define STRC PSTRCONbits.STRC // bit 2
2497 #define STRD PSTRCONbits.STRD // bit 3
2498 #define STRSYNC PSTRCONbits.STRSYNC // bit 4
2500 #define PDC0 PWM1CONbits.PDC0 // bit 0
2501 #define PDC1 PWM1CONbits.PDC1 // bit 1
2502 #define PDC2 PWM1CONbits.PDC2 // bit 2
2503 #define PDC3 PWM1CONbits.PDC3 // bit 3
2504 #define PDC4 PWM1CONbits.PDC4 // bit 4
2505 #define PDC5 PWM1CONbits.PDC5 // bit 5
2506 #define PDC6 PWM1CONbits.PDC6 // bit 6
2507 #define PRSEN PWM1CONbits.PRSEN // bit 7
2509 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
2510 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
2511 #define OERR RCSTAbits.OERR // bit 1
2512 #define FERR RCSTAbits.FERR // bit 2
2513 #define ADDEN RCSTAbits.ADDEN // bit 3
2514 #define CREN RCSTAbits.CREN // bit 4
2515 #define SREN RCSTAbits.SREN // bit 5
2516 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
2517 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
2518 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
2519 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
2520 #define SPEN RCSTAbits.SPEN // bit 7
2522 #define BRG0 SPBRGbits.BRG0 // bit 0
2523 #define BRG1 SPBRGbits.BRG1 // bit 1
2524 #define BRG2 SPBRGbits.BRG2 // bit 2
2525 #define BRG3 SPBRGbits.BRG3 // bit 3
2526 #define BRG4 SPBRGbits.BRG4 // bit 4
2527 #define BRG5 SPBRGbits.BRG5 // bit 5
2528 #define BRG6 SPBRGbits.BRG6 // bit 6
2529 #define BRG7 SPBRGbits.BRG7 // bit 7
2531 #define BRG8 SPBRGHbits.BRG8 // bit 0
2532 #define BRG9 SPBRGHbits.BRG9 // bit 1
2533 #define BRG10 SPBRGHbits.BRG10 // bit 2
2534 #define BRG11 SPBRGHbits.BRG11 // bit 3
2535 #define BRG12 SPBRGHbits.BRG12 // bit 4
2536 #define BRG13 SPBRGHbits.BRG13 // bit 5
2537 #define BRG14 SPBRGHbits.BRG14 // bit 6
2538 #define BRG15 SPBRGHbits.BRG15 // bit 7
2540 #define FVREN SRCONbits.FVREN // bit 0
2541 #define PULSR SRCONbits.PULSR // bit 2
2542 #define PULSS SRCONbits.PULSS // bit 3
2543 #define C2REN SRCONbits.C2REN // bit 4
2544 #define C1SEN SRCONbits.C1SEN // bit 5
2545 #define SR0 SRCONbits.SR0 // bit 6
2546 #define SR1 SRCONbits.SR1 // bit 7
2548 #define SSPM0 SSPCONbits.SSPM0 // bit 0
2549 #define SSPM1 SSPCONbits.SSPM1 // bit 1
2550 #define SSPM2 SSPCONbits.SSPM2 // bit 2
2551 #define SSPM3 SSPCONbits.SSPM3 // bit 3
2552 #define CKP SSPCONbits.CKP // bit 4
2553 #define SSPEN SSPCONbits.SSPEN // bit 5
2554 #define SSPOV SSPCONbits.SSPOV // bit 6
2555 #define WCOL SSPCONbits.WCOL // bit 7
2557 #define SEN SSPCON2bits.SEN // bit 0
2558 #define RSEN SSPCON2bits.RSEN // bit 1
2559 #define PEN SSPCON2bits.PEN // bit 2
2560 #define RCEN SSPCON2bits.RCEN // bit 3
2561 #define ACKEN SSPCON2bits.ACKEN // bit 4
2562 #define ACKDT SSPCON2bits.ACKDT // bit 5
2563 #define ACKSTAT SSPCON2bits.ACKSTAT // bit 6
2564 #define GCEN SSPCON2bits.GCEN // bit 7
2566 #define BF SSPSTATbits.BF // bit 0
2567 #define UA SSPSTATbits.UA // bit 1
2568 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
2569 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
2570 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
2571 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
2572 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
2573 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
2574 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
2575 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
2576 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
2577 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
2578 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
2579 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
2580 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
2581 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
2582 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
2583 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
2584 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
2585 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
2586 #define CKE SSPSTATbits.CKE // bit 6
2587 #define SMP SSPSTATbits.SMP // bit 7
2589 #define C STATUSbits.C // bit 0
2590 #define DC STATUSbits.DC // bit 1
2591 #define Z STATUSbits.Z // bit 2
2592 #define NOT_PD STATUSbits.NOT_PD // bit 3
2593 #define NOT_TO STATUSbits.NOT_TO // bit 4
2594 #define RP0 STATUSbits.RP0 // bit 5
2595 #define RP1 STATUSbits.RP1 // bit 6
2596 #define IRP STATUSbits.IRP // bit 7
2598 #define TMR1ON T1CONbits.TMR1ON // bit 0
2599 #define TMR1CS T1CONbits.TMR1CS // bit 1
2600 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
2601 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
2602 #define T1SYNC T1CONbits.T1SYNC // bit 2, shadows bit in T1CONbits
2603 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
2604 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
2605 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
2606 #define TMR1GE T1CONbits.TMR1GE // bit 6
2607 #define T1GINV T1CONbits.T1GINV // bit 7, shadows bit in T1CONbits
2608 #define T1GIV T1CONbits.T1GIV // bit 7, shadows bit in T1CONbits
2610 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
2611 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
2612 #define TMR2ON T2CONbits.TMR2ON // bit 2
2613 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
2614 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
2615 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
2616 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
2618 #define TRISA0 TRISAbits.TRISA0 // bit 0
2619 #define TRISA1 TRISAbits.TRISA1 // bit 1
2620 #define TRISA2 TRISAbits.TRISA2 // bit 2
2621 #define TRISA3 TRISAbits.TRISA3 // bit 3
2622 #define TRISA4 TRISAbits.TRISA4 // bit 4
2623 #define TRISA5 TRISAbits.TRISA5 // bit 5
2624 #define TRISA6 TRISAbits.TRISA6 // bit 6
2625 #define TRISA7 TRISAbits.TRISA7 // bit 7
2627 #define TRISB0 TRISBbits.TRISB0 // bit 0
2628 #define TRISB1 TRISBbits.TRISB1 // bit 1
2629 #define TRISB2 TRISBbits.TRISB2 // bit 2
2630 #define TRISB3 TRISBbits.TRISB3 // bit 3
2631 #define TRISB4 TRISBbits.TRISB4 // bit 4
2632 #define TRISB5 TRISBbits.TRISB5 // bit 5
2633 #define TRISB6 TRISBbits.TRISB6 // bit 6
2634 #define TRISB7 TRISBbits.TRISB7 // bit 7
2636 #define TRISC0 TRISCbits.TRISC0 // bit 0
2637 #define TRISC1 TRISCbits.TRISC1 // bit 1
2638 #define TRISC2 TRISCbits.TRISC2 // bit 2
2639 #define TRISC3 TRISCbits.TRISC3 // bit 3
2640 #define TRISC4 TRISCbits.TRISC4 // bit 4
2641 #define TRISC5 TRISCbits.TRISC5 // bit 5
2642 #define TRISC6 TRISCbits.TRISC6 // bit 6
2643 #define TRISC7 TRISCbits.TRISC7 // bit 7
2645 #define TRISD0 TRISDbits.TRISD0 // bit 0
2646 #define TRISD1 TRISDbits.TRISD1 // bit 1
2647 #define TRISD2 TRISDbits.TRISD2 // bit 2
2648 #define TRISD3 TRISDbits.TRISD3 // bit 3
2649 #define TRISD4 TRISDbits.TRISD4 // bit 4
2650 #define TRISD5 TRISDbits.TRISD5 // bit 5
2651 #define TRISD6 TRISDbits.TRISD6 // bit 6
2652 #define TRISD7 TRISDbits.TRISD7 // bit 7
2654 #define TRISE0 TRISEbits.TRISE0 // bit 0
2655 #define TRISE1 TRISEbits.TRISE1 // bit 1
2656 #define TRISE2 TRISEbits.TRISE2 // bit 2
2657 #define TRISE3 TRISEbits.TRISE3 // bit 3
2659 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
2660 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
2661 #define TRMT TXSTAbits.TRMT // bit 1
2662 #define BRGH TXSTAbits.BRGH // bit 2
2663 #define SENDB TXSTAbits.SENDB // bit 3
2664 #define SYNC TXSTAbits.SYNC // bit 4
2665 #define TXEN TXSTAbits.TXEN // bit 5
2666 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
2667 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
2668 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
2669 #define CSRC TXSTAbits.CSRC // bit 7
2671 #define VR0 VRCONbits.VR0 // bit 0
2672 #define VR1 VRCONbits.VR1 // bit 1
2673 #define VR2 VRCONbits.VR2 // bit 2
2674 #define VR3 VRCONbits.VR3 // bit 3
2675 #define VRSS VRCONbits.VRSS // bit 4
2676 #define VRR VRCONbits.VRR // bit 5
2677 #define VROE VRCONbits.VROE // bit 6
2678 #define VREN VRCONbits.VREN // bit 7
2680 #define SWDTEN WDTCONbits.SWDTEN // bit 0
2681 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
2682 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
2683 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
2684 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
2686 #define WPUB0 WPUBbits.WPUB0 // bit 0
2687 #define WPUB1 WPUBbits.WPUB1 // bit 1
2688 #define WPUB2 WPUBbits.WPUB2 // bit 2
2689 #define WPUB3 WPUBbits.WPUB3 // bit 3
2690 #define WPUB4 WPUBbits.WPUB4 // bit 4
2691 #define WPUB5 WPUBbits.WPUB5 // bit 5
2692 #define WPUB6 WPUBbits.WPUB6 // bit 6
2693 #define WPUB7 WPUBbits.WPUB7 // bit 7
2695 #endif // #ifndef NO_BIT_DEFINES
2697 #endif // #ifndef __PIC16F884_H__