Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f13k22.h
blob059478424471d8afd9cc231ac7fbdab102da91d3
1 /*
2 * This declarations of the PIC18F13K22 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:25 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 __PIC18F13K22_H__
26 #define __PIC18F13K22_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // SRCON0 Bits
40 extern __at(0x0F68) __sfr SRCON0;
42 typedef union
44 struct
46 unsigned SRPR : 1;
47 unsigned SRPS : 1;
48 unsigned SRNQEN : 1;
49 unsigned SRQEN : 1;
50 unsigned SRCLK0 : 1;
51 unsigned SRCLK1 : 1;
52 unsigned SRCLK2 : 1;
53 unsigned SRLEN : 1;
56 struct
58 unsigned : 4;
59 unsigned SRCLK : 3;
60 unsigned : 1;
62 } __SRCON0bits_t;
64 extern __at(0x0F68) volatile __SRCON0bits_t SRCON0bits;
66 #define _SRPR 0x01
67 #define _SRPS 0x02
68 #define _SRNQEN 0x04
69 #define _SRQEN 0x08
70 #define _SRCLK0 0x10
71 #define _SRCLK1 0x20
72 #define _SRCLK2 0x40
73 #define _SRLEN 0x80
75 //==============================================================================
78 //==============================================================================
79 // SRCON1 Bits
81 extern __at(0x0F69) __sfr SRCON1;
83 typedef struct
85 unsigned SRRC1E : 1;
86 unsigned SRRC2E : 1;
87 unsigned SRRCKE : 1;
88 unsigned SRRPE : 1;
89 unsigned SRSC1E : 1;
90 unsigned SRSC2E : 1;
91 unsigned SRSCKE : 1;
92 unsigned SRSPE : 1;
93 } __SRCON1bits_t;
95 extern __at(0x0F69) volatile __SRCON1bits_t SRCON1bits;
97 #define _SRRC1E 0x01
98 #define _SRRC2E 0x02
99 #define _SRRCKE 0x04
100 #define _SRRPE 0x08
101 #define _SRSC1E 0x10
102 #define _SRSC2E 0x20
103 #define _SRSCKE 0x40
104 #define _SRSPE 0x80
106 //==============================================================================
109 //==============================================================================
110 // CM2CON0 Bits
112 extern __at(0x0F6B) __sfr CM2CON0;
114 typedef union
116 struct
118 unsigned C2CH0 : 1;
119 unsigned C2CH1 : 1;
120 unsigned C2R : 1;
121 unsigned C2SP : 1;
122 unsigned C2POL : 1;
123 unsigned C2OE : 1;
124 unsigned C2OUT : 1;
125 unsigned C2ON : 1;
128 struct
130 unsigned C2CH : 2;
131 unsigned : 6;
133 } __CM2CON0bits_t;
135 extern __at(0x0F6B) volatile __CM2CON0bits_t CM2CON0bits;
137 #define _C2CH0 0x01
138 #define _C2CH1 0x02
139 #define _C2R 0x04
140 #define _C2SP 0x08
141 #define _C2POL 0x10
142 #define _C2OE 0x20
143 #define _C2OUT 0x40
144 #define _C2ON 0x80
146 //==============================================================================
149 //==============================================================================
150 // CM2CON1 Bits
152 extern __at(0x0F6C) __sfr CM2CON1;
154 typedef struct
156 unsigned C2SYNC : 1;
157 unsigned C1SYNC : 1;
158 unsigned C2HYS : 1;
159 unsigned C1HYS : 1;
160 unsigned C2RSEL : 1;
161 unsigned C1RSEL : 1;
162 unsigned MC2OUT : 1;
163 unsigned MC1OUT : 1;
164 } __CM2CON1bits_t;
166 extern __at(0x0F6C) volatile __CM2CON1bits_t CM2CON1bits;
168 #define _C2SYNC 0x01
169 #define _C1SYNC 0x02
170 #define _C2HYS 0x04
171 #define _C1HYS 0x08
172 #define _C2RSEL 0x10
173 #define _C1RSEL 0x20
174 #define _MC2OUT 0x40
175 #define _MC1OUT 0x80
177 //==============================================================================
180 //==============================================================================
181 // CM1CON0 Bits
183 extern __at(0x0F6D) __sfr CM1CON0;
185 typedef union
187 struct
189 unsigned C1CH0 : 1;
190 unsigned C1CH1 : 1;
191 unsigned C1R : 1;
192 unsigned C1SP : 1;
193 unsigned C1POL : 1;
194 unsigned C1OE : 1;
195 unsigned C1OUT : 1;
196 unsigned C1ON : 1;
199 struct
201 unsigned C1CH : 2;
202 unsigned : 6;
204 } __CM1CON0bits_t;
206 extern __at(0x0F6D) volatile __CM1CON0bits_t CM1CON0bits;
208 #define _C1CH0 0x01
209 #define _C1CH1 0x02
210 #define _C1R 0x04
211 #define _C1SP 0x08
212 #define _C1POL 0x10
213 #define _C1OE 0x20
214 #define _C1OUT 0x40
215 #define _C1ON 0x80
217 //==============================================================================
220 //==============================================================================
221 // SSPMSK Bits
223 extern __at(0x0F6F) __sfr SSPMSK;
225 typedef struct
227 unsigned MSK0 : 1;
228 unsigned MSK1 : 1;
229 unsigned MSK2 : 1;
230 unsigned MSK3 : 1;
231 unsigned MSK4 : 1;
232 unsigned MSK5 : 1;
233 unsigned MSK6 : 1;
234 unsigned MSK7 : 1;
235 } __SSPMSKbits_t;
237 extern __at(0x0F6F) volatile __SSPMSKbits_t SSPMSKbits;
239 #define _MSK0 0x01
240 #define _MSK1 0x02
241 #define _MSK2 0x04
242 #define _MSK3 0x08
243 #define _MSK4 0x10
244 #define _MSK5 0x20
245 #define _MSK6 0x40
246 #define _MSK7 0x80
248 //==============================================================================
251 //==============================================================================
252 // SLRCON Bits
254 extern __at(0x0F76) __sfr SLRCON;
256 typedef struct
258 unsigned SLRA : 1;
259 unsigned SLRB : 1;
260 unsigned SLRC : 1;
261 unsigned : 1;
262 unsigned : 1;
263 unsigned : 1;
264 unsigned : 1;
265 unsigned : 1;
266 } __SLRCONbits_t;
268 extern __at(0x0F76) volatile __SLRCONbits_t SLRCONbits;
270 #define _SLRA 0x01
271 #define _SLRB 0x02
272 #define _SLRC 0x04
274 //==============================================================================
277 //==============================================================================
278 // WPUA Bits
280 extern __at(0x0F77) __sfr WPUA;
282 typedef union
284 struct
286 unsigned WPUA0 : 1;
287 unsigned WPUA1 : 1;
288 unsigned WPUA2 : 1;
289 unsigned WPUA3 : 1;
290 unsigned WPUA4 : 1;
291 unsigned WPUA5 : 1;
292 unsigned : 1;
293 unsigned : 1;
296 struct
298 unsigned WPUA : 6;
299 unsigned : 2;
301 } __WPUAbits_t;
303 extern __at(0x0F77) volatile __WPUAbits_t WPUAbits;
305 #define _WPUA0 0x01
306 #define _WPUA1 0x02
307 #define _WPUA2 0x04
308 #define _WPUA3 0x08
309 #define _WPUA4 0x10
310 #define _WPUA5 0x20
312 //==============================================================================
315 //==============================================================================
316 // WPUB Bits
318 extern __at(0x0F78) __sfr WPUB;
320 typedef struct
322 unsigned : 1;
323 unsigned : 1;
324 unsigned : 1;
325 unsigned : 1;
326 unsigned WPUB4 : 1;
327 unsigned WPUB5 : 1;
328 unsigned WPUB6 : 1;
329 unsigned WPUB7 : 1;
330 } __WPUBbits_t;
332 extern __at(0x0F78) volatile __WPUBbits_t WPUBbits;
334 #define _WPUB4 0x10
335 #define _WPUB5 0x20
336 #define _WPUB6 0x40
337 #define _WPUB7 0x80
339 //==============================================================================
342 //==============================================================================
343 // IOCA Bits
345 extern __at(0x0F79) __sfr IOCA;
347 typedef union
349 struct
351 unsigned IOCA0 : 1;
352 unsigned IOCA1 : 1;
353 unsigned IOCA2 : 1;
354 unsigned IOCA3 : 1;
355 unsigned IOCA4 : 1;
356 unsigned IOCA5 : 1;
357 unsigned : 1;
358 unsigned : 1;
361 struct
363 unsigned IOCA : 6;
364 unsigned : 2;
366 } __IOCAbits_t;
368 extern __at(0x0F79) volatile __IOCAbits_t IOCAbits;
370 #define _IOCA0 0x01
371 #define _IOCA1 0x02
372 #define _IOCA2 0x04
373 #define _IOCA3 0x08
374 #define _IOCA4 0x10
375 #define _IOCA5 0x20
377 //==============================================================================
380 //==============================================================================
381 // IOCB Bits
383 extern __at(0x0F7A) __sfr IOCB;
385 typedef struct
387 unsigned : 1;
388 unsigned : 1;
389 unsigned : 1;
390 unsigned : 1;
391 unsigned IOCB4 : 1;
392 unsigned IOCB5 : 1;
393 unsigned IOCB6 : 1;
394 unsigned IOCB7 : 1;
395 } __IOCBbits_t;
397 extern __at(0x0F7A) volatile __IOCBbits_t IOCBbits;
399 #define _IOCB4 0x10
400 #define _IOCB5 0x20
401 #define _IOCB6 0x40
402 #define _IOCB7 0x80
404 //==============================================================================
407 //==============================================================================
408 // ANSEL Bits
410 extern __at(0x0F7E) __sfr ANSEL;
412 typedef union
414 struct
416 unsigned ANS0 : 1;
417 unsigned ANS1 : 1;
418 unsigned ANS2 : 1;
419 unsigned ANS3 : 1;
420 unsigned ANS4 : 1;
421 unsigned ANS5 : 1;
422 unsigned ANS6 : 1;
423 unsigned ANS7 : 1;
426 struct
428 unsigned ANSEL0 : 1;
429 unsigned ANSEL1 : 1;
430 unsigned ANSEL2 : 1;
431 unsigned ANSEL3 : 1;
432 unsigned ANSEL4 : 1;
433 unsigned ANSEL5 : 1;
434 unsigned ANSEL6 : 1;
435 unsigned ANSEL7 : 1;
437 } __ANSELbits_t;
439 extern __at(0x0F7E) volatile __ANSELbits_t ANSELbits;
441 #define _ANS0 0x01
442 #define _ANSEL0 0x01
443 #define _ANS1 0x02
444 #define _ANSEL1 0x02
445 #define _ANS2 0x04
446 #define _ANSEL2 0x04
447 #define _ANS3 0x08
448 #define _ANSEL3 0x08
449 #define _ANS4 0x10
450 #define _ANSEL4 0x10
451 #define _ANS5 0x20
452 #define _ANSEL5 0x20
453 #define _ANS6 0x40
454 #define _ANSEL6 0x40
455 #define _ANS7 0x80
456 #define _ANSEL7 0x80
458 //==============================================================================
461 //==============================================================================
462 // ANSELH Bits
464 extern __at(0x0F7F) __sfr ANSELH;
466 typedef union
468 struct
470 unsigned ANS8 : 1;
471 unsigned ANS9 : 1;
472 unsigned ANS10 : 1;
473 unsigned ANS11 : 1;
474 unsigned : 1;
475 unsigned : 1;
476 unsigned : 1;
477 unsigned : 1;
480 struct
482 unsigned ANSEL8 : 1;
483 unsigned ANSEL9 : 1;
484 unsigned ANSEL10 : 1;
485 unsigned ANSEL11 : 1;
486 unsigned : 1;
487 unsigned : 1;
488 unsigned : 1;
489 unsigned : 1;
491 } __ANSELHbits_t;
493 extern __at(0x0F7F) volatile __ANSELHbits_t ANSELHbits;
495 #define _ANS8 0x01
496 #define _ANSEL8 0x01
497 #define _ANS9 0x02
498 #define _ANSEL9 0x02
499 #define _ANS10 0x04
500 #define _ANSEL10 0x04
501 #define _ANS11 0x08
502 #define _ANSEL11 0x08
504 //==============================================================================
507 //==============================================================================
508 // PORTA Bits
510 extern __at(0x0F80) __sfr PORTA;
512 typedef union
514 struct
516 unsigned RA0 : 1;
517 unsigned RA1 : 1;
518 unsigned RA2 : 1;
519 unsigned RA3 : 1;
520 unsigned RA4 : 1;
521 unsigned RA5 : 1;
522 unsigned : 1;
523 unsigned : 1;
526 struct
528 unsigned AN0 : 1;
529 unsigned AN1 : 1;
530 unsigned AN2 : 1;
531 unsigned MCLR : 1;
532 unsigned AN3 : 1;
533 unsigned T13CKI : 1;
534 unsigned : 1;
535 unsigned : 1;
538 struct
540 unsigned CVREF : 1;
541 unsigned C12IN0M : 1;
542 unsigned T0CKI : 1;
543 unsigned NOT_MCLR : 1;
544 unsigned OSC2 : 1;
545 unsigned OSC1 : 1;
546 unsigned : 1;
547 unsigned : 1;
550 struct
552 unsigned VREFM : 1;
553 unsigned VREFP : 1;
554 unsigned INT2 : 1;
555 unsigned VPP : 1;
556 unsigned CLKOUT : 1;
557 unsigned CLKIN : 1;
558 unsigned : 1;
559 unsigned : 1;
562 struct
564 unsigned INT0 : 1;
565 unsigned INT1 : 1;
566 unsigned SRQ : 1;
567 unsigned : 1;
568 unsigned : 1;
569 unsigned : 1;
570 unsigned : 1;
571 unsigned : 1;
574 struct
576 unsigned PGD : 1;
577 unsigned PGC : 1;
578 unsigned : 1;
579 unsigned : 1;
580 unsigned : 1;
581 unsigned : 1;
582 unsigned : 1;
583 unsigned : 1;
586 struct
588 unsigned C1INP : 1;
589 unsigned : 1;
590 unsigned : 1;
591 unsigned : 1;
592 unsigned : 1;
593 unsigned : 1;
594 unsigned : 1;
595 unsigned : 1;
598 struct
600 unsigned RA : 6;
601 unsigned : 2;
604 struct
606 unsigned INT : 3;
607 unsigned : 5;
609 } __PORTAbits_t;
611 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
613 #define _PORTA_RA0 0x01
614 #define _PORTA_AN0 0x01
615 #define _PORTA_CVREF 0x01
616 #define _PORTA_VREFM 0x01
617 #define _PORTA_INT0 0x01
618 #define _PORTA_PGD 0x01
619 #define _PORTA_C1INP 0x01
620 #define _PORTA_RA1 0x02
621 #define _PORTA_AN1 0x02
622 #define _PORTA_C12IN0M 0x02
623 #define _PORTA_VREFP 0x02
624 #define _PORTA_INT1 0x02
625 #define _PORTA_PGC 0x02
626 #define _PORTA_RA2 0x04
627 #define _PORTA_AN2 0x04
628 #define _PORTA_T0CKI 0x04
629 #define _PORTA_INT2 0x04
630 #define _PORTA_SRQ 0x04
631 #define _PORTA_RA3 0x08
632 #define _PORTA_MCLR 0x08
633 #define _PORTA_NOT_MCLR 0x08
634 #define _PORTA_VPP 0x08
635 #define _PORTA_RA4 0x10
636 #define _PORTA_AN3 0x10
637 #define _PORTA_OSC2 0x10
638 #define _PORTA_CLKOUT 0x10
639 #define _PORTA_RA5 0x20
640 #define _PORTA_T13CKI 0x20
641 #define _PORTA_OSC1 0x20
642 #define _PORTA_CLKIN 0x20
644 //==============================================================================
647 //==============================================================================
648 // PORTB Bits
650 extern __at(0x0F81) __sfr PORTB;
652 typedef union
654 struct
656 unsigned : 1;
657 unsigned : 1;
658 unsigned : 1;
659 unsigned : 1;
660 unsigned RB4 : 1;
661 unsigned RB5 : 1;
662 unsigned RB6 : 1;
663 unsigned RB7 : 1;
666 struct
668 unsigned : 1;
669 unsigned : 1;
670 unsigned : 1;
671 unsigned : 1;
672 unsigned SDI : 1;
673 unsigned RX : 1;
674 unsigned SCL : 1;
675 unsigned TX : 1;
678 struct
680 unsigned : 1;
681 unsigned : 1;
682 unsigned : 1;
683 unsigned : 1;
684 unsigned SDA : 1;
685 unsigned AN11 : 1;
686 unsigned SCK : 1;
687 unsigned CK : 1;
690 struct
692 unsigned : 1;
693 unsigned : 1;
694 unsigned : 1;
695 unsigned : 1;
696 unsigned AN10 : 1;
697 unsigned : 1;
698 unsigned : 1;
699 unsigned : 1;
701 } __PORTBbits_t;
703 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
705 #define _PORTB_RB4 0x10
706 #define _PORTB_SDI 0x10
707 #define _PORTB_SDA 0x10
708 #define _PORTB_AN10 0x10
709 #define _PORTB_RB5 0x20
710 #define _PORTB_RX 0x20
711 #define _PORTB_AN11 0x20
712 #define _PORTB_RB6 0x40
713 #define _PORTB_SCL 0x40
714 #define _PORTB_SCK 0x40
715 #define _PORTB_RB7 0x80
716 #define _PORTB_TX 0x80
717 #define _PORTB_CK 0x80
719 //==============================================================================
722 //==============================================================================
723 // PORTC Bits
725 extern __at(0x0F82) __sfr PORTC;
727 typedef union
729 struct
731 unsigned RC0 : 1;
732 unsigned RC1 : 1;
733 unsigned RC2 : 1;
734 unsigned RC3 : 1;
735 unsigned RC4 : 1;
736 unsigned RC5 : 1;
737 unsigned RC6 : 1;
738 unsigned RC7 : 1;
741 struct
743 unsigned AN4 : 1;
744 unsigned AN5 : 1;
745 unsigned AN6 : 1;
746 unsigned AN7 : 1;
747 unsigned C12OUT : 1;
748 unsigned P1A : 1;
749 unsigned AN8 : 1;
750 unsigned AN9 : 1;
753 struct
755 unsigned C12INP : 1;
756 unsigned C12IN1M : 1;
757 unsigned C12IN2M : 1;
758 unsigned C12IN3M : 1;
759 unsigned P1B : 1;
760 unsigned CCP1 : 1;
761 unsigned SS : 1;
762 unsigned SDO : 1;
765 struct
767 unsigned C2INP : 1;
768 unsigned : 1;
769 unsigned P1D : 1;
770 unsigned P1C : 1;
771 unsigned : 1;
772 unsigned : 1;
773 unsigned NOT_SS : 1;
774 unsigned : 1;
777 struct
779 unsigned : 1;
780 unsigned : 1;
781 unsigned : 1;
782 unsigned PGM : 1;
783 unsigned : 1;
784 unsigned : 1;
785 unsigned : 1;
786 unsigned : 1;
788 } __PORTCbits_t;
790 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
792 #define _PORTC_RC0 0x01
793 #define _PORTC_AN4 0x01
794 #define _PORTC_C12INP 0x01
795 #define _PORTC_C2INP 0x01
796 #define _PORTC_RC1 0x02
797 #define _PORTC_AN5 0x02
798 #define _PORTC_C12IN1M 0x02
799 #define _PORTC_RC2 0x04
800 #define _PORTC_AN6 0x04
801 #define _PORTC_C12IN2M 0x04
802 #define _PORTC_P1D 0x04
803 #define _PORTC_RC3 0x08
804 #define _PORTC_AN7 0x08
805 #define _PORTC_C12IN3M 0x08
806 #define _PORTC_P1C 0x08
807 #define _PORTC_PGM 0x08
808 #define _PORTC_RC4 0x10
809 #define _PORTC_C12OUT 0x10
810 #define _PORTC_P1B 0x10
811 #define _PORTC_RC5 0x20
812 #define _PORTC_P1A 0x20
813 #define _PORTC_CCP1 0x20
814 #define _PORTC_RC6 0x40
815 #define _PORTC_AN8 0x40
816 #define _PORTC_SS 0x40
817 #define _PORTC_NOT_SS 0x40
818 #define _PORTC_RC7 0x80
819 #define _PORTC_AN9 0x80
820 #define _PORTC_SDO 0x80
822 //==============================================================================
825 //==============================================================================
826 // LATA Bits
828 extern __at(0x0F89) __sfr LATA;
830 typedef struct
832 unsigned LATA0 : 1;
833 unsigned LATA1 : 1;
834 unsigned LATA2 : 1;
835 unsigned : 1;
836 unsigned LATA4 : 1;
837 unsigned LATA5 : 1;
838 unsigned : 1;
839 unsigned : 1;
840 } __LATAbits_t;
842 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
844 #define _LATA0 0x01
845 #define _LATA1 0x02
846 #define _LATA2 0x04
847 #define _LATA4 0x10
848 #define _LATA5 0x20
850 //==============================================================================
853 //==============================================================================
854 // LATB Bits
856 extern __at(0x0F8A) __sfr LATB;
858 typedef struct
860 unsigned : 1;
861 unsigned : 1;
862 unsigned : 1;
863 unsigned : 1;
864 unsigned LATB4 : 1;
865 unsigned LATB5 : 1;
866 unsigned LATB6 : 1;
867 unsigned LATB7 : 1;
868 } __LATBbits_t;
870 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
872 #define _LATB4 0x10
873 #define _LATB5 0x20
874 #define _LATB6 0x40
875 #define _LATB7 0x80
877 //==============================================================================
880 //==============================================================================
881 // LATC Bits
883 extern __at(0x0F8B) __sfr LATC;
885 typedef struct
887 unsigned LATC0 : 1;
888 unsigned LATC1 : 1;
889 unsigned LATC2 : 1;
890 unsigned LATC3 : 1;
891 unsigned LATC4 : 1;
892 unsigned LATC5 : 1;
893 unsigned LATC6 : 1;
894 unsigned LATC7 : 1;
895 } __LATCbits_t;
897 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
899 #define _LATC0 0x01
900 #define _LATC1 0x02
901 #define _LATC2 0x04
902 #define _LATC3 0x08
903 #define _LATC4 0x10
904 #define _LATC5 0x20
905 #define _LATC6 0x40
906 #define _LATC7 0x80
908 //==============================================================================
911 //==============================================================================
912 // DDRA Bits
914 extern __at(0x0F92) __sfr DDRA;
916 typedef union
918 struct
920 unsigned TRISA0 : 1;
921 unsigned TRISA1 : 1;
922 unsigned TRISA2 : 1;
923 unsigned : 1;
924 unsigned TRISA4 : 1;
925 unsigned TRISA5 : 1;
926 unsigned : 1;
927 unsigned : 1;
930 struct
932 unsigned RA0 : 1;
933 unsigned RA1 : 1;
934 unsigned RA2 : 1;
935 unsigned : 1;
936 unsigned RA4 : 1;
937 unsigned RA5 : 1;
938 unsigned : 1;
939 unsigned : 1;
941 } __DDRAbits_t;
943 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
945 #define _TRISA0 0x01
946 #define _RA0 0x01
947 #define _TRISA1 0x02
948 #define _RA1 0x02
949 #define _TRISA2 0x04
950 #define _RA2 0x04
951 #define _TRISA4 0x10
952 #define _RA4 0x10
953 #define _TRISA5 0x20
954 #define _RA5 0x20
956 //==============================================================================
959 //==============================================================================
960 // TRISA Bits
962 extern __at(0x0F92) __sfr TRISA;
964 typedef union
966 struct
968 unsigned TRISA0 : 1;
969 unsigned TRISA1 : 1;
970 unsigned TRISA2 : 1;
971 unsigned : 1;
972 unsigned TRISA4 : 1;
973 unsigned TRISA5 : 1;
974 unsigned : 1;
975 unsigned : 1;
978 struct
980 unsigned RA0 : 1;
981 unsigned RA1 : 1;
982 unsigned RA2 : 1;
983 unsigned : 1;
984 unsigned RA4 : 1;
985 unsigned RA5 : 1;
986 unsigned : 1;
987 unsigned : 1;
989 } __TRISAbits_t;
991 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
993 #define _TRISA_TRISA0 0x01
994 #define _TRISA_RA0 0x01
995 #define _TRISA_TRISA1 0x02
996 #define _TRISA_RA1 0x02
997 #define _TRISA_TRISA2 0x04
998 #define _TRISA_RA2 0x04
999 #define _TRISA_TRISA4 0x10
1000 #define _TRISA_RA4 0x10
1001 #define _TRISA_TRISA5 0x20
1002 #define _TRISA_RA5 0x20
1004 //==============================================================================
1007 //==============================================================================
1008 // DDRB Bits
1010 extern __at(0x0F93) __sfr DDRB;
1012 typedef union
1014 struct
1016 unsigned : 1;
1017 unsigned : 1;
1018 unsigned : 1;
1019 unsigned : 1;
1020 unsigned TRISB4 : 1;
1021 unsigned TRISB5 : 1;
1022 unsigned TRISB6 : 1;
1023 unsigned TRISB7 : 1;
1026 struct
1028 unsigned : 1;
1029 unsigned : 1;
1030 unsigned : 1;
1031 unsigned : 1;
1032 unsigned RB4 : 1;
1033 unsigned RB5 : 1;
1034 unsigned RB6 : 1;
1035 unsigned RB7 : 1;
1037 } __DDRBbits_t;
1039 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1041 #define _TRISB4 0x10
1042 #define _RB4 0x10
1043 #define _TRISB5 0x20
1044 #define _RB5 0x20
1045 #define _TRISB6 0x40
1046 #define _RB6 0x40
1047 #define _TRISB7 0x80
1048 #define _RB7 0x80
1050 //==============================================================================
1053 //==============================================================================
1054 // TRISB Bits
1056 extern __at(0x0F93) __sfr TRISB;
1058 typedef union
1060 struct
1062 unsigned : 1;
1063 unsigned : 1;
1064 unsigned : 1;
1065 unsigned : 1;
1066 unsigned TRISB4 : 1;
1067 unsigned TRISB5 : 1;
1068 unsigned TRISB6 : 1;
1069 unsigned TRISB7 : 1;
1072 struct
1074 unsigned : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1077 unsigned : 1;
1078 unsigned RB4 : 1;
1079 unsigned RB5 : 1;
1080 unsigned RB6 : 1;
1081 unsigned RB7 : 1;
1083 } __TRISBbits_t;
1085 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1087 #define _TRISB_TRISB4 0x10
1088 #define _TRISB_RB4 0x10
1089 #define _TRISB_TRISB5 0x20
1090 #define _TRISB_RB5 0x20
1091 #define _TRISB_TRISB6 0x40
1092 #define _TRISB_RB6 0x40
1093 #define _TRISB_TRISB7 0x80
1094 #define _TRISB_RB7 0x80
1096 //==============================================================================
1099 //==============================================================================
1100 // DDRC Bits
1102 extern __at(0x0F94) __sfr DDRC;
1104 typedef union
1106 struct
1108 unsigned TRISC0 : 1;
1109 unsigned TRISC1 : 1;
1110 unsigned TRISC2 : 1;
1111 unsigned TRISC3 : 1;
1112 unsigned TRISC4 : 1;
1113 unsigned TRISC5 : 1;
1114 unsigned TRISC6 : 1;
1115 unsigned TRISC7 : 1;
1118 struct
1120 unsigned RC0 : 1;
1121 unsigned RC1 : 1;
1122 unsigned RC2 : 1;
1123 unsigned RC3 : 1;
1124 unsigned RC4 : 1;
1125 unsigned RC5 : 1;
1126 unsigned RC6 : 1;
1127 unsigned RC7 : 1;
1129 } __DDRCbits_t;
1131 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1133 #define _TRISC0 0x01
1134 #define _RC0 0x01
1135 #define _TRISC1 0x02
1136 #define _RC1 0x02
1137 #define _TRISC2 0x04
1138 #define _RC2 0x04
1139 #define _TRISC3 0x08
1140 #define _RC3 0x08
1141 #define _TRISC4 0x10
1142 #define _RC4 0x10
1143 #define _TRISC5 0x20
1144 #define _RC5 0x20
1145 #define _TRISC6 0x40
1146 #define _RC6 0x40
1147 #define _TRISC7 0x80
1148 #define _RC7 0x80
1150 //==============================================================================
1153 //==============================================================================
1154 // TRISC Bits
1156 extern __at(0x0F94) __sfr TRISC;
1158 typedef union
1160 struct
1162 unsigned TRISC0 : 1;
1163 unsigned TRISC1 : 1;
1164 unsigned TRISC2 : 1;
1165 unsigned TRISC3 : 1;
1166 unsigned TRISC4 : 1;
1167 unsigned TRISC5 : 1;
1168 unsigned TRISC6 : 1;
1169 unsigned TRISC7 : 1;
1172 struct
1174 unsigned RC0 : 1;
1175 unsigned RC1 : 1;
1176 unsigned RC2 : 1;
1177 unsigned RC3 : 1;
1178 unsigned RC4 : 1;
1179 unsigned RC5 : 1;
1180 unsigned RC6 : 1;
1181 unsigned RC7 : 1;
1183 } __TRISCbits_t;
1185 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1187 #define _TRISC_TRISC0 0x01
1188 #define _TRISC_RC0 0x01
1189 #define _TRISC_TRISC1 0x02
1190 #define _TRISC_RC1 0x02
1191 #define _TRISC_TRISC2 0x04
1192 #define _TRISC_RC2 0x04
1193 #define _TRISC_TRISC3 0x08
1194 #define _TRISC_RC3 0x08
1195 #define _TRISC_TRISC4 0x10
1196 #define _TRISC_RC4 0x10
1197 #define _TRISC_TRISC5 0x20
1198 #define _TRISC_RC5 0x20
1199 #define _TRISC_TRISC6 0x40
1200 #define _TRISC_RC6 0x40
1201 #define _TRISC_TRISC7 0x80
1202 #define _TRISC_RC7 0x80
1204 //==============================================================================
1207 //==============================================================================
1208 // OSCTUNE Bits
1210 extern __at(0x0F9B) __sfr OSCTUNE;
1212 typedef union
1214 struct
1216 unsigned TUN0 : 1;
1217 unsigned TUN1 : 1;
1218 unsigned TUN2 : 1;
1219 unsigned TUN3 : 1;
1220 unsigned TUN4 : 1;
1221 unsigned TUN5 : 1;
1222 unsigned PLLEN : 1;
1223 unsigned INTSRC : 1;
1226 struct
1228 unsigned TUN : 6;
1229 unsigned : 2;
1231 } __OSCTUNEbits_t;
1233 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
1235 #define _TUN0 0x01
1236 #define _TUN1 0x02
1237 #define _TUN2 0x04
1238 #define _TUN3 0x08
1239 #define _TUN4 0x10
1240 #define _TUN5 0x20
1241 #define _PLLEN 0x40
1242 #define _INTSRC 0x80
1244 //==============================================================================
1247 //==============================================================================
1248 // PIE1 Bits
1250 extern __at(0x0F9D) __sfr PIE1;
1252 typedef struct
1254 unsigned TMR1IE : 1;
1255 unsigned TMR2IE : 1;
1256 unsigned CCP1IE : 1;
1257 unsigned SSPIE : 1;
1258 unsigned TXIE : 1;
1259 unsigned RCIE : 1;
1260 unsigned ADIE : 1;
1261 unsigned : 1;
1262 } __PIE1bits_t;
1264 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1266 #define _TMR1IE 0x01
1267 #define _TMR2IE 0x02
1268 #define _CCP1IE 0x04
1269 #define _SSPIE 0x08
1270 #define _TXIE 0x10
1271 #define _RCIE 0x20
1272 #define _ADIE 0x40
1274 //==============================================================================
1277 //==============================================================================
1278 // PIR1 Bits
1280 extern __at(0x0F9E) __sfr PIR1;
1282 typedef struct
1284 unsigned TMR1IF : 1;
1285 unsigned TMR2IF : 1;
1286 unsigned CCP1IF : 1;
1287 unsigned SSPIF : 1;
1288 unsigned TXIF : 1;
1289 unsigned RCIF : 1;
1290 unsigned ADIF : 1;
1291 unsigned : 1;
1292 } __PIR1bits_t;
1294 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1296 #define _TMR1IF 0x01
1297 #define _TMR2IF 0x02
1298 #define _CCP1IF 0x04
1299 #define _SSPIF 0x08
1300 #define _TXIF 0x10
1301 #define _RCIF 0x20
1302 #define _ADIF 0x40
1304 //==============================================================================
1307 //==============================================================================
1308 // IPR1 Bits
1310 extern __at(0x0F9F) __sfr IPR1;
1312 typedef struct
1314 unsigned TMR1IP : 1;
1315 unsigned TMR2IP : 1;
1316 unsigned CCP1IP : 1;
1317 unsigned SSPIP : 1;
1318 unsigned TXIP : 1;
1319 unsigned RCIP : 1;
1320 unsigned ADIP : 1;
1321 unsigned : 1;
1322 } __IPR1bits_t;
1324 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1326 #define _TMR1IP 0x01
1327 #define _TMR2IP 0x02
1328 #define _CCP1IP 0x04
1329 #define _SSPIP 0x08
1330 #define _TXIP 0x10
1331 #define _RCIP 0x20
1332 #define _ADIP 0x40
1334 //==============================================================================
1337 //==============================================================================
1338 // PIE2 Bits
1340 extern __at(0x0FA0) __sfr PIE2;
1342 typedef struct
1344 unsigned : 1;
1345 unsigned TMR3IE : 1;
1346 unsigned : 1;
1347 unsigned BCLIE : 1;
1348 unsigned EEIE : 1;
1349 unsigned C2IE : 1;
1350 unsigned C1IE : 1;
1351 unsigned OSCFIE : 1;
1352 } __PIE2bits_t;
1354 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1356 #define _TMR3IE 0x02
1357 #define _BCLIE 0x08
1358 #define _EEIE 0x10
1359 #define _C2IE 0x20
1360 #define _C1IE 0x40
1361 #define _OSCFIE 0x80
1363 //==============================================================================
1366 //==============================================================================
1367 // PIR2 Bits
1369 extern __at(0x0FA1) __sfr PIR2;
1371 typedef struct
1373 unsigned : 1;
1374 unsigned TMR3IF : 1;
1375 unsigned : 1;
1376 unsigned BCLIF : 1;
1377 unsigned EEIF : 1;
1378 unsigned C2IF : 1;
1379 unsigned C1IF : 1;
1380 unsigned OSCFIF : 1;
1381 } __PIR2bits_t;
1383 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1385 #define _TMR3IF 0x02
1386 #define _BCLIF 0x08
1387 #define _EEIF 0x10
1388 #define _C2IF 0x20
1389 #define _C1IF 0x40
1390 #define _OSCFIF 0x80
1392 //==============================================================================
1395 //==============================================================================
1396 // IPR2 Bits
1398 extern __at(0x0FA2) __sfr IPR2;
1400 typedef struct
1402 unsigned : 1;
1403 unsigned TMR3IP : 1;
1404 unsigned : 1;
1405 unsigned BCLIP : 1;
1406 unsigned EEIP : 1;
1407 unsigned C2IP : 1;
1408 unsigned C1IP : 1;
1409 unsigned OSCFIP : 1;
1410 } __IPR2bits_t;
1412 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1414 #define _TMR3IP 0x02
1415 #define _BCLIP 0x08
1416 #define _EEIP 0x10
1417 #define _C2IP 0x20
1418 #define _C1IP 0x40
1419 #define _OSCFIP 0x80
1421 //==============================================================================
1424 //==============================================================================
1425 // EECON1 Bits
1427 extern __at(0x0FA6) __sfr EECON1;
1429 typedef struct
1431 unsigned RD : 1;
1432 unsigned WR : 1;
1433 unsigned WREN : 1;
1434 unsigned WRERR : 1;
1435 unsigned FREE : 1;
1436 unsigned : 1;
1437 unsigned CFGS : 1;
1438 unsigned EEPGD : 1;
1439 } __EECON1bits_t;
1441 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1443 #define _RD 0x01
1444 #define _WR 0x02
1445 #define _WREN 0x04
1446 #define _WRERR 0x08
1447 #define _FREE 0x10
1448 #define _CFGS 0x40
1449 #define _EEPGD 0x80
1451 //==============================================================================
1453 extern __at(0x0FA7) __sfr EECON2;
1454 extern __at(0x0FA8) __sfr EEDATA;
1456 //==============================================================================
1457 // EEADR Bits
1459 extern __at(0x0FA9) __sfr EEADR;
1461 typedef struct
1463 unsigned EEADR0 : 1;
1464 unsigned EEADR1 : 1;
1465 unsigned EEADR2 : 1;
1466 unsigned EEADR3 : 1;
1467 unsigned EEADR4 : 1;
1468 unsigned EEADR5 : 1;
1469 unsigned EEADR6 : 1;
1470 unsigned EEADR7 : 1;
1471 } __EEADRbits_t;
1473 extern __at(0x0FA9) volatile __EEADRbits_t EEADRbits;
1475 #define _EEADR0 0x01
1476 #define _EEADR1 0x02
1477 #define _EEADR2 0x04
1478 #define _EEADR3 0x08
1479 #define _EEADR4 0x10
1480 #define _EEADR5 0x20
1481 #define _EEADR6 0x40
1482 #define _EEADR7 0x80
1484 //==============================================================================
1487 //==============================================================================
1488 // RCSTA Bits
1490 extern __at(0x0FAB) __sfr RCSTA;
1492 typedef union
1494 struct
1496 unsigned RX9D : 1;
1497 unsigned OERR : 1;
1498 unsigned FERR : 1;
1499 unsigned ADDEN : 1;
1500 unsigned CREN : 1;
1501 unsigned SREN : 1;
1502 unsigned RX9 : 1;
1503 unsigned SPEN : 1;
1506 struct
1508 unsigned : 1;
1509 unsigned : 1;
1510 unsigned : 1;
1511 unsigned ADEN : 1;
1512 unsigned : 1;
1513 unsigned : 1;
1514 unsigned : 1;
1515 unsigned : 1;
1517 } __RCSTAbits_t;
1519 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1521 #define _RX9D 0x01
1522 #define _OERR 0x02
1523 #define _FERR 0x04
1524 #define _ADDEN 0x08
1525 #define _ADEN 0x08
1526 #define _CREN 0x10
1527 #define _SREN 0x20
1528 #define _RX9 0x40
1529 #define _SPEN 0x80
1531 //==============================================================================
1534 //==============================================================================
1535 // TXSTA Bits
1537 extern __at(0x0FAC) __sfr TXSTA;
1539 typedef struct
1541 unsigned TX9D : 1;
1542 unsigned TRMT : 1;
1543 unsigned BRGH : 1;
1544 unsigned SENDB : 1;
1545 unsigned SYNC : 1;
1546 unsigned TXEN : 1;
1547 unsigned TX9 : 1;
1548 unsigned CSRC : 1;
1549 } __TXSTAbits_t;
1551 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1553 #define _TX9D 0x01
1554 #define _TRMT 0x02
1555 #define _BRGH 0x04
1556 #define _SENDB 0x08
1557 #define _SYNC 0x10
1558 #define _TXEN 0x20
1559 #define _TX9 0x40
1560 #define _CSRC 0x80
1562 //==============================================================================
1564 extern __at(0x0FAD) __sfr TXREG;
1565 extern __at(0x0FAE) __sfr RCREG;
1566 extern __at(0x0FAF) __sfr SPBRG;
1567 extern __at(0x0FB0) __sfr SPBRGH;
1569 //==============================================================================
1570 // T3CON Bits
1572 extern __at(0x0FB1) __sfr T3CON;
1574 typedef union
1576 struct
1578 unsigned TMR3ON : 1;
1579 unsigned TMR3CS : 1;
1580 unsigned NOT_T3SYNC : 1;
1581 unsigned T3CCP1 : 1;
1582 unsigned T3CKPS0 : 1;
1583 unsigned T3CKPS1 : 1;
1584 unsigned : 1;
1585 unsigned RD16 : 1;
1588 struct
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned T3SYNC : 1;
1593 unsigned : 1;
1594 unsigned : 1;
1595 unsigned : 1;
1596 unsigned : 1;
1597 unsigned : 1;
1600 struct
1602 unsigned : 4;
1603 unsigned T3CKPS : 2;
1604 unsigned : 2;
1606 } __T3CONbits_t;
1608 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1610 #define _T3CON_TMR3ON 0x01
1611 #define _T3CON_TMR3CS 0x02
1612 #define _T3CON_NOT_T3SYNC 0x04
1613 #define _T3CON_T3SYNC 0x04
1614 #define _T3CON_T3CCP1 0x08
1615 #define _T3CON_T3CKPS0 0x10
1616 #define _T3CON_T3CKPS1 0x20
1617 #define _T3CON_RD16 0x80
1619 //==============================================================================
1621 extern __at(0x0FB2) __sfr TMR3;
1622 extern __at(0x0FB2) __sfr TMR3L;
1623 extern __at(0x0FB3) __sfr TMR3H;
1625 //==============================================================================
1626 // ECCP1AS Bits
1628 extern __at(0x0FB6) __sfr ECCP1AS;
1630 typedef union
1632 struct
1634 unsigned PSSBD0 : 1;
1635 unsigned PSSBD1 : 1;
1636 unsigned PSSAC0 : 1;
1637 unsigned PSSAC1 : 1;
1638 unsigned ECCPAS0 : 1;
1639 unsigned ECCPAS1 : 1;
1640 unsigned ECCPAS2 : 1;
1641 unsigned ECCPASE : 1;
1644 struct
1646 unsigned PSSBD : 2;
1647 unsigned : 6;
1650 struct
1652 unsigned : 2;
1653 unsigned PSSAC : 2;
1654 unsigned : 4;
1657 struct
1659 unsigned : 4;
1660 unsigned ECCPAS : 3;
1661 unsigned : 1;
1663 } __ECCP1ASbits_t;
1665 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits;
1667 #define _PSSBD0 0x01
1668 #define _PSSBD1 0x02
1669 #define _PSSAC0 0x04
1670 #define _PSSAC1 0x08
1671 #define _ECCPAS0 0x10
1672 #define _ECCPAS1 0x20
1673 #define _ECCPAS2 0x40
1674 #define _ECCPASE 0x80
1676 //==============================================================================
1679 //==============================================================================
1680 // PWM1CON Bits
1682 extern __at(0x0FB7) __sfr PWM1CON;
1684 typedef union
1686 struct
1688 unsigned PDC0 : 1;
1689 unsigned PDC1 : 1;
1690 unsigned PDC2 : 1;
1691 unsigned PDC3 : 1;
1692 unsigned PDC4 : 1;
1693 unsigned PDC5 : 1;
1694 unsigned PDC6 : 1;
1695 unsigned PRSEN : 1;
1698 struct
1700 unsigned PDC : 7;
1701 unsigned : 1;
1703 } __PWM1CONbits_t;
1705 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1707 #define _PDC0 0x01
1708 #define _PDC1 0x02
1709 #define _PDC2 0x04
1710 #define _PDC3 0x08
1711 #define _PDC4 0x10
1712 #define _PDC5 0x20
1713 #define _PDC6 0x40
1714 #define _PRSEN 0x80
1716 //==============================================================================
1719 //==============================================================================
1720 // BAUDCON Bits
1722 extern __at(0x0FB8) __sfr BAUDCON;
1724 typedef union
1726 struct
1728 unsigned ABDEN : 1;
1729 unsigned WUE : 1;
1730 unsigned : 1;
1731 unsigned BRG16 : 1;
1732 unsigned CKTXP : 1;
1733 unsigned DTRXP : 1;
1734 unsigned RCIDL : 1;
1735 unsigned ABDOVF : 1;
1738 struct
1740 unsigned : 1;
1741 unsigned : 1;
1742 unsigned : 1;
1743 unsigned : 1;
1744 unsigned SCKP : 1;
1745 unsigned : 1;
1746 unsigned : 1;
1747 unsigned : 1;
1749 } __BAUDCONbits_t;
1751 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1753 #define _ABDEN 0x01
1754 #define _WUE 0x02
1755 #define _BRG16 0x08
1756 #define _CKTXP 0x10
1757 #define _SCKP 0x10
1758 #define _DTRXP 0x20
1759 #define _RCIDL 0x40
1760 #define _ABDOVF 0x80
1762 //==============================================================================
1765 //==============================================================================
1766 // BAUDCTL Bits
1768 extern __at(0x0FB8) __sfr BAUDCTL;
1770 typedef union
1772 struct
1774 unsigned ABDEN : 1;
1775 unsigned WUE : 1;
1776 unsigned : 1;
1777 unsigned BRG16 : 1;
1778 unsigned CKTXP : 1;
1779 unsigned DTRXP : 1;
1780 unsigned RCIDL : 1;
1781 unsigned ABDOVF : 1;
1784 struct
1786 unsigned : 1;
1787 unsigned : 1;
1788 unsigned : 1;
1789 unsigned : 1;
1790 unsigned SCKP : 1;
1791 unsigned : 1;
1792 unsigned : 1;
1793 unsigned : 1;
1795 } __BAUDCTLbits_t;
1797 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1799 #define _BAUDCTL_ABDEN 0x01
1800 #define _BAUDCTL_WUE 0x02
1801 #define _BAUDCTL_BRG16 0x08
1802 #define _BAUDCTL_CKTXP 0x10
1803 #define _BAUDCTL_SCKP 0x10
1804 #define _BAUDCTL_DTRXP 0x20
1805 #define _BAUDCTL_RCIDL 0x40
1806 #define _BAUDCTL_ABDOVF 0x80
1808 //==============================================================================
1811 //==============================================================================
1812 // PSTRCON Bits
1814 extern __at(0x0FB9) __sfr PSTRCON;
1816 typedef struct
1818 unsigned STRA : 1;
1819 unsigned STRB : 1;
1820 unsigned STRC : 1;
1821 unsigned STRD : 1;
1822 unsigned STRSYNC : 1;
1823 unsigned : 1;
1824 unsigned : 1;
1825 unsigned : 1;
1826 } __PSTRCONbits_t;
1828 extern __at(0x0FB9) volatile __PSTRCONbits_t PSTRCONbits;
1830 #define _STRA 0x01
1831 #define _STRB 0x02
1832 #define _STRC 0x04
1833 #define _STRD 0x08
1834 #define _STRSYNC 0x10
1836 //==============================================================================
1839 //==============================================================================
1840 // REFCON0 Bits
1842 extern __at(0x0FBA) __sfr REFCON0;
1844 typedef union
1846 struct
1848 unsigned : 1;
1849 unsigned : 1;
1850 unsigned : 1;
1851 unsigned : 1;
1852 unsigned FVR1S0 : 1;
1853 unsigned FVR1S1 : 1;
1854 unsigned FVR1ST : 1;
1855 unsigned FVR1EN : 1;
1858 struct
1860 unsigned : 4;
1861 unsigned FVR1S : 2;
1862 unsigned : 2;
1864 } __REFCON0bits_t;
1866 extern __at(0x0FBA) volatile __REFCON0bits_t REFCON0bits;
1868 #define _FVR1S0 0x10
1869 #define _FVR1S1 0x20
1870 #define _FVR1ST 0x40
1871 #define _FVR1EN 0x80
1873 //==============================================================================
1876 //==============================================================================
1877 // VREFCON0 Bits
1879 extern __at(0x0FBA) __sfr VREFCON0;
1881 typedef union
1883 struct
1885 unsigned : 1;
1886 unsigned : 1;
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned FVR1S0 : 1;
1890 unsigned FVR1S1 : 1;
1891 unsigned FVR1ST : 1;
1892 unsigned FVR1EN : 1;
1895 struct
1897 unsigned : 4;
1898 unsigned FVR1S : 2;
1899 unsigned : 2;
1901 } __VREFCON0bits_t;
1903 extern __at(0x0FBA) volatile __VREFCON0bits_t VREFCON0bits;
1905 #define _VREFCON0_FVR1S0 0x10
1906 #define _VREFCON0_FVR1S1 0x20
1907 #define _VREFCON0_FVR1ST 0x40
1908 #define _VREFCON0_FVR1EN 0x80
1910 //==============================================================================
1913 //==============================================================================
1914 // REFCON1 Bits
1916 extern __at(0x0FBB) __sfr REFCON1;
1918 typedef union
1920 struct
1922 unsigned D1NSS : 1;
1923 unsigned : 1;
1924 unsigned D1PSS0 : 1;
1925 unsigned D1PSS1 : 1;
1926 unsigned : 1;
1927 unsigned DAC1OE : 1;
1928 unsigned D1LPS : 1;
1929 unsigned D1EN : 1;
1932 struct
1934 unsigned D1NSS0 : 1;
1935 unsigned : 1;
1936 unsigned : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned : 1;
1940 unsigned : 1;
1941 unsigned : 1;
1944 struct
1946 unsigned : 2;
1947 unsigned D1PSS : 2;
1948 unsigned : 4;
1950 } __REFCON1bits_t;
1952 extern __at(0x0FBB) volatile __REFCON1bits_t REFCON1bits;
1954 #define _D1NSS 0x01
1955 #define _D1NSS0 0x01
1956 #define _D1PSS0 0x04
1957 #define _D1PSS1 0x08
1958 #define _DAC1OE 0x20
1959 #define _D1LPS 0x40
1960 #define _D1EN 0x80
1962 //==============================================================================
1965 //==============================================================================
1966 // VREFCON1 Bits
1968 extern __at(0x0FBB) __sfr VREFCON1;
1970 typedef union
1972 struct
1974 unsigned D1NSS : 1;
1975 unsigned : 1;
1976 unsigned D1PSS0 : 1;
1977 unsigned D1PSS1 : 1;
1978 unsigned : 1;
1979 unsigned DAC1OE : 1;
1980 unsigned D1LPS : 1;
1981 unsigned D1EN : 1;
1984 struct
1986 unsigned D1NSS0 : 1;
1987 unsigned : 1;
1988 unsigned : 1;
1989 unsigned : 1;
1990 unsigned : 1;
1991 unsigned : 1;
1992 unsigned : 1;
1993 unsigned : 1;
1996 struct
1998 unsigned : 2;
1999 unsigned D1PSS : 2;
2000 unsigned : 4;
2002 } __VREFCON1bits_t;
2004 extern __at(0x0FBB) volatile __VREFCON1bits_t VREFCON1bits;
2006 #define _VREFCON1_D1NSS 0x01
2007 #define _VREFCON1_D1NSS0 0x01
2008 #define _VREFCON1_D1PSS0 0x04
2009 #define _VREFCON1_D1PSS1 0x08
2010 #define _VREFCON1_DAC1OE 0x20
2011 #define _VREFCON1_D1LPS 0x40
2012 #define _VREFCON1_D1EN 0x80
2014 //==============================================================================
2017 //==============================================================================
2018 // REFCON2 Bits
2020 extern __at(0x0FBC) __sfr REFCON2;
2022 typedef union
2024 struct
2026 unsigned DAC1R0 : 1;
2027 unsigned DAC1R1 : 1;
2028 unsigned DAC1R2 : 1;
2029 unsigned DAC1R3 : 1;
2030 unsigned DAC1R4 : 1;
2031 unsigned : 1;
2032 unsigned : 1;
2033 unsigned : 1;
2036 struct
2038 unsigned DAC1R : 5;
2039 unsigned : 3;
2041 } __REFCON2bits_t;
2043 extern __at(0x0FBC) volatile __REFCON2bits_t REFCON2bits;
2045 #define _DAC1R0 0x01
2046 #define _DAC1R1 0x02
2047 #define _DAC1R2 0x04
2048 #define _DAC1R3 0x08
2049 #define _DAC1R4 0x10
2051 //==============================================================================
2054 //==============================================================================
2055 // VREFCON2 Bits
2057 extern __at(0x0FBC) __sfr VREFCON2;
2059 typedef union
2061 struct
2063 unsigned DAC1R0 : 1;
2064 unsigned DAC1R1 : 1;
2065 unsigned DAC1R2 : 1;
2066 unsigned DAC1R3 : 1;
2067 unsigned DAC1R4 : 1;
2068 unsigned : 1;
2069 unsigned : 1;
2070 unsigned : 1;
2073 struct
2075 unsigned DAC1R : 5;
2076 unsigned : 3;
2078 } __VREFCON2bits_t;
2080 extern __at(0x0FBC) volatile __VREFCON2bits_t VREFCON2bits;
2082 #define _VREFCON2_DAC1R0 0x01
2083 #define _VREFCON2_DAC1R1 0x02
2084 #define _VREFCON2_DAC1R2 0x04
2085 #define _VREFCON2_DAC1R3 0x08
2086 #define _VREFCON2_DAC1R4 0x10
2088 //==============================================================================
2091 //==============================================================================
2092 // CCP1CON Bits
2094 extern __at(0x0FBD) __sfr CCP1CON;
2096 typedef union
2098 struct
2100 unsigned CCP1M0 : 1;
2101 unsigned CCP1M1 : 1;
2102 unsigned CCP1M2 : 1;
2103 unsigned CCP1M3 : 1;
2104 unsigned DC1B0 : 1;
2105 unsigned DC1B1 : 1;
2106 unsigned P1M0 : 1;
2107 unsigned P1M1 : 1;
2110 struct
2112 unsigned CCP1M : 4;
2113 unsigned : 4;
2116 struct
2118 unsigned : 4;
2119 unsigned DC1B : 2;
2120 unsigned : 2;
2123 struct
2125 unsigned : 6;
2126 unsigned P1M : 2;
2128 } __CCP1CONbits_t;
2130 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
2132 #define _CCP1M0 0x01
2133 #define _CCP1M1 0x02
2134 #define _CCP1M2 0x04
2135 #define _CCP1M3 0x08
2136 #define _DC1B0 0x10
2137 #define _DC1B1 0x20
2138 #define _P1M0 0x40
2139 #define _P1M1 0x80
2141 //==============================================================================
2143 extern __at(0x0FBE) __sfr CCPR1;
2144 extern __at(0x0FBE) __sfr CCPR1L;
2145 extern __at(0x0FBF) __sfr CCPR1H;
2147 //==============================================================================
2148 // ADCON2 Bits
2150 extern __at(0x0FC0) __sfr ADCON2;
2152 typedef union
2154 struct
2156 unsigned ADCS0 : 1;
2157 unsigned ADCS1 : 1;
2158 unsigned ADCS2 : 1;
2159 unsigned ACQT0 : 1;
2160 unsigned ACQT1 : 1;
2161 unsigned ACQT2 : 1;
2162 unsigned : 1;
2163 unsigned ADFM : 1;
2166 struct
2168 unsigned ADCS : 3;
2169 unsigned : 5;
2172 struct
2174 unsigned : 3;
2175 unsigned ACQT : 3;
2176 unsigned : 2;
2178 } __ADCON2bits_t;
2180 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2182 #define _ADCS0 0x01
2183 #define _ADCS1 0x02
2184 #define _ADCS2 0x04
2185 #define _ACQT0 0x08
2186 #define _ACQT1 0x10
2187 #define _ACQT2 0x20
2188 #define _ADFM 0x80
2190 //==============================================================================
2193 //==============================================================================
2194 // ADCON1 Bits
2196 extern __at(0x0FC1) __sfr ADCON1;
2198 typedef union
2200 struct
2202 unsigned NVCFG0 : 1;
2203 unsigned NVCFG1 : 1;
2204 unsigned PVCFG0 : 1;
2205 unsigned PVCFG1 : 1;
2206 unsigned : 1;
2207 unsigned : 1;
2208 unsigned : 1;
2209 unsigned : 1;
2212 struct
2214 unsigned NVCFG : 2;
2215 unsigned : 6;
2218 struct
2220 unsigned : 2;
2221 unsigned PVCFG : 2;
2222 unsigned : 4;
2224 } __ADCON1bits_t;
2226 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2228 #define _NVCFG0 0x01
2229 #define _NVCFG1 0x02
2230 #define _PVCFG0 0x04
2231 #define _PVCFG1 0x08
2233 //==============================================================================
2236 //==============================================================================
2237 // ADCON0 Bits
2239 extern __at(0x0FC2) __sfr ADCON0;
2241 typedef union
2243 struct
2245 unsigned ADON : 1;
2246 unsigned GO_NOT_DONE : 1;
2247 unsigned CHS0 : 1;
2248 unsigned CHS1 : 1;
2249 unsigned CHS2 : 1;
2250 unsigned CHS3 : 1;
2251 unsigned : 1;
2252 unsigned : 1;
2255 struct
2257 unsigned : 1;
2258 unsigned DONE : 1;
2259 unsigned : 1;
2260 unsigned : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned : 1;
2264 unsigned : 1;
2267 struct
2269 unsigned : 1;
2270 unsigned NOT_DONE : 1;
2271 unsigned : 1;
2272 unsigned : 1;
2273 unsigned : 1;
2274 unsigned : 1;
2275 unsigned : 1;
2276 unsigned : 1;
2279 struct
2281 unsigned : 1;
2282 unsigned GO_DONE : 1;
2283 unsigned : 1;
2284 unsigned : 1;
2285 unsigned : 1;
2286 unsigned : 1;
2287 unsigned : 1;
2288 unsigned : 1;
2291 struct
2293 unsigned : 1;
2294 unsigned GO : 1;
2295 unsigned : 1;
2296 unsigned : 1;
2297 unsigned : 1;
2298 unsigned : 1;
2299 unsigned : 1;
2300 unsigned : 1;
2303 struct
2305 unsigned : 2;
2306 unsigned CHS : 4;
2307 unsigned : 2;
2309 } __ADCON0bits_t;
2311 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2313 #define _ADON 0x01
2314 #define _GO_NOT_DONE 0x02
2315 #define _DONE 0x02
2316 #define _NOT_DONE 0x02
2317 #define _GO_DONE 0x02
2318 #define _GO 0x02
2319 #define _CHS0 0x04
2320 #define _CHS1 0x08
2321 #define _CHS2 0x10
2322 #define _CHS3 0x20
2324 //==============================================================================
2326 extern __at(0x0FC3) __sfr ADRES;
2327 extern __at(0x0FC3) __sfr ADRESL;
2328 extern __at(0x0FC4) __sfr ADRESH;
2330 //==============================================================================
2331 // SSPCON2 Bits
2333 extern __at(0x0FC5) __sfr SSPCON2;
2335 typedef struct
2337 unsigned SEN : 1;
2338 unsigned RSEN : 1;
2339 unsigned PEN : 1;
2340 unsigned RCEN : 1;
2341 unsigned ACKEN : 1;
2342 unsigned ACKDT : 1;
2343 unsigned ACKSTAT : 1;
2344 unsigned GCEN : 1;
2345 } __SSPCON2bits_t;
2347 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
2349 #define _SEN 0x01
2350 #define _RSEN 0x02
2351 #define _PEN 0x04
2352 #define _RCEN 0x08
2353 #define _ACKEN 0x10
2354 #define _ACKDT 0x20
2355 #define _ACKSTAT 0x40
2356 #define _GCEN 0x80
2358 //==============================================================================
2361 //==============================================================================
2362 // SSPCON1 Bits
2364 extern __at(0x0FC6) __sfr SSPCON1;
2366 typedef union
2368 struct
2370 unsigned SSPM0 : 1;
2371 unsigned SSPM1 : 1;
2372 unsigned SSPM2 : 1;
2373 unsigned SSPM3 : 1;
2374 unsigned CKP : 1;
2375 unsigned SSPEN : 1;
2376 unsigned SSPOV : 1;
2377 unsigned WCOL : 1;
2380 struct
2382 unsigned SSPM : 4;
2383 unsigned : 4;
2385 } __SSPCON1bits_t;
2387 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
2389 #define _SSPM0 0x01
2390 #define _SSPM1 0x02
2391 #define _SSPM2 0x04
2392 #define _SSPM3 0x08
2393 #define _CKP 0x10
2394 #define _SSPEN 0x20
2395 #define _SSPOV 0x40
2396 #define _WCOL 0x80
2398 //==============================================================================
2401 //==============================================================================
2402 // SSPSTAT Bits
2404 extern __at(0x0FC7) __sfr SSPSTAT;
2406 typedef union
2408 struct
2410 unsigned BF : 1;
2411 unsigned UA : 1;
2412 unsigned R_NOT_W : 1;
2413 unsigned S : 1;
2414 unsigned P : 1;
2415 unsigned D_NOT_A : 1;
2416 unsigned CKE : 1;
2417 unsigned SMP : 1;
2420 struct
2422 unsigned : 1;
2423 unsigned : 1;
2424 unsigned R : 1;
2425 unsigned : 1;
2426 unsigned : 1;
2427 unsigned D : 1;
2428 unsigned : 1;
2429 unsigned : 1;
2432 struct
2434 unsigned : 1;
2435 unsigned : 1;
2436 unsigned NOT_W : 1;
2437 unsigned : 1;
2438 unsigned : 1;
2439 unsigned NOT_A : 1;
2440 unsigned : 1;
2441 unsigned : 1;
2444 struct
2446 unsigned : 1;
2447 unsigned : 1;
2448 unsigned R_W : 1;
2449 unsigned : 1;
2450 unsigned : 1;
2451 unsigned D_A : 1;
2452 unsigned : 1;
2453 unsigned : 1;
2456 struct
2458 unsigned : 1;
2459 unsigned : 1;
2460 unsigned NOT_WRITE : 1;
2461 unsigned : 1;
2462 unsigned : 1;
2463 unsigned NOT_ADDRESS : 1;
2464 unsigned : 1;
2465 unsigned : 1;
2467 } __SSPSTATbits_t;
2469 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
2471 #define _BF 0x01
2472 #define _UA 0x02
2473 #define _R_NOT_W 0x04
2474 #define _R 0x04
2475 #define _NOT_W 0x04
2476 #define _R_W 0x04
2477 #define _NOT_WRITE 0x04
2478 #define _S 0x08
2479 #define _P 0x10
2480 #define _D_NOT_A 0x20
2481 #define _D 0x20
2482 #define _NOT_A 0x20
2483 #define _D_A 0x20
2484 #define _NOT_ADDRESS 0x20
2485 #define _CKE 0x40
2486 #define _SMP 0x80
2488 //==============================================================================
2490 extern __at(0x0FC8) __sfr SSPADD;
2491 extern __at(0x0FC9) __sfr SSPBUF;
2493 //==============================================================================
2494 // T2CON Bits
2496 extern __at(0x0FCA) __sfr T2CON;
2498 typedef union
2500 struct
2502 unsigned T2CKPS0 : 1;
2503 unsigned T2CKPS1 : 1;
2504 unsigned TMR2ON : 1;
2505 unsigned T2OUTPS0 : 1;
2506 unsigned T2OUTPS1 : 1;
2507 unsigned T2OUTPS2 : 1;
2508 unsigned T2OUTPS3 : 1;
2509 unsigned : 1;
2512 struct
2514 unsigned T2CKPS : 2;
2515 unsigned : 6;
2518 struct
2520 unsigned : 3;
2521 unsigned T2OUTPS : 4;
2522 unsigned : 1;
2524 } __T2CONbits_t;
2526 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2528 #define _T2CKPS0 0x01
2529 #define _T2CKPS1 0x02
2530 #define _TMR2ON 0x04
2531 #define _T2OUTPS0 0x08
2532 #define _T2OUTPS1 0x10
2533 #define _T2OUTPS2 0x20
2534 #define _T2OUTPS3 0x40
2536 //==============================================================================
2538 extern __at(0x0FCB) __sfr PR2;
2539 extern __at(0x0FCC) __sfr TMR2;
2541 //==============================================================================
2542 // T1CON Bits
2544 extern __at(0x0FCD) __sfr T1CON;
2546 typedef union
2548 struct
2550 unsigned TMR1ON : 1;
2551 unsigned TMR1CS : 1;
2552 unsigned NOT_T1SYNC : 1;
2553 unsigned T1OSCEN : 1;
2554 unsigned T1CKPS0 : 1;
2555 unsigned T1CKPS1 : 1;
2556 unsigned T1RUN : 1;
2557 unsigned RD16 : 1;
2560 struct
2562 unsigned : 1;
2563 unsigned : 1;
2564 unsigned T1SYNC : 1;
2565 unsigned : 1;
2566 unsigned : 1;
2567 unsigned : 1;
2568 unsigned : 1;
2569 unsigned : 1;
2572 struct
2574 unsigned : 4;
2575 unsigned T1CKPS : 2;
2576 unsigned : 2;
2578 } __T1CONbits_t;
2580 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2582 #define _TMR1ON 0x01
2583 #define _TMR1CS 0x02
2584 #define _NOT_T1SYNC 0x04
2585 #define _T1SYNC 0x04
2586 #define _T1OSCEN 0x08
2587 #define _T1CKPS0 0x10
2588 #define _T1CKPS1 0x20
2589 #define _T1RUN 0x40
2590 #define _RD16 0x80
2592 //==============================================================================
2594 extern __at(0x0FCE) __sfr TMR1;
2595 extern __at(0x0FCE) __sfr TMR1L;
2596 extern __at(0x0FCF) __sfr TMR1H;
2598 //==============================================================================
2599 // RCON Bits
2601 extern __at(0x0FD0) __sfr RCON;
2603 typedef union
2605 struct
2607 unsigned NOT_BOR : 1;
2608 unsigned NOT_POR : 1;
2609 unsigned NOT_PD : 1;
2610 unsigned NOT_TO : 1;
2611 unsigned NOT_RI : 1;
2612 unsigned : 1;
2613 unsigned SBOREN : 1;
2614 unsigned IPEN : 1;
2617 struct
2619 unsigned BOR : 1;
2620 unsigned POR : 1;
2621 unsigned PD : 1;
2622 unsigned TO : 1;
2623 unsigned RI : 1;
2624 unsigned : 1;
2625 unsigned : 1;
2626 unsigned : 1;
2628 } __RCONbits_t;
2630 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2632 #define _NOT_BOR 0x01
2633 #define _BOR 0x01
2634 #define _NOT_POR 0x02
2635 #define _POR 0x02
2636 #define _NOT_PD 0x04
2637 #define _PD 0x04
2638 #define _NOT_TO 0x08
2639 #define _TO 0x08
2640 #define _NOT_RI 0x10
2641 #define _RI 0x10
2642 #define _SBOREN 0x40
2643 #define _IPEN 0x80
2645 //==============================================================================
2648 //==============================================================================
2649 // WDTCON Bits
2651 extern __at(0x0FD1) __sfr WDTCON;
2653 typedef union
2655 struct
2657 unsigned SWDTEN : 1;
2658 unsigned : 1;
2659 unsigned : 1;
2660 unsigned : 1;
2661 unsigned : 1;
2662 unsigned : 1;
2663 unsigned : 1;
2664 unsigned : 1;
2667 struct
2669 unsigned SWDTE : 1;
2670 unsigned : 1;
2671 unsigned : 1;
2672 unsigned : 1;
2673 unsigned : 1;
2674 unsigned : 1;
2675 unsigned : 1;
2676 unsigned : 1;
2678 } __WDTCONbits_t;
2680 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2682 #define _SWDTEN 0x01
2683 #define _SWDTE 0x01
2685 //==============================================================================
2688 //==============================================================================
2689 // OSCCON2 Bits
2691 extern __at(0x0FD2) __sfr OSCCON2;
2693 typedef struct
2695 unsigned LFIOFS : 1;
2696 unsigned HFIOFL : 1;
2697 unsigned PRI_SD : 1;
2698 unsigned : 1;
2699 unsigned : 1;
2700 unsigned : 1;
2701 unsigned : 1;
2702 unsigned : 1;
2703 } __OSCCON2bits_t;
2705 extern __at(0x0FD2) volatile __OSCCON2bits_t OSCCON2bits;
2707 #define _LFIOFS 0x01
2708 #define _HFIOFL 0x02
2709 #define _PRI_SD 0x04
2711 //==============================================================================
2714 //==============================================================================
2715 // OSCCON Bits
2717 extern __at(0x0FD3) __sfr OSCCON;
2719 typedef union
2721 struct
2723 unsigned SCS0 : 1;
2724 unsigned SCS1 : 1;
2725 unsigned HFIOFS : 1;
2726 unsigned OSTS : 1;
2727 unsigned IRCF0 : 1;
2728 unsigned IRCF1 : 1;
2729 unsigned IRCF2 : 1;
2730 unsigned IDLEN : 1;
2733 struct
2735 unsigned : 1;
2736 unsigned : 1;
2737 unsigned FLTS : 1;
2738 unsigned : 1;
2739 unsigned : 1;
2740 unsigned : 1;
2741 unsigned : 1;
2742 unsigned : 1;
2745 struct
2747 unsigned SCS : 2;
2748 unsigned : 6;
2751 struct
2753 unsigned : 4;
2754 unsigned IRCF : 3;
2755 unsigned : 1;
2757 } __OSCCONbits_t;
2759 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2761 #define _SCS0 0x01
2762 #define _SCS1 0x02
2763 #define _HFIOFS 0x04
2764 #define _FLTS 0x04
2765 #define _OSTS 0x08
2766 #define _IRCF0 0x10
2767 #define _IRCF1 0x20
2768 #define _IRCF2 0x40
2769 #define _IDLEN 0x80
2771 //==============================================================================
2774 //==============================================================================
2775 // T0CON Bits
2777 extern __at(0x0FD5) __sfr T0CON;
2779 typedef union
2781 struct
2783 unsigned T0PS0 : 1;
2784 unsigned T0PS1 : 1;
2785 unsigned T0PS2 : 1;
2786 unsigned PSA : 1;
2787 unsigned T0SE : 1;
2788 unsigned T0CS : 1;
2789 unsigned T08BIT : 1;
2790 unsigned TMR0ON : 1;
2793 struct
2795 unsigned T0PS : 3;
2796 unsigned : 5;
2798 } __T0CONbits_t;
2800 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2802 #define _T0PS0 0x01
2803 #define _T0PS1 0x02
2804 #define _T0PS2 0x04
2805 #define _PSA 0x08
2806 #define _T0SE 0x10
2807 #define _T0CS 0x20
2808 #define _T08BIT 0x40
2809 #define _TMR0ON 0x80
2811 //==============================================================================
2813 extern __at(0x0FD6) __sfr TMR0;
2814 extern __at(0x0FD6) __sfr TMR0L;
2815 extern __at(0x0FD7) __sfr TMR0H;
2817 //==============================================================================
2818 // STATUS Bits
2820 extern __at(0x0FD8) __sfr STATUS;
2822 typedef struct
2824 unsigned C : 1;
2825 unsigned DC : 1;
2826 unsigned Z : 1;
2827 unsigned OV : 1;
2828 unsigned N : 1;
2829 unsigned : 1;
2830 unsigned : 1;
2831 unsigned : 1;
2832 } __STATUSbits_t;
2834 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2836 #define _C 0x01
2837 #define _DC 0x02
2838 #define _Z 0x04
2839 #define _OV 0x08
2840 #define _N 0x10
2842 //==============================================================================
2844 extern __at(0x0FD9) __sfr FSR2L;
2845 extern __at(0x0FDA) __sfr FSR2H;
2846 extern __at(0x0FDB) __sfr PLUSW2;
2847 extern __at(0x0FDC) __sfr PREINC2;
2848 extern __at(0x0FDD) __sfr POSTDEC2;
2849 extern __at(0x0FDE) __sfr POSTINC2;
2850 extern __at(0x0FDF) __sfr INDF2;
2851 extern __at(0x0FE0) __sfr BSR;
2852 extern __at(0x0FE1) __sfr FSR1L;
2853 extern __at(0x0FE2) __sfr FSR1H;
2854 extern __at(0x0FE3) __sfr PLUSW1;
2855 extern __at(0x0FE4) __sfr PREINC1;
2856 extern __at(0x0FE5) __sfr POSTDEC1;
2857 extern __at(0x0FE6) __sfr POSTINC1;
2858 extern __at(0x0FE7) __sfr INDF1;
2859 extern __at(0x0FE8) __sfr WREG;
2860 extern __at(0x0FE9) __sfr FSR0L;
2861 extern __at(0x0FEA) __sfr FSR0H;
2862 extern __at(0x0FEB) __sfr PLUSW0;
2863 extern __at(0x0FEC) __sfr PREINC0;
2864 extern __at(0x0FED) __sfr POSTDEC0;
2865 extern __at(0x0FEE) __sfr POSTINC0;
2866 extern __at(0x0FEF) __sfr INDF0;
2868 //==============================================================================
2869 // INTCON3 Bits
2871 extern __at(0x0FF0) __sfr INTCON3;
2873 typedef union
2875 struct
2877 unsigned INT1IF : 1;
2878 unsigned INT2IF : 1;
2879 unsigned : 1;
2880 unsigned INT1IE : 1;
2881 unsigned INT2IE : 1;
2882 unsigned : 1;
2883 unsigned INT1IP : 1;
2884 unsigned INT2IP : 1;
2887 struct
2889 unsigned INT1F : 1;
2890 unsigned INT2F : 1;
2891 unsigned : 1;
2892 unsigned INT1E : 1;
2893 unsigned INT2E : 1;
2894 unsigned : 1;
2895 unsigned INT1P : 1;
2896 unsigned INT2P : 1;
2898 } __INTCON3bits_t;
2900 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2902 #define _INT1IF 0x01
2903 #define _INT1F 0x01
2904 #define _INT2IF 0x02
2905 #define _INT2F 0x02
2906 #define _INT1IE 0x08
2907 #define _INT1E 0x08
2908 #define _INT2IE 0x10
2909 #define _INT2E 0x10
2910 #define _INT1IP 0x40
2911 #define _INT1P 0x40
2912 #define _INT2IP 0x80
2913 #define _INT2P 0x80
2915 //==============================================================================
2918 //==============================================================================
2919 // INTCON2 Bits
2921 extern __at(0x0FF1) __sfr INTCON2;
2923 typedef union
2925 struct
2927 unsigned RABIP : 1;
2928 unsigned : 1;
2929 unsigned TMR0IP : 1;
2930 unsigned : 1;
2931 unsigned INTEDG2 : 1;
2932 unsigned INTEDG1 : 1;
2933 unsigned INTEDG0 : 1;
2934 unsigned NOT_RABPU : 1;
2937 struct
2939 unsigned RBIP : 1;
2940 unsigned : 1;
2941 unsigned : 1;
2942 unsigned : 1;
2943 unsigned : 1;
2944 unsigned : 1;
2945 unsigned : 1;
2946 unsigned RABPU : 1;
2949 struct
2951 unsigned : 1;
2952 unsigned : 1;
2953 unsigned : 1;
2954 unsigned : 1;
2955 unsigned : 1;
2956 unsigned : 1;
2957 unsigned : 1;
2958 unsigned NOT_RBPU : 1;
2960 } __INTCON2bits_t;
2962 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2964 #define _RABIP 0x01
2965 #define _RBIP 0x01
2966 #define _TMR0IP 0x04
2967 #define _INTEDG2 0x10
2968 #define _INTEDG1 0x20
2969 #define _INTEDG0 0x40
2970 #define _NOT_RABPU 0x80
2971 #define _RABPU 0x80
2972 #define _NOT_RBPU 0x80
2974 //==============================================================================
2977 //==============================================================================
2978 // INTCON Bits
2980 extern __at(0x0FF2) __sfr INTCON;
2982 typedef union
2984 struct
2986 unsigned RABIF : 1;
2987 unsigned INT0IF : 1;
2988 unsigned TMR0IF : 1;
2989 unsigned RABIE : 1;
2990 unsigned INT0IE : 1;
2991 unsigned TMR0IE : 1;
2992 unsigned PEIE_GIEL : 1;
2993 unsigned GIE_GIEH : 1;
2996 struct
2998 unsigned RBIF : 1;
2999 unsigned INT0F : 1;
3000 unsigned T0IF : 1;
3001 unsigned RBIE : 1;
3002 unsigned INT0E : 1;
3003 unsigned T0IE : 1;
3004 unsigned PEIE : 1;
3005 unsigned GIE : 1;
3008 struct
3010 unsigned : 1;
3011 unsigned : 1;
3012 unsigned : 1;
3013 unsigned : 1;
3014 unsigned : 1;
3015 unsigned : 1;
3016 unsigned GIEL : 1;
3017 unsigned GIEH : 1;
3020 struct
3022 unsigned : 1;
3023 unsigned : 1;
3024 unsigned : 1;
3025 unsigned : 1;
3026 unsigned : 1;
3027 unsigned : 1;
3028 unsigned PIE : 1;
3029 unsigned : 1;
3031 } __INTCONbits_t;
3033 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
3035 #define _RABIF 0x01
3036 #define _RBIF 0x01
3037 #define _INT0IF 0x02
3038 #define _INT0F 0x02
3039 #define _TMR0IF 0x04
3040 #define _T0IF 0x04
3041 #define _RABIE 0x08
3042 #define _RBIE 0x08
3043 #define _INT0IE 0x10
3044 #define _INT0E 0x10
3045 #define _TMR0IE 0x20
3046 #define _T0IE 0x20
3047 #define _PEIE_GIEL 0x40
3048 #define _PEIE 0x40
3049 #define _GIEL 0x40
3050 #define _PIE 0x40
3051 #define _GIE_GIEH 0x80
3052 #define _GIE 0x80
3053 #define _GIEH 0x80
3055 //==============================================================================
3057 extern __at(0x0FF3) __sfr PROD;
3058 extern __at(0x0FF3) __sfr PRODL;
3059 extern __at(0x0FF4) __sfr PRODH;
3060 extern __at(0x0FF5) __sfr TABLAT;
3061 extern __at(0x0FF6) __sfr TBLPTR;
3062 extern __at(0x0FF6) __sfr TBLPTRL;
3063 extern __at(0x0FF7) __sfr TBLPTRH;
3064 extern __at(0x0FF8) __sfr TBLPTRU;
3065 extern __at(0x0FF9) __sfr PC;
3066 extern __at(0x0FF9) __sfr PCL;
3067 extern __at(0x0FFA) __sfr PCLATH;
3068 extern __at(0x0FFB) __sfr PCLATU;
3070 //==============================================================================
3071 // STKPTR Bits
3073 extern __at(0x0FFC) __sfr STKPTR;
3075 typedef union
3077 struct
3079 unsigned SP0 : 1;
3080 unsigned SP1 : 1;
3081 unsigned SP2 : 1;
3082 unsigned SP3 : 1;
3083 unsigned SP4 : 1;
3084 unsigned : 1;
3085 unsigned STKUNF : 1;
3086 unsigned STKOVF : 1;
3089 struct
3091 unsigned : 1;
3092 unsigned : 1;
3093 unsigned : 1;
3094 unsigned : 1;
3095 unsigned : 1;
3096 unsigned : 1;
3097 unsigned : 1;
3098 unsigned STKFUL : 1;
3101 struct
3103 unsigned SP : 5;
3104 unsigned : 3;
3106 } __STKPTRbits_t;
3108 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
3110 #define _SP0 0x01
3111 #define _SP1 0x02
3112 #define _SP2 0x04
3113 #define _SP3 0x08
3114 #define _SP4 0x10
3115 #define _STKUNF 0x40
3116 #define _STKOVF 0x80
3117 #define _STKFUL 0x80
3119 //==============================================================================
3121 extern __at(0x0FFD) __sfr TOS;
3122 extern __at(0x0FFD) __sfr TOSL;
3123 extern __at(0x0FFE) __sfr TOSH;
3124 extern __at(0x0FFF) __sfr TOSU;
3126 //==============================================================================
3128 // Configuration Bits
3130 //==============================================================================
3132 #define __CONFIG1H 0x300001
3133 #define __CONFIG2L 0x300002
3134 #define __CONFIG2H 0x300003
3135 #define __CONFIG3H 0x300005
3136 #define __CONFIG4L 0x300006
3137 #define __CONFIG5L 0x300008
3138 #define __CONFIG5H 0x300009
3139 #define __CONFIG6L 0x30000A
3140 #define __CONFIG6H 0x30000B
3141 #define __CONFIG7L 0x30000C
3142 #define __CONFIG7H 0x30000D
3144 //----------------------------- CONFIG1H Options -------------------------------
3146 #define _FOSC_LP_1H 0xF0 // LP oscillator.
3147 #define _FOSC_XT_1H 0xF1 // XT oscillator.
3148 #define _FOSC_HS_1H 0xF2 // HS oscillator.
3149 #define _FOSC_ERCCLKOUT_1H 0xF3 // External RC oscillator, CLKOUT function on OSC2.
3150 #define _FOSC_ECCLKOUTH_1H 0xF4 // EC, CLKOUT function on OSC2 (high).
3151 #define _FOSC_ECH_1H 0xF5 // EC (high).
3152 #define _FOSC_ERC_1H 0xF7 // External RC oscillator.
3153 #define _FOSC_IRC_1H 0xF8 // Internal RC oscillator.
3154 #define _FOSC_IRCCLKOUT_1H 0xF9 // Internal RC oscillator, CLKOUT function on OSC2.
3155 #define _FOSC_ECCLKOUTM_1H 0xFA // EC, CLKOUT function on OSC2 (medium).
3156 #define _FOSC_ECM_1H 0xFB // EC (medium).
3157 #define _FOSC_ECCLKOUTL_1H 0xFC // EC, CLKOUT function on OSC2 (low).
3158 #define _FOSC_ECL_1H 0xFD // EC (low).
3159 #define _PLLEN_OFF_1H 0xEF // PLL is under software control.
3160 #define _PLLEN_ON_1H 0xFF // Oscillator multiplied by 4.
3161 #define _PCLKEN_OFF_1H 0xDF // Primary clock is under software control.
3162 #define _PCLKEN_ON_1H 0xFF // Primary clock enabled.
3163 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
3164 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
3165 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
3166 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
3168 //----------------------------- CONFIG2L Options -------------------------------
3170 #define _PWRTEN_ON_2L 0xFE // PWRT enabled.
3171 #define _PWRTEN_OFF_2L 0xFF // PWRT disabled.
3172 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
3173 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
3174 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
3175 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
3176 #define _BORV_30_2L 0xE7 // VBOR set to 3.0 V nominal.
3177 #define _BORV_27_2L 0xEF // VBOR set to 2.7 V nominal.
3178 #define _BORV_22_2L 0xF7 // VBOR set to 2.2 V nominal.
3179 #define _BORV_19_2L 0xFF // VBOR set to 1.9 V nominal.
3181 //----------------------------- CONFIG2H Options -------------------------------
3183 #define _WDTEN_OFF_2H 0xFE // WDT is controlled by SWDTEN bit of the WDTCON register.
3184 #define _WDTEN_ON_2H 0xFF // WDT is always enabled. SWDTEN bit has no effect.
3185 #define _WDTPS_1_2H 0xE1 // 1:1.
3186 #define _WDTPS_2_2H 0xE3 // 1:2.
3187 #define _WDTPS_4_2H 0xE5 // 1:4.
3188 #define _WDTPS_8_2H 0xE7 // 1:8.
3189 #define _WDTPS_16_2H 0xE9 // 1:16.
3190 #define _WDTPS_32_2H 0xEB // 1:32.
3191 #define _WDTPS_64_2H 0xED // 1:64.
3192 #define _WDTPS_128_2H 0xEF // 1:128.
3193 #define _WDTPS_256_2H 0xF1 // 1:256.
3194 #define _WDTPS_512_2H 0xF3 // 1:512.
3195 #define _WDTPS_1024_2H 0xF5 // 1:1024.
3196 #define _WDTPS_2048_2H 0xF7 // 1:2048.
3197 #define _WDTPS_4096_2H 0xF9 // 1:4096.
3198 #define _WDTPS_8192_2H 0xFB // 1:8192.
3199 #define _WDTPS_16384_2H 0xFD // 1:16384.
3200 #define _WDTPS_32768_2H 0xFF // 1:32768.
3202 //----------------------------- CONFIG3H Options -------------------------------
3204 #define _HFOFST_OFF_3H 0xF7 // The system clock is held off until the HFINTOSC is stable.
3205 #define _HFOFST_ON_3H 0xFF // HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.
3206 #define _MCLRE_OFF_3H 0x7F // RA3 input pin enabled; MCLR disabled.
3207 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA3 input pin disabled.
3209 //----------------------------- CONFIG4L Options -------------------------------
3211 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3212 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3213 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3214 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3215 #define _BBSIZ_OFF_4L 0xF7 // 512W boot block size.
3216 #define _BBSIZ_ON_4L 0xFF // 1kW boot block size.
3217 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3218 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3219 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RA0 and RA1 are dedicated to In-Circuit Debug.
3220 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RA0 and RA1 configured as general purpose I/O pins.
3222 //----------------------------- CONFIG5L Options -------------------------------
3224 #define _CP0_ON_5L 0xFE // Block 0 code-protected.
3225 #define _CP0_OFF_5L 0xFF // Block 0 not code-protected.
3226 #define _CP1_ON_5L 0xFD // Block 1 code-protected.
3227 #define _CP1_OFF_5L 0xFF // Block 1 not code-protected.
3229 //----------------------------- CONFIG5H Options -------------------------------
3231 #define _CPB_ON_5H 0xBF // Boot block code-protected.
3232 #define _CPB_OFF_5H 0xFF // Boot block not code-protected.
3233 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
3234 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
3236 //----------------------------- CONFIG6L Options -------------------------------
3238 #define _WRT0_ON_6L 0xFE // Block 0 write-protected.
3239 #define _WRT0_OFF_6L 0xFF // Block 0 not write-protected.
3240 #define _WRT1_ON_6L 0xFD // Block 1 write-protected.
3241 #define _WRT1_OFF_6L 0xFF // Block 1 not write-protected.
3243 //----------------------------- CONFIG6H Options -------------------------------
3245 #define _WRTC_ON_6H 0xDF // Configuration registers write-protected.
3246 #define _WRTC_OFF_6H 0xFF // Configuration registers not write-protected.
3247 #define _WRTB_ON_6H 0xBF // Boot block write-protected.
3248 #define _WRTB_OFF_6H 0xFF // Boot block not write-protected.
3249 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
3250 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
3252 //----------------------------- CONFIG7L Options -------------------------------
3254 #define _EBTR0_ON_7L 0xFE // Block 0 protected from table reads executed in other blocks.
3255 #define _EBTR0_OFF_7L 0xFF // Block 0 not protected from table reads executed in other blocks.
3256 #define _EBTR1_ON_7L 0xFD // Block 1 protected from table reads executed in other blocks.
3257 #define _EBTR1_OFF_7L 0xFF // Block 1 not protected from table reads executed in other blocks.
3259 //----------------------------- CONFIG7H Options -------------------------------
3261 #define _EBTRB_ON_7H 0xBF // Boot block protected from table reads executed in other blocks.
3262 #define _EBTRB_OFF_7H 0xFF // Boot block not protected from table reads executed in other blocks.
3264 //==============================================================================
3266 #define __DEVID1 0x3FFFFE
3267 #define __DEVID2 0x3FFFFF
3269 #define __IDLOC0 0x200000
3270 #define __IDLOC1 0x200001
3271 #define __IDLOC2 0x200002
3272 #define __IDLOC3 0x200003
3273 #define __IDLOC4 0x200004
3274 #define __IDLOC5 0x200005
3275 #define __IDLOC6 0x200006
3276 #define __IDLOC7 0x200007
3278 #endif // #ifndef __PIC18F13K22_H__