1 /*
2  * This declarations of the PIC16F874 MCU.
3  *
4  * This file is part of the GNU PIC library for SDCC, originally
5  * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
6  *
7  * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:00 UTC.
8  *
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.
12  *
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.
21  *
22  * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
23  */
24 
25 #ifndef __PIC16F874_H__
26 #define __PIC16F874_H__
27 
28 //==============================================================================
29 //
30 //	Register Addresses
31 //
32 //==============================================================================
33 
34 #ifndef NO_ADDR_DEFINES
35 
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 SSPCON2_ADDR            0x0091
81 #define PR2_ADDR                0x0092
82 #define SSPADD_ADDR             0x0093
83 #define SSPSTAT_ADDR            0x0094
84 #define TXSTA_ADDR              0x0098
85 #define SPBRG_ADDR              0x0099
86 #define ADRESL_ADDR             0x009E
87 #define ADCON1_ADDR             0x009F
88 #define EEDATA_ADDR             0x010C
89 #define EEADR_ADDR              0x010D
90 #define EEDATH_ADDR             0x010E
91 #define EEADRH_ADDR             0x010F
92 #define EECON1_ADDR             0x018C
93 #define EECON2_ADDR             0x018D
94 
95 #endif // #ifndef NO_ADDR_DEFINES
96 
97 //==============================================================================
98 //
99 //	Register Definitions
100 //
101 //==============================================================================
102 
103 extern __at(0x0000) __sfr INDF;
104 extern __at(0x0001) __sfr TMR0;
105 extern __at(0x0002) __sfr PCL;
106 
107 //==============================================================================
108 //        STATUS Bits
109 
110 extern __at(0x0003) __sfr STATUS;
111 
112 typedef union
113   {
114   struct
115     {
116     unsigned C                  : 1;
117     unsigned DC                 : 1;
118     unsigned Z                  : 1;
119     unsigned NOT_PD             : 1;
120     unsigned NOT_TO             : 1;
121     unsigned RP0                : 1;
122     unsigned RP1                : 1;
123     unsigned IRP                : 1;
124     };
125 
126   struct
127     {
128     unsigned                    : 5;
129     unsigned RP                 : 2;
130     unsigned                    : 1;
131     };
132   } __STATUSbits_t;
133 
134 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
135 
136 #define _C                      0x01
137 #define _DC                     0x02
138 #define _Z                      0x04
139 #define _NOT_PD                 0x08
140 #define _NOT_TO                 0x10
141 #define _RP0                    0x20
142 #define _RP1                    0x40
143 #define _IRP                    0x80
144 
145 //==============================================================================
146 
147 extern __at(0x0004) __sfr FSR;
148 
149 //==============================================================================
150 //        PORTA Bits
151 
152 extern __at(0x0005) __sfr PORTA;
153 
154 typedef union
155   {
156   struct
157     {
158     unsigned RA0                : 1;
159     unsigned RA1                : 1;
160     unsigned RA2                : 1;
161     unsigned RA3                : 1;
162     unsigned RA4                : 1;
163     unsigned RA5                : 1;
164     unsigned                    : 1;
165     unsigned                    : 1;
166     };
167 
168   struct
169     {
170     unsigned RA                 : 6;
171     unsigned                    : 2;
172     };
173   } __PORTAbits_t;
174 
175 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
176 
177 #define _RA0                    0x01
178 #define _RA1                    0x02
179 #define _RA2                    0x04
180 #define _RA3                    0x08
181 #define _RA4                    0x10
182 #define _RA5                    0x20
183 
184 //==============================================================================
185 
186 
187 //==============================================================================
188 //        PORTB Bits
189 
190 extern __at(0x0006) __sfr PORTB;
191 
192 typedef struct
193   {
194   unsigned RB0                  : 1;
195   unsigned RB1                  : 1;
196   unsigned RB2                  : 1;
197   unsigned RB3                  : 1;
198   unsigned RB4                  : 1;
199   unsigned RB5                  : 1;
200   unsigned RB6                  : 1;
201   unsigned RB7                  : 1;
202   } __PORTBbits_t;
203 
204 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
205 
206 #define _RB0                    0x01
207 #define _RB1                    0x02
208 #define _RB2                    0x04
209 #define _RB3                    0x08
210 #define _RB4                    0x10
211 #define _RB5                    0x20
212 #define _RB6                    0x40
213 #define _RB7                    0x80
214 
215 //==============================================================================
216 
217 
218 //==============================================================================
219 //        PORTC Bits
220 
221 extern __at(0x0007) __sfr PORTC;
222 
223 typedef struct
224   {
225   unsigned RC0                  : 1;
226   unsigned RC1                  : 1;
227   unsigned RC2                  : 1;
228   unsigned RC3                  : 1;
229   unsigned RC4                  : 1;
230   unsigned RC5                  : 1;
231   unsigned RC6                  : 1;
232   unsigned RC7                  : 1;
233   } __PORTCbits_t;
234 
235 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
236 
237 #define _RC0                    0x01
238 #define _RC1                    0x02
239 #define _RC2                    0x04
240 #define _RC3                    0x08
241 #define _RC4                    0x10
242 #define _RC5                    0x20
243 #define _RC6                    0x40
244 #define _RC7                    0x80
245 
246 //==============================================================================
247 
248 
249 //==============================================================================
250 //        PORTD Bits
251 
252 extern __at(0x0008) __sfr PORTD;
253 
254 typedef struct
255   {
256   unsigned RD0                  : 1;
257   unsigned RD1                  : 1;
258   unsigned RD2                  : 1;
259   unsigned RD3                  : 1;
260   unsigned RD4                  : 1;
261   unsigned RD5                  : 1;
262   unsigned RD6                  : 1;
263   unsigned RD7                  : 1;
264   } __PORTDbits_t;
265 
266 extern __at(0x0008) volatile __PORTDbits_t PORTDbits;
267 
268 #define _RD0                    0x01
269 #define _RD1                    0x02
270 #define _RD2                    0x04
271 #define _RD3                    0x08
272 #define _RD4                    0x10
273 #define _RD5                    0x20
274 #define _RD6                    0x40
275 #define _RD7                    0x80
276 
277 //==============================================================================
278 
279 
280 //==============================================================================
281 //        PORTE Bits
282 
283 extern __at(0x0009) __sfr PORTE;
284 
285 typedef union
286   {
287   struct
288     {
289     unsigned RE0                : 1;
290     unsigned RE1                : 1;
291     unsigned RE2                : 1;
292     unsigned                    : 1;
293     unsigned                    : 1;
294     unsigned                    : 1;
295     unsigned                    : 1;
296     unsigned                    : 1;
297     };
298 
299   struct
300     {
301     unsigned RE                 : 3;
302     unsigned                    : 5;
303     };
304   } __PORTEbits_t;
305 
306 extern __at(0x0009) volatile __PORTEbits_t PORTEbits;
307 
308 #define _RE0                    0x01
309 #define _RE1                    0x02
310 #define _RE2                    0x04
311 
312 //==============================================================================
313 
314 extern __at(0x000A) __sfr PCLATH;
315 
316 //==============================================================================
317 //        INTCON Bits
318 
319 extern __at(0x000B) __sfr INTCON;
320 
321 typedef union
322   {
323   struct
324     {
325     unsigned RBIF               : 1;
326     unsigned INTF               : 1;
327     unsigned T0IF               : 1;
328     unsigned RBIE               : 1;
329     unsigned INTE               : 1;
330     unsigned T0IE               : 1;
331     unsigned PEIE               : 1;
332     unsigned GIE                : 1;
333     };
334 
335   struct
336     {
337     unsigned                    : 1;
338     unsigned                    : 1;
339     unsigned TMR0IF             : 1;
340     unsigned                    : 1;
341     unsigned                    : 1;
342     unsigned TMR0IE             : 1;
343     unsigned                    : 1;
344     unsigned                    : 1;
345     };
346   } __INTCONbits_t;
347 
348 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
349 
350 #define _RBIF                   0x01
351 #define _INTF                   0x02
352 #define _T0IF                   0x04
353 #define _TMR0IF                 0x04
354 #define _RBIE                   0x08
355 #define _INTE                   0x10
356 #define _T0IE                   0x20
357 #define _TMR0IE                 0x20
358 #define _PEIE                   0x40
359 #define _GIE                    0x80
360 
361 //==============================================================================
362 
363 
364 //==============================================================================
365 //        PIR1 Bits
366 
367 extern __at(0x000C) __sfr PIR1;
368 
369 typedef struct
370   {
371   unsigned TMR1IF               : 1;
372   unsigned TMR2IF               : 1;
373   unsigned CCP1IF               : 1;
374   unsigned SSPIF                : 1;
375   unsigned TXIF                 : 1;
376   unsigned RCIF                 : 1;
377   unsigned ADIF                 : 1;
378   unsigned PSPIF                : 1;
379   } __PIR1bits_t;
380 
381 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
382 
383 #define _TMR1IF                 0x01
384 #define _TMR2IF                 0x02
385 #define _CCP1IF                 0x04
386 #define _SSPIF                  0x08
387 #define _TXIF                   0x10
388 #define _RCIF                   0x20
389 #define _ADIF                   0x40
390 #define _PSPIF                  0x80
391 
392 //==============================================================================
393 
394 
395 //==============================================================================
396 //        PIR2 Bits
397 
398 extern __at(0x000D) __sfr PIR2;
399 
400 typedef struct
401   {
402   unsigned CCP2IF               : 1;
403   unsigned                      : 1;
404   unsigned                      : 1;
405   unsigned BCLIF                : 1;
406   unsigned EEIF                 : 1;
407   unsigned                      : 1;
408   unsigned                      : 1;
409   unsigned                      : 1;
410   } __PIR2bits_t;
411 
412 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
413 
414 #define _CCP2IF                 0x01
415 #define _BCLIF                  0x08
416 #define _EEIF                   0x10
417 
418 //==============================================================================
419 
420 extern __at(0x000E) __sfr TMR1;
421 extern __at(0x000E) __sfr TMR1L;
422 extern __at(0x000F) __sfr TMR1H;
423 
424 //==============================================================================
425 //        T1CON Bits
426 
427 extern __at(0x0010) __sfr T1CON;
428 
429 typedef union
430   {
431   struct
432     {
433     unsigned TMR1ON             : 1;
434     unsigned TMR1CS             : 1;
435     unsigned NOT_T1SYNC         : 1;
436     unsigned T1OSCEN            : 1;
437     unsigned T1CKPS0            : 1;
438     unsigned T1CKPS1            : 1;
439     unsigned                    : 1;
440     unsigned                    : 1;
441     };
442 
443   struct
444     {
445     unsigned                    : 1;
446     unsigned                    : 1;
447     unsigned T1INSYNC           : 1;
448     unsigned                    : 1;
449     unsigned                    : 1;
450     unsigned                    : 1;
451     unsigned                    : 1;
452     unsigned                    : 1;
453     };
454 
455   struct
456     {
457     unsigned                    : 1;
458     unsigned                    : 1;
459     unsigned T1SYNC             : 1;
460     unsigned                    : 1;
461     unsigned                    : 1;
462     unsigned                    : 1;
463     unsigned                    : 1;
464     unsigned                    : 1;
465     };
466 
467   struct
468     {
469     unsigned                    : 4;
470     unsigned T1CKPS             : 2;
471     unsigned                    : 2;
472     };
473   } __T1CONbits_t;
474 
475 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
476 
477 #define _TMR1ON                 0x01
478 #define _TMR1CS                 0x02
479 #define _NOT_T1SYNC             0x04
480 #define _T1INSYNC               0x04
481 #define _T1SYNC                 0x04
482 #define _T1OSCEN                0x08
483 #define _T1CKPS0                0x10
484 #define _T1CKPS1                0x20
485 
486 //==============================================================================
487 
488 extern __at(0x0011) __sfr TMR2;
489 
490 //==============================================================================
491 //        T2CON Bits
492 
493 extern __at(0x0012) __sfr T2CON;
494 
495 typedef union
496   {
497   struct
498     {
499     unsigned T2CKPS0            : 1;
500     unsigned T2CKPS1            : 1;
501     unsigned TMR2ON             : 1;
502     unsigned TOUTPS0            : 1;
503     unsigned TOUTPS1            : 1;
504     unsigned TOUTPS2            : 1;
505     unsigned TOUTPS3            : 1;
506     unsigned                    : 1;
507     };
508 
509   struct
510     {
511     unsigned T2CKPS             : 2;
512     unsigned                    : 6;
513     };
514 
515   struct
516     {
517     unsigned                    : 3;
518     unsigned TOUTPS             : 4;
519     unsigned                    : 1;
520     };
521   } __T2CONbits_t;
522 
523 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
524 
525 #define _T2CKPS0                0x01
526 #define _T2CKPS1                0x02
527 #define _TMR2ON                 0x04
528 #define _TOUTPS0                0x08
529 #define _TOUTPS1                0x10
530 #define _TOUTPS2                0x20
531 #define _TOUTPS3                0x40
532 
533 //==============================================================================
534 
535 extern __at(0x0013) __sfr SSPBUF;
536 
537 //==============================================================================
538 //        SSPCON Bits
539 
540 extern __at(0x0014) __sfr SSPCON;
541 
542 typedef union
543   {
544   struct
545     {
546     unsigned SSPM0              : 1;
547     unsigned SSPM1              : 1;
548     unsigned SSPM2              : 1;
549     unsigned SSPM3              : 1;
550     unsigned CKP                : 1;
551     unsigned SSPEN              : 1;
552     unsigned SSPOV              : 1;
553     unsigned WCOL               : 1;
554     };
555 
556   struct
557     {
558     unsigned SSPM               : 4;
559     unsigned                    : 4;
560     };
561   } __SSPCONbits_t;
562 
563 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
564 
565 #define _SSPM0                  0x01
566 #define _SSPM1                  0x02
567 #define _SSPM2                  0x04
568 #define _SSPM3                  0x08
569 #define _CKP                    0x10
570 #define _SSPEN                  0x20
571 #define _SSPOV                  0x40
572 #define _WCOL                   0x80
573 
574 //==============================================================================
575 
576 extern __at(0x0015) __sfr CCPR1;
577 extern __at(0x0015) __sfr CCPR1L;
578 extern __at(0x0016) __sfr CCPR1H;
579 
580 //==============================================================================
581 //        CCP1CON Bits
582 
583 extern __at(0x0017) __sfr CCP1CON;
584 
585 typedef union
586   {
587   struct
588     {
589     unsigned CCP1M0             : 1;
590     unsigned CCP1M1             : 1;
591     unsigned CCP1M2             : 1;
592     unsigned CCP1M3             : 1;
593     unsigned CCP1Y              : 1;
594     unsigned CCP1X              : 1;
595     unsigned                    : 1;
596     unsigned                    : 1;
597     };
598 
599   struct
600     {
601     unsigned CCP1M              : 4;
602     unsigned                    : 4;
603     };
604   } __CCP1CONbits_t;
605 
606 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
607 
608 #define _CCP1M0                 0x01
609 #define _CCP1M1                 0x02
610 #define _CCP1M2                 0x04
611 #define _CCP1M3                 0x08
612 #define _CCP1Y                  0x10
613 #define _CCP1X                  0x20
614 
615 //==============================================================================
616 
617 
618 //==============================================================================
619 //        RCSTA Bits
620 
621 extern __at(0x0018) __sfr RCSTA;
622 
623 typedef union
624   {
625   struct
626     {
627     unsigned RX9D               : 1;
628     unsigned OERR               : 1;
629     unsigned FERR               : 1;
630     unsigned ADDEN              : 1;
631     unsigned CREN               : 1;
632     unsigned SREN               : 1;
633     unsigned RX9                : 1;
634     unsigned SPEN               : 1;
635     };
636 
637   struct
638     {
639     unsigned RCD8               : 1;
640     unsigned                    : 1;
641     unsigned                    : 1;
642     unsigned                    : 1;
643     unsigned                    : 1;
644     unsigned                    : 1;
645     unsigned RC9                : 1;
646     unsigned                    : 1;
647     };
648 
649   struct
650     {
651     unsigned                    : 1;
652     unsigned                    : 1;
653     unsigned                    : 1;
654     unsigned                    : 1;
655     unsigned                    : 1;
656     unsigned                    : 1;
657     unsigned NOT_RC8            : 1;
658     unsigned                    : 1;
659     };
660 
661   struct
662     {
663     unsigned                    : 1;
664     unsigned                    : 1;
665     unsigned                    : 1;
666     unsigned                    : 1;
667     unsigned                    : 1;
668     unsigned                    : 1;
669     unsigned RC8_9              : 1;
670     unsigned                    : 1;
671     };
672   } __RCSTAbits_t;
673 
674 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
675 
676 #define _RX9D                   0x01
677 #define _RCD8                   0x01
678 #define _OERR                   0x02
679 #define _FERR                   0x04
680 #define _ADDEN                  0x08
681 #define _CREN                   0x10
682 #define _SREN                   0x20
683 #define _RX9                    0x40
684 #define _RC9                    0x40
685 #define _NOT_RC8                0x40
686 #define _RC8_9                  0x40
687 #define _SPEN                   0x80
688 
689 //==============================================================================
690 
691 extern __at(0x0019) __sfr TXREG;
692 extern __at(0x001A) __sfr RCREG;
693 extern __at(0x001B) __sfr CCPR2;
694 extern __at(0x001B) __sfr CCPR2L;
695 extern __at(0x001C) __sfr CCPR2H;
696 
697 //==============================================================================
698 //        CCP2CON Bits
699 
700 extern __at(0x001D) __sfr CCP2CON;
701 
702 typedef union
703   {
704   struct
705     {
706     unsigned CCP2M0             : 1;
707     unsigned CCP2M1             : 1;
708     unsigned CCP2M2             : 1;
709     unsigned CCP2M3             : 1;
710     unsigned CCP2Y              : 1;
711     unsigned CCP2X              : 1;
712     unsigned                    : 1;
713     unsigned                    : 1;
714     };
715 
716   struct
717     {
718     unsigned CCP2M              : 4;
719     unsigned                    : 4;
720     };
721   } __CCP2CONbits_t;
722 
723 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
724 
725 #define _CCP2M0                 0x01
726 #define _CCP2M1                 0x02
727 #define _CCP2M2                 0x04
728 #define _CCP2M3                 0x08
729 #define _CCP2Y                  0x10
730 #define _CCP2X                  0x20
731 
732 //==============================================================================
733 
734 extern __at(0x001E) __sfr ADRESH;
735 
736 //==============================================================================
737 //        ADCON0 Bits
738 
739 extern __at(0x001F) __sfr ADCON0;
740 
741 typedef union
742   {
743   struct
744     {
745     unsigned ADON               : 1;
746     unsigned                    : 1;
747     unsigned GO_NOT_DONE        : 1;
748     unsigned CHS0               : 1;
749     unsigned CHS1               : 1;
750     unsigned CHS2               : 1;
751     unsigned ADCS0              : 1;
752     unsigned ADCS1              : 1;
753     };
754 
755   struct
756     {
757     unsigned                    : 1;
758     unsigned                    : 1;
759     unsigned GO                 : 1;
760     unsigned                    : 1;
761     unsigned                    : 1;
762     unsigned                    : 1;
763     unsigned                    : 1;
764     unsigned                    : 1;
765     };
766 
767   struct
768     {
769     unsigned                    : 1;
770     unsigned                    : 1;
771     unsigned NOT_DONE           : 1;
772     unsigned                    : 1;
773     unsigned                    : 1;
774     unsigned                    : 1;
775     unsigned                    : 1;
776     unsigned                    : 1;
777     };
778 
779   struct
780     {
781     unsigned                    : 1;
782     unsigned                    : 1;
783     unsigned GO_DONE            : 1;
784     unsigned                    : 1;
785     unsigned                    : 1;
786     unsigned                    : 1;
787     unsigned                    : 1;
788     unsigned                    : 1;
789     };
790 
791   struct
792     {
793     unsigned                    : 3;
794     unsigned CHS                : 3;
795     unsigned                    : 2;
796     };
797 
798   struct
799     {
800     unsigned                    : 6;
801     unsigned ADCS               : 2;
802     };
803   } __ADCON0bits_t;
804 
805 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
806 
807 #define _ADON                   0x01
808 #define _GO_NOT_DONE            0x04
809 #define _GO                     0x04
810 #define _NOT_DONE               0x04
811 #define _GO_DONE                0x04
812 #define _CHS0                   0x08
813 #define _CHS1                   0x10
814 #define _CHS2                   0x20
815 #define _ADCS0                  0x40
816 #define _ADCS1                  0x80
817 
818 //==============================================================================
819 
820 
821 //==============================================================================
822 //        OPTION_REG Bits
823 
824 extern __at(0x0081) __sfr OPTION_REG;
825 
826 typedef union
827   {
828   struct
829     {
830     unsigned PS0                : 1;
831     unsigned PS1                : 1;
832     unsigned PS2                : 1;
833     unsigned PSA                : 1;
834     unsigned T0SE               : 1;
835     unsigned T0CS               : 1;
836     unsigned INTEDG             : 1;
837     unsigned NOT_RBPU           : 1;
838     };
839 
840   struct
841     {
842     unsigned PS                 : 3;
843     unsigned                    : 5;
844     };
845   } __OPTION_REGbits_t;
846 
847 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
848 
849 #define _PS0                    0x01
850 #define _PS1                    0x02
851 #define _PS2                    0x04
852 #define _PSA                    0x08
853 #define _T0SE                   0x10
854 #define _T0CS                   0x20
855 #define _INTEDG                 0x40
856 #define _NOT_RBPU               0x80
857 
858 //==============================================================================
859 
860 
861 //==============================================================================
862 //        TRISA Bits
863 
864 extern __at(0x0085) __sfr TRISA;
865 
866 typedef union
867   {
868   struct
869     {
870     unsigned TRISA0             : 1;
871     unsigned TRISA1             : 1;
872     unsigned TRISA2             : 1;
873     unsigned TRISA3             : 1;
874     unsigned TRISA4             : 1;
875     unsigned TRISA5             : 1;
876     unsigned                    : 1;
877     unsigned                    : 1;
878     };
879 
880   struct
881     {
882     unsigned TRISA              : 6;
883     unsigned                    : 2;
884     };
885   } __TRISAbits_t;
886 
887 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
888 
889 #define _TRISA0                 0x01
890 #define _TRISA1                 0x02
891 #define _TRISA2                 0x04
892 #define _TRISA3                 0x08
893 #define _TRISA4                 0x10
894 #define _TRISA5                 0x20
895 
896 //==============================================================================
897 
898 
899 //==============================================================================
900 //        TRISB Bits
901 
902 extern __at(0x0086) __sfr TRISB;
903 
904 typedef struct
905   {
906   unsigned TRISB0               : 1;
907   unsigned TRISB1               : 1;
908   unsigned TRISB2               : 1;
909   unsigned TRISB3               : 1;
910   unsigned TRISB4               : 1;
911   unsigned TRISB5               : 1;
912   unsigned TRISB6               : 1;
913   unsigned TRISB7               : 1;
914   } __TRISBbits_t;
915 
916 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
917 
918 #define _TRISB0                 0x01
919 #define _TRISB1                 0x02
920 #define _TRISB2                 0x04
921 #define _TRISB3                 0x08
922 #define _TRISB4                 0x10
923 #define _TRISB5                 0x20
924 #define _TRISB6                 0x40
925 #define _TRISB7                 0x80
926 
927 //==============================================================================
928 
929 
930 //==============================================================================
931 //        TRISC Bits
932 
933 extern __at(0x0087) __sfr TRISC;
934 
935 typedef struct
936   {
937   unsigned TRISC0               : 1;
938   unsigned TRISC1               : 1;
939   unsigned TRISC2               : 1;
940   unsigned TRISC3               : 1;
941   unsigned TRISC4               : 1;
942   unsigned TRISC5               : 1;
943   unsigned TRISC6               : 1;
944   unsigned TRISC7               : 1;
945   } __TRISCbits_t;
946 
947 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
948 
949 #define _TRISC0                 0x01
950 #define _TRISC1                 0x02
951 #define _TRISC2                 0x04
952 #define _TRISC3                 0x08
953 #define _TRISC4                 0x10
954 #define _TRISC5                 0x20
955 #define _TRISC6                 0x40
956 #define _TRISC7                 0x80
957 
958 //==============================================================================
959 
960 
961 //==============================================================================
962 //        TRISD Bits
963 
964 extern __at(0x0088) __sfr TRISD;
965 
966 typedef struct
967   {
968   unsigned TRISD0               : 1;
969   unsigned TRISD1               : 1;
970   unsigned TRISD2               : 1;
971   unsigned TRISD3               : 1;
972   unsigned TRISD4               : 1;
973   unsigned TRISD5               : 1;
974   unsigned TRISD6               : 1;
975   unsigned TRISD7               : 1;
976   } __TRISDbits_t;
977 
978 extern __at(0x0088) volatile __TRISDbits_t TRISDbits;
979 
980 #define _TRISD0                 0x01
981 #define _TRISD1                 0x02
982 #define _TRISD2                 0x04
983 #define _TRISD3                 0x08
984 #define _TRISD4                 0x10
985 #define _TRISD5                 0x20
986 #define _TRISD6                 0x40
987 #define _TRISD7                 0x80
988 
989 //==============================================================================
990 
991 
992 //==============================================================================
993 //        TRISE Bits
994 
995 extern __at(0x0089) __sfr TRISE;
996 
997 typedef union
998   {
999   struct
1000     {
1001     unsigned TRISE0             : 1;
1002     unsigned TRISE1             : 1;
1003     unsigned TRISE2             : 1;
1004     unsigned                    : 1;
1005     unsigned PSPMODE            : 1;
1006     unsigned IBOV               : 1;
1007     unsigned OBF                : 1;
1008     unsigned IBF                : 1;
1009     };
1010 
1011   struct
1012     {
1013     unsigned TRISE              : 3;
1014     unsigned                    : 5;
1015     };
1016   } __TRISEbits_t;
1017 
1018 extern __at(0x0089) volatile __TRISEbits_t TRISEbits;
1019 
1020 #define _TRISE0                 0x01
1021 #define _TRISE1                 0x02
1022 #define _TRISE2                 0x04
1023 #define _PSPMODE                0x10
1024 #define _IBOV                   0x20
1025 #define _OBF                    0x40
1026 #define _IBF                    0x80
1027 
1028 //==============================================================================
1029 
1030 
1031 //==============================================================================
1032 //        PIE1 Bits
1033 
1034 extern __at(0x008C) __sfr PIE1;
1035 
1036 typedef struct
1037   {
1038   unsigned TMR1IE               : 1;
1039   unsigned TMR2IE               : 1;
1040   unsigned CCP1IE               : 1;
1041   unsigned SSPIE                : 1;
1042   unsigned TXIE                 : 1;
1043   unsigned RCIE                 : 1;
1044   unsigned ADIE                 : 1;
1045   unsigned PSPIE                : 1;
1046   } __PIE1bits_t;
1047 
1048 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
1049 
1050 #define _TMR1IE                 0x01
1051 #define _TMR2IE                 0x02
1052 #define _CCP1IE                 0x04
1053 #define _SSPIE                  0x08
1054 #define _TXIE                   0x10
1055 #define _RCIE                   0x20
1056 #define _ADIE                   0x40
1057 #define _PSPIE                  0x80
1058 
1059 //==============================================================================
1060 
1061 
1062 //==============================================================================
1063 //        PIE2 Bits
1064 
1065 extern __at(0x008D) __sfr PIE2;
1066 
1067 typedef struct
1068   {
1069   unsigned CCP2IE               : 1;
1070   unsigned                      : 1;
1071   unsigned                      : 1;
1072   unsigned BCLIE                : 1;
1073   unsigned EEIE                 : 1;
1074   unsigned                      : 1;
1075   unsigned                      : 1;
1076   unsigned                      : 1;
1077   } __PIE2bits_t;
1078 
1079 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
1080 
1081 #define _CCP2IE                 0x01
1082 #define _BCLIE                  0x08
1083 #define _EEIE                   0x10
1084 
1085 //==============================================================================
1086 
1087 
1088 //==============================================================================
1089 //        PCON Bits
1090 
1091 extern __at(0x008E) __sfr PCON;
1092 
1093 typedef union
1094   {
1095   struct
1096     {
1097     unsigned NOT_BOR            : 1;
1098     unsigned NOT_POR            : 1;
1099     unsigned                    : 1;
1100     unsigned                    : 1;
1101     unsigned                    : 1;
1102     unsigned                    : 1;
1103     unsigned                    : 1;
1104     unsigned                    : 1;
1105     };
1106 
1107   struct
1108     {
1109     unsigned NOT_BO             : 1;
1110     unsigned                    : 1;
1111     unsigned                    : 1;
1112     unsigned                    : 1;
1113     unsigned                    : 1;
1114     unsigned                    : 1;
1115     unsigned                    : 1;
1116     unsigned                    : 1;
1117     };
1118   } __PCONbits_t;
1119 
1120 extern __at(0x008E) volatile __PCONbits_t PCONbits;
1121 
1122 #define _NOT_BOR                0x01
1123 #define _NOT_BO                 0x01
1124 #define _NOT_POR                0x02
1125 
1126 //==============================================================================
1127 
1128 
1129 //==============================================================================
1130 //        SSPCON2 Bits
1131 
1132 extern __at(0x0091) __sfr SSPCON2;
1133 
1134 typedef struct
1135   {
1136   unsigned SEN                  : 1;
1137   unsigned RSEN                 : 1;
1138   unsigned PEN                  : 1;
1139   unsigned RCEN                 : 1;
1140   unsigned ACKEN                : 1;
1141   unsigned ACKDT                : 1;
1142   unsigned ACKSTAT              : 1;
1143   unsigned GCEN                 : 1;
1144   } __SSPCON2bits_t;
1145 
1146 extern __at(0x0091) volatile __SSPCON2bits_t SSPCON2bits;
1147 
1148 #define _SEN                    0x01
1149 #define _RSEN                   0x02
1150 #define _PEN                    0x04
1151 #define _RCEN                   0x08
1152 #define _ACKEN                  0x10
1153 #define _ACKDT                  0x20
1154 #define _ACKSTAT                0x40
1155 #define _GCEN                   0x80
1156 
1157 //==============================================================================
1158 
1159 extern __at(0x0092) __sfr PR2;
1160 extern __at(0x0093) __sfr SSPADD;
1161 
1162 //==============================================================================
1163 //        SSPSTAT Bits
1164 
1165 extern __at(0x0094) __sfr SSPSTAT;
1166 
1167 typedef union
1168   {
1169   struct
1170     {
1171     unsigned BF                 : 1;
1172     unsigned UA                 : 1;
1173     unsigned R_NOT_W            : 1;
1174     unsigned S                  : 1;
1175     unsigned P                  : 1;
1176     unsigned D_NOT_A            : 1;
1177     unsigned CKE                : 1;
1178     unsigned SMP                : 1;
1179     };
1180 
1181   struct
1182     {
1183     unsigned                    : 1;
1184     unsigned                    : 1;
1185     unsigned R                  : 1;
1186     unsigned I2C_START          : 1;
1187     unsigned I2C_STOP           : 1;
1188     unsigned D                  : 1;
1189     unsigned                    : 1;
1190     unsigned                    : 1;
1191     };
1192 
1193   struct
1194     {
1195     unsigned                    : 1;
1196     unsigned                    : 1;
1197     unsigned I2C_READ           : 1;
1198     unsigned                    : 1;
1199     unsigned                    : 1;
1200     unsigned I2C_DATA           : 1;
1201     unsigned                    : 1;
1202     unsigned                    : 1;
1203     };
1204 
1205   struct
1206     {
1207     unsigned                    : 1;
1208     unsigned                    : 1;
1209     unsigned NOT_W              : 1;
1210     unsigned                    : 1;
1211     unsigned                    : 1;
1212     unsigned NOT_A              : 1;
1213     unsigned                    : 1;
1214     unsigned                    : 1;
1215     };
1216 
1217   struct
1218     {
1219     unsigned                    : 1;
1220     unsigned                    : 1;
1221     unsigned NOT_WRITE          : 1;
1222     unsigned                    : 1;
1223     unsigned                    : 1;
1224     unsigned NOT_ADDRESS        : 1;
1225     unsigned                    : 1;
1226     unsigned                    : 1;
1227     };
1228 
1229   struct
1230     {
1231     unsigned                    : 1;
1232     unsigned                    : 1;
1233     unsigned R_W                : 1;
1234     unsigned                    : 1;
1235     unsigned                    : 1;
1236     unsigned D_A                : 1;
1237     unsigned                    : 1;
1238     unsigned                    : 1;
1239     };
1240 
1241   struct
1242     {
1243     unsigned                    : 1;
1244     unsigned                    : 1;
1245     unsigned READ_WRITE         : 1;
1246     unsigned                    : 1;
1247     unsigned                    : 1;
1248     unsigned DATA_ADDRESS       : 1;
1249     unsigned                    : 1;
1250     unsigned                    : 1;
1251     };
1252   } __SSPSTATbits_t;
1253 
1254 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1255 
1256 #define _BF                     0x01
1257 #define _UA                     0x02
1258 #define _R_NOT_W                0x04
1259 #define _R                      0x04
1260 #define _I2C_READ               0x04
1261 #define _NOT_W                  0x04
1262 #define _NOT_WRITE              0x04
1263 #define _R_W                    0x04
1264 #define _READ_WRITE             0x04
1265 #define _S                      0x08
1266 #define _I2C_START              0x08
1267 #define _P                      0x10
1268 #define _I2C_STOP               0x10
1269 #define _D_NOT_A                0x20
1270 #define _D                      0x20
1271 #define _I2C_DATA               0x20
1272 #define _NOT_A                  0x20
1273 #define _NOT_ADDRESS            0x20
1274 #define _D_A                    0x20
1275 #define _DATA_ADDRESS           0x20
1276 #define _CKE                    0x40
1277 #define _SMP                    0x80
1278 
1279 //==============================================================================
1280 
1281 
1282 //==============================================================================
1283 //        TXSTA Bits
1284 
1285 extern __at(0x0098) __sfr TXSTA;
1286 
1287 typedef union
1288   {
1289   struct
1290     {
1291     unsigned TX9D               : 1;
1292     unsigned TRMT               : 1;
1293     unsigned BRGH               : 1;
1294     unsigned                    : 1;
1295     unsigned SYNC               : 1;
1296     unsigned TXEN               : 1;
1297     unsigned TX9                : 1;
1298     unsigned CSRC               : 1;
1299     };
1300 
1301   struct
1302     {
1303     unsigned TXD8               : 1;
1304     unsigned                    : 1;
1305     unsigned                    : 1;
1306     unsigned                    : 1;
1307     unsigned                    : 1;
1308     unsigned                    : 1;
1309     unsigned NOT_TX8            : 1;
1310     unsigned                    : 1;
1311     };
1312 
1313   struct
1314     {
1315     unsigned                    : 1;
1316     unsigned                    : 1;
1317     unsigned                    : 1;
1318     unsigned                    : 1;
1319     unsigned                    : 1;
1320     unsigned                    : 1;
1321     unsigned TX8_9              : 1;
1322     unsigned                    : 1;
1323     };
1324   } __TXSTAbits_t;
1325 
1326 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1327 
1328 #define _TX9D                   0x01
1329 #define _TXD8                   0x01
1330 #define _TRMT                   0x02
1331 #define _BRGH                   0x04
1332 #define _SYNC                   0x10
1333 #define _TXEN                   0x20
1334 #define _TX9                    0x40
1335 #define _NOT_TX8                0x40
1336 #define _TX8_9                  0x40
1337 #define _CSRC                   0x80
1338 
1339 //==============================================================================
1340 
1341 extern __at(0x0099) __sfr SPBRG;
1342 extern __at(0x009E) __sfr ADRESL;
1343 
1344 //==============================================================================
1345 //        ADCON1 Bits
1346 
1347 extern __at(0x009F) __sfr ADCON1;
1348 
1349 typedef union
1350   {
1351   struct
1352     {
1353     unsigned PCFG0              : 1;
1354     unsigned PCFG1              : 1;
1355     unsigned PCFG2              : 1;
1356     unsigned PCFG3              : 1;
1357     unsigned                    : 1;
1358     unsigned                    : 1;
1359     unsigned                    : 1;
1360     unsigned ADFM               : 1;
1361     };
1362 
1363   struct
1364     {
1365     unsigned PCFG               : 4;
1366     unsigned                    : 4;
1367     };
1368   } __ADCON1bits_t;
1369 
1370 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1371 
1372 #define _PCFG0                  0x01
1373 #define _PCFG1                  0x02
1374 #define _PCFG2                  0x04
1375 #define _PCFG3                  0x08
1376 #define _ADFM                   0x80
1377 
1378 //==============================================================================
1379 
1380 extern __at(0x010C) __sfr EEDATA;
1381 extern __at(0x010D) __sfr EEADR;
1382 extern __at(0x010E) __sfr EEDATH;
1383 extern __at(0x010F) __sfr EEADRH;
1384 
1385 //==============================================================================
1386 //        EECON1 Bits
1387 
1388 extern __at(0x018C) __sfr EECON1;
1389 
1390 typedef struct
1391   {
1392   unsigned RD                   : 1;
1393   unsigned WR                   : 1;
1394   unsigned WREN                 : 1;
1395   unsigned WRERR                : 1;
1396   unsigned                      : 1;
1397   unsigned                      : 1;
1398   unsigned                      : 1;
1399   unsigned EEPGD                : 1;
1400   } __EECON1bits_t;
1401 
1402 extern __at(0x018C) volatile __EECON1bits_t EECON1bits;
1403 
1404 #define _RD                     0x01
1405 #define _WR                     0x02
1406 #define _WREN                   0x04
1407 #define _WRERR                  0x08
1408 #define _EEPGD                  0x80
1409 
1410 //==============================================================================
1411 
1412 extern __at(0x018D) __sfr EECON2;
1413 
1414 //==============================================================================
1415 //
1416 //        Configuration Bits
1417 //
1418 //==============================================================================
1419 
1420 #define _CONFIG                 0x2007
1421 
1422 //----------------------------- CONFIG Options -------------------------------
1423 
1424 #define _FOSC_LP                0x3FFC  // LP oscillator.
1425 #define _LP_OSC                 0x3FFC  // LP oscillator.
1426 #define _FOSC_XT                0x3FFD  // XT oscillator.
1427 #define _XT_OSC                 0x3FFD  // XT oscillator.
1428 #define _FOSC_HS                0x3FFE  // HS oscillator.
1429 #define _HS_OSC                 0x3FFE  // HS oscillator.
1430 #define _FOSC_EXTRC             0x3FFF  // RC oscillator.
1431 #define _RC_OSC                 0x3FFF  // RC oscillator.
1432 #define _WDTE_OFF               0x3FFB  // WDT disabled.
1433 #define _WDT_OFF                0x3FFB  // WDT disabled.
1434 #define _WDTE_ON                0x3FFF  // WDT enabled.
1435 #define _WDT_ON                 0x3FFF  // WDT enabled.
1436 #define _PWRTE_ON               0x3FF7  // PWRT enabled.
1437 #define _PWRTE_OFF              0x3FFF  // PWRT disabled.
1438 #define _CP_ALL                 0x0FCF  // 0000h to 0FFFh code protected.
1439 #define _CP_HALF                0x1FDF  // 0800h to 0FFFh code protected.
1440 #define _CP_UPPER_256           0x2FEF  // 0F00h to 0FFFh code protected.
1441 #define _CP_OFF                 0x3FFF  // Code protection off.
1442 #define _BOREN_OFF              0x3FBF  // BOR disabled.
1443 #define _BODEN_OFF              0x3FBF  // BOR disabled.
1444 #define _BOREN_ON               0x3FFF  // BOR enabled.
1445 #define _BODEN_ON               0x3FFF  // BOR enabled.
1446 #define _LVP_OFF                0x3F7F  // RB3 is digital I/O, HV on MCLR must be used for programming.
1447 #define _LVP_ON                 0x3FFF  // RB3/PGM pin has PGM function; low-voltage programming enabled.
1448 #define _CPD_ON                 0x3EFF  // Data EEPROM memory code-protected.
1449 #define _CPD_OFF                0x3FFF  // Code Protection off.
1450 #define _WRT_OFF                0x3DFF  // Unprotected program memory may not be written to by EECON control.
1451 #define _WRT_ENABLE_OFF         0x3DFF  // Unprotected program memory may not be written to by EECON control.
1452 #define _WRT_ON                 0x3FFF  // Unprotected program memory may be written to by EECON control.
1453 #define _WRT_ENABLE_ON          0x3FFF  // Unprotected program memory may be written to by EECON control.
1454 #define _DEBUG_ON               0x37FF  // In-Circuit Debugger enabled, RB6 and RB7 are dedicated to the debugger.
1455 #define _DEBUG_OFF              0x3FFF  // In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins.
1456 
1457 //==============================================================================
1458 
1459 #define _DEVID1                 0x2006
1460 
1461 #define _IDLOC0                 0x2000
1462 #define _IDLOC1                 0x2001
1463 #define _IDLOC2                 0x2002
1464 #define _IDLOC3                 0x2003
1465 
1466 //==============================================================================
1467 
1468 #ifndef NO_BIT_DEFINES
1469 
1470 #define ADON                    ADCON0bits.ADON                 // bit 0
1471 #define GO_NOT_DONE             ADCON0bits.GO_NOT_DONE          // bit 2, shadows bit in ADCON0bits
1472 #define GO                      ADCON0bits.GO                   // bit 2, shadows bit in ADCON0bits
1473 #define NOT_DONE                ADCON0bits.NOT_DONE             // bit 2, shadows bit in ADCON0bits
1474 #define GO_DONE                 ADCON0bits.GO_DONE              // bit 2, shadows bit in ADCON0bits
1475 #define CHS0                    ADCON0bits.CHS0                 // bit 3
1476 #define CHS1                    ADCON0bits.CHS1                 // bit 4
1477 #define CHS2                    ADCON0bits.CHS2                 // bit 5
1478 #define ADCS0                   ADCON0bits.ADCS0                // bit 6
1479 #define ADCS1                   ADCON0bits.ADCS1                // bit 7
1480 
1481 #define PCFG0                   ADCON1bits.PCFG0                // bit 0
1482 #define PCFG1                   ADCON1bits.PCFG1                // bit 1
1483 #define PCFG2                   ADCON1bits.PCFG2                // bit 2
1484 #define PCFG3                   ADCON1bits.PCFG3                // bit 3
1485 #define ADFM                    ADCON1bits.ADFM                 // bit 7
1486 
1487 #define CCP1M0                  CCP1CONbits.CCP1M0              // bit 0
1488 #define CCP1M1                  CCP1CONbits.CCP1M1              // bit 1
1489 #define CCP1M2                  CCP1CONbits.CCP1M2              // bit 2
1490 #define CCP1M3                  CCP1CONbits.CCP1M3              // bit 3
1491 #define CCP1Y                   CCP1CONbits.CCP1Y               // bit 4
1492 #define CCP1X                   CCP1CONbits.CCP1X               // bit 5
1493 
1494 #define CCP2M0                  CCP2CONbits.CCP2M0              // bit 0
1495 #define CCP2M1                  CCP2CONbits.CCP2M1              // bit 1
1496 #define CCP2M2                  CCP2CONbits.CCP2M2              // bit 2
1497 #define CCP2M3                  CCP2CONbits.CCP2M3              // bit 3
1498 #define CCP2Y                   CCP2CONbits.CCP2Y               // bit 4
1499 #define CCP2X                   CCP2CONbits.CCP2X               // bit 5
1500 
1501 #define RD                      EECON1bits.RD                   // bit 0
1502 #define WR                      EECON1bits.WR                   // bit 1
1503 #define WREN                    EECON1bits.WREN                 // bit 2
1504 #define WRERR                   EECON1bits.WRERR                // bit 3
1505 #define EEPGD                   EECON1bits.EEPGD                // bit 7
1506 
1507 #define RBIF                    INTCONbits.RBIF                 // bit 0
1508 #define INTF                    INTCONbits.INTF                 // bit 1
1509 #define T0IF                    INTCONbits.T0IF                 // bit 2, shadows bit in INTCONbits
1510 #define TMR0IF                  INTCONbits.TMR0IF               // bit 2, shadows bit in INTCONbits
1511 #define RBIE                    INTCONbits.RBIE                 // bit 3
1512 #define INTE                    INTCONbits.INTE                 // bit 4
1513 #define T0IE                    INTCONbits.T0IE                 // bit 5, shadows bit in INTCONbits
1514 #define TMR0IE                  INTCONbits.TMR0IE               // bit 5, shadows bit in INTCONbits
1515 #define PEIE                    INTCONbits.PEIE                 // bit 6
1516 #define GIE                     INTCONbits.GIE                  // bit 7
1517 
1518 #define PS0                     OPTION_REGbits.PS0              // bit 0
1519 #define PS1                     OPTION_REGbits.PS1              // bit 1
1520 #define PS2                     OPTION_REGbits.PS2              // bit 2
1521 #define PSA                     OPTION_REGbits.PSA              // bit 3
1522 #define T0SE                    OPTION_REGbits.T0SE             // bit 4
1523 #define T0CS                    OPTION_REGbits.T0CS             // bit 5
1524 #define INTEDG                  OPTION_REGbits.INTEDG           // bit 6
1525 #define NOT_RBPU                OPTION_REGbits.NOT_RBPU         // bit 7
1526 
1527 #define NOT_BOR                 PCONbits.NOT_BOR                // bit 0, shadows bit in PCONbits
1528 #define NOT_BO                  PCONbits.NOT_BO                 // bit 0, shadows bit in PCONbits
1529 #define NOT_POR                 PCONbits.NOT_POR                // bit 1
1530 
1531 #define TMR1IE                  PIE1bits.TMR1IE                 // bit 0
1532 #define TMR2IE                  PIE1bits.TMR2IE                 // bit 1
1533 #define CCP1IE                  PIE1bits.CCP1IE                 // bit 2
1534 #define SSPIE                   PIE1bits.SSPIE                  // bit 3
1535 #define TXIE                    PIE1bits.TXIE                   // bit 4
1536 #define RCIE                    PIE1bits.RCIE                   // bit 5
1537 #define ADIE                    PIE1bits.ADIE                   // bit 6
1538 #define PSPIE                   PIE1bits.PSPIE                  // bit 7
1539 
1540 #define CCP2IE                  PIE2bits.CCP2IE                 // bit 0
1541 #define BCLIE                   PIE2bits.BCLIE                  // bit 3
1542 #define EEIE                    PIE2bits.EEIE                   // bit 4
1543 
1544 #define TMR1IF                  PIR1bits.TMR1IF                 // bit 0
1545 #define TMR2IF                  PIR1bits.TMR2IF                 // bit 1
1546 #define CCP1IF                  PIR1bits.CCP1IF                 // bit 2
1547 #define SSPIF                   PIR1bits.SSPIF                  // bit 3
1548 #define TXIF                    PIR1bits.TXIF                   // bit 4
1549 #define RCIF                    PIR1bits.RCIF                   // bit 5
1550 #define ADIF                    PIR1bits.ADIF                   // bit 6
1551 #define PSPIF                   PIR1bits.PSPIF                  // bit 7
1552 
1553 #define CCP2IF                  PIR2bits.CCP2IF                 // bit 0
1554 #define BCLIF                   PIR2bits.BCLIF                  // bit 3
1555 #define EEIF                    PIR2bits.EEIF                   // bit 4
1556 
1557 #define RA0                     PORTAbits.RA0                   // bit 0
1558 #define RA1                     PORTAbits.RA1                   // bit 1
1559 #define RA2                     PORTAbits.RA2                   // bit 2
1560 #define RA3                     PORTAbits.RA3                   // bit 3
1561 #define RA4                     PORTAbits.RA4                   // bit 4
1562 #define RA5                     PORTAbits.RA5                   // bit 5
1563 
1564 #define RB0                     PORTBbits.RB0                   // bit 0
1565 #define RB1                     PORTBbits.RB1                   // bit 1
1566 #define RB2                     PORTBbits.RB2                   // bit 2
1567 #define RB3                     PORTBbits.RB3                   // bit 3
1568 #define RB4                     PORTBbits.RB4                   // bit 4
1569 #define RB5                     PORTBbits.RB5                   // bit 5
1570 #define RB6                     PORTBbits.RB6                   // bit 6
1571 #define RB7                     PORTBbits.RB7                   // bit 7
1572 
1573 #define RC0                     PORTCbits.RC0                   // bit 0
1574 #define RC1                     PORTCbits.RC1                   // bit 1
1575 #define RC2                     PORTCbits.RC2                   // bit 2
1576 #define RC3                     PORTCbits.RC3                   // bit 3
1577 #define RC4                     PORTCbits.RC4                   // bit 4
1578 #define RC5                     PORTCbits.RC5                   // bit 5
1579 #define RC6                     PORTCbits.RC6                   // bit 6
1580 #define RC7                     PORTCbits.RC7                   // bit 7
1581 
1582 #define RD0                     PORTDbits.RD0                   // bit 0
1583 #define RD1                     PORTDbits.RD1                   // bit 1
1584 #define RD2                     PORTDbits.RD2                   // bit 2
1585 #define RD3                     PORTDbits.RD3                   // bit 3
1586 #define RD4                     PORTDbits.RD4                   // bit 4
1587 #define RD5                     PORTDbits.RD5                   // bit 5
1588 #define RD6                     PORTDbits.RD6                   // bit 6
1589 #define RD7                     PORTDbits.RD7                   // bit 7
1590 
1591 #define RE0                     PORTEbits.RE0                   // bit 0
1592 #define RE1                     PORTEbits.RE1                   // bit 1
1593 #define RE2                     PORTEbits.RE2                   // bit 2
1594 
1595 #define RX9D                    RCSTAbits.RX9D                  // bit 0, shadows bit in RCSTAbits
1596 #define RCD8                    RCSTAbits.RCD8                  // bit 0, shadows bit in RCSTAbits
1597 #define OERR                    RCSTAbits.OERR                  // bit 1
1598 #define FERR                    RCSTAbits.FERR                  // bit 2
1599 #define ADDEN                   RCSTAbits.ADDEN                 // bit 3
1600 #define CREN                    RCSTAbits.CREN                  // bit 4
1601 #define SREN                    RCSTAbits.SREN                  // bit 5
1602 #define RX9                     RCSTAbits.RX9                   // bit 6, shadows bit in RCSTAbits
1603 #define RC9                     RCSTAbits.RC9                   // bit 6, shadows bit in RCSTAbits
1604 #define NOT_RC8                 RCSTAbits.NOT_RC8               // bit 6, shadows bit in RCSTAbits
1605 #define RC8_9                   RCSTAbits.RC8_9                 // bit 6, shadows bit in RCSTAbits
1606 #define SPEN                    RCSTAbits.SPEN                  // bit 7
1607 
1608 #define SSPM0                   SSPCONbits.SSPM0                // bit 0
1609 #define SSPM1                   SSPCONbits.SSPM1                // bit 1
1610 #define SSPM2                   SSPCONbits.SSPM2                // bit 2
1611 #define SSPM3                   SSPCONbits.SSPM3                // bit 3
1612 #define CKP                     SSPCONbits.CKP                  // bit 4
1613 #define SSPEN                   SSPCONbits.SSPEN                // bit 5
1614 #define SSPOV                   SSPCONbits.SSPOV                // bit 6
1615 #define WCOL                    SSPCONbits.WCOL                 // bit 7
1616 
1617 #define SEN                     SSPCON2bits.SEN                 // bit 0
1618 #define RSEN                    SSPCON2bits.RSEN                // bit 1
1619 #define PEN                     SSPCON2bits.PEN                 // bit 2
1620 #define RCEN                    SSPCON2bits.RCEN                // bit 3
1621 #define ACKEN                   SSPCON2bits.ACKEN               // bit 4
1622 #define ACKDT                   SSPCON2bits.ACKDT               // bit 5
1623 #define ACKSTAT                 SSPCON2bits.ACKSTAT             // bit 6
1624 #define GCEN                    SSPCON2bits.GCEN                // bit 7
1625 
1626 #define BF                      SSPSTATbits.BF                  // bit 0
1627 #define UA                      SSPSTATbits.UA                  // bit 1
1628 #define R_NOT_W                 SSPSTATbits.R_NOT_W             // bit 2, shadows bit in SSPSTATbits
1629 #define R                       SSPSTATbits.R                   // bit 2, shadows bit in SSPSTATbits
1630 #define I2C_READ                SSPSTATbits.I2C_READ            // bit 2, shadows bit in SSPSTATbits
1631 #define NOT_W                   SSPSTATbits.NOT_W               // bit 2, shadows bit in SSPSTATbits
1632 #define NOT_WRITE               SSPSTATbits.NOT_WRITE           // bit 2, shadows bit in SSPSTATbits
1633 #define R_W                     SSPSTATbits.R_W                 // bit 2, shadows bit in SSPSTATbits
1634 #define READ_WRITE              SSPSTATbits.READ_WRITE          // bit 2, shadows bit in SSPSTATbits
1635 #define S                       SSPSTATbits.S                   // bit 3, shadows bit in SSPSTATbits
1636 #define I2C_START               SSPSTATbits.I2C_START           // bit 3, shadows bit in SSPSTATbits
1637 #define P                       SSPSTATbits.P                   // bit 4, shadows bit in SSPSTATbits
1638 #define I2C_STOP                SSPSTATbits.I2C_STOP            // bit 4, shadows bit in SSPSTATbits
1639 #define D_NOT_A                 SSPSTATbits.D_NOT_A             // bit 5, shadows bit in SSPSTATbits
1640 #define D                       SSPSTATbits.D                   // bit 5, shadows bit in SSPSTATbits
1641 #define I2C_DATA                SSPSTATbits.I2C_DATA            // bit 5, shadows bit in SSPSTATbits
1642 #define NOT_A                   SSPSTATbits.NOT_A               // bit 5, shadows bit in SSPSTATbits
1643 #define NOT_ADDRESS             SSPSTATbits.NOT_ADDRESS         // bit 5, shadows bit in SSPSTATbits
1644 #define D_A                     SSPSTATbits.D_A                 // bit 5, shadows bit in SSPSTATbits
1645 #define DATA_ADDRESS            SSPSTATbits.DATA_ADDRESS        // bit 5, shadows bit in SSPSTATbits
1646 #define CKE                     SSPSTATbits.CKE                 // bit 6
1647 #define SMP                     SSPSTATbits.SMP                 // bit 7
1648 
1649 #define C                       STATUSbits.C                    // bit 0
1650 #define DC                      STATUSbits.DC                   // bit 1
1651 #define Z                       STATUSbits.Z                    // bit 2
1652 #define NOT_PD                  STATUSbits.NOT_PD               // bit 3
1653 #define NOT_TO                  STATUSbits.NOT_TO               // bit 4
1654 #define RP0                     STATUSbits.RP0                  // bit 5
1655 #define RP1                     STATUSbits.RP1                  // bit 6
1656 #define IRP                     STATUSbits.IRP                  // bit 7
1657 
1658 #define TMR1ON                  T1CONbits.TMR1ON                // bit 0
1659 #define TMR1CS                  T1CONbits.TMR1CS                // bit 1
1660 #define NOT_T1SYNC              T1CONbits.NOT_T1SYNC            // bit 2, shadows bit in T1CONbits
1661 #define T1INSYNC                T1CONbits.T1INSYNC              // bit 2, shadows bit in T1CONbits
1662 #define T1SYNC                  T1CONbits.T1SYNC                // bit 2, shadows bit in T1CONbits
1663 #define T1OSCEN                 T1CONbits.T1OSCEN               // bit 3
1664 #define T1CKPS0                 T1CONbits.T1CKPS0               // bit 4
1665 #define T1CKPS1                 T1CONbits.T1CKPS1               // bit 5
1666 
1667 #define T2CKPS0                 T2CONbits.T2CKPS0               // bit 0
1668 #define T2CKPS1                 T2CONbits.T2CKPS1               // bit 1
1669 #define TMR2ON                  T2CONbits.TMR2ON                // bit 2
1670 #define TOUTPS0                 T2CONbits.TOUTPS0               // bit 3
1671 #define TOUTPS1                 T2CONbits.TOUTPS1               // bit 4
1672 #define TOUTPS2                 T2CONbits.TOUTPS2               // bit 5
1673 #define TOUTPS3                 T2CONbits.TOUTPS3               // bit 6
1674 
1675 #define TRISA0                  TRISAbits.TRISA0                // bit 0
1676 #define TRISA1                  TRISAbits.TRISA1                // bit 1
1677 #define TRISA2                  TRISAbits.TRISA2                // bit 2
1678 #define TRISA3                  TRISAbits.TRISA3                // bit 3
1679 #define TRISA4                  TRISAbits.TRISA4                // bit 4
1680 #define TRISA5                  TRISAbits.TRISA5                // bit 5
1681 
1682 #define TRISB0                  TRISBbits.TRISB0                // bit 0
1683 #define TRISB1                  TRISBbits.TRISB1                // bit 1
1684 #define TRISB2                  TRISBbits.TRISB2                // bit 2
1685 #define TRISB3                  TRISBbits.TRISB3                // bit 3
1686 #define TRISB4                  TRISBbits.TRISB4                // bit 4
1687 #define TRISB5                  TRISBbits.TRISB5                // bit 5
1688 #define TRISB6                  TRISBbits.TRISB6                // bit 6
1689 #define TRISB7                  TRISBbits.TRISB7                // bit 7
1690 
1691 #define TRISC0                  TRISCbits.TRISC0                // bit 0
1692 #define TRISC1                  TRISCbits.TRISC1                // bit 1
1693 #define TRISC2                  TRISCbits.TRISC2                // bit 2
1694 #define TRISC3                  TRISCbits.TRISC3                // bit 3
1695 #define TRISC4                  TRISCbits.TRISC4                // bit 4
1696 #define TRISC5                  TRISCbits.TRISC5                // bit 5
1697 #define TRISC6                  TRISCbits.TRISC6                // bit 6
1698 #define TRISC7                  TRISCbits.TRISC7                // bit 7
1699 
1700 #define TRISD0                  TRISDbits.TRISD0                // bit 0
1701 #define TRISD1                  TRISDbits.TRISD1                // bit 1
1702 #define TRISD2                  TRISDbits.TRISD2                // bit 2
1703 #define TRISD3                  TRISDbits.TRISD3                // bit 3
1704 #define TRISD4                  TRISDbits.TRISD4                // bit 4
1705 #define TRISD5                  TRISDbits.TRISD5                // bit 5
1706 #define TRISD6                  TRISDbits.TRISD6                // bit 6
1707 #define TRISD7                  TRISDbits.TRISD7                // bit 7
1708 
1709 #define TRISE0                  TRISEbits.TRISE0                // bit 0
1710 #define TRISE1                  TRISEbits.TRISE1                // bit 1
1711 #define TRISE2                  TRISEbits.TRISE2                // bit 2
1712 #define PSPMODE                 TRISEbits.PSPMODE               // bit 4
1713 #define IBOV                    TRISEbits.IBOV                  // bit 5
1714 #define OBF                     TRISEbits.OBF                   // bit 6
1715 #define IBF                     TRISEbits.IBF                   // bit 7
1716 
1717 #define TX9D                    TXSTAbits.TX9D                  // bit 0, shadows bit in TXSTAbits
1718 #define TXD8                    TXSTAbits.TXD8                  // bit 0, shadows bit in TXSTAbits
1719 #define TRMT                    TXSTAbits.TRMT                  // bit 1
1720 #define BRGH                    TXSTAbits.BRGH                  // bit 2
1721 #define SYNC                    TXSTAbits.SYNC                  // bit 4
1722 #define TXEN                    TXSTAbits.TXEN                  // bit 5
1723 #define TX9                     TXSTAbits.TX9                   // bit 6, shadows bit in TXSTAbits
1724 #define NOT_TX8                 TXSTAbits.NOT_TX8               // bit 6, shadows bit in TXSTAbits
1725 #define TX8_9                   TXSTAbits.TX8_9                 // bit 6, shadows bit in TXSTAbits
1726 #define CSRC                    TXSTAbits.CSRC                  // bit 7
1727 
1728 #endif // #ifndef NO_BIT_DEFINES
1729 
1730 #endif // #ifndef __PIC16F874_H__
1731