struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf2450.h
blob9b9ac4c5068b194c0aa3668091bf6d680388bf46
1 /*
2 * This declarations of the PIC18LF2450 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:24:00 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 __PIC18LF2450_H__
26 #define __PIC18LF2450_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
36 extern __at(0x0F66) __sfr UFRM;
38 //==============================================================================
39 // UFRML Bits
41 extern __at(0x0F66) __sfr UFRML;
43 typedef struct
45 unsigned FRM0 : 1;
46 unsigned FRM1 : 1;
47 unsigned FRM2 : 1;
48 unsigned FRM3 : 1;
49 unsigned FRM4 : 1;
50 unsigned FRM5 : 1;
51 unsigned FRM6 : 1;
52 unsigned FRM7 : 1;
53 } __UFRMLbits_t;
55 extern __at(0x0F66) volatile __UFRMLbits_t UFRMLbits;
57 #define _FRM0 0x01
58 #define _FRM1 0x02
59 #define _FRM2 0x04
60 #define _FRM3 0x08
61 #define _FRM4 0x10
62 #define _FRM5 0x20
63 #define _FRM6 0x40
64 #define _FRM7 0x80
66 //==============================================================================
69 //==============================================================================
70 // UFRMH Bits
72 extern __at(0x0F67) __sfr UFRMH;
74 typedef struct
76 unsigned FRM8 : 1;
77 unsigned FRM9 : 1;
78 unsigned FRM10 : 1;
79 unsigned : 1;
80 unsigned : 1;
81 unsigned : 1;
82 unsigned : 1;
83 unsigned : 1;
84 } __UFRMHbits_t;
86 extern __at(0x0F67) volatile __UFRMHbits_t UFRMHbits;
88 #define _FRM8 0x01
89 #define _FRM9 0x02
90 #define _FRM10 0x04
92 //==============================================================================
95 //==============================================================================
96 // UIR Bits
98 extern __at(0x0F68) __sfr UIR;
100 typedef struct
102 unsigned URSTIF : 1;
103 unsigned UERRIF : 1;
104 unsigned ACTVIF : 1;
105 unsigned TRNIF : 1;
106 unsigned IDLEIF : 1;
107 unsigned STALLIF : 1;
108 unsigned SOFIF : 1;
109 unsigned : 1;
110 } __UIRbits_t;
112 extern __at(0x0F68) volatile __UIRbits_t UIRbits;
114 #define _URSTIF 0x01
115 #define _UERRIF 0x02
116 #define _ACTVIF 0x04
117 #define _TRNIF 0x08
118 #define _IDLEIF 0x10
119 #define _STALLIF 0x20
120 #define _SOFIF 0x40
122 //==============================================================================
125 //==============================================================================
126 // UIE Bits
128 extern __at(0x0F69) __sfr UIE;
130 typedef struct
132 unsigned URSTIE : 1;
133 unsigned UERRIE : 1;
134 unsigned ACTVIE : 1;
135 unsigned TRNIE : 1;
136 unsigned IDLEIE : 1;
137 unsigned STALLIE : 1;
138 unsigned SOFIE : 1;
139 unsigned : 1;
140 } __UIEbits_t;
142 extern __at(0x0F69) volatile __UIEbits_t UIEbits;
144 #define _URSTIE 0x01
145 #define _UERRIE 0x02
146 #define _ACTVIE 0x04
147 #define _TRNIE 0x08
148 #define _IDLEIE 0x10
149 #define _STALLIE 0x20
150 #define _SOFIE 0x40
152 //==============================================================================
155 //==============================================================================
156 // UEIR Bits
158 extern __at(0x0F6A) __sfr UEIR;
160 typedef struct
162 unsigned PIDEF : 1;
163 unsigned CRC5EF : 1;
164 unsigned CRC16EF : 1;
165 unsigned DFN8EF : 1;
166 unsigned BTOEF : 1;
167 unsigned : 1;
168 unsigned : 1;
169 unsigned BTSEF : 1;
170 } __UEIRbits_t;
172 extern __at(0x0F6A) volatile __UEIRbits_t UEIRbits;
174 #define _PIDEF 0x01
175 #define _CRC5EF 0x02
176 #define _CRC16EF 0x04
177 #define _DFN8EF 0x08
178 #define _BTOEF 0x10
179 #define _BTSEF 0x80
181 //==============================================================================
184 //==============================================================================
185 // UEIE Bits
187 extern __at(0x0F6B) __sfr UEIE;
189 typedef struct
191 unsigned PIDEE : 1;
192 unsigned CRC5EE : 1;
193 unsigned CRC16EE : 1;
194 unsigned DFN8EE : 1;
195 unsigned BTOEE : 1;
196 unsigned : 1;
197 unsigned : 1;
198 unsigned BTSEE : 1;
199 } __UEIEbits_t;
201 extern __at(0x0F6B) volatile __UEIEbits_t UEIEbits;
203 #define _PIDEE 0x01
204 #define _CRC5EE 0x02
205 #define _CRC16EE 0x04
206 #define _DFN8EE 0x08
207 #define _BTOEE 0x10
208 #define _BTSEE 0x80
210 //==============================================================================
213 //==============================================================================
214 // USTAT Bits
216 extern __at(0x0F6C) __sfr USTAT;
218 typedef union
220 struct
222 unsigned : 1;
223 unsigned PPBI : 1;
224 unsigned DIR : 1;
225 unsigned ENDP0 : 1;
226 unsigned ENDP1 : 1;
227 unsigned ENDP2 : 1;
228 unsigned ENDP3 : 1;
229 unsigned : 1;
232 struct
234 unsigned : 3;
235 unsigned ENDP : 4;
236 unsigned : 1;
238 } __USTATbits_t;
240 extern __at(0x0F6C) volatile __USTATbits_t USTATbits;
242 #define _PPBI 0x02
243 #define _DIR 0x04
244 #define _ENDP0 0x08
245 #define _ENDP1 0x10
246 #define _ENDP2 0x20
247 #define _ENDP3 0x40
249 //==============================================================================
252 //==============================================================================
253 // UCON Bits
255 extern __at(0x0F6D) __sfr UCON;
257 typedef struct
259 unsigned : 1;
260 unsigned SUSPND : 1;
261 unsigned RESUME : 1;
262 unsigned USBEN : 1;
263 unsigned PKTDIS : 1;
264 unsigned SE0 : 1;
265 unsigned PPBRST : 1;
266 unsigned : 1;
267 } __UCONbits_t;
269 extern __at(0x0F6D) volatile __UCONbits_t UCONbits;
271 #define _SUSPND 0x02
272 #define _RESUME 0x04
273 #define _USBEN 0x08
274 #define _PKTDIS 0x10
275 #define _SE0 0x20
276 #define _PPBRST 0x40
278 //==============================================================================
281 //==============================================================================
282 // UADDR Bits
284 extern __at(0x0F6E) __sfr UADDR;
286 typedef union
288 struct
290 unsigned ADDR0 : 1;
291 unsigned ADDR1 : 1;
292 unsigned ADDR2 : 1;
293 unsigned ADDR3 : 1;
294 unsigned ADDR4 : 1;
295 unsigned ADDR5 : 1;
296 unsigned ADDR6 : 1;
297 unsigned : 1;
300 struct
302 unsigned ADDR : 7;
303 unsigned : 1;
305 } __UADDRbits_t;
307 extern __at(0x0F6E) volatile __UADDRbits_t UADDRbits;
309 #define _ADDR0 0x01
310 #define _ADDR1 0x02
311 #define _ADDR2 0x04
312 #define _ADDR3 0x08
313 #define _ADDR4 0x10
314 #define _ADDR5 0x20
315 #define _ADDR6 0x40
317 //==============================================================================
320 //==============================================================================
321 // UCFG Bits
323 extern __at(0x0F6F) __sfr UCFG;
325 typedef union
327 struct
329 unsigned PPB0 : 1;
330 unsigned PPB1 : 1;
331 unsigned FSEN : 1;
332 unsigned UTRDIS : 1;
333 unsigned UPUEN : 1;
334 unsigned : 1;
335 unsigned UOEMON : 1;
336 unsigned UTEYE : 1;
339 struct
341 unsigned PPB : 2;
342 unsigned : 6;
344 } __UCFGbits_t;
346 extern __at(0x0F6F) volatile __UCFGbits_t UCFGbits;
348 #define _PPB0 0x01
349 #define _PPB1 0x02
350 #define _FSEN 0x04
351 #define _UTRDIS 0x08
352 #define _UPUEN 0x10
353 #define _UOEMON 0x40
354 #define _UTEYE 0x80
356 //==============================================================================
359 //==============================================================================
360 // UEP0 Bits
362 extern __at(0x0F70) __sfr UEP0;
364 typedef struct
366 unsigned EPSTALL : 1;
367 unsigned EPINEN : 1;
368 unsigned EPOUTEN : 1;
369 unsigned EPCONDIS : 1;
370 unsigned EPHSHK : 1;
371 unsigned : 1;
372 unsigned : 1;
373 unsigned : 1;
374 } __UEP0bits_t;
376 extern __at(0x0F70) volatile __UEP0bits_t UEP0bits;
378 #define _EPSTALL 0x01
379 #define _EPINEN 0x02
380 #define _EPOUTEN 0x04
381 #define _EPCONDIS 0x08
382 #define _EPHSHK 0x10
384 //==============================================================================
387 //==============================================================================
388 // UEP1 Bits
390 extern __at(0x0F71) __sfr UEP1;
392 typedef struct
394 unsigned EPSTALL : 1;
395 unsigned EPINEN : 1;
396 unsigned EPOUTEN : 1;
397 unsigned EPCONDIS : 1;
398 unsigned EPHSHK : 1;
399 unsigned : 1;
400 unsigned : 1;
401 unsigned : 1;
402 } __UEP1bits_t;
404 extern __at(0x0F71) volatile __UEP1bits_t UEP1bits;
406 #define _UEP1_EPSTALL 0x01
407 #define _UEP1_EPINEN 0x02
408 #define _UEP1_EPOUTEN 0x04
409 #define _UEP1_EPCONDIS 0x08
410 #define _UEP1_EPHSHK 0x10
412 //==============================================================================
415 //==============================================================================
416 // UEP2 Bits
418 extern __at(0x0F72) __sfr UEP2;
420 typedef struct
422 unsigned EPSTALL : 1;
423 unsigned EPINEN : 1;
424 unsigned EPOUTEN : 1;
425 unsigned EPCONDIS : 1;
426 unsigned EPHSHK : 1;
427 unsigned : 1;
428 unsigned : 1;
429 unsigned : 1;
430 } __UEP2bits_t;
432 extern __at(0x0F72) volatile __UEP2bits_t UEP2bits;
434 #define _UEP2_EPSTALL 0x01
435 #define _UEP2_EPINEN 0x02
436 #define _UEP2_EPOUTEN 0x04
437 #define _UEP2_EPCONDIS 0x08
438 #define _UEP2_EPHSHK 0x10
440 //==============================================================================
443 //==============================================================================
444 // UEP3 Bits
446 extern __at(0x0F73) __sfr UEP3;
448 typedef struct
450 unsigned EPSTALL : 1;
451 unsigned EPINEN : 1;
452 unsigned EPOUTEN : 1;
453 unsigned EPCONDIS : 1;
454 unsigned EPHSHK : 1;
455 unsigned : 1;
456 unsigned : 1;
457 unsigned : 1;
458 } __UEP3bits_t;
460 extern __at(0x0F73) volatile __UEP3bits_t UEP3bits;
462 #define _UEP3_EPSTALL 0x01
463 #define _UEP3_EPINEN 0x02
464 #define _UEP3_EPOUTEN 0x04
465 #define _UEP3_EPCONDIS 0x08
466 #define _UEP3_EPHSHK 0x10
468 //==============================================================================
471 //==============================================================================
472 // UEP4 Bits
474 extern __at(0x0F74) __sfr UEP4;
476 typedef struct
478 unsigned EPSTALL : 1;
479 unsigned EPINEN : 1;
480 unsigned EPOUTEN : 1;
481 unsigned EPCONDIS : 1;
482 unsigned EPHSHK : 1;
483 unsigned : 1;
484 unsigned : 1;
485 unsigned : 1;
486 } __UEP4bits_t;
488 extern __at(0x0F74) volatile __UEP4bits_t UEP4bits;
490 #define _UEP4_EPSTALL 0x01
491 #define _UEP4_EPINEN 0x02
492 #define _UEP4_EPOUTEN 0x04
493 #define _UEP4_EPCONDIS 0x08
494 #define _UEP4_EPHSHK 0x10
496 //==============================================================================
499 //==============================================================================
500 // UEP5 Bits
502 extern __at(0x0F75) __sfr UEP5;
504 typedef struct
506 unsigned EPSTALL : 1;
507 unsigned EPINEN : 1;
508 unsigned EPOUTEN : 1;
509 unsigned EPCONDIS : 1;
510 unsigned EPHSHK : 1;
511 unsigned : 1;
512 unsigned : 1;
513 unsigned : 1;
514 } __UEP5bits_t;
516 extern __at(0x0F75) volatile __UEP5bits_t UEP5bits;
518 #define _UEP5_EPSTALL 0x01
519 #define _UEP5_EPINEN 0x02
520 #define _UEP5_EPOUTEN 0x04
521 #define _UEP5_EPCONDIS 0x08
522 #define _UEP5_EPHSHK 0x10
524 //==============================================================================
527 //==============================================================================
528 // UEP6 Bits
530 extern __at(0x0F76) __sfr UEP6;
532 typedef struct
534 unsigned EPSTALL : 1;
535 unsigned EPINEN : 1;
536 unsigned EPOUTEN : 1;
537 unsigned EPCONDIS : 1;
538 unsigned EPHSHK : 1;
539 unsigned : 1;
540 unsigned : 1;
541 unsigned : 1;
542 } __UEP6bits_t;
544 extern __at(0x0F76) volatile __UEP6bits_t UEP6bits;
546 #define _UEP6_EPSTALL 0x01
547 #define _UEP6_EPINEN 0x02
548 #define _UEP6_EPOUTEN 0x04
549 #define _UEP6_EPCONDIS 0x08
550 #define _UEP6_EPHSHK 0x10
552 //==============================================================================
555 //==============================================================================
556 // UEP7 Bits
558 extern __at(0x0F77) __sfr UEP7;
560 typedef struct
562 unsigned EPSTALL : 1;
563 unsigned EPINEN : 1;
564 unsigned EPOUTEN : 1;
565 unsigned EPCONDIS : 1;
566 unsigned EPHSHK : 1;
567 unsigned : 1;
568 unsigned : 1;
569 unsigned : 1;
570 } __UEP7bits_t;
572 extern __at(0x0F77) volatile __UEP7bits_t UEP7bits;
574 #define _UEP7_EPSTALL 0x01
575 #define _UEP7_EPINEN 0x02
576 #define _UEP7_EPOUTEN 0x04
577 #define _UEP7_EPCONDIS 0x08
578 #define _UEP7_EPHSHK 0x10
580 //==============================================================================
583 //==============================================================================
584 // UEP8 Bits
586 extern __at(0x0F78) __sfr UEP8;
588 typedef struct
590 unsigned EPSTALL : 1;
591 unsigned EPINEN : 1;
592 unsigned EPOUTEN : 1;
593 unsigned EPCONDIS : 1;
594 unsigned EPHSHK : 1;
595 unsigned : 1;
596 unsigned : 1;
597 unsigned : 1;
598 } __UEP8bits_t;
600 extern __at(0x0F78) volatile __UEP8bits_t UEP8bits;
602 #define _UEP8_EPSTALL 0x01
603 #define _UEP8_EPINEN 0x02
604 #define _UEP8_EPOUTEN 0x04
605 #define _UEP8_EPCONDIS 0x08
606 #define _UEP8_EPHSHK 0x10
608 //==============================================================================
611 //==============================================================================
612 // UEP9 Bits
614 extern __at(0x0F79) __sfr UEP9;
616 typedef struct
618 unsigned EPSTALL : 1;
619 unsigned EPINEN : 1;
620 unsigned EPOUTEN : 1;
621 unsigned EPCONDIS : 1;
622 unsigned EPHSHK : 1;
623 unsigned : 1;
624 unsigned : 1;
625 unsigned : 1;
626 } __UEP9bits_t;
628 extern __at(0x0F79) volatile __UEP9bits_t UEP9bits;
630 #define _UEP9_EPSTALL 0x01
631 #define _UEP9_EPINEN 0x02
632 #define _UEP9_EPOUTEN 0x04
633 #define _UEP9_EPCONDIS 0x08
634 #define _UEP9_EPHSHK 0x10
636 //==============================================================================
639 //==============================================================================
640 // UEP10 Bits
642 extern __at(0x0F7A) __sfr UEP10;
644 typedef struct
646 unsigned EPSTALL : 1;
647 unsigned EPINEN : 1;
648 unsigned EPOUTEN : 1;
649 unsigned EPCONDIS : 1;
650 unsigned EPHSHK : 1;
651 unsigned : 1;
652 unsigned : 1;
653 unsigned : 1;
654 } __UEP10bits_t;
656 extern __at(0x0F7A) volatile __UEP10bits_t UEP10bits;
658 #define _UEP10_EPSTALL 0x01
659 #define _UEP10_EPINEN 0x02
660 #define _UEP10_EPOUTEN 0x04
661 #define _UEP10_EPCONDIS 0x08
662 #define _UEP10_EPHSHK 0x10
664 //==============================================================================
667 //==============================================================================
668 // UEP11 Bits
670 extern __at(0x0F7B) __sfr UEP11;
672 typedef struct
674 unsigned EPSTALL : 1;
675 unsigned EPINEN : 1;
676 unsigned EPOUTEN : 1;
677 unsigned EPCONDIS : 1;
678 unsigned EPHSHK : 1;
679 unsigned : 1;
680 unsigned : 1;
681 unsigned : 1;
682 } __UEP11bits_t;
684 extern __at(0x0F7B) volatile __UEP11bits_t UEP11bits;
686 #define _UEP11_EPSTALL 0x01
687 #define _UEP11_EPINEN 0x02
688 #define _UEP11_EPOUTEN 0x04
689 #define _UEP11_EPCONDIS 0x08
690 #define _UEP11_EPHSHK 0x10
692 //==============================================================================
695 //==============================================================================
696 // UEP12 Bits
698 extern __at(0x0F7C) __sfr UEP12;
700 typedef struct
702 unsigned EPSTALL : 1;
703 unsigned EPINEN : 1;
704 unsigned EPOUTEN : 1;
705 unsigned EPCONDIS : 1;
706 unsigned EPHSHK : 1;
707 unsigned : 1;
708 unsigned : 1;
709 unsigned : 1;
710 } __UEP12bits_t;
712 extern __at(0x0F7C) volatile __UEP12bits_t UEP12bits;
714 #define _UEP12_EPSTALL 0x01
715 #define _UEP12_EPINEN 0x02
716 #define _UEP12_EPOUTEN 0x04
717 #define _UEP12_EPCONDIS 0x08
718 #define _UEP12_EPHSHK 0x10
720 //==============================================================================
723 //==============================================================================
724 // UEP13 Bits
726 extern __at(0x0F7D) __sfr UEP13;
728 typedef struct
730 unsigned EPSTALL : 1;
731 unsigned EPINEN : 1;
732 unsigned EPOUTEN : 1;
733 unsigned EPCONDIS : 1;
734 unsigned EPHSHK : 1;
735 unsigned : 1;
736 unsigned : 1;
737 unsigned : 1;
738 } __UEP13bits_t;
740 extern __at(0x0F7D) volatile __UEP13bits_t UEP13bits;
742 #define _UEP13_EPSTALL 0x01
743 #define _UEP13_EPINEN 0x02
744 #define _UEP13_EPOUTEN 0x04
745 #define _UEP13_EPCONDIS 0x08
746 #define _UEP13_EPHSHK 0x10
748 //==============================================================================
751 //==============================================================================
752 // UEP14 Bits
754 extern __at(0x0F7E) __sfr UEP14;
756 typedef struct
758 unsigned EPSTALL : 1;
759 unsigned EPINEN : 1;
760 unsigned EPOUTEN : 1;
761 unsigned EPCONDIS : 1;
762 unsigned EPHSHK : 1;
763 unsigned : 1;
764 unsigned : 1;
765 unsigned : 1;
766 } __UEP14bits_t;
768 extern __at(0x0F7E) volatile __UEP14bits_t UEP14bits;
770 #define _UEP14_EPSTALL 0x01
771 #define _UEP14_EPINEN 0x02
772 #define _UEP14_EPOUTEN 0x04
773 #define _UEP14_EPCONDIS 0x08
774 #define _UEP14_EPHSHK 0x10
776 //==============================================================================
779 //==============================================================================
780 // UEP15 Bits
782 extern __at(0x0F7F) __sfr UEP15;
784 typedef struct
786 unsigned EPSTALL : 1;
787 unsigned EPINEN : 1;
788 unsigned EPOUTEN : 1;
789 unsigned EPCONDIS : 1;
790 unsigned EPHSHK : 1;
791 unsigned : 1;
792 unsigned : 1;
793 unsigned : 1;
794 } __UEP15bits_t;
796 extern __at(0x0F7F) volatile __UEP15bits_t UEP15bits;
798 #define _UEP15_EPSTALL 0x01
799 #define _UEP15_EPINEN 0x02
800 #define _UEP15_EPOUTEN 0x04
801 #define _UEP15_EPCONDIS 0x08
802 #define _UEP15_EPHSHK 0x10
804 //==============================================================================
807 //==============================================================================
808 // PORTA Bits
810 extern __at(0x0F80) __sfr PORTA;
812 typedef union
814 struct
816 unsigned RA0 : 1;
817 unsigned RA1 : 1;
818 unsigned RA2 : 1;
819 unsigned RA3 : 1;
820 unsigned RA4 : 1;
821 unsigned RA5 : 1;
822 unsigned RA6 : 1;
823 unsigned : 1;
826 struct
828 unsigned AN0 : 1;
829 unsigned AN1 : 1;
830 unsigned AN2 : 1;
831 unsigned AN3 : 1;
832 unsigned T0CKI : 1;
833 unsigned AN4 : 1;
834 unsigned OSC2 : 1;
835 unsigned : 1;
838 struct
840 unsigned : 1;
841 unsigned : 1;
842 unsigned VREFM : 1;
843 unsigned VREFP : 1;
844 unsigned RCV : 1;
845 unsigned LVDIN : 1;
846 unsigned : 1;
847 unsigned : 1;
850 struct
852 unsigned : 1;
853 unsigned : 1;
854 unsigned : 1;
855 unsigned : 1;
856 unsigned : 1;
857 unsigned HLVDIN : 1;
858 unsigned : 1;
859 unsigned : 1;
862 struct
864 unsigned RA : 7;
865 unsigned : 1;
867 } __PORTAbits_t;
869 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
871 #define _PORTA_RA0 0x01
872 #define _PORTA_AN0 0x01
873 #define _PORTA_RA1 0x02
874 #define _PORTA_AN1 0x02
875 #define _PORTA_RA2 0x04
876 #define _PORTA_AN2 0x04
877 #define _PORTA_VREFM 0x04
878 #define _PORTA_RA3 0x08
879 #define _PORTA_AN3 0x08
880 #define _PORTA_VREFP 0x08
881 #define _PORTA_RA4 0x10
882 #define _PORTA_T0CKI 0x10
883 #define _PORTA_RCV 0x10
884 #define _PORTA_RA5 0x20
885 #define _PORTA_AN4 0x20
886 #define _PORTA_LVDIN 0x20
887 #define _PORTA_HLVDIN 0x20
888 #define _PORTA_RA6 0x40
889 #define _PORTA_OSC2 0x40
891 //==============================================================================
894 //==============================================================================
895 // PORTB Bits
897 extern __at(0x0F81) __sfr PORTB;
899 typedef union
901 struct
903 unsigned RB0 : 1;
904 unsigned RB1 : 1;
905 unsigned RB2 : 1;
906 unsigned RB3 : 1;
907 unsigned RB4 : 1;
908 unsigned RB5 : 1;
909 unsigned RB6 : 1;
910 unsigned RB7 : 1;
913 struct
915 unsigned INT0 : 1;
916 unsigned INT1 : 1;
917 unsigned INT2 : 1;
918 unsigned AN9 : 1;
919 unsigned KBI0 : 1;
920 unsigned KBI1 : 1;
921 unsigned KBI2 : 1;
922 unsigned KBI3 : 1;
925 struct
927 unsigned AN12 : 1;
928 unsigned AN10 : 1;
929 unsigned AN8 : 1;
930 unsigned VPO : 1;
931 unsigned AN11 : 1;
932 unsigned PGM : 1;
933 unsigned PGC : 1;
934 unsigned PGD : 1;
937 struct
939 unsigned : 1;
940 unsigned : 1;
941 unsigned VMO : 1;
942 unsigned : 1;
943 unsigned : 1;
944 unsigned : 1;
945 unsigned : 1;
946 unsigned : 1;
949 struct
951 unsigned INT : 3;
952 unsigned : 5;
955 struct
957 unsigned : 4;
958 unsigned KBI : 4;
960 } __PORTBbits_t;
962 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
964 #define _PORTB_RB0 0x01
965 #define _PORTB_INT0 0x01
966 #define _PORTB_AN12 0x01
967 #define _PORTB_RB1 0x02
968 #define _PORTB_INT1 0x02
969 #define _PORTB_AN10 0x02
970 #define _PORTB_RB2 0x04
971 #define _PORTB_INT2 0x04
972 #define _PORTB_AN8 0x04
973 #define _PORTB_VMO 0x04
974 #define _PORTB_RB3 0x08
975 #define _PORTB_AN9 0x08
976 #define _PORTB_VPO 0x08
977 #define _PORTB_RB4 0x10
978 #define _PORTB_KBI0 0x10
979 #define _PORTB_AN11 0x10
980 #define _PORTB_RB5 0x20
981 #define _PORTB_KBI1 0x20
982 #define _PORTB_PGM 0x20
983 #define _PORTB_RB6 0x40
984 #define _PORTB_KBI2 0x40
985 #define _PORTB_PGC 0x40
986 #define _PORTB_RB7 0x80
987 #define _PORTB_KBI3 0x80
988 #define _PORTB_PGD 0x80
990 //==============================================================================
993 //==============================================================================
994 // PORTC Bits
996 extern __at(0x0F82) __sfr PORTC;
998 typedef union
1000 struct
1002 unsigned RC0 : 1;
1003 unsigned RC1 : 1;
1004 unsigned RC2 : 1;
1005 unsigned : 1;
1006 unsigned RC4 : 1;
1007 unsigned RC5 : 1;
1008 unsigned RC6 : 1;
1009 unsigned RC7 : 1;
1012 struct
1014 unsigned T1OSO : 1;
1015 unsigned T1OSI : 1;
1016 unsigned CCP1 : 1;
1017 unsigned : 1;
1018 unsigned : 1;
1019 unsigned : 1;
1020 unsigned TX : 1;
1021 unsigned RX : 1;
1024 struct
1026 unsigned T1CKI : 1;
1027 unsigned NOT_UOE : 1;
1028 unsigned P1A : 1;
1029 unsigned : 1;
1030 unsigned : 1;
1031 unsigned : 1;
1032 unsigned CK : 1;
1033 unsigned : 1;
1036 struct
1038 unsigned : 1;
1039 unsigned UOE : 1;
1040 unsigned : 1;
1041 unsigned : 1;
1042 unsigned : 1;
1043 unsigned : 1;
1044 unsigned : 1;
1045 unsigned : 1;
1047 } __PORTCbits_t;
1049 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
1051 #define _PORTC_RC0 0x01
1052 #define _PORTC_T1OSO 0x01
1053 #define _PORTC_T1CKI 0x01
1054 #define _PORTC_RC1 0x02
1055 #define _PORTC_T1OSI 0x02
1056 #define _PORTC_NOT_UOE 0x02
1057 #define _PORTC_UOE 0x02
1058 #define _PORTC_RC2 0x04
1059 #define _PORTC_CCP1 0x04
1060 #define _PORTC_P1A 0x04
1061 #define _PORTC_RC4 0x10
1062 #define _PORTC_RC5 0x20
1063 #define _PORTC_RC6 0x40
1064 #define _PORTC_TX 0x40
1065 #define _PORTC_CK 0x40
1066 #define _PORTC_RC7 0x80
1067 #define _PORTC_RX 0x80
1069 //==============================================================================
1072 //==============================================================================
1073 // PORTE Bits
1075 extern __at(0x0F84) __sfr PORTE;
1077 typedef struct
1079 unsigned : 1;
1080 unsigned : 1;
1081 unsigned : 1;
1082 unsigned RE3 : 1;
1083 unsigned : 1;
1084 unsigned : 1;
1085 unsigned : 1;
1086 unsigned : 1;
1087 } __PORTEbits_t;
1089 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
1091 #define _RE3 0x08
1093 //==============================================================================
1096 //==============================================================================
1097 // LATA Bits
1099 extern __at(0x0F89) __sfr LATA;
1101 typedef union
1103 struct
1105 unsigned LATA0 : 1;
1106 unsigned LATA1 : 1;
1107 unsigned LATA2 : 1;
1108 unsigned LATA3 : 1;
1109 unsigned LATA4 : 1;
1110 unsigned LATA5 : 1;
1111 unsigned LATA6 : 1;
1112 unsigned : 1;
1115 struct
1117 unsigned LATA : 7;
1118 unsigned : 1;
1120 } __LATAbits_t;
1122 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
1124 #define _LATA0 0x01
1125 #define _LATA1 0x02
1126 #define _LATA2 0x04
1127 #define _LATA3 0x08
1128 #define _LATA4 0x10
1129 #define _LATA5 0x20
1130 #define _LATA6 0x40
1132 //==============================================================================
1135 //==============================================================================
1136 // LATB Bits
1138 extern __at(0x0F8A) __sfr LATB;
1140 typedef struct
1142 unsigned LATB0 : 1;
1143 unsigned LATB1 : 1;
1144 unsigned LATB2 : 1;
1145 unsigned LATB3 : 1;
1146 unsigned LATB4 : 1;
1147 unsigned LATB5 : 1;
1148 unsigned LATB6 : 1;
1149 unsigned LATB7 : 1;
1150 } __LATBbits_t;
1152 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
1154 #define _LATB0 0x01
1155 #define _LATB1 0x02
1156 #define _LATB2 0x04
1157 #define _LATB3 0x08
1158 #define _LATB4 0x10
1159 #define _LATB5 0x20
1160 #define _LATB6 0x40
1161 #define _LATB7 0x80
1163 //==============================================================================
1166 //==============================================================================
1167 // LATC Bits
1169 extern __at(0x0F8B) __sfr LATC;
1171 typedef struct
1173 unsigned LATC0 : 1;
1174 unsigned LATC1 : 1;
1175 unsigned LATC2 : 1;
1176 unsigned : 1;
1177 unsigned : 1;
1178 unsigned : 1;
1179 unsigned LATC6 : 1;
1180 unsigned LATC7 : 1;
1181 } __LATCbits_t;
1183 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
1185 #define _LATC0 0x01
1186 #define _LATC1 0x02
1187 #define _LATC2 0x04
1188 #define _LATC6 0x40
1189 #define _LATC7 0x80
1191 //==============================================================================
1194 //==============================================================================
1195 // DDRA Bits
1197 extern __at(0x0F92) __sfr DDRA;
1199 typedef union
1201 struct
1203 unsigned TRISA0 : 1;
1204 unsigned TRISA1 : 1;
1205 unsigned TRISA2 : 1;
1206 unsigned TRISA3 : 1;
1207 unsigned TRISA4 : 1;
1208 unsigned TRISA5 : 1;
1209 unsigned TRISA6 : 1;
1210 unsigned : 1;
1213 struct
1215 unsigned RA0 : 1;
1216 unsigned RA1 : 1;
1217 unsigned RA2 : 1;
1218 unsigned RA3 : 1;
1219 unsigned RA4 : 1;
1220 unsigned RA5 : 1;
1221 unsigned RA6 : 1;
1222 unsigned : 1;
1225 struct
1227 unsigned TRISA : 7;
1228 unsigned : 1;
1231 struct
1233 unsigned RA : 7;
1234 unsigned : 1;
1236 } __DDRAbits_t;
1238 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
1240 #define _TRISA0 0x01
1241 #define _RA0 0x01
1242 #define _TRISA1 0x02
1243 #define _RA1 0x02
1244 #define _TRISA2 0x04
1245 #define _RA2 0x04
1246 #define _TRISA3 0x08
1247 #define _RA3 0x08
1248 #define _TRISA4 0x10
1249 #define _RA4 0x10
1250 #define _TRISA5 0x20
1251 #define _RA5 0x20
1252 #define _TRISA6 0x40
1253 #define _RA6 0x40
1255 //==============================================================================
1258 //==============================================================================
1259 // TRISA Bits
1261 extern __at(0x0F92) __sfr TRISA;
1263 typedef union
1265 struct
1267 unsigned TRISA0 : 1;
1268 unsigned TRISA1 : 1;
1269 unsigned TRISA2 : 1;
1270 unsigned TRISA3 : 1;
1271 unsigned TRISA4 : 1;
1272 unsigned TRISA5 : 1;
1273 unsigned TRISA6 : 1;
1274 unsigned : 1;
1277 struct
1279 unsigned RA0 : 1;
1280 unsigned RA1 : 1;
1281 unsigned RA2 : 1;
1282 unsigned RA3 : 1;
1283 unsigned RA4 : 1;
1284 unsigned RA5 : 1;
1285 unsigned RA6 : 1;
1286 unsigned : 1;
1289 struct
1291 unsigned TRISA : 7;
1292 unsigned : 1;
1295 struct
1297 unsigned RA : 7;
1298 unsigned : 1;
1300 } __TRISAbits_t;
1302 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
1304 #define _TRISA_TRISA0 0x01
1305 #define _TRISA_RA0 0x01
1306 #define _TRISA_TRISA1 0x02
1307 #define _TRISA_RA1 0x02
1308 #define _TRISA_TRISA2 0x04
1309 #define _TRISA_RA2 0x04
1310 #define _TRISA_TRISA3 0x08
1311 #define _TRISA_RA3 0x08
1312 #define _TRISA_TRISA4 0x10
1313 #define _TRISA_RA4 0x10
1314 #define _TRISA_TRISA5 0x20
1315 #define _TRISA_RA5 0x20
1316 #define _TRISA_TRISA6 0x40
1317 #define _TRISA_RA6 0x40
1319 //==============================================================================
1322 //==============================================================================
1323 // DDRB Bits
1325 extern __at(0x0F93) __sfr DDRB;
1327 typedef union
1329 struct
1331 unsigned TRISB0 : 1;
1332 unsigned TRISB1 : 1;
1333 unsigned TRISB2 : 1;
1334 unsigned TRISB3 : 1;
1335 unsigned TRISB4 : 1;
1336 unsigned TRISB5 : 1;
1337 unsigned TRISB6 : 1;
1338 unsigned TRISB7 : 1;
1341 struct
1343 unsigned RB0 : 1;
1344 unsigned RB1 : 1;
1345 unsigned RB2 : 1;
1346 unsigned RB3 : 1;
1347 unsigned RB4 : 1;
1348 unsigned RB5 : 1;
1349 unsigned RB6 : 1;
1350 unsigned RB7 : 1;
1352 } __DDRBbits_t;
1354 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
1356 #define _TRISB0 0x01
1357 #define _RB0 0x01
1358 #define _TRISB1 0x02
1359 #define _RB1 0x02
1360 #define _TRISB2 0x04
1361 #define _RB2 0x04
1362 #define _TRISB3 0x08
1363 #define _RB3 0x08
1364 #define _TRISB4 0x10
1365 #define _RB4 0x10
1366 #define _TRISB5 0x20
1367 #define _RB5 0x20
1368 #define _TRISB6 0x40
1369 #define _RB6 0x40
1370 #define _TRISB7 0x80
1371 #define _RB7 0x80
1373 //==============================================================================
1376 //==============================================================================
1377 // TRISB Bits
1379 extern __at(0x0F93) __sfr TRISB;
1381 typedef union
1383 struct
1385 unsigned TRISB0 : 1;
1386 unsigned TRISB1 : 1;
1387 unsigned TRISB2 : 1;
1388 unsigned TRISB3 : 1;
1389 unsigned TRISB4 : 1;
1390 unsigned TRISB5 : 1;
1391 unsigned TRISB6 : 1;
1392 unsigned TRISB7 : 1;
1395 struct
1397 unsigned RB0 : 1;
1398 unsigned RB1 : 1;
1399 unsigned RB2 : 1;
1400 unsigned RB3 : 1;
1401 unsigned RB4 : 1;
1402 unsigned RB5 : 1;
1403 unsigned RB6 : 1;
1404 unsigned RB7 : 1;
1406 } __TRISBbits_t;
1408 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
1410 #define _TRISB_TRISB0 0x01
1411 #define _TRISB_RB0 0x01
1412 #define _TRISB_TRISB1 0x02
1413 #define _TRISB_RB1 0x02
1414 #define _TRISB_TRISB2 0x04
1415 #define _TRISB_RB2 0x04
1416 #define _TRISB_TRISB3 0x08
1417 #define _TRISB_RB3 0x08
1418 #define _TRISB_TRISB4 0x10
1419 #define _TRISB_RB4 0x10
1420 #define _TRISB_TRISB5 0x20
1421 #define _TRISB_RB5 0x20
1422 #define _TRISB_TRISB6 0x40
1423 #define _TRISB_RB6 0x40
1424 #define _TRISB_TRISB7 0x80
1425 #define _TRISB_RB7 0x80
1427 //==============================================================================
1430 //==============================================================================
1431 // DDRC Bits
1433 extern __at(0x0F94) __sfr DDRC;
1435 typedef union
1437 struct
1439 unsigned TRISC0 : 1;
1440 unsigned TRISC1 : 1;
1441 unsigned TRISC2 : 1;
1442 unsigned : 1;
1443 unsigned : 1;
1444 unsigned : 1;
1445 unsigned TRISC6 : 1;
1446 unsigned TRISC7 : 1;
1449 struct
1451 unsigned RC0 : 1;
1452 unsigned RC1 : 1;
1453 unsigned RC2 : 1;
1454 unsigned : 1;
1455 unsigned : 1;
1456 unsigned : 1;
1457 unsigned RC6 : 1;
1458 unsigned RC7 : 1;
1460 } __DDRCbits_t;
1462 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
1464 #define _TRISC0 0x01
1465 #define _RC0 0x01
1466 #define _TRISC1 0x02
1467 #define _RC1 0x02
1468 #define _TRISC2 0x04
1469 #define _RC2 0x04
1470 #define _TRISC6 0x40
1471 #define _RC6 0x40
1472 #define _TRISC7 0x80
1473 #define _RC7 0x80
1475 //==============================================================================
1478 //==============================================================================
1479 // TRISC Bits
1481 extern __at(0x0F94) __sfr TRISC;
1483 typedef union
1485 struct
1487 unsigned TRISC0 : 1;
1488 unsigned TRISC1 : 1;
1489 unsigned TRISC2 : 1;
1490 unsigned : 1;
1491 unsigned : 1;
1492 unsigned : 1;
1493 unsigned TRISC6 : 1;
1494 unsigned TRISC7 : 1;
1497 struct
1499 unsigned RC0 : 1;
1500 unsigned RC1 : 1;
1501 unsigned RC2 : 1;
1502 unsigned : 1;
1503 unsigned : 1;
1504 unsigned : 1;
1505 unsigned RC6 : 1;
1506 unsigned RC7 : 1;
1508 } __TRISCbits_t;
1510 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
1512 #define _TRISC_TRISC0 0x01
1513 #define _TRISC_RC0 0x01
1514 #define _TRISC_TRISC1 0x02
1515 #define _TRISC_RC1 0x02
1516 #define _TRISC_TRISC2 0x04
1517 #define _TRISC_RC2 0x04
1518 #define _TRISC_TRISC6 0x40
1519 #define _TRISC_RC6 0x40
1520 #define _TRISC_TRISC7 0x80
1521 #define _TRISC_RC7 0x80
1523 //==============================================================================
1526 //==============================================================================
1527 // PIE1 Bits
1529 extern __at(0x0F9D) __sfr PIE1;
1531 typedef struct
1533 unsigned TMR1IE : 1;
1534 unsigned TMR2IE : 1;
1535 unsigned CCP1IE : 1;
1536 unsigned : 1;
1537 unsigned TXIE : 1;
1538 unsigned RCIE : 1;
1539 unsigned ADIE : 1;
1540 unsigned : 1;
1541 } __PIE1bits_t;
1543 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1545 #define _TMR1IE 0x01
1546 #define _TMR2IE 0x02
1547 #define _CCP1IE 0x04
1548 #define _TXIE 0x10
1549 #define _RCIE 0x20
1550 #define _ADIE 0x40
1552 //==============================================================================
1555 //==============================================================================
1556 // PIR1 Bits
1558 extern __at(0x0F9E) __sfr PIR1;
1560 typedef struct
1562 unsigned TMR1IF : 1;
1563 unsigned TMR2IF : 1;
1564 unsigned CCP1IF : 1;
1565 unsigned : 1;
1566 unsigned TXIF : 1;
1567 unsigned RCIF : 1;
1568 unsigned ADIF : 1;
1569 unsigned : 1;
1570 } __PIR1bits_t;
1572 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1574 #define _TMR1IF 0x01
1575 #define _TMR2IF 0x02
1576 #define _CCP1IF 0x04
1577 #define _TXIF 0x10
1578 #define _RCIF 0x20
1579 #define _ADIF 0x40
1581 //==============================================================================
1584 //==============================================================================
1585 // IPR1 Bits
1587 extern __at(0x0F9F) __sfr IPR1;
1589 typedef struct
1591 unsigned TMR1IP : 1;
1592 unsigned TMR2IP : 1;
1593 unsigned CCP1IP : 1;
1594 unsigned : 1;
1595 unsigned TXIP : 1;
1596 unsigned RCIP : 1;
1597 unsigned ADIP : 1;
1598 unsigned : 1;
1599 } __IPR1bits_t;
1601 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1603 #define _TMR1IP 0x01
1604 #define _TMR2IP 0x02
1605 #define _CCP1IP 0x04
1606 #define _TXIP 0x10
1607 #define _RCIP 0x20
1608 #define _ADIP 0x40
1610 //==============================================================================
1613 //==============================================================================
1614 // PIE2 Bits
1616 extern __at(0x0FA0) __sfr PIE2;
1618 typedef union
1620 struct
1622 unsigned : 1;
1623 unsigned : 1;
1624 unsigned HLVDIE : 1;
1625 unsigned : 1;
1626 unsigned : 1;
1627 unsigned USBIE : 1;
1628 unsigned : 1;
1629 unsigned OSCFIE : 1;
1632 struct
1634 unsigned : 1;
1635 unsigned : 1;
1636 unsigned LVDIE : 1;
1637 unsigned : 1;
1638 unsigned : 1;
1639 unsigned : 1;
1640 unsigned : 1;
1641 unsigned : 1;
1643 } __PIE2bits_t;
1645 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1647 #define _HLVDIE 0x04
1648 #define _LVDIE 0x04
1649 #define _USBIE 0x20
1650 #define _OSCFIE 0x80
1652 //==============================================================================
1655 //==============================================================================
1656 // PIR2 Bits
1658 extern __at(0x0FA1) __sfr PIR2;
1660 typedef union
1662 struct
1664 unsigned : 1;
1665 unsigned : 1;
1666 unsigned HLVDIF : 1;
1667 unsigned : 1;
1668 unsigned : 1;
1669 unsigned USBIF : 1;
1670 unsigned : 1;
1671 unsigned OSCFIF : 1;
1674 struct
1676 unsigned : 1;
1677 unsigned : 1;
1678 unsigned LVDIF : 1;
1679 unsigned : 1;
1680 unsigned : 1;
1681 unsigned : 1;
1682 unsigned : 1;
1683 unsigned : 1;
1685 } __PIR2bits_t;
1687 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1689 #define _HLVDIF 0x04
1690 #define _LVDIF 0x04
1691 #define _USBIF 0x20
1692 #define _OSCFIF 0x80
1694 //==============================================================================
1697 //==============================================================================
1698 // IPR2 Bits
1700 extern __at(0x0FA2) __sfr IPR2;
1702 typedef union
1704 struct
1706 unsigned : 1;
1707 unsigned : 1;
1708 unsigned HLVDIP : 1;
1709 unsigned : 1;
1710 unsigned : 1;
1711 unsigned USBIP : 1;
1712 unsigned : 1;
1713 unsigned OSCFIP : 1;
1716 struct
1718 unsigned : 1;
1719 unsigned : 1;
1720 unsigned LVDIP : 1;
1721 unsigned : 1;
1722 unsigned : 1;
1723 unsigned : 1;
1724 unsigned : 1;
1725 unsigned : 1;
1727 } __IPR2bits_t;
1729 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1731 #define _HLVDIP 0x04
1732 #define _LVDIP 0x04
1733 #define _USBIP 0x20
1734 #define _OSCFIP 0x80
1736 //==============================================================================
1739 //==============================================================================
1740 // EECON1 Bits
1742 extern __at(0x0FA6) __sfr EECON1;
1744 typedef struct
1746 unsigned : 1;
1747 unsigned WR : 1;
1748 unsigned WREN : 1;
1749 unsigned WRERR : 1;
1750 unsigned FREE : 1;
1751 unsigned : 1;
1752 unsigned CFGS : 1;
1753 unsigned : 1;
1754 } __EECON1bits_t;
1756 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1758 #define _WR 0x02
1759 #define _WREN 0x04
1760 #define _WRERR 0x08
1761 #define _FREE 0x10
1762 #define _CFGS 0x40
1764 //==============================================================================
1766 extern __at(0x0FA7) __sfr EECON2;
1768 //==============================================================================
1769 // RCSTA Bits
1771 extern __at(0x0FAB) __sfr RCSTA;
1773 typedef union
1775 struct
1777 unsigned RX9D : 1;
1778 unsigned OERR : 1;
1779 unsigned FERR : 1;
1780 unsigned ADDEN : 1;
1781 unsigned CREN : 1;
1782 unsigned SREN : 1;
1783 unsigned RX9 : 1;
1784 unsigned SPEN : 1;
1787 struct
1789 unsigned : 1;
1790 unsigned : 1;
1791 unsigned : 1;
1792 unsigned ADEN : 1;
1793 unsigned : 1;
1794 unsigned : 1;
1795 unsigned : 1;
1796 unsigned : 1;
1798 } __RCSTAbits_t;
1800 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1802 #define _RX9D 0x01
1803 #define _OERR 0x02
1804 #define _FERR 0x04
1805 #define _ADDEN 0x08
1806 #define _ADEN 0x08
1807 #define _CREN 0x10
1808 #define _SREN 0x20
1809 #define _RX9 0x40
1810 #define _SPEN 0x80
1812 //==============================================================================
1815 //==============================================================================
1816 // TXSTA Bits
1818 extern __at(0x0FAC) __sfr TXSTA;
1820 typedef struct
1822 unsigned TX9D : 1;
1823 unsigned TRMT : 1;
1824 unsigned BRGH : 1;
1825 unsigned SENDB : 1;
1826 unsigned SYNC : 1;
1827 unsigned TXEN : 1;
1828 unsigned TX9 : 1;
1829 unsigned CSRC : 1;
1830 } __TXSTAbits_t;
1832 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1834 #define _TX9D 0x01
1835 #define _TRMT 0x02
1836 #define _BRGH 0x04
1837 #define _SENDB 0x08
1838 #define _SYNC 0x10
1839 #define _TXEN 0x20
1840 #define _TX9 0x40
1841 #define _CSRC 0x80
1843 //==============================================================================
1845 extern __at(0x0FAD) __sfr TXREG;
1846 extern __at(0x0FAE) __sfr RCREG;
1847 extern __at(0x0FAF) __sfr SPBRG;
1848 extern __at(0x0FB0) __sfr SPBRGH;
1850 //==============================================================================
1851 // BAUDCON Bits
1853 extern __at(0x0FB8) __sfr BAUDCON;
1855 typedef union
1857 struct
1859 unsigned ABDEN : 1;
1860 unsigned WUE : 1;
1861 unsigned : 1;
1862 unsigned BRG16 : 1;
1863 unsigned TXCKP : 1;
1864 unsigned RXDTP : 1;
1865 unsigned RCIDL : 1;
1866 unsigned ABDOVF : 1;
1869 struct
1871 unsigned : 1;
1872 unsigned : 1;
1873 unsigned : 1;
1874 unsigned : 1;
1875 unsigned SCKP : 1;
1876 unsigned : 1;
1877 unsigned RCMT : 1;
1878 unsigned : 1;
1880 } __BAUDCONbits_t;
1882 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits;
1884 #define _ABDEN 0x01
1885 #define _WUE 0x02
1886 #define _BRG16 0x08
1887 #define _TXCKP 0x10
1888 #define _SCKP 0x10
1889 #define _RXDTP 0x20
1890 #define _RCIDL 0x40
1891 #define _RCMT 0x40
1892 #define _ABDOVF 0x80
1894 //==============================================================================
1897 //==============================================================================
1898 // BAUDCTL Bits
1900 extern __at(0x0FB8) __sfr BAUDCTL;
1902 typedef union
1904 struct
1906 unsigned ABDEN : 1;
1907 unsigned WUE : 1;
1908 unsigned : 1;
1909 unsigned BRG16 : 1;
1910 unsigned TXCKP : 1;
1911 unsigned RXDTP : 1;
1912 unsigned RCIDL : 1;
1913 unsigned ABDOVF : 1;
1916 struct
1918 unsigned : 1;
1919 unsigned : 1;
1920 unsigned : 1;
1921 unsigned : 1;
1922 unsigned SCKP : 1;
1923 unsigned : 1;
1924 unsigned RCMT : 1;
1925 unsigned : 1;
1927 } __BAUDCTLbits_t;
1929 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits;
1931 #define _BAUDCTL_ABDEN 0x01
1932 #define _BAUDCTL_WUE 0x02
1933 #define _BAUDCTL_BRG16 0x08
1934 #define _BAUDCTL_TXCKP 0x10
1935 #define _BAUDCTL_SCKP 0x10
1936 #define _BAUDCTL_RXDTP 0x20
1937 #define _BAUDCTL_RCIDL 0x40
1938 #define _BAUDCTL_RCMT 0x40
1939 #define _BAUDCTL_ABDOVF 0x80
1941 //==============================================================================
1944 //==============================================================================
1945 // CCP1CON Bits
1947 extern __at(0x0FBD) __sfr CCP1CON;
1949 typedef union
1951 struct
1953 unsigned CCP1M0 : 1;
1954 unsigned CCP1M1 : 1;
1955 unsigned CCP1M2 : 1;
1956 unsigned CCP1M3 : 1;
1957 unsigned DC1B0 : 1;
1958 unsigned DC1B1 : 1;
1959 unsigned : 1;
1960 unsigned : 1;
1963 struct
1965 unsigned CCP1M : 4;
1966 unsigned : 4;
1969 struct
1971 unsigned : 4;
1972 unsigned DC1B : 2;
1973 unsigned : 2;
1975 } __CCP1CONbits_t;
1977 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1979 #define _CCP1M0 0x01
1980 #define _CCP1M1 0x02
1981 #define _CCP1M2 0x04
1982 #define _CCP1M3 0x08
1983 #define _DC1B0 0x10
1984 #define _DC1B1 0x20
1986 //==============================================================================
1988 extern __at(0x0FBE) __sfr CCPR1;
1989 extern __at(0x0FBE) __sfr CCPR1L;
1990 extern __at(0x0FBF) __sfr CCPR1H;
1992 //==============================================================================
1993 // ADCON2 Bits
1995 extern __at(0x0FC0) __sfr ADCON2;
1997 typedef union
1999 struct
2001 unsigned ADCS0 : 1;
2002 unsigned ADCS1 : 1;
2003 unsigned ADCS2 : 1;
2004 unsigned ACQT0 : 1;
2005 unsigned ACQT1 : 1;
2006 unsigned ACQT2 : 1;
2007 unsigned : 1;
2008 unsigned ADFM : 1;
2011 struct
2013 unsigned ADCS : 3;
2014 unsigned : 5;
2017 struct
2019 unsigned : 3;
2020 unsigned ACQT : 3;
2021 unsigned : 2;
2023 } __ADCON2bits_t;
2025 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
2027 #define _ADCS0 0x01
2028 #define _ADCS1 0x02
2029 #define _ADCS2 0x04
2030 #define _ACQT0 0x08
2031 #define _ACQT1 0x10
2032 #define _ACQT2 0x20
2033 #define _ADFM 0x80
2035 //==============================================================================
2038 //==============================================================================
2039 // ADCON1 Bits
2041 extern __at(0x0FC1) __sfr ADCON1;
2043 typedef union
2045 struct
2047 unsigned PCFG0 : 1;
2048 unsigned PCFG1 : 1;
2049 unsigned PCFG2 : 1;
2050 unsigned PCFG3 : 1;
2051 unsigned VCFG0 : 1;
2052 unsigned VCFG1 : 1;
2053 unsigned : 1;
2054 unsigned : 1;
2057 struct
2059 unsigned PCFG : 4;
2060 unsigned : 4;
2063 struct
2065 unsigned : 4;
2066 unsigned VCFG : 2;
2067 unsigned : 2;
2069 } __ADCON1bits_t;
2071 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
2073 #define _PCFG0 0x01
2074 #define _PCFG1 0x02
2075 #define _PCFG2 0x04
2076 #define _PCFG3 0x08
2077 #define _VCFG0 0x10
2078 #define _VCFG1 0x20
2080 //==============================================================================
2083 //==============================================================================
2084 // ADCON0 Bits
2086 extern __at(0x0FC2) __sfr ADCON0;
2088 typedef union
2090 struct
2092 unsigned ADON : 1;
2093 unsigned GO_NOT_DONE : 1;
2094 unsigned CHS0 : 1;
2095 unsigned CHS1 : 1;
2096 unsigned CHS2 : 1;
2097 unsigned CHS3 : 1;
2098 unsigned : 1;
2099 unsigned : 1;
2102 struct
2104 unsigned : 1;
2105 unsigned GO_DONE : 1;
2106 unsigned : 1;
2107 unsigned : 1;
2108 unsigned : 1;
2109 unsigned : 1;
2110 unsigned : 1;
2111 unsigned : 1;
2114 struct
2116 unsigned : 1;
2117 unsigned DONE : 1;
2118 unsigned : 1;
2119 unsigned : 1;
2120 unsigned : 1;
2121 unsigned : 1;
2122 unsigned : 1;
2123 unsigned : 1;
2126 struct
2128 unsigned : 1;
2129 unsigned GO : 1;
2130 unsigned : 1;
2131 unsigned : 1;
2132 unsigned : 1;
2133 unsigned : 1;
2134 unsigned : 1;
2135 unsigned : 1;
2138 struct
2140 unsigned : 1;
2141 unsigned NOT_DONE : 1;
2142 unsigned : 1;
2143 unsigned : 1;
2144 unsigned : 1;
2145 unsigned : 1;
2146 unsigned : 1;
2147 unsigned : 1;
2150 struct
2152 unsigned : 2;
2153 unsigned CHS : 4;
2154 unsigned : 2;
2156 } __ADCON0bits_t;
2158 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
2160 #define _ADON 0x01
2161 #define _GO_NOT_DONE 0x02
2162 #define _GO_DONE 0x02
2163 #define _DONE 0x02
2164 #define _GO 0x02
2165 #define _NOT_DONE 0x02
2166 #define _CHS0 0x04
2167 #define _CHS1 0x08
2168 #define _CHS2 0x10
2169 #define _CHS3 0x20
2171 //==============================================================================
2173 extern __at(0x0FC3) __sfr ADRES;
2174 extern __at(0x0FC3) __sfr ADRESL;
2175 extern __at(0x0FC4) __sfr ADRESH;
2177 //==============================================================================
2178 // T2CON Bits
2180 extern __at(0x0FCA) __sfr T2CON;
2182 typedef union
2184 struct
2186 unsigned T2CKPS0 : 1;
2187 unsigned T2CKPS1 : 1;
2188 unsigned TMR2ON : 1;
2189 unsigned T2OUTPS0 : 1;
2190 unsigned T2OUTPS1 : 1;
2191 unsigned T2OUTPS2 : 1;
2192 unsigned T2OUTPS3 : 1;
2193 unsigned : 1;
2196 struct
2198 unsigned T2CKPS : 2;
2199 unsigned : 6;
2202 struct
2204 unsigned : 3;
2205 unsigned T2OUTPS : 4;
2206 unsigned : 1;
2208 } __T2CONbits_t;
2210 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
2212 #define _T2CKPS0 0x01
2213 #define _T2CKPS1 0x02
2214 #define _TMR2ON 0x04
2215 #define _T2OUTPS0 0x08
2216 #define _T2OUTPS1 0x10
2217 #define _T2OUTPS2 0x20
2218 #define _T2OUTPS3 0x40
2220 //==============================================================================
2222 extern __at(0x0FCB) __sfr PR2;
2223 extern __at(0x0FCC) __sfr TMR2;
2225 //==============================================================================
2226 // T1CON Bits
2228 extern __at(0x0FCD) __sfr T1CON;
2230 typedef union
2232 struct
2234 unsigned TMR1ON : 1;
2235 unsigned TMR1CS : 1;
2236 unsigned NOT_T1SYNC : 1;
2237 unsigned T1OSCEN : 1;
2238 unsigned T1CKPS0 : 1;
2239 unsigned T1CKPS1 : 1;
2240 unsigned T1RUN : 1;
2241 unsigned RD16 : 1;
2244 struct
2246 unsigned : 1;
2247 unsigned : 1;
2248 unsigned T1SYNC : 1;
2249 unsigned : 1;
2250 unsigned : 1;
2251 unsigned : 1;
2252 unsigned : 1;
2253 unsigned : 1;
2256 struct
2258 unsigned : 4;
2259 unsigned T1CKPS : 2;
2260 unsigned : 2;
2262 } __T1CONbits_t;
2264 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
2266 #define _TMR1ON 0x01
2267 #define _TMR1CS 0x02
2268 #define _NOT_T1SYNC 0x04
2269 #define _T1SYNC 0x04
2270 #define _T1OSCEN 0x08
2271 #define _T1CKPS0 0x10
2272 #define _T1CKPS1 0x20
2273 #define _T1RUN 0x40
2274 #define _RD16 0x80
2276 //==============================================================================
2278 extern __at(0x0FCE) __sfr TMR1;
2279 extern __at(0x0FCE) __sfr TMR1L;
2280 extern __at(0x0FCF) __sfr TMR1H;
2282 //==============================================================================
2283 // RCON Bits
2285 extern __at(0x0FD0) __sfr RCON;
2287 typedef union
2289 struct
2291 unsigned NOT_BOR : 1;
2292 unsigned NOT_POR : 1;
2293 unsigned NOT_PD : 1;
2294 unsigned NOT_TO : 1;
2295 unsigned NOT_RI : 1;
2296 unsigned : 1;
2297 unsigned SBOREN : 1;
2298 unsigned IPEN : 1;
2301 struct
2303 unsigned BOR : 1;
2304 unsigned POR : 1;
2305 unsigned PD : 1;
2306 unsigned TO : 1;
2307 unsigned RI : 1;
2308 unsigned : 1;
2309 unsigned : 1;
2310 unsigned NOT_IPEN : 1;
2312 } __RCONbits_t;
2314 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
2316 #define _NOT_BOR 0x01
2317 #define _BOR 0x01
2318 #define _NOT_POR 0x02
2319 #define _POR 0x02
2320 #define _NOT_PD 0x04
2321 #define _PD 0x04
2322 #define _NOT_TO 0x08
2323 #define _TO 0x08
2324 #define _NOT_RI 0x10
2325 #define _RI 0x10
2326 #define _SBOREN 0x40
2327 #define _IPEN 0x80
2328 #define _NOT_IPEN 0x80
2330 //==============================================================================
2333 //==============================================================================
2334 // WDTCON Bits
2336 extern __at(0x0FD1) __sfr WDTCON;
2338 typedef union
2340 struct
2342 unsigned SWDTEN : 1;
2343 unsigned : 1;
2344 unsigned : 1;
2345 unsigned : 1;
2346 unsigned : 1;
2347 unsigned : 1;
2348 unsigned : 1;
2349 unsigned : 1;
2352 struct
2354 unsigned SWDTE : 1;
2355 unsigned : 1;
2356 unsigned : 1;
2357 unsigned : 1;
2358 unsigned : 1;
2359 unsigned : 1;
2360 unsigned : 1;
2361 unsigned : 1;
2363 } __WDTCONbits_t;
2365 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2367 #define _SWDTEN 0x01
2368 #define _SWDTE 0x01
2370 //==============================================================================
2373 //==============================================================================
2374 // HLVDCON Bits
2376 extern __at(0x0FD2) __sfr HLVDCON;
2378 typedef union
2380 struct
2382 unsigned HLVDL0 : 1;
2383 unsigned HLVDL1 : 1;
2384 unsigned HLVDL2 : 1;
2385 unsigned HLVDL3 : 1;
2386 unsigned HLVDEN : 1;
2387 unsigned IRVST : 1;
2388 unsigned : 1;
2389 unsigned VDIRMAG : 1;
2392 struct
2394 unsigned LVDL0 : 1;
2395 unsigned LVDL1 : 1;
2396 unsigned LVDL2 : 1;
2397 unsigned LVDL3 : 1;
2398 unsigned LVDEN : 1;
2399 unsigned IVRST : 1;
2400 unsigned : 1;
2401 unsigned : 1;
2404 struct
2406 unsigned LVV0 : 1;
2407 unsigned LVV1 : 1;
2408 unsigned LVV2 : 1;
2409 unsigned LVV3 : 1;
2410 unsigned : 1;
2411 unsigned BGST : 1;
2412 unsigned : 1;
2413 unsigned : 1;
2416 struct
2418 unsigned HLVDL : 4;
2419 unsigned : 4;
2422 struct
2424 unsigned LVV : 4;
2425 unsigned : 4;
2428 struct
2430 unsigned LVDL : 4;
2431 unsigned : 4;
2433 } __HLVDCONbits_t;
2435 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits;
2437 #define _HLVDL0 0x01
2438 #define _LVDL0 0x01
2439 #define _LVV0 0x01
2440 #define _HLVDL1 0x02
2441 #define _LVDL1 0x02
2442 #define _LVV1 0x02
2443 #define _HLVDL2 0x04
2444 #define _LVDL2 0x04
2445 #define _LVV2 0x04
2446 #define _HLVDL3 0x08
2447 #define _LVDL3 0x08
2448 #define _LVV3 0x08
2449 #define _HLVDEN 0x10
2450 #define _LVDEN 0x10
2451 #define _IRVST 0x20
2452 #define _IVRST 0x20
2453 #define _BGST 0x20
2454 #define _VDIRMAG 0x80
2456 //==============================================================================
2459 //==============================================================================
2460 // LVDCON Bits
2462 extern __at(0x0FD2) __sfr LVDCON;
2464 typedef union
2466 struct
2468 unsigned HLVDL0 : 1;
2469 unsigned HLVDL1 : 1;
2470 unsigned HLVDL2 : 1;
2471 unsigned HLVDL3 : 1;
2472 unsigned HLVDEN : 1;
2473 unsigned IRVST : 1;
2474 unsigned : 1;
2475 unsigned VDIRMAG : 1;
2478 struct
2480 unsigned LVDL0 : 1;
2481 unsigned LVDL1 : 1;
2482 unsigned LVDL2 : 1;
2483 unsigned LVDL3 : 1;
2484 unsigned LVDEN : 1;
2485 unsigned IVRST : 1;
2486 unsigned : 1;
2487 unsigned : 1;
2490 struct
2492 unsigned LVV0 : 1;
2493 unsigned LVV1 : 1;
2494 unsigned LVV2 : 1;
2495 unsigned LVV3 : 1;
2496 unsigned : 1;
2497 unsigned BGST : 1;
2498 unsigned : 1;
2499 unsigned : 1;
2502 struct
2504 unsigned LVDL : 4;
2505 unsigned : 4;
2508 struct
2510 unsigned LVV : 4;
2511 unsigned : 4;
2514 struct
2516 unsigned HLVDL : 4;
2517 unsigned : 4;
2519 } __LVDCONbits_t;
2521 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2523 #define _LVDCON_HLVDL0 0x01
2524 #define _LVDCON_LVDL0 0x01
2525 #define _LVDCON_LVV0 0x01
2526 #define _LVDCON_HLVDL1 0x02
2527 #define _LVDCON_LVDL1 0x02
2528 #define _LVDCON_LVV1 0x02
2529 #define _LVDCON_HLVDL2 0x04
2530 #define _LVDCON_LVDL2 0x04
2531 #define _LVDCON_LVV2 0x04
2532 #define _LVDCON_HLVDL3 0x08
2533 #define _LVDCON_LVDL3 0x08
2534 #define _LVDCON_LVV3 0x08
2535 #define _LVDCON_HLVDEN 0x10
2536 #define _LVDCON_LVDEN 0x10
2537 #define _LVDCON_IRVST 0x20
2538 #define _LVDCON_IVRST 0x20
2539 #define _LVDCON_BGST 0x20
2540 #define _LVDCON_VDIRMAG 0x80
2542 //==============================================================================
2545 //==============================================================================
2546 // OSCCON Bits
2548 extern __at(0x0FD3) __sfr OSCCON;
2550 typedef union
2552 struct
2554 unsigned SCS0 : 1;
2555 unsigned SCS1 : 1;
2556 unsigned : 1;
2557 unsigned OSTS : 1;
2558 unsigned : 1;
2559 unsigned : 1;
2560 unsigned : 1;
2561 unsigned IDLEN : 1;
2564 struct
2566 unsigned SCS : 2;
2567 unsigned : 6;
2569 } __OSCCONbits_t;
2571 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2573 #define _SCS0 0x01
2574 #define _SCS1 0x02
2575 #define _OSTS 0x08
2576 #define _IDLEN 0x80
2578 //==============================================================================
2581 //==============================================================================
2582 // T0CON Bits
2584 extern __at(0x0FD5) __sfr T0CON;
2586 typedef union
2588 struct
2590 unsigned T0PS0 : 1;
2591 unsigned T0PS1 : 1;
2592 unsigned T0PS2 : 1;
2593 unsigned PSA : 1;
2594 unsigned T0SE : 1;
2595 unsigned T0CS : 1;
2596 unsigned T08BIT : 1;
2597 unsigned TMR0ON : 1;
2600 struct
2602 unsigned T0PS : 3;
2603 unsigned : 5;
2605 } __T0CONbits_t;
2607 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2609 #define _T0PS0 0x01
2610 #define _T0PS1 0x02
2611 #define _T0PS2 0x04
2612 #define _PSA 0x08
2613 #define _T0SE 0x10
2614 #define _T0CS 0x20
2615 #define _T08BIT 0x40
2616 #define _TMR0ON 0x80
2618 //==============================================================================
2620 extern __at(0x0FD6) __sfr TMR0;
2621 extern __at(0x0FD6) __sfr TMR0L;
2622 extern __at(0x0FD7) __sfr TMR0H;
2624 //==============================================================================
2625 // STATUS Bits
2627 extern __at(0x0FD8) __sfr STATUS;
2629 typedef struct
2631 unsigned C : 1;
2632 unsigned DC : 1;
2633 unsigned Z : 1;
2634 unsigned OV : 1;
2635 unsigned N : 1;
2636 unsigned : 1;
2637 unsigned : 1;
2638 unsigned : 1;
2639 } __STATUSbits_t;
2641 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2643 #define _C 0x01
2644 #define _DC 0x02
2645 #define _Z 0x04
2646 #define _OV 0x08
2647 #define _N 0x10
2649 //==============================================================================
2651 extern __at(0x0FD9) __sfr FSR2L;
2652 extern __at(0x0FDA) __sfr FSR2H;
2653 extern __at(0x0FDB) __sfr PLUSW2;
2654 extern __at(0x0FDC) __sfr PREINC2;
2655 extern __at(0x0FDD) __sfr POSTDEC2;
2656 extern __at(0x0FDE) __sfr POSTINC2;
2657 extern __at(0x0FDF) __sfr INDF2;
2658 extern __at(0x0FE0) __sfr BSR;
2659 extern __at(0x0FE1) __sfr FSR1L;
2660 extern __at(0x0FE2) __sfr FSR1H;
2661 extern __at(0x0FE3) __sfr PLUSW1;
2662 extern __at(0x0FE4) __sfr PREINC1;
2663 extern __at(0x0FE5) __sfr POSTDEC1;
2664 extern __at(0x0FE6) __sfr POSTINC1;
2665 extern __at(0x0FE7) __sfr INDF1;
2666 extern __at(0x0FE8) __sfr WREG;
2667 extern __at(0x0FE9) __sfr FSR0L;
2668 extern __at(0x0FEA) __sfr FSR0H;
2669 extern __at(0x0FEB) __sfr PLUSW0;
2670 extern __at(0x0FEC) __sfr PREINC0;
2671 extern __at(0x0FED) __sfr POSTDEC0;
2672 extern __at(0x0FEE) __sfr POSTINC0;
2673 extern __at(0x0FEF) __sfr INDF0;
2675 //==============================================================================
2676 // INTCON3 Bits
2678 extern __at(0x0FF0) __sfr INTCON3;
2680 typedef union
2682 struct
2684 unsigned INT1IF : 1;
2685 unsigned INT2IF : 1;
2686 unsigned : 1;
2687 unsigned INT1IE : 1;
2688 unsigned INT2IE : 1;
2689 unsigned : 1;
2690 unsigned INT1IP : 1;
2691 unsigned INT2IP : 1;
2694 struct
2696 unsigned INT1F : 1;
2697 unsigned INT2F : 1;
2698 unsigned : 1;
2699 unsigned INT1E : 1;
2700 unsigned INT2E : 1;
2701 unsigned : 1;
2702 unsigned INT1P : 1;
2703 unsigned INT2P : 1;
2705 } __INTCON3bits_t;
2707 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2709 #define _INT1IF 0x01
2710 #define _INT1F 0x01
2711 #define _INT2IF 0x02
2712 #define _INT2F 0x02
2713 #define _INT1IE 0x08
2714 #define _INT1E 0x08
2715 #define _INT2IE 0x10
2716 #define _INT2E 0x10
2717 #define _INT1IP 0x40
2718 #define _INT1P 0x40
2719 #define _INT2IP 0x80
2720 #define _INT2P 0x80
2722 //==============================================================================
2725 //==============================================================================
2726 // INTCON2 Bits
2728 extern __at(0x0FF1) __sfr INTCON2;
2730 typedef union
2732 struct
2734 unsigned RBIP : 1;
2735 unsigned : 1;
2736 unsigned TMR0IP : 1;
2737 unsigned : 1;
2738 unsigned INTEDG2 : 1;
2739 unsigned INTEDG1 : 1;
2740 unsigned INTEDG0 : 1;
2741 unsigned NOT_RBPU : 1;
2744 struct
2746 unsigned : 1;
2747 unsigned : 1;
2748 unsigned T0IP : 1;
2749 unsigned : 1;
2750 unsigned : 1;
2751 unsigned : 1;
2752 unsigned : 1;
2753 unsigned RBPU : 1;
2755 } __INTCON2bits_t;
2757 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2759 #define _RBIP 0x01
2760 #define _TMR0IP 0x04
2761 #define _T0IP 0x04
2762 #define _INTEDG2 0x10
2763 #define _INTEDG1 0x20
2764 #define _INTEDG0 0x40
2765 #define _NOT_RBPU 0x80
2766 #define _RBPU 0x80
2768 //==============================================================================
2771 //==============================================================================
2772 // INTCON Bits
2774 extern __at(0x0FF2) __sfr INTCON;
2776 typedef union
2778 struct
2780 unsigned RBIF : 1;
2781 unsigned INT0IF : 1;
2782 unsigned TMR0IF : 1;
2783 unsigned RBIE : 1;
2784 unsigned INT0IE : 1;
2785 unsigned TMR0IE : 1;
2786 unsigned PEIE_GIEL : 1;
2787 unsigned GIE_GIEH : 1;
2790 struct
2792 unsigned : 1;
2793 unsigned INT0F : 1;
2794 unsigned T0IF : 1;
2795 unsigned : 1;
2796 unsigned INT0E : 1;
2797 unsigned T0IE : 1;
2798 unsigned PEIE : 1;
2799 unsigned GIE : 1;
2802 struct
2804 unsigned : 1;
2805 unsigned : 1;
2806 unsigned : 1;
2807 unsigned : 1;
2808 unsigned : 1;
2809 unsigned : 1;
2810 unsigned GIEL : 1;
2811 unsigned GIEH : 1;
2813 } __INTCONbits_t;
2815 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2817 #define _RBIF 0x01
2818 #define _INT0IF 0x02
2819 #define _INT0F 0x02
2820 #define _TMR0IF 0x04
2821 #define _T0IF 0x04
2822 #define _RBIE 0x08
2823 #define _INT0IE 0x10
2824 #define _INT0E 0x10
2825 #define _TMR0IE 0x20
2826 #define _T0IE 0x20
2827 #define _PEIE_GIEL 0x40
2828 #define _PEIE 0x40
2829 #define _GIEL 0x40
2830 #define _GIE_GIEH 0x80
2831 #define _GIE 0x80
2832 #define _GIEH 0x80
2834 //==============================================================================
2836 extern __at(0x0FF3) __sfr PROD;
2837 extern __at(0x0FF3) __sfr PRODL;
2838 extern __at(0x0FF4) __sfr PRODH;
2839 extern __at(0x0FF5) __sfr TABLAT;
2840 extern __at(0x0FF6) __sfr TBLPTR;
2841 extern __at(0x0FF6) __sfr TBLPTRL;
2842 extern __at(0x0FF7) __sfr TBLPTRH;
2843 extern __at(0x0FF8) __sfr TBLPTRU;
2844 extern __at(0x0FF9) __sfr PC;
2845 extern __at(0x0FF9) __sfr PCL;
2846 extern __at(0x0FFA) __sfr PCLATH;
2847 extern __at(0x0FFB) __sfr PCLATU;
2849 //==============================================================================
2850 // STKPTR Bits
2852 extern __at(0x0FFC) __sfr STKPTR;
2854 typedef union
2856 struct
2858 unsigned STKPTR0 : 1;
2859 unsigned STKPTR1 : 1;
2860 unsigned STKPTR2 : 1;
2861 unsigned STKPTR3 : 1;
2862 unsigned STKPTR4 : 1;
2863 unsigned : 1;
2864 unsigned STKUNF : 1;
2865 unsigned STKFUL : 1;
2868 struct
2870 unsigned : 1;
2871 unsigned : 1;
2872 unsigned : 1;
2873 unsigned : 1;
2874 unsigned : 1;
2875 unsigned : 1;
2876 unsigned : 1;
2877 unsigned STKOVF : 1;
2880 struct
2882 unsigned STKPTR : 5;
2883 unsigned : 3;
2885 } __STKPTRbits_t;
2887 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2889 #define _STKPTR0 0x01
2890 #define _STKPTR1 0x02
2891 #define _STKPTR2 0x04
2892 #define _STKPTR3 0x08
2893 #define _STKPTR4 0x10
2894 #define _STKUNF 0x40
2895 #define _STKFUL 0x80
2896 #define _STKOVF 0x80
2898 //==============================================================================
2900 extern __at(0x0FFD) __sfr TOS;
2901 extern __at(0x0FFD) __sfr TOSL;
2902 extern __at(0x0FFE) __sfr TOSH;
2903 extern __at(0x0FFF) __sfr TOSU;
2905 //==============================================================================
2907 // Configuration Bits
2909 //==============================================================================
2911 #define __CONFIG1L 0x300000
2912 #define __CONFIG1H 0x300001
2913 #define __CONFIG2L 0x300002
2914 #define __CONFIG2H 0x300003
2915 #define __CONFIG3H 0x300005
2916 #define __CONFIG4L 0x300006
2917 #define __CONFIG5L 0x300008
2918 #define __CONFIG5H 0x300009
2919 #define __CONFIG6L 0x30000A
2920 #define __CONFIG6H 0x30000B
2921 #define __CONFIG7L 0x30000C
2922 #define __CONFIG7H 0x30000D
2924 //----------------------------- CONFIG1L Options -------------------------------
2926 #define _PLLDIV_1_1L 0xF8 // No prescale (4 MHz oscillator input drives PLL directly).
2927 #define _PLLDIV_2_1L 0xF9 // Divide by 2 (8 MHz oscillator input).
2928 #define _PLLDIV_3_1L 0xFA // Divide by 3 (12 MHz oscillator input).
2929 #define _PLLDIV_4_1L 0xFB // Divide by 4 (16 MHz oscillator input).
2930 #define _PLLDIV_5_1L 0xFC // Divide by 5 (20 MHz oscillator input).
2931 #define _PLLDIV_6_1L 0xFD // Divide by 6 (24 MHz oscillator input).
2932 #define _PLLDIV_10_1L 0xFE // Divide by 10 (40 MHz oscillator input).
2933 #define _PLLDIV_12_1L 0xFF // Divide by 12 (48 MHz oscillator input).
2934 #define _CPUDIV_OSC1_PLL2_1L 0xE7 // [Primary Oscillator Src: /1][96 MHz PLL Src: /2].
2935 #define _CPUDIV_OSC2_PLL3_1L 0xEF // [Primary Oscillator Src: /2][96 MHz PLL Src: /3].
2936 #define _CPUDIV_OSC3_PLL4_1L 0xF7 // [Primary Oscillator Src: /3][96 MHz PLL Src: /4].
2937 #define _CPUDIV_OSC4_PLL6_1L 0xFF // [Primary Oscillator Src: /4][96 MHz PLL Src: /6].
2938 #define _USBDIV_1_1L 0xDF // USB clock source comes directly from the primary oscillator block with no postscale.
2939 #define _USBDIV_2_1L 0xFF // USB clock source comes from the 96 MHz PLL divided by 2.
2941 //----------------------------- CONFIG1H Options -------------------------------
2943 #define _FOSC_XT_XT_1H 0xF0 // XT oscillator (XT).
2944 #define _FOSC_XTPLL_XT_1H 0xF2 // XT oscillator, PLL enabled (XTPLL).
2945 #define _FOSC_ECIO_EC_1H 0xF4 // EC oscillator, port function on RA6 (ECIO).
2946 #define _FOSC_EC_EC_1H 0xF5 // EC oscillator, CLKO function on RA6 (EC).
2947 #define _FOSC_ECPLLIO_EC_1H 0xF6 // EC oscillator, PLL enabled, port function on RA6 (ECPIO).
2948 #define _FOSC_ECPLL_EC_1H 0xF7 // EC oscillator, PLL enabled, CLKO function on RA6 (ECPLL).
2949 #define _FOSC_INTOSCIO_EC_1H 0xF8 // Internal oscillator, port function on RA6, EC used by USB (INTIO).
2950 #define _FOSC_INTOSC_EC_1H 0xF9 // Internal oscillator, CLKO function on RA6, EC used by USB (INTCKO).
2951 #define _FOSC_INTOSC_XT_1H 0xFA // Internal oscillator, XT used by USB (INTXT).
2952 #define _FOSC_INTOSC_HS_1H 0xFB // Internal oscillator, HS oscillator used by USB (INTHS).
2953 #define _FOSC_HS_1H 0xFC // HS oscillator (HS).
2954 #define _FOSC_HSPLL_HS_1H 0xFE // HS oscillator, PLL enabled (HSPLL).
2955 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2956 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2957 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled.
2958 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled.
2960 //----------------------------- CONFIG2L Options -------------------------------
2962 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2963 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2964 #define _BOR_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software.
2965 #define _BOR_SOFT_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled).
2966 #define _BOR_ON_ACTIVE_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled).
2967 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled).
2968 #define _BORV_46_2L 0xE7 // 4.6V.
2969 #define _BORV_43_2L 0xEF // 4.3V.
2970 #define _BORV_28_2L 0xF7 // 2.8V.
2971 #define _BORV_21_2L 0xFF // 2.1V.
2972 #define _VREGEN_OFF_2L 0xDF // USB voltage regulator disabled.
2973 #define _VREGEN_ON_2L 0xFF // USB voltage regulator enabled.
2975 //----------------------------- CONFIG2H Options -------------------------------
2977 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2978 #define _WDT_ON_2H 0xFF // WDT enabled.
2979 #define _WDTPS_1_2H 0xE1 // 1:1.
2980 #define _WDTPS_2_2H 0xE3 // 1:2.
2981 #define _WDTPS_4_2H 0xE5 // 1:4.
2982 #define _WDTPS_8_2H 0xE7 // 1:8.
2983 #define _WDTPS_16_2H 0xE9 // 1:16.
2984 #define _WDTPS_32_2H 0xEB // 1:32.
2985 #define _WDTPS_64_2H 0xED // 1:64.
2986 #define _WDTPS_128_2H 0xEF // 1:128.
2987 #define _WDTPS_256_2H 0xF1 // 1:256.
2988 #define _WDTPS_512_2H 0xF3 // 1:512.
2989 #define _WDTPS_1024_2H 0xF5 // 1:1024.
2990 #define _WDTPS_2048_2H 0xF7 // 1:2048.
2991 #define _WDTPS_4096_2H 0xF9 // 1:4096.
2992 #define _WDTPS_8192_2H 0xFB // 1:8192.
2993 #define _WDTPS_16384_2H 0xFD // 1:16384.
2994 #define _WDTPS_32768_2H 0xFF // 1:32768.
2996 //----------------------------- CONFIG3H Options -------------------------------
2998 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset.
2999 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset.
3000 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation.
3001 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation.
3002 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR pin disabled.
3003 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled.
3005 //----------------------------- CONFIG4L Options -------------------------------
3007 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
3008 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset.
3009 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled.
3010 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled.
3011 #define _BBSIZ_BB1K_4L 0xF7 // 1KW Boot block size.
3012 #define _BBSIZ_BB2K_4L 0xFF // 2KW Boot block size.
3013 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode).
3014 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled.
3015 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
3016 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
3018 //----------------------------- CONFIG5L Options -------------------------------
3020 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) or (001000-001FFFh) is code-protected.
3021 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) or (001000-001FFFh) is not code-protected.
3022 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) is code-protected.
3023 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) is not code-protected.
3025 //----------------------------- CONFIG5H Options -------------------------------
3027 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) or (000000-000FFFh) is code-protected.
3028 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) or (000000-000FFFh) is not code-protected.
3030 //----------------------------- CONFIG6L Options -------------------------------
3032 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) or (001000-001FFFh) is write-protected.
3033 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) or (001000-001FFFh) is not write-protected.
3034 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) is write-protected.
3035 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) is not write-protected.
3037 //----------------------------- CONFIG6H Options -------------------------------
3039 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) are write-protected.
3040 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) are not write-protected.
3041 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) or (000000-000FFFh) is write-protected.
3042 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) or (000000-000FFFh) is not write-protected.
3044 //----------------------------- CONFIG7L Options -------------------------------
3046 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) or (001000-001FFFh) is protected from table reads executed in other blocks.
3047 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) or (001000-001FFFh) is not protected from table reads executed in other blocks.
3048 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) is protected from table reads executed in other blocks.
3049 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks.
3051 //----------------------------- CONFIG7H Options -------------------------------
3053 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) or (000000-000FFFh) is protected from table reads executed in other blocks.
3054 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) or (000000-000FFFh) is not protected from table reads executed in other blocks.
3056 //==============================================================================
3058 #define __DEVID1 0x3FFFFE
3059 #define __DEVID2 0x3FFFFF
3061 #define __IDLOC0 0x200000
3062 #define __IDLOC1 0x200001
3063 #define __IDLOC2 0x200002
3064 #define __IDLOC3 0x200003
3065 #define __IDLOC4 0x200004
3066 #define __IDLOC5 0x200005
3067 #define __IDLOC6 0x200006
3068 #define __IDLOC7 0x200007
3070 #endif // #ifndef __PIC18LF2450_H__