struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18lf2539.h
blobd49ba842f6679a9db4822a94aa998524b07f05a7
1 /*
2 * This declarations of the PIC18LF2539 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:01 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 __PIC18LF2539_H__
26 #define __PIC18LF2539_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 : 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 AN4 : 1;
64 unsigned OSC2 : 1;
65 unsigned : 1;
68 struct
70 unsigned : 1;
71 unsigned : 1;
72 unsigned VREFM : 1;
73 unsigned VREFP : 1;
74 unsigned : 1;
75 unsigned SS : 1;
76 unsigned CLK0 : 1;
77 unsigned : 1;
80 struct
82 unsigned : 1;
83 unsigned : 1;
84 unsigned : 1;
85 unsigned : 1;
86 unsigned : 1;
87 unsigned LVDIN : 1;
88 unsigned : 1;
89 unsigned : 1;
92 struct
94 unsigned RA : 7;
95 unsigned : 1;
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_RA2 0x04
106 #define _PORTA_AN2 0x04
107 #define _PORTA_VREFM 0x04
108 #define _PORTA_RA3 0x08
109 #define _PORTA_AN3 0x08
110 #define _PORTA_VREFP 0x08
111 #define _PORTA_RA4 0x10
112 #define _PORTA_T0CKI 0x10
113 #define _PORTA_RA5 0x20
114 #define _PORTA_AN4 0x20
115 #define _PORTA_SS 0x20
116 #define _PORTA_LVDIN 0x20
117 #define _PORTA_RA6 0x40
118 #define _PORTA_OSC2 0x40
119 #define _PORTA_CLK0 0x40
121 //==============================================================================
124 //==============================================================================
125 // PORTB Bits
127 extern __at(0x0F81) __sfr PORTB;
129 typedef union
131 struct
133 unsigned RB0 : 1;
134 unsigned RB1 : 1;
135 unsigned RB2 : 1;
136 unsigned RB3 : 1;
137 unsigned RB4 : 1;
138 unsigned RB5 : 1;
139 unsigned RB6 : 1;
140 unsigned RB7 : 1;
143 struct
145 unsigned INT0 : 1;
146 unsigned INT1 : 1;
147 unsigned INT2 : 1;
148 unsigned INT3 : 1;
149 unsigned : 1;
150 unsigned : 1;
151 unsigned : 1;
152 unsigned : 1;
155 struct
157 unsigned INT : 4;
158 unsigned : 4;
160 } __PORTBbits_t;
162 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits;
164 #define _PORTB_RB0 0x01
165 #define _PORTB_INT0 0x01
166 #define _PORTB_RB1 0x02
167 #define _PORTB_INT1 0x02
168 #define _PORTB_RB2 0x04
169 #define _PORTB_INT2 0x04
170 #define _PORTB_RB3 0x08
171 #define _PORTB_INT3 0x08
172 #define _PORTB_RB4 0x10
173 #define _PORTB_RB5 0x20
174 #define _PORTB_RB6 0x40
175 #define _PORTB_RB7 0x80
177 //==============================================================================
180 //==============================================================================
181 // PORTC Bits
183 extern __at(0x0F82) __sfr PORTC;
185 typedef union
187 struct
189 unsigned RC0 : 1;
190 unsigned T1OSI : 1;
191 unsigned CCP1 : 1;
192 unsigned RC3 : 1;
193 unsigned RC4 : 1;
194 unsigned RC5 : 1;
195 unsigned RC6 : 1;
196 unsigned RC7 : 1;
199 struct
201 unsigned T1OSO : 1;
202 unsigned CCP2 : 1;
203 unsigned RC2 : 1;
204 unsigned SCK : 1;
205 unsigned SDI : 1;
206 unsigned SDO : 1;
207 unsigned TX : 1;
208 unsigned RX : 1;
211 struct
213 unsigned T1CKI : 1;
214 unsigned RC1 : 1;
215 unsigned : 1;
216 unsigned SCL : 1;
217 unsigned SDA : 1;
218 unsigned : 1;
219 unsigned CK : 1;
220 unsigned : 1;
222 } __PORTCbits_t;
224 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits;
226 #define _PORTC_RC0 0x01
227 #define _PORTC_T1OSO 0x01
228 #define _PORTC_T1CKI 0x01
229 #define _PORTC_T1OSI 0x02
230 #define _PORTC_CCP2 0x02
231 #define _PORTC_RC1 0x02
232 #define _PORTC_CCP1 0x04
233 #define _PORTC_RC2 0x04
234 #define _PORTC_RC3 0x08
235 #define _PORTC_SCK 0x08
236 #define _PORTC_SCL 0x08
237 #define _PORTC_RC4 0x10
238 #define _PORTC_SDI 0x10
239 #define _PORTC_SDA 0x10
240 #define _PORTC_RC5 0x20
241 #define _PORTC_SDO 0x20
242 #define _PORTC_RC6 0x40
243 #define _PORTC_TX 0x40
244 #define _PORTC_CK 0x40
245 #define _PORTC_RC7 0x80
246 #define _PORTC_RX 0x80
248 //==============================================================================
251 //==============================================================================
252 // LATA Bits
254 extern __at(0x0F89) __sfr LATA;
256 typedef union
258 struct
260 unsigned LATA0 : 1;
261 unsigned LATA1 : 1;
262 unsigned LATA2 : 1;
263 unsigned LATA3 : 1;
264 unsigned LATA4 : 1;
265 unsigned LATA5 : 1;
266 unsigned LATA6 : 1;
267 unsigned : 1;
270 struct
272 unsigned LATA : 7;
273 unsigned : 1;
275 } __LATAbits_t;
277 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
279 #define _LATA0 0x01
280 #define _LATA1 0x02
281 #define _LATA2 0x04
282 #define _LATA3 0x08
283 #define _LATA4 0x10
284 #define _LATA5 0x20
285 #define _LATA6 0x40
287 //==============================================================================
290 //==============================================================================
291 // LATB Bits
293 extern __at(0x0F8A) __sfr LATB;
295 typedef struct
297 unsigned LATB0 : 1;
298 unsigned LATB1 : 1;
299 unsigned LATB2 : 1;
300 unsigned LATB3 : 1;
301 unsigned LATB4 : 1;
302 unsigned LATB5 : 1;
303 unsigned LATB6 : 1;
304 unsigned LATB7 : 1;
305 } __LATBbits_t;
307 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
309 #define _LATB0 0x01
310 #define _LATB1 0x02
311 #define _LATB2 0x04
312 #define _LATB3 0x08
313 #define _LATB4 0x10
314 #define _LATB5 0x20
315 #define _LATB6 0x40
316 #define _LATB7 0x80
318 //==============================================================================
321 //==============================================================================
322 // LATC Bits
324 extern __at(0x0F8B) __sfr LATC;
326 typedef struct
328 unsigned LATC0 : 1;
329 unsigned LATC1 : 1;
330 unsigned LATC2 : 1;
331 unsigned LATC3 : 1;
332 unsigned LATC4 : 1;
333 unsigned LATC5 : 1;
334 unsigned LATC6 : 1;
335 unsigned LATC7 : 1;
336 } __LATCbits_t;
338 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
340 #define _LATC0 0x01
341 #define _LATC1 0x02
342 #define _LATC2 0x04
343 #define _LATC3 0x08
344 #define _LATC4 0x10
345 #define _LATC5 0x20
346 #define _LATC6 0x40
347 #define _LATC7 0x80
349 //==============================================================================
352 //==============================================================================
353 // DDRA Bits
355 extern __at(0x0F92) __sfr DDRA;
357 typedef union
359 struct
361 unsigned TRISA0 : 1;
362 unsigned TRISA1 : 1;
363 unsigned TRISA2 : 1;
364 unsigned TRISA3 : 1;
365 unsigned TRISA4 : 1;
366 unsigned TRISA5 : 1;
367 unsigned TRISA6 : 1;
368 unsigned RA7 : 1;
371 struct
373 unsigned RA0 : 1;
374 unsigned RA1 : 1;
375 unsigned RA2 : 1;
376 unsigned RA3 : 1;
377 unsigned RA4 : 1;
378 unsigned RA5 : 1;
379 unsigned RA6 : 1;
380 unsigned : 1;
383 struct
385 unsigned TRISA : 7;
386 unsigned : 1;
388 } __DDRAbits_t;
390 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
392 #define _TRISA0 0x01
393 #define _RA0 0x01
394 #define _TRISA1 0x02
395 #define _RA1 0x02
396 #define _TRISA2 0x04
397 #define _RA2 0x04
398 #define _TRISA3 0x08
399 #define _RA3 0x08
400 #define _TRISA4 0x10
401 #define _RA4 0x10
402 #define _TRISA5 0x20
403 #define _RA5 0x20
404 #define _TRISA6 0x40
405 #define _RA6 0x40
406 #define _RA7 0x80
408 //==============================================================================
411 //==============================================================================
412 // TRISA Bits
414 extern __at(0x0F92) __sfr TRISA;
416 typedef union
418 struct
420 unsigned TRISA0 : 1;
421 unsigned TRISA1 : 1;
422 unsigned TRISA2 : 1;
423 unsigned TRISA3 : 1;
424 unsigned TRISA4 : 1;
425 unsigned TRISA5 : 1;
426 unsigned TRISA6 : 1;
427 unsigned RA7 : 1;
430 struct
432 unsigned RA0 : 1;
433 unsigned RA1 : 1;
434 unsigned RA2 : 1;
435 unsigned RA3 : 1;
436 unsigned RA4 : 1;
437 unsigned RA5 : 1;
438 unsigned RA6 : 1;
439 unsigned : 1;
442 struct
444 unsigned TRISA : 7;
445 unsigned : 1;
447 } __TRISAbits_t;
449 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
451 #define _TRISA_TRISA0 0x01
452 #define _TRISA_RA0 0x01
453 #define _TRISA_TRISA1 0x02
454 #define _TRISA_RA1 0x02
455 #define _TRISA_TRISA2 0x04
456 #define _TRISA_RA2 0x04
457 #define _TRISA_TRISA3 0x08
458 #define _TRISA_RA3 0x08
459 #define _TRISA_TRISA4 0x10
460 #define _TRISA_RA4 0x10
461 #define _TRISA_TRISA5 0x20
462 #define _TRISA_RA5 0x20
463 #define _TRISA_TRISA6 0x40
464 #define _TRISA_RA6 0x40
465 #define _TRISA_RA7 0x80
467 //==============================================================================
470 //==============================================================================
471 // DDRB Bits
473 extern __at(0x0F93) __sfr DDRB;
475 typedef union
477 struct
479 unsigned TRISB0 : 1;
480 unsigned TRISB1 : 1;
481 unsigned TRISB2 : 1;
482 unsigned TRISB3 : 1;
483 unsigned TRISB4 : 1;
484 unsigned TRISB5 : 1;
485 unsigned TRISB6 : 1;
486 unsigned TRISB7 : 1;
489 struct
491 unsigned RB0 : 1;
492 unsigned RB1 : 1;
493 unsigned RB2 : 1;
494 unsigned RB3 : 1;
495 unsigned RB4 : 1;
496 unsigned RB5 : 1;
497 unsigned RB6 : 1;
498 unsigned RB7 : 1;
500 } __DDRBbits_t;
502 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
504 #define _TRISB0 0x01
505 #define _RB0 0x01
506 #define _TRISB1 0x02
507 #define _RB1 0x02
508 #define _TRISB2 0x04
509 #define _RB2 0x04
510 #define _TRISB3 0x08
511 #define _RB3 0x08
512 #define _TRISB4 0x10
513 #define _RB4 0x10
514 #define _TRISB5 0x20
515 #define _RB5 0x20
516 #define _TRISB6 0x40
517 #define _RB6 0x40
518 #define _TRISB7 0x80
519 #define _RB7 0x80
521 //==============================================================================
524 //==============================================================================
525 // TRISB Bits
527 extern __at(0x0F93) __sfr TRISB;
529 typedef union
531 struct
533 unsigned TRISB0 : 1;
534 unsigned TRISB1 : 1;
535 unsigned TRISB2 : 1;
536 unsigned TRISB3 : 1;
537 unsigned TRISB4 : 1;
538 unsigned TRISB5 : 1;
539 unsigned TRISB6 : 1;
540 unsigned TRISB7 : 1;
543 struct
545 unsigned RB0 : 1;
546 unsigned RB1 : 1;
547 unsigned RB2 : 1;
548 unsigned RB3 : 1;
549 unsigned RB4 : 1;
550 unsigned RB5 : 1;
551 unsigned RB6 : 1;
552 unsigned RB7 : 1;
554 } __TRISBbits_t;
556 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
558 #define _TRISB_TRISB0 0x01
559 #define _TRISB_RB0 0x01
560 #define _TRISB_TRISB1 0x02
561 #define _TRISB_RB1 0x02
562 #define _TRISB_TRISB2 0x04
563 #define _TRISB_RB2 0x04
564 #define _TRISB_TRISB3 0x08
565 #define _TRISB_RB3 0x08
566 #define _TRISB_TRISB4 0x10
567 #define _TRISB_RB4 0x10
568 #define _TRISB_TRISB5 0x20
569 #define _TRISB_RB5 0x20
570 #define _TRISB_TRISB6 0x40
571 #define _TRISB_RB6 0x40
572 #define _TRISB_TRISB7 0x80
573 #define _TRISB_RB7 0x80
575 //==============================================================================
578 //==============================================================================
579 // DDRC Bits
581 extern __at(0x0F94) __sfr DDRC;
583 typedef union
585 struct
587 unsigned TRISC0 : 1;
588 unsigned RC1 : 1;
589 unsigned RC2 : 1;
590 unsigned TRISC3 : 1;
591 unsigned TRISC4 : 1;
592 unsigned TRISC5 : 1;
593 unsigned TRISC6 : 1;
594 unsigned TRISC7 : 1;
597 struct
599 unsigned RC0 : 1;
600 unsigned : 1;
601 unsigned : 1;
602 unsigned RC3 : 1;
603 unsigned RC4 : 1;
604 unsigned RC5 : 1;
605 unsigned RC6 : 1;
606 unsigned RC7 : 1;
608 } __DDRCbits_t;
610 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
612 #define _TRISC0 0x01
613 #define _RC0 0x01
614 #define _RC1 0x02
615 #define _RC2 0x04
616 #define _TRISC3 0x08
617 #define _RC3 0x08
618 #define _TRISC4 0x10
619 #define _RC4 0x10
620 #define _TRISC5 0x20
621 #define _RC5 0x20
622 #define _TRISC6 0x40
623 #define _RC6 0x40
624 #define _TRISC7 0x80
625 #define _RC7 0x80
627 //==============================================================================
630 //==============================================================================
631 // TRISC Bits
633 extern __at(0x0F94) __sfr TRISC;
635 typedef union
637 struct
639 unsigned TRISC0 : 1;
640 unsigned RC1 : 1;
641 unsigned RC2 : 1;
642 unsigned TRISC3 : 1;
643 unsigned TRISC4 : 1;
644 unsigned TRISC5 : 1;
645 unsigned TRISC6 : 1;
646 unsigned TRISC7 : 1;
649 struct
651 unsigned RC0 : 1;
652 unsigned : 1;
653 unsigned : 1;
654 unsigned RC3 : 1;
655 unsigned RC4 : 1;
656 unsigned RC5 : 1;
657 unsigned RC6 : 1;
658 unsigned RC7 : 1;
660 } __TRISCbits_t;
662 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
664 #define _TRISC_TRISC0 0x01
665 #define _TRISC_RC0 0x01
666 #define _TRISC_RC1 0x02
667 #define _TRISC_RC2 0x04
668 #define _TRISC_TRISC3 0x08
669 #define _TRISC_RC3 0x08
670 #define _TRISC_TRISC4 0x10
671 #define _TRISC_RC4 0x10
672 #define _TRISC_TRISC5 0x20
673 #define _TRISC_RC5 0x20
674 #define _TRISC_TRISC6 0x40
675 #define _TRISC_RC6 0x40
676 #define _TRISC_TRISC7 0x80
677 #define _TRISC_RC7 0x80
679 //==============================================================================
682 //==============================================================================
683 // PIE1 Bits
685 extern __at(0x0F9D) __sfr PIE1;
687 typedef struct
689 unsigned TMR1IE : 1;
690 unsigned TMR2IE : 1;
691 unsigned CCP1IE : 1;
692 unsigned SSPIE : 1;
693 unsigned TXIE : 1;
694 unsigned RCIE : 1;
695 unsigned ADIE : 1;
696 unsigned PSPIE : 1;
697 } __PIE1bits_t;
699 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
701 #define _TMR1IE 0x01
702 #define _TMR2IE 0x02
703 #define _CCP1IE 0x04
704 #define _SSPIE 0x08
705 #define _TXIE 0x10
706 #define _RCIE 0x20
707 #define _ADIE 0x40
708 #define _PSPIE 0x80
710 //==============================================================================
713 //==============================================================================
714 // PIR1 Bits
716 extern __at(0x0F9E) __sfr PIR1;
718 typedef struct
720 unsigned TMR1IF : 1;
721 unsigned TMR2IF : 1;
722 unsigned CCP1IF : 1;
723 unsigned SSPIF : 1;
724 unsigned TXIF : 1;
725 unsigned RCIF : 1;
726 unsigned ADIF : 1;
727 unsigned PSPIF : 1;
728 } __PIR1bits_t;
730 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
732 #define _TMR1IF 0x01
733 #define _TMR2IF 0x02
734 #define _CCP1IF 0x04
735 #define _SSPIF 0x08
736 #define _TXIF 0x10
737 #define _RCIF 0x20
738 #define _ADIF 0x40
739 #define _PSPIF 0x80
741 //==============================================================================
744 //==============================================================================
745 // IPR1 Bits
747 extern __at(0x0F9F) __sfr IPR1;
749 typedef struct
751 unsigned TMR1IP : 1;
752 unsigned TMR2IP : 1;
753 unsigned CCP1IP : 1;
754 unsigned SSPIP : 1;
755 unsigned TXIP : 1;
756 unsigned RCIP : 1;
757 unsigned ADIP : 1;
758 unsigned PSPIP : 1;
759 } __IPR1bits_t;
761 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
763 #define _TMR1IP 0x01
764 #define _TMR2IP 0x02
765 #define _CCP1IP 0x04
766 #define _SSPIP 0x08
767 #define _TXIP 0x10
768 #define _RCIP 0x20
769 #define _ADIP 0x40
770 #define _PSPIP 0x80
772 //==============================================================================
775 //==============================================================================
776 // PIE2 Bits
778 extern __at(0x0FA0) __sfr PIE2;
780 typedef struct
782 unsigned CCP2IE : 1;
783 unsigned TMR3IE : 1;
784 unsigned LVDIE : 1;
785 unsigned BCLIE : 1;
786 unsigned EEIE : 1;
787 unsigned : 1;
788 unsigned : 1;
789 unsigned : 1;
790 } __PIE2bits_t;
792 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
794 #define _CCP2IE 0x01
795 #define _TMR3IE 0x02
796 #define _LVDIE 0x04
797 #define _BCLIE 0x08
798 #define _EEIE 0x10
800 //==============================================================================
803 //==============================================================================
804 // PIR2 Bits
806 extern __at(0x0FA1) __sfr PIR2;
808 typedef struct
810 unsigned CCP2IF : 1;
811 unsigned TMR3IF : 1;
812 unsigned LVDIF : 1;
813 unsigned BCLIF : 1;
814 unsigned EEIF : 1;
815 unsigned : 1;
816 unsigned : 1;
817 unsigned : 1;
818 } __PIR2bits_t;
820 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
822 #define _CCP2IF 0x01
823 #define _TMR3IF 0x02
824 #define _LVDIF 0x04
825 #define _BCLIF 0x08
826 #define _EEIF 0x10
828 //==============================================================================
831 //==============================================================================
832 // IPR2 Bits
834 extern __at(0x0FA2) __sfr IPR2;
836 typedef struct
838 unsigned CCP2IP : 1;
839 unsigned TMR3IP : 1;
840 unsigned LVDIP : 1;
841 unsigned BCLIP : 1;
842 unsigned EEIP : 1;
843 unsigned : 1;
844 unsigned : 1;
845 unsigned : 1;
846 } __IPR2bits_t;
848 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
850 #define _CCP2IP 0x01
851 #define _TMR3IP 0x02
852 #define _LVDIP 0x04
853 #define _BCLIP 0x08
854 #define _EEIP 0x10
856 //==============================================================================
859 //==============================================================================
860 // EECON1 Bits
862 extern __at(0x0FA6) __sfr EECON1;
864 typedef struct
866 unsigned RD : 1;
867 unsigned WR : 1;
868 unsigned WREN : 1;
869 unsigned WRERR : 1;
870 unsigned FREE : 1;
871 unsigned : 1;
872 unsigned CFGS : 1;
873 unsigned EEPGD : 1;
874 } __EECON1bits_t;
876 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
878 #define _RD 0x01
879 #define _WR 0x02
880 #define _WREN 0x04
881 #define _WRERR 0x08
882 #define _FREE 0x10
883 #define _CFGS 0x40
884 #define _EEPGD 0x80
886 //==============================================================================
888 extern __at(0x0FA7) __sfr EECON2;
889 extern __at(0x0FA8) __sfr EEDATA;
890 extern __at(0x0FA9) __sfr EEADR;
892 //==============================================================================
893 // RCSTA Bits
895 extern __at(0x0FAB) __sfr RCSTA;
897 typedef struct
899 unsigned RX9D : 1;
900 unsigned OERR : 1;
901 unsigned FERR : 1;
902 unsigned ADDEN : 1;
903 unsigned CREN : 1;
904 unsigned SREN : 1;
905 unsigned RX9 : 1;
906 unsigned SPEN : 1;
907 } __RCSTAbits_t;
909 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
911 #define _RX9D 0x01
912 #define _OERR 0x02
913 #define _FERR 0x04
914 #define _ADDEN 0x08
915 #define _CREN 0x10
916 #define _SREN 0x20
917 #define _RX9 0x40
918 #define _SPEN 0x80
920 //==============================================================================
923 //==============================================================================
924 // TXSTA Bits
926 extern __at(0x0FAC) __sfr TXSTA;
928 typedef struct
930 unsigned TX9D : 1;
931 unsigned TRMT : 1;
932 unsigned BRGH : 1;
933 unsigned : 1;
934 unsigned SYNC : 1;
935 unsigned TXEN : 1;
936 unsigned TX9 : 1;
937 unsigned CSRC : 1;
938 } __TXSTAbits_t;
940 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
942 #define _TX9D 0x01
943 #define _TRMT 0x02
944 #define _BRGH 0x04
945 #define _SYNC 0x10
946 #define _TXEN 0x20
947 #define _TX9 0x40
948 #define _CSRC 0x80
950 //==============================================================================
952 extern __at(0x0FAD) __sfr TXREG;
953 extern __at(0x0FAE) __sfr RCREG;
954 extern __at(0x0FAF) __sfr SPBRG;
956 //==============================================================================
957 // T3CON Bits
959 extern __at(0x0FB1) __sfr T3CON;
961 typedef union
963 struct
965 unsigned TMR3ON : 1;
966 unsigned TMR3CS : 1;
967 unsigned NOT_T3SYNC : 1;
968 unsigned T3CCP1 : 1;
969 unsigned T3CKPS0 : 1;
970 unsigned T3CKPS1 : 1;
971 unsigned T3CCP2 : 1;
972 unsigned RD16 : 1;
975 struct
977 unsigned : 1;
978 unsigned : 1;
979 unsigned T3SYNC : 1;
980 unsigned : 1;
981 unsigned : 1;
982 unsigned : 1;
983 unsigned : 1;
984 unsigned : 1;
987 struct
989 unsigned : 4;
990 unsigned T3CKPS : 2;
991 unsigned : 2;
993 } __T3CONbits_t;
995 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
997 #define _T3CON_TMR3ON 0x01
998 #define _T3CON_TMR3CS 0x02
999 #define _T3CON_NOT_T3SYNC 0x04
1000 #define _T3CON_T3SYNC 0x04
1001 #define _T3CON_T3CCP1 0x08
1002 #define _T3CON_T3CKPS0 0x10
1003 #define _T3CON_T3CKPS1 0x20
1004 #define _T3CON_T3CCP2 0x40
1005 #define _T3CON_RD16 0x80
1007 //==============================================================================
1009 extern __at(0x0FB2) __sfr TMR3;
1010 extern __at(0x0FB2) __sfr TMR3L;
1011 extern __at(0x0FB3) __sfr TMR3H;
1013 //==============================================================================
1014 // CCP2CON Bits
1016 extern __at(0x0FBA) __sfr CCP2CON;
1018 typedef union
1020 struct
1022 unsigned CCP2M0 : 1;
1023 unsigned CCP2M1 : 1;
1024 unsigned CCP2M2 : 1;
1025 unsigned CCP2M3 : 1;
1026 unsigned CCP2Y : 1;
1027 unsigned CCP2X : 1;
1028 unsigned : 1;
1029 unsigned : 1;
1032 struct
1034 unsigned : 1;
1035 unsigned : 1;
1036 unsigned : 1;
1037 unsigned : 1;
1038 unsigned DC2B0 : 1;
1039 unsigned DC2B1 : 1;
1040 unsigned : 1;
1041 unsigned : 1;
1044 struct
1046 unsigned : 1;
1047 unsigned : 1;
1048 unsigned : 1;
1049 unsigned : 1;
1050 unsigned : 1;
1051 unsigned DCCPX : 1;
1052 unsigned : 1;
1053 unsigned : 1;
1056 struct
1058 unsigned CCP2M : 4;
1059 unsigned : 4;
1062 struct
1064 unsigned : 4;
1065 unsigned DC2B : 2;
1066 unsigned : 2;
1068 } __CCP2CONbits_t;
1070 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1072 #define _CCP2M0 0x01
1073 #define _CCP2M1 0x02
1074 #define _CCP2M2 0x04
1075 #define _CCP2M3 0x08
1076 #define _CCP2Y 0x10
1077 #define _DC2B0 0x10
1078 #define _CCP2X 0x20
1079 #define _DC2B1 0x20
1080 #define _DCCPX 0x20
1082 //==============================================================================
1084 extern __at(0x0FBB) __sfr CCPR2;
1085 extern __at(0x0FBB) __sfr CCPR2L;
1086 extern __at(0x0FBC) __sfr CCPR2H;
1088 //==============================================================================
1089 // CCP1CON Bits
1091 extern __at(0x0FBD) __sfr CCP1CON;
1093 typedef union
1095 struct
1097 unsigned CCP1M0 : 1;
1098 unsigned CCP1M1 : 1;
1099 unsigned CCP1M2 : 1;
1100 unsigned CCP1M3 : 1;
1101 unsigned CCP1Y : 1;
1102 unsigned CCP1X : 1;
1103 unsigned : 1;
1104 unsigned : 1;
1107 struct
1109 unsigned : 1;
1110 unsigned : 1;
1111 unsigned : 1;
1112 unsigned : 1;
1113 unsigned DC1B0 : 1;
1114 unsigned DC1B1 : 1;
1115 unsigned : 1;
1116 unsigned : 1;
1119 struct
1121 unsigned CCP1M : 4;
1122 unsigned : 4;
1125 struct
1127 unsigned : 4;
1128 unsigned DC1B : 2;
1129 unsigned : 2;
1131 } __CCP1CONbits_t;
1133 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1135 #define _CCP1M0 0x01
1136 #define _CCP1M1 0x02
1137 #define _CCP1M2 0x04
1138 #define _CCP1M3 0x08
1139 #define _CCP1Y 0x10
1140 #define _DC1B0 0x10
1141 #define _CCP1X 0x20
1142 #define _DC1B1 0x20
1144 //==============================================================================
1146 extern __at(0x0FBE) __sfr CCPR1;
1147 extern __at(0x0FBE) __sfr CCPR1L;
1148 extern __at(0x0FBF) __sfr CCPR1H;
1150 //==============================================================================
1151 // ADCON1 Bits
1153 extern __at(0x0FC1) __sfr ADCON1;
1155 typedef union
1157 struct
1159 unsigned PCFG0 : 1;
1160 unsigned PCFG1 : 1;
1161 unsigned PCFG2 : 1;
1162 unsigned PCFG3 : 1;
1163 unsigned : 1;
1164 unsigned : 1;
1165 unsigned ADCS2 : 1;
1166 unsigned ADFM : 1;
1169 struct
1171 unsigned PCFG : 4;
1172 unsigned : 4;
1174 } __ADCON1bits_t;
1176 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1178 #define _PCFG0 0x01
1179 #define _PCFG1 0x02
1180 #define _PCFG2 0x04
1181 #define _PCFG3 0x08
1182 #define _ADCS2 0x40
1183 #define _ADFM 0x80
1185 //==============================================================================
1188 //==============================================================================
1189 // ADCON0 Bits
1191 extern __at(0x0FC2) __sfr ADCON0;
1193 typedef union
1195 struct
1197 unsigned ADON : 1;
1198 unsigned : 1;
1199 unsigned GO_NOT_DONE : 1;
1200 unsigned CHS0 : 1;
1201 unsigned CHS1 : 1;
1202 unsigned CHS2 : 1;
1203 unsigned ADCS0 : 1;
1204 unsigned ADCS1 : 1;
1207 struct
1209 unsigned : 1;
1210 unsigned : 1;
1211 unsigned GO : 1;
1212 unsigned : 1;
1213 unsigned : 1;
1214 unsigned : 1;
1215 unsigned : 1;
1216 unsigned : 1;
1219 struct
1221 unsigned : 1;
1222 unsigned : 1;
1223 unsigned NOT_DONE : 1;
1224 unsigned : 1;
1225 unsigned : 1;
1226 unsigned : 1;
1227 unsigned : 1;
1228 unsigned : 1;
1231 struct
1233 unsigned : 1;
1234 unsigned : 1;
1235 unsigned DONE : 1;
1236 unsigned : 1;
1237 unsigned : 1;
1238 unsigned : 1;
1239 unsigned : 1;
1240 unsigned : 1;
1243 struct
1245 unsigned : 1;
1246 unsigned : 1;
1247 unsigned GO_DONE : 1;
1248 unsigned : 1;
1249 unsigned : 1;
1250 unsigned : 1;
1251 unsigned : 1;
1252 unsigned : 1;
1255 struct
1257 unsigned : 3;
1258 unsigned CHS : 3;
1259 unsigned : 2;
1262 struct
1264 unsigned : 6;
1265 unsigned ADCS : 2;
1267 } __ADCON0bits_t;
1269 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1271 #define _ADON 0x01
1272 #define _GO_NOT_DONE 0x04
1273 #define _GO 0x04
1274 #define _NOT_DONE 0x04
1275 #define _DONE 0x04
1276 #define _GO_DONE 0x04
1277 #define _CHS0 0x08
1278 #define _CHS1 0x10
1279 #define _CHS2 0x20
1280 #define _ADCS0 0x40
1281 #define _ADCS1 0x80
1283 //==============================================================================
1285 extern __at(0x0FC3) __sfr ADRES;
1286 extern __at(0x0FC3) __sfr ADRESL;
1287 extern __at(0x0FC4) __sfr ADRESH;
1289 //==============================================================================
1290 // SSPCON2 Bits
1292 extern __at(0x0FC5) __sfr SSPCON2;
1294 typedef struct
1296 unsigned SEN : 1;
1297 unsigned RSEN : 1;
1298 unsigned PEN : 1;
1299 unsigned RCEN : 1;
1300 unsigned ACKEN : 1;
1301 unsigned ACKDT : 1;
1302 unsigned ACKSTAT : 1;
1303 unsigned GCEN : 1;
1304 } __SSPCON2bits_t;
1306 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1308 #define _SEN 0x01
1309 #define _RSEN 0x02
1310 #define _PEN 0x04
1311 #define _RCEN 0x08
1312 #define _ACKEN 0x10
1313 #define _ACKDT 0x20
1314 #define _ACKSTAT 0x40
1315 #define _GCEN 0x80
1317 //==============================================================================
1320 //==============================================================================
1321 // SSPCON1 Bits
1323 extern __at(0x0FC6) __sfr SSPCON1;
1325 typedef union
1327 struct
1329 unsigned SSPM0 : 1;
1330 unsigned SSPM1 : 1;
1331 unsigned SSPM2 : 1;
1332 unsigned SSPM3 : 1;
1333 unsigned CKP : 1;
1334 unsigned SSPEN : 1;
1335 unsigned SSPOV : 1;
1336 unsigned WCOL : 1;
1339 struct
1341 unsigned SSPM : 4;
1342 unsigned : 4;
1344 } __SSPCON1bits_t;
1346 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1348 #define _SSPM0 0x01
1349 #define _SSPM1 0x02
1350 #define _SSPM2 0x04
1351 #define _SSPM3 0x08
1352 #define _CKP 0x10
1353 #define _SSPEN 0x20
1354 #define _SSPOV 0x40
1355 #define _WCOL 0x80
1357 //==============================================================================
1360 //==============================================================================
1361 // SSPSTAT Bits
1363 extern __at(0x0FC7) __sfr SSPSTAT;
1365 typedef union
1367 struct
1369 unsigned BF : 1;
1370 unsigned UA : 1;
1371 unsigned R_NOT_W : 1;
1372 unsigned S : 1;
1373 unsigned P : 1;
1374 unsigned D_NOT_A : 1;
1375 unsigned CKE : 1;
1376 unsigned SMP : 1;
1379 struct
1381 unsigned : 1;
1382 unsigned : 1;
1383 unsigned R_W : 1;
1384 unsigned : 1;
1385 unsigned : 1;
1386 unsigned D_A : 1;
1387 unsigned : 1;
1388 unsigned : 1;
1390 } __SSPSTATbits_t;
1392 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1394 #define _BF 0x01
1395 #define _UA 0x02
1396 #define _R_NOT_W 0x04
1397 #define _R_W 0x04
1398 #define _S 0x08
1399 #define _P 0x10
1400 #define _D_NOT_A 0x20
1401 #define _D_A 0x20
1402 #define _CKE 0x40
1403 #define _SMP 0x80
1405 //==============================================================================
1407 extern __at(0x0FC8) __sfr SSPADD;
1408 extern __at(0x0FC9) __sfr SSPBUF;
1410 //==============================================================================
1411 // T2CON Bits
1413 extern __at(0x0FCA) __sfr T2CON;
1415 typedef union
1417 struct
1419 unsigned T2CKPS0 : 1;
1420 unsigned T2CKPS1 : 1;
1421 unsigned TMR2ON : 1;
1422 unsigned TOUTPS0 : 1;
1423 unsigned TOUTPS1 : 1;
1424 unsigned TOUTPS2 : 1;
1425 unsigned TOUTPS3 : 1;
1426 unsigned : 1;
1429 struct
1431 unsigned T2CKPS : 2;
1432 unsigned : 6;
1435 struct
1437 unsigned : 3;
1438 unsigned TOUTPS : 4;
1439 unsigned : 1;
1441 } __T2CONbits_t;
1443 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
1445 #define _T2CKPS0 0x01
1446 #define _T2CKPS1 0x02
1447 #define _TMR2ON 0x04
1448 #define _TOUTPS0 0x08
1449 #define _TOUTPS1 0x10
1450 #define _TOUTPS2 0x20
1451 #define _TOUTPS3 0x40
1453 //==============================================================================
1455 extern __at(0x0FCB) __sfr PR2;
1456 extern __at(0x0FCC) __sfr TMR2;
1458 //==============================================================================
1459 // T1CON Bits
1461 extern __at(0x0FCD) __sfr T1CON;
1463 typedef union
1465 struct
1467 unsigned TMR1ON : 1;
1468 unsigned TMR1CS : 1;
1469 unsigned NOT_T1SYNC : 1;
1470 unsigned T1OSCEN : 1;
1471 unsigned T1CKPS0 : 1;
1472 unsigned T1CKPS1 : 1;
1473 unsigned : 1;
1474 unsigned RD16 : 1;
1477 struct
1479 unsigned : 1;
1480 unsigned : 1;
1481 unsigned T1SYNC : 1;
1482 unsigned : 1;
1483 unsigned : 1;
1484 unsigned : 1;
1485 unsigned : 1;
1486 unsigned T1RD16 : 1;
1489 struct
1491 unsigned : 4;
1492 unsigned T1CKPS : 2;
1493 unsigned : 2;
1495 } __T1CONbits_t;
1497 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1499 #define _TMR1ON 0x01
1500 #define _TMR1CS 0x02
1501 #define _NOT_T1SYNC 0x04
1502 #define _T1SYNC 0x04
1503 #define _T1OSCEN 0x08
1504 #define _T1CKPS0 0x10
1505 #define _T1CKPS1 0x20
1506 #define _RD16 0x80
1507 #define _T1RD16 0x80
1509 //==============================================================================
1511 extern __at(0x0FCE) __sfr TMR1;
1512 extern __at(0x0FCE) __sfr TMR1L;
1513 extern __at(0x0FCF) __sfr TMR1H;
1515 //==============================================================================
1516 // RCON Bits
1518 extern __at(0x0FD0) __sfr RCON;
1520 typedef union
1522 struct
1524 unsigned NOT_BOR : 1;
1525 unsigned NOT_POR : 1;
1526 unsigned NOT_PD : 1;
1527 unsigned NOT_TO : 1;
1528 unsigned NOT_RI : 1;
1529 unsigned : 1;
1530 unsigned : 1;
1531 unsigned IPEN : 1;
1534 struct
1536 unsigned BOR : 1;
1537 unsigned POR : 1;
1538 unsigned PD : 1;
1539 unsigned TO : 1;
1540 unsigned RI : 1;
1541 unsigned : 1;
1542 unsigned : 1;
1543 unsigned NOT_IPEN : 1;
1545 } __RCONbits_t;
1547 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1549 #define _NOT_BOR 0x01
1550 #define _BOR 0x01
1551 #define _NOT_POR 0x02
1552 #define _POR 0x02
1553 #define _NOT_PD 0x04
1554 #define _PD 0x04
1555 #define _NOT_TO 0x08
1556 #define _TO 0x08
1557 #define _NOT_RI 0x10
1558 #define _RI 0x10
1559 #define _IPEN 0x80
1560 #define _NOT_IPEN 0x80
1562 //==============================================================================
1565 //==============================================================================
1566 // WDTCON Bits
1568 extern __at(0x0FD1) __sfr WDTCON;
1570 typedef union
1572 struct
1574 unsigned SWDTEN : 1;
1575 unsigned : 1;
1576 unsigned : 1;
1577 unsigned : 1;
1578 unsigned : 1;
1579 unsigned : 1;
1580 unsigned : 1;
1581 unsigned : 1;
1584 struct
1586 unsigned SWDTE : 1;
1587 unsigned : 1;
1588 unsigned : 1;
1589 unsigned : 1;
1590 unsigned : 1;
1591 unsigned : 1;
1592 unsigned : 1;
1593 unsigned : 1;
1595 } __WDTCONbits_t;
1597 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
1599 #define _SWDTEN 0x01
1600 #define _SWDTE 0x01
1602 //==============================================================================
1605 //==============================================================================
1606 // LVDCON Bits
1608 extern __at(0x0FD2) __sfr LVDCON;
1610 typedef union
1612 struct
1614 unsigned LVDL0 : 1;
1615 unsigned LVDL1 : 1;
1616 unsigned LVDL2 : 1;
1617 unsigned LVDL3 : 1;
1618 unsigned LVDEN : 1;
1619 unsigned IRVST : 1;
1620 unsigned : 1;
1621 unsigned : 1;
1624 struct
1626 unsigned LVDL : 4;
1627 unsigned : 4;
1629 } __LVDCONbits_t;
1631 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
1633 #define _LVDL0 0x01
1634 #define _LVDL1 0x02
1635 #define _LVDL2 0x04
1636 #define _LVDL3 0x08
1637 #define _LVDEN 0x10
1638 #define _IRVST 0x20
1640 //==============================================================================
1643 //==============================================================================
1644 // OSCCON Bits
1646 extern __at(0x0FD3) __sfr OSCCON;
1648 typedef union
1650 struct
1652 unsigned RESERVED : 1;
1653 unsigned : 1;
1654 unsigned : 1;
1655 unsigned : 1;
1656 unsigned : 1;
1657 unsigned : 1;
1658 unsigned : 1;
1659 unsigned : 1;
1662 struct
1664 unsigned SCS : 1;
1665 unsigned : 1;
1666 unsigned : 1;
1667 unsigned : 1;
1668 unsigned : 1;
1669 unsigned : 1;
1670 unsigned : 1;
1671 unsigned : 1;
1673 } __OSCCONbits_t;
1675 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
1677 #define _RESERVED 0x01
1678 #define _SCS 0x01
1680 //==============================================================================
1683 //==============================================================================
1684 // T0CON Bits
1686 extern __at(0x0FD5) __sfr T0CON;
1688 typedef union
1690 struct
1692 unsigned T0PS0 : 1;
1693 unsigned T0PS1 : 1;
1694 unsigned T0PS2 : 1;
1695 unsigned PSA : 1;
1696 unsigned T0SE : 1;
1697 unsigned T0CS : 1;
1698 unsigned T08BIT : 1;
1699 unsigned TMR0ON : 1;
1702 struct
1704 unsigned T0PS : 3;
1705 unsigned : 5;
1707 } __T0CONbits_t;
1709 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
1711 #define _T0PS0 0x01
1712 #define _T0PS1 0x02
1713 #define _T0PS2 0x04
1714 #define _PSA 0x08
1715 #define _T0SE 0x10
1716 #define _T0CS 0x20
1717 #define _T08BIT 0x40
1718 #define _TMR0ON 0x80
1720 //==============================================================================
1722 extern __at(0x0FD6) __sfr TMR0;
1723 extern __at(0x0FD6) __sfr TMR0L;
1724 extern __at(0x0FD7) __sfr TMR0H;
1726 //==============================================================================
1727 // STATUS Bits
1729 extern __at(0x0FD8) __sfr STATUS;
1731 typedef struct
1733 unsigned C : 1;
1734 unsigned DC : 1;
1735 unsigned Z : 1;
1736 unsigned OV : 1;
1737 unsigned N : 1;
1738 unsigned : 1;
1739 unsigned : 1;
1740 unsigned : 1;
1741 } __STATUSbits_t;
1743 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
1745 #define _C 0x01
1746 #define _DC 0x02
1747 #define _Z 0x04
1748 #define _OV 0x08
1749 #define _N 0x10
1751 //==============================================================================
1753 extern __at(0x0FD9) __sfr FSR2L;
1754 extern __at(0x0FDA) __sfr FSR2H;
1755 extern __at(0x0FDB) __sfr PLUSW2;
1756 extern __at(0x0FDC) __sfr PREINC2;
1757 extern __at(0x0FDD) __sfr POSTDEC2;
1758 extern __at(0x0FDE) __sfr POSTINC2;
1759 extern __at(0x0FDF) __sfr INDF2;
1760 extern __at(0x0FE0) __sfr BSR;
1761 extern __at(0x0FE1) __sfr FSR1L;
1762 extern __at(0x0FE2) __sfr FSR1H;
1763 extern __at(0x0FE3) __sfr PLUSW1;
1764 extern __at(0x0FE4) __sfr PREINC1;
1765 extern __at(0x0FE5) __sfr POSTDEC1;
1766 extern __at(0x0FE6) __sfr POSTINC1;
1767 extern __at(0x0FE7) __sfr INDF1;
1768 extern __at(0x0FE8) __sfr WREG;
1769 extern __at(0x0FE9) __sfr FSR0L;
1770 extern __at(0x0FEA) __sfr FSR0H;
1771 extern __at(0x0FEB) __sfr PLUSW0;
1772 extern __at(0x0FEC) __sfr PREINC0;
1773 extern __at(0x0FED) __sfr POSTDEC0;
1774 extern __at(0x0FEE) __sfr POSTINC0;
1775 extern __at(0x0FEF) __sfr INDF0;
1777 //==============================================================================
1778 // INTCON3 Bits
1780 extern __at(0x0FF0) __sfr INTCON3;
1782 typedef union
1784 struct
1786 unsigned INT1IF : 1;
1787 unsigned INT2IF : 1;
1788 unsigned : 1;
1789 unsigned INT1IE : 1;
1790 unsigned INT2IE : 1;
1791 unsigned : 1;
1792 unsigned INT1IP : 1;
1793 unsigned INT2IP : 1;
1796 struct
1798 unsigned INT1F : 1;
1799 unsigned INT2F : 1;
1800 unsigned : 1;
1801 unsigned INT1E : 1;
1802 unsigned INT2E : 1;
1803 unsigned : 1;
1804 unsigned INT1P : 1;
1805 unsigned INT2P : 1;
1807 } __INTCON3bits_t;
1809 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
1811 #define _INT1IF 0x01
1812 #define _INT1F 0x01
1813 #define _INT2IF 0x02
1814 #define _INT2F 0x02
1815 #define _INT1IE 0x08
1816 #define _INT1E 0x08
1817 #define _INT2IE 0x10
1818 #define _INT2E 0x10
1819 #define _INT1IP 0x40
1820 #define _INT1P 0x40
1821 #define _INT2IP 0x80
1822 #define _INT2P 0x80
1824 //==============================================================================
1827 //==============================================================================
1828 // INTCON2 Bits
1830 extern __at(0x0FF1) __sfr INTCON2;
1832 typedef union
1834 struct
1836 unsigned RBIP : 1;
1837 unsigned INT3P : 1;
1838 unsigned TMR0IP : 1;
1839 unsigned INTEDG3 : 1;
1840 unsigned INTEDG2 : 1;
1841 unsigned INTEDG1 : 1;
1842 unsigned INTEDG0 : 1;
1843 unsigned NOT_RBPU : 1;
1846 struct
1848 unsigned : 1;
1849 unsigned : 1;
1850 unsigned T0IP : 1;
1851 unsigned : 1;
1852 unsigned : 1;
1853 unsigned : 1;
1854 unsigned : 1;
1855 unsigned RBPU : 1;
1857 } __INTCON2bits_t;
1859 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
1861 #define _RBIP 0x01
1862 #define _INT3P 0x02
1863 #define _TMR0IP 0x04
1864 #define _T0IP 0x04
1865 #define _INTEDG3 0x08
1866 #define _INTEDG2 0x10
1867 #define _INTEDG1 0x20
1868 #define _INTEDG0 0x40
1869 #define _NOT_RBPU 0x80
1870 #define _RBPU 0x80
1872 //==============================================================================
1875 //==============================================================================
1876 // INTCON Bits
1878 extern __at(0x0FF2) __sfr INTCON;
1880 typedef union
1882 struct
1884 unsigned RBIF : 1;
1885 unsigned INT0IF : 1;
1886 unsigned TMR0IF : 1;
1887 unsigned RBIE : 1;
1888 unsigned INT0IE : 1;
1889 unsigned TMR0IE : 1;
1890 unsigned PEIE_GIEL : 1;
1891 unsigned GIE_GIEH : 1;
1894 struct
1896 unsigned : 1;
1897 unsigned INT0F : 1;
1898 unsigned T0IF : 1;
1899 unsigned : 1;
1900 unsigned INT0E : 1;
1901 unsigned T0IE : 1;
1902 unsigned PEIE : 1;
1903 unsigned GIE : 1;
1906 struct
1908 unsigned : 1;
1909 unsigned : 1;
1910 unsigned : 1;
1911 unsigned : 1;
1912 unsigned : 1;
1913 unsigned : 1;
1914 unsigned GIEL : 1;
1915 unsigned GIEH : 1;
1917 } __INTCONbits_t;
1919 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
1921 #define _RBIF 0x01
1922 #define _INT0IF 0x02
1923 #define _INT0F 0x02
1924 #define _TMR0IF 0x04
1925 #define _T0IF 0x04
1926 #define _RBIE 0x08
1927 #define _INT0IE 0x10
1928 #define _INT0E 0x10
1929 #define _TMR0IE 0x20
1930 #define _T0IE 0x20
1931 #define _PEIE_GIEL 0x40
1932 #define _PEIE 0x40
1933 #define _GIEL 0x40
1934 #define _GIE_GIEH 0x80
1935 #define _GIE 0x80
1936 #define _GIEH 0x80
1938 //==============================================================================
1940 extern __at(0x0FF3) __sfr PROD;
1941 extern __at(0x0FF3) __sfr PRODL;
1942 extern __at(0x0FF4) __sfr PRODH;
1943 extern __at(0x0FF5) __sfr TABLAT;
1944 extern __at(0x0FF6) __sfr TBLPTR;
1945 extern __at(0x0FF6) __sfr TBLPTRL;
1946 extern __at(0x0FF7) __sfr TBLPTRH;
1947 extern __at(0x0FF8) __sfr TBLPTRU;
1948 extern __at(0x0FF9) __sfr PC;
1949 extern __at(0x0FF9) __sfr PCL;
1950 extern __at(0x0FFA) __sfr PCLATH;
1951 extern __at(0x0FFB) __sfr PCLATU;
1953 //==============================================================================
1954 // STKPTR Bits
1956 extern __at(0x0FFC) __sfr STKPTR;
1958 typedef union
1960 struct
1962 unsigned STKPTR0 : 1;
1963 unsigned STKPTR1 : 1;
1964 unsigned STKPTR2 : 1;
1965 unsigned STKPTR3 : 1;
1966 unsigned STKPTR4 : 1;
1967 unsigned : 1;
1968 unsigned STKUNF : 1;
1969 unsigned STKFUL : 1;
1972 struct
1974 unsigned STKPTR : 5;
1975 unsigned : 3;
1977 } __STKPTRbits_t;
1979 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
1981 #define _STKPTR0 0x01
1982 #define _STKPTR1 0x02
1983 #define _STKPTR2 0x04
1984 #define _STKPTR3 0x08
1985 #define _STKPTR4 0x10
1986 #define _STKUNF 0x40
1987 #define _STKFUL 0x80
1989 //==============================================================================
1991 extern __at(0x0FFD) __sfr TOS;
1992 extern __at(0x0FFD) __sfr TOSL;
1993 extern __at(0x0FFE) __sfr TOSH;
1994 extern __at(0x0FFF) __sfr TOSU;
1996 //==============================================================================
1998 // Configuration Bits
2000 //==============================================================================
2002 #define __CONFIG1H 0x300001
2003 #define __CONFIG2L 0x300002
2004 #define __CONFIG2H 0x300003
2005 #define __CONFIG4L 0x300006
2006 #define __CONFIG5L 0x300008
2007 #define __CONFIG5H 0x300009
2008 #define __CONFIG6L 0x30000A
2009 #define __CONFIG6H 0x30000B
2010 #define __CONFIG7L 0x30000C
2011 #define __CONFIG7H 0x30000D
2013 //----------------------------- CONFIG1H Options -------------------------------
2015 #define _OSC_HS_1H 0xFA // HS oscillator.
2016 #define _OSC_EC_1H 0xFC // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2017 #define _OSC_ECIO_1H 0xFD // EC oscillator w/ OSC2 configured as RA6.
2018 #define _OSC_HSPLL_1H 0xFE // HS oscillator with PLL enabled; clock frequency = (4 x FOSC).
2020 //----------------------------- CONFIG2L Options -------------------------------
2022 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2023 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2024 #define _BOR_OFF_2L 0xFD // Brown-out Reset disabled.
2025 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled.
2026 #define _BORV_45_2L 0xF3 // VBOR set to 4.5V.
2027 #define _BORV_42_2L 0xF7 // VBOR set to 4.2V.
2028 #define _BORV_27_2L 0xFB // VBOR set to 2.7V.
2029 #define _BORV_25_2L 0xFF // VBOR set to 2.5V.
2031 //----------------------------- CONFIG2H Options -------------------------------
2033 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2034 #define _WDT_ON_2H 0xFF // WDT enabled.
2035 #define _WDTPS_1_2H 0xF1 // 1:1.
2036 #define _WDTPS_2_2H 0xF3 // 1:2.
2037 #define _WDTPS_4_2H 0xF5 // 1:4.
2038 #define _WDTPS_8_2H 0xF7 // 1:8.
2039 #define _WDTPS_16_2H 0xF9 // 1:16.
2040 #define _WDTPS_32_2H 0xFB // 1:32.
2041 #define _WDTPS_64_2H 0xFD // 1:64.
2042 #define _WDTPS_128_2H 0xFF // 1:128.
2044 //----------------------------- CONFIG4L Options -------------------------------
2046 #define _STVR_OFF_4L 0xFE // Stack Full/Underflow will not cause RESET.
2047 #define _STVR_ON_4L 0xFF // Stack Full/Underflow will cause RESET.
2048 #define _LVP_OFF_4L 0xFB // Low Voltage ICSP disabled.
2049 #define _LVP_ON_4L 0xFF // Low Voltage ICSP enabled.
2050 #define _DEBUG_ON_4L 0x7F // Background Debugger enabled. RB6 and RB7 are dedicated to In-Circuit Debug.
2051 #define _DEBUG_OFF_4L 0xFF // Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
2053 //----------------------------- CONFIG5L Options -------------------------------
2055 #define _CP0_ON_5L 0xFE // Block 0 (000200-001FFFh) code protected.
2056 #define _CP0_OFF_5L 0xFF // Block 0 (000200-001FFFh) not code protected.
2057 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code protected.
2058 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code protected.
2059 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code protected.
2060 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code protected.
2062 //----------------------------- CONFIG5H Options -------------------------------
2064 #define _CPB_ON_5H 0xBF // Boot block (000000-0001FFh) code protected.
2065 #define _CPB_OFF_5H 0xFF // Boot block (000000-0001FFh) not code protected.
2066 #define _CPD_ON_5H 0x7F // Data EEPROM code protected.
2067 #define _CPD_OFF_5H 0xFF // Data EEPROM not code protected.
2069 //----------------------------- CONFIG6L Options -------------------------------
2071 #define _WRT0_ON_6L 0xFE // Block 0 (000200h-001FFFh) write protected.
2072 #define _WRT0_OFF_6L 0xFF // Block 0 (000200h-001FFFh) not write protected.
2073 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write protected.
2074 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write protected.
2075 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write protected.
2076 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write protected.
2078 //----------------------------- CONFIG6H Options -------------------------------
2080 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write protected.
2081 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write protected.
2082 #define _WRTB_ON_6H 0xBF // Boot block (000000-0001FFh) write protected.
2083 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0001FFh) not write protected.
2084 #define _WRTD_ON_6H 0x7F // Data EEPROM write protected.
2085 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write protected.
2087 //----------------------------- CONFIG7L Options -------------------------------
2089 #define _EBTR0_ON_7L 0xFE // Block 0 (000200h-001FFFh) protected from Table Reads executed in other blocks.
2090 #define _EBTR0_OFF_7L 0xFF // Block 0 (000200h-001FFFh) not protected from Table Reads executed in other blocks.
2091 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from Table Reads executed in other blocks.
2092 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks.
2093 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from Table Reads executed in other blocks.
2094 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks.
2096 //----------------------------- CONFIG7H Options -------------------------------
2098 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0001FFh) protected from Table Reads executed in other blocks.
2099 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0001FFh) not protected from Table Reads executed in other blocks.
2101 //==============================================================================
2103 #define __DEVID1 0x3FFFFE
2104 #define __DEVID2 0x3FFFFF
2106 #define __IDLOC0 0x200000
2107 #define __IDLOC1 0x200001
2108 #define __IDLOC2 0x200002
2109 #define __IDLOC3 0x200003
2110 #define __IDLOC4 0x200004
2111 #define __IDLOC5 0x200005
2112 #define __IDLOC6 0x200006
2113 #define __IDLOC7 0x200007
2115 #endif // #ifndef __PIC18LF2539_H__