struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16f73.h
blob70f485e7526b0cf42ef48197724f70e880e3ef0b
1 /*
2 * This declarations of the PIC16F73 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:55 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 __PIC16F73_H__
26 #define __PIC16F73_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 SSPBUF_ADDR 0x0013
55 #define SSPCON_ADDR 0x0014
56 #define CCPR1_ADDR 0x0015
57 #define CCPR1L_ADDR 0x0015
58 #define CCPR1H_ADDR 0x0016
59 #define CCP1CON_ADDR 0x0017
60 #define RCSTA_ADDR 0x0018
61 #define TXREG_ADDR 0x0019
62 #define RCREG_ADDR 0x001A
63 #define CCPR2_ADDR 0x001B
64 #define CCPR2L_ADDR 0x001B
65 #define CCPR2H_ADDR 0x001C
66 #define CCP2CON_ADDR 0x001D
67 #define ADRES_ADDR 0x001E
68 #define ADCON0_ADDR 0x001F
69 #define OPTION_REG_ADDR 0x0081
70 #define TRISA_ADDR 0x0085
71 #define TRISB_ADDR 0x0086
72 #define TRISC_ADDR 0x0087
73 #define PIE1_ADDR 0x008C
74 #define PIE2_ADDR 0x008D
75 #define PCON_ADDR 0x008E
76 #define PR2_ADDR 0x0092
77 #define SSPADD_ADDR 0x0093
78 #define SSPSTAT_ADDR 0x0094
79 #define TXSTA_ADDR 0x0098
80 #define SPBRG_ADDR 0x0099
81 #define ADCON1_ADDR 0x009F
82 #define PMDATA_ADDR 0x010C
83 #define PMADR_ADDR 0x010D
84 #define PMDATH_ADDR 0x010E
85 #define PMADRH_ADDR 0x010F
86 #define PMCON1_ADDR 0x018C
88 #endif // #ifndef NO_ADDR_DEFINES
90 //==============================================================================
92 // Register Definitions
94 //==============================================================================
96 extern __at(0x0000) __sfr INDF;
97 extern __at(0x0001) __sfr TMR0;
98 extern __at(0x0002) __sfr PCL;
100 //==============================================================================
101 // STATUS Bits
103 extern __at(0x0003) __sfr STATUS;
105 typedef union
107 struct
109 unsigned C : 1;
110 unsigned DC : 1;
111 unsigned Z : 1;
112 unsigned NOT_PD : 1;
113 unsigned NOT_TO : 1;
114 unsigned RP0 : 1;
115 unsigned RP1 : 1;
116 unsigned IRP : 1;
119 struct
121 unsigned : 5;
122 unsigned RP : 2;
123 unsigned : 1;
125 } __STATUSbits_t;
127 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
129 #define _C 0x01
130 #define _DC 0x02
131 #define _Z 0x04
132 #define _NOT_PD 0x08
133 #define _NOT_TO 0x10
134 #define _RP0 0x20
135 #define _RP1 0x40
136 #define _IRP 0x80
138 //==============================================================================
140 extern __at(0x0004) __sfr FSR;
142 //==============================================================================
143 // PORTA Bits
145 extern __at(0x0005) __sfr PORTA;
147 typedef union
149 struct
151 unsigned RA0 : 1;
152 unsigned RA1 : 1;
153 unsigned RA2 : 1;
154 unsigned RA3 : 1;
155 unsigned RA4 : 1;
156 unsigned RA5 : 1;
157 unsigned : 1;
158 unsigned : 1;
161 struct
163 unsigned RA : 6;
164 unsigned : 2;
166 } __PORTAbits_t;
168 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
170 #define _RA0 0x01
171 #define _RA1 0x02
172 #define _RA2 0x04
173 #define _RA3 0x08
174 #define _RA4 0x10
175 #define _RA5 0x20
177 //==============================================================================
180 //==============================================================================
181 // PORTB Bits
183 extern __at(0x0006) __sfr PORTB;
185 typedef struct
187 unsigned RB0 : 1;
188 unsigned RB1 : 1;
189 unsigned RB2 : 1;
190 unsigned RB3 : 1;
191 unsigned RB4 : 1;
192 unsigned RB5 : 1;
193 unsigned RB6 : 1;
194 unsigned RB7 : 1;
195 } __PORTBbits_t;
197 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
199 #define _RB0 0x01
200 #define _RB1 0x02
201 #define _RB2 0x04
202 #define _RB3 0x08
203 #define _RB4 0x10
204 #define _RB5 0x20
205 #define _RB6 0x40
206 #define _RB7 0x80
208 //==============================================================================
211 //==============================================================================
212 // PORTC Bits
214 extern __at(0x0007) __sfr PORTC;
216 typedef struct
218 unsigned RC0 : 1;
219 unsigned RC1 : 1;
220 unsigned RC2 : 1;
221 unsigned RC3 : 1;
222 unsigned RC4 : 1;
223 unsigned RC5 : 1;
224 unsigned RC6 : 1;
225 unsigned RC7 : 1;
226 } __PORTCbits_t;
228 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
230 #define _RC0 0x01
231 #define _RC1 0x02
232 #define _RC2 0x04
233 #define _RC3 0x08
234 #define _RC4 0x10
235 #define _RC5 0x20
236 #define _RC6 0x40
237 #define _RC7 0x80
239 //==============================================================================
241 extern __at(0x000A) __sfr PCLATH;
243 //==============================================================================
244 // INTCON Bits
246 extern __at(0x000B) __sfr INTCON;
248 typedef union
250 struct
252 unsigned RBIF : 1;
253 unsigned INTF : 1;
254 unsigned TMR0IF : 1;
255 unsigned RBIE : 1;
256 unsigned INTE : 1;
257 unsigned TMR0IE : 1;
258 unsigned PEIE : 1;
259 unsigned GIE : 1;
262 struct
264 unsigned : 1;
265 unsigned : 1;
266 unsigned T0IF : 1;
267 unsigned : 1;
268 unsigned : 1;
269 unsigned T0IE : 1;
270 unsigned : 1;
271 unsigned : 1;
273 } __INTCONbits_t;
275 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
277 #define _RBIF 0x01
278 #define _INTF 0x02
279 #define _TMR0IF 0x04
280 #define _T0IF 0x04
281 #define _RBIE 0x08
282 #define _INTE 0x10
283 #define _TMR0IE 0x20
284 #define _T0IE 0x20
285 #define _PEIE 0x40
286 #define _GIE 0x80
288 //==============================================================================
291 //==============================================================================
292 // PIR1 Bits
294 extern __at(0x000C) __sfr PIR1;
296 typedef struct
298 unsigned TMR1IF : 1;
299 unsigned TMR2IF : 1;
300 unsigned CCP1IF : 1;
301 unsigned SSPIF : 1;
302 unsigned TXIF : 1;
303 unsigned RCIF : 1;
304 unsigned ADIF : 1;
305 unsigned : 1;
306 } __PIR1bits_t;
308 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
310 #define _TMR1IF 0x01
311 #define _TMR2IF 0x02
312 #define _CCP1IF 0x04
313 #define _SSPIF 0x08
314 #define _TXIF 0x10
315 #define _RCIF 0x20
316 #define _ADIF 0x40
318 //==============================================================================
321 //==============================================================================
322 // PIR2 Bits
324 extern __at(0x000D) __sfr PIR2;
326 typedef struct
328 unsigned CCP2IF : 1;
329 unsigned : 1;
330 unsigned : 1;
331 unsigned : 1;
332 unsigned : 1;
333 unsigned : 1;
334 unsigned : 1;
335 unsigned : 1;
336 } __PIR2bits_t;
338 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
340 #define _CCP2IF 0x01
342 //==============================================================================
344 extern __at(0x000E) __sfr TMR1;
345 extern __at(0x000E) __sfr TMR1L;
346 extern __at(0x000F) __sfr TMR1H;
348 //==============================================================================
349 // T1CON Bits
351 extern __at(0x0010) __sfr T1CON;
353 typedef union
355 struct
357 unsigned TMR1ON : 1;
358 unsigned TMR1CS : 1;
359 unsigned NOT_T1SYNC : 1;
360 unsigned T1OSCEN : 1;
361 unsigned T1CKPS0 : 1;
362 unsigned T1CKPS1 : 1;
363 unsigned : 1;
364 unsigned : 1;
367 struct
369 unsigned : 1;
370 unsigned : 1;
371 unsigned T1INSYNC : 1;
372 unsigned : 1;
373 unsigned : 1;
374 unsigned : 1;
375 unsigned : 1;
376 unsigned : 1;
379 struct
381 unsigned : 4;
382 unsigned T1CKPS : 2;
383 unsigned : 2;
385 } __T1CONbits_t;
387 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
389 #define _TMR1ON 0x01
390 #define _TMR1CS 0x02
391 #define _NOT_T1SYNC 0x04
392 #define _T1INSYNC 0x04
393 #define _T1OSCEN 0x08
394 #define _T1CKPS0 0x10
395 #define _T1CKPS1 0x20
397 //==============================================================================
399 extern __at(0x0011) __sfr TMR2;
401 //==============================================================================
402 // T2CON Bits
404 extern __at(0x0012) __sfr T2CON;
406 typedef union
408 struct
410 unsigned T2CKPS0 : 1;
411 unsigned T2CKPS1 : 1;
412 unsigned TMR2ON : 1;
413 unsigned TOUTPS0 : 1;
414 unsigned TOUTPS1 : 1;
415 unsigned TOUTPS2 : 1;
416 unsigned TOUTPS3 : 1;
417 unsigned : 1;
420 struct
422 unsigned T2CKPS : 2;
423 unsigned : 6;
426 struct
428 unsigned : 3;
429 unsigned TOUTPS : 4;
430 unsigned : 1;
432 } __T2CONbits_t;
434 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
436 #define _T2CKPS0 0x01
437 #define _T2CKPS1 0x02
438 #define _TMR2ON 0x04
439 #define _TOUTPS0 0x08
440 #define _TOUTPS1 0x10
441 #define _TOUTPS2 0x20
442 #define _TOUTPS3 0x40
444 //==============================================================================
446 extern __at(0x0013) __sfr SSPBUF;
448 //==============================================================================
449 // SSPCON Bits
451 extern __at(0x0014) __sfr SSPCON;
453 typedef union
455 struct
457 unsigned SSPM0 : 1;
458 unsigned SSPM1 : 1;
459 unsigned SSPM2 : 1;
460 unsigned SSPM3 : 1;
461 unsigned CKP : 1;
462 unsigned SSPEN : 1;
463 unsigned SSPOV : 1;
464 unsigned WCOL : 1;
467 struct
469 unsigned SSPM : 4;
470 unsigned : 4;
472 } __SSPCONbits_t;
474 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
476 #define _SSPM0 0x01
477 #define _SSPM1 0x02
478 #define _SSPM2 0x04
479 #define _SSPM3 0x08
480 #define _CKP 0x10
481 #define _SSPEN 0x20
482 #define _SSPOV 0x40
483 #define _WCOL 0x80
485 //==============================================================================
487 extern __at(0x0015) __sfr CCPR1;
488 extern __at(0x0015) __sfr CCPR1L;
489 extern __at(0x0016) __sfr CCPR1H;
491 //==============================================================================
492 // CCP1CON Bits
494 extern __at(0x0017) __sfr CCP1CON;
496 typedef union
498 struct
500 unsigned CCP1M0 : 1;
501 unsigned CCP1M1 : 1;
502 unsigned CCP1M2 : 1;
503 unsigned CCP1M3 : 1;
504 unsigned CCP1Y : 1;
505 unsigned CCP1X : 1;
506 unsigned : 1;
507 unsigned : 1;
510 struct
512 unsigned CCP1M : 4;
513 unsigned : 4;
515 } __CCP1CONbits_t;
517 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
519 #define _CCP1M0 0x01
520 #define _CCP1M1 0x02
521 #define _CCP1M2 0x04
522 #define _CCP1M3 0x08
523 #define _CCP1Y 0x10
524 #define _CCP1X 0x20
526 //==============================================================================
529 //==============================================================================
530 // RCSTA Bits
532 extern __at(0x0018) __sfr RCSTA;
534 typedef union
536 struct
538 unsigned RX9D : 1;
539 unsigned OERR : 1;
540 unsigned FERR : 1;
541 unsigned : 1;
542 unsigned CREN : 1;
543 unsigned SREN : 1;
544 unsigned RX9 : 1;
545 unsigned SPEN : 1;
548 struct
550 unsigned RCD8 : 1;
551 unsigned : 1;
552 unsigned : 1;
553 unsigned : 1;
554 unsigned : 1;
555 unsigned : 1;
556 unsigned RC9 : 1;
557 unsigned : 1;
560 struct
562 unsigned : 1;
563 unsigned : 1;
564 unsigned : 1;
565 unsigned : 1;
566 unsigned : 1;
567 unsigned : 1;
568 unsigned NOT_RC8 : 1;
569 unsigned : 1;
572 struct
574 unsigned : 1;
575 unsigned : 1;
576 unsigned : 1;
577 unsigned : 1;
578 unsigned : 1;
579 unsigned : 1;
580 unsigned RC8_9 : 1;
581 unsigned : 1;
583 } __RCSTAbits_t;
585 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
587 #define _RX9D 0x01
588 #define _RCD8 0x01
589 #define _OERR 0x02
590 #define _FERR 0x04
591 #define _CREN 0x10
592 #define _SREN 0x20
593 #define _RX9 0x40
594 #define _RC9 0x40
595 #define _NOT_RC8 0x40
596 #define _RC8_9 0x40
597 #define _SPEN 0x80
599 //==============================================================================
601 extern __at(0x0019) __sfr TXREG;
602 extern __at(0x001A) __sfr RCREG;
603 extern __at(0x001B) __sfr CCPR2;
604 extern __at(0x001B) __sfr CCPR2L;
605 extern __at(0x001C) __sfr CCPR2H;
607 //==============================================================================
608 // CCP2CON Bits
610 extern __at(0x001D) __sfr CCP2CON;
612 typedef union
614 struct
616 unsigned CCP2M0 : 1;
617 unsigned CCP2M1 : 1;
618 unsigned CCP2M2 : 1;
619 unsigned CCP2M3 : 1;
620 unsigned CCP2Y : 1;
621 unsigned CCP2X : 1;
622 unsigned : 1;
623 unsigned : 1;
626 struct
628 unsigned CCP2M : 4;
629 unsigned : 4;
631 } __CCP2CONbits_t;
633 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
635 #define _CCP2M0 0x01
636 #define _CCP2M1 0x02
637 #define _CCP2M2 0x04
638 #define _CCP2M3 0x08
639 #define _CCP2Y 0x10
640 #define _CCP2X 0x20
642 //==============================================================================
644 extern __at(0x001E) __sfr ADRES;
646 //==============================================================================
647 // ADCON0 Bits
649 extern __at(0x001F) __sfr ADCON0;
651 typedef union
653 struct
655 unsigned ADON : 1;
656 unsigned : 1;
657 unsigned GO_NOT_DONE : 1;
658 unsigned CHS0 : 1;
659 unsigned CHS1 : 1;
660 unsigned CHS2 : 1;
661 unsigned ADCS0 : 1;
662 unsigned ADCS1 : 1;
665 struct
667 unsigned : 1;
668 unsigned : 1;
669 unsigned GO : 1;
670 unsigned : 1;
671 unsigned : 1;
672 unsigned : 1;
673 unsigned : 1;
674 unsigned : 1;
677 struct
679 unsigned : 1;
680 unsigned : 1;
681 unsigned NOT_DONE : 1;
682 unsigned : 1;
683 unsigned : 1;
684 unsigned : 1;
685 unsigned : 1;
686 unsigned : 1;
689 struct
691 unsigned : 1;
692 unsigned : 1;
693 unsigned GO_DONE : 1;
694 unsigned : 1;
695 unsigned : 1;
696 unsigned : 1;
697 unsigned : 1;
698 unsigned : 1;
701 struct
703 unsigned : 3;
704 unsigned CHS : 3;
705 unsigned : 2;
708 struct
710 unsigned : 6;
711 unsigned ADCS : 2;
713 } __ADCON0bits_t;
715 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
717 #define _ADON 0x01
718 #define _GO_NOT_DONE 0x04
719 #define _GO 0x04
720 #define _NOT_DONE 0x04
721 #define _GO_DONE 0x04
722 #define _CHS0 0x08
723 #define _CHS1 0x10
724 #define _CHS2 0x20
725 #define _ADCS0 0x40
726 #define _ADCS1 0x80
728 //==============================================================================
731 //==============================================================================
732 // OPTION_REG Bits
734 extern __at(0x0081) __sfr OPTION_REG;
736 typedef union
738 struct
740 unsigned PS0 : 1;
741 unsigned PS1 : 1;
742 unsigned PS2 : 1;
743 unsigned PSA : 1;
744 unsigned T0SE : 1;
745 unsigned T0CS : 1;
746 unsigned INTEDG : 1;
747 unsigned NOT_RBPU : 1;
750 struct
752 unsigned PS : 3;
753 unsigned : 5;
755 } __OPTION_REGbits_t;
757 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
759 #define _PS0 0x01
760 #define _PS1 0x02
761 #define _PS2 0x04
762 #define _PSA 0x08
763 #define _T0SE 0x10
764 #define _T0CS 0x20
765 #define _INTEDG 0x40
766 #define _NOT_RBPU 0x80
768 //==============================================================================
771 //==============================================================================
772 // TRISA Bits
774 extern __at(0x0085) __sfr TRISA;
776 typedef union
778 struct
780 unsigned TRISA0 : 1;
781 unsigned TRISA1 : 1;
782 unsigned TRISA2 : 1;
783 unsigned TRISA3 : 1;
784 unsigned TRISA4 : 1;
785 unsigned TRISA5 : 1;
786 unsigned : 1;
787 unsigned : 1;
790 struct
792 unsigned TRISA : 6;
793 unsigned : 2;
795 } __TRISAbits_t;
797 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
799 #define _TRISA0 0x01
800 #define _TRISA1 0x02
801 #define _TRISA2 0x04
802 #define _TRISA3 0x08
803 #define _TRISA4 0x10
804 #define _TRISA5 0x20
806 //==============================================================================
809 //==============================================================================
810 // TRISB Bits
812 extern __at(0x0086) __sfr TRISB;
814 typedef struct
816 unsigned TRISB0 : 1;
817 unsigned TRISB1 : 1;
818 unsigned TRISB2 : 1;
819 unsigned TRISB3 : 1;
820 unsigned TRISB4 : 1;
821 unsigned TRISB5 : 1;
822 unsigned TRISB6 : 1;
823 unsigned TRISB7 : 1;
824 } __TRISBbits_t;
826 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
828 #define _TRISB0 0x01
829 #define _TRISB1 0x02
830 #define _TRISB2 0x04
831 #define _TRISB3 0x08
832 #define _TRISB4 0x10
833 #define _TRISB5 0x20
834 #define _TRISB6 0x40
835 #define _TRISB7 0x80
837 //==============================================================================
840 //==============================================================================
841 // TRISC Bits
843 extern __at(0x0087) __sfr TRISC;
845 typedef struct
847 unsigned TRISC0 : 1;
848 unsigned TRISC1 : 1;
849 unsigned TRISC2 : 1;
850 unsigned TRISC3 : 1;
851 unsigned TRISC4 : 1;
852 unsigned TRISC5 : 1;
853 unsigned TRISC6 : 1;
854 unsigned TRISC7 : 1;
855 } __TRISCbits_t;
857 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
859 #define _TRISC0 0x01
860 #define _TRISC1 0x02
861 #define _TRISC2 0x04
862 #define _TRISC3 0x08
863 #define _TRISC4 0x10
864 #define _TRISC5 0x20
865 #define _TRISC6 0x40
866 #define _TRISC7 0x80
868 //==============================================================================
871 //==============================================================================
872 // PIE1 Bits
874 extern __at(0x008C) __sfr PIE1;
876 typedef struct
878 unsigned TMR1IE : 1;
879 unsigned TMR2IE : 1;
880 unsigned CCP1IE : 1;
881 unsigned SSPIE : 1;
882 unsigned TXIE : 1;
883 unsigned RCIE : 1;
884 unsigned ADIE : 1;
885 unsigned : 1;
886 } __PIE1bits_t;
888 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
890 #define _TMR1IE 0x01
891 #define _TMR2IE 0x02
892 #define _CCP1IE 0x04
893 #define _SSPIE 0x08
894 #define _TXIE 0x10
895 #define _RCIE 0x20
896 #define _ADIE 0x40
898 //==============================================================================
901 //==============================================================================
902 // PIE2 Bits
904 extern __at(0x008D) __sfr PIE2;
906 typedef struct
908 unsigned CCP2IE : 1;
909 unsigned : 1;
910 unsigned : 1;
911 unsigned : 1;
912 unsigned : 1;
913 unsigned : 1;
914 unsigned : 1;
915 unsigned : 1;
916 } __PIE2bits_t;
918 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
920 #define _CCP2IE 0x01
922 //==============================================================================
925 //==============================================================================
926 // PCON Bits
928 extern __at(0x008E) __sfr PCON;
930 typedef union
932 struct
934 unsigned NOT_BOR : 1;
935 unsigned NOT_POR : 1;
936 unsigned : 1;
937 unsigned : 1;
938 unsigned : 1;
939 unsigned : 1;
940 unsigned : 1;
941 unsigned : 1;
944 struct
946 unsigned NOT_BO : 1;
947 unsigned : 1;
948 unsigned : 1;
949 unsigned : 1;
950 unsigned : 1;
951 unsigned : 1;
952 unsigned : 1;
953 unsigned : 1;
955 } __PCONbits_t;
957 extern __at(0x008E) volatile __PCONbits_t PCONbits;
959 #define _NOT_BOR 0x01
960 #define _NOT_BO 0x01
961 #define _NOT_POR 0x02
963 //==============================================================================
965 extern __at(0x0092) __sfr PR2;
966 extern __at(0x0093) __sfr SSPADD;
968 //==============================================================================
969 // SSPSTAT Bits
971 extern __at(0x0094) __sfr SSPSTAT;
973 typedef union
975 struct
977 unsigned BF : 1;
978 unsigned UA : 1;
979 unsigned R_NOT_W : 1;
980 unsigned S : 1;
981 unsigned P : 1;
982 unsigned D_NOT_A : 1;
983 unsigned CKE : 1;
984 unsigned SMP : 1;
987 struct
989 unsigned : 1;
990 unsigned : 1;
991 unsigned R : 1;
992 unsigned I2C_START : 1;
993 unsigned I2C_STOP : 1;
994 unsigned D : 1;
995 unsigned : 1;
996 unsigned : 1;
999 struct
1001 unsigned : 1;
1002 unsigned : 1;
1003 unsigned I2C_READ : 1;
1004 unsigned : 1;
1005 unsigned : 1;
1006 unsigned I2C_DATA : 1;
1007 unsigned : 1;
1008 unsigned : 1;
1011 struct
1013 unsigned : 1;
1014 unsigned : 1;
1015 unsigned NOT_W : 1;
1016 unsigned : 1;
1017 unsigned : 1;
1018 unsigned NOT_A : 1;
1019 unsigned : 1;
1020 unsigned : 1;
1023 struct
1025 unsigned : 1;
1026 unsigned : 1;
1027 unsigned NOT_WRITE : 1;
1028 unsigned : 1;
1029 unsigned : 1;
1030 unsigned NOT_ADDRESS : 1;
1031 unsigned : 1;
1032 unsigned : 1;
1035 struct
1037 unsigned : 1;
1038 unsigned : 1;
1039 unsigned R_W : 1;
1040 unsigned : 1;
1041 unsigned : 1;
1042 unsigned D_A : 1;
1043 unsigned : 1;
1044 unsigned : 1;
1047 struct
1049 unsigned : 1;
1050 unsigned : 1;
1051 unsigned READ_WRITE : 1;
1052 unsigned : 1;
1053 unsigned : 1;
1054 unsigned DATA_ADDRESS : 1;
1055 unsigned : 1;
1056 unsigned : 1;
1058 } __SSPSTATbits_t;
1060 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1062 #define _BF 0x01
1063 #define _UA 0x02
1064 #define _R_NOT_W 0x04
1065 #define _R 0x04
1066 #define _I2C_READ 0x04
1067 #define _NOT_W 0x04
1068 #define _NOT_WRITE 0x04
1069 #define _R_W 0x04
1070 #define _READ_WRITE 0x04
1071 #define _S 0x08
1072 #define _I2C_START 0x08
1073 #define _P 0x10
1074 #define _I2C_STOP 0x10
1075 #define _D_NOT_A 0x20
1076 #define _D 0x20
1077 #define _I2C_DATA 0x20
1078 #define _NOT_A 0x20
1079 #define _NOT_ADDRESS 0x20
1080 #define _D_A 0x20
1081 #define _DATA_ADDRESS 0x20
1082 #define _CKE 0x40
1083 #define _SMP 0x80
1085 //==============================================================================
1088 //==============================================================================
1089 // TXSTA Bits
1091 extern __at(0x0098) __sfr TXSTA;
1093 typedef union
1095 struct
1097 unsigned TX9D : 1;
1098 unsigned TRMT : 1;
1099 unsigned BRGH : 1;
1100 unsigned : 1;
1101 unsigned SYNC : 1;
1102 unsigned TXEN : 1;
1103 unsigned TX9 : 1;
1104 unsigned CSRC : 1;
1107 struct
1109 unsigned TXD8 : 1;
1110 unsigned : 1;
1111 unsigned : 1;
1112 unsigned : 1;
1113 unsigned : 1;
1114 unsigned : 1;
1115 unsigned NOT_TX8 : 1;
1116 unsigned : 1;
1119 struct
1121 unsigned : 1;
1122 unsigned : 1;
1123 unsigned : 1;
1124 unsigned : 1;
1125 unsigned : 1;
1126 unsigned : 1;
1127 unsigned TX8_9 : 1;
1128 unsigned : 1;
1130 } __TXSTAbits_t;
1132 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1134 #define _TX9D 0x01
1135 #define _TXD8 0x01
1136 #define _TRMT 0x02
1137 #define _BRGH 0x04
1138 #define _SYNC 0x10
1139 #define _TXEN 0x20
1140 #define _TX9 0x40
1141 #define _NOT_TX8 0x40
1142 #define _TX8_9 0x40
1143 #define _CSRC 0x80
1145 //==============================================================================
1147 extern __at(0x0099) __sfr SPBRG;
1149 //==============================================================================
1150 // ADCON1 Bits
1152 extern __at(0x009F) __sfr ADCON1;
1154 typedef union
1156 struct
1158 unsigned PCFG0 : 1;
1159 unsigned PCFG1 : 1;
1160 unsigned PCFG2 : 1;
1161 unsigned : 1;
1162 unsigned : 1;
1163 unsigned : 1;
1164 unsigned : 1;
1165 unsigned : 1;
1168 struct
1170 unsigned PCFG : 3;
1171 unsigned : 5;
1173 } __ADCON1bits_t;
1175 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1177 #define _PCFG0 0x01
1178 #define _PCFG1 0x02
1179 #define _PCFG2 0x04
1181 //==============================================================================
1183 extern __at(0x010C) __sfr PMDATA;
1184 extern __at(0x010D) __sfr PMADR;
1185 extern __at(0x010E) __sfr PMDATH;
1186 extern __at(0x010F) __sfr PMADRH;
1188 //==============================================================================
1189 // PMCON1 Bits
1191 extern __at(0x018C) __sfr PMCON1;
1193 typedef struct
1195 unsigned RD : 1;
1196 unsigned : 1;
1197 unsigned : 1;
1198 unsigned : 1;
1199 unsigned : 1;
1200 unsigned : 1;
1201 unsigned : 1;
1202 unsigned : 1;
1203 } __PMCON1bits_t;
1205 extern __at(0x018C) volatile __PMCON1bits_t PMCON1bits;
1207 #define _RD 0x01
1209 //==============================================================================
1212 //==============================================================================
1214 // Configuration Bits
1216 //==============================================================================
1218 #define _CONFIG 0x2007
1220 //----------------------------- CONFIG Options -------------------------------
1222 #define _FOSC_LP 0x3FFC // LP oscillator.
1223 #define _LP_OSC 0x3FFC // LP oscillator.
1224 #define _FOSC_XT 0x3FFD // XT oscillator.
1225 #define _XT_OSC 0x3FFD // XT oscillator.
1226 #define _FOSC_HS 0x3FFE // HS oscillator.
1227 #define _HS_OSC 0x3FFE // HS oscillator.
1228 #define _FOSC_RC 0x3FFF // RC oscillator.
1229 #define _RC_OSC 0x3FFF // RC oscillator.
1230 #define _WDTE_OFF 0x3FFB // WDT disabled.
1231 #define _WDT_OFF 0x3FFB // WDT disabled.
1232 #define _WDTE_ON 0x3FFF // WDT enabled.
1233 #define _WDT_ON 0x3FFF // WDT enabled.
1234 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
1235 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1236 #define _CP_ON 0x3FEF // All Memory locations code protected.
1237 #define _CP_ALL 0x3FEF // All Memory locations code protected.
1238 #define _CP_OFF 0x3FFF // Code protection off.
1239 #define _BOREN_OFF 0x3FBF // BOR disabled.
1240 #define _BODEN_OFF 0x3FBF // BOR disabled.
1241 #define _BOREN_ON 0x3FFF // BOR enabled.
1242 #define _BODEN_ON 0x3FFF // BOR enabled.
1244 //==============================================================================
1246 #define _DEVID1 0x2006
1248 #define _IDLOC0 0x2000
1249 #define _IDLOC1 0x2001
1250 #define _IDLOC2 0x2002
1251 #define _IDLOC3 0x2003
1253 //==============================================================================
1255 #ifndef NO_BIT_DEFINES
1257 #define ADON ADCON0bits.ADON // bit 0
1258 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
1259 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
1260 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
1261 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
1262 #define CHS0 ADCON0bits.CHS0 // bit 3
1263 #define CHS1 ADCON0bits.CHS1 // bit 4
1264 #define CHS2 ADCON0bits.CHS2 // bit 5
1265 #define ADCS0 ADCON0bits.ADCS0 // bit 6
1266 #define ADCS1 ADCON0bits.ADCS1 // bit 7
1268 #define PCFG0 ADCON1bits.PCFG0 // bit 0
1269 #define PCFG1 ADCON1bits.PCFG1 // bit 1
1270 #define PCFG2 ADCON1bits.PCFG2 // bit 2
1272 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
1273 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
1274 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
1275 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
1276 #define CCP1Y CCP1CONbits.CCP1Y // bit 4
1277 #define CCP1X CCP1CONbits.CCP1X // bit 5
1279 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
1280 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
1281 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
1282 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
1283 #define CCP2Y CCP2CONbits.CCP2Y // bit 4
1284 #define CCP2X CCP2CONbits.CCP2X // bit 5
1286 #define RBIF INTCONbits.RBIF // bit 0
1287 #define INTF INTCONbits.INTF // bit 1
1288 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
1289 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
1290 #define RBIE INTCONbits.RBIE // bit 3
1291 #define INTE INTCONbits.INTE // bit 4
1292 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
1293 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
1294 #define PEIE INTCONbits.PEIE // bit 6
1295 #define GIE INTCONbits.GIE // bit 7
1297 #define PS0 OPTION_REGbits.PS0 // bit 0
1298 #define PS1 OPTION_REGbits.PS1 // bit 1
1299 #define PS2 OPTION_REGbits.PS2 // bit 2
1300 #define PSA OPTION_REGbits.PSA // bit 3
1301 #define T0SE OPTION_REGbits.T0SE // bit 4
1302 #define T0CS OPTION_REGbits.T0CS // bit 5
1303 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1304 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
1306 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1307 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
1308 #define NOT_POR PCONbits.NOT_POR // bit 1
1310 #define TMR1IE PIE1bits.TMR1IE // bit 0
1311 #define TMR2IE PIE1bits.TMR2IE // bit 1
1312 #define CCP1IE PIE1bits.CCP1IE // bit 2
1313 #define SSPIE PIE1bits.SSPIE // bit 3
1314 #define TXIE PIE1bits.TXIE // bit 4
1315 #define RCIE PIE1bits.RCIE // bit 5
1316 #define ADIE PIE1bits.ADIE // bit 6
1318 #define CCP2IE PIE2bits.CCP2IE // bit 0
1320 #define TMR1IF PIR1bits.TMR1IF // bit 0
1321 #define TMR2IF PIR1bits.TMR2IF // bit 1
1322 #define CCP1IF PIR1bits.CCP1IF // bit 2
1323 #define SSPIF PIR1bits.SSPIF // bit 3
1324 #define TXIF PIR1bits.TXIF // bit 4
1325 #define RCIF PIR1bits.RCIF // bit 5
1326 #define ADIF PIR1bits.ADIF // bit 6
1328 #define CCP2IF PIR2bits.CCP2IF // bit 0
1330 #define RD PMCON1bits.RD // bit 0
1332 #define RA0 PORTAbits.RA0 // bit 0
1333 #define RA1 PORTAbits.RA1 // bit 1
1334 #define RA2 PORTAbits.RA2 // bit 2
1335 #define RA3 PORTAbits.RA3 // bit 3
1336 #define RA4 PORTAbits.RA4 // bit 4
1337 #define RA5 PORTAbits.RA5 // bit 5
1339 #define RB0 PORTBbits.RB0 // bit 0
1340 #define RB1 PORTBbits.RB1 // bit 1
1341 #define RB2 PORTBbits.RB2 // bit 2
1342 #define RB3 PORTBbits.RB3 // bit 3
1343 #define RB4 PORTBbits.RB4 // bit 4
1344 #define RB5 PORTBbits.RB5 // bit 5
1345 #define RB6 PORTBbits.RB6 // bit 6
1346 #define RB7 PORTBbits.RB7 // bit 7
1348 #define RC0 PORTCbits.RC0 // bit 0
1349 #define RC1 PORTCbits.RC1 // bit 1
1350 #define RC2 PORTCbits.RC2 // bit 2
1351 #define RC3 PORTCbits.RC3 // bit 3
1352 #define RC4 PORTCbits.RC4 // bit 4
1353 #define RC5 PORTCbits.RC5 // bit 5
1354 #define RC6 PORTCbits.RC6 // bit 6
1355 #define RC7 PORTCbits.RC7 // bit 7
1357 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
1358 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
1359 #define OERR RCSTAbits.OERR // bit 1
1360 #define FERR RCSTAbits.FERR // bit 2
1361 #define CREN RCSTAbits.CREN // bit 4
1362 #define SREN RCSTAbits.SREN // bit 5
1363 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
1364 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
1365 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
1366 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
1367 #define SPEN RCSTAbits.SPEN // bit 7
1369 #define SSPM0 SSPCONbits.SSPM0 // bit 0
1370 #define SSPM1 SSPCONbits.SSPM1 // bit 1
1371 #define SSPM2 SSPCONbits.SSPM2 // bit 2
1372 #define SSPM3 SSPCONbits.SSPM3 // bit 3
1373 #define CKP SSPCONbits.CKP // bit 4
1374 #define SSPEN SSPCONbits.SSPEN // bit 5
1375 #define SSPOV SSPCONbits.SSPOV // bit 6
1376 #define WCOL SSPCONbits.WCOL // bit 7
1378 #define BF SSPSTATbits.BF // bit 0
1379 #define UA SSPSTATbits.UA // bit 1
1380 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
1381 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
1382 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
1383 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
1384 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
1385 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
1386 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
1387 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
1388 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
1389 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
1390 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
1391 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
1392 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
1393 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
1394 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
1395 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
1396 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
1397 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
1398 #define CKE SSPSTATbits.CKE // bit 6
1399 #define SMP SSPSTATbits.SMP // bit 7
1401 #define C STATUSbits.C // bit 0
1402 #define DC STATUSbits.DC // bit 1
1403 #define Z STATUSbits.Z // bit 2
1404 #define NOT_PD STATUSbits.NOT_PD // bit 3
1405 #define NOT_TO STATUSbits.NOT_TO // bit 4
1406 #define RP0 STATUSbits.RP0 // bit 5
1407 #define RP1 STATUSbits.RP1 // bit 6
1408 #define IRP STATUSbits.IRP // bit 7
1410 #define TMR1ON T1CONbits.TMR1ON // bit 0
1411 #define TMR1CS T1CONbits.TMR1CS // bit 1
1412 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
1413 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
1414 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1415 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1416 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1418 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
1419 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
1420 #define TMR2ON T2CONbits.TMR2ON // bit 2
1421 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
1422 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
1423 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
1424 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
1426 #define TRISA0 TRISAbits.TRISA0 // bit 0
1427 #define TRISA1 TRISAbits.TRISA1 // bit 1
1428 #define TRISA2 TRISAbits.TRISA2 // bit 2
1429 #define TRISA3 TRISAbits.TRISA3 // bit 3
1430 #define TRISA4 TRISAbits.TRISA4 // bit 4
1431 #define TRISA5 TRISAbits.TRISA5 // bit 5
1433 #define TRISB0 TRISBbits.TRISB0 // bit 0
1434 #define TRISB1 TRISBbits.TRISB1 // bit 1
1435 #define TRISB2 TRISBbits.TRISB2 // bit 2
1436 #define TRISB3 TRISBbits.TRISB3 // bit 3
1437 #define TRISB4 TRISBbits.TRISB4 // bit 4
1438 #define TRISB5 TRISBbits.TRISB5 // bit 5
1439 #define TRISB6 TRISBbits.TRISB6 // bit 6
1440 #define TRISB7 TRISBbits.TRISB7 // bit 7
1442 #define TRISC0 TRISCbits.TRISC0 // bit 0
1443 #define TRISC1 TRISCbits.TRISC1 // bit 1
1444 #define TRISC2 TRISCbits.TRISC2 // bit 2
1445 #define TRISC3 TRISCbits.TRISC3 // bit 3
1446 #define TRISC4 TRISCbits.TRISC4 // bit 4
1447 #define TRISC5 TRISCbits.TRISC5 // bit 5
1448 #define TRISC6 TRISCbits.TRISC6 // bit 6
1449 #define TRISC7 TRISCbits.TRISC7 // bit 7
1451 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
1452 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
1453 #define TRMT TXSTAbits.TRMT // bit 1
1454 #define BRGH TXSTAbits.BRGH // bit 2
1455 #define SYNC TXSTAbits.SYNC // bit 4
1456 #define TXEN TXSTAbits.TXEN // bit 5
1457 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
1458 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
1459 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
1460 #define CSRC TXSTAbits.CSRC // bit 7
1462 #endif // #ifndef NO_BIT_DEFINES
1464 #endif // #ifndef __PIC16F73_H__