struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c73b.h
blob446370a2116e0b6da1f2a6e32524bb108d52be23
1 /*
2 * This declarations of the PIC16C73B MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:02 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 __PIC16C73B_H__
26 #define __PIC16C73B_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
83 #endif // #ifndef NO_ADDR_DEFINES
85 //==============================================================================
87 // Register Definitions
89 //==============================================================================
91 extern __at(0x0000) __sfr INDF;
92 extern __at(0x0001) __sfr TMR0;
93 extern __at(0x0002) __sfr PCL;
95 //==============================================================================
96 // STATUS Bits
98 extern __at(0x0003) __sfr STATUS;
100 typedef union
102 struct
104 unsigned C : 1;
105 unsigned DC : 1;
106 unsigned Z : 1;
107 unsigned NOT_PD : 1;
108 unsigned NOT_TO : 1;
109 unsigned RP0 : 1;
110 unsigned RP1 : 1;
111 unsigned IRP : 1;
114 struct
116 unsigned : 5;
117 unsigned RP : 2;
118 unsigned : 1;
120 } __STATUSbits_t;
122 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
124 #define _C 0x01
125 #define _DC 0x02
126 #define _Z 0x04
127 #define _NOT_PD 0x08
128 #define _NOT_TO 0x10
129 #define _RP0 0x20
130 #define _RP1 0x40
131 #define _IRP 0x80
133 //==============================================================================
135 extern __at(0x0004) __sfr FSR;
137 //==============================================================================
138 // PORTA Bits
140 extern __at(0x0005) __sfr PORTA;
142 typedef union
144 struct
146 unsigned RA0 : 1;
147 unsigned RA1 : 1;
148 unsigned RA2 : 1;
149 unsigned RA3 : 1;
150 unsigned RA4 : 1;
151 unsigned RA5 : 1;
152 unsigned : 1;
153 unsigned : 1;
156 struct
158 unsigned RA : 6;
159 unsigned : 2;
161 } __PORTAbits_t;
163 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
165 #define _RA0 0x01
166 #define _RA1 0x02
167 #define _RA2 0x04
168 #define _RA3 0x08
169 #define _RA4 0x10
170 #define _RA5 0x20
172 //==============================================================================
175 //==============================================================================
176 // PORTB Bits
178 extern __at(0x0006) __sfr PORTB;
180 typedef struct
182 unsigned RB0 : 1;
183 unsigned RB1 : 1;
184 unsigned RB2 : 1;
185 unsigned RB3 : 1;
186 unsigned RB4 : 1;
187 unsigned RB5 : 1;
188 unsigned RB6 : 1;
189 unsigned RB7 : 1;
190 } __PORTBbits_t;
192 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
194 #define _RB0 0x01
195 #define _RB1 0x02
196 #define _RB2 0x04
197 #define _RB3 0x08
198 #define _RB4 0x10
199 #define _RB5 0x20
200 #define _RB6 0x40
201 #define _RB7 0x80
203 //==============================================================================
206 //==============================================================================
207 // PORTC Bits
209 extern __at(0x0007) __sfr PORTC;
211 typedef struct
213 unsigned RC0 : 1;
214 unsigned RC1 : 1;
215 unsigned RC2 : 1;
216 unsigned RC3 : 1;
217 unsigned RC4 : 1;
218 unsigned RC5 : 1;
219 unsigned RC6 : 1;
220 unsigned RC7 : 1;
221 } __PORTCbits_t;
223 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
225 #define _RC0 0x01
226 #define _RC1 0x02
227 #define _RC2 0x04
228 #define _RC3 0x08
229 #define _RC4 0x10
230 #define _RC5 0x20
231 #define _RC6 0x40
232 #define _RC7 0x80
234 //==============================================================================
236 extern __at(0x000A) __sfr PCLATH;
238 //==============================================================================
239 // INTCON Bits
241 extern __at(0x000B) __sfr INTCON;
243 typedef union
245 struct
247 unsigned RBIF : 1;
248 unsigned INTF : 1;
249 unsigned T0IF : 1;
250 unsigned RBIE : 1;
251 unsigned INTE : 1;
252 unsigned T0IE : 1;
253 unsigned PEIE : 1;
254 unsigned GIE : 1;
257 struct
259 unsigned : 1;
260 unsigned : 1;
261 unsigned TMR0IF : 1;
262 unsigned : 1;
263 unsigned : 1;
264 unsigned TMR0IE : 1;
265 unsigned : 1;
266 unsigned : 1;
268 } __INTCONbits_t;
270 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
272 #define _RBIF 0x01
273 #define _INTF 0x02
274 #define _T0IF 0x04
275 #define _TMR0IF 0x04
276 #define _RBIE 0x08
277 #define _INTE 0x10
278 #define _T0IE 0x20
279 #define _TMR0IE 0x20
280 #define _PEIE 0x40
281 #define _GIE 0x80
283 //==============================================================================
286 //==============================================================================
287 // PIR1 Bits
289 extern __at(0x000C) __sfr PIR1;
291 typedef struct
293 unsigned TMR1IF : 1;
294 unsigned TMR2IF : 1;
295 unsigned CCP1IF : 1;
296 unsigned SSPIF : 1;
297 unsigned TXIF : 1;
298 unsigned RCIF : 1;
299 unsigned ADIF : 1;
300 unsigned : 1;
301 } __PIR1bits_t;
303 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
305 #define _TMR1IF 0x01
306 #define _TMR2IF 0x02
307 #define _CCP1IF 0x04
308 #define _SSPIF 0x08
309 #define _TXIF 0x10
310 #define _RCIF 0x20
311 #define _ADIF 0x40
313 //==============================================================================
316 //==============================================================================
317 // PIR2 Bits
319 extern __at(0x000D) __sfr PIR2;
321 typedef struct
323 unsigned CCP2IF : 1;
324 unsigned : 1;
325 unsigned : 1;
326 unsigned : 1;
327 unsigned : 1;
328 unsigned : 1;
329 unsigned : 1;
330 unsigned : 1;
331 } __PIR2bits_t;
333 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
335 #define _CCP2IF 0x01
337 //==============================================================================
339 extern __at(0x000E) __sfr TMR1;
340 extern __at(0x000E) __sfr TMR1L;
341 extern __at(0x000F) __sfr TMR1H;
343 //==============================================================================
344 // T1CON Bits
346 extern __at(0x0010) __sfr T1CON;
348 typedef union
350 struct
352 unsigned TMR1ON : 1;
353 unsigned TMR1CS : 1;
354 unsigned NOT_T1SYNC : 1;
355 unsigned T1OSCEN : 1;
356 unsigned T1CKPS0 : 1;
357 unsigned T1CKPS1 : 1;
358 unsigned : 1;
359 unsigned : 1;
362 struct
364 unsigned : 1;
365 unsigned : 1;
366 unsigned T1INSYNC : 1;
367 unsigned : 1;
368 unsigned : 1;
369 unsigned : 1;
370 unsigned : 1;
371 unsigned : 1;
374 struct
376 unsigned : 4;
377 unsigned T1CKPS : 2;
378 unsigned : 2;
380 } __T1CONbits_t;
382 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
384 #define _TMR1ON 0x01
385 #define _TMR1CS 0x02
386 #define _NOT_T1SYNC 0x04
387 #define _T1INSYNC 0x04
388 #define _T1OSCEN 0x08
389 #define _T1CKPS0 0x10
390 #define _T1CKPS1 0x20
392 //==============================================================================
394 extern __at(0x0011) __sfr TMR2;
396 //==============================================================================
397 // T2CON Bits
399 extern __at(0x0012) __sfr T2CON;
401 typedef union
403 struct
405 unsigned T2CKPS0 : 1;
406 unsigned T2CKPS1 : 1;
407 unsigned TMR2ON : 1;
408 unsigned TOUTPS0 : 1;
409 unsigned TOUTPS1 : 1;
410 unsigned TOUTPS2 : 1;
411 unsigned TOUTPS3 : 1;
412 unsigned : 1;
415 struct
417 unsigned T2CKPS : 2;
418 unsigned : 6;
421 struct
423 unsigned : 3;
424 unsigned TOUTPS : 4;
425 unsigned : 1;
427 } __T2CONbits_t;
429 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
431 #define _T2CKPS0 0x01
432 #define _T2CKPS1 0x02
433 #define _TMR2ON 0x04
434 #define _TOUTPS0 0x08
435 #define _TOUTPS1 0x10
436 #define _TOUTPS2 0x20
437 #define _TOUTPS3 0x40
439 //==============================================================================
441 extern __at(0x0013) __sfr SSPBUF;
443 //==============================================================================
444 // SSPCON Bits
446 extern __at(0x0014) __sfr SSPCON;
448 typedef union
450 struct
452 unsigned SSPM0 : 1;
453 unsigned SSPM1 : 1;
454 unsigned SSPM2 : 1;
455 unsigned SSPM3 : 1;
456 unsigned CKP : 1;
457 unsigned SSPEN : 1;
458 unsigned SSPOV : 1;
459 unsigned WCOL : 1;
462 struct
464 unsigned SSPM : 4;
465 unsigned : 4;
467 } __SSPCONbits_t;
469 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
471 #define _SSPM0 0x01
472 #define _SSPM1 0x02
473 #define _SSPM2 0x04
474 #define _SSPM3 0x08
475 #define _CKP 0x10
476 #define _SSPEN 0x20
477 #define _SSPOV 0x40
478 #define _WCOL 0x80
480 //==============================================================================
482 extern __at(0x0015) __sfr CCPR1;
483 extern __at(0x0015) __sfr CCPR1L;
484 extern __at(0x0016) __sfr CCPR1H;
486 //==============================================================================
487 // CCP1CON Bits
489 extern __at(0x0017) __sfr CCP1CON;
491 typedef union
493 struct
495 unsigned CCP1M0 : 1;
496 unsigned CCP1M1 : 1;
497 unsigned CCP1M2 : 1;
498 unsigned CCP1M3 : 1;
499 unsigned CCP1Y : 1;
500 unsigned CCP1X : 1;
501 unsigned : 1;
502 unsigned : 1;
505 struct
507 unsigned CCP1M : 4;
508 unsigned : 4;
510 } __CCP1CONbits_t;
512 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
514 #define _CCP1M0 0x01
515 #define _CCP1M1 0x02
516 #define _CCP1M2 0x04
517 #define _CCP1M3 0x08
518 #define _CCP1Y 0x10
519 #define _CCP1X 0x20
521 //==============================================================================
524 //==============================================================================
525 // RCSTA Bits
527 extern __at(0x0018) __sfr RCSTA;
529 typedef union
531 struct
533 unsigned RX9D : 1;
534 unsigned OERR : 1;
535 unsigned FERR : 1;
536 unsigned : 1;
537 unsigned CREN : 1;
538 unsigned SREN : 1;
539 unsigned RX9 : 1;
540 unsigned SPEN : 1;
543 struct
545 unsigned RCD8 : 1;
546 unsigned : 1;
547 unsigned : 1;
548 unsigned : 1;
549 unsigned : 1;
550 unsigned : 1;
551 unsigned RC9 : 1;
552 unsigned : 1;
555 struct
557 unsigned : 1;
558 unsigned : 1;
559 unsigned : 1;
560 unsigned : 1;
561 unsigned : 1;
562 unsigned : 1;
563 unsigned NOT_RC8 : 1;
564 unsigned : 1;
567 struct
569 unsigned : 1;
570 unsigned : 1;
571 unsigned : 1;
572 unsigned : 1;
573 unsigned : 1;
574 unsigned : 1;
575 unsigned RC8_9 : 1;
576 unsigned : 1;
578 } __RCSTAbits_t;
580 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
582 #define _RX9D 0x01
583 #define _RCD8 0x01
584 #define _OERR 0x02
585 #define _FERR 0x04
586 #define _CREN 0x10
587 #define _SREN 0x20
588 #define _RX9 0x40
589 #define _RC9 0x40
590 #define _NOT_RC8 0x40
591 #define _RC8_9 0x40
592 #define _SPEN 0x80
594 //==============================================================================
596 extern __at(0x0019) __sfr TXREG;
597 extern __at(0x001A) __sfr RCREG;
598 extern __at(0x001B) __sfr CCPR2;
599 extern __at(0x001B) __sfr CCPR2L;
600 extern __at(0x001C) __sfr CCPR2H;
602 //==============================================================================
603 // CCP2CON Bits
605 extern __at(0x001D) __sfr CCP2CON;
607 typedef union
609 struct
611 unsigned CCP2M0 : 1;
612 unsigned CCP2M1 : 1;
613 unsigned CCP2M2 : 1;
614 unsigned CCP2M3 : 1;
615 unsigned CCP2Y : 1;
616 unsigned CCP2X : 1;
617 unsigned : 1;
618 unsigned : 1;
621 struct
623 unsigned CCP2M : 4;
624 unsigned : 4;
626 } __CCP2CONbits_t;
628 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
630 #define _CCP2M0 0x01
631 #define _CCP2M1 0x02
632 #define _CCP2M2 0x04
633 #define _CCP2M3 0x08
634 #define _CCP2Y 0x10
635 #define _CCP2X 0x20
637 //==============================================================================
639 extern __at(0x001E) __sfr ADRES;
641 //==============================================================================
642 // ADCON0 Bits
644 extern __at(0x001F) __sfr ADCON0;
646 typedef union
648 struct
650 unsigned ADON : 1;
651 unsigned : 1;
652 unsigned GO_NOT_DONE : 1;
653 unsigned CHS0 : 1;
654 unsigned CHS1 : 1;
655 unsigned CHS2 : 1;
656 unsigned ADCS0 : 1;
657 unsigned ADCS1 : 1;
660 struct
662 unsigned : 1;
663 unsigned : 1;
664 unsigned GO : 1;
665 unsigned : 1;
666 unsigned : 1;
667 unsigned : 1;
668 unsigned : 1;
669 unsigned : 1;
672 struct
674 unsigned : 1;
675 unsigned : 1;
676 unsigned NOT_DONE : 1;
677 unsigned : 1;
678 unsigned : 1;
679 unsigned : 1;
680 unsigned : 1;
681 unsigned : 1;
684 struct
686 unsigned : 1;
687 unsigned : 1;
688 unsigned GO_DONE : 1;
689 unsigned : 1;
690 unsigned : 1;
691 unsigned : 1;
692 unsigned : 1;
693 unsigned : 1;
696 struct
698 unsigned : 3;
699 unsigned CHS : 3;
700 unsigned : 2;
703 struct
705 unsigned : 6;
706 unsigned ADCS : 2;
708 } __ADCON0bits_t;
710 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
712 #define _ADON 0x01
713 #define _GO_NOT_DONE 0x04
714 #define _GO 0x04
715 #define _NOT_DONE 0x04
716 #define _GO_DONE 0x04
717 #define _CHS0 0x08
718 #define _CHS1 0x10
719 #define _CHS2 0x20
720 #define _ADCS0 0x40
721 #define _ADCS1 0x80
723 //==============================================================================
726 //==============================================================================
727 // OPTION_REG Bits
729 extern __at(0x0081) __sfr OPTION_REG;
731 typedef union
733 struct
735 unsigned PS0 : 1;
736 unsigned PS1 : 1;
737 unsigned PS2 : 1;
738 unsigned PSA : 1;
739 unsigned T0SE : 1;
740 unsigned T0CS : 1;
741 unsigned INTEDG : 1;
742 unsigned NOT_RBPU : 1;
745 struct
747 unsigned PS : 3;
748 unsigned : 5;
750 } __OPTION_REGbits_t;
752 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
754 #define _PS0 0x01
755 #define _PS1 0x02
756 #define _PS2 0x04
757 #define _PSA 0x08
758 #define _T0SE 0x10
759 #define _T0CS 0x20
760 #define _INTEDG 0x40
761 #define _NOT_RBPU 0x80
763 //==============================================================================
766 //==============================================================================
767 // TRISA Bits
769 extern __at(0x0085) __sfr TRISA;
771 typedef union
773 struct
775 unsigned TRISA0 : 1;
776 unsigned TRISA1 : 1;
777 unsigned TRISA2 : 1;
778 unsigned TRISA3 : 1;
779 unsigned TRISA4 : 1;
780 unsigned TRISA5 : 1;
781 unsigned : 1;
782 unsigned : 1;
785 struct
787 unsigned TRISA : 6;
788 unsigned : 2;
790 } __TRISAbits_t;
792 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
794 #define _TRISA0 0x01
795 #define _TRISA1 0x02
796 #define _TRISA2 0x04
797 #define _TRISA3 0x08
798 #define _TRISA4 0x10
799 #define _TRISA5 0x20
801 //==============================================================================
804 //==============================================================================
805 // TRISB Bits
807 extern __at(0x0086) __sfr TRISB;
809 typedef struct
811 unsigned TRISB0 : 1;
812 unsigned TRISB1 : 1;
813 unsigned TRISB2 : 1;
814 unsigned TRISB3 : 1;
815 unsigned TRISB4 : 1;
816 unsigned TRISB5 : 1;
817 unsigned TRISB6 : 1;
818 unsigned TRISB7 : 1;
819 } __TRISBbits_t;
821 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
823 #define _TRISB0 0x01
824 #define _TRISB1 0x02
825 #define _TRISB2 0x04
826 #define _TRISB3 0x08
827 #define _TRISB4 0x10
828 #define _TRISB5 0x20
829 #define _TRISB6 0x40
830 #define _TRISB7 0x80
832 //==============================================================================
835 //==============================================================================
836 // TRISC Bits
838 extern __at(0x0087) __sfr TRISC;
840 typedef struct
842 unsigned TRISC0 : 1;
843 unsigned TRISC1 : 1;
844 unsigned TRISC2 : 1;
845 unsigned TRISC3 : 1;
846 unsigned TRISC4 : 1;
847 unsigned TRISC5 : 1;
848 unsigned TRISC6 : 1;
849 unsigned TRISC7 : 1;
850 } __TRISCbits_t;
852 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
854 #define _TRISC0 0x01
855 #define _TRISC1 0x02
856 #define _TRISC2 0x04
857 #define _TRISC3 0x08
858 #define _TRISC4 0x10
859 #define _TRISC5 0x20
860 #define _TRISC6 0x40
861 #define _TRISC7 0x80
863 //==============================================================================
866 //==============================================================================
867 // PIE1 Bits
869 extern __at(0x008C) __sfr PIE1;
871 typedef struct
873 unsigned TMR1IE : 1;
874 unsigned TMR2IE : 1;
875 unsigned CCP1IE : 1;
876 unsigned SSPIE : 1;
877 unsigned TXIE : 1;
878 unsigned RCIE : 1;
879 unsigned ADIE : 1;
880 unsigned : 1;
881 } __PIE1bits_t;
883 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
885 #define _TMR1IE 0x01
886 #define _TMR2IE 0x02
887 #define _CCP1IE 0x04
888 #define _SSPIE 0x08
889 #define _TXIE 0x10
890 #define _RCIE 0x20
891 #define _ADIE 0x40
893 //==============================================================================
896 //==============================================================================
897 // PIE2 Bits
899 extern __at(0x008D) __sfr PIE2;
901 typedef struct
903 unsigned CCP2IE : 1;
904 unsigned : 1;
905 unsigned : 1;
906 unsigned : 1;
907 unsigned : 1;
908 unsigned : 1;
909 unsigned : 1;
910 unsigned : 1;
911 } __PIE2bits_t;
913 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
915 #define _CCP2IE 0x01
917 //==============================================================================
920 //==============================================================================
921 // PCON Bits
923 extern __at(0x008E) __sfr PCON;
925 typedef union
927 struct
929 unsigned NOT_BOR : 1;
930 unsigned NOT_POR : 1;
931 unsigned : 1;
932 unsigned : 1;
933 unsigned : 1;
934 unsigned : 1;
935 unsigned : 1;
936 unsigned : 1;
939 struct
941 unsigned NOT_BO : 1;
942 unsigned : 1;
943 unsigned : 1;
944 unsigned : 1;
945 unsigned : 1;
946 unsigned : 1;
947 unsigned : 1;
948 unsigned : 1;
950 } __PCONbits_t;
952 extern __at(0x008E) volatile __PCONbits_t PCONbits;
954 #define _NOT_BOR 0x01
955 #define _NOT_BO 0x01
956 #define _NOT_POR 0x02
958 //==============================================================================
960 extern __at(0x0092) __sfr PR2;
961 extern __at(0x0093) __sfr SSPADD;
963 //==============================================================================
964 // SSPSTAT Bits
966 extern __at(0x0094) __sfr SSPSTAT;
968 typedef union
970 struct
972 unsigned BF : 1;
973 unsigned UA : 1;
974 unsigned R_NOT_W : 1;
975 unsigned S : 1;
976 unsigned P : 1;
977 unsigned D_NOT_A : 1;
978 unsigned CKE : 1;
979 unsigned SMP : 1;
982 struct
984 unsigned : 1;
985 unsigned : 1;
986 unsigned R : 1;
987 unsigned I2C_START : 1;
988 unsigned I2C_STOP : 1;
989 unsigned D : 1;
990 unsigned : 1;
991 unsigned : 1;
994 struct
996 unsigned : 1;
997 unsigned : 1;
998 unsigned I2C_READ : 1;
999 unsigned : 1;
1000 unsigned : 1;
1001 unsigned I2C_DATA : 1;
1002 unsigned : 1;
1003 unsigned : 1;
1006 struct
1008 unsigned : 1;
1009 unsigned : 1;
1010 unsigned R_W : 1;
1011 unsigned : 1;
1012 unsigned : 1;
1013 unsigned D_A : 1;
1014 unsigned : 1;
1015 unsigned : 1;
1018 struct
1020 unsigned : 1;
1021 unsigned : 1;
1022 unsigned READ_WRITE : 1;
1023 unsigned : 1;
1024 unsigned : 1;
1025 unsigned DATA_ADDRESS : 1;
1026 unsigned : 1;
1027 unsigned : 1;
1030 struct
1032 unsigned : 1;
1033 unsigned : 1;
1034 unsigned NOT_W : 1;
1035 unsigned : 1;
1036 unsigned : 1;
1037 unsigned NOT_A : 1;
1038 unsigned : 1;
1039 unsigned : 1;
1042 struct
1044 unsigned : 1;
1045 unsigned : 1;
1046 unsigned NOT_WRITE : 1;
1047 unsigned : 1;
1048 unsigned : 1;
1049 unsigned NOT_ADDRESS : 1;
1050 unsigned : 1;
1051 unsigned : 1;
1053 } __SSPSTATbits_t;
1055 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1057 #define _BF 0x01
1058 #define _UA 0x02
1059 #define _R_NOT_W 0x04
1060 #define _R 0x04
1061 #define _I2C_READ 0x04
1062 #define _R_W 0x04
1063 #define _READ_WRITE 0x04
1064 #define _NOT_W 0x04
1065 #define _NOT_WRITE 0x04
1066 #define _S 0x08
1067 #define _I2C_START 0x08
1068 #define _P 0x10
1069 #define _I2C_STOP 0x10
1070 #define _D_NOT_A 0x20
1071 #define _D 0x20
1072 #define _I2C_DATA 0x20
1073 #define _D_A 0x20
1074 #define _DATA_ADDRESS 0x20
1075 #define _NOT_A 0x20
1076 #define _NOT_ADDRESS 0x20
1077 #define _CKE 0x40
1078 #define _SMP 0x80
1080 //==============================================================================
1083 //==============================================================================
1084 // TXSTA Bits
1086 extern __at(0x0098) __sfr TXSTA;
1088 typedef union
1090 struct
1092 unsigned TX9D : 1;
1093 unsigned TRMT : 1;
1094 unsigned BRGH : 1;
1095 unsigned : 1;
1096 unsigned SYNC : 1;
1097 unsigned TXEN : 1;
1098 unsigned TX9 : 1;
1099 unsigned CSRC : 1;
1102 struct
1104 unsigned TXD8 : 1;
1105 unsigned : 1;
1106 unsigned : 1;
1107 unsigned : 1;
1108 unsigned : 1;
1109 unsigned : 1;
1110 unsigned NOT_TX8 : 1;
1111 unsigned : 1;
1114 struct
1116 unsigned : 1;
1117 unsigned : 1;
1118 unsigned : 1;
1119 unsigned : 1;
1120 unsigned : 1;
1121 unsigned : 1;
1122 unsigned TX8_9 : 1;
1123 unsigned : 1;
1125 } __TXSTAbits_t;
1127 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1129 #define _TX9D 0x01
1130 #define _TXD8 0x01
1131 #define _TRMT 0x02
1132 #define _BRGH 0x04
1133 #define _SYNC 0x10
1134 #define _TXEN 0x20
1135 #define _TX9 0x40
1136 #define _NOT_TX8 0x40
1137 #define _TX8_9 0x40
1138 #define _CSRC 0x80
1140 //==============================================================================
1142 extern __at(0x0099) __sfr SPBRG;
1144 //==============================================================================
1145 // ADCON1 Bits
1147 extern __at(0x009F) __sfr ADCON1;
1149 typedef union
1151 struct
1153 unsigned PCFG0 : 1;
1154 unsigned PCFG1 : 1;
1155 unsigned PCFG2 : 1;
1156 unsigned : 1;
1157 unsigned : 1;
1158 unsigned : 1;
1159 unsigned : 1;
1160 unsigned : 1;
1163 struct
1165 unsigned PCFG : 3;
1166 unsigned : 5;
1168 } __ADCON1bits_t;
1170 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1172 #define _PCFG0 0x01
1173 #define _PCFG1 0x02
1174 #define _PCFG2 0x04
1176 //==============================================================================
1179 //==============================================================================
1181 // Configuration Bits
1183 //==============================================================================
1185 #define _CONFIG1 0x2007
1187 //----------------------------- CONFIG1 Options -------------------------------
1189 #define _FOSC_LP 0x3FFC // LP oscillator.
1190 #define _LP_OSC 0x3FFC // LP oscillator.
1191 #define _FOSC_XT 0x3FFD // XT oscillator.
1192 #define _XT_OSC 0x3FFD // XT oscillator.
1193 #define _FOSC_HS 0x3FFE // HS oscillator.
1194 #define _HS_OSC 0x3FFE // HS oscillator.
1195 #define _FOSC_RC 0x3FFF // RC oscillator.
1196 #define _RC_OSC 0x3FFF // RC oscillator.
1197 #define _WDTE_OFF 0x3FFB // WDT disabled.
1198 #define _WDT_OFF 0x3FFB // WDT disabled.
1199 #define _WDTE_ON 0x3FFF // WDT enabled.
1200 #define _WDT_ON 0x3FFF // WDT enabled.
1201 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
1202 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1203 #define _CP_ALL 0x00CF // All memory is code protected.
1204 #define _CP_75 0x15DF // 0400h-0FFFh code protected.
1205 #define _CP_50 0x2AEF // 0800h-0FFFh code protected.
1206 #define _CP_OFF 0x3FFF // Code protection off.
1207 #define _BOREN_OFF 0x3FBF // BOR disabled.
1208 #define _BODEN_OFF 0x3FBF // BOR disabled.
1209 #define _BOREN_ON 0x3FFF // BOR enabled.
1210 #define _BODEN_ON 0x3FFF // BOR enabled.
1212 //==============================================================================
1214 #define _IDLOC0 0x2000
1215 #define _IDLOC1 0x2001
1216 #define _IDLOC2 0x2002
1217 #define _IDLOC3 0x2003
1219 //==============================================================================
1221 #ifndef NO_BIT_DEFINES
1223 #define ADON ADCON0bits.ADON // bit 0
1224 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
1225 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
1226 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
1227 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
1228 #define CHS0 ADCON0bits.CHS0 // bit 3
1229 #define CHS1 ADCON0bits.CHS1 // bit 4
1230 #define CHS2 ADCON0bits.CHS2 // bit 5
1231 #define ADCS0 ADCON0bits.ADCS0 // bit 6
1232 #define ADCS1 ADCON0bits.ADCS1 // bit 7
1234 #define PCFG0 ADCON1bits.PCFG0 // bit 0
1235 #define PCFG1 ADCON1bits.PCFG1 // bit 1
1236 #define PCFG2 ADCON1bits.PCFG2 // bit 2
1238 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
1239 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
1240 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
1241 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
1242 #define CCP1Y CCP1CONbits.CCP1Y // bit 4
1243 #define CCP1X CCP1CONbits.CCP1X // bit 5
1245 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
1246 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
1247 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
1248 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
1249 #define CCP2Y CCP2CONbits.CCP2Y // bit 4
1250 #define CCP2X CCP2CONbits.CCP2X // bit 5
1252 #define RBIF INTCONbits.RBIF // bit 0
1253 #define INTF INTCONbits.INTF // bit 1
1254 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
1255 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
1256 #define RBIE INTCONbits.RBIE // bit 3
1257 #define INTE INTCONbits.INTE // bit 4
1258 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
1259 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
1260 #define PEIE INTCONbits.PEIE // bit 6
1261 #define GIE INTCONbits.GIE // bit 7
1263 #define PS0 OPTION_REGbits.PS0 // bit 0
1264 #define PS1 OPTION_REGbits.PS1 // bit 1
1265 #define PS2 OPTION_REGbits.PS2 // bit 2
1266 #define PSA OPTION_REGbits.PSA // bit 3
1267 #define T0SE OPTION_REGbits.T0SE // bit 4
1268 #define T0CS OPTION_REGbits.T0CS // bit 5
1269 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1270 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
1272 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1273 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
1274 #define NOT_POR PCONbits.NOT_POR // bit 1
1276 #define TMR1IE PIE1bits.TMR1IE // bit 0
1277 #define TMR2IE PIE1bits.TMR2IE // bit 1
1278 #define CCP1IE PIE1bits.CCP1IE // bit 2
1279 #define SSPIE PIE1bits.SSPIE // bit 3
1280 #define TXIE PIE1bits.TXIE // bit 4
1281 #define RCIE PIE1bits.RCIE // bit 5
1282 #define ADIE PIE1bits.ADIE // bit 6
1284 #define CCP2IE PIE2bits.CCP2IE // bit 0
1286 #define TMR1IF PIR1bits.TMR1IF // bit 0
1287 #define TMR2IF PIR1bits.TMR2IF // bit 1
1288 #define CCP1IF PIR1bits.CCP1IF // bit 2
1289 #define SSPIF PIR1bits.SSPIF // bit 3
1290 #define TXIF PIR1bits.TXIF // bit 4
1291 #define RCIF PIR1bits.RCIF // bit 5
1292 #define ADIF PIR1bits.ADIF // bit 6
1294 #define CCP2IF PIR2bits.CCP2IF // bit 0
1296 #define RA0 PORTAbits.RA0 // bit 0
1297 #define RA1 PORTAbits.RA1 // bit 1
1298 #define RA2 PORTAbits.RA2 // bit 2
1299 #define RA3 PORTAbits.RA3 // bit 3
1300 #define RA4 PORTAbits.RA4 // bit 4
1301 #define RA5 PORTAbits.RA5 // bit 5
1303 #define RB0 PORTBbits.RB0 // bit 0
1304 #define RB1 PORTBbits.RB1 // bit 1
1305 #define RB2 PORTBbits.RB2 // bit 2
1306 #define RB3 PORTBbits.RB3 // bit 3
1307 #define RB4 PORTBbits.RB4 // bit 4
1308 #define RB5 PORTBbits.RB5 // bit 5
1309 #define RB6 PORTBbits.RB6 // bit 6
1310 #define RB7 PORTBbits.RB7 // bit 7
1312 #define RC0 PORTCbits.RC0 // bit 0
1313 #define RC1 PORTCbits.RC1 // bit 1
1314 #define RC2 PORTCbits.RC2 // bit 2
1315 #define RC3 PORTCbits.RC3 // bit 3
1316 #define RC4 PORTCbits.RC4 // bit 4
1317 #define RC5 PORTCbits.RC5 // bit 5
1318 #define RC6 PORTCbits.RC6 // bit 6
1319 #define RC7 PORTCbits.RC7 // bit 7
1321 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
1322 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
1323 #define OERR RCSTAbits.OERR // bit 1
1324 #define FERR RCSTAbits.FERR // bit 2
1325 #define CREN RCSTAbits.CREN // bit 4
1326 #define SREN RCSTAbits.SREN // bit 5
1327 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
1328 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
1329 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
1330 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
1331 #define SPEN RCSTAbits.SPEN // bit 7
1333 #define SSPM0 SSPCONbits.SSPM0 // bit 0
1334 #define SSPM1 SSPCONbits.SSPM1 // bit 1
1335 #define SSPM2 SSPCONbits.SSPM2 // bit 2
1336 #define SSPM3 SSPCONbits.SSPM3 // bit 3
1337 #define CKP SSPCONbits.CKP // bit 4
1338 #define SSPEN SSPCONbits.SSPEN // bit 5
1339 #define SSPOV SSPCONbits.SSPOV // bit 6
1340 #define WCOL SSPCONbits.WCOL // bit 7
1342 #define BF SSPSTATbits.BF // bit 0
1343 #define UA SSPSTATbits.UA // bit 1
1344 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
1345 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
1346 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
1347 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
1348 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
1349 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
1350 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
1351 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
1352 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
1353 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
1354 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
1355 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
1356 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
1357 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
1358 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
1359 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
1360 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
1361 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
1362 #define CKE SSPSTATbits.CKE // bit 6
1363 #define SMP SSPSTATbits.SMP // bit 7
1365 #define C STATUSbits.C // bit 0
1366 #define DC STATUSbits.DC // bit 1
1367 #define Z STATUSbits.Z // bit 2
1368 #define NOT_PD STATUSbits.NOT_PD // bit 3
1369 #define NOT_TO STATUSbits.NOT_TO // bit 4
1370 #define RP0 STATUSbits.RP0 // bit 5
1371 #define RP1 STATUSbits.RP1 // bit 6
1372 #define IRP STATUSbits.IRP // bit 7
1374 #define TMR1ON T1CONbits.TMR1ON // bit 0
1375 #define TMR1CS T1CONbits.TMR1CS // bit 1
1376 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
1377 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
1378 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1379 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1380 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1382 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
1383 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
1384 #define TMR2ON T2CONbits.TMR2ON // bit 2
1385 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
1386 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
1387 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
1388 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
1390 #define TRISA0 TRISAbits.TRISA0 // bit 0
1391 #define TRISA1 TRISAbits.TRISA1 // bit 1
1392 #define TRISA2 TRISAbits.TRISA2 // bit 2
1393 #define TRISA3 TRISAbits.TRISA3 // bit 3
1394 #define TRISA4 TRISAbits.TRISA4 // bit 4
1395 #define TRISA5 TRISAbits.TRISA5 // bit 5
1397 #define TRISB0 TRISBbits.TRISB0 // bit 0
1398 #define TRISB1 TRISBbits.TRISB1 // bit 1
1399 #define TRISB2 TRISBbits.TRISB2 // bit 2
1400 #define TRISB3 TRISBbits.TRISB3 // bit 3
1401 #define TRISB4 TRISBbits.TRISB4 // bit 4
1402 #define TRISB5 TRISBbits.TRISB5 // bit 5
1403 #define TRISB6 TRISBbits.TRISB6 // bit 6
1404 #define TRISB7 TRISBbits.TRISB7 // bit 7
1406 #define TRISC0 TRISCbits.TRISC0 // bit 0
1407 #define TRISC1 TRISCbits.TRISC1 // bit 1
1408 #define TRISC2 TRISCbits.TRISC2 // bit 2
1409 #define TRISC3 TRISCbits.TRISC3 // bit 3
1410 #define TRISC4 TRISCbits.TRISC4 // bit 4
1411 #define TRISC5 TRISCbits.TRISC5 // bit 5
1412 #define TRISC6 TRISCbits.TRISC6 // bit 6
1413 #define TRISC7 TRISCbits.TRISC7 // bit 7
1415 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
1416 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
1417 #define TRMT TXSTAbits.TRMT // bit 1
1418 #define BRGH TXSTAbits.BRGH // bit 2
1419 #define SYNC TXSTAbits.SYNC // bit 4
1420 #define TXEN TXSTAbits.TXEN // bit 5
1421 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
1422 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
1423 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
1424 #define CSRC TXSTAbits.CSRC // bit 7
1426 #endif // #ifndef NO_BIT_DEFINES
1428 #endif // #ifndef __PIC16C73B_H__