Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c765.h
blob778b5058f26aadcf7d16ec3da183d421e274a694
1 /*
2 * This declarations of the PIC16C765 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:03 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 __PIC16C765_H__
26 #define __PIC16C765_H__
28 //==============================================================================
30 // Register Addresses
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF_ADDR 0x0000
37 #define TMR0_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR_ADDR 0x0004
41 #define PORTA_ADDR 0x0005
42 #define PORTB_ADDR 0x0006
43 #define PORTC_ADDR 0x0007
44 #define PORTD_ADDR 0x0008
45 #define PORTE_ADDR 0x0009
46 #define PCLATH_ADDR 0x000A
47 #define INTCON_ADDR 0x000B
48 #define PIR1_ADDR 0x000C
49 #define PIR2_ADDR 0x000D
50 #define TMR1_ADDR 0x000E
51 #define TMR1L_ADDR 0x000E
52 #define TMR1H_ADDR 0x000F
53 #define T1CON_ADDR 0x0010
54 #define TMR2_ADDR 0x0011
55 #define T2CON_ADDR 0x0012
56 #define 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 TRISD_ADDR 0x0088
74 #define TRISE_ADDR 0x0089
75 #define PIE1_ADDR 0x008C
76 #define PIE2_ADDR 0x008D
77 #define PCON_ADDR 0x008E
78 #define PR2_ADDR 0x0092
79 #define TXSTA_ADDR 0x0098
80 #define SPBRG_ADDR 0x0099
81 #define ADCON1_ADDR 0x009F
82 #define UIR_ADDR 0x0190
83 #define UIE_ADDR 0x0191
84 #define UEIR_ADDR 0x0192
85 #define UEIE_ADDR 0x0193
86 #define USTAT_ADDR 0x0194
87 #define UCTRL_ADDR 0x0195
88 #define UADDR_ADDR 0x0196
89 #define USWSTAT_ADDR 0x0197
90 #define UEP0_ADDR 0x0198
91 #define UEP1_ADDR 0x0199
92 #define UEP2_ADDR 0x019A
93 #define BD0OST_ADDR 0x01A0
94 #define BD0OBC_ADDR 0x01A1
95 #define BD0OAL_ADDR 0x01A2
96 #define BD0IST_ADDR 0x01A4
97 #define BD0IBC_ADDR 0x01A5
98 #define BD0IAL_ADDR 0x01A6
99 #define BD1OST_ADDR 0x01A8
100 #define BD1OBC_ADDR 0x01A9
101 #define BD1OAL_ADDR 0x01AA
102 #define BD1IST_ADDR 0x01AC
103 #define BD1IBC_ADDR 0x01AD
104 #define BD1IAL_ADDR 0x01AE
105 #define BD2OST_ADDR 0x01B0
106 #define BD2OBC_ADDR 0x01B1
107 #define BD2OAL_ADDR 0x01B2
108 #define BD2IST_ADDR 0x01B4
109 #define BD2IBC_ADDR 0x01B5
110 #define BD2IAL_ADDR 0x01B6
112 #endif // #ifndef NO_ADDR_DEFINES
114 //==============================================================================
116 // Register Definitions
118 //==============================================================================
120 extern __at(0x0000) __sfr INDF;
121 extern __at(0x0001) __sfr TMR0;
122 extern __at(0x0002) __sfr PCL;
124 //==============================================================================
125 // STATUS Bits
127 extern __at(0x0003) __sfr STATUS;
129 typedef union
131 struct
133 unsigned C : 1;
134 unsigned DC : 1;
135 unsigned Z : 1;
136 unsigned NOT_PD : 1;
137 unsigned NOT_TO : 1;
138 unsigned RP0 : 1;
139 unsigned RP1 : 1;
140 unsigned IRP : 1;
143 struct
145 unsigned : 5;
146 unsigned RP : 2;
147 unsigned : 1;
149 } __STATUSbits_t;
151 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
153 #define _C 0x01
154 #define _DC 0x02
155 #define _Z 0x04
156 #define _NOT_PD 0x08
157 #define _NOT_TO 0x10
158 #define _RP0 0x20
159 #define _RP1 0x40
160 #define _IRP 0x80
162 //==============================================================================
164 extern __at(0x0004) __sfr FSR;
166 //==============================================================================
167 // PORTA Bits
169 extern __at(0x0005) __sfr PORTA;
171 typedef union
173 struct
175 unsigned RA0 : 1;
176 unsigned RA1 : 1;
177 unsigned RA2 : 1;
178 unsigned RA3 : 1;
179 unsigned RA4 : 1;
180 unsigned RA5 : 1;
181 unsigned : 1;
182 unsigned : 1;
185 struct
187 unsigned RA : 6;
188 unsigned : 2;
190 } __PORTAbits_t;
192 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
194 #define _RA0 0x01
195 #define _RA1 0x02
196 #define _RA2 0x04
197 #define _RA3 0x08
198 #define _RA4 0x10
199 #define _RA5 0x20
201 //==============================================================================
204 //==============================================================================
205 // PORTB Bits
207 extern __at(0x0006) __sfr PORTB;
209 typedef struct
211 unsigned RB0 : 1;
212 unsigned RB1 : 1;
213 unsigned RB2 : 1;
214 unsigned RB3 : 1;
215 unsigned RB4 : 1;
216 unsigned RB5 : 1;
217 unsigned RB6 : 1;
218 unsigned RB7 : 1;
219 } __PORTBbits_t;
221 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
223 #define _RB0 0x01
224 #define _RB1 0x02
225 #define _RB2 0x04
226 #define _RB3 0x08
227 #define _RB4 0x10
228 #define _RB5 0x20
229 #define _RB6 0x40
230 #define _RB7 0x80
232 //==============================================================================
235 //==============================================================================
236 // PORTC Bits
238 extern __at(0x0007) __sfr PORTC;
240 typedef struct
242 unsigned RC0 : 1;
243 unsigned RC1 : 1;
244 unsigned RC2 : 1;
245 unsigned : 1;
246 unsigned : 1;
247 unsigned : 1;
248 unsigned RC6 : 1;
249 unsigned RC7 : 1;
250 } __PORTCbits_t;
252 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
254 #define _RC0 0x01
255 #define _RC1 0x02
256 #define _RC2 0x04
257 #define _RC6 0x40
258 #define _RC7 0x80
260 //==============================================================================
263 //==============================================================================
264 // PORTD Bits
266 extern __at(0x0008) __sfr PORTD;
268 typedef struct
270 unsigned RD0 : 1;
271 unsigned RD1 : 1;
272 unsigned RD2 : 1;
273 unsigned RD3 : 1;
274 unsigned RD4 : 1;
275 unsigned RD5 : 1;
276 unsigned RD6 : 1;
277 unsigned RD7 : 1;
278 } __PORTDbits_t;
280 extern __at(0x0008) volatile __PORTDbits_t PORTDbits;
282 #define _RD0 0x01
283 #define _RD1 0x02
284 #define _RD2 0x04
285 #define _RD3 0x08
286 #define _RD4 0x10
287 #define _RD5 0x20
288 #define _RD6 0x40
289 #define _RD7 0x80
291 //==============================================================================
294 //==============================================================================
295 // PORTE Bits
297 extern __at(0x0009) __sfr PORTE;
299 typedef union
301 struct
303 unsigned RE0 : 1;
304 unsigned RE1 : 1;
305 unsigned RE2 : 1;
306 unsigned : 1;
307 unsigned : 1;
308 unsigned : 1;
309 unsigned : 1;
310 unsigned : 1;
313 struct
315 unsigned RE : 3;
316 unsigned : 5;
318 } __PORTEbits_t;
320 extern __at(0x0009) volatile __PORTEbits_t PORTEbits;
322 #define _RE0 0x01
323 #define _RE1 0x02
324 #define _RE2 0x04
326 //==============================================================================
328 extern __at(0x000A) __sfr PCLATH;
330 //==============================================================================
331 // INTCON Bits
333 extern __at(0x000B) __sfr INTCON;
335 typedef union
337 struct
339 unsigned RBIF : 1;
340 unsigned INTF : 1;
341 unsigned T0IF : 1;
342 unsigned RBIE : 1;
343 unsigned INTE : 1;
344 unsigned T0IE : 1;
345 unsigned PEIE : 1;
346 unsigned GIE : 1;
349 struct
351 unsigned : 1;
352 unsigned : 1;
353 unsigned TMR0IF : 1;
354 unsigned : 1;
355 unsigned : 1;
356 unsigned TMR0IE : 1;
357 unsigned : 1;
358 unsigned : 1;
360 } __INTCONbits_t;
362 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
364 #define _RBIF 0x01
365 #define _INTF 0x02
366 #define _T0IF 0x04
367 #define _TMR0IF 0x04
368 #define _RBIE 0x08
369 #define _INTE 0x10
370 #define _T0IE 0x20
371 #define _TMR0IE 0x20
372 #define _PEIE 0x40
373 #define _GIE 0x80
375 //==============================================================================
378 //==============================================================================
379 // PIR1 Bits
381 extern __at(0x000C) __sfr PIR1;
383 typedef struct
385 unsigned TMR1IF : 1;
386 unsigned TMR2IF : 1;
387 unsigned CCP1IF : 1;
388 unsigned USBIF : 1;
389 unsigned TXIF : 1;
390 unsigned RCIF : 1;
391 unsigned ADIF : 1;
392 unsigned PSPIF : 1;
393 } __PIR1bits_t;
395 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
397 #define _TMR1IF 0x01
398 #define _TMR2IF 0x02
399 #define _CCP1IF 0x04
400 #define _USBIF 0x08
401 #define _TXIF 0x10
402 #define _RCIF 0x20
403 #define _ADIF 0x40
404 #define _PSPIF 0x80
406 //==============================================================================
409 //==============================================================================
410 // PIR2 Bits
412 extern __at(0x000D) __sfr PIR2;
414 typedef struct
416 unsigned CCP2IF : 1;
417 unsigned : 1;
418 unsigned : 1;
419 unsigned : 1;
420 unsigned : 1;
421 unsigned : 1;
422 unsigned : 1;
423 unsigned : 1;
424 } __PIR2bits_t;
426 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
428 #define _CCP2IF 0x01
430 //==============================================================================
432 extern __at(0x000E) __sfr TMR1;
433 extern __at(0x000E) __sfr TMR1L;
434 extern __at(0x000F) __sfr TMR1H;
436 //==============================================================================
437 // T1CON Bits
439 extern __at(0x0010) __sfr T1CON;
441 typedef union
443 struct
445 unsigned TMR1ON : 1;
446 unsigned TMR1CS : 1;
447 unsigned NOT_T1SYNC : 1;
448 unsigned T1OSCEN : 1;
449 unsigned T1CKPS0 : 1;
450 unsigned T1CKPS1 : 1;
451 unsigned : 1;
452 unsigned : 1;
455 struct
457 unsigned : 1;
458 unsigned : 1;
459 unsigned T1INSYNC : 1;
460 unsigned : 1;
461 unsigned : 1;
462 unsigned : 1;
463 unsigned : 1;
464 unsigned : 1;
467 struct
469 unsigned : 4;
470 unsigned T1CKPS : 2;
471 unsigned : 2;
473 } __T1CONbits_t;
475 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
477 #define _TMR1ON 0x01
478 #define _TMR1CS 0x02
479 #define _NOT_T1SYNC 0x04
480 #define _T1INSYNC 0x04
481 #define _T1OSCEN 0x08
482 #define _T1CKPS0 0x10
483 #define _T1CKPS1 0x20
485 //==============================================================================
487 extern __at(0x0011) __sfr TMR2;
489 //==============================================================================
490 // T2CON Bits
492 extern __at(0x0012) __sfr T2CON;
494 typedef union
496 struct
498 unsigned T2CKPS0 : 1;
499 unsigned T2CKPS1 : 1;
500 unsigned TMR2ON : 1;
501 unsigned TOUTPS0 : 1;
502 unsigned TOUTPS1 : 1;
503 unsigned TOUTPS2 : 1;
504 unsigned TOUTPS3 : 1;
505 unsigned : 1;
508 struct
510 unsigned T2CKPS : 2;
511 unsigned : 6;
514 struct
516 unsigned : 3;
517 unsigned TOUTPS : 4;
518 unsigned : 1;
520 } __T2CONbits_t;
522 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
524 #define _T2CKPS0 0x01
525 #define _T2CKPS1 0x02
526 #define _TMR2ON 0x04
527 #define _TOUTPS0 0x08
528 #define _TOUTPS1 0x10
529 #define _TOUTPS2 0x20
530 #define _TOUTPS3 0x40
532 //==============================================================================
534 extern __at(0x0015) __sfr CCPR1;
535 extern __at(0x0015) __sfr CCPR1L;
536 extern __at(0x0016) __sfr CCPR1H;
538 //==============================================================================
539 // CCP1CON Bits
541 extern __at(0x0017) __sfr CCP1CON;
543 typedef union
545 struct
547 unsigned CCP1M0 : 1;
548 unsigned CCP1M1 : 1;
549 unsigned CCP1M2 : 1;
550 unsigned CCP1M3 : 1;
551 unsigned DC1B0 : 1;
552 unsigned DC1B1 : 1;
553 unsigned : 1;
554 unsigned : 1;
557 struct
559 unsigned CCP1M : 4;
560 unsigned : 4;
563 struct
565 unsigned : 4;
566 unsigned DC1B : 2;
567 unsigned : 2;
569 } __CCP1CONbits_t;
571 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
573 #define _CCP1M0 0x01
574 #define _CCP1M1 0x02
575 #define _CCP1M2 0x04
576 #define _CCP1M3 0x08
577 #define _DC1B0 0x10
578 #define _DC1B1 0x20
580 //==============================================================================
583 //==============================================================================
584 // RCSTA Bits
586 extern __at(0x0018) __sfr RCSTA;
588 typedef union
590 struct
592 unsigned RX9D : 1;
593 unsigned OERR : 1;
594 unsigned FERR : 1;
595 unsigned : 1;
596 unsigned CREN : 1;
597 unsigned SREN : 1;
598 unsigned RX9 : 1;
599 unsigned SPEN : 1;
602 struct
604 unsigned RCD8 : 1;
605 unsigned : 1;
606 unsigned : 1;
607 unsigned : 1;
608 unsigned : 1;
609 unsigned : 1;
610 unsigned RC9 : 1;
611 unsigned : 1;
614 struct
616 unsigned : 1;
617 unsigned : 1;
618 unsigned : 1;
619 unsigned : 1;
620 unsigned : 1;
621 unsigned : 1;
622 unsigned NOT_RC8 : 1;
623 unsigned : 1;
626 struct
628 unsigned : 1;
629 unsigned : 1;
630 unsigned : 1;
631 unsigned : 1;
632 unsigned : 1;
633 unsigned : 1;
634 unsigned RC8_9 : 1;
635 unsigned : 1;
637 } __RCSTAbits_t;
639 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
641 #define _RX9D 0x01
642 #define _RCD8 0x01
643 #define _OERR 0x02
644 #define _FERR 0x04
645 #define _CREN 0x10
646 #define _SREN 0x20
647 #define _RX9 0x40
648 #define _RC9 0x40
649 #define _NOT_RC8 0x40
650 #define _RC8_9 0x40
651 #define _SPEN 0x80
653 //==============================================================================
655 extern __at(0x0019) __sfr TXREG;
656 extern __at(0x001A) __sfr RCREG;
657 extern __at(0x001B) __sfr CCPR2;
658 extern __at(0x001B) __sfr CCPR2L;
659 extern __at(0x001C) __sfr CCPR2H;
661 //==============================================================================
662 // CCP2CON Bits
664 extern __at(0x001D) __sfr CCP2CON;
666 typedef union
668 struct
670 unsigned CCP2M0 : 1;
671 unsigned CCP2M1 : 1;
672 unsigned CCP2M2 : 1;
673 unsigned CCP2M3 : 1;
674 unsigned DC2B0 : 1;
675 unsigned DC2B1 : 1;
676 unsigned : 1;
677 unsigned : 1;
680 struct
682 unsigned CCP2M : 4;
683 unsigned : 4;
686 struct
688 unsigned : 4;
689 unsigned DC2B : 2;
690 unsigned : 2;
692 } __CCP2CONbits_t;
694 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
696 #define _CCP2M0 0x01
697 #define _CCP2M1 0x02
698 #define _CCP2M2 0x04
699 #define _CCP2M3 0x08
700 #define _DC2B0 0x10
701 #define _DC2B1 0x20
703 //==============================================================================
705 extern __at(0x001E) __sfr ADRES;
707 //==============================================================================
708 // ADCON0 Bits
710 extern __at(0x001F) __sfr ADCON0;
712 typedef union
714 struct
716 unsigned ADON : 1;
717 unsigned : 1;
718 unsigned GO_NOT_DONE : 1;
719 unsigned CHS0 : 1;
720 unsigned CHS1 : 1;
721 unsigned CHS2 : 1;
722 unsigned ADCS0 : 1;
723 unsigned ADCS1 : 1;
726 struct
728 unsigned : 1;
729 unsigned : 1;
730 unsigned GO : 1;
731 unsigned : 1;
732 unsigned : 1;
733 unsigned : 1;
734 unsigned : 1;
735 unsigned : 1;
738 struct
740 unsigned : 1;
741 unsigned : 1;
742 unsigned NOT_DONE : 1;
743 unsigned : 1;
744 unsigned : 1;
745 unsigned : 1;
746 unsigned : 1;
747 unsigned : 1;
750 struct
752 unsigned : 1;
753 unsigned : 1;
754 unsigned GO_DONE : 1;
755 unsigned : 1;
756 unsigned : 1;
757 unsigned : 1;
758 unsigned : 1;
759 unsigned : 1;
762 struct
764 unsigned : 3;
765 unsigned CHS : 3;
766 unsigned : 2;
769 struct
771 unsigned : 6;
772 unsigned ADCS : 2;
774 } __ADCON0bits_t;
776 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
778 #define _ADON 0x01
779 #define _GO_NOT_DONE 0x04
780 #define _GO 0x04
781 #define _NOT_DONE 0x04
782 #define _GO_DONE 0x04
783 #define _CHS0 0x08
784 #define _CHS1 0x10
785 #define _CHS2 0x20
786 #define _ADCS0 0x40
787 #define _ADCS1 0x80
789 //==============================================================================
792 //==============================================================================
793 // OPTION_REG Bits
795 extern __at(0x0081) __sfr OPTION_REG;
797 typedef union
799 struct
801 unsigned PS0 : 1;
802 unsigned PS1 : 1;
803 unsigned PS2 : 1;
804 unsigned PSA : 1;
805 unsigned T0SE : 1;
806 unsigned T0CS : 1;
807 unsigned INTEDG : 1;
808 unsigned NOT_RBPU : 1;
811 struct
813 unsigned PS : 3;
814 unsigned : 5;
816 } __OPTION_REGbits_t;
818 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
820 #define _PS0 0x01
821 #define _PS1 0x02
822 #define _PS2 0x04
823 #define _PSA 0x08
824 #define _T0SE 0x10
825 #define _T0CS 0x20
826 #define _INTEDG 0x40
827 #define _NOT_RBPU 0x80
829 //==============================================================================
832 //==============================================================================
833 // TRISA Bits
835 extern __at(0x0085) __sfr TRISA;
837 typedef union
839 struct
841 unsigned TRISA0 : 1;
842 unsigned TRISA1 : 1;
843 unsigned TRISA2 : 1;
844 unsigned TRISA3 : 1;
845 unsigned TRISA4 : 1;
846 unsigned TRISA5 : 1;
847 unsigned : 1;
848 unsigned : 1;
851 struct
853 unsigned TRISA : 6;
854 unsigned : 2;
856 } __TRISAbits_t;
858 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
860 #define _TRISA0 0x01
861 #define _TRISA1 0x02
862 #define _TRISA2 0x04
863 #define _TRISA3 0x08
864 #define _TRISA4 0x10
865 #define _TRISA5 0x20
867 //==============================================================================
870 //==============================================================================
871 // TRISB Bits
873 extern __at(0x0086) __sfr TRISB;
875 typedef struct
877 unsigned TRISB0 : 1;
878 unsigned TRISB1 : 1;
879 unsigned TRISB2 : 1;
880 unsigned TRISB3 : 1;
881 unsigned TRISB4 : 1;
882 unsigned TRISB5 : 1;
883 unsigned TRISB6 : 1;
884 unsigned TRISB7 : 1;
885 } __TRISBbits_t;
887 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
889 #define _TRISB0 0x01
890 #define _TRISB1 0x02
891 #define _TRISB2 0x04
892 #define _TRISB3 0x08
893 #define _TRISB4 0x10
894 #define _TRISB5 0x20
895 #define _TRISB6 0x40
896 #define _TRISB7 0x80
898 //==============================================================================
901 //==============================================================================
902 // TRISC Bits
904 extern __at(0x0087) __sfr TRISC;
906 typedef struct
908 unsigned TRISC0 : 1;
909 unsigned TRISC1 : 1;
910 unsigned TRISC2 : 1;
911 unsigned : 1;
912 unsigned : 1;
913 unsigned : 1;
914 unsigned TRISC6 : 1;
915 unsigned TRISC7 : 1;
916 } __TRISCbits_t;
918 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
920 #define _TRISC0 0x01
921 #define _TRISC1 0x02
922 #define _TRISC2 0x04
923 #define _TRISC6 0x40
924 #define _TRISC7 0x80
926 //==============================================================================
929 //==============================================================================
930 // TRISD Bits
932 extern __at(0x0088) __sfr TRISD;
934 typedef struct
936 unsigned TRISD0 : 1;
937 unsigned TRISD1 : 1;
938 unsigned TRISD2 : 1;
939 unsigned TRISD3 : 1;
940 unsigned TRISD4 : 1;
941 unsigned TRISD5 : 1;
942 unsigned TRISD6 : 1;
943 unsigned TRISD7 : 1;
944 } __TRISDbits_t;
946 extern __at(0x0088) volatile __TRISDbits_t TRISDbits;
948 #define _TRISD0 0x01
949 #define _TRISD1 0x02
950 #define _TRISD2 0x04
951 #define _TRISD3 0x08
952 #define _TRISD4 0x10
953 #define _TRISD5 0x20
954 #define _TRISD6 0x40
955 #define _TRISD7 0x80
957 //==============================================================================
960 //==============================================================================
961 // TRISE Bits
963 extern __at(0x0089) __sfr TRISE;
965 typedef union
967 struct
969 unsigned TRISE0 : 1;
970 unsigned TRISE1 : 1;
971 unsigned TRISE2 : 1;
972 unsigned : 1;
973 unsigned PSPMODE : 1;
974 unsigned IBOV : 1;
975 unsigned OBF : 1;
976 unsigned IBF : 1;
979 struct
981 unsigned TRISE : 3;
982 unsigned : 5;
984 } __TRISEbits_t;
986 extern __at(0x0089) volatile __TRISEbits_t TRISEbits;
988 #define _TRISE0 0x01
989 #define _TRISE1 0x02
990 #define _TRISE2 0x04
991 #define _PSPMODE 0x10
992 #define _IBOV 0x20
993 #define _OBF 0x40
994 #define _IBF 0x80
996 //==============================================================================
999 //==============================================================================
1000 // PIE1 Bits
1002 extern __at(0x008C) __sfr PIE1;
1004 typedef struct
1006 unsigned TMR1IE : 1;
1007 unsigned TMR2IE : 1;
1008 unsigned CCP1IE : 1;
1009 unsigned USBIE : 1;
1010 unsigned TXIE : 1;
1011 unsigned RCIE : 1;
1012 unsigned ADIE : 1;
1013 unsigned PSPIE : 1;
1014 } __PIE1bits_t;
1016 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
1018 #define _TMR1IE 0x01
1019 #define _TMR2IE 0x02
1020 #define _CCP1IE 0x04
1021 #define _USBIE 0x08
1022 #define _TXIE 0x10
1023 #define _RCIE 0x20
1024 #define _ADIE 0x40
1025 #define _PSPIE 0x80
1027 //==============================================================================
1030 //==============================================================================
1031 // PIE2 Bits
1033 extern __at(0x008D) __sfr PIE2;
1035 typedef struct
1037 unsigned CCP2IE : 1;
1038 unsigned : 1;
1039 unsigned : 1;
1040 unsigned : 1;
1041 unsigned : 1;
1042 unsigned : 1;
1043 unsigned : 1;
1044 unsigned : 1;
1045 } __PIE2bits_t;
1047 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
1049 #define _CCP2IE 0x01
1051 //==============================================================================
1054 //==============================================================================
1055 // PCON Bits
1057 extern __at(0x008E) __sfr PCON;
1059 typedef union
1061 struct
1063 unsigned NOT_BOR : 1;
1064 unsigned NOT_POR : 1;
1065 unsigned : 1;
1066 unsigned : 1;
1067 unsigned : 1;
1068 unsigned : 1;
1069 unsigned : 1;
1070 unsigned : 1;
1073 struct
1075 unsigned NOT_BO : 1;
1076 unsigned : 1;
1077 unsigned : 1;
1078 unsigned : 1;
1079 unsigned : 1;
1080 unsigned : 1;
1081 unsigned : 1;
1082 unsigned : 1;
1084 } __PCONbits_t;
1086 extern __at(0x008E) volatile __PCONbits_t PCONbits;
1088 #define _NOT_BOR 0x01
1089 #define _NOT_BO 0x01
1090 #define _NOT_POR 0x02
1092 //==============================================================================
1094 extern __at(0x0092) __sfr PR2;
1096 //==============================================================================
1097 // TXSTA Bits
1099 extern __at(0x0098) __sfr TXSTA;
1101 typedef union
1103 struct
1105 unsigned TX9D : 1;
1106 unsigned TRMT : 1;
1107 unsigned BRGH : 1;
1108 unsigned : 1;
1109 unsigned SYNC : 1;
1110 unsigned TXEN : 1;
1111 unsigned TX9 : 1;
1112 unsigned CSRC : 1;
1115 struct
1117 unsigned TXD8 : 1;
1118 unsigned : 1;
1119 unsigned : 1;
1120 unsigned : 1;
1121 unsigned : 1;
1122 unsigned : 1;
1123 unsigned NOT_TX8 : 1;
1124 unsigned : 1;
1127 struct
1129 unsigned : 1;
1130 unsigned : 1;
1131 unsigned : 1;
1132 unsigned : 1;
1133 unsigned : 1;
1134 unsigned : 1;
1135 unsigned TX8_9 : 1;
1136 unsigned : 1;
1138 } __TXSTAbits_t;
1140 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1142 #define _TX9D 0x01
1143 #define _TXD8 0x01
1144 #define _TRMT 0x02
1145 #define _BRGH 0x04
1146 #define _SYNC 0x10
1147 #define _TXEN 0x20
1148 #define _TX9 0x40
1149 #define _NOT_TX8 0x40
1150 #define _TX8_9 0x40
1151 #define _CSRC 0x80
1153 //==============================================================================
1155 extern __at(0x0099) __sfr SPBRG;
1157 //==============================================================================
1158 // ADCON1 Bits
1160 extern __at(0x009F) __sfr ADCON1;
1162 typedef union
1164 struct
1166 unsigned PCFG0 : 1;
1167 unsigned PCFG1 : 1;
1168 unsigned PCFG2 : 1;
1169 unsigned : 1;
1170 unsigned : 1;
1171 unsigned : 1;
1172 unsigned : 1;
1173 unsigned : 1;
1176 struct
1178 unsigned PCFG : 3;
1179 unsigned : 5;
1181 } __ADCON1bits_t;
1183 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1185 #define _PCFG0 0x01
1186 #define _PCFG1 0x02
1187 #define _PCFG2 0x04
1189 //==============================================================================
1192 //==============================================================================
1193 // UIR Bits
1195 extern __at(0x0190) __sfr UIR;
1197 typedef struct
1199 unsigned USB_RST : 1;
1200 unsigned UERR : 1;
1201 unsigned ACTIVITY : 1;
1202 unsigned TOK_DNE : 1;
1203 unsigned UIDLE : 1;
1204 unsigned STALL : 1;
1205 unsigned : 1;
1206 unsigned : 1;
1207 } __UIRbits_t;
1209 extern __at(0x0190) volatile __UIRbits_t UIRbits;
1211 #define _UIR_USB_RST 0x01
1212 #define _UIR_UERR 0x02
1213 #define _UIR_ACTIVITY 0x04
1214 #define _UIR_TOK_DNE 0x08
1215 #define _UIR_UIDLE 0x10
1216 #define _UIR_STALL 0x20
1218 //==============================================================================
1221 //==============================================================================
1222 // UIE Bits
1224 extern __at(0x0191) __sfr UIE;
1226 typedef struct
1228 unsigned USB_RST : 1;
1229 unsigned UERR : 1;
1230 unsigned ACTIVITY : 1;
1231 unsigned TOK_DNE : 1;
1232 unsigned UIDLE : 1;
1233 unsigned STALL : 1;
1234 unsigned : 1;
1235 unsigned : 1;
1236 } __UIEbits_t;
1238 extern __at(0x0191) volatile __UIEbits_t UIEbits;
1240 #define _USB_RST 0x01
1241 #define _UERR 0x02
1242 #define _ACTIVITY 0x04
1243 #define _TOK_DNE 0x08
1244 #define _UIDLE 0x10
1245 #define _STALL 0x20
1247 //==============================================================================
1250 //==============================================================================
1251 // UEIR Bits
1253 extern __at(0x0192) __sfr UEIR;
1255 typedef struct
1257 unsigned PID_ERR : 1;
1258 unsigned CRC5 : 1;
1259 unsigned CRC16 : 1;
1260 unsigned DFN8 : 1;
1261 unsigned BTO_ERR : 1;
1262 unsigned WRT_ERR : 1;
1263 unsigned OWN_ERR : 1;
1264 unsigned BTS_ERR : 1;
1265 } __UEIRbits_t;
1267 extern __at(0x0192) volatile __UEIRbits_t UEIRbits;
1269 #define _UEIR_PID_ERR 0x01
1270 #define _UEIR_CRC5 0x02
1271 #define _UEIR_CRC16 0x04
1272 #define _UEIR_DFN8 0x08
1273 #define _UEIR_BTO_ERR 0x10
1274 #define _UEIR_WRT_ERR 0x20
1275 #define _UEIR_OWN_ERR 0x40
1276 #define _UEIR_BTS_ERR 0x80
1278 //==============================================================================
1281 //==============================================================================
1282 // UEIE Bits
1284 extern __at(0x0193) __sfr UEIE;
1286 typedef struct
1288 unsigned PID_ERR : 1;
1289 unsigned CRC5 : 1;
1290 unsigned CRC16 : 1;
1291 unsigned DFN8 : 1;
1292 unsigned BTO_ERR : 1;
1293 unsigned WRT_ERR : 1;
1294 unsigned OWN_ERR : 1;
1295 unsigned BTS_ERR : 1;
1296 } __UEIEbits_t;
1298 extern __at(0x0193) volatile __UEIEbits_t UEIEbits;
1300 #define _PID_ERR 0x01
1301 #define _CRC5 0x02
1302 #define _CRC16 0x04
1303 #define _DFN8 0x08
1304 #define _BTO_ERR 0x10
1305 #define _WRT_ERR 0x20
1306 #define _OWN_ERR 0x40
1307 #define _BTS_ERR 0x80
1309 //==============================================================================
1312 //==============================================================================
1313 // USTAT Bits
1315 extern __at(0x0194) __sfr USTAT;
1317 typedef union
1319 struct
1321 unsigned : 1;
1322 unsigned : 1;
1323 unsigned IN : 1;
1324 unsigned ENDP0 : 1;
1325 unsigned ENDP1 : 1;
1326 unsigned : 1;
1327 unsigned : 1;
1328 unsigned : 1;
1331 struct
1333 unsigned : 3;
1334 unsigned ENDP : 2;
1335 unsigned : 3;
1337 } __USTATbits_t;
1339 extern __at(0x0194) volatile __USTATbits_t USTATbits;
1341 #define _IN 0x04
1342 #define _ENDP0 0x08
1343 #define _ENDP1 0x10
1345 //==============================================================================
1348 //==============================================================================
1349 // UCTRL Bits
1351 extern __at(0x0195) __sfr UCTRL;
1353 typedef struct
1355 unsigned : 1;
1356 unsigned SUSPND : 1;
1357 unsigned RESUME : 1;
1358 unsigned DEV_ATT : 1;
1359 unsigned PKT_DIS : 1;
1360 unsigned SE0 : 1;
1361 unsigned : 1;
1362 unsigned : 1;
1363 } __UCTRLbits_t;
1365 extern __at(0x0195) volatile __UCTRLbits_t UCTRLbits;
1367 #define _SUSPND 0x02
1368 #define _RESUME 0x04
1369 #define _DEV_ATT 0x08
1370 #define _PKT_DIS 0x10
1371 #define _SE0 0x20
1373 //==============================================================================
1375 extern __at(0x0196) __sfr UADDR;
1376 extern __at(0x0197) __sfr USWSTAT;
1378 //==============================================================================
1379 // UEP0 Bits
1381 extern __at(0x0198) __sfr UEP0;
1383 typedef struct
1385 unsigned EP_STALL : 1;
1386 unsigned EP_IN_EN : 1;
1387 unsigned EP_OUT_EN : 1;
1388 unsigned EP_CTL_DIS : 1;
1389 unsigned : 1;
1390 unsigned : 1;
1391 unsigned : 1;
1392 unsigned : 1;
1393 } __UEP0bits_t;
1395 extern __at(0x0198) volatile __UEP0bits_t UEP0bits;
1397 #define _EP_STALL 0x01
1398 #define _EP_IN_EN 0x02
1399 #define _EP_OUT_EN 0x04
1400 #define _EP_CTL_DIS 0x08
1402 //==============================================================================
1405 //==============================================================================
1406 // UEP1 Bits
1408 extern __at(0x0199) __sfr UEP1;
1410 typedef struct
1412 unsigned EP_STALL : 1;
1413 unsigned EP_IN_EN : 1;
1414 unsigned EP_OUT_EN : 1;
1415 unsigned EP_CTL_DIS : 1;
1416 unsigned : 1;
1417 unsigned : 1;
1418 unsigned : 1;
1419 unsigned : 1;
1420 } __UEP1bits_t;
1422 extern __at(0x0199) volatile __UEP1bits_t UEP1bits;
1424 #define _UEP1_EP_STALL 0x01
1425 #define _UEP1_EP_IN_EN 0x02
1426 #define _UEP1_EP_OUT_EN 0x04
1427 #define _UEP1_EP_CTL_DIS 0x08
1429 //==============================================================================
1432 //==============================================================================
1433 // UEP2 Bits
1435 extern __at(0x019A) __sfr UEP2;
1437 typedef struct
1439 unsigned EP_STALL : 1;
1440 unsigned EP_IN_EN : 1;
1441 unsigned EP_OUT_EN : 1;
1442 unsigned EP_CTL_DIS : 1;
1443 unsigned : 1;
1444 unsigned : 1;
1445 unsigned : 1;
1446 unsigned : 1;
1447 } __UEP2bits_t;
1449 extern __at(0x019A) volatile __UEP2bits_t UEP2bits;
1451 #define _UEP2_EP_STALL 0x01
1452 #define _UEP2_EP_IN_EN 0x02
1453 #define _UEP2_EP_OUT_EN 0x04
1454 #define _UEP2_EP_CTL_DIS 0x08
1456 //==============================================================================
1459 //==============================================================================
1460 // BD0OST Bits
1462 extern __at(0x01A0) __sfr BD0OST;
1464 typedef union
1466 struct
1468 unsigned : 1;
1469 unsigned : 1;
1470 unsigned PID0_BSTALL : 1;
1471 unsigned PID1_DTS : 1;
1472 unsigned PID2 : 1;
1473 unsigned PID3 : 1;
1474 unsigned DATA0_1 : 1;
1475 unsigned UOWN : 1;
1478 struct
1480 unsigned : 1;
1481 unsigned : 1;
1482 unsigned PID0 : 1;
1483 unsigned PID1 : 1;
1484 unsigned : 1;
1485 unsigned : 1;
1486 unsigned DATA01 : 1;
1487 unsigned OWN : 1;
1490 struct
1492 unsigned : 1;
1493 unsigned : 1;
1494 unsigned BSTALL : 1;
1495 unsigned DTS : 1;
1496 unsigned : 1;
1497 unsigned : 1;
1498 unsigned : 1;
1499 unsigned : 1;
1502 struct
1504 unsigned : 2;
1505 unsigned PID : 4;
1506 unsigned : 2;
1508 } __BD0OSTbits_t;
1510 extern __at(0x01A0) volatile __BD0OSTbits_t BD0OSTbits;
1512 #define _BD0OST_PID0_BSTALL 0x04
1513 #define _BD0OST_PID0 0x04
1514 #define _BD0OST_BSTALL 0x04
1515 #define _BD0OST_PID1_DTS 0x08
1516 #define _BD0OST_PID1 0x08
1517 #define _BD0OST_DTS 0x08
1518 #define _BD0OST_PID2 0x10
1519 #define _BD0OST_PID3 0x20
1520 #define _BD0OST_DATA0_1 0x40
1521 #define _BD0OST_DATA01 0x40
1522 #define _BD0OST_UOWN 0x80
1523 #define _BD0OST_OWN 0x80
1525 //==============================================================================
1528 //==============================================================================
1529 // BD0OBC Bits
1531 extern __at(0x01A1) __sfr BD0OBC;
1533 typedef union
1535 struct
1537 unsigned BC0 : 1;
1538 unsigned BC1 : 1;
1539 unsigned BC2 : 1;
1540 unsigned BC3 : 1;
1541 unsigned : 1;
1542 unsigned : 1;
1543 unsigned : 1;
1544 unsigned : 1;
1547 struct
1549 unsigned BC : 4;
1550 unsigned : 4;
1552 } __BD0OBCbits_t;
1554 extern __at(0x01A1) volatile __BD0OBCbits_t BD0OBCbits;
1556 #define _BD0OBC_BC0 0x01
1557 #define _BD0OBC_BC1 0x02
1558 #define _BD0OBC_BC2 0x04
1559 #define _BD0OBC_BC3 0x08
1561 //==============================================================================
1563 extern __at(0x01A2) __sfr BD0OAL;
1565 //==============================================================================
1566 // BD0IST Bits
1568 extern __at(0x01A4) __sfr BD0IST;
1570 typedef union
1572 struct
1574 unsigned : 1;
1575 unsigned : 1;
1576 unsigned PID0_BSTALL : 1;
1577 unsigned PID1_DTS : 1;
1578 unsigned PID2 : 1;
1579 unsigned PID3 : 1;
1580 unsigned DATA0_1 : 1;
1581 unsigned UOWN : 1;
1584 struct
1586 unsigned : 1;
1587 unsigned : 1;
1588 unsigned PID0 : 1;
1589 unsigned PID1 : 1;
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned DATA01 : 1;
1593 unsigned OWN : 1;
1596 struct
1598 unsigned : 1;
1599 unsigned : 1;
1600 unsigned BSTALL : 1;
1601 unsigned DTS : 1;
1602 unsigned : 1;
1603 unsigned : 1;
1604 unsigned : 1;
1605 unsigned : 1;
1608 struct
1610 unsigned : 2;
1611 unsigned PID : 4;
1612 unsigned : 2;
1614 } __BD0ISTbits_t;
1616 extern __at(0x01A4) volatile __BD0ISTbits_t BD0ISTbits;
1618 #define _PID0_BSTALL 0x04
1619 #define _PID0 0x04
1620 #define _BSTALL 0x04
1621 #define _PID1_DTS 0x08
1622 #define _PID1 0x08
1623 #define _DTS 0x08
1624 #define _PID2 0x10
1625 #define _PID3 0x20
1626 #define _DATA0_1 0x40
1627 #define _DATA01 0x40
1628 #define _UOWN 0x80
1629 #define _OWN 0x80
1631 //==============================================================================
1634 //==============================================================================
1635 // BD0IBC Bits
1637 extern __at(0x01A5) __sfr BD0IBC;
1639 typedef union
1641 struct
1643 unsigned BC0 : 1;
1644 unsigned BC1 : 1;
1645 unsigned BC2 : 1;
1646 unsigned BC3 : 1;
1647 unsigned : 1;
1648 unsigned : 1;
1649 unsigned : 1;
1650 unsigned : 1;
1653 struct
1655 unsigned BC : 4;
1656 unsigned : 4;
1658 } __BD0IBCbits_t;
1660 extern __at(0x01A5) volatile __BD0IBCbits_t BD0IBCbits;
1662 #define _BC0 0x01
1663 #define _BC1 0x02
1664 #define _BC2 0x04
1665 #define _BC3 0x08
1667 //==============================================================================
1669 extern __at(0x01A6) __sfr BD0IAL;
1671 //==============================================================================
1672 // BD1OST Bits
1674 extern __at(0x01A8) __sfr BD1OST;
1676 typedef union
1678 struct
1680 unsigned : 1;
1681 unsigned : 1;
1682 unsigned PID0_BSTALL : 1;
1683 unsigned PID1_DTS : 1;
1684 unsigned PID2 : 1;
1685 unsigned PID3 : 1;
1686 unsigned DATA0_1 : 1;
1687 unsigned UOWN : 1;
1690 struct
1692 unsigned : 1;
1693 unsigned : 1;
1694 unsigned PID0 : 1;
1695 unsigned PID1 : 1;
1696 unsigned : 1;
1697 unsigned : 1;
1698 unsigned DATA01 : 1;
1699 unsigned OWN : 1;
1702 struct
1704 unsigned : 1;
1705 unsigned : 1;
1706 unsigned BSTALL : 1;
1707 unsigned DTS : 1;
1708 unsigned : 1;
1709 unsigned : 1;
1710 unsigned : 1;
1711 unsigned : 1;
1714 struct
1716 unsigned : 2;
1717 unsigned PID : 4;
1718 unsigned : 2;
1720 } __BD1OSTbits_t;
1722 extern __at(0x01A8) volatile __BD1OSTbits_t BD1OSTbits;
1724 #define _BD1OST_PID0_BSTALL 0x04
1725 #define _BD1OST_PID0 0x04
1726 #define _BD1OST_BSTALL 0x04
1727 #define _BD1OST_PID1_DTS 0x08
1728 #define _BD1OST_PID1 0x08
1729 #define _BD1OST_DTS 0x08
1730 #define _BD1OST_PID2 0x10
1731 #define _BD1OST_PID3 0x20
1732 #define _BD1OST_DATA0_1 0x40
1733 #define _BD1OST_DATA01 0x40
1734 #define _BD1OST_UOWN 0x80
1735 #define _BD1OST_OWN 0x80
1737 //==============================================================================
1740 //==============================================================================
1741 // BD1OBC Bits
1743 extern __at(0x01A9) __sfr BD1OBC;
1745 typedef union
1747 struct
1749 unsigned BC0 : 1;
1750 unsigned BC1 : 1;
1751 unsigned BC2 : 1;
1752 unsigned BC3 : 1;
1753 unsigned : 1;
1754 unsigned : 1;
1755 unsigned : 1;
1756 unsigned : 1;
1759 struct
1761 unsigned BC : 4;
1762 unsigned : 4;
1764 } __BD1OBCbits_t;
1766 extern __at(0x01A9) volatile __BD1OBCbits_t BD1OBCbits;
1768 #define _BD1OBC_BC0 0x01
1769 #define _BD1OBC_BC1 0x02
1770 #define _BD1OBC_BC2 0x04
1771 #define _BD1OBC_BC3 0x08
1773 //==============================================================================
1775 extern __at(0x01AA) __sfr BD1OAL;
1777 //==============================================================================
1778 // BD1IST Bits
1780 extern __at(0x01AC) __sfr BD1IST;
1782 typedef union
1784 struct
1786 unsigned : 1;
1787 unsigned : 1;
1788 unsigned PID0_BSTALL : 1;
1789 unsigned PID1_DTS : 1;
1790 unsigned PID2 : 1;
1791 unsigned PID3 : 1;
1792 unsigned DATA0_1 : 1;
1793 unsigned UOWN : 1;
1796 struct
1798 unsigned : 1;
1799 unsigned : 1;
1800 unsigned PID0 : 1;
1801 unsigned PID1 : 1;
1802 unsigned : 1;
1803 unsigned : 1;
1804 unsigned DATA01 : 1;
1805 unsigned OWN : 1;
1808 struct
1810 unsigned : 1;
1811 unsigned : 1;
1812 unsigned BSTALL : 1;
1813 unsigned DTS : 1;
1814 unsigned : 1;
1815 unsigned : 1;
1816 unsigned : 1;
1817 unsigned : 1;
1820 struct
1822 unsigned : 2;
1823 unsigned PID : 4;
1824 unsigned : 2;
1826 } __BD1ISTbits_t;
1828 extern __at(0x01AC) volatile __BD1ISTbits_t BD1ISTbits;
1830 #define _BD1IST_PID0_BSTALL 0x04
1831 #define _BD1IST_PID0 0x04
1832 #define _BD1IST_BSTALL 0x04
1833 #define _BD1IST_PID1_DTS 0x08
1834 #define _BD1IST_PID1 0x08
1835 #define _BD1IST_DTS 0x08
1836 #define _BD1IST_PID2 0x10
1837 #define _BD1IST_PID3 0x20
1838 #define _BD1IST_DATA0_1 0x40
1839 #define _BD1IST_DATA01 0x40
1840 #define _BD1IST_UOWN 0x80
1841 #define _BD1IST_OWN 0x80
1843 //==============================================================================
1846 //==============================================================================
1847 // BD1IBC Bits
1849 extern __at(0x01AD) __sfr BD1IBC;
1851 typedef union
1853 struct
1855 unsigned BC0 : 1;
1856 unsigned BC1 : 1;
1857 unsigned BC2 : 1;
1858 unsigned BC3 : 1;
1859 unsigned : 1;
1860 unsigned : 1;
1861 unsigned : 1;
1862 unsigned : 1;
1865 struct
1867 unsigned BC : 4;
1868 unsigned : 4;
1870 } __BD1IBCbits_t;
1872 extern __at(0x01AD) volatile __BD1IBCbits_t BD1IBCbits;
1874 #define _BD1IBC_BC0 0x01
1875 #define _BD1IBC_BC1 0x02
1876 #define _BD1IBC_BC2 0x04
1877 #define _BD1IBC_BC3 0x08
1879 //==============================================================================
1881 extern __at(0x01AE) __sfr BD1IAL;
1883 //==============================================================================
1884 // BD2OST Bits
1886 extern __at(0x01B0) __sfr BD2OST;
1888 typedef union
1890 struct
1892 unsigned : 1;
1893 unsigned : 1;
1894 unsigned PID0_BSTALL : 1;
1895 unsigned PID1_DTS : 1;
1896 unsigned PID2 : 1;
1897 unsigned PID3 : 1;
1898 unsigned DATA0_1 : 1;
1899 unsigned UOWN : 1;
1902 struct
1904 unsigned : 1;
1905 unsigned : 1;
1906 unsigned PID0 : 1;
1907 unsigned PID1 : 1;
1908 unsigned : 1;
1909 unsigned : 1;
1910 unsigned DATA01 : 1;
1911 unsigned OWN : 1;
1914 struct
1916 unsigned : 1;
1917 unsigned : 1;
1918 unsigned BSTALL : 1;
1919 unsigned DTS : 1;
1920 unsigned : 1;
1921 unsigned : 1;
1922 unsigned : 1;
1923 unsigned : 1;
1926 struct
1928 unsigned : 2;
1929 unsigned PID : 4;
1930 unsigned : 2;
1932 } __BD2OSTbits_t;
1934 extern __at(0x01B0) volatile __BD2OSTbits_t BD2OSTbits;
1936 #define _BD2OST_PID0_BSTALL 0x04
1937 #define _BD2OST_PID0 0x04
1938 #define _BD2OST_BSTALL 0x04
1939 #define _BD2OST_PID1_DTS 0x08
1940 #define _BD2OST_PID1 0x08
1941 #define _BD2OST_DTS 0x08
1942 #define _BD2OST_PID2 0x10
1943 #define _BD2OST_PID3 0x20
1944 #define _BD2OST_DATA0_1 0x40
1945 #define _BD2OST_DATA01 0x40
1946 #define _BD2OST_UOWN 0x80
1947 #define _BD2OST_OWN 0x80
1949 //==============================================================================
1952 //==============================================================================
1953 // BD2OBC Bits
1955 extern __at(0x01B1) __sfr BD2OBC;
1957 typedef union
1959 struct
1961 unsigned BC0 : 1;
1962 unsigned BC1 : 1;
1963 unsigned BC2 : 1;
1964 unsigned BC3 : 1;
1965 unsigned : 1;
1966 unsigned : 1;
1967 unsigned : 1;
1968 unsigned : 1;
1971 struct
1973 unsigned BC : 4;
1974 unsigned : 4;
1976 } __BD2OBCbits_t;
1978 extern __at(0x01B1) volatile __BD2OBCbits_t BD2OBCbits;
1980 #define _BD2OBC_BC0 0x01
1981 #define _BD2OBC_BC1 0x02
1982 #define _BD2OBC_BC2 0x04
1983 #define _BD2OBC_BC3 0x08
1985 //==============================================================================
1987 extern __at(0x01B2) __sfr BD2OAL;
1989 //==============================================================================
1990 // BD2IST Bits
1992 extern __at(0x01B4) __sfr BD2IST;
1994 typedef union
1996 struct
1998 unsigned : 1;
1999 unsigned : 1;
2000 unsigned PID0_BSTALL : 1;
2001 unsigned PID1_DTS : 1;
2002 unsigned PID2 : 1;
2003 unsigned PID3 : 1;
2004 unsigned DATA0_1 : 1;
2005 unsigned UOWN : 1;
2008 struct
2010 unsigned : 1;
2011 unsigned : 1;
2012 unsigned PID0 : 1;
2013 unsigned PID1 : 1;
2014 unsigned : 1;
2015 unsigned : 1;
2016 unsigned DATA01 : 1;
2017 unsigned OWN : 1;
2020 struct
2022 unsigned : 1;
2023 unsigned : 1;
2024 unsigned BSTALL : 1;
2025 unsigned DTS : 1;
2026 unsigned : 1;
2027 unsigned : 1;
2028 unsigned : 1;
2029 unsigned : 1;
2032 struct
2034 unsigned : 2;
2035 unsigned PID : 4;
2036 unsigned : 2;
2038 } __BD2ISTbits_t;
2040 extern __at(0x01B4) volatile __BD2ISTbits_t BD2ISTbits;
2042 #define _BD2IST_PID0_BSTALL 0x04
2043 #define _BD2IST_PID0 0x04
2044 #define _BD2IST_BSTALL 0x04
2045 #define _BD2IST_PID1_DTS 0x08
2046 #define _BD2IST_PID1 0x08
2047 #define _BD2IST_DTS 0x08
2048 #define _BD2IST_PID2 0x10
2049 #define _BD2IST_PID3 0x20
2050 #define _BD2IST_DATA0_1 0x40
2051 #define _BD2IST_DATA01 0x40
2052 #define _BD2IST_UOWN 0x80
2053 #define _BD2IST_OWN 0x80
2055 //==============================================================================
2058 //==============================================================================
2059 // BD2IBC Bits
2061 extern __at(0x01B5) __sfr BD2IBC;
2063 typedef union
2065 struct
2067 unsigned BC0 : 1;
2068 unsigned BC1 : 1;
2069 unsigned BC2 : 1;
2070 unsigned BC3 : 1;
2071 unsigned : 1;
2072 unsigned : 1;
2073 unsigned : 1;
2074 unsigned : 1;
2077 struct
2079 unsigned BC : 4;
2080 unsigned : 4;
2082 } __BD2IBCbits_t;
2084 extern __at(0x01B5) volatile __BD2IBCbits_t BD2IBCbits;
2086 #define _BD2IBC_BC0 0x01
2087 #define _BD2IBC_BC1 0x02
2088 #define _BD2IBC_BC2 0x04
2089 #define _BD2IBC_BC3 0x08
2091 //==============================================================================
2093 extern __at(0x01B6) __sfr BD2IAL;
2095 //==============================================================================
2097 // Configuration Bits
2099 //==============================================================================
2101 #define _CONFIG1 0x2007
2103 //----------------------------- CONFIG1 Options -------------------------------
2105 #define _FOSC_HS 0x3FFC // HS oscillator.
2106 #define _HS_OSC 0x3FFC // HS oscillator.
2107 #define _FOSC_EC 0x3FFD // External clock. CLKOUT on OSC2 pin.
2108 #define _EC_OSC 0x3FFD // External clock. CLKOUT on OSC2 pin.
2109 #define _FOSC_H4 0x3FFE // HS osc with 4x PLL enabled.
2110 #define _H4_OSC 0x3FFE // HS osc with 4x PLL enabled.
2111 #define _FOSC_E4 0x3FFF // External clock with 4x PLL enabled. CLKOUT on OSC2 pin.
2112 #define _E4_OSC 0x3FFF // External clock with 4x PLL enabled. CLKOUT on OSC2 pin.
2113 #define _WDTE_OFF 0x3FFB // WDT disabled.
2114 #define _WDT_OFF 0x3FFB // WDT disabled.
2115 #define _WDTE_ON 0x3FFF // WDT enabled.
2116 #define _WDT_ON 0x3FFF // WDT enabled.
2117 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
2118 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
2119 #define _CP_ALL 0x00CF // All memory is code protected.
2120 #define _CP_75 0x15DF // 0800h-1FFFh code protected.
2121 #define _CP_50 0x2AEF // 1000h-1FFFh code protected.
2122 #define _CP_OFF 0x3FFF // Code protection off.
2124 //==============================================================================
2126 #define _DEVID1 0x2006
2128 #define _IDLOC0 0x2000
2129 #define _IDLOC1 0x2001
2130 #define _IDLOC2 0x2002
2131 #define _IDLOC3 0x2003
2133 //==============================================================================
2135 #ifndef NO_BIT_DEFINES
2137 #define ADON ADCON0bits.ADON // bit 0
2138 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
2139 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
2140 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
2141 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
2142 #define CHS0 ADCON0bits.CHS0 // bit 3
2143 #define CHS1 ADCON0bits.CHS1 // bit 4
2144 #define CHS2 ADCON0bits.CHS2 // bit 5
2145 #define ADCS0 ADCON0bits.ADCS0 // bit 6
2146 #define ADCS1 ADCON0bits.ADCS1 // bit 7
2148 #define PCFG0 ADCON1bits.PCFG0 // bit 0
2149 #define PCFG1 ADCON1bits.PCFG1 // bit 1
2150 #define PCFG2 ADCON1bits.PCFG2 // bit 2
2152 #define BC0 BD0IBCbits.BC0 // bit 0
2153 #define BC1 BD0IBCbits.BC1 // bit 1
2154 #define BC2 BD0IBCbits.BC2 // bit 2
2155 #define BC3 BD0IBCbits.BC3 // bit 3
2157 #define PID0_BSTALL BD0ISTbits.PID0_BSTALL // bit 2, shadows bit in BD0ISTbits
2158 #define PID0 BD0ISTbits.PID0 // bit 2, shadows bit in BD0ISTbits
2159 #define BSTALL BD0ISTbits.BSTALL // bit 2, shadows bit in BD0ISTbits
2160 #define PID1_DTS BD0ISTbits.PID1_DTS // bit 3, shadows bit in BD0ISTbits
2161 #define PID1 BD0ISTbits.PID1 // bit 3, shadows bit in BD0ISTbits
2162 #define DTS BD0ISTbits.DTS // bit 3, shadows bit in BD0ISTbits
2163 #define PID2 BD0ISTbits.PID2 // bit 4
2164 #define PID3 BD0ISTbits.PID3 // bit 5
2165 #define DATA0_1 BD0ISTbits.DATA0_1 // bit 6, shadows bit in BD0ISTbits
2166 #define DATA01 BD0ISTbits.DATA01 // bit 6, shadows bit in BD0ISTbits
2167 #define UOWN BD0ISTbits.UOWN // bit 7, shadows bit in BD0ISTbits
2168 #define OWN BD0ISTbits.OWN // bit 7, shadows bit in BD0ISTbits
2170 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
2171 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
2172 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
2173 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
2174 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
2175 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
2177 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
2178 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
2179 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
2180 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
2181 #define DC2B0 CCP2CONbits.DC2B0 // bit 4
2182 #define DC2B1 CCP2CONbits.DC2B1 // bit 5
2184 #define RBIF INTCONbits.RBIF // bit 0
2185 #define INTF INTCONbits.INTF // bit 1
2186 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
2187 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
2188 #define RBIE INTCONbits.RBIE // bit 3
2189 #define INTE INTCONbits.INTE // bit 4
2190 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
2191 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
2192 #define PEIE INTCONbits.PEIE // bit 6
2193 #define GIE INTCONbits.GIE // bit 7
2195 #define PS0 OPTION_REGbits.PS0 // bit 0
2196 #define PS1 OPTION_REGbits.PS1 // bit 1
2197 #define PS2 OPTION_REGbits.PS2 // bit 2
2198 #define PSA OPTION_REGbits.PSA // bit 3
2199 #define T0SE OPTION_REGbits.T0SE // bit 4
2200 #define T0CS OPTION_REGbits.T0CS // bit 5
2201 #define INTEDG OPTION_REGbits.INTEDG // bit 6
2202 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
2204 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
2205 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
2206 #define NOT_POR PCONbits.NOT_POR // bit 1
2208 #define TMR1IE PIE1bits.TMR1IE // bit 0
2209 #define TMR2IE PIE1bits.TMR2IE // bit 1
2210 #define CCP1IE PIE1bits.CCP1IE // bit 2
2211 #define USBIE PIE1bits.USBIE // bit 3
2212 #define TXIE PIE1bits.TXIE // bit 4
2213 #define RCIE PIE1bits.RCIE // bit 5
2214 #define ADIE PIE1bits.ADIE // bit 6
2215 #define PSPIE PIE1bits.PSPIE // bit 7
2217 #define CCP2IE PIE2bits.CCP2IE // bit 0
2219 #define TMR1IF PIR1bits.TMR1IF // bit 0
2220 #define TMR2IF PIR1bits.TMR2IF // bit 1
2221 #define CCP1IF PIR1bits.CCP1IF // bit 2
2222 #define USBIF PIR1bits.USBIF // bit 3
2223 #define TXIF PIR1bits.TXIF // bit 4
2224 #define RCIF PIR1bits.RCIF // bit 5
2225 #define ADIF PIR1bits.ADIF // bit 6
2226 #define PSPIF PIR1bits.PSPIF // bit 7
2228 #define CCP2IF PIR2bits.CCP2IF // bit 0
2230 #define RA0 PORTAbits.RA0 // bit 0
2231 #define RA1 PORTAbits.RA1 // bit 1
2232 #define RA2 PORTAbits.RA2 // bit 2
2233 #define RA3 PORTAbits.RA3 // bit 3
2234 #define RA4 PORTAbits.RA4 // bit 4
2235 #define RA5 PORTAbits.RA5 // bit 5
2237 #define RB0 PORTBbits.RB0 // bit 0
2238 #define RB1 PORTBbits.RB1 // bit 1
2239 #define RB2 PORTBbits.RB2 // bit 2
2240 #define RB3 PORTBbits.RB3 // bit 3
2241 #define RB4 PORTBbits.RB4 // bit 4
2242 #define RB5 PORTBbits.RB5 // bit 5
2243 #define RB6 PORTBbits.RB6 // bit 6
2244 #define RB7 PORTBbits.RB7 // bit 7
2246 #define RC0 PORTCbits.RC0 // bit 0
2247 #define RC1 PORTCbits.RC1 // bit 1
2248 #define RC2 PORTCbits.RC2 // bit 2
2249 #define RC6 PORTCbits.RC6 // bit 6
2250 #define RC7 PORTCbits.RC7 // bit 7
2252 #define RD0 PORTDbits.RD0 // bit 0
2253 #define RD1 PORTDbits.RD1 // bit 1
2254 #define RD2 PORTDbits.RD2 // bit 2
2255 #define RD3 PORTDbits.RD3 // bit 3
2256 #define RD4 PORTDbits.RD4 // bit 4
2257 #define RD5 PORTDbits.RD5 // bit 5
2258 #define RD6 PORTDbits.RD6 // bit 6
2259 #define RD7 PORTDbits.RD7 // bit 7
2261 #define RE0 PORTEbits.RE0 // bit 0
2262 #define RE1 PORTEbits.RE1 // bit 1
2263 #define RE2 PORTEbits.RE2 // bit 2
2265 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
2266 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
2267 #define OERR RCSTAbits.OERR // bit 1
2268 #define FERR RCSTAbits.FERR // bit 2
2269 #define CREN RCSTAbits.CREN // bit 4
2270 #define SREN RCSTAbits.SREN // bit 5
2271 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
2272 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
2273 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
2274 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
2275 #define SPEN RCSTAbits.SPEN // bit 7
2277 #define C STATUSbits.C // bit 0
2278 #define DC STATUSbits.DC // bit 1
2279 #define Z STATUSbits.Z // bit 2
2280 #define NOT_PD STATUSbits.NOT_PD // bit 3
2281 #define NOT_TO STATUSbits.NOT_TO // bit 4
2282 #define RP0 STATUSbits.RP0 // bit 5
2283 #define RP1 STATUSbits.RP1 // bit 6
2284 #define IRP STATUSbits.IRP // bit 7
2286 #define TMR1ON T1CONbits.TMR1ON // bit 0
2287 #define TMR1CS T1CONbits.TMR1CS // bit 1
2288 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
2289 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
2290 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
2291 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
2292 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
2294 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
2295 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
2296 #define TMR2ON T2CONbits.TMR2ON // bit 2
2297 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
2298 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
2299 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
2300 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
2302 #define TRISA0 TRISAbits.TRISA0 // bit 0
2303 #define TRISA1 TRISAbits.TRISA1 // bit 1
2304 #define TRISA2 TRISAbits.TRISA2 // bit 2
2305 #define TRISA3 TRISAbits.TRISA3 // bit 3
2306 #define TRISA4 TRISAbits.TRISA4 // bit 4
2307 #define TRISA5 TRISAbits.TRISA5 // bit 5
2309 #define TRISB0 TRISBbits.TRISB0 // bit 0
2310 #define TRISB1 TRISBbits.TRISB1 // bit 1
2311 #define TRISB2 TRISBbits.TRISB2 // bit 2
2312 #define TRISB3 TRISBbits.TRISB3 // bit 3
2313 #define TRISB4 TRISBbits.TRISB4 // bit 4
2314 #define TRISB5 TRISBbits.TRISB5 // bit 5
2315 #define TRISB6 TRISBbits.TRISB6 // bit 6
2316 #define TRISB7 TRISBbits.TRISB7 // bit 7
2318 #define TRISC0 TRISCbits.TRISC0 // bit 0
2319 #define TRISC1 TRISCbits.TRISC1 // bit 1
2320 #define TRISC2 TRISCbits.TRISC2 // bit 2
2321 #define TRISC6 TRISCbits.TRISC6 // bit 6
2322 #define TRISC7 TRISCbits.TRISC7 // bit 7
2324 #define TRISD0 TRISDbits.TRISD0 // bit 0
2325 #define TRISD1 TRISDbits.TRISD1 // bit 1
2326 #define TRISD2 TRISDbits.TRISD2 // bit 2
2327 #define TRISD3 TRISDbits.TRISD3 // bit 3
2328 #define TRISD4 TRISDbits.TRISD4 // bit 4
2329 #define TRISD5 TRISDbits.TRISD5 // bit 5
2330 #define TRISD6 TRISDbits.TRISD6 // bit 6
2331 #define TRISD7 TRISDbits.TRISD7 // bit 7
2333 #define TRISE0 TRISEbits.TRISE0 // bit 0
2334 #define TRISE1 TRISEbits.TRISE1 // bit 1
2335 #define TRISE2 TRISEbits.TRISE2 // bit 2
2336 #define PSPMODE TRISEbits.PSPMODE // bit 4
2337 #define IBOV TRISEbits.IBOV // bit 5
2338 #define OBF TRISEbits.OBF // bit 6
2339 #define IBF TRISEbits.IBF // bit 7
2341 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
2342 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
2343 #define TRMT TXSTAbits.TRMT // bit 1
2344 #define BRGH TXSTAbits.BRGH // bit 2
2345 #define SYNC TXSTAbits.SYNC // bit 4
2346 #define TXEN TXSTAbits.TXEN // bit 5
2347 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
2348 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
2349 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
2350 #define CSRC TXSTAbits.CSRC // bit 7
2352 #define SUSPND UCTRLbits.SUSPND // bit 1
2353 #define RESUME UCTRLbits.RESUME // bit 2
2354 #define DEV_ATT UCTRLbits.DEV_ATT // bit 3
2355 #define PKT_DIS UCTRLbits.PKT_DIS // bit 4
2356 #define SE0 UCTRLbits.SE0 // bit 5
2358 #define PID_ERR UEIEbits.PID_ERR // bit 0
2359 #define CRC5 UEIEbits.CRC5 // bit 1
2360 #define CRC16 UEIEbits.CRC16 // bit 2
2361 #define DFN8 UEIEbits.DFN8 // bit 3
2362 #define BTO_ERR UEIEbits.BTO_ERR // bit 4
2363 #define WRT_ERR UEIEbits.WRT_ERR // bit 5
2364 #define OWN_ERR UEIEbits.OWN_ERR // bit 6
2365 #define BTS_ERR UEIEbits.BTS_ERR // bit 7
2367 #define EP_STALL UEP0bits.EP_STALL // bit 0
2368 #define EP_IN_EN UEP0bits.EP_IN_EN // bit 1
2369 #define EP_OUT_EN UEP0bits.EP_OUT_EN // bit 2
2370 #define EP_CTL_DIS UEP0bits.EP_CTL_DIS // bit 3
2372 #define USB_RST UIEbits.USB_RST // bit 0
2373 #define UERR UIEbits.UERR // bit 1
2374 #define ACTIVITY UIEbits.ACTIVITY // bit 2
2375 #define TOK_DNE UIEbits.TOK_DNE // bit 3
2376 #define UIDLE UIEbits.UIDLE // bit 4
2377 #define STALL UIEbits.STALL // bit 5
2379 #define IN USTATbits.IN // bit 2
2380 #define ENDP0 USTATbits.ENDP0 // bit 3
2381 #define ENDP1 USTATbits.ENDP1 // bit 4
2383 #endif // #ifndef NO_BIT_DEFINES
2385 #endif // #ifndef __PIC16C765_H__