struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f1320.h
blob7c2856a4045572936ed95b2380c94480786af973
1 /*
2 * This declarations of the PIC18F1320 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:42 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 __PIC18F1320_H__
26 #define __PIC18F1320_H__
28 //==============================================================================
30 //==============================================================================
32 // Register Definitions
34 //==============================================================================
37 //==============================================================================
38 // PORTA Bits
40 extern __at(0x0F80) __sfr PORTA;
42 typedef union
44 struct
46 unsigned RA0 : 1;
47 unsigned RA1 : 1;
48 unsigned RA2 : 1;
49 unsigned RA3 : 1;
50 unsigned RA4 : 1;
51 unsigned RA5 : 1;
52 unsigned RA6 : 1;
53 unsigned RA7 : 1;
56 struct
58 unsigned AN0 : 1;
59 unsigned AN1 : 1;
60 unsigned AN2 : 1;
61 unsigned AN3 : 1;
62 unsigned T0CKI : 1;
63 unsigned MCLR : 1;
64 unsigned CLKO : 1;
65 unsigned CLKI : 1;
68 struct
70 unsigned : 1;
71 unsigned LVDIN : 1;
72 unsigned VREFM : 1;
73 unsigned VREFP : 1;
74 unsigned : 1;
75 unsigned NOT_MCLR : 1;
76 unsigned OSC2 : 1;
77 unsigned OSC1 : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned : 1;
88 unsigned CLKOUT : 1;
89 unsigned CLKIN : 1;
92 struct
94 unsigned AN : 4;
95 unsigned : 4;
97 } __PORTAbits_t;
99 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits;
101 #define _PORTA_RA0 0x01
102 #define _PORTA_AN0 0x01
103 #define _PORTA_RA1 0x02
104 #define _PORTA_AN1 0x02
105 #define _PORTA_LVDIN 0x02
106 #define _PORTA_RA2 0x04
107 #define _PORTA_AN2 0x04
108 #define _PORTA_VREFM 0x04
109 #define _PORTA_RA3 0x08
110 #define _PORTA_AN3 0x08
111 #define _PORTA_VREFP 0x08
112 #define _PORTA_RA4 0x10
113 #define _PORTA_T0CKI 0x10
114 #define _PORTA_RA5 0x20
115 #define _PORTA_MCLR 0x20
116 #define _PORTA_NOT_MCLR 0x20
117 #define _PORTA_RA6 0x40
118 #define _PORTA_CLKO 0x40
119 #define _PORTA_OSC2 0x40
120 #define _PORTA_CLKOUT 0x40
121 #define _PORTA_RA7 0x80
122 #define _PORTA_CLKI 0x80
123 #define _PORTA_OSC1 0x80
124 #define _PORTA_CLKIN 0x80
126 //==============================================================================
129 //==============================================================================
130 // PORTB Bits
132 extern __at(0x0F81) __sfr PORTB;
134 typedef union
136 struct
138 unsigned RB0 : 1;
139 unsigned RB1 : 1;
140 unsigned RB2 : 1;
141 unsigned RB3 : 1;
142 unsigned RB4 : 1;
143 unsigned RB5 : 1;
144 unsigned RB6 : 1;
145 unsigned RB7 : 1;
148 struct
150 unsigned AN4 : 1;
151 unsigned AN5 : 1;
152 unsigned INT2 : 1;
153 unsigned CCP1 : 1;
154 unsigned AN6 : 1;
155 unsigned PGM : 1;
156 unsigned PGC : 1;
157 unsigned PGD : 1;
160 struct
162 unsigned INT0 : 1;
163 unsigned INT1 : 1;
164 unsigned P1B : 1;
165 unsigned P1A : 1;
166 unsigned KBI0 : 1;
167 unsigned KBI1 : 1;
168 unsigned KBI2 : 1;
169 unsigned KBI3 : 1;
172 struct
174 unsigned : 1;
175 unsigned CK : 1;
176 unsigned : 1;
177 unsigned : 1;
178 unsigned RX : 1;
179 unsigned : 1;
180 unsigned P1C : 1;
181 unsigned P1D : 1;
184 struct
186 unsigned : 1;
187 unsigned TX : 1;
188 unsigned : 1;
189 unsigned : 1;
190 unsigned : 1;
191 unsigned : 1;
192 unsigned T1OSO : 1;
193 unsigned T1OSI : 1;
196 struct
198 unsigned : 1;
199 unsigned : 1;
200 unsigned : 1;
201 unsigned : 1;
202 unsigned : 1;
203 unsigned : 1;
204 unsigned T13CKI : 1;
205 unsigned : 1;
208 struct
210 unsigned : 1;
211 unsigned : 1;
212 unsigned : 1;
213 unsigned : 1;
214 unsigned : 1;
215 unsigned : 1;
216 unsigned T1CKI : 1;
217 unsigned : 1;
220 struct
222 unsigned INT : 3;
223 unsigned : 5;
226 struct
228 unsigned : 4;
229 unsigned KBI : 4;
231 } __PORTBbits_t;
233 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
235 #define _PORTB_RB0 0x01
236 #define _PORTB_AN4 0x01
237 #define _PORTB_INT0 0x01
238 #define _PORTB_RB1 0x02
239 #define _PORTB_AN5 0x02
240 #define _PORTB_INT1 0x02
241 #define _PORTB_CK 0x02
242 #define _PORTB_TX 0x02
243 #define _PORTB_RB2 0x04
244 #define _PORTB_INT2 0x04
245 #define _PORTB_P1B 0x04
246 #define _PORTB_RB3 0x08
247 #define _PORTB_CCP1 0x08
248 #define _PORTB_P1A 0x08
249 #define _PORTB_RB4 0x10
250 #define _PORTB_AN6 0x10
251 #define _PORTB_KBI0 0x10
252 #define _PORTB_RX 0x10
253 #define _PORTB_RB5 0x20
254 #define _PORTB_PGM 0x20
255 #define _PORTB_KBI1 0x20
256 #define _PORTB_RB6 0x40
257 #define _PORTB_PGC 0x40
258 #define _PORTB_KBI2 0x40
259 #define _PORTB_P1C 0x40
260 #define _PORTB_T1OSO 0x40
261 #define _PORTB_T13CKI 0x40
262 #define _PORTB_T1CKI 0x40
263 #define _PORTB_RB7 0x80
264 #define _PORTB_PGD 0x80
265 #define _PORTB_KBI3 0x80
266 #define _PORTB_P1D 0x80
267 #define _PORTB_T1OSI 0x80
269 //==============================================================================
272 //==============================================================================
273 // LATA Bits
275 extern __at(0x0F89) __sfr LATA;
277 typedef struct
279 unsigned LATA0 : 1;
280 unsigned LATA1 : 1;
281 unsigned LATA2 : 1;
282 unsigned LATA3 : 1;
283 unsigned LATA4 : 1;
284 unsigned : 1;
285 unsigned LATA6 : 1;
286 unsigned LATA7 : 1;
287 } __LATAbits_t;
289 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
291 #define _LATA0 0x01
292 #define _LATA1 0x02
293 #define _LATA2 0x04
294 #define _LATA3 0x08
295 #define _LATA4 0x10
296 #define _LATA6 0x40
297 #define _LATA7 0x80
299 //==============================================================================
302 //==============================================================================
303 // LATB Bits
305 extern __at(0x0F8A) __sfr LATB;
307 typedef struct
309 unsigned LATB0 : 1;
310 unsigned LATB1 : 1;
311 unsigned LATB2 : 1;
312 unsigned LATB3 : 1;
313 unsigned LATB4 : 1;
314 unsigned LATB5 : 1;
315 unsigned LATB6 : 1;
316 unsigned LATB7 : 1;
317 } __LATBbits_t;
319 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
321 #define _LATB0 0x01
322 #define _LATB1 0x02
323 #define _LATB2 0x04
324 #define _LATB3 0x08
325 #define _LATB4 0x10
326 #define _LATB5 0x20
327 #define _LATB6 0x40
328 #define _LATB7 0x80
330 //==============================================================================
333 //==============================================================================
334 // DDRA Bits
336 extern __at(0x0F92) __sfr DDRA;
338 typedef union
340 struct
342 unsigned TRISA0 : 1;
343 unsigned TRISA1 : 1;
344 unsigned TRISA2 : 1;
345 unsigned TRISA3 : 1;
346 unsigned TRISA4 : 1;
347 unsigned : 1;
348 unsigned TRISA6 : 1;
349 unsigned TRISA7 : 1;
352 struct
354 unsigned RA0 : 1;
355 unsigned RA1 : 1;
356 unsigned RA2 : 1;
357 unsigned RA3 : 1;
358 unsigned RA4 : 1;
359 unsigned : 1;
360 unsigned RA6 : 1;
361 unsigned RA7 : 1;
363 } __DDRAbits_t;
365 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
367 #define _TRISA0 0x01
368 #define _RA0 0x01
369 #define _TRISA1 0x02
370 #define _RA1 0x02
371 #define _TRISA2 0x04
372 #define _RA2 0x04
373 #define _TRISA3 0x08
374 #define _RA3 0x08
375 #define _TRISA4 0x10
376 #define _RA4 0x10
377 #define _TRISA6 0x40
378 #define _RA6 0x40
379 #define _TRISA7 0x80
380 #define _RA7 0x80
382 //==============================================================================
385 //==============================================================================
386 // TRISA Bits
388 extern __at(0x0F92) __sfr TRISA;
390 typedef union
392 struct
394 unsigned TRISA0 : 1;
395 unsigned TRISA1 : 1;
396 unsigned TRISA2 : 1;
397 unsigned TRISA3 : 1;
398 unsigned TRISA4 : 1;
399 unsigned : 1;
400 unsigned TRISA6 : 1;
401 unsigned TRISA7 : 1;
404 struct
406 unsigned RA0 : 1;
407 unsigned RA1 : 1;
408 unsigned RA2 : 1;
409 unsigned RA3 : 1;
410 unsigned RA4 : 1;
411 unsigned : 1;
412 unsigned RA6 : 1;
413 unsigned RA7 : 1;
415 } __TRISAbits_t;
417 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
419 #define _TRISA_TRISA0 0x01
420 #define _TRISA_RA0 0x01
421 #define _TRISA_TRISA1 0x02
422 #define _TRISA_RA1 0x02
423 #define _TRISA_TRISA2 0x04
424 #define _TRISA_RA2 0x04
425 #define _TRISA_TRISA3 0x08
426 #define _TRISA_RA3 0x08
427 #define _TRISA_TRISA4 0x10
428 #define _TRISA_RA4 0x10
429 #define _TRISA_TRISA6 0x40
430 #define _TRISA_RA6 0x40
431 #define _TRISA_TRISA7 0x80
432 #define _TRISA_RA7 0x80
434 //==============================================================================
437 //==============================================================================
438 // DDRB Bits
440 extern __at(0x0F93) __sfr DDRB;
442 typedef union
444 struct
446 unsigned TRISB0 : 1;
447 unsigned TRISB1 : 1;
448 unsigned TRISB2 : 1;
449 unsigned TRISB3 : 1;
450 unsigned TRISB4 : 1;
451 unsigned TRISB5 : 1;
452 unsigned TRISB6 : 1;
453 unsigned TRISB7 : 1;
456 struct
458 unsigned RB0 : 1;
459 unsigned RB1 : 1;
460 unsigned RB2 : 1;
461 unsigned RB3 : 1;
462 unsigned RB4 : 1;
463 unsigned RB5 : 1;
464 unsigned RB6 : 1;
465 unsigned RB7 : 1;
467 } __DDRBbits_t;
469 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
471 #define _TRISB0 0x01
472 #define _RB0 0x01
473 #define _TRISB1 0x02
474 #define _RB1 0x02
475 #define _TRISB2 0x04
476 #define _RB2 0x04
477 #define _TRISB3 0x08
478 #define _RB3 0x08
479 #define _TRISB4 0x10
480 #define _RB4 0x10
481 #define _TRISB5 0x20
482 #define _RB5 0x20
483 #define _TRISB6 0x40
484 #define _RB6 0x40
485 #define _TRISB7 0x80
486 #define _RB7 0x80
488 //==============================================================================
491 //==============================================================================
492 // TRISB Bits
494 extern __at(0x0F93) __sfr TRISB;
496 typedef union
498 struct
500 unsigned TRISB0 : 1;
501 unsigned TRISB1 : 1;
502 unsigned TRISB2 : 1;
503 unsigned TRISB3 : 1;
504 unsigned TRISB4 : 1;
505 unsigned TRISB5 : 1;
506 unsigned TRISB6 : 1;
507 unsigned TRISB7 : 1;
510 struct
512 unsigned RB0 : 1;
513 unsigned RB1 : 1;
514 unsigned RB2 : 1;
515 unsigned RB3 : 1;
516 unsigned RB4 : 1;
517 unsigned RB5 : 1;
518 unsigned RB6 : 1;
519 unsigned RB7 : 1;
521 } __TRISBbits_t;
523 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
525 #define _TRISB_TRISB0 0x01
526 #define _TRISB_RB0 0x01
527 #define _TRISB_TRISB1 0x02
528 #define _TRISB_RB1 0x02
529 #define _TRISB_TRISB2 0x04
530 #define _TRISB_RB2 0x04
531 #define _TRISB_TRISB3 0x08
532 #define _TRISB_RB3 0x08
533 #define _TRISB_TRISB4 0x10
534 #define _TRISB_RB4 0x10
535 #define _TRISB_TRISB5 0x20
536 #define _TRISB_RB5 0x20
537 #define _TRISB_TRISB6 0x40
538 #define _TRISB_RB6 0x40
539 #define _TRISB_TRISB7 0x80
540 #define _TRISB_RB7 0x80
542 //==============================================================================
545 //==============================================================================
546 // OSCTUNE Bits
548 extern __at(0x0F9B) __sfr OSCTUNE;
550 typedef union
552 struct
554 unsigned TUN0 : 1;
555 unsigned TUN1 : 1;
556 unsigned TUN2 : 1;
557 unsigned TUN3 : 1;
558 unsigned TUN4 : 1;
559 unsigned TUN5 : 1;
560 unsigned : 1;
561 unsigned : 1;
564 struct
566 unsigned TUN : 6;
567 unsigned : 2;
569 } __OSCTUNEbits_t;
571 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits;
573 #define _TUN0 0x01
574 #define _TUN1 0x02
575 #define _TUN2 0x04
576 #define _TUN3 0x08
577 #define _TUN4 0x10
578 #define _TUN5 0x20
580 //==============================================================================
583 //==============================================================================
584 // PIE1 Bits
586 extern __at(0x0F9D) __sfr PIE1;
588 typedef struct
590 unsigned TMR1IE : 1;
591 unsigned TMR2IE : 1;
592 unsigned CCP1IE : 1;
593 unsigned : 1;
594 unsigned TXIE : 1;
595 unsigned RCIE : 1;
596 unsigned ADIE : 1;
597 unsigned : 1;
598 } __PIE1bits_t;
600 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
602 #define _TMR1IE 0x01
603 #define _TMR2IE 0x02
604 #define _CCP1IE 0x04
605 #define _TXIE 0x10
606 #define _RCIE 0x20
607 #define _ADIE 0x40
609 //==============================================================================
612 //==============================================================================
613 // PIR1 Bits
615 extern __at(0x0F9E) __sfr PIR1;
617 typedef struct
619 unsigned TMR1IF : 1;
620 unsigned TMR2IF : 1;
621 unsigned CCP1IF : 1;
622 unsigned : 1;
623 unsigned TXIF : 1;
624 unsigned RCIF : 1;
625 unsigned ADIF : 1;
626 unsigned : 1;
627 } __PIR1bits_t;
629 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
631 #define _TMR1IF 0x01
632 #define _TMR2IF 0x02
633 #define _CCP1IF 0x04
634 #define _TXIF 0x10
635 #define _RCIF 0x20
636 #define _ADIF 0x40
638 //==============================================================================
641 //==============================================================================
642 // IPR1 Bits
644 extern __at(0x0F9F) __sfr IPR1;
646 typedef struct
648 unsigned TMR1IP : 1;
649 unsigned TMR2IP : 1;
650 unsigned CCP1IP : 1;
651 unsigned : 1;
652 unsigned TXIP : 1;
653 unsigned RCIP : 1;
654 unsigned ADIP : 1;
655 unsigned : 1;
656 } __IPR1bits_t;
658 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
660 #define _TMR1IP 0x01
661 #define _TMR2IP 0x02
662 #define _CCP1IP 0x04
663 #define _TXIP 0x10
664 #define _RCIP 0x20
665 #define _ADIP 0x40
667 //==============================================================================
670 //==============================================================================
671 // PIE2 Bits
673 extern __at(0x0FA0) __sfr PIE2;
675 typedef struct
677 unsigned : 1;
678 unsigned TMR3IE : 1;
679 unsigned LVDIE : 1;
680 unsigned : 1;
681 unsigned EEIE : 1;
682 unsigned : 1;
683 unsigned : 1;
684 unsigned OSCFIE : 1;
685 } __PIE2bits_t;
687 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
689 #define _TMR3IE 0x02
690 #define _LVDIE 0x04
691 #define _EEIE 0x10
692 #define _OSCFIE 0x80
694 //==============================================================================
697 //==============================================================================
698 // PIR2 Bits
700 extern __at(0x0FA1) __sfr PIR2;
702 typedef struct
704 unsigned : 1;
705 unsigned TMR3IF : 1;
706 unsigned LVDIF : 1;
707 unsigned : 1;
708 unsigned EEIF : 1;
709 unsigned : 1;
710 unsigned : 1;
711 unsigned OSCFIF : 1;
712 } __PIR2bits_t;
714 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
716 #define _TMR3IF 0x02
717 #define _LVDIF 0x04
718 #define _EEIF 0x10
719 #define _OSCFIF 0x80
721 //==============================================================================
724 //==============================================================================
725 // IPR2 Bits
727 extern __at(0x0FA2) __sfr IPR2;
729 typedef struct
731 unsigned : 1;
732 unsigned TMR3IP : 1;
733 unsigned LVDIP : 1;
734 unsigned : 1;
735 unsigned EEIP : 1;
736 unsigned : 1;
737 unsigned : 1;
738 unsigned OSCFIP : 1;
739 } __IPR2bits_t;
741 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
743 #define _TMR3IP 0x02
744 #define _LVDIP 0x04
745 #define _EEIP 0x10
746 #define _OSCFIP 0x80
748 //==============================================================================
751 //==============================================================================
752 // EECON1 Bits
754 extern __at(0x0FA6) __sfr EECON1;
756 typedef struct
758 unsigned RD : 1;
759 unsigned WR : 1;
760 unsigned WREN : 1;
761 unsigned WRERR : 1;
762 unsigned FREE : 1;
763 unsigned : 1;
764 unsigned CFGS : 1;
765 unsigned EEPGD : 1;
766 } __EECON1bits_t;
768 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
770 #define _RD 0x01
771 #define _WR 0x02
772 #define _WREN 0x04
773 #define _WRERR 0x08
774 #define _FREE 0x10
775 #define _CFGS 0x40
776 #define _EEPGD 0x80
778 //==============================================================================
780 extern __at(0x0FA7) __sfr EECON2;
781 extern __at(0x0FA8) __sfr EEDATA;
782 extern __at(0x0FA9) __sfr EEADR;
784 //==============================================================================
785 // BAUDCTL Bits
787 extern __at(0x0FAA) __sfr BAUDCTL;
789 #define BAUDCON BAUDCTL
791 typedef union
793 struct
795 unsigned ABDEN : 1;
796 unsigned WUE : 1;
797 unsigned : 1;
798 unsigned BRG16 : 1;
799 unsigned SCKP : 1;
800 unsigned : 1;
801 unsigned RCIDL : 1;
802 unsigned : 1;
805 struct
807 unsigned : 1;
808 unsigned : 1;
809 unsigned : 1;
810 unsigned : 1;
811 unsigned : 1;
812 unsigned : 1;
813 unsigned RCMT : 1;
814 unsigned : 1;
816 } __BAUDCTLbits_t;
818 extern __at(0x0FAA) volatile __BAUDCTLbits_t BAUDCTLbits;
820 #define BAUDCONbits BAUDCTLbits
822 #define _ABDEN 0x01
823 #define _WUE 0x02
824 #define _BRG16 0x08
825 #define _SCKP 0x10
826 #define _RCIDL 0x40
827 #define _RCMT 0x40
829 //==============================================================================
832 //==============================================================================
833 // RCSTA Bits
835 extern __at(0x0FAB) __sfr RCSTA;
837 typedef union
839 struct
841 unsigned RX9D : 1;
842 unsigned OERR : 1;
843 unsigned FERR : 1;
844 unsigned ADDEN : 1;
845 unsigned CREN : 1;
846 unsigned SREN : 1;
847 unsigned RX9 : 1;
848 unsigned SPEN : 1;
851 struct
853 unsigned : 1;
854 unsigned : 1;
855 unsigned : 1;
856 unsigned ADEN : 1;
857 unsigned : 1;
858 unsigned : 1;
859 unsigned : 1;
860 unsigned : 1;
862 } __RCSTAbits_t;
864 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
866 #define _RX9D 0x01
867 #define _OERR 0x02
868 #define _FERR 0x04
869 #define _ADDEN 0x08
870 #define _ADEN 0x08
871 #define _CREN 0x10
872 #define _SREN 0x20
873 #define _RX9 0x40
874 #define _SPEN 0x80
876 //==============================================================================
879 //==============================================================================
880 // TXSTA Bits
882 extern __at(0x0FAC) __sfr TXSTA;
884 typedef struct
886 unsigned TX9D : 1;
887 unsigned TRMT : 1;
888 unsigned BRGH : 1;
889 unsigned SENDB : 1;
890 unsigned SYNC : 1;
891 unsigned TXEN : 1;
892 unsigned TX9 : 1;
893 unsigned CSRC : 1;
894 } __TXSTAbits_t;
896 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
898 #define _TX9D 0x01
899 #define _TRMT 0x02
900 #define _BRGH 0x04
901 #define _SENDB 0x08
902 #define _SYNC 0x10
903 #define _TXEN 0x20
904 #define _TX9 0x40
905 #define _CSRC 0x80
907 //==============================================================================
909 extern __at(0x0FAD) __sfr TXREG;
910 extern __at(0x0FAE) __sfr RCREG;
911 extern __at(0x0FAF) __sfr SPBRG;
912 extern __at(0x0FB0) __sfr SPBRGH;
914 //==============================================================================
915 // T3CON Bits
917 extern __at(0x0FB1) __sfr T3CON;
919 typedef union
921 struct
923 unsigned TMR3ON : 1;
924 unsigned TMR3CS : 1;
925 unsigned NOT_T3SYNC : 1;
926 unsigned T3CCP1 : 1;
927 unsigned T3CKPS0 : 1;
928 unsigned T3CKPS1 : 1;
929 unsigned T3CCP2 : 1;
930 unsigned RD16 : 1;
933 struct
935 unsigned : 1;
936 unsigned : 1;
937 unsigned T3SYNC : 1;
938 unsigned : 1;
939 unsigned : 1;
940 unsigned : 1;
941 unsigned : 1;
942 unsigned : 1;
945 struct
947 unsigned : 4;
948 unsigned T3CKPS : 2;
949 unsigned : 2;
951 } __T3CONbits_t;
953 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
955 #define _T3CON_TMR3ON 0x01
956 #define _T3CON_TMR3CS 0x02
957 #define _T3CON_NOT_T3SYNC 0x04
958 #define _T3CON_T3SYNC 0x04
959 #define _T3CON_T3CCP1 0x08
960 #define _T3CON_T3CKPS0 0x10
961 #define _T3CON_T3CKPS1 0x20
962 #define _T3CON_T3CCP2 0x40
963 #define _T3CON_RD16 0x80
965 //==============================================================================
967 extern __at(0x0FB2) __sfr TMR3;
968 extern __at(0x0FB2) __sfr TMR3L;
969 extern __at(0x0FB3) __sfr TMR3H;
971 //==============================================================================
972 // ECCPAS Bits
974 extern __at(0x0FB6) __sfr ECCPAS;
976 typedef union
978 struct
980 unsigned PSSBD0 : 1;
981 unsigned PSSBD1 : 1;
982 unsigned PSSAC0 : 1;
983 unsigned PSSAC1 : 1;
984 unsigned ECCPAS0 : 1;
985 unsigned ECCPAS1 : 1;
986 unsigned ECCPAS2 : 1;
987 unsigned ECCPASE : 1;
990 struct
992 unsigned PSSBD : 2;
993 unsigned : 6;
996 struct
998 unsigned : 2;
999 unsigned PSSAC : 2;
1000 unsigned : 4;
1003 struct
1005 unsigned : 4;
1006 unsigned ECCPAS : 3;
1007 unsigned : 1;
1009 } __ECCPASbits_t;
1011 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits;
1013 #define _PSSBD0 0x01
1014 #define _PSSBD1 0x02
1015 #define _PSSAC0 0x04
1016 #define _PSSAC1 0x08
1017 #define _ECCPAS0 0x10
1018 #define _ECCPAS1 0x20
1019 #define _ECCPAS2 0x40
1020 #define _ECCPASE 0x80
1022 //==============================================================================
1025 //==============================================================================
1026 // PWM1CON Bits
1028 extern __at(0x0FB7) __sfr PWM1CON;
1030 typedef union
1032 struct
1034 unsigned PDC0 : 1;
1035 unsigned PDC1 : 1;
1036 unsigned PDC2 : 1;
1037 unsigned PDC3 : 1;
1038 unsigned PDC4 : 1;
1039 unsigned PDC5 : 1;
1040 unsigned PDC6 : 1;
1041 unsigned PRSEN : 1;
1044 struct
1046 unsigned PDC : 7;
1047 unsigned : 1;
1049 } __PWM1CONbits_t;
1051 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits;
1053 #define _PDC0 0x01
1054 #define _PDC1 0x02
1055 #define _PDC2 0x04
1056 #define _PDC3 0x08
1057 #define _PDC4 0x10
1058 #define _PDC5 0x20
1059 #define _PDC6 0x40
1060 #define _PRSEN 0x80
1062 //==============================================================================
1065 //==============================================================================
1066 // CCP1CON Bits
1068 extern __at(0x0FBD) __sfr CCP1CON;
1070 typedef union
1072 struct
1074 unsigned CCP1M0 : 1;
1075 unsigned CCP1M1 : 1;
1076 unsigned CCP1M2 : 1;
1077 unsigned CCP1M3 : 1;
1078 unsigned DC1B0 : 1;
1079 unsigned DC1B1 : 1;
1080 unsigned P1M0 : 1;
1081 unsigned P1M1 : 1;
1084 struct
1086 unsigned : 1;
1087 unsigned : 1;
1088 unsigned : 1;
1089 unsigned : 1;
1090 unsigned CCP1Y : 1;
1091 unsigned CCP1X : 1;
1092 unsigned : 1;
1093 unsigned : 1;
1096 struct
1098 unsigned CCP1M : 4;
1099 unsigned : 4;
1102 struct
1104 unsigned : 4;
1105 unsigned DC1B : 2;
1106 unsigned : 2;
1109 struct
1111 unsigned : 6;
1112 unsigned P1M : 2;
1114 } __CCP1CONbits_t;
1116 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1118 #define _CCP1M0 0x01
1119 #define _CCP1M1 0x02
1120 #define _CCP1M2 0x04
1121 #define _CCP1M3 0x08
1122 #define _DC1B0 0x10
1123 #define _CCP1Y 0x10
1124 #define _DC1B1 0x20
1125 #define _CCP1X 0x20
1126 #define _P1M0 0x40
1127 #define _P1M1 0x80
1129 //==============================================================================
1131 extern __at(0x0FBE) __sfr CCPR1;
1132 extern __at(0x0FBE) __sfr CCPR1L;
1133 extern __at(0x0FBF) __sfr CCPR1H;
1135 //==============================================================================
1136 // ADCON2 Bits
1138 extern __at(0x0FC0) __sfr ADCON2;
1140 typedef union
1142 struct
1144 unsigned ADCS0 : 1;
1145 unsigned ADCS1 : 1;
1146 unsigned ADCS2 : 1;
1147 unsigned ACQT0 : 1;
1148 unsigned ACQT1 : 1;
1149 unsigned ACQT2 : 1;
1150 unsigned : 1;
1151 unsigned ADFM : 1;
1154 struct
1156 unsigned ADCS : 3;
1157 unsigned : 5;
1160 struct
1162 unsigned : 3;
1163 unsigned ACQT : 3;
1164 unsigned : 2;
1166 } __ADCON2bits_t;
1168 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits;
1170 #define _ADCS0 0x01
1171 #define _ADCS1 0x02
1172 #define _ADCS2 0x04
1173 #define _ACQT0 0x08
1174 #define _ACQT1 0x10
1175 #define _ACQT2 0x20
1176 #define _ADFM 0x80
1178 //==============================================================================
1181 //==============================================================================
1182 // ADCON1 Bits
1184 extern __at(0x0FC1) __sfr ADCON1;
1186 typedef union
1188 struct
1190 unsigned PCFG0 : 1;
1191 unsigned PCFG1 : 1;
1192 unsigned PCFG2 : 1;
1193 unsigned PCFG3 : 1;
1194 unsigned PCFG4 : 1;
1195 unsigned PCFG5 : 1;
1196 unsigned PCFG6 : 1;
1197 unsigned : 1;
1200 struct
1202 unsigned PCFG : 7;
1203 unsigned : 1;
1205 } __ADCON1bits_t;
1207 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1209 #define _PCFG0 0x01
1210 #define _PCFG1 0x02
1211 #define _PCFG2 0x04
1212 #define _PCFG3 0x08
1213 #define _PCFG4 0x10
1214 #define _PCFG5 0x20
1215 #define _PCFG6 0x40
1217 //==============================================================================
1220 //==============================================================================
1221 // ADCON0 Bits
1223 extern __at(0x0FC2) __sfr ADCON0;
1225 typedef union
1227 struct
1229 unsigned ADON : 1;
1230 unsigned GO_NOT_DONE : 1;
1231 unsigned CHS0 : 1;
1232 unsigned CHS1 : 1;
1233 unsigned CHS2 : 1;
1234 unsigned : 1;
1235 unsigned VCFG0 : 1;
1236 unsigned VCFG1 : 1;
1239 struct
1241 unsigned : 1;
1242 unsigned GO : 1;
1243 unsigned : 1;
1244 unsigned : 1;
1245 unsigned : 1;
1246 unsigned : 1;
1247 unsigned : 1;
1248 unsigned : 1;
1251 struct
1253 unsigned : 1;
1254 unsigned DONE : 1;
1255 unsigned : 1;
1256 unsigned : 1;
1257 unsigned : 1;
1258 unsigned : 1;
1259 unsigned : 1;
1260 unsigned : 1;
1263 struct
1265 unsigned : 1;
1266 unsigned NOT_DONE : 1;
1267 unsigned : 1;
1268 unsigned : 1;
1269 unsigned : 1;
1270 unsigned : 1;
1271 unsigned : 1;
1272 unsigned : 1;
1275 struct
1277 unsigned : 1;
1278 unsigned GO_DONE : 1;
1279 unsigned : 1;
1280 unsigned : 1;
1281 unsigned : 1;
1282 unsigned : 1;
1283 unsigned : 1;
1284 unsigned : 1;
1287 struct
1289 unsigned : 2;
1290 unsigned CHS : 3;
1291 unsigned : 3;
1294 struct
1296 unsigned : 6;
1297 unsigned VCFG : 2;
1299 } __ADCON0bits_t;
1301 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1303 #define _ADON 0x01
1304 #define _GO_NOT_DONE 0x02
1305 #define _GO 0x02
1306 #define _DONE 0x02
1307 #define _NOT_DONE 0x02
1308 #define _GO_DONE 0x02
1309 #define _CHS0 0x04
1310 #define _CHS1 0x08
1311 #define _CHS2 0x10
1312 #define _VCFG0 0x40
1313 #define _VCFG1 0x80
1315 //==============================================================================
1317 extern __at(0x0FC3) __sfr ADRES;
1318 extern __at(0x0FC3) __sfr ADRESL;
1319 extern __at(0x0FC4) __sfr ADRESH;
1321 //==============================================================================
1322 // T2CON Bits
1324 extern __at(0x0FCA) __sfr T2CON;
1326 typedef union
1328 struct
1330 unsigned T2CKPS0 : 1;
1331 unsigned T2CKPS1 : 1;
1332 unsigned TMR2ON : 1;
1333 unsigned TOUTPS0 : 1;
1334 unsigned TOUTPS1 : 1;
1335 unsigned TOUTPS2 : 1;
1336 unsigned TOUTPS3 : 1;
1337 unsigned : 1;
1340 struct
1342 unsigned T2CKPS : 2;
1343 unsigned : 6;
1346 struct
1348 unsigned : 3;
1349 unsigned TOUTPS : 4;
1350 unsigned : 1;
1352 } __T2CONbits_t;
1354 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
1356 #define _T2CKPS0 0x01
1357 #define _T2CKPS1 0x02
1358 #define _TMR2ON 0x04
1359 #define _TOUTPS0 0x08
1360 #define _TOUTPS1 0x10
1361 #define _TOUTPS2 0x20
1362 #define _TOUTPS3 0x40
1364 //==============================================================================
1366 extern __at(0x0FCB) __sfr PR2;
1367 extern __at(0x0FCC) __sfr TMR2;
1369 //==============================================================================
1370 // T1CON Bits
1372 extern __at(0x0FCD) __sfr T1CON;
1374 typedef union
1376 struct
1378 unsigned TMR1ON : 1;
1379 unsigned TMR1CS : 1;
1380 unsigned NOT_T1SYNC : 1;
1381 unsigned T1OSCEN : 1;
1382 unsigned T1CKPS0 : 1;
1383 unsigned T1CKPS1 : 1;
1384 unsigned T1RUN : 1;
1385 unsigned RD16 : 1;
1388 struct
1390 unsigned : 1;
1391 unsigned : 1;
1392 unsigned T1SYNC : 1;
1393 unsigned : 1;
1394 unsigned : 1;
1395 unsigned : 1;
1396 unsigned : 1;
1397 unsigned : 1;
1400 struct
1402 unsigned : 4;
1403 unsigned T1CKPS : 2;
1404 unsigned : 2;
1406 } __T1CONbits_t;
1408 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1410 #define _TMR1ON 0x01
1411 #define _TMR1CS 0x02
1412 #define _NOT_T1SYNC 0x04
1413 #define _T1SYNC 0x04
1414 #define _T1OSCEN 0x08
1415 #define _T1CKPS0 0x10
1416 #define _T1CKPS1 0x20
1417 #define _T1RUN 0x40
1418 #define _RD16 0x80
1420 //==============================================================================
1422 extern __at(0x0FCE) __sfr TMR1;
1423 extern __at(0x0FCE) __sfr TMR1L;
1424 extern __at(0x0FCF) __sfr TMR1H;
1426 //==============================================================================
1427 // RCON Bits
1429 extern __at(0x0FD0) __sfr RCON;
1431 typedef union
1433 struct
1435 unsigned NOT_BOR : 1;
1436 unsigned NOT_POR : 1;
1437 unsigned NOT_PD : 1;
1438 unsigned NOT_TO : 1;
1439 unsigned NOT_RI : 1;
1440 unsigned : 1;
1441 unsigned : 1;
1442 unsigned IPEN : 1;
1445 struct
1447 unsigned BOR : 1;
1448 unsigned POR : 1;
1449 unsigned PD : 1;
1450 unsigned TO : 1;
1451 unsigned RI : 1;
1452 unsigned : 1;
1453 unsigned : 1;
1454 unsigned : 1;
1456 } __RCONbits_t;
1458 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1460 #define _NOT_BOR 0x01
1461 #define _BOR 0x01
1462 #define _NOT_POR 0x02
1463 #define _POR 0x02
1464 #define _NOT_PD 0x04
1465 #define _PD 0x04
1466 #define _NOT_TO 0x08
1467 #define _TO 0x08
1468 #define _NOT_RI 0x10
1469 #define _RI 0x10
1470 #define _IPEN 0x80
1472 //==============================================================================
1475 //==============================================================================
1476 // WDTCON Bits
1478 extern __at(0x0FD1) __sfr WDTCON;
1480 typedef union
1482 struct
1484 unsigned SWDTEN : 1;
1485 unsigned : 1;
1486 unsigned : 1;
1487 unsigned : 1;
1488 unsigned : 1;
1489 unsigned : 1;
1490 unsigned : 1;
1491 unsigned : 1;
1494 struct
1496 unsigned SWDTE : 1;
1497 unsigned : 1;
1498 unsigned : 1;
1499 unsigned : 1;
1500 unsigned : 1;
1501 unsigned : 1;
1502 unsigned : 1;
1503 unsigned : 1;
1505 } __WDTCONbits_t;
1507 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
1509 #define _SWDTEN 0x01
1510 #define _SWDTE 0x01
1512 //==============================================================================
1515 //==============================================================================
1516 // LVDCON Bits
1518 extern __at(0x0FD2) __sfr LVDCON;
1520 typedef union
1522 struct
1524 unsigned LVDL0 : 1;
1525 unsigned LVDL1 : 1;
1526 unsigned LVDL2 : 1;
1527 unsigned LVDL3 : 1;
1528 unsigned LVDEN : 1;
1529 unsigned IRVST : 1;
1530 unsigned : 1;
1531 unsigned : 1;
1534 struct
1536 unsigned : 1;
1537 unsigned : 1;
1538 unsigned : 1;
1539 unsigned : 1;
1540 unsigned : 1;
1541 unsigned IVRST : 1;
1542 unsigned : 1;
1543 unsigned : 1;
1546 struct
1548 unsigned LVDL : 4;
1549 unsigned : 4;
1551 } __LVDCONbits_t;
1553 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
1555 #define _LVDL0 0x01
1556 #define _LVDL1 0x02
1557 #define _LVDL2 0x04
1558 #define _LVDL3 0x08
1559 #define _LVDEN 0x10
1560 #define _IRVST 0x20
1561 #define _IVRST 0x20
1563 //==============================================================================
1566 //==============================================================================
1567 // OSCCON Bits
1569 extern __at(0x0FD3) __sfr OSCCON;
1571 typedef union
1573 struct
1575 unsigned SCS0 : 1;
1576 unsigned SCS1 : 1;
1577 unsigned IOFS : 1;
1578 unsigned OSTS : 1;
1579 unsigned IRCF0 : 1;
1580 unsigned IRCF1 : 1;
1581 unsigned IRCF2 : 1;
1582 unsigned IDLEN : 1;
1585 struct
1587 unsigned SCS : 1;
1588 unsigned : 1;
1589 unsigned FLTS : 1;
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned : 1;
1593 unsigned : 1;
1594 unsigned : 1;
1597 struct
1599 unsigned : 4;
1600 unsigned IRCF : 3;
1601 unsigned : 1;
1603 } __OSCCONbits_t;
1605 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
1607 #define _SCS0 0x01
1608 #define _SCS 0x01
1609 #define _SCS1 0x02
1610 #define _IOFS 0x04
1611 #define _FLTS 0x04
1612 #define _OSTS 0x08
1613 #define _IRCF0 0x10
1614 #define _IRCF1 0x20
1615 #define _IRCF2 0x40
1616 #define _IDLEN 0x80
1618 //==============================================================================
1621 //==============================================================================
1622 // T0CON Bits
1624 extern __at(0x0FD5) __sfr T0CON;
1626 typedef union
1628 struct
1630 unsigned T0PS0 : 1;
1631 unsigned T0PS1 : 1;
1632 unsigned T0PS2 : 1;
1633 unsigned PSA : 1;
1634 unsigned T0SE : 1;
1635 unsigned T0CS : 1;
1636 unsigned T08BIT : 1;
1637 unsigned TMR0ON : 1;
1640 struct
1642 unsigned : 1;
1643 unsigned : 1;
1644 unsigned : 1;
1645 unsigned : 1;
1646 unsigned : 1;
1647 unsigned : 1;
1648 unsigned T016BIT : 1;
1649 unsigned : 1;
1652 struct
1654 unsigned T0PS : 3;
1655 unsigned : 5;
1657 } __T0CONbits_t;
1659 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
1661 #define _T0PS0 0x01
1662 #define _T0PS1 0x02
1663 #define _T0PS2 0x04
1664 #define _PSA 0x08
1665 #define _T0SE 0x10
1666 #define _T0CS 0x20
1667 #define _T08BIT 0x40
1668 #define _T016BIT 0x40
1669 #define _TMR0ON 0x80
1671 //==============================================================================
1673 extern __at(0x0FD6) __sfr TMR0;
1674 extern __at(0x0FD6) __sfr TMR0L;
1675 extern __at(0x0FD7) __sfr TMR0H;
1677 //==============================================================================
1678 // STATUS Bits
1680 extern __at(0x0FD8) __sfr STATUS;
1682 typedef struct
1684 unsigned C : 1;
1685 unsigned DC : 1;
1686 unsigned Z : 1;
1687 unsigned OV : 1;
1688 unsigned N : 1;
1689 unsigned : 1;
1690 unsigned : 1;
1691 unsigned : 1;
1692 } __STATUSbits_t;
1694 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
1696 #define _C 0x01
1697 #define _DC 0x02
1698 #define _Z 0x04
1699 #define _OV 0x08
1700 #define _N 0x10
1702 //==============================================================================
1704 extern __at(0x0FD9) __sfr FSR2L;
1705 extern __at(0x0FDA) __sfr FSR2H;
1706 extern __at(0x0FDB) __sfr PLUSW2;
1707 extern __at(0x0FDC) __sfr PREINC2;
1708 extern __at(0x0FDD) __sfr POSTDEC2;
1709 extern __at(0x0FDE) __sfr POSTINC2;
1710 extern __at(0x0FDF) __sfr INDF2;
1711 extern __at(0x0FE0) __sfr BSR;
1712 extern __at(0x0FE1) __sfr FSR1L;
1713 extern __at(0x0FE2) __sfr FSR1H;
1714 extern __at(0x0FE3) __sfr PLUSW1;
1715 extern __at(0x0FE4) __sfr PREINC1;
1716 extern __at(0x0FE5) __sfr POSTDEC1;
1717 extern __at(0x0FE6) __sfr POSTINC1;
1718 extern __at(0x0FE7) __sfr INDF1;
1719 extern __at(0x0FE8) __sfr WREG;
1720 extern __at(0x0FE9) __sfr FSR0L;
1721 extern __at(0x0FEA) __sfr FSR0H;
1722 extern __at(0x0FEB) __sfr PLUSW0;
1723 extern __at(0x0FEC) __sfr PREINC0;
1724 extern __at(0x0FED) __sfr POSTDEC0;
1725 extern __at(0x0FEE) __sfr POSTINC0;
1726 extern __at(0x0FEF) __sfr INDF0;
1728 //==============================================================================
1729 // INTCON3 Bits
1731 extern __at(0x0FF0) __sfr INTCON3;
1733 typedef union
1735 struct
1737 unsigned INT1IF : 1;
1738 unsigned INT2IF : 1;
1739 unsigned : 1;
1740 unsigned INT1IE : 1;
1741 unsigned INT2IE : 1;
1742 unsigned : 1;
1743 unsigned INT1IP : 1;
1744 unsigned INT2IP : 1;
1747 struct
1749 unsigned INT1F : 1;
1750 unsigned INT2F : 1;
1751 unsigned : 1;
1752 unsigned INT1E : 1;
1753 unsigned INT2E : 1;
1754 unsigned : 1;
1755 unsigned INT1P : 1;
1756 unsigned INT2P : 1;
1758 } __INTCON3bits_t;
1760 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
1762 #define _INT1IF 0x01
1763 #define _INT1F 0x01
1764 #define _INT2IF 0x02
1765 #define _INT2F 0x02
1766 #define _INT1IE 0x08
1767 #define _INT1E 0x08
1768 #define _INT2IE 0x10
1769 #define _INT2E 0x10
1770 #define _INT1IP 0x40
1771 #define _INT1P 0x40
1772 #define _INT2IP 0x80
1773 #define _INT2P 0x80
1775 //==============================================================================
1778 //==============================================================================
1779 // INTCON2 Bits
1781 extern __at(0x0FF1) __sfr INTCON2;
1783 typedef union
1785 struct
1787 unsigned RBIP : 1;
1788 unsigned : 1;
1789 unsigned TMR0IP : 1;
1790 unsigned : 1;
1791 unsigned INTEDG2 : 1;
1792 unsigned INTEDG1 : 1;
1793 unsigned INTEDG0 : 1;
1794 unsigned NOT_RBPU : 1;
1797 struct
1799 unsigned : 1;
1800 unsigned : 1;
1801 unsigned T0IP : 1;
1802 unsigned : 1;
1803 unsigned : 1;
1804 unsigned : 1;
1805 unsigned : 1;
1806 unsigned RBPU : 1;
1808 } __INTCON2bits_t;
1810 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
1812 #define _RBIP 0x01
1813 #define _TMR0IP 0x04
1814 #define _T0IP 0x04
1815 #define _INTEDG2 0x10
1816 #define _INTEDG1 0x20
1817 #define _INTEDG0 0x40
1818 #define _NOT_RBPU 0x80
1819 #define _RBPU 0x80
1821 //==============================================================================
1824 //==============================================================================
1825 // INTCON Bits
1827 extern __at(0x0FF2) __sfr INTCON;
1829 typedef union
1831 struct
1833 unsigned RBIF : 1;
1834 unsigned INT0IF : 1;
1835 unsigned TMR0IF : 1;
1836 unsigned RBIE : 1;
1837 unsigned INT0IE : 1;
1838 unsigned TMR0IE : 1;
1839 unsigned PEIE_GIEL : 1;
1840 unsigned GIE_GIEH : 1;
1843 struct
1845 unsigned : 1;
1846 unsigned INT0F : 1;
1847 unsigned T0IF : 1;
1848 unsigned : 1;
1849 unsigned INT0E : 1;
1850 unsigned T0IE : 1;
1851 unsigned PEIE : 1;
1852 unsigned GIE : 1;
1855 struct
1857 unsigned : 1;
1858 unsigned INTF : 1;
1859 unsigned : 1;
1860 unsigned : 1;
1861 unsigned INTE : 1;
1862 unsigned : 1;
1863 unsigned GIEL : 1;
1864 unsigned GIEH : 1;
1866 } __INTCONbits_t;
1868 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
1870 #define _RBIF 0x01
1871 #define _INT0IF 0x02
1872 #define _INT0F 0x02
1873 #define _INTF 0x02
1874 #define _TMR0IF 0x04
1875 #define _T0IF 0x04
1876 #define _RBIE 0x08
1877 #define _INT0IE 0x10
1878 #define _INT0E 0x10
1879 #define _INTE 0x10
1880 #define _TMR0IE 0x20
1881 #define _T0IE 0x20
1882 #define _PEIE_GIEL 0x40
1883 #define _PEIE 0x40
1884 #define _GIEL 0x40
1885 #define _GIE_GIEH 0x80
1886 #define _GIE 0x80
1887 #define _GIEH 0x80
1889 //==============================================================================
1891 extern __at(0x0FF3) __sfr PROD;
1892 extern __at(0x0FF3) __sfr PRODL;
1893 extern __at(0x0FF4) __sfr PRODH;
1894 extern __at(0x0FF5) __sfr TABLAT;
1895 extern __at(0x0FF6) __sfr TBLPTR;
1896 extern __at(0x0FF6) __sfr TBLPTRL;
1897 extern __at(0x0FF7) __sfr TBLPTRH;
1898 extern __at(0x0FF8) __sfr TBLPTRU;
1899 extern __at(0x0FF9) __sfr PC;
1900 extern __at(0x0FF9) __sfr PCL;
1901 extern __at(0x0FFA) __sfr PCLATH;
1902 extern __at(0x0FFB) __sfr PCLATU;
1904 //==============================================================================
1905 // STKPTR Bits
1907 extern __at(0x0FFC) __sfr STKPTR;
1909 typedef union
1911 struct
1913 unsigned STKPTR0 : 1;
1914 unsigned STKPTR1 : 1;
1915 unsigned STKPTR2 : 1;
1916 unsigned STKPTR3 : 1;
1917 unsigned STKPTR4 : 1;
1918 unsigned : 1;
1919 unsigned STKUNF : 1;
1920 unsigned STKFUL : 1;
1923 struct
1925 unsigned SP0 : 1;
1926 unsigned SP1 : 1;
1927 unsigned SP2 : 1;
1928 unsigned SP3 : 1;
1929 unsigned SP4 : 1;
1930 unsigned : 1;
1931 unsigned : 1;
1932 unsigned STKOVF : 1;
1935 struct
1937 unsigned SP : 5;
1938 unsigned : 3;
1941 struct
1943 unsigned STKPTR : 5;
1944 unsigned : 3;
1946 } __STKPTRbits_t;
1948 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
1950 #define _STKPTR0 0x01
1951 #define _SP0 0x01
1952 #define _STKPTR1 0x02
1953 #define _SP1 0x02
1954 #define _STKPTR2 0x04
1955 #define _SP2 0x04
1956 #define _STKPTR3 0x08
1957 #define _SP3 0x08
1958 #define _STKPTR4 0x10
1959 #define _SP4 0x10
1960 #define _STKUNF 0x40
1961 #define _STKFUL 0x80
1962 #define _STKOVF 0x80
1964 //==============================================================================
1966 extern __at(0x0FFD) __sfr TOS;
1967 extern __at(0x0FFD) __sfr TOSL;
1968 extern __at(0x0FFE) __sfr TOSH;
1969 extern __at(0x0FFF) __sfr TOSU;
1971 //==============================================================================
1973 // Configuration Bits
1975 //==============================================================================
1977 #define __CONFIG1H 0x300001
1978 #define __CONFIG2L 0x300002
1979 #define __CONFIG2H 0x300003
1980 #define __CONFIG3H 0x300005
1981 #define __CONFIG4L 0x300006
1982 #define __CONFIG5L 0x300008
1983 #define __CONFIG5H 0x300009
1984 #define __CONFIG6L 0x30000A
1985 #define __CONFIG6H 0x30000B
1986 #define __CONFIG7L 0x30000C
1987 #define __CONFIG7H 0x30000D
1989 //----------------------------- CONFIG1H Options -------------------------------
1991 #define _LP_OSC_1H 0xF0 // LP Oscillator.
1992 #define _XT_OSC_1H 0xF1 // XT Oscillator.
1993 #define _HS_OSC_1H 0xF2 // HS Oscillator.
1994 #define _EC_OSC_1H 0xF4 // EC oscillator, CLKO function on RA6.
1995 #define _ECIOP_OSC_1H 0xF5 // EC oscillator, port function on RA6.
1996 #define _HSPLL_OSC_1H 0xF6 // HS oscillator, PLL enabled (clock frequency = 4 x FOSC1).
1997 #define _RCIO_OSC_1H 0xF7 // External RC oscillator, port function on RA6.
1998 #define _INTIO2_OSC_1H 0xF8 // Internal RC oscillator, port function on RA6 and port function on RA7.
1999 #define _INTIO1_OSC_1H 0xF9 // Internal RC oscillator, CLKO function on RA6 and port function on RA7.
2000 #define _RC_OSC_1H 0xFC // External RC oscillator, CLKO function on RA6.
2001 #define _FSCM_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled.
2002 #define _FSCM_ON_1H 0xFF // Fail-Safe Clock Monitor enabled.
2003 #define _IESO_OFF_1H 0x7F // Internal External Switchover mode disabled.
2004 #define _IESO_ON_1H 0xFF // Internal External Switchover mode enabled.
2006 //----------------------------- CONFIG2L Options -------------------------------
2008 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2009 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2010 #define _BOR_OFF_2L 0xFD // Brown-out Reset disabled.
2011 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled.
2012 #define _BORV_45_2L 0xF3 // VBOR set to 4.5V.
2013 #define _BORV_42_2L 0xF7 // VBOR set to 4.2V.
2014 #define _BORV_27_2L 0xFB // VBOR set to 2.7V.
2016 //----------------------------- CONFIG2H Options -------------------------------
2018 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2019 #define _WDT_ON_2H 0xFF // WDT enabled.
2020 #define _WDTPS_1_2H 0xE1 // 1:1.
2021 #define _WDTPS_2_2H 0xE3 // 1:2.
2022 #define _WDTPS_4_2H 0xE5 // 1:4.
2023 #define _WDTPS_8_2H 0xE7 // 1:8.
2024 #define _WDTPS_16_2H 0xE9 // 1:16.
2025 #define _WDTPS_32_2H 0xEB // 1:32.
2026 #define _WDTPS_64_2H 0xED // 1:64.
2027 #define _WDTPS_128_2H 0xEF // 1:128.
2028 #define _WDTPS_256_2H 0xF1 // 1:256.
2029 #define _WDTPS_512_2H 0xF3 // 1:512.
2030 #define _WDTPS_1K_2H 0xF5 // 1:1024.
2031 #define _WDTPS_2K_2H 0xF7 // 1:2048.
2032 #define _WDTPS_4K_2H 0xF9 // 1:4096.
2033 #define _WDTPS_8K_2H 0xFB // 1:8192.
2034 #define _WDTPS_16K_2H 0xFD // 1:16384.
2035 #define _WDTPS_32K_2H 0xFF // 1:32768.
2037 //----------------------------- CONFIG3H Options -------------------------------
2039 #define _MCLRE_OFF_3H 0x7F // RA5 input pin enabled, MCLR disabled.
2040 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled, RA5 input pin disabled.
2042 //----------------------------- CONFIG4L Options -------------------------------
2044 #define _STVR_OFF_4L 0xFE // Stack full/underflow will not cause Reset.
2045 #define _STVR_ON_4L 0xFF // Stack full/underflow will cause Reset.
2046 #define _LVP_OFF_4L 0xFB // Low-Voltage ICSP disabled.
2047 #define _LVP_ON_4L 0xFF // Low-Voltage ICSP enabled.
2048 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug.
2049 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins.
2051 //----------------------------- CONFIG5L Options -------------------------------
2053 #define _CP0_ON_5L 0xFE // Block 0 (00200-000FFFh) code-protected.
2054 #define _CP0_OFF_5L 0xFF // Block 0 (00200-000FFFh) not code-protected.
2055 #define _CP1_ON_5L 0xFD // Block 1 (001000-001FFFh) code-protected.
2056 #define _CP1_OFF_5L 0xFF // Block 1 (001000-001FFFh) not code-protected.
2058 //----------------------------- CONFIG5H Options -------------------------------
2060 #define _CPB_ON_5H 0xBF // Boot Block (000000-0001FFh) code-protected.
2061 #define _CPB_OFF_5H 0xFF // Boot Block (000000-0001FFh) not code-protected.
2062 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected.
2063 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected.
2065 //----------------------------- CONFIG6L Options -------------------------------
2067 #define _WRT0_ON_6L 0xFE // Block 0 (00200-000FFFh) write-protected.
2068 #define _WRT0_OFF_6L 0xFF // Block 0 (00200-000FFFh) not write-protected.
2069 #define _WRT1_ON_6L 0xFD // Block 1 (001000-001FFFh) write-protected.
2070 #define _WRT1_OFF_6L 0xFF // Block 1 (001000-001FFFh) not write-protected.
2072 //----------------------------- CONFIG6H Options -------------------------------
2074 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected.
2075 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected.
2076 #define _WRTB_ON_6H 0xBF // Boot Block (000000-0001FFh) write-protected.
2077 #define _WRTB_OFF_6H 0xFF // Boot Block (000000-0001FFh) not write-protected.
2078 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected.
2079 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected.
2081 //----------------------------- CONFIG7L Options -------------------------------
2083 #define _EBTR0_ON_7L 0xFE // Block 0 (00200-000FFFh) protected from table reads executed in other blocks.
2084 #define _EBTR0_OFF_7L 0xFF // Block 0 (00200-000FFFh) not protected from table reads executed in other blocks.
2085 #define _EBTR1_ON_7L 0xFD // Block 1 (001000-001FFFh) protected from table reads executed in other blocks.
2086 #define _EBTR1_OFF_7L 0xFF // Block 1 (001000-001FFFh) not protected from table reads executed in other blocks.
2088 //----------------------------- CONFIG7H Options -------------------------------
2090 #define _EBTRB_ON_7H 0xBF // Boot Block (000000-0001FFh) protected from table reads executed in other blocks.
2091 #define _EBTRB_OFF_7H 0xFF // Boot Block (000000-0001FFh) not protected from table reads executed in other blocks.
2093 //==============================================================================
2095 #define __DEVID1 0x3FFFFE
2096 #define __DEVID2 0x3FFFFF
2098 #define __IDLOC0 0x200000
2099 #define __IDLOC1 0x200001
2100 #define __IDLOC2 0x200002
2101 #define __IDLOC3 0x200003
2102 #define __IDLOC4 0x200004
2103 #define __IDLOC5 0x200005
2104 #define __IDLOC6 0x200006
2105 #define __IDLOC7 0x200007
2107 #endif // #ifndef __PIC18F1320_H__