Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f685.h
blob73361f403f717da9bcea2737c41945d5c3066732
1 /*
2 * This declarations of the PIC16F685 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:22:57 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 __PIC16F685_H__
26 #define __PIC16F685_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 PCLATH_ADDR 0x000A
45 #define INTCON_ADDR 0x000B
46 #define PIR1_ADDR 0x000C
47 #define PIR2_ADDR 0x000D
48 #define TMR1_ADDR 0x000E
49 #define TMR1L_ADDR 0x000E
50 #define TMR1H_ADDR 0x000F
51 #define T1CON_ADDR 0x0010
52 #define TMR2_ADDR 0x0011
53 #define T2CON_ADDR 0x0012
54 #define CCPR1_ADDR 0x0015
55 #define CCPR1L_ADDR 0x0015
56 #define CCPR1H_ADDR 0x0016
57 #define CCP1CON_ADDR 0x0017
58 #define PWM1CON_ADDR 0x001C
59 #define ECCPAS_ADDR 0x001D
60 #define ADRESH_ADDR 0x001E
61 #define ADCON0_ADDR 0x001F
62 #define OPTION_REG_ADDR 0x0081
63 #define TRISA_ADDR 0x0085
64 #define TRISB_ADDR 0x0086
65 #define TRISC_ADDR 0x0087
66 #define PIE1_ADDR 0x008C
67 #define PIE2_ADDR 0x008D
68 #define PCON_ADDR 0x008E
69 #define OSCCON_ADDR 0x008F
70 #define OSCTUNE_ADDR 0x0090
71 #define PR2_ADDR 0x0092
72 #define WPU_ADDR 0x0095
73 #define WPUA_ADDR 0x0095
74 #define IOC_ADDR 0x0096
75 #define IOCA_ADDR 0x0096
76 #define WDTCON_ADDR 0x0097
77 #define ADRESL_ADDR 0x009E
78 #define ADCON1_ADDR 0x009F
79 #define EEDAT_ADDR 0x010C
80 #define EEDATA_ADDR 0x010C
81 #define EEADR_ADDR 0x010D
82 #define EEDATH_ADDR 0x010E
83 #define EEADRH_ADDR 0x010F
84 #define WPUB_ADDR 0x0115
85 #define IOCB_ADDR 0x0116
86 #define VRCON_ADDR 0x0118
87 #define CM1CON0_ADDR 0x0119
88 #define CM2CON0_ADDR 0x011A
89 #define CM2CON1_ADDR 0x011B
90 #define ANSEL_ADDR 0x011E
91 #define ANSELH_ADDR 0x011F
92 #define EECON1_ADDR 0x018C
93 #define EECON2_ADDR 0x018D
94 #define PSTRCON_ADDR 0x019D
95 #define SRCON_ADDR 0x019E
97 #endif // #ifndef NO_ADDR_DEFINES
99 //==============================================================================
101 // Register Definitions
103 //==============================================================================
105 extern __at(0x0000) __sfr INDF;
106 extern __at(0x0001) __sfr TMR0;
107 extern __at(0x0002) __sfr PCL;
109 //==============================================================================
110 // STATUS Bits
112 extern __at(0x0003) __sfr STATUS;
114 typedef union
116 struct
118 unsigned C : 1;
119 unsigned DC : 1;
120 unsigned Z : 1;
121 unsigned NOT_PD : 1;
122 unsigned NOT_TO : 1;
123 unsigned RP0 : 1;
124 unsigned RP1 : 1;
125 unsigned IRP : 1;
128 struct
130 unsigned : 5;
131 unsigned RP : 2;
132 unsigned : 1;
134 } __STATUSbits_t;
136 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
138 #define _C 0x01
139 #define _DC 0x02
140 #define _Z 0x04
141 #define _NOT_PD 0x08
142 #define _NOT_TO 0x10
143 #define _RP0 0x20
144 #define _RP1 0x40
145 #define _IRP 0x80
147 //==============================================================================
149 extern __at(0x0004) __sfr FSR;
151 //==============================================================================
152 // PORTA Bits
154 extern __at(0x0005) __sfr PORTA;
156 typedef union
158 struct
160 unsigned RA0 : 1;
161 unsigned RA1 : 1;
162 unsigned RA2 : 1;
163 unsigned RA3 : 1;
164 unsigned RA4 : 1;
165 unsigned RA5 : 1;
166 unsigned : 1;
167 unsigned : 1;
170 struct
172 unsigned RA : 6;
173 unsigned : 2;
175 } __PORTAbits_t;
177 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
179 #define _RA0 0x01
180 #define _RA1 0x02
181 #define _RA2 0x04
182 #define _RA3 0x08
183 #define _RA4 0x10
184 #define _RA5 0x20
186 //==============================================================================
189 //==============================================================================
190 // PORTB Bits
192 extern __at(0x0006) __sfr PORTB;
194 typedef struct
196 unsigned : 1;
197 unsigned : 1;
198 unsigned : 1;
199 unsigned : 1;
200 unsigned RB4 : 1;
201 unsigned RB5 : 1;
202 unsigned RB6 : 1;
203 unsigned RB7 : 1;
204 } __PORTBbits_t;
206 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
208 #define _RB4 0x10
209 #define _RB5 0x20
210 #define _RB6 0x40
211 #define _RB7 0x80
213 //==============================================================================
216 //==============================================================================
217 // PORTC Bits
219 extern __at(0x0007) __sfr PORTC;
221 typedef struct
223 unsigned RC0 : 1;
224 unsigned RC1 : 1;
225 unsigned RC2 : 1;
226 unsigned RC3 : 1;
227 unsigned RC4 : 1;
228 unsigned RC5 : 1;
229 unsigned RC6 : 1;
230 unsigned RC7 : 1;
231 } __PORTCbits_t;
233 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
235 #define _RC0 0x01
236 #define _RC1 0x02
237 #define _RC2 0x04
238 #define _RC3 0x08
239 #define _RC4 0x10
240 #define _RC5 0x20
241 #define _RC6 0x40
242 #define _RC7 0x80
244 //==============================================================================
246 extern __at(0x000A) __sfr PCLATH;
248 //==============================================================================
249 // INTCON Bits
251 extern __at(0x000B) __sfr INTCON;
253 typedef struct
255 unsigned RABIF : 1;
256 unsigned INTF : 1;
257 unsigned T0IF : 1;
258 unsigned RABIE : 1;
259 unsigned INTE : 1;
260 unsigned T0IE : 1;
261 unsigned PEIE : 1;
262 unsigned GIE : 1;
263 } __INTCONbits_t;
265 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
267 #define _RABIF 0x01
268 #define _INTF 0x02
269 #define _T0IF 0x04
270 #define _RABIE 0x08
271 #define _INTE 0x10
272 #define _T0IE 0x20
273 #define _PEIE 0x40
274 #define _GIE 0x80
276 //==============================================================================
279 //==============================================================================
280 // PIR1 Bits
282 extern __at(0x000C) __sfr PIR1;
284 typedef union
286 struct
288 unsigned TMR1IF : 1;
289 unsigned TMR2IF : 1;
290 unsigned CCP1IF : 1;
291 unsigned : 1;
292 unsigned : 1;
293 unsigned : 1;
294 unsigned ADIF : 1;
295 unsigned : 1;
298 struct
300 unsigned T1IF : 1;
301 unsigned T2IF : 1;
302 unsigned : 1;
303 unsigned : 1;
304 unsigned : 1;
305 unsigned : 1;
306 unsigned : 1;
307 unsigned : 1;
309 } __PIR1bits_t;
311 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
313 #define _TMR1IF 0x01
314 #define _T1IF 0x01
315 #define _TMR2IF 0x02
316 #define _T2IF 0x02
317 #define _CCP1IF 0x04
318 #define _ADIF 0x40
320 //==============================================================================
323 //==============================================================================
324 // PIR2 Bits
326 extern __at(0x000D) __sfr PIR2;
328 typedef struct
330 unsigned : 1;
331 unsigned : 1;
332 unsigned : 1;
333 unsigned : 1;
334 unsigned EEIF : 1;
335 unsigned C1IF : 1;
336 unsigned C2IF : 1;
337 unsigned OSFIF : 1;
338 } __PIR2bits_t;
340 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
342 #define _EEIF 0x10
343 #define _C1IF 0x20
344 #define _C2IF 0x40
345 #define _OSFIF 0x80
347 //==============================================================================
349 extern __at(0x000E) __sfr TMR1;
350 extern __at(0x000E) __sfr TMR1L;
351 extern __at(0x000F) __sfr TMR1H;
353 //==============================================================================
354 // T1CON Bits
356 extern __at(0x0010) __sfr T1CON;
358 typedef union
360 struct
362 unsigned TMR1ON : 1;
363 unsigned TMR1CS : 1;
364 unsigned NOT_T1SYNC : 1;
365 unsigned T1OSCEN : 1;
366 unsigned T1CKPS0 : 1;
367 unsigned T1CKPS1 : 1;
368 unsigned TMR1GE : 1;
369 unsigned T1GINV : 1;
372 struct
374 unsigned : 4;
375 unsigned T1CKPS : 2;
376 unsigned : 2;
378 } __T1CONbits_t;
380 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
382 #define _TMR1ON 0x01
383 #define _TMR1CS 0x02
384 #define _NOT_T1SYNC 0x04
385 #define _T1OSCEN 0x08
386 #define _T1CKPS0 0x10
387 #define _T1CKPS1 0x20
388 #define _TMR1GE 0x40
389 #define _T1GINV 0x80
391 //==============================================================================
393 extern __at(0x0011) __sfr TMR2;
395 //==============================================================================
396 // T2CON Bits
398 extern __at(0x0012) __sfr T2CON;
400 typedef union
402 struct
404 unsigned T2CKPS0 : 1;
405 unsigned T2CKPS1 : 1;
406 unsigned TMR2ON : 1;
407 unsigned TOUTPS0 : 1;
408 unsigned TOUTPS1 : 1;
409 unsigned TOUTPS2 : 1;
410 unsigned TOUTPS3 : 1;
411 unsigned : 1;
414 struct
416 unsigned T2CKPS : 2;
417 unsigned : 6;
420 struct
422 unsigned : 3;
423 unsigned TOUTPS : 4;
424 unsigned : 1;
426 } __T2CONbits_t;
428 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
430 #define _T2CKPS0 0x01
431 #define _T2CKPS1 0x02
432 #define _TMR2ON 0x04
433 #define _TOUTPS0 0x08
434 #define _TOUTPS1 0x10
435 #define _TOUTPS2 0x20
436 #define _TOUTPS3 0x40
438 //==============================================================================
440 extern __at(0x0015) __sfr CCPR1;
441 extern __at(0x0015) __sfr CCPR1L;
442 extern __at(0x0016) __sfr CCPR1H;
444 //==============================================================================
445 // CCP1CON Bits
447 extern __at(0x0017) __sfr CCP1CON;
449 typedef union
451 struct
453 unsigned CCP1M0 : 1;
454 unsigned CCP1M1 : 1;
455 unsigned CCP1M2 : 1;
456 unsigned CCP1M3 : 1;
457 unsigned DC1B0 : 1;
458 unsigned DC1B1 : 1;
459 unsigned P1M0 : 1;
460 unsigned P1M1 : 1;
463 struct
465 unsigned CCP1M : 4;
466 unsigned : 4;
469 struct
471 unsigned : 4;
472 unsigned DC1B : 2;
473 unsigned : 2;
476 struct
478 unsigned : 6;
479 unsigned P1M : 2;
481 } __CCP1CONbits_t;
483 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
485 #define _CCP1M0 0x01
486 #define _CCP1M1 0x02
487 #define _CCP1M2 0x04
488 #define _CCP1M3 0x08
489 #define _DC1B0 0x10
490 #define _DC1B1 0x20
491 #define _P1M0 0x40
492 #define _P1M1 0x80
494 //==============================================================================
497 //==============================================================================
498 // PWM1CON Bits
500 extern __at(0x001C) __sfr PWM1CON;
502 typedef union
504 struct
506 unsigned PDC0 : 1;
507 unsigned PDC1 : 1;
508 unsigned PDC2 : 1;
509 unsigned PDC3 : 1;
510 unsigned PDC4 : 1;
511 unsigned PDC5 : 1;
512 unsigned PDC6 : 1;
513 unsigned PRSEN : 1;
516 struct
518 unsigned PDC : 7;
519 unsigned : 1;
521 } __PWM1CONbits_t;
523 extern __at(0x001C) volatile __PWM1CONbits_t PWM1CONbits;
525 #define _PDC0 0x01
526 #define _PDC1 0x02
527 #define _PDC2 0x04
528 #define _PDC3 0x08
529 #define _PDC4 0x10
530 #define _PDC5 0x20
531 #define _PDC6 0x40
532 #define _PRSEN 0x80
534 //==============================================================================
537 //==============================================================================
538 // ECCPAS Bits
540 extern __at(0x001D) __sfr ECCPAS;
542 typedef union
544 struct
546 unsigned PSSBD0 : 1;
547 unsigned PSSBD1 : 1;
548 unsigned PSSAC0 : 1;
549 unsigned PSSAC1 : 1;
550 unsigned ECCPAS0 : 1;
551 unsigned ECCPAS1 : 1;
552 unsigned ECCPAS2 : 1;
553 unsigned ECCPASE : 1;
556 struct
558 unsigned PSSBD : 2;
559 unsigned : 6;
562 struct
564 unsigned : 2;
565 unsigned PSSAC : 2;
566 unsigned : 4;
569 struct
571 unsigned : 4;
572 unsigned ECCPAS : 3;
573 unsigned : 1;
575 } __ECCPASbits_t;
577 extern __at(0x001D) volatile __ECCPASbits_t ECCPASbits;
579 #define _PSSBD0 0x01
580 #define _PSSBD1 0x02
581 #define _PSSAC0 0x04
582 #define _PSSAC1 0x08
583 #define _ECCPAS0 0x10
584 #define _ECCPAS1 0x20
585 #define _ECCPAS2 0x40
586 #define _ECCPASE 0x80
588 //==============================================================================
590 extern __at(0x001E) __sfr ADRESH;
592 //==============================================================================
593 // ADCON0 Bits
595 extern __at(0x001F) __sfr ADCON0;
597 typedef union
599 struct
601 unsigned ADON : 1;
602 unsigned GO_NOT_DONE : 1;
603 unsigned CHS0 : 1;
604 unsigned CHS1 : 1;
605 unsigned CHS2 : 1;
606 unsigned CHS3 : 1;
607 unsigned VCFG : 1;
608 unsigned ADFM : 1;
611 struct
613 unsigned : 1;
614 unsigned GO : 1;
615 unsigned : 1;
616 unsigned : 1;
617 unsigned : 1;
618 unsigned : 1;
619 unsigned : 1;
620 unsigned : 1;
623 struct
625 unsigned : 1;
626 unsigned NOT_DONE : 1;
627 unsigned : 1;
628 unsigned : 1;
629 unsigned : 1;
630 unsigned : 1;
631 unsigned : 1;
632 unsigned : 1;
635 struct
637 unsigned : 1;
638 unsigned GO_DONE : 1;
639 unsigned : 1;
640 unsigned : 1;
641 unsigned : 1;
642 unsigned : 1;
643 unsigned : 1;
644 unsigned : 1;
647 struct
649 unsigned : 2;
650 unsigned CHS : 4;
651 unsigned : 2;
653 } __ADCON0bits_t;
655 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
657 #define _ADON 0x01
658 #define _GO_NOT_DONE 0x02
659 #define _GO 0x02
660 #define _NOT_DONE 0x02
661 #define _GO_DONE 0x02
662 #define _CHS0 0x04
663 #define _CHS1 0x08
664 #define _CHS2 0x10
665 #define _CHS3 0x20
666 #define _VCFG 0x40
667 #define _ADFM 0x80
669 //==============================================================================
672 //==============================================================================
673 // OPTION_REG Bits
675 extern __at(0x0081) __sfr OPTION_REG;
677 typedef union
679 struct
681 unsigned PS0 : 1;
682 unsigned PS1 : 1;
683 unsigned PS2 : 1;
684 unsigned PSA : 1;
685 unsigned T0SE : 1;
686 unsigned T0CS : 1;
687 unsigned INTEDG : 1;
688 unsigned NOT_RABPU : 1;
691 struct
693 unsigned PS : 3;
694 unsigned : 5;
696 } __OPTION_REGbits_t;
698 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
700 #define _PS0 0x01
701 #define _PS1 0x02
702 #define _PS2 0x04
703 #define _PSA 0x08
704 #define _T0SE 0x10
705 #define _T0CS 0x20
706 #define _INTEDG 0x40
707 #define _NOT_RABPU 0x80
709 //==============================================================================
712 //==============================================================================
713 // TRISA Bits
715 extern __at(0x0085) __sfr TRISA;
717 typedef union
719 struct
721 unsigned TRISA0 : 1;
722 unsigned TRISA1 : 1;
723 unsigned TRISA2 : 1;
724 unsigned TRISA3 : 1;
725 unsigned TRISA4 : 1;
726 unsigned TRISA5 : 1;
727 unsigned : 1;
728 unsigned : 1;
731 struct
733 unsigned TRISA : 6;
734 unsigned : 2;
736 } __TRISAbits_t;
738 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
740 #define _TRISA0 0x01
741 #define _TRISA1 0x02
742 #define _TRISA2 0x04
743 #define _TRISA3 0x08
744 #define _TRISA4 0x10
745 #define _TRISA5 0x20
747 //==============================================================================
750 //==============================================================================
751 // TRISB Bits
753 extern __at(0x0086) __sfr TRISB;
755 typedef struct
757 unsigned : 1;
758 unsigned : 1;
759 unsigned : 1;
760 unsigned : 1;
761 unsigned TRISB4 : 1;
762 unsigned TRISB5 : 1;
763 unsigned TRISB6 : 1;
764 unsigned TRISB7 : 1;
765 } __TRISBbits_t;
767 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
769 #define _TRISB4 0x10
770 #define _TRISB5 0x20
771 #define _TRISB6 0x40
772 #define _TRISB7 0x80
774 //==============================================================================
777 //==============================================================================
778 // TRISC Bits
780 extern __at(0x0087) __sfr TRISC;
782 typedef struct
784 unsigned TRISC0 : 1;
785 unsigned TRISC1 : 1;
786 unsigned TRISC2 : 1;
787 unsigned TRISC3 : 1;
788 unsigned TRISC4 : 1;
789 unsigned TRISC5 : 1;
790 unsigned TRISC6 : 1;
791 unsigned TRISC7 : 1;
792 } __TRISCbits_t;
794 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
796 #define _TRISC0 0x01
797 #define _TRISC1 0x02
798 #define _TRISC2 0x04
799 #define _TRISC3 0x08
800 #define _TRISC4 0x10
801 #define _TRISC5 0x20
802 #define _TRISC6 0x40
803 #define _TRISC7 0x80
805 //==============================================================================
808 //==============================================================================
809 // PIE1 Bits
811 extern __at(0x008C) __sfr PIE1;
813 typedef union
815 struct
817 unsigned TMR1IE : 1;
818 unsigned TMR2IE : 1;
819 unsigned CCP1IE : 1;
820 unsigned : 1;
821 unsigned : 1;
822 unsigned : 1;
823 unsigned ADIE : 1;
824 unsigned : 1;
827 struct
829 unsigned T1IE : 1;
830 unsigned T2IE : 1;
831 unsigned : 1;
832 unsigned : 1;
833 unsigned : 1;
834 unsigned : 1;
835 unsigned : 1;
836 unsigned : 1;
838 } __PIE1bits_t;
840 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
842 #define _TMR1IE 0x01
843 #define _T1IE 0x01
844 #define _TMR2IE 0x02
845 #define _T2IE 0x02
846 #define _CCP1IE 0x04
847 #define _ADIE 0x40
849 //==============================================================================
852 //==============================================================================
853 // PIE2 Bits
855 extern __at(0x008D) __sfr PIE2;
857 typedef struct
859 unsigned : 1;
860 unsigned : 1;
861 unsigned : 1;
862 unsigned : 1;
863 unsigned EEIE : 1;
864 unsigned C1IE : 1;
865 unsigned C2IE : 1;
866 unsigned OSFIE : 1;
867 } __PIE2bits_t;
869 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
871 #define _EEIE 0x10
872 #define _C1IE 0x20
873 #define _C2IE 0x40
874 #define _OSFIE 0x80
876 //==============================================================================
879 //==============================================================================
880 // PCON Bits
882 extern __at(0x008E) __sfr PCON;
884 typedef union
886 struct
888 unsigned NOT_BOR : 1;
889 unsigned NOT_POR : 1;
890 unsigned : 1;
891 unsigned : 1;
892 unsigned SBOREN : 1;
893 unsigned ULPWUE : 1;
894 unsigned : 1;
895 unsigned : 1;
898 struct
900 unsigned NOT_BOD : 1;
901 unsigned : 1;
902 unsigned : 1;
903 unsigned : 1;
904 unsigned : 1;
905 unsigned : 1;
906 unsigned : 1;
907 unsigned : 1;
909 } __PCONbits_t;
911 extern __at(0x008E) volatile __PCONbits_t PCONbits;
913 #define _NOT_BOR 0x01
914 #define _NOT_BOD 0x01
915 #define _NOT_POR 0x02
916 #define _SBOREN 0x10
917 #define _ULPWUE 0x20
919 //==============================================================================
922 //==============================================================================
923 // OSCCON Bits
925 extern __at(0x008F) __sfr OSCCON;
927 typedef union
929 struct
931 unsigned SCS : 1;
932 unsigned LTS : 1;
933 unsigned HTS : 1;
934 unsigned OSTS : 1;
935 unsigned IRCF0 : 1;
936 unsigned IRCF1 : 1;
937 unsigned IRCF2 : 1;
938 unsigned : 1;
941 struct
943 unsigned : 4;
944 unsigned IRCF : 3;
945 unsigned : 1;
947 } __OSCCONbits_t;
949 extern __at(0x008F) volatile __OSCCONbits_t OSCCONbits;
951 #define _SCS 0x01
952 #define _LTS 0x02
953 #define _HTS 0x04
954 #define _OSTS 0x08
955 #define _IRCF0 0x10
956 #define _IRCF1 0x20
957 #define _IRCF2 0x40
959 //==============================================================================
962 //==============================================================================
963 // OSCTUNE Bits
965 extern __at(0x0090) __sfr OSCTUNE;
967 typedef union
969 struct
971 unsigned TUN0 : 1;
972 unsigned TUN1 : 1;
973 unsigned TUN2 : 1;
974 unsigned TUN3 : 1;
975 unsigned TUN4 : 1;
976 unsigned : 1;
977 unsigned : 1;
978 unsigned : 1;
981 struct
983 unsigned TUN : 5;
984 unsigned : 3;
986 } __OSCTUNEbits_t;
988 extern __at(0x0090) volatile __OSCTUNEbits_t OSCTUNEbits;
990 #define _TUN0 0x01
991 #define _TUN1 0x02
992 #define _TUN2 0x04
993 #define _TUN3 0x08
994 #define _TUN4 0x10
996 //==============================================================================
998 extern __at(0x0092) __sfr PR2;
1000 //==============================================================================
1001 // WPU Bits
1003 extern __at(0x0095) __sfr WPU;
1005 typedef union
1007 struct
1009 unsigned WPUA0 : 1;
1010 unsigned WPUA1 : 1;
1011 unsigned WPUA2 : 1;
1012 unsigned : 1;
1013 unsigned WPUA4 : 1;
1014 unsigned WPUA5 : 1;
1015 unsigned : 1;
1016 unsigned : 1;
1019 struct
1021 unsigned WPU0 : 1;
1022 unsigned WPU1 : 1;
1023 unsigned WPU2 : 1;
1024 unsigned : 1;
1025 unsigned WPU4 : 1;
1026 unsigned WPU5 : 1;
1027 unsigned : 1;
1028 unsigned : 1;
1030 } __WPUbits_t;
1032 extern __at(0x0095) volatile __WPUbits_t WPUbits;
1034 #define _WPUA0 0x01
1035 #define _WPU0 0x01
1036 #define _WPUA1 0x02
1037 #define _WPU1 0x02
1038 #define _WPUA2 0x04
1039 #define _WPU2 0x04
1040 #define _WPUA4 0x10
1041 #define _WPU4 0x10
1042 #define _WPUA5 0x20
1043 #define _WPU5 0x20
1045 //==============================================================================
1048 //==============================================================================
1049 // WPUA Bits
1051 extern __at(0x0095) __sfr WPUA;
1053 typedef union
1055 struct
1057 unsigned WPUA0 : 1;
1058 unsigned WPUA1 : 1;
1059 unsigned WPUA2 : 1;
1060 unsigned : 1;
1061 unsigned WPUA4 : 1;
1062 unsigned WPUA5 : 1;
1063 unsigned : 1;
1064 unsigned : 1;
1067 struct
1069 unsigned WPU0 : 1;
1070 unsigned WPU1 : 1;
1071 unsigned WPU2 : 1;
1072 unsigned : 1;
1073 unsigned WPU4 : 1;
1074 unsigned WPU5 : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1078 } __WPUAbits_t;
1080 extern __at(0x0095) volatile __WPUAbits_t WPUAbits;
1082 #define _WPUA_WPUA0 0x01
1083 #define _WPUA_WPU0 0x01
1084 #define _WPUA_WPUA1 0x02
1085 #define _WPUA_WPU1 0x02
1086 #define _WPUA_WPUA2 0x04
1087 #define _WPUA_WPU2 0x04
1088 #define _WPUA_WPUA4 0x10
1089 #define _WPUA_WPU4 0x10
1090 #define _WPUA_WPUA5 0x20
1091 #define _WPUA_WPU5 0x20
1093 //==============================================================================
1096 //==============================================================================
1097 // IOC Bits
1099 extern __at(0x0096) __sfr IOC;
1101 typedef union
1103 struct
1105 unsigned IOCA0 : 1;
1106 unsigned IOCA1 : 1;
1107 unsigned IOCA2 : 1;
1108 unsigned IOCA3 : 1;
1109 unsigned IOCA4 : 1;
1110 unsigned IOCA5 : 1;
1111 unsigned : 1;
1112 unsigned : 1;
1115 struct
1117 unsigned IOC0 : 1;
1118 unsigned IOC1 : 1;
1119 unsigned IOC2 : 1;
1120 unsigned IOC3 : 1;
1121 unsigned IOC4 : 1;
1122 unsigned IOC5 : 1;
1123 unsigned : 1;
1124 unsigned : 1;
1127 struct
1129 unsigned IOC : 6;
1130 unsigned : 2;
1133 struct
1135 unsigned IOCA : 6;
1136 unsigned : 2;
1138 } __IOCbits_t;
1140 extern __at(0x0096) volatile __IOCbits_t IOCbits;
1142 #define _IOCA0 0x01
1143 #define _IOC0 0x01
1144 #define _IOCA1 0x02
1145 #define _IOC1 0x02
1146 #define _IOCA2 0x04
1147 #define _IOC2 0x04
1148 #define _IOCA3 0x08
1149 #define _IOC3 0x08
1150 #define _IOCA4 0x10
1151 #define _IOC4 0x10
1152 #define _IOCA5 0x20
1153 #define _IOC5 0x20
1155 //==============================================================================
1158 //==============================================================================
1159 // IOCA Bits
1161 extern __at(0x0096) __sfr IOCA;
1163 typedef union
1165 struct
1167 unsigned IOCA0 : 1;
1168 unsigned IOCA1 : 1;
1169 unsigned IOCA2 : 1;
1170 unsigned IOCA3 : 1;
1171 unsigned IOCA4 : 1;
1172 unsigned IOCA5 : 1;
1173 unsigned : 1;
1174 unsigned : 1;
1177 struct
1179 unsigned IOC0 : 1;
1180 unsigned IOC1 : 1;
1181 unsigned IOC2 : 1;
1182 unsigned IOC3 : 1;
1183 unsigned IOC4 : 1;
1184 unsigned IOC5 : 1;
1185 unsigned : 1;
1186 unsigned : 1;
1189 struct
1191 unsigned IOCA : 6;
1192 unsigned : 2;
1195 struct
1197 unsigned IOC : 6;
1198 unsigned : 2;
1200 } __IOCAbits_t;
1202 extern __at(0x0096) volatile __IOCAbits_t IOCAbits;
1204 #define _IOCA_IOCA0 0x01
1205 #define _IOCA_IOC0 0x01
1206 #define _IOCA_IOCA1 0x02
1207 #define _IOCA_IOC1 0x02
1208 #define _IOCA_IOCA2 0x04
1209 #define _IOCA_IOC2 0x04
1210 #define _IOCA_IOCA3 0x08
1211 #define _IOCA_IOC3 0x08
1212 #define _IOCA_IOCA4 0x10
1213 #define _IOCA_IOC4 0x10
1214 #define _IOCA_IOCA5 0x20
1215 #define _IOCA_IOC5 0x20
1217 //==============================================================================
1220 //==============================================================================
1221 // WDTCON Bits
1223 extern __at(0x0097) __sfr WDTCON;
1225 typedef union
1227 struct
1229 unsigned SWDTEN : 1;
1230 unsigned WDTPS0 : 1;
1231 unsigned WDTPS1 : 1;
1232 unsigned WDTPS2 : 1;
1233 unsigned WDTPS3 : 1;
1234 unsigned : 1;
1235 unsigned : 1;
1236 unsigned : 1;
1239 struct
1241 unsigned : 1;
1242 unsigned WDTPS : 4;
1243 unsigned : 3;
1245 } __WDTCONbits_t;
1247 extern __at(0x0097) volatile __WDTCONbits_t WDTCONbits;
1249 #define _SWDTEN 0x01
1250 #define _WDTPS0 0x02
1251 #define _WDTPS1 0x04
1252 #define _WDTPS2 0x08
1253 #define _WDTPS3 0x10
1255 //==============================================================================
1257 extern __at(0x009E) __sfr ADRESL;
1259 //==============================================================================
1260 // ADCON1 Bits
1262 extern __at(0x009F) __sfr ADCON1;
1264 typedef union
1266 struct
1268 unsigned : 1;
1269 unsigned : 1;
1270 unsigned : 1;
1271 unsigned : 1;
1272 unsigned ADCS0 : 1;
1273 unsigned ADCS1 : 1;
1274 unsigned ADCS2 : 1;
1275 unsigned : 1;
1278 struct
1280 unsigned : 4;
1281 unsigned ADCS : 3;
1282 unsigned : 1;
1284 } __ADCON1bits_t;
1286 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1288 #define _ADCS0 0x10
1289 #define _ADCS1 0x20
1290 #define _ADCS2 0x40
1292 //==============================================================================
1294 extern __at(0x010C) __sfr EEDAT;
1295 extern __at(0x010C) __sfr EEDATA;
1296 extern __at(0x010D) __sfr EEADR;
1297 extern __at(0x010E) __sfr EEDATH;
1298 extern __at(0x010F) __sfr EEADRH;
1300 //==============================================================================
1301 // WPUB Bits
1303 extern __at(0x0115) __sfr WPUB;
1305 typedef struct
1307 unsigned : 1;
1308 unsigned : 1;
1309 unsigned : 1;
1310 unsigned : 1;
1311 unsigned WPUB4 : 1;
1312 unsigned WPUB5 : 1;
1313 unsigned WPUB6 : 1;
1314 unsigned WPUB7 : 1;
1315 } __WPUBbits_t;
1317 extern __at(0x0115) volatile __WPUBbits_t WPUBbits;
1319 #define _WPUB4 0x10
1320 #define _WPUB5 0x20
1321 #define _WPUB6 0x40
1322 #define _WPUB7 0x80
1324 //==============================================================================
1327 //==============================================================================
1328 // IOCB Bits
1330 extern __at(0x0116) __sfr IOCB;
1332 typedef struct
1334 unsigned : 1;
1335 unsigned : 1;
1336 unsigned : 1;
1337 unsigned : 1;
1338 unsigned IOCB4 : 1;
1339 unsigned IOCB5 : 1;
1340 unsigned IOCB6 : 1;
1341 unsigned IOCB7 : 1;
1342 } __IOCBbits_t;
1344 extern __at(0x0116) volatile __IOCBbits_t IOCBbits;
1346 #define _IOCB4 0x10
1347 #define _IOCB5 0x20
1348 #define _IOCB6 0x40
1349 #define _IOCB7 0x80
1351 //==============================================================================
1354 //==============================================================================
1355 // VRCON Bits
1357 extern __at(0x0118) __sfr VRCON;
1359 typedef union
1361 struct
1363 unsigned VR0 : 1;
1364 unsigned VR1 : 1;
1365 unsigned VR2 : 1;
1366 unsigned VR3 : 1;
1367 unsigned VP6EN : 1;
1368 unsigned VRR : 1;
1369 unsigned C2VREN : 1;
1370 unsigned C1VREN : 1;
1373 struct
1375 unsigned VR : 4;
1376 unsigned : 4;
1378 } __VRCONbits_t;
1380 extern __at(0x0118) volatile __VRCONbits_t VRCONbits;
1382 #define _VR0 0x01
1383 #define _VR1 0x02
1384 #define _VR2 0x04
1385 #define _VR3 0x08
1386 #define _VP6EN 0x10
1387 #define _VRR 0x20
1388 #define _C2VREN 0x40
1389 #define _C1VREN 0x80
1391 //==============================================================================
1394 //==============================================================================
1395 // CM1CON0 Bits
1397 extern __at(0x0119) __sfr CM1CON0;
1399 typedef union
1401 struct
1403 unsigned C1CH0 : 1;
1404 unsigned C1CH1 : 1;
1405 unsigned C1R : 1;
1406 unsigned : 1;
1407 unsigned C1POL : 1;
1408 unsigned C1OE : 1;
1409 unsigned C1OUT : 1;
1410 unsigned C1ON : 1;
1413 struct
1415 unsigned C1CH : 2;
1416 unsigned : 6;
1418 } __CM1CON0bits_t;
1420 extern __at(0x0119) volatile __CM1CON0bits_t CM1CON0bits;
1422 #define _C1CH0 0x01
1423 #define _C1CH1 0x02
1424 #define _C1R 0x04
1425 #define _C1POL 0x10
1426 #define _C1OE 0x20
1427 #define _C1OUT 0x40
1428 #define _C1ON 0x80
1430 //==============================================================================
1433 //==============================================================================
1434 // CM2CON0 Bits
1436 extern __at(0x011A) __sfr CM2CON0;
1438 typedef union
1440 struct
1442 unsigned C2CH0 : 1;
1443 unsigned C2CH1 : 1;
1444 unsigned C2R : 1;
1445 unsigned : 1;
1446 unsigned C2POL : 1;
1447 unsigned C2OE : 1;
1448 unsigned C2OUT : 1;
1449 unsigned C2ON : 1;
1452 struct
1454 unsigned C2CH : 2;
1455 unsigned : 6;
1457 } __CM2CON0bits_t;
1459 extern __at(0x011A) volatile __CM2CON0bits_t CM2CON0bits;
1461 #define _C2CH0 0x01
1462 #define _C2CH1 0x02
1463 #define _C2R 0x04
1464 #define _C2POL 0x10
1465 #define _C2OE 0x20
1466 #define _C2OUT 0x40
1467 #define _C2ON 0x80
1469 //==============================================================================
1472 //==============================================================================
1473 // CM2CON1 Bits
1475 extern __at(0x011B) __sfr CM2CON1;
1477 typedef struct
1479 unsigned C2SYNC : 1;
1480 unsigned T1GSS : 1;
1481 unsigned : 1;
1482 unsigned : 1;
1483 unsigned : 1;
1484 unsigned : 1;
1485 unsigned MC2OUT : 1;
1486 unsigned MC1OUT : 1;
1487 } __CM2CON1bits_t;
1489 extern __at(0x011B) volatile __CM2CON1bits_t CM2CON1bits;
1491 #define _C2SYNC 0x01
1492 #define _T1GSS 0x02
1493 #define _MC2OUT 0x40
1494 #define _MC1OUT 0x80
1496 //==============================================================================
1499 //==============================================================================
1500 // ANSEL Bits
1502 extern __at(0x011E) __sfr ANSEL;
1504 typedef struct
1506 unsigned ANS0 : 1;
1507 unsigned ANS1 : 1;
1508 unsigned ANS2 : 1;
1509 unsigned ANS3 : 1;
1510 unsigned ANS4 : 1;
1511 unsigned ANS5 : 1;
1512 unsigned ANS6 : 1;
1513 unsigned ANS7 : 1;
1514 } __ANSELbits_t;
1516 extern __at(0x011E) volatile __ANSELbits_t ANSELbits;
1518 #define _ANS0 0x01
1519 #define _ANS1 0x02
1520 #define _ANS2 0x04
1521 #define _ANS3 0x08
1522 #define _ANS4 0x10
1523 #define _ANS5 0x20
1524 #define _ANS6 0x40
1525 #define _ANS7 0x80
1527 //==============================================================================
1530 //==============================================================================
1531 // ANSELH Bits
1533 extern __at(0x011F) __sfr ANSELH;
1535 typedef struct
1537 unsigned ANS8 : 1;
1538 unsigned ANS9 : 1;
1539 unsigned ANS10 : 1;
1540 unsigned ANS11 : 1;
1541 unsigned : 1;
1542 unsigned : 1;
1543 unsigned : 1;
1544 unsigned : 1;
1545 } __ANSELHbits_t;
1547 extern __at(0x011F) volatile __ANSELHbits_t ANSELHbits;
1549 #define _ANS8 0x01
1550 #define _ANS9 0x02
1551 #define _ANS10 0x04
1552 #define _ANS11 0x08
1554 //==============================================================================
1557 //==============================================================================
1558 // EECON1 Bits
1560 extern __at(0x018C) __sfr EECON1;
1562 typedef struct
1564 unsigned RD : 1;
1565 unsigned WR : 1;
1566 unsigned WREN : 1;
1567 unsigned WRERR : 1;
1568 unsigned : 1;
1569 unsigned : 1;
1570 unsigned : 1;
1571 unsigned EEPGD : 1;
1572 } __EECON1bits_t;
1574 extern __at(0x018C) volatile __EECON1bits_t EECON1bits;
1576 #define _RD 0x01
1577 #define _WR 0x02
1578 #define _WREN 0x04
1579 #define _WRERR 0x08
1580 #define _EEPGD 0x80
1582 //==============================================================================
1584 extern __at(0x018D) __sfr EECON2;
1586 //==============================================================================
1587 // PSTRCON Bits
1589 extern __at(0x019D) __sfr PSTRCON;
1591 typedef struct
1593 unsigned STRA : 1;
1594 unsigned STRB : 1;
1595 unsigned STRC : 1;
1596 unsigned STRD : 1;
1597 unsigned STRSYNC : 1;
1598 unsigned : 1;
1599 unsigned : 1;
1600 unsigned : 1;
1601 } __PSTRCONbits_t;
1603 extern __at(0x019D) volatile __PSTRCONbits_t PSTRCONbits;
1605 #define _STRA 0x01
1606 #define _STRB 0x02
1607 #define _STRC 0x04
1608 #define _STRD 0x08
1609 #define _STRSYNC 0x10
1611 //==============================================================================
1614 //==============================================================================
1615 // SRCON Bits
1617 extern __at(0x019E) __sfr SRCON;
1619 typedef union
1621 struct
1623 unsigned : 1;
1624 unsigned : 1;
1625 unsigned PULSR : 1;
1626 unsigned PULSS : 1;
1627 unsigned C2REN : 1;
1628 unsigned C1SEN : 1;
1629 unsigned SR0 : 1;
1630 unsigned SR1 : 1;
1633 struct
1635 unsigned : 6;
1636 unsigned SR : 2;
1638 } __SRCONbits_t;
1640 extern __at(0x019E) volatile __SRCONbits_t SRCONbits;
1642 #define _PULSR 0x04
1643 #define _PULSS 0x08
1644 #define _C2REN 0x10
1645 #define _C1SEN 0x20
1646 #define _SR0 0x40
1647 #define _SR1 0x80
1649 //==============================================================================
1652 //==============================================================================
1654 // Configuration Bits
1656 //==============================================================================
1658 #define _CONFIG 0x2007
1660 //----------------------------- CONFIG Options -------------------------------
1662 #define _FOSC_LP 0x3FF8 // LP oscillator: Low-power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1663 #define _LP_OSC 0x3FF8 // LP oscillator: Low-power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1664 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1665 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1666 #define _FOSC_HS 0x3FFA // HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1667 #define _HS_OSC 0x3FFA // HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
1668 #define _FOSC_EC 0x3FFB // EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN.
1669 #define _EC_OSC 0x3FFB // EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN.
1670 #define _FOSC_INTRCIO 0x3FFC // INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1671 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1672 #define _INTOSCIO 0x3FFC // INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1673 #define _FOSC_INTRCCLK 0x3FFD // INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1674 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1675 #define _INTOSC 0x3FFD // INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
1676 #define _FOSC_EXTRCIO 0x3FFE // RCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1677 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1678 #define _EXTRCIO 0x3FFE // RCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1679 #define _FOSC_EXTRCCLK 0x3FFF // RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1680 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1681 #define _EXTRC 0x3FFF // RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
1682 #define _WDTE_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
1683 #define _WDT_OFF 0x3FF7 // WDT disabled and can be enabled by SWDTEN bit of the WDTCON register.
1684 #define _WDTE_ON 0x3FFF // WDT enabled.
1685 #define _WDT_ON 0x3FFF // WDT enabled.
1686 #define _PWRTE_ON 0x3FEF // PWRT enabled.
1687 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1688 #define _MCLRE_OFF 0x3FDF // MCLR pin function is digital input, MCLR internally tied to VDD.
1689 #define _MCLRE_ON 0x3FFF // MCLR pin function is MCLR.
1690 #define _CP_ON 0x3FBF // Program memory code protection is enabled.
1691 #define _CP_OFF 0x3FFF // Program memory code protection is disabled.
1692 #define _CPD_ON 0x3F7F // Data memory code protection is enabled.
1693 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
1694 #define _BOREN_OFF 0x3CFF // BOR disabled.
1695 #define _BOD_OFF 0x3CFF // BOR disabled.
1696 #define _BOR_OFF 0x3CFF // BOR disabled.
1697 #define _BOREN_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
1698 #define _BOD_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
1699 #define _BOR_SBODEN 0x3DFF // BOR controlled by SBOREN bit of the PCON register.
1700 #define _BOREN_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
1701 #define _BOD_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
1702 #define _BOR_NSLEEP 0x3EFF // BOR enabled during operation and disabled in Sleep.
1703 #define _BOREN_ON 0x3FFF // BOR enabled.
1704 #define _BOD_ON 0x3FFF // BOR enabled.
1705 #define _BOR_ON 0x3FFF // BOR enabled.
1706 #define _IESO_OFF 0x3BFF // Internal External Switchover mode is disabled.
1707 #define _IESO_ON 0x3FFF // Internal External Switchover mode is enabled.
1708 #define _FCMEN_OFF 0x37FF // Fail-Safe Clock Monitor is disabled.
1709 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor is enabled.
1711 //==============================================================================
1713 #define _DEVID1 0x2006
1715 #define _IDLOC0 0x2000
1716 #define _IDLOC1 0x2001
1717 #define _IDLOC2 0x2002
1718 #define _IDLOC3 0x2003
1720 //==============================================================================
1722 #ifndef NO_BIT_DEFINES
1724 #define ADON ADCON0bits.ADON // bit 0
1725 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
1726 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
1727 #define NOT_DONE ADCON0bits.NOT_DONE // bit 1, shadows bit in ADCON0bits
1728 #define GO_DONE ADCON0bits.GO_DONE // bit 1, shadows bit in ADCON0bits
1729 #define CHS0 ADCON0bits.CHS0 // bit 2
1730 #define CHS1 ADCON0bits.CHS1 // bit 3
1731 #define CHS2 ADCON0bits.CHS2 // bit 4
1732 #define CHS3 ADCON0bits.CHS3 // bit 5
1733 #define VCFG ADCON0bits.VCFG // bit 6
1734 #define ADFM ADCON0bits.ADFM // bit 7
1736 #define ADCS0 ADCON1bits.ADCS0 // bit 4
1737 #define ADCS1 ADCON1bits.ADCS1 // bit 5
1738 #define ADCS2 ADCON1bits.ADCS2 // bit 6
1740 #define ANS0 ANSELbits.ANS0 // bit 0
1741 #define ANS1 ANSELbits.ANS1 // bit 1
1742 #define ANS2 ANSELbits.ANS2 // bit 2
1743 #define ANS3 ANSELbits.ANS3 // bit 3
1744 #define ANS4 ANSELbits.ANS4 // bit 4
1745 #define ANS5 ANSELbits.ANS5 // bit 5
1746 #define ANS6 ANSELbits.ANS6 // bit 6
1747 #define ANS7 ANSELbits.ANS7 // bit 7
1749 #define ANS8 ANSELHbits.ANS8 // bit 0
1750 #define ANS9 ANSELHbits.ANS9 // bit 1
1751 #define ANS10 ANSELHbits.ANS10 // bit 2
1752 #define ANS11 ANSELHbits.ANS11 // bit 3
1754 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
1755 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
1756 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
1757 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
1758 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
1759 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
1760 #define P1M0 CCP1CONbits.P1M0 // bit 6
1761 #define P1M1 CCP1CONbits.P1M1 // bit 7
1763 #define C1CH0 CM1CON0bits.C1CH0 // bit 0
1764 #define C1CH1 CM1CON0bits.C1CH1 // bit 1
1765 #define C1R CM1CON0bits.C1R // bit 2
1766 #define C1POL CM1CON0bits.C1POL // bit 4
1767 #define C1OE CM1CON0bits.C1OE // bit 5
1768 #define C1OUT CM1CON0bits.C1OUT // bit 6
1769 #define C1ON CM1CON0bits.C1ON // bit 7
1771 #define C2CH0 CM2CON0bits.C2CH0 // bit 0
1772 #define C2CH1 CM2CON0bits.C2CH1 // bit 1
1773 #define C2R CM2CON0bits.C2R // bit 2
1774 #define C2POL CM2CON0bits.C2POL // bit 4
1775 #define C2OE CM2CON0bits.C2OE // bit 5
1776 #define C2OUT CM2CON0bits.C2OUT // bit 6
1777 #define C2ON CM2CON0bits.C2ON // bit 7
1779 #define C2SYNC CM2CON1bits.C2SYNC // bit 0
1780 #define T1GSS CM2CON1bits.T1GSS // bit 1
1781 #define MC2OUT CM2CON1bits.MC2OUT // bit 6
1782 #define MC1OUT CM2CON1bits.MC1OUT // bit 7
1784 #define PSSBD0 ECCPASbits.PSSBD0 // bit 0
1785 #define PSSBD1 ECCPASbits.PSSBD1 // bit 1
1786 #define PSSAC0 ECCPASbits.PSSAC0 // bit 2
1787 #define PSSAC1 ECCPASbits.PSSAC1 // bit 3
1788 #define ECCPAS0 ECCPASbits.ECCPAS0 // bit 4
1789 #define ECCPAS1 ECCPASbits.ECCPAS1 // bit 5
1790 #define ECCPAS2 ECCPASbits.ECCPAS2 // bit 6
1791 #define ECCPASE ECCPASbits.ECCPASE // bit 7
1793 #define RD EECON1bits.RD // bit 0
1794 #define WR EECON1bits.WR // bit 1
1795 #define WREN EECON1bits.WREN // bit 2
1796 #define WRERR EECON1bits.WRERR // bit 3
1797 #define EEPGD EECON1bits.EEPGD // bit 7
1799 #define RABIF INTCONbits.RABIF // bit 0
1800 #define INTF INTCONbits.INTF // bit 1
1801 #define T0IF INTCONbits.T0IF // bit 2
1802 #define RABIE INTCONbits.RABIE // bit 3
1803 #define INTE INTCONbits.INTE // bit 4
1804 #define T0IE INTCONbits.T0IE // bit 5
1805 #define PEIE INTCONbits.PEIE // bit 6
1806 #define GIE INTCONbits.GIE // bit 7
1808 #define IOCA0 IOCbits.IOCA0 // bit 0, shadows bit in IOCbits
1809 #define IOC0 IOCbits.IOC0 // bit 0, shadows bit in IOCbits
1810 #define IOCA1 IOCbits.IOCA1 // bit 1, shadows bit in IOCbits
1811 #define IOC1 IOCbits.IOC1 // bit 1, shadows bit in IOCbits
1812 #define IOCA2 IOCbits.IOCA2 // bit 2, shadows bit in IOCbits
1813 #define IOC2 IOCbits.IOC2 // bit 2, shadows bit in IOCbits
1814 #define IOCA3 IOCbits.IOCA3 // bit 3, shadows bit in IOCbits
1815 #define IOC3 IOCbits.IOC3 // bit 3, shadows bit in IOCbits
1816 #define IOCA4 IOCbits.IOCA4 // bit 4, shadows bit in IOCbits
1817 #define IOC4 IOCbits.IOC4 // bit 4, shadows bit in IOCbits
1818 #define IOCA5 IOCbits.IOCA5 // bit 5, shadows bit in IOCbits
1819 #define IOC5 IOCbits.IOC5 // bit 5, shadows bit in IOCbits
1821 #define IOCB4 IOCBbits.IOCB4 // bit 4
1822 #define IOCB5 IOCBbits.IOCB5 // bit 5
1823 #define IOCB6 IOCBbits.IOCB6 // bit 6
1824 #define IOCB7 IOCBbits.IOCB7 // bit 7
1826 #define PS0 OPTION_REGbits.PS0 // bit 0
1827 #define PS1 OPTION_REGbits.PS1 // bit 1
1828 #define PS2 OPTION_REGbits.PS2 // bit 2
1829 #define PSA OPTION_REGbits.PSA // bit 3
1830 #define T0SE OPTION_REGbits.T0SE // bit 4
1831 #define T0CS OPTION_REGbits.T0CS // bit 5
1832 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1833 #define NOT_RABPU OPTION_REGbits.NOT_RABPU // bit 7
1835 #define SCS OSCCONbits.SCS // bit 0
1836 #define LTS OSCCONbits.LTS // bit 1
1837 #define HTS OSCCONbits.HTS // bit 2
1838 #define OSTS OSCCONbits.OSTS // bit 3
1839 #define IRCF0 OSCCONbits.IRCF0 // bit 4
1840 #define IRCF1 OSCCONbits.IRCF1 // bit 5
1841 #define IRCF2 OSCCONbits.IRCF2 // bit 6
1843 #define TUN0 OSCTUNEbits.TUN0 // bit 0
1844 #define TUN1 OSCTUNEbits.TUN1 // bit 1
1845 #define TUN2 OSCTUNEbits.TUN2 // bit 2
1846 #define TUN3 OSCTUNEbits.TUN3 // bit 3
1847 #define TUN4 OSCTUNEbits.TUN4 // bit 4
1849 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1850 #define NOT_BOD PCONbits.NOT_BOD // bit 0, shadows bit in PCONbits
1851 #define NOT_POR PCONbits.NOT_POR // bit 1
1852 #define SBOREN PCONbits.SBOREN // bit 4
1853 #define ULPWUE PCONbits.ULPWUE // bit 5
1855 #define TMR1IE PIE1bits.TMR1IE // bit 0, shadows bit in PIE1bits
1856 #define T1IE PIE1bits.T1IE // bit 0, shadows bit in PIE1bits
1857 #define TMR2IE PIE1bits.TMR2IE // bit 1, shadows bit in PIE1bits
1858 #define T2IE PIE1bits.T2IE // bit 1, shadows bit in PIE1bits
1859 #define CCP1IE PIE1bits.CCP1IE // bit 2
1860 #define ADIE PIE1bits.ADIE // bit 6
1862 #define EEIE PIE2bits.EEIE // bit 4
1863 #define C1IE PIE2bits.C1IE // bit 5
1864 #define C2IE PIE2bits.C2IE // bit 6
1865 #define OSFIE PIE2bits.OSFIE // bit 7
1867 #define TMR1IF PIR1bits.TMR1IF // bit 0, shadows bit in PIR1bits
1868 #define T1IF PIR1bits.T1IF // bit 0, shadows bit in PIR1bits
1869 #define TMR2IF PIR1bits.TMR2IF // bit 1, shadows bit in PIR1bits
1870 #define T2IF PIR1bits.T2IF // bit 1, shadows bit in PIR1bits
1871 #define CCP1IF PIR1bits.CCP1IF // bit 2
1872 #define ADIF PIR1bits.ADIF // bit 6
1874 #define EEIF PIR2bits.EEIF // bit 4
1875 #define C1IF PIR2bits.C1IF // bit 5
1876 #define C2IF PIR2bits.C2IF // bit 6
1877 #define OSFIF PIR2bits.OSFIF // bit 7
1879 #define RA0 PORTAbits.RA0 // bit 0
1880 #define RA1 PORTAbits.RA1 // bit 1
1881 #define RA2 PORTAbits.RA2 // bit 2
1882 #define RA3 PORTAbits.RA3 // bit 3
1883 #define RA4 PORTAbits.RA4 // bit 4
1884 #define RA5 PORTAbits.RA5 // bit 5
1886 #define RB4 PORTBbits.RB4 // bit 4
1887 #define RB5 PORTBbits.RB5 // bit 5
1888 #define RB6 PORTBbits.RB6 // bit 6
1889 #define RB7 PORTBbits.RB7 // bit 7
1891 #define RC0 PORTCbits.RC0 // bit 0
1892 #define RC1 PORTCbits.RC1 // bit 1
1893 #define RC2 PORTCbits.RC2 // bit 2
1894 #define RC3 PORTCbits.RC3 // bit 3
1895 #define RC4 PORTCbits.RC4 // bit 4
1896 #define RC5 PORTCbits.RC5 // bit 5
1897 #define RC6 PORTCbits.RC6 // bit 6
1898 #define RC7 PORTCbits.RC7 // bit 7
1900 #define STRA PSTRCONbits.STRA // bit 0
1901 #define STRB PSTRCONbits.STRB // bit 1
1902 #define STRC PSTRCONbits.STRC // bit 2
1903 #define STRD PSTRCONbits.STRD // bit 3
1904 #define STRSYNC PSTRCONbits.STRSYNC // bit 4
1906 #define PDC0 PWM1CONbits.PDC0 // bit 0
1907 #define PDC1 PWM1CONbits.PDC1 // bit 1
1908 #define PDC2 PWM1CONbits.PDC2 // bit 2
1909 #define PDC3 PWM1CONbits.PDC3 // bit 3
1910 #define PDC4 PWM1CONbits.PDC4 // bit 4
1911 #define PDC5 PWM1CONbits.PDC5 // bit 5
1912 #define PDC6 PWM1CONbits.PDC6 // bit 6
1913 #define PRSEN PWM1CONbits.PRSEN // bit 7
1915 #define PULSR SRCONbits.PULSR // bit 2
1916 #define PULSS SRCONbits.PULSS // bit 3
1917 #define C2REN SRCONbits.C2REN // bit 4
1918 #define C1SEN SRCONbits.C1SEN // bit 5
1919 #define SR0 SRCONbits.SR0 // bit 6
1920 #define SR1 SRCONbits.SR1 // bit 7
1922 #define C STATUSbits.C // bit 0
1923 #define DC STATUSbits.DC // bit 1
1924 #define Z STATUSbits.Z // bit 2
1925 #define NOT_PD STATUSbits.NOT_PD // bit 3
1926 #define NOT_TO STATUSbits.NOT_TO // bit 4
1927 #define RP0 STATUSbits.RP0 // bit 5
1928 #define RP1 STATUSbits.RP1 // bit 6
1929 #define IRP STATUSbits.IRP // bit 7
1931 #define TMR1ON T1CONbits.TMR1ON // bit 0
1932 #define TMR1CS T1CONbits.TMR1CS // bit 1
1933 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
1934 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1935 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1936 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1937 #define TMR1GE T1CONbits.TMR1GE // bit 6
1938 #define T1GINV T1CONbits.T1GINV // bit 7
1940 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
1941 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
1942 #define TMR2ON T2CONbits.TMR2ON // bit 2
1943 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
1944 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
1945 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
1946 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
1948 #define TRISA0 TRISAbits.TRISA0 // bit 0
1949 #define TRISA1 TRISAbits.TRISA1 // bit 1
1950 #define TRISA2 TRISAbits.TRISA2 // bit 2
1951 #define TRISA3 TRISAbits.TRISA3 // bit 3
1952 #define TRISA4 TRISAbits.TRISA4 // bit 4
1953 #define TRISA5 TRISAbits.TRISA5 // bit 5
1955 #define TRISB4 TRISBbits.TRISB4 // bit 4
1956 #define TRISB5 TRISBbits.TRISB5 // bit 5
1957 #define TRISB6 TRISBbits.TRISB6 // bit 6
1958 #define TRISB7 TRISBbits.TRISB7 // bit 7
1960 #define TRISC0 TRISCbits.TRISC0 // bit 0
1961 #define TRISC1 TRISCbits.TRISC1 // bit 1
1962 #define TRISC2 TRISCbits.TRISC2 // bit 2
1963 #define TRISC3 TRISCbits.TRISC3 // bit 3
1964 #define TRISC4 TRISCbits.TRISC4 // bit 4
1965 #define TRISC5 TRISCbits.TRISC5 // bit 5
1966 #define TRISC6 TRISCbits.TRISC6 // bit 6
1967 #define TRISC7 TRISCbits.TRISC7 // bit 7
1969 #define VR0 VRCONbits.VR0 // bit 0
1970 #define VR1 VRCONbits.VR1 // bit 1
1971 #define VR2 VRCONbits.VR2 // bit 2
1972 #define VR3 VRCONbits.VR3 // bit 3
1973 #define VP6EN VRCONbits.VP6EN // bit 4
1974 #define VRR VRCONbits.VRR // bit 5
1975 #define C2VREN VRCONbits.C2VREN // bit 6
1976 #define C1VREN VRCONbits.C1VREN // bit 7
1978 #define SWDTEN WDTCONbits.SWDTEN // bit 0
1979 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1
1980 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2
1981 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3
1982 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4
1984 #define WPUA0 WPUbits.WPUA0 // bit 0, shadows bit in WPUbits
1985 #define WPU0 WPUbits.WPU0 // bit 0, shadows bit in WPUbits
1986 #define WPUA1 WPUbits.WPUA1 // bit 1, shadows bit in WPUbits
1987 #define WPU1 WPUbits.WPU1 // bit 1, shadows bit in WPUbits
1988 #define WPUA2 WPUbits.WPUA2 // bit 2, shadows bit in WPUbits
1989 #define WPU2 WPUbits.WPU2 // bit 2, shadows bit in WPUbits
1990 #define WPUA4 WPUbits.WPUA4 // bit 4, shadows bit in WPUbits
1991 #define WPU4 WPUbits.WPU4 // bit 4, shadows bit in WPUbits
1992 #define WPUA5 WPUbits.WPUA5 // bit 5, shadows bit in WPUbits
1993 #define WPU5 WPUbits.WPU5 // bit 5, shadows bit in WPUbits
1995 #define WPUB4 WPUBbits.WPUB4 // bit 4
1996 #define WPUB5 WPUBbits.WPUB5 // bit 5
1997 #define WPUB6 WPUBbits.WPUB6 // bit 6
1998 #define WPUB7 WPUBbits.WPUB7 // bit 7
2000 #endif // #ifndef NO_BIT_DEFINES
2002 #endif // #ifndef __PIC16F685_H__