Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c65b.h
blob1f42cd3807daa28f4357e45ebb5a752243aa0795
1 /*
2 * This declarations of the PIC16C65B 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 __PIC16C65B_H__
26 #define __PIC16C65B_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 SSPBUF_ADDR 0x0013
57 #define SSPCON_ADDR 0x0014
58 #define CCPR1_ADDR 0x0015
59 #define CCPR1L_ADDR 0x0015
60 #define CCPR1H_ADDR 0x0016
61 #define CCP1CON_ADDR 0x0017
62 #define RCSTA_ADDR 0x0018
63 #define TXREG_ADDR 0x0019
64 #define RCREG_ADDR 0x001A
65 #define CCPR2_ADDR 0x001B
66 #define CCPR2L_ADDR 0x001B
67 #define CCPR2H_ADDR 0x001C
68 #define CCP2CON_ADDR 0x001D
69 #define 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 SSPADD_ADDR 0x0093
80 #define SSPSTAT_ADDR 0x0094
81 #define TXSTA_ADDR 0x0098
82 #define SPBRG_ADDR 0x0099
84 #endif // #ifndef NO_ADDR_DEFINES
86 //==============================================================================
88 // Register Definitions
90 //==============================================================================
92 extern __at(0x0000) __sfr INDF;
93 extern __at(0x0001) __sfr TMR0;
94 extern __at(0x0002) __sfr PCL;
96 //==============================================================================
97 // STATUS Bits
99 extern __at(0x0003) __sfr STATUS;
101 typedef union
103 struct
105 unsigned C : 1;
106 unsigned DC : 1;
107 unsigned Z : 1;
108 unsigned NOT_PD : 1;
109 unsigned NOT_TO : 1;
110 unsigned RP0 : 1;
111 unsigned RP1 : 1;
112 unsigned IRP : 1;
115 struct
117 unsigned : 5;
118 unsigned RP : 2;
119 unsigned : 1;
121 } __STATUSbits_t;
123 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
125 #define _C 0x01
126 #define _DC 0x02
127 #define _Z 0x04
128 #define _NOT_PD 0x08
129 #define _NOT_TO 0x10
130 #define _RP0 0x20
131 #define _RP1 0x40
132 #define _IRP 0x80
134 //==============================================================================
136 extern __at(0x0004) __sfr FSR;
138 //==============================================================================
139 // PORTA Bits
141 extern __at(0x0005) __sfr PORTA;
143 typedef union
145 struct
147 unsigned RA0 : 1;
148 unsigned RA1 : 1;
149 unsigned RA2 : 1;
150 unsigned RA3 : 1;
151 unsigned RA4 : 1;
152 unsigned RA5 : 1;
153 unsigned : 1;
154 unsigned : 1;
157 struct
159 unsigned RA : 6;
160 unsigned : 2;
162 } __PORTAbits_t;
164 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
166 #define _RA0 0x01
167 #define _RA1 0x02
168 #define _RA2 0x04
169 #define _RA3 0x08
170 #define _RA4 0x10
171 #define _RA5 0x20
173 //==============================================================================
176 //==============================================================================
177 // PORTB Bits
179 extern __at(0x0006) __sfr PORTB;
181 typedef struct
183 unsigned RB0 : 1;
184 unsigned RB1 : 1;
185 unsigned RB2 : 1;
186 unsigned RB3 : 1;
187 unsigned RB4 : 1;
188 unsigned RB5 : 1;
189 unsigned RB6 : 1;
190 unsigned RB7 : 1;
191 } __PORTBbits_t;
193 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
195 #define _RB0 0x01
196 #define _RB1 0x02
197 #define _RB2 0x04
198 #define _RB3 0x08
199 #define _RB4 0x10
200 #define _RB5 0x20
201 #define _RB6 0x40
202 #define _RB7 0x80
204 //==============================================================================
207 //==============================================================================
208 // PORTC Bits
210 extern __at(0x0007) __sfr PORTC;
212 typedef struct
214 unsigned RC0 : 1;
215 unsigned RC1 : 1;
216 unsigned RC2 : 1;
217 unsigned RC3 : 1;
218 unsigned RC4 : 1;
219 unsigned RC5 : 1;
220 unsigned RC6 : 1;
221 unsigned RC7 : 1;
222 } __PORTCbits_t;
224 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
226 #define _RC0 0x01
227 #define _RC1 0x02
228 #define _RC2 0x04
229 #define _RC3 0x08
230 #define _RC4 0x10
231 #define _RC5 0x20
232 #define _RC6 0x40
233 #define _RC7 0x80
235 //==============================================================================
238 //==============================================================================
239 // PORTD Bits
241 extern __at(0x0008) __sfr PORTD;
243 typedef struct
245 unsigned RD0 : 1;
246 unsigned RD1 : 1;
247 unsigned RD2 : 1;
248 unsigned RD3 : 1;
249 unsigned RD4 : 1;
250 unsigned RD5 : 1;
251 unsigned RD6 : 1;
252 unsigned RD7 : 1;
253 } __PORTDbits_t;
255 extern __at(0x0008) volatile __PORTDbits_t PORTDbits;
257 #define _RD0 0x01
258 #define _RD1 0x02
259 #define _RD2 0x04
260 #define _RD3 0x08
261 #define _RD4 0x10
262 #define _RD5 0x20
263 #define _RD6 0x40
264 #define _RD7 0x80
266 //==============================================================================
269 //==============================================================================
270 // PORTE Bits
272 extern __at(0x0009) __sfr PORTE;
274 typedef union
276 struct
278 unsigned RE0 : 1;
279 unsigned RE1 : 1;
280 unsigned RE2 : 1;
281 unsigned : 1;
282 unsigned : 1;
283 unsigned : 1;
284 unsigned : 1;
285 unsigned : 1;
288 struct
290 unsigned RE : 3;
291 unsigned : 5;
293 } __PORTEbits_t;
295 extern __at(0x0009) volatile __PORTEbits_t PORTEbits;
297 #define _RE0 0x01
298 #define _RE1 0x02
299 #define _RE2 0x04
301 //==============================================================================
303 extern __at(0x000A) __sfr PCLATH;
305 //==============================================================================
306 // INTCON Bits
308 extern __at(0x000B) __sfr INTCON;
310 typedef union
312 struct
314 unsigned RBIF : 1;
315 unsigned INTF : 1;
316 unsigned T0IF : 1;
317 unsigned RBIE : 1;
318 unsigned INTE : 1;
319 unsigned T0IE : 1;
320 unsigned PEIE : 1;
321 unsigned GIE : 1;
324 struct
326 unsigned : 1;
327 unsigned : 1;
328 unsigned TMR0IF : 1;
329 unsigned : 1;
330 unsigned : 1;
331 unsigned TMR0IE : 1;
332 unsigned : 1;
333 unsigned : 1;
335 } __INTCONbits_t;
337 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
339 #define _RBIF 0x01
340 #define _INTF 0x02
341 #define _T0IF 0x04
342 #define _TMR0IF 0x04
343 #define _RBIE 0x08
344 #define _INTE 0x10
345 #define _T0IE 0x20
346 #define _TMR0IE 0x20
347 #define _PEIE 0x40
348 #define _GIE 0x80
350 //==============================================================================
353 //==============================================================================
354 // PIR1 Bits
356 extern __at(0x000C) __sfr PIR1;
358 typedef struct
360 unsigned TMR1IF : 1;
361 unsigned TMR2IF : 1;
362 unsigned CCP1IF : 1;
363 unsigned SSPIF : 1;
364 unsigned TXIF : 1;
365 unsigned RCIF : 1;
366 unsigned : 1;
367 unsigned PSPIF : 1;
368 } __PIR1bits_t;
370 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
372 #define _TMR1IF 0x01
373 #define _TMR2IF 0x02
374 #define _CCP1IF 0x04
375 #define _SSPIF 0x08
376 #define _TXIF 0x10
377 #define _RCIF 0x20
378 #define _PSPIF 0x80
380 //==============================================================================
383 //==============================================================================
384 // PIR2 Bits
386 extern __at(0x000D) __sfr PIR2;
388 typedef struct
390 unsigned CCP2IF : 1;
391 unsigned : 1;
392 unsigned : 1;
393 unsigned : 1;
394 unsigned : 1;
395 unsigned : 1;
396 unsigned : 1;
397 unsigned : 1;
398 } __PIR2bits_t;
400 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
402 #define _CCP2IF 0x01
404 //==============================================================================
406 extern __at(0x000E) __sfr TMR1;
407 extern __at(0x000E) __sfr TMR1L;
408 extern __at(0x000F) __sfr TMR1H;
410 //==============================================================================
411 // T1CON Bits
413 extern __at(0x0010) __sfr T1CON;
415 typedef union
417 struct
419 unsigned TMR1ON : 1;
420 unsigned TMR1CS : 1;
421 unsigned NOT_T1SYNC : 1;
422 unsigned T1OSCEN : 1;
423 unsigned T1CKPS0 : 1;
424 unsigned T1CKPS1 : 1;
425 unsigned : 1;
426 unsigned : 1;
429 struct
431 unsigned : 1;
432 unsigned : 1;
433 unsigned T1INSYNC : 1;
434 unsigned : 1;
435 unsigned : 1;
436 unsigned : 1;
437 unsigned : 1;
438 unsigned : 1;
441 struct
443 unsigned : 4;
444 unsigned T1CKPS : 2;
445 unsigned : 2;
447 } __T1CONbits_t;
449 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
451 #define _TMR1ON 0x01
452 #define _TMR1CS 0x02
453 #define _NOT_T1SYNC 0x04
454 #define _T1INSYNC 0x04
455 #define _T1OSCEN 0x08
456 #define _T1CKPS0 0x10
457 #define _T1CKPS1 0x20
459 //==============================================================================
461 extern __at(0x0011) __sfr TMR2;
463 //==============================================================================
464 // T2CON Bits
466 extern __at(0x0012) __sfr T2CON;
468 typedef union
470 struct
472 unsigned T2CKPS0 : 1;
473 unsigned T2CKPS1 : 1;
474 unsigned TMR2ON : 1;
475 unsigned TOUTPS0 : 1;
476 unsigned TOUTPS1 : 1;
477 unsigned TOUTPS2 : 1;
478 unsigned TOUTPS3 : 1;
479 unsigned : 1;
482 struct
484 unsigned T2CKPS : 2;
485 unsigned : 6;
488 struct
490 unsigned : 3;
491 unsigned TOUTPS : 4;
492 unsigned : 1;
494 } __T2CONbits_t;
496 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
498 #define _T2CKPS0 0x01
499 #define _T2CKPS1 0x02
500 #define _TMR2ON 0x04
501 #define _TOUTPS0 0x08
502 #define _TOUTPS1 0x10
503 #define _TOUTPS2 0x20
504 #define _TOUTPS3 0x40
506 //==============================================================================
508 extern __at(0x0013) __sfr SSPBUF;
510 //==============================================================================
511 // SSPCON Bits
513 extern __at(0x0014) __sfr SSPCON;
515 typedef union
517 struct
519 unsigned SSPM0 : 1;
520 unsigned SSPM1 : 1;
521 unsigned SSPM2 : 1;
522 unsigned SSPM3 : 1;
523 unsigned CKP : 1;
524 unsigned SSPEN : 1;
525 unsigned SSPOV : 1;
526 unsigned WCOL : 1;
529 struct
531 unsigned SSPM : 4;
532 unsigned : 4;
534 } __SSPCONbits_t;
536 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
538 #define _SSPM0 0x01
539 #define _SSPM1 0x02
540 #define _SSPM2 0x04
541 #define _SSPM3 0x08
542 #define _CKP 0x10
543 #define _SSPEN 0x20
544 #define _SSPOV 0x40
545 #define _WCOL 0x80
547 //==============================================================================
549 extern __at(0x0015) __sfr CCPR1;
550 extern __at(0x0015) __sfr CCPR1L;
551 extern __at(0x0016) __sfr CCPR1H;
553 //==============================================================================
554 // CCP1CON Bits
556 extern __at(0x0017) __sfr CCP1CON;
558 typedef union
560 struct
562 unsigned CCP1M0 : 1;
563 unsigned CCP1M1 : 1;
564 unsigned CCP1M2 : 1;
565 unsigned CCP1M3 : 1;
566 unsigned CCP1Y : 1;
567 unsigned CCP1X : 1;
568 unsigned : 1;
569 unsigned : 1;
572 struct
574 unsigned CCP1M : 4;
575 unsigned : 4;
577 } __CCP1CONbits_t;
579 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
581 #define _CCP1M0 0x01
582 #define _CCP1M1 0x02
583 #define _CCP1M2 0x04
584 #define _CCP1M3 0x08
585 #define _CCP1Y 0x10
586 #define _CCP1X 0x20
588 //==============================================================================
591 //==============================================================================
592 // RCSTA Bits
594 extern __at(0x0018) __sfr RCSTA;
596 typedef union
598 struct
600 unsigned RX9D : 1;
601 unsigned OERR : 1;
602 unsigned FERR : 1;
603 unsigned : 1;
604 unsigned CREN : 1;
605 unsigned SREN : 1;
606 unsigned RX9 : 1;
607 unsigned SPEN : 1;
610 struct
612 unsigned RCD8 : 1;
613 unsigned : 1;
614 unsigned : 1;
615 unsigned : 1;
616 unsigned : 1;
617 unsigned : 1;
618 unsigned RC9 : 1;
619 unsigned : 1;
622 struct
624 unsigned : 1;
625 unsigned : 1;
626 unsigned : 1;
627 unsigned : 1;
628 unsigned : 1;
629 unsigned : 1;
630 unsigned NOT_RC8 : 1;
631 unsigned : 1;
634 struct
636 unsigned : 1;
637 unsigned : 1;
638 unsigned : 1;
639 unsigned : 1;
640 unsigned : 1;
641 unsigned : 1;
642 unsigned RC8_9 : 1;
643 unsigned : 1;
645 } __RCSTAbits_t;
647 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits;
649 #define _RX9D 0x01
650 #define _RCD8 0x01
651 #define _OERR 0x02
652 #define _FERR 0x04
653 #define _CREN 0x10
654 #define _SREN 0x20
655 #define _RX9 0x40
656 #define _RC9 0x40
657 #define _NOT_RC8 0x40
658 #define _RC8_9 0x40
659 #define _SPEN 0x80
661 //==============================================================================
663 extern __at(0x0019) __sfr TXREG;
664 extern __at(0x001A) __sfr RCREG;
665 extern __at(0x001B) __sfr CCPR2;
666 extern __at(0x001B) __sfr CCPR2L;
667 extern __at(0x001C) __sfr CCPR2H;
669 //==============================================================================
670 // CCP2CON Bits
672 extern __at(0x001D) __sfr CCP2CON;
674 typedef union
676 struct
678 unsigned CCP2M0 : 1;
679 unsigned CCP2M1 : 1;
680 unsigned CCP2M2 : 1;
681 unsigned CCP2M3 : 1;
682 unsigned CCP2Y : 1;
683 unsigned CCP2X : 1;
684 unsigned : 1;
685 unsigned : 1;
688 struct
690 unsigned CCP2M : 4;
691 unsigned : 4;
693 } __CCP2CONbits_t;
695 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
697 #define _CCP2M0 0x01
698 #define _CCP2M1 0x02
699 #define _CCP2M2 0x04
700 #define _CCP2M3 0x08
701 #define _CCP2Y 0x10
702 #define _CCP2X 0x20
704 //==============================================================================
707 //==============================================================================
708 // OPTION_REG Bits
710 extern __at(0x0081) __sfr OPTION_REG;
712 typedef union
714 struct
716 unsigned PS0 : 1;
717 unsigned PS1 : 1;
718 unsigned PS2 : 1;
719 unsigned PSA : 1;
720 unsigned T0SE : 1;
721 unsigned T0CS : 1;
722 unsigned INTEDG : 1;
723 unsigned NOT_RBPU : 1;
726 struct
728 unsigned PS : 3;
729 unsigned : 5;
731 } __OPTION_REGbits_t;
733 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
735 #define _PS0 0x01
736 #define _PS1 0x02
737 #define _PS2 0x04
738 #define _PSA 0x08
739 #define _T0SE 0x10
740 #define _T0CS 0x20
741 #define _INTEDG 0x40
742 #define _NOT_RBPU 0x80
744 //==============================================================================
747 //==============================================================================
748 // TRISA Bits
750 extern __at(0x0085) __sfr TRISA;
752 typedef union
754 struct
756 unsigned TRISA0 : 1;
757 unsigned TRISA1 : 1;
758 unsigned TRISA2 : 1;
759 unsigned TRISA3 : 1;
760 unsigned TRISA4 : 1;
761 unsigned TRISA5 : 1;
762 unsigned : 1;
763 unsigned : 1;
766 struct
768 unsigned TRISA : 6;
769 unsigned : 2;
771 } __TRISAbits_t;
773 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
775 #define _TRISA0 0x01
776 #define _TRISA1 0x02
777 #define _TRISA2 0x04
778 #define _TRISA3 0x08
779 #define _TRISA4 0x10
780 #define _TRISA5 0x20
782 //==============================================================================
785 //==============================================================================
786 // TRISB Bits
788 extern __at(0x0086) __sfr TRISB;
790 typedef struct
792 unsigned TRISB0 : 1;
793 unsigned TRISB1 : 1;
794 unsigned TRISB2 : 1;
795 unsigned TRISB3 : 1;
796 unsigned TRISB4 : 1;
797 unsigned TRISB5 : 1;
798 unsigned TRISB6 : 1;
799 unsigned TRISB7 : 1;
800 } __TRISBbits_t;
802 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
804 #define _TRISB0 0x01
805 #define _TRISB1 0x02
806 #define _TRISB2 0x04
807 #define _TRISB3 0x08
808 #define _TRISB4 0x10
809 #define _TRISB5 0x20
810 #define _TRISB6 0x40
811 #define _TRISB7 0x80
813 //==============================================================================
816 //==============================================================================
817 // TRISC Bits
819 extern __at(0x0087) __sfr TRISC;
821 typedef struct
823 unsigned TRISC0 : 1;
824 unsigned TRISC1 : 1;
825 unsigned TRISC2 : 1;
826 unsigned TRISC3 : 1;
827 unsigned TRISC4 : 1;
828 unsigned TRISC5 : 1;
829 unsigned TRISC6 : 1;
830 unsigned TRISC7 : 1;
831 } __TRISCbits_t;
833 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
835 #define _TRISC0 0x01
836 #define _TRISC1 0x02
837 #define _TRISC2 0x04
838 #define _TRISC3 0x08
839 #define _TRISC4 0x10
840 #define _TRISC5 0x20
841 #define _TRISC6 0x40
842 #define _TRISC7 0x80
844 //==============================================================================
847 //==============================================================================
848 // TRISD Bits
850 extern __at(0x0088) __sfr TRISD;
852 typedef struct
854 unsigned TRISD0 : 1;
855 unsigned TRISD1 : 1;
856 unsigned TRISD2 : 1;
857 unsigned TRISD3 : 1;
858 unsigned TRISD4 : 1;
859 unsigned TRISD5 : 1;
860 unsigned TRISD6 : 1;
861 unsigned TRISD7 : 1;
862 } __TRISDbits_t;
864 extern __at(0x0088) volatile __TRISDbits_t TRISDbits;
866 #define _TRISD0 0x01
867 #define _TRISD1 0x02
868 #define _TRISD2 0x04
869 #define _TRISD3 0x08
870 #define _TRISD4 0x10
871 #define _TRISD5 0x20
872 #define _TRISD6 0x40
873 #define _TRISD7 0x80
875 //==============================================================================
878 //==============================================================================
879 // TRISE Bits
881 extern __at(0x0089) __sfr TRISE;
883 typedef union
885 struct
887 unsigned TRISE0 : 1;
888 unsigned TRISE1 : 1;
889 unsigned TRISE2 : 1;
890 unsigned : 1;
891 unsigned PSPMODE : 1;
892 unsigned IBOV : 1;
893 unsigned OBF : 1;
894 unsigned IBF : 1;
897 struct
899 unsigned TRISE : 3;
900 unsigned : 5;
902 } __TRISEbits_t;
904 extern __at(0x0089) volatile __TRISEbits_t TRISEbits;
906 #define _TRISE0 0x01
907 #define _TRISE1 0x02
908 #define _TRISE2 0x04
909 #define _PSPMODE 0x10
910 #define _IBOV 0x20
911 #define _OBF 0x40
912 #define _IBF 0x80
914 //==============================================================================
917 //==============================================================================
918 // PIE1 Bits
920 extern __at(0x008C) __sfr PIE1;
922 typedef struct
924 unsigned TMR1IE : 1;
925 unsigned TMR2IE : 1;
926 unsigned CCP1IE : 1;
927 unsigned SSPIE : 1;
928 unsigned TXIE : 1;
929 unsigned RCIE : 1;
930 unsigned : 1;
931 unsigned PSPIE : 1;
932 } __PIE1bits_t;
934 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
936 #define _TMR1IE 0x01
937 #define _TMR2IE 0x02
938 #define _CCP1IE 0x04
939 #define _SSPIE 0x08
940 #define _TXIE 0x10
941 #define _RCIE 0x20
942 #define _PSPIE 0x80
944 //==============================================================================
947 //==============================================================================
948 // PIE2 Bits
950 extern __at(0x008D) __sfr PIE2;
952 typedef struct
954 unsigned CCP2IE : 1;
955 unsigned : 1;
956 unsigned : 1;
957 unsigned : 1;
958 unsigned : 1;
959 unsigned : 1;
960 unsigned : 1;
961 unsigned : 1;
962 } __PIE2bits_t;
964 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
966 #define _CCP2IE 0x01
968 //==============================================================================
971 //==============================================================================
972 // PCON Bits
974 extern __at(0x008E) __sfr PCON;
976 typedef union
978 struct
980 unsigned NOT_BOR : 1;
981 unsigned NOT_POR : 1;
982 unsigned : 1;
983 unsigned : 1;
984 unsigned : 1;
985 unsigned : 1;
986 unsigned : 1;
987 unsigned : 1;
990 struct
992 unsigned NOT_BO : 1;
993 unsigned : 1;
994 unsigned : 1;
995 unsigned : 1;
996 unsigned : 1;
997 unsigned : 1;
998 unsigned : 1;
999 unsigned : 1;
1001 } __PCONbits_t;
1003 extern __at(0x008E) volatile __PCONbits_t PCONbits;
1005 #define _NOT_BOR 0x01
1006 #define _NOT_BO 0x01
1007 #define _NOT_POR 0x02
1009 //==============================================================================
1011 extern __at(0x0092) __sfr PR2;
1012 extern __at(0x0093) __sfr SSPADD;
1014 //==============================================================================
1015 // SSPSTAT Bits
1017 extern __at(0x0094) __sfr SSPSTAT;
1019 typedef union
1021 struct
1023 unsigned BF : 1;
1024 unsigned UA : 1;
1025 unsigned R_NOT_W : 1;
1026 unsigned S : 1;
1027 unsigned P : 1;
1028 unsigned D_NOT_A : 1;
1029 unsigned CKE : 1;
1030 unsigned SMP : 1;
1033 struct
1035 unsigned : 1;
1036 unsigned : 1;
1037 unsigned R : 1;
1038 unsigned I2C_START : 1;
1039 unsigned I2C_STOP : 1;
1040 unsigned D : 1;
1041 unsigned : 1;
1042 unsigned : 1;
1045 struct
1047 unsigned : 1;
1048 unsigned : 1;
1049 unsigned I2C_READ : 1;
1050 unsigned : 1;
1051 unsigned : 1;
1052 unsigned I2C_DATA : 1;
1053 unsigned : 1;
1054 unsigned : 1;
1057 struct
1059 unsigned : 1;
1060 unsigned : 1;
1061 unsigned R_W : 1;
1062 unsigned : 1;
1063 unsigned : 1;
1064 unsigned D_A : 1;
1065 unsigned : 1;
1066 unsigned : 1;
1069 struct
1071 unsigned : 1;
1072 unsigned : 1;
1073 unsigned READ_WRITE : 1;
1074 unsigned : 1;
1075 unsigned : 1;
1076 unsigned DATA_ADDRESS : 1;
1077 unsigned : 1;
1078 unsigned : 1;
1081 struct
1083 unsigned : 1;
1084 unsigned : 1;
1085 unsigned NOT_W : 1;
1086 unsigned : 1;
1087 unsigned : 1;
1088 unsigned NOT_A : 1;
1089 unsigned : 1;
1090 unsigned : 1;
1093 struct
1095 unsigned : 1;
1096 unsigned : 1;
1097 unsigned NOT_WRITE : 1;
1098 unsigned : 1;
1099 unsigned : 1;
1100 unsigned NOT_ADDRESS : 1;
1101 unsigned : 1;
1102 unsigned : 1;
1104 } __SSPSTATbits_t;
1106 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
1108 #define _BF 0x01
1109 #define _UA 0x02
1110 #define _R_NOT_W 0x04
1111 #define _R 0x04
1112 #define _I2C_READ 0x04
1113 #define _R_W 0x04
1114 #define _READ_WRITE 0x04
1115 #define _NOT_W 0x04
1116 #define _NOT_WRITE 0x04
1117 #define _S 0x08
1118 #define _I2C_START 0x08
1119 #define _P 0x10
1120 #define _I2C_STOP 0x10
1121 #define _D_NOT_A 0x20
1122 #define _D 0x20
1123 #define _I2C_DATA 0x20
1124 #define _D_A 0x20
1125 #define _DATA_ADDRESS 0x20
1126 #define _NOT_A 0x20
1127 #define _NOT_ADDRESS 0x20
1128 #define _CKE 0x40
1129 #define _SMP 0x80
1131 //==============================================================================
1134 //==============================================================================
1135 // TXSTA Bits
1137 extern __at(0x0098) __sfr TXSTA;
1139 typedef union
1141 struct
1143 unsigned TX9D : 1;
1144 unsigned TRMT : 1;
1145 unsigned BRGH : 1;
1146 unsigned : 1;
1147 unsigned SYNC : 1;
1148 unsigned TXEN : 1;
1149 unsigned TX9 : 1;
1150 unsigned CSRC : 1;
1153 struct
1155 unsigned TXD8 : 1;
1156 unsigned : 1;
1157 unsigned : 1;
1158 unsigned : 1;
1159 unsigned : 1;
1160 unsigned : 1;
1161 unsigned NOT_TX8 : 1;
1162 unsigned : 1;
1165 struct
1167 unsigned : 1;
1168 unsigned : 1;
1169 unsigned : 1;
1170 unsigned : 1;
1171 unsigned : 1;
1172 unsigned : 1;
1173 unsigned TX8_9 : 1;
1174 unsigned : 1;
1176 } __TXSTAbits_t;
1178 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits;
1180 #define _TX9D 0x01
1181 #define _TXD8 0x01
1182 #define _TRMT 0x02
1183 #define _BRGH 0x04
1184 #define _SYNC 0x10
1185 #define _TXEN 0x20
1186 #define _TX9 0x40
1187 #define _NOT_TX8 0x40
1188 #define _TX8_9 0x40
1189 #define _CSRC 0x80
1191 //==============================================================================
1193 extern __at(0x0099) __sfr SPBRG;
1195 //==============================================================================
1197 // Configuration Bits
1199 //==============================================================================
1201 #define _CONFIG1 0x2007
1203 //----------------------------- CONFIG1 Options -------------------------------
1205 #define _FOSC_LP 0x3FFC // LP oscillator.
1206 #define _LP_OSC 0x3FFC // LP oscillator.
1207 #define _FOSC_XT 0x3FFD // XT oscillator.
1208 #define _XT_OSC 0x3FFD // XT oscillator.
1209 #define _FOSC_HS 0x3FFE // HS oscillator.
1210 #define _HS_OSC 0x3FFE // HS oscillator.
1211 #define _FOSC_RC 0x3FFF // RC oscillator.
1212 #define _RC_OSC 0x3FFF // RC oscillator.
1213 #define _WDTE_OFF 0x3FFB // WDT disabled.
1214 #define _WDT_OFF 0x3FFB // WDT disabled.
1215 #define _WDTE_ON 0x3FFF // WDT enabled.
1216 #define _WDT_ON 0x3FFF // WDT enabled.
1217 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
1218 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1219 #define _CP_ALL 0x00CF // All memory is code protected.
1220 #define _CP_75 0x15DF // 0400h-0FFFh code protected.
1221 #define _CP_50 0x2AEF // 0800h-0FFFh code protected.
1222 #define _CP_OFF 0x3FFF // Code protection off.
1223 #define _BOREN_OFF 0x3FBF // BOR disabled.
1224 #define _BODEN_OFF 0x3FBF // BOR disabled.
1225 #define _BOREN_ON 0x3FFF // BOR enabled.
1226 #define _BODEN_ON 0x3FFF // BOR enabled.
1228 //==============================================================================
1230 #define _IDLOC0 0x2000
1231 #define _IDLOC1 0x2001
1232 #define _IDLOC2 0x2002
1233 #define _IDLOC3 0x2003
1235 //==============================================================================
1237 #ifndef NO_BIT_DEFINES
1239 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
1240 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
1241 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
1242 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
1243 #define CCP1Y CCP1CONbits.CCP1Y // bit 4
1244 #define CCP1X CCP1CONbits.CCP1X // bit 5
1246 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0
1247 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1
1248 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2
1249 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3
1250 #define CCP2Y CCP2CONbits.CCP2Y // bit 4
1251 #define CCP2X CCP2CONbits.CCP2X // bit 5
1253 #define RBIF INTCONbits.RBIF // bit 0
1254 #define INTF INTCONbits.INTF // bit 1
1255 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
1256 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
1257 #define RBIE INTCONbits.RBIE // bit 3
1258 #define INTE INTCONbits.INTE // bit 4
1259 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
1260 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
1261 #define PEIE INTCONbits.PEIE // bit 6
1262 #define GIE INTCONbits.GIE // bit 7
1264 #define PS0 OPTION_REGbits.PS0 // bit 0
1265 #define PS1 OPTION_REGbits.PS1 // bit 1
1266 #define PS2 OPTION_REGbits.PS2 // bit 2
1267 #define PSA OPTION_REGbits.PSA // bit 3
1268 #define T0SE OPTION_REGbits.T0SE // bit 4
1269 #define T0CS OPTION_REGbits.T0CS // bit 5
1270 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1271 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
1273 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1274 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
1275 #define NOT_POR PCONbits.NOT_POR // bit 1
1277 #define TMR1IE PIE1bits.TMR1IE // bit 0
1278 #define TMR2IE PIE1bits.TMR2IE // bit 1
1279 #define CCP1IE PIE1bits.CCP1IE // bit 2
1280 #define SSPIE PIE1bits.SSPIE // bit 3
1281 #define TXIE PIE1bits.TXIE // bit 4
1282 #define RCIE PIE1bits.RCIE // bit 5
1283 #define PSPIE PIE1bits.PSPIE // bit 7
1285 #define CCP2IE PIE2bits.CCP2IE // bit 0
1287 #define TMR1IF PIR1bits.TMR1IF // bit 0
1288 #define TMR2IF PIR1bits.TMR2IF // bit 1
1289 #define CCP1IF PIR1bits.CCP1IF // bit 2
1290 #define SSPIF PIR1bits.SSPIF // bit 3
1291 #define TXIF PIR1bits.TXIF // bit 4
1292 #define RCIF PIR1bits.RCIF // bit 5
1293 #define PSPIF PIR1bits.PSPIF // bit 7
1295 #define CCP2IF PIR2bits.CCP2IF // bit 0
1297 #define RA0 PORTAbits.RA0 // bit 0
1298 #define RA1 PORTAbits.RA1 // bit 1
1299 #define RA2 PORTAbits.RA2 // bit 2
1300 #define RA3 PORTAbits.RA3 // bit 3
1301 #define RA4 PORTAbits.RA4 // bit 4
1302 #define RA5 PORTAbits.RA5 // bit 5
1304 #define RB0 PORTBbits.RB0 // bit 0
1305 #define RB1 PORTBbits.RB1 // bit 1
1306 #define RB2 PORTBbits.RB2 // bit 2
1307 #define RB3 PORTBbits.RB3 // bit 3
1308 #define RB4 PORTBbits.RB4 // bit 4
1309 #define RB5 PORTBbits.RB5 // bit 5
1310 #define RB6 PORTBbits.RB6 // bit 6
1311 #define RB7 PORTBbits.RB7 // bit 7
1313 #define RC0 PORTCbits.RC0 // bit 0
1314 #define RC1 PORTCbits.RC1 // bit 1
1315 #define RC2 PORTCbits.RC2 // bit 2
1316 #define RC3 PORTCbits.RC3 // bit 3
1317 #define RC4 PORTCbits.RC4 // bit 4
1318 #define RC5 PORTCbits.RC5 // bit 5
1319 #define RC6 PORTCbits.RC6 // bit 6
1320 #define RC7 PORTCbits.RC7 // bit 7
1322 #define RD0 PORTDbits.RD0 // bit 0
1323 #define RD1 PORTDbits.RD1 // bit 1
1324 #define RD2 PORTDbits.RD2 // bit 2
1325 #define RD3 PORTDbits.RD3 // bit 3
1326 #define RD4 PORTDbits.RD4 // bit 4
1327 #define RD5 PORTDbits.RD5 // bit 5
1328 #define RD6 PORTDbits.RD6 // bit 6
1329 #define RD7 PORTDbits.RD7 // bit 7
1331 #define RE0 PORTEbits.RE0 // bit 0
1332 #define RE1 PORTEbits.RE1 // bit 1
1333 #define RE2 PORTEbits.RE2 // bit 2
1335 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits
1336 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits
1337 #define OERR RCSTAbits.OERR // bit 1
1338 #define FERR RCSTAbits.FERR // bit 2
1339 #define CREN RCSTAbits.CREN // bit 4
1340 #define SREN RCSTAbits.SREN // bit 5
1341 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits
1342 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits
1343 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits
1344 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits
1345 #define SPEN RCSTAbits.SPEN // bit 7
1347 #define SSPM0 SSPCONbits.SSPM0 // bit 0
1348 #define SSPM1 SSPCONbits.SSPM1 // bit 1
1349 #define SSPM2 SSPCONbits.SSPM2 // bit 2
1350 #define SSPM3 SSPCONbits.SSPM3 // bit 3
1351 #define CKP SSPCONbits.CKP // bit 4
1352 #define SSPEN SSPCONbits.SSPEN // bit 5
1353 #define SSPOV SSPCONbits.SSPOV // bit 6
1354 #define WCOL SSPCONbits.WCOL // bit 7
1356 #define BF SSPSTATbits.BF // bit 0
1357 #define UA SSPSTATbits.UA // bit 1
1358 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
1359 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
1360 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
1361 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
1362 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
1363 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
1364 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
1365 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
1366 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
1367 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
1368 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
1369 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
1370 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
1371 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
1372 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
1373 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
1374 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
1375 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
1376 #define CKE SSPSTATbits.CKE // bit 6
1377 #define SMP SSPSTATbits.SMP // bit 7
1379 #define C STATUSbits.C // bit 0
1380 #define DC STATUSbits.DC // bit 1
1381 #define Z STATUSbits.Z // bit 2
1382 #define NOT_PD STATUSbits.NOT_PD // bit 3
1383 #define NOT_TO STATUSbits.NOT_TO // bit 4
1384 #define RP0 STATUSbits.RP0 // bit 5
1385 #define RP1 STATUSbits.RP1 // bit 6
1386 #define IRP STATUSbits.IRP // bit 7
1388 #define TMR1ON T1CONbits.TMR1ON // bit 0
1389 #define TMR1CS T1CONbits.TMR1CS // bit 1
1390 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
1391 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
1392 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1393 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1394 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1396 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
1397 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
1398 #define TMR2ON T2CONbits.TMR2ON // bit 2
1399 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
1400 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
1401 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
1402 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
1404 #define TRISA0 TRISAbits.TRISA0 // bit 0
1405 #define TRISA1 TRISAbits.TRISA1 // bit 1
1406 #define TRISA2 TRISAbits.TRISA2 // bit 2
1407 #define TRISA3 TRISAbits.TRISA3 // bit 3
1408 #define TRISA4 TRISAbits.TRISA4 // bit 4
1409 #define TRISA5 TRISAbits.TRISA5 // bit 5
1411 #define TRISB0 TRISBbits.TRISB0 // bit 0
1412 #define TRISB1 TRISBbits.TRISB1 // bit 1
1413 #define TRISB2 TRISBbits.TRISB2 // bit 2
1414 #define TRISB3 TRISBbits.TRISB3 // bit 3
1415 #define TRISB4 TRISBbits.TRISB4 // bit 4
1416 #define TRISB5 TRISBbits.TRISB5 // bit 5
1417 #define TRISB6 TRISBbits.TRISB6 // bit 6
1418 #define TRISB7 TRISBbits.TRISB7 // bit 7
1420 #define TRISC0 TRISCbits.TRISC0 // bit 0
1421 #define TRISC1 TRISCbits.TRISC1 // bit 1
1422 #define TRISC2 TRISCbits.TRISC2 // bit 2
1423 #define TRISC3 TRISCbits.TRISC3 // bit 3
1424 #define TRISC4 TRISCbits.TRISC4 // bit 4
1425 #define TRISC5 TRISCbits.TRISC5 // bit 5
1426 #define TRISC6 TRISCbits.TRISC6 // bit 6
1427 #define TRISC7 TRISCbits.TRISC7 // bit 7
1429 #define TRISD0 TRISDbits.TRISD0 // bit 0
1430 #define TRISD1 TRISDbits.TRISD1 // bit 1
1431 #define TRISD2 TRISDbits.TRISD2 // bit 2
1432 #define TRISD3 TRISDbits.TRISD3 // bit 3
1433 #define TRISD4 TRISDbits.TRISD4 // bit 4
1434 #define TRISD5 TRISDbits.TRISD5 // bit 5
1435 #define TRISD6 TRISDbits.TRISD6 // bit 6
1436 #define TRISD7 TRISDbits.TRISD7 // bit 7
1438 #define TRISE0 TRISEbits.TRISE0 // bit 0
1439 #define TRISE1 TRISEbits.TRISE1 // bit 1
1440 #define TRISE2 TRISEbits.TRISE2 // bit 2
1441 #define PSPMODE TRISEbits.PSPMODE // bit 4
1442 #define IBOV TRISEbits.IBOV // bit 5
1443 #define OBF TRISEbits.OBF // bit 6
1444 #define IBF TRISEbits.IBF // bit 7
1446 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits
1447 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits
1448 #define TRMT TXSTAbits.TRMT // bit 1
1449 #define BRGH TXSTAbits.BRGH // bit 2
1450 #define SYNC TXSTAbits.SYNC // bit 4
1451 #define TXEN TXSTAbits.TXEN // bit 5
1452 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits
1453 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits
1454 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits
1455 #define CSRC TXSTAbits.CSRC // bit 7
1457 #endif // #ifndef NO_BIT_DEFINES
1459 #endif // #ifndef __PIC16C65B_H__