struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic16 / pic18f4439.h
blob9787074bfb1776571ae236d4d5b543a91ff6446b
1 /*
2 * This declarations of the PIC18F4439 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:46 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 __PIC18F4439_H__
26 #define __PIC18F4439_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 // PORTD Bits
254 extern __at(0x0F83) __sfr PORTD;
256 typedef union
258 struct
260 unsigned RD0 : 1;
261 unsigned RD1 : 1;
262 unsigned RD2 : 1;
263 unsigned RD3 : 1;
264 unsigned RD4 : 1;
265 unsigned RD5 : 1;
266 unsigned RD6 : 1;
267 unsigned RD7 : 1;
270 struct
272 unsigned AD0 : 1;
273 unsigned AD1 : 1;
274 unsigned AD2 : 1;
275 unsigned AD3 : 1;
276 unsigned AD4 : 1;
277 unsigned AD5 : 1;
278 unsigned AD6 : 1;
279 unsigned AD7 : 1;
281 } __PORTDbits_t;
283 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits;
285 #define _PORTD_RD0 0x01
286 #define _PORTD_AD0 0x01
287 #define _PORTD_RD1 0x02
288 #define _PORTD_AD1 0x02
289 #define _PORTD_RD2 0x04
290 #define _PORTD_AD2 0x04
291 #define _PORTD_RD3 0x08
292 #define _PORTD_AD3 0x08
293 #define _PORTD_RD4 0x10
294 #define _PORTD_AD4 0x10
295 #define _PORTD_RD5 0x20
296 #define _PORTD_AD5 0x20
297 #define _PORTD_RD6 0x40
298 #define _PORTD_AD6 0x40
299 #define _PORTD_RD7 0x80
300 #define _PORTD_AD7 0x80
302 //==============================================================================
305 //==============================================================================
306 // PORTE Bits
308 extern __at(0x0F84) __sfr PORTE;
310 typedef union
312 struct
314 unsigned RE0 : 1;
315 unsigned RE1 : 1;
316 unsigned RE2 : 1;
317 unsigned RE3 : 1;
318 unsigned RE4 : 1;
319 unsigned RE5 : 1;
320 unsigned RE6 : 1;
321 unsigned RE7 : 1;
324 struct
326 unsigned AN5 : 1;
327 unsigned AN6 : 1;
328 unsigned AN7 : 1;
329 unsigned WRH : 1;
330 unsigned : 1;
331 unsigned : 1;
332 unsigned : 1;
333 unsigned CCP2 : 1;
336 struct
338 unsigned ALE : 1;
339 unsigned OE : 1;
340 unsigned WRL : 1;
341 unsigned : 1;
342 unsigned : 1;
343 unsigned : 1;
344 unsigned : 1;
345 unsigned : 1;
347 } __PORTEbits_t;
349 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits;
351 #define _PORTE_RE0 0x01
352 #define _PORTE_AN5 0x01
353 #define _PORTE_ALE 0x01
354 #define _PORTE_RE1 0x02
355 #define _PORTE_AN6 0x02
356 #define _PORTE_OE 0x02
357 #define _PORTE_RE2 0x04
358 #define _PORTE_AN7 0x04
359 #define _PORTE_WRL 0x04
360 #define _PORTE_RE3 0x08
361 #define _PORTE_WRH 0x08
362 #define _PORTE_RE4 0x10
363 #define _PORTE_RE5 0x20
364 #define _PORTE_RE6 0x40
365 #define _PORTE_RE7 0x80
366 #define _PORTE_CCP2 0x80
368 //==============================================================================
371 //==============================================================================
372 // LATA Bits
374 extern __at(0x0F89) __sfr LATA;
376 typedef union
378 struct
380 unsigned LATA0 : 1;
381 unsigned LATA1 : 1;
382 unsigned LATA2 : 1;
383 unsigned LATA3 : 1;
384 unsigned LATA4 : 1;
385 unsigned LATA5 : 1;
386 unsigned LATA6 : 1;
387 unsigned : 1;
390 struct
392 unsigned LATA : 7;
393 unsigned : 1;
395 } __LATAbits_t;
397 extern __at(0x0F89) volatile __LATAbits_t LATAbits;
399 #define _LATA0 0x01
400 #define _LATA1 0x02
401 #define _LATA2 0x04
402 #define _LATA3 0x08
403 #define _LATA4 0x10
404 #define _LATA5 0x20
405 #define _LATA6 0x40
407 //==============================================================================
410 //==============================================================================
411 // LATB Bits
413 extern __at(0x0F8A) __sfr LATB;
415 typedef struct
417 unsigned LATB0 : 1;
418 unsigned LATB1 : 1;
419 unsigned LATB2 : 1;
420 unsigned LATB3 : 1;
421 unsigned LATB4 : 1;
422 unsigned LATB5 : 1;
423 unsigned LATB6 : 1;
424 unsigned LATB7 : 1;
425 } __LATBbits_t;
427 extern __at(0x0F8A) volatile __LATBbits_t LATBbits;
429 #define _LATB0 0x01
430 #define _LATB1 0x02
431 #define _LATB2 0x04
432 #define _LATB3 0x08
433 #define _LATB4 0x10
434 #define _LATB5 0x20
435 #define _LATB6 0x40
436 #define _LATB7 0x80
438 //==============================================================================
441 //==============================================================================
442 // LATC Bits
444 extern __at(0x0F8B) __sfr LATC;
446 typedef struct
448 unsigned LATC0 : 1;
449 unsigned LATC1 : 1;
450 unsigned LATC2 : 1;
451 unsigned LATC3 : 1;
452 unsigned LATC4 : 1;
453 unsigned LATC5 : 1;
454 unsigned LATC6 : 1;
455 unsigned LATC7 : 1;
456 } __LATCbits_t;
458 extern __at(0x0F8B) volatile __LATCbits_t LATCbits;
460 #define _LATC0 0x01
461 #define _LATC1 0x02
462 #define _LATC2 0x04
463 #define _LATC3 0x08
464 #define _LATC4 0x10
465 #define _LATC5 0x20
466 #define _LATC6 0x40
467 #define _LATC7 0x80
469 //==============================================================================
472 //==============================================================================
473 // LATD Bits
475 extern __at(0x0F8C) __sfr LATD;
477 typedef struct
479 unsigned LATD0 : 1;
480 unsigned LATD1 : 1;
481 unsigned LATD2 : 1;
482 unsigned LATD3 : 1;
483 unsigned LATD4 : 1;
484 unsigned LATD5 : 1;
485 unsigned LATD6 : 1;
486 unsigned LATD7 : 1;
487 } __LATDbits_t;
489 extern __at(0x0F8C) volatile __LATDbits_t LATDbits;
491 #define _LATD0 0x01
492 #define _LATD1 0x02
493 #define _LATD2 0x04
494 #define _LATD3 0x08
495 #define _LATD4 0x10
496 #define _LATD5 0x20
497 #define _LATD6 0x40
498 #define _LATD7 0x80
500 //==============================================================================
503 //==============================================================================
504 // LATE Bits
506 extern __at(0x0F8D) __sfr LATE;
508 typedef struct
510 unsigned LATE0 : 1;
511 unsigned LATE1 : 1;
512 unsigned LATE2 : 1;
513 unsigned LATE3 : 1;
514 unsigned LATE4 : 1;
515 unsigned LATE5 : 1;
516 unsigned LATE6 : 1;
517 unsigned LATE7 : 1;
518 } __LATEbits_t;
520 extern __at(0x0F8D) volatile __LATEbits_t LATEbits;
522 #define _LATE0 0x01
523 #define _LATE1 0x02
524 #define _LATE2 0x04
525 #define _LATE3 0x08
526 #define _LATE4 0x10
527 #define _LATE5 0x20
528 #define _LATE6 0x40
529 #define _LATE7 0x80
531 //==============================================================================
534 //==============================================================================
535 // DDRA Bits
537 extern __at(0x0F92) __sfr DDRA;
539 typedef union
541 struct
543 unsigned TRISA0 : 1;
544 unsigned TRISA1 : 1;
545 unsigned TRISA2 : 1;
546 unsigned TRISA3 : 1;
547 unsigned TRISA4 : 1;
548 unsigned TRISA5 : 1;
549 unsigned TRISA6 : 1;
550 unsigned RA7 : 1;
553 struct
555 unsigned RA0 : 1;
556 unsigned RA1 : 1;
557 unsigned RA2 : 1;
558 unsigned RA3 : 1;
559 unsigned RA4 : 1;
560 unsigned RA5 : 1;
561 unsigned RA6 : 1;
562 unsigned : 1;
565 struct
567 unsigned TRISA : 7;
568 unsigned : 1;
570 } __DDRAbits_t;
572 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits;
574 #define _TRISA0 0x01
575 #define _RA0 0x01
576 #define _TRISA1 0x02
577 #define _RA1 0x02
578 #define _TRISA2 0x04
579 #define _RA2 0x04
580 #define _TRISA3 0x08
581 #define _RA3 0x08
582 #define _TRISA4 0x10
583 #define _RA4 0x10
584 #define _TRISA5 0x20
585 #define _RA5 0x20
586 #define _TRISA6 0x40
587 #define _RA6 0x40
588 #define _RA7 0x80
590 //==============================================================================
593 //==============================================================================
594 // TRISA Bits
596 extern __at(0x0F92) __sfr TRISA;
598 typedef union
600 struct
602 unsigned TRISA0 : 1;
603 unsigned TRISA1 : 1;
604 unsigned TRISA2 : 1;
605 unsigned TRISA3 : 1;
606 unsigned TRISA4 : 1;
607 unsigned TRISA5 : 1;
608 unsigned TRISA6 : 1;
609 unsigned RA7 : 1;
612 struct
614 unsigned RA0 : 1;
615 unsigned RA1 : 1;
616 unsigned RA2 : 1;
617 unsigned RA3 : 1;
618 unsigned RA4 : 1;
619 unsigned RA5 : 1;
620 unsigned RA6 : 1;
621 unsigned : 1;
624 struct
626 unsigned TRISA : 7;
627 unsigned : 1;
629 } __TRISAbits_t;
631 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits;
633 #define _TRISA_TRISA0 0x01
634 #define _TRISA_RA0 0x01
635 #define _TRISA_TRISA1 0x02
636 #define _TRISA_RA1 0x02
637 #define _TRISA_TRISA2 0x04
638 #define _TRISA_RA2 0x04
639 #define _TRISA_TRISA3 0x08
640 #define _TRISA_RA3 0x08
641 #define _TRISA_TRISA4 0x10
642 #define _TRISA_RA4 0x10
643 #define _TRISA_TRISA5 0x20
644 #define _TRISA_RA5 0x20
645 #define _TRISA_TRISA6 0x40
646 #define _TRISA_RA6 0x40
647 #define _TRISA_RA7 0x80
649 //==============================================================================
652 //==============================================================================
653 // DDRB Bits
655 extern __at(0x0F93) __sfr DDRB;
657 typedef union
659 struct
661 unsigned TRISB0 : 1;
662 unsigned TRISB1 : 1;
663 unsigned TRISB2 : 1;
664 unsigned TRISB3 : 1;
665 unsigned TRISB4 : 1;
666 unsigned TRISB5 : 1;
667 unsigned TRISB6 : 1;
668 unsigned TRISB7 : 1;
671 struct
673 unsigned RB0 : 1;
674 unsigned RB1 : 1;
675 unsigned RB2 : 1;
676 unsigned RB3 : 1;
677 unsigned RB4 : 1;
678 unsigned RB5 : 1;
679 unsigned RB6 : 1;
680 unsigned RB7 : 1;
682 } __DDRBbits_t;
684 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits;
686 #define _TRISB0 0x01
687 #define _RB0 0x01
688 #define _TRISB1 0x02
689 #define _RB1 0x02
690 #define _TRISB2 0x04
691 #define _RB2 0x04
692 #define _TRISB3 0x08
693 #define _RB3 0x08
694 #define _TRISB4 0x10
695 #define _RB4 0x10
696 #define _TRISB5 0x20
697 #define _RB5 0x20
698 #define _TRISB6 0x40
699 #define _RB6 0x40
700 #define _TRISB7 0x80
701 #define _RB7 0x80
703 //==============================================================================
706 //==============================================================================
707 // TRISB Bits
709 extern __at(0x0F93) __sfr TRISB;
711 typedef union
713 struct
715 unsigned TRISB0 : 1;
716 unsigned TRISB1 : 1;
717 unsigned TRISB2 : 1;
718 unsigned TRISB3 : 1;
719 unsigned TRISB4 : 1;
720 unsigned TRISB5 : 1;
721 unsigned TRISB6 : 1;
722 unsigned TRISB7 : 1;
725 struct
727 unsigned RB0 : 1;
728 unsigned RB1 : 1;
729 unsigned RB2 : 1;
730 unsigned RB3 : 1;
731 unsigned RB4 : 1;
732 unsigned RB5 : 1;
733 unsigned RB6 : 1;
734 unsigned RB7 : 1;
736 } __TRISBbits_t;
738 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits;
740 #define _TRISB_TRISB0 0x01
741 #define _TRISB_RB0 0x01
742 #define _TRISB_TRISB1 0x02
743 #define _TRISB_RB1 0x02
744 #define _TRISB_TRISB2 0x04
745 #define _TRISB_RB2 0x04
746 #define _TRISB_TRISB3 0x08
747 #define _TRISB_RB3 0x08
748 #define _TRISB_TRISB4 0x10
749 #define _TRISB_RB4 0x10
750 #define _TRISB_TRISB5 0x20
751 #define _TRISB_RB5 0x20
752 #define _TRISB_TRISB6 0x40
753 #define _TRISB_RB6 0x40
754 #define _TRISB_TRISB7 0x80
755 #define _TRISB_RB7 0x80
757 //==============================================================================
760 //==============================================================================
761 // DDRC Bits
763 extern __at(0x0F94) __sfr DDRC;
765 typedef union
767 struct
769 unsigned TRISC0 : 1;
770 unsigned RC1 : 1;
771 unsigned RC2 : 1;
772 unsigned TRISC3 : 1;
773 unsigned TRISC4 : 1;
774 unsigned TRISC5 : 1;
775 unsigned TRISC6 : 1;
776 unsigned TRISC7 : 1;
779 struct
781 unsigned RC0 : 1;
782 unsigned : 1;
783 unsigned : 1;
784 unsigned RC3 : 1;
785 unsigned RC4 : 1;
786 unsigned RC5 : 1;
787 unsigned RC6 : 1;
788 unsigned RC7 : 1;
790 } __DDRCbits_t;
792 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits;
794 #define _TRISC0 0x01
795 #define _RC0 0x01
796 #define _RC1 0x02
797 #define _RC2 0x04
798 #define _TRISC3 0x08
799 #define _RC3 0x08
800 #define _TRISC4 0x10
801 #define _RC4 0x10
802 #define _TRISC5 0x20
803 #define _RC5 0x20
804 #define _TRISC6 0x40
805 #define _RC6 0x40
806 #define _TRISC7 0x80
807 #define _RC7 0x80
809 //==============================================================================
812 //==============================================================================
813 // TRISC Bits
815 extern __at(0x0F94) __sfr TRISC;
817 typedef union
819 struct
821 unsigned TRISC0 : 1;
822 unsigned RC1 : 1;
823 unsigned RC2 : 1;
824 unsigned TRISC3 : 1;
825 unsigned TRISC4 : 1;
826 unsigned TRISC5 : 1;
827 unsigned TRISC6 : 1;
828 unsigned TRISC7 : 1;
831 struct
833 unsigned RC0 : 1;
834 unsigned : 1;
835 unsigned : 1;
836 unsigned RC3 : 1;
837 unsigned RC4 : 1;
838 unsigned RC5 : 1;
839 unsigned RC6 : 1;
840 unsigned RC7 : 1;
842 } __TRISCbits_t;
844 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits;
846 #define _TRISC_TRISC0 0x01
847 #define _TRISC_RC0 0x01
848 #define _TRISC_RC1 0x02
849 #define _TRISC_RC2 0x04
850 #define _TRISC_TRISC3 0x08
851 #define _TRISC_RC3 0x08
852 #define _TRISC_TRISC4 0x10
853 #define _TRISC_RC4 0x10
854 #define _TRISC_TRISC5 0x20
855 #define _TRISC_RC5 0x20
856 #define _TRISC_TRISC6 0x40
857 #define _TRISC_RC6 0x40
858 #define _TRISC_TRISC7 0x80
859 #define _TRISC_RC7 0x80
861 //==============================================================================
864 //==============================================================================
865 // DDRD Bits
867 extern __at(0x0F95) __sfr DDRD;
869 typedef union
871 struct
873 unsigned TRISD0 : 1;
874 unsigned TRISD1 : 1;
875 unsigned TRISD2 : 1;
876 unsigned TRISD3 : 1;
877 unsigned TRISD4 : 1;
878 unsigned TRISD5 : 1;
879 unsigned TRISD6 : 1;
880 unsigned TRISD7 : 1;
883 struct
885 unsigned RD0 : 1;
886 unsigned RD1 : 1;
887 unsigned RD2 : 1;
888 unsigned RD3 : 1;
889 unsigned RD4 : 1;
890 unsigned RD5 : 1;
891 unsigned RD6 : 1;
892 unsigned RD7 : 1;
894 } __DDRDbits_t;
896 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits;
898 #define _TRISD0 0x01
899 #define _RD0 0x01
900 #define _TRISD1 0x02
901 #define _RD1 0x02
902 #define _TRISD2 0x04
903 #define _RD2 0x04
904 #define _TRISD3 0x08
905 #define _RD3 0x08
906 #define _TRISD4 0x10
907 #define _RD4 0x10
908 #define _TRISD5 0x20
909 #define _RD5 0x20
910 #define _TRISD6 0x40
911 #define _RD6 0x40
912 #define _TRISD7 0x80
913 #define _RD7 0x80
915 //==============================================================================
918 //==============================================================================
919 // TRISD Bits
921 extern __at(0x0F95) __sfr TRISD;
923 typedef union
925 struct
927 unsigned TRISD0 : 1;
928 unsigned TRISD1 : 1;
929 unsigned TRISD2 : 1;
930 unsigned TRISD3 : 1;
931 unsigned TRISD4 : 1;
932 unsigned TRISD5 : 1;
933 unsigned TRISD6 : 1;
934 unsigned TRISD7 : 1;
937 struct
939 unsigned RD0 : 1;
940 unsigned RD1 : 1;
941 unsigned RD2 : 1;
942 unsigned RD3 : 1;
943 unsigned RD4 : 1;
944 unsigned RD5 : 1;
945 unsigned RD6 : 1;
946 unsigned RD7 : 1;
948 } __TRISDbits_t;
950 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits;
952 #define _TRISD_TRISD0 0x01
953 #define _TRISD_RD0 0x01
954 #define _TRISD_TRISD1 0x02
955 #define _TRISD_RD1 0x02
956 #define _TRISD_TRISD2 0x04
957 #define _TRISD_RD2 0x04
958 #define _TRISD_TRISD3 0x08
959 #define _TRISD_RD3 0x08
960 #define _TRISD_TRISD4 0x10
961 #define _TRISD_RD4 0x10
962 #define _TRISD_TRISD5 0x20
963 #define _TRISD_RD5 0x20
964 #define _TRISD_TRISD6 0x40
965 #define _TRISD_RD6 0x40
966 #define _TRISD_TRISD7 0x80
967 #define _TRISD_RD7 0x80
969 //==============================================================================
972 //==============================================================================
973 // DDRE Bits
975 extern __at(0x0F96) __sfr DDRE;
977 typedef union
979 struct
981 unsigned TRISE0 : 1;
982 unsigned TRISE1 : 1;
983 unsigned TRISE2 : 1;
984 unsigned RE3 : 1;
985 unsigned PSPMODE : 1;
986 unsigned IBOV : 1;
987 unsigned OBF : 1;
988 unsigned IBF : 1;
991 struct
993 unsigned RE0 : 1;
994 unsigned RE1 : 1;
995 unsigned RE2 : 1;
996 unsigned : 1;
997 unsigned RE4 : 1;
998 unsigned RE5 : 1;
999 unsigned RE6 : 1;
1000 unsigned RE7 : 1;
1003 struct
1005 unsigned TRISE : 3;
1006 unsigned : 5;
1008 } __DDREbits_t;
1010 extern __at(0x0F96) volatile __DDREbits_t DDREbits;
1012 #define _TRISE0 0x01
1013 #define _RE0 0x01
1014 #define _TRISE1 0x02
1015 #define _RE1 0x02
1016 #define _TRISE2 0x04
1017 #define _RE2 0x04
1018 #define _RE3 0x08
1019 #define _PSPMODE 0x10
1020 #define _RE4 0x10
1021 #define _IBOV 0x20
1022 #define _RE5 0x20
1023 #define _OBF 0x40
1024 #define _RE6 0x40
1025 #define _IBF 0x80
1026 #define _RE7 0x80
1028 //==============================================================================
1031 //==============================================================================
1032 // TRISE Bits
1034 extern __at(0x0F96) __sfr TRISE;
1036 typedef union
1038 struct
1040 unsigned TRISE0 : 1;
1041 unsigned TRISE1 : 1;
1042 unsigned TRISE2 : 1;
1043 unsigned RE3 : 1;
1044 unsigned PSPMODE : 1;
1045 unsigned IBOV : 1;
1046 unsigned OBF : 1;
1047 unsigned IBF : 1;
1050 struct
1052 unsigned RE0 : 1;
1053 unsigned RE1 : 1;
1054 unsigned RE2 : 1;
1055 unsigned : 1;
1056 unsigned RE4 : 1;
1057 unsigned RE5 : 1;
1058 unsigned RE6 : 1;
1059 unsigned RE7 : 1;
1062 struct
1064 unsigned TRISE : 3;
1065 unsigned : 5;
1067 } __TRISEbits_t;
1069 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits;
1071 #define _TRISE_TRISE0 0x01
1072 #define _TRISE_RE0 0x01
1073 #define _TRISE_TRISE1 0x02
1074 #define _TRISE_RE1 0x02
1075 #define _TRISE_TRISE2 0x04
1076 #define _TRISE_RE2 0x04
1077 #define _TRISE_RE3 0x08
1078 #define _TRISE_PSPMODE 0x10
1079 #define _TRISE_RE4 0x10
1080 #define _TRISE_IBOV 0x20
1081 #define _TRISE_RE5 0x20
1082 #define _TRISE_OBF 0x40
1083 #define _TRISE_RE6 0x40
1084 #define _TRISE_IBF 0x80
1085 #define _TRISE_RE7 0x80
1087 //==============================================================================
1090 //==============================================================================
1091 // PIE1 Bits
1093 extern __at(0x0F9D) __sfr PIE1;
1095 typedef struct
1097 unsigned TMR1IE : 1;
1098 unsigned TMR2IE : 1;
1099 unsigned CCP1IE : 1;
1100 unsigned SSPIE : 1;
1101 unsigned TXIE : 1;
1102 unsigned RCIE : 1;
1103 unsigned ADIE : 1;
1104 unsigned PSPIE : 1;
1105 } __PIE1bits_t;
1107 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits;
1109 #define _TMR1IE 0x01
1110 #define _TMR2IE 0x02
1111 #define _CCP1IE 0x04
1112 #define _SSPIE 0x08
1113 #define _TXIE 0x10
1114 #define _RCIE 0x20
1115 #define _ADIE 0x40
1116 #define _PSPIE 0x80
1118 //==============================================================================
1121 //==============================================================================
1122 // PIR1 Bits
1124 extern __at(0x0F9E) __sfr PIR1;
1126 typedef struct
1128 unsigned TMR1IF : 1;
1129 unsigned TMR2IF : 1;
1130 unsigned CCP1IF : 1;
1131 unsigned SSPIF : 1;
1132 unsigned TXIF : 1;
1133 unsigned RCIF : 1;
1134 unsigned ADIF : 1;
1135 unsigned PSPIF : 1;
1136 } __PIR1bits_t;
1138 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits;
1140 #define _TMR1IF 0x01
1141 #define _TMR2IF 0x02
1142 #define _CCP1IF 0x04
1143 #define _SSPIF 0x08
1144 #define _TXIF 0x10
1145 #define _RCIF 0x20
1146 #define _ADIF 0x40
1147 #define _PSPIF 0x80
1149 //==============================================================================
1152 //==============================================================================
1153 // IPR1 Bits
1155 extern __at(0x0F9F) __sfr IPR1;
1157 typedef struct
1159 unsigned TMR1IP : 1;
1160 unsigned TMR2IP : 1;
1161 unsigned CCP1IP : 1;
1162 unsigned SSPIP : 1;
1163 unsigned TXIP : 1;
1164 unsigned RCIP : 1;
1165 unsigned ADIP : 1;
1166 unsigned PSPIP : 1;
1167 } __IPR1bits_t;
1169 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits;
1171 #define _TMR1IP 0x01
1172 #define _TMR2IP 0x02
1173 #define _CCP1IP 0x04
1174 #define _SSPIP 0x08
1175 #define _TXIP 0x10
1176 #define _RCIP 0x20
1177 #define _ADIP 0x40
1178 #define _PSPIP 0x80
1180 //==============================================================================
1183 //==============================================================================
1184 // PIE2 Bits
1186 extern __at(0x0FA0) __sfr PIE2;
1188 typedef struct
1190 unsigned CCP2IE : 1;
1191 unsigned TMR3IE : 1;
1192 unsigned LVDIE : 1;
1193 unsigned BCLIE : 1;
1194 unsigned EEIE : 1;
1195 unsigned : 1;
1196 unsigned : 1;
1197 unsigned : 1;
1198 } __PIE2bits_t;
1200 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits;
1202 #define _CCP2IE 0x01
1203 #define _TMR3IE 0x02
1204 #define _LVDIE 0x04
1205 #define _BCLIE 0x08
1206 #define _EEIE 0x10
1208 //==============================================================================
1211 //==============================================================================
1212 // PIR2 Bits
1214 extern __at(0x0FA1) __sfr PIR2;
1216 typedef struct
1218 unsigned CCP2IF : 1;
1219 unsigned TMR3IF : 1;
1220 unsigned LVDIF : 1;
1221 unsigned BCLIF : 1;
1222 unsigned EEIF : 1;
1223 unsigned : 1;
1224 unsigned : 1;
1225 unsigned : 1;
1226 } __PIR2bits_t;
1228 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits;
1230 #define _CCP2IF 0x01
1231 #define _TMR3IF 0x02
1232 #define _LVDIF 0x04
1233 #define _BCLIF 0x08
1234 #define _EEIF 0x10
1236 //==============================================================================
1239 //==============================================================================
1240 // IPR2 Bits
1242 extern __at(0x0FA2) __sfr IPR2;
1244 typedef struct
1246 unsigned CCP2IP : 1;
1247 unsigned TMR3IP : 1;
1248 unsigned LVDIP : 1;
1249 unsigned BCLIP : 1;
1250 unsigned EEIP : 1;
1251 unsigned : 1;
1252 unsigned : 1;
1253 unsigned : 1;
1254 } __IPR2bits_t;
1256 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits;
1258 #define _CCP2IP 0x01
1259 #define _TMR3IP 0x02
1260 #define _LVDIP 0x04
1261 #define _BCLIP 0x08
1262 #define _EEIP 0x10
1264 //==============================================================================
1267 //==============================================================================
1268 // EECON1 Bits
1270 extern __at(0x0FA6) __sfr EECON1;
1272 typedef struct
1274 unsigned RD : 1;
1275 unsigned WR : 1;
1276 unsigned WREN : 1;
1277 unsigned WRERR : 1;
1278 unsigned FREE : 1;
1279 unsigned : 1;
1280 unsigned CFGS : 1;
1281 unsigned EEPGD : 1;
1282 } __EECON1bits_t;
1284 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits;
1286 #define _RD 0x01
1287 #define _WR 0x02
1288 #define _WREN 0x04
1289 #define _WRERR 0x08
1290 #define _FREE 0x10
1291 #define _CFGS 0x40
1292 #define _EEPGD 0x80
1294 //==============================================================================
1296 extern __at(0x0FA7) __sfr EECON2;
1297 extern __at(0x0FA8) __sfr EEDATA;
1298 extern __at(0x0FA9) __sfr EEADR;
1300 //==============================================================================
1301 // RCSTA Bits
1303 extern __at(0x0FAB) __sfr RCSTA;
1305 typedef struct
1307 unsigned RX9D : 1;
1308 unsigned OERR : 1;
1309 unsigned FERR : 1;
1310 unsigned ADDEN : 1;
1311 unsigned CREN : 1;
1312 unsigned SREN : 1;
1313 unsigned RX9 : 1;
1314 unsigned SPEN : 1;
1315 } __RCSTAbits_t;
1317 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits;
1319 #define _RX9D 0x01
1320 #define _OERR 0x02
1321 #define _FERR 0x04
1322 #define _ADDEN 0x08
1323 #define _CREN 0x10
1324 #define _SREN 0x20
1325 #define _RX9 0x40
1326 #define _SPEN 0x80
1328 //==============================================================================
1331 //==============================================================================
1332 // TXSTA Bits
1334 extern __at(0x0FAC) __sfr TXSTA;
1336 typedef struct
1338 unsigned TX9D : 1;
1339 unsigned TRMT : 1;
1340 unsigned BRGH : 1;
1341 unsigned : 1;
1342 unsigned SYNC : 1;
1343 unsigned TXEN : 1;
1344 unsigned TX9 : 1;
1345 unsigned CSRC : 1;
1346 } __TXSTAbits_t;
1348 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits;
1350 #define _TX9D 0x01
1351 #define _TRMT 0x02
1352 #define _BRGH 0x04
1353 #define _SYNC 0x10
1354 #define _TXEN 0x20
1355 #define _TX9 0x40
1356 #define _CSRC 0x80
1358 //==============================================================================
1360 extern __at(0x0FAD) __sfr TXREG;
1361 extern __at(0x0FAE) __sfr RCREG;
1362 extern __at(0x0FAF) __sfr SPBRG;
1364 //==============================================================================
1365 // T3CON Bits
1367 extern __at(0x0FB1) __sfr T3CON;
1369 typedef union
1371 struct
1373 unsigned TMR3ON : 1;
1374 unsigned TMR3CS : 1;
1375 unsigned NOT_T3SYNC : 1;
1376 unsigned T3CCP1 : 1;
1377 unsigned T3CKPS0 : 1;
1378 unsigned T3CKPS1 : 1;
1379 unsigned T3CCP2 : 1;
1380 unsigned RD16 : 1;
1383 struct
1385 unsigned : 1;
1386 unsigned : 1;
1387 unsigned T3SYNC : 1;
1388 unsigned : 1;
1389 unsigned : 1;
1390 unsigned : 1;
1391 unsigned : 1;
1392 unsigned : 1;
1395 struct
1397 unsigned : 4;
1398 unsigned T3CKPS : 2;
1399 unsigned : 2;
1401 } __T3CONbits_t;
1403 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits;
1405 #define _T3CON_TMR3ON 0x01
1406 #define _T3CON_TMR3CS 0x02
1407 #define _T3CON_NOT_T3SYNC 0x04
1408 #define _T3CON_T3SYNC 0x04
1409 #define _T3CON_T3CCP1 0x08
1410 #define _T3CON_T3CKPS0 0x10
1411 #define _T3CON_T3CKPS1 0x20
1412 #define _T3CON_T3CCP2 0x40
1413 #define _T3CON_RD16 0x80
1415 //==============================================================================
1417 extern __at(0x0FB2) __sfr TMR3;
1418 extern __at(0x0FB2) __sfr TMR3L;
1419 extern __at(0x0FB3) __sfr TMR3H;
1421 //==============================================================================
1422 // CCP2CON Bits
1424 extern __at(0x0FBA) __sfr CCP2CON;
1426 typedef union
1428 struct
1430 unsigned CCP2M0 : 1;
1431 unsigned CCP2M1 : 1;
1432 unsigned CCP2M2 : 1;
1433 unsigned CCP2M3 : 1;
1434 unsigned CCP2Y : 1;
1435 unsigned CCP2X : 1;
1436 unsigned : 1;
1437 unsigned : 1;
1440 struct
1442 unsigned : 1;
1443 unsigned : 1;
1444 unsigned : 1;
1445 unsigned : 1;
1446 unsigned DC2B0 : 1;
1447 unsigned DC2B1 : 1;
1448 unsigned : 1;
1449 unsigned : 1;
1452 struct
1454 unsigned : 1;
1455 unsigned : 1;
1456 unsigned : 1;
1457 unsigned : 1;
1458 unsigned : 1;
1459 unsigned DCCPX : 1;
1460 unsigned : 1;
1461 unsigned : 1;
1464 struct
1466 unsigned CCP2M : 4;
1467 unsigned : 4;
1470 struct
1472 unsigned : 4;
1473 unsigned DC2B : 2;
1474 unsigned : 2;
1476 } __CCP2CONbits_t;
1478 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits;
1480 #define _CCP2M0 0x01
1481 #define _CCP2M1 0x02
1482 #define _CCP2M2 0x04
1483 #define _CCP2M3 0x08
1484 #define _CCP2Y 0x10
1485 #define _DC2B0 0x10
1486 #define _CCP2X 0x20
1487 #define _DC2B1 0x20
1488 #define _DCCPX 0x20
1490 //==============================================================================
1492 extern __at(0x0FBB) __sfr CCPR2;
1493 extern __at(0x0FBB) __sfr CCPR2L;
1494 extern __at(0x0FBC) __sfr CCPR2H;
1496 //==============================================================================
1497 // CCP1CON Bits
1499 extern __at(0x0FBD) __sfr CCP1CON;
1501 typedef union
1503 struct
1505 unsigned CCP1M0 : 1;
1506 unsigned CCP1M1 : 1;
1507 unsigned CCP1M2 : 1;
1508 unsigned CCP1M3 : 1;
1509 unsigned CCP1Y : 1;
1510 unsigned CCP1X : 1;
1511 unsigned : 1;
1512 unsigned : 1;
1515 struct
1517 unsigned : 1;
1518 unsigned : 1;
1519 unsigned : 1;
1520 unsigned : 1;
1521 unsigned DC1B0 : 1;
1522 unsigned DC1B1 : 1;
1523 unsigned : 1;
1524 unsigned : 1;
1527 struct
1529 unsigned CCP1M : 4;
1530 unsigned : 4;
1533 struct
1535 unsigned : 4;
1536 unsigned DC1B : 2;
1537 unsigned : 2;
1539 } __CCP1CONbits_t;
1541 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits;
1543 #define _CCP1M0 0x01
1544 #define _CCP1M1 0x02
1545 #define _CCP1M2 0x04
1546 #define _CCP1M3 0x08
1547 #define _CCP1Y 0x10
1548 #define _DC1B0 0x10
1549 #define _CCP1X 0x20
1550 #define _DC1B1 0x20
1552 //==============================================================================
1554 extern __at(0x0FBE) __sfr CCPR1;
1555 extern __at(0x0FBE) __sfr CCPR1L;
1556 extern __at(0x0FBF) __sfr CCPR1H;
1558 //==============================================================================
1559 // ADCON1 Bits
1561 extern __at(0x0FC1) __sfr ADCON1;
1563 typedef union
1565 struct
1567 unsigned PCFG0 : 1;
1568 unsigned PCFG1 : 1;
1569 unsigned PCFG2 : 1;
1570 unsigned PCFG3 : 1;
1571 unsigned : 1;
1572 unsigned : 1;
1573 unsigned ADCS2 : 1;
1574 unsigned ADFM : 1;
1577 struct
1579 unsigned PCFG : 4;
1580 unsigned : 4;
1582 } __ADCON1bits_t;
1584 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits;
1586 #define _PCFG0 0x01
1587 #define _PCFG1 0x02
1588 #define _PCFG2 0x04
1589 #define _PCFG3 0x08
1590 #define _ADCS2 0x40
1591 #define _ADFM 0x80
1593 //==============================================================================
1596 //==============================================================================
1597 // ADCON0 Bits
1599 extern __at(0x0FC2) __sfr ADCON0;
1601 typedef union
1603 struct
1605 unsigned ADON : 1;
1606 unsigned : 1;
1607 unsigned GO_NOT_DONE : 1;
1608 unsigned CHS0 : 1;
1609 unsigned CHS1 : 1;
1610 unsigned CHS2 : 1;
1611 unsigned ADCS0 : 1;
1612 unsigned ADCS1 : 1;
1615 struct
1617 unsigned : 1;
1618 unsigned : 1;
1619 unsigned GO : 1;
1620 unsigned : 1;
1621 unsigned : 1;
1622 unsigned : 1;
1623 unsigned : 1;
1624 unsigned : 1;
1627 struct
1629 unsigned : 1;
1630 unsigned : 1;
1631 unsigned NOT_DONE : 1;
1632 unsigned : 1;
1633 unsigned : 1;
1634 unsigned : 1;
1635 unsigned : 1;
1636 unsigned : 1;
1639 struct
1641 unsigned : 1;
1642 unsigned : 1;
1643 unsigned DONE : 1;
1644 unsigned : 1;
1645 unsigned : 1;
1646 unsigned : 1;
1647 unsigned : 1;
1648 unsigned : 1;
1651 struct
1653 unsigned : 1;
1654 unsigned : 1;
1655 unsigned GO_DONE : 1;
1656 unsigned : 1;
1657 unsigned : 1;
1658 unsigned : 1;
1659 unsigned : 1;
1660 unsigned : 1;
1663 struct
1665 unsigned : 3;
1666 unsigned CHS : 3;
1667 unsigned : 2;
1670 struct
1672 unsigned : 6;
1673 unsigned ADCS : 2;
1675 } __ADCON0bits_t;
1677 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits;
1679 #define _ADON 0x01
1680 #define _GO_NOT_DONE 0x04
1681 #define _GO 0x04
1682 #define _NOT_DONE 0x04
1683 #define _DONE 0x04
1684 #define _GO_DONE 0x04
1685 #define _CHS0 0x08
1686 #define _CHS1 0x10
1687 #define _CHS2 0x20
1688 #define _ADCS0 0x40
1689 #define _ADCS1 0x80
1691 //==============================================================================
1693 extern __at(0x0FC3) __sfr ADRES;
1694 extern __at(0x0FC3) __sfr ADRESL;
1695 extern __at(0x0FC4) __sfr ADRESH;
1697 //==============================================================================
1698 // SSPCON2 Bits
1700 extern __at(0x0FC5) __sfr SSPCON2;
1702 typedef struct
1704 unsigned SEN : 1;
1705 unsigned RSEN : 1;
1706 unsigned PEN : 1;
1707 unsigned RCEN : 1;
1708 unsigned ACKEN : 1;
1709 unsigned ACKDT : 1;
1710 unsigned ACKSTAT : 1;
1711 unsigned GCEN : 1;
1712 } __SSPCON2bits_t;
1714 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits;
1716 #define _SEN 0x01
1717 #define _RSEN 0x02
1718 #define _PEN 0x04
1719 #define _RCEN 0x08
1720 #define _ACKEN 0x10
1721 #define _ACKDT 0x20
1722 #define _ACKSTAT 0x40
1723 #define _GCEN 0x80
1725 //==============================================================================
1728 //==============================================================================
1729 // SSPCON1 Bits
1731 extern __at(0x0FC6) __sfr SSPCON1;
1733 typedef union
1735 struct
1737 unsigned SSPM0 : 1;
1738 unsigned SSPM1 : 1;
1739 unsigned SSPM2 : 1;
1740 unsigned SSPM3 : 1;
1741 unsigned CKP : 1;
1742 unsigned SSPEN : 1;
1743 unsigned SSPOV : 1;
1744 unsigned WCOL : 1;
1747 struct
1749 unsigned SSPM : 4;
1750 unsigned : 4;
1752 } __SSPCON1bits_t;
1754 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits;
1756 #define _SSPM0 0x01
1757 #define _SSPM1 0x02
1758 #define _SSPM2 0x04
1759 #define _SSPM3 0x08
1760 #define _CKP 0x10
1761 #define _SSPEN 0x20
1762 #define _SSPOV 0x40
1763 #define _WCOL 0x80
1765 //==============================================================================
1768 //==============================================================================
1769 // SSPSTAT Bits
1771 extern __at(0x0FC7) __sfr SSPSTAT;
1773 typedef union
1775 struct
1777 unsigned BF : 1;
1778 unsigned UA : 1;
1779 unsigned R_NOT_W : 1;
1780 unsigned S : 1;
1781 unsigned P : 1;
1782 unsigned D_NOT_A : 1;
1783 unsigned CKE : 1;
1784 unsigned SMP : 1;
1787 struct
1789 unsigned : 1;
1790 unsigned : 1;
1791 unsigned R_W : 1;
1792 unsigned : 1;
1793 unsigned : 1;
1794 unsigned D_A : 1;
1795 unsigned : 1;
1796 unsigned : 1;
1798 } __SSPSTATbits_t;
1800 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits;
1802 #define _BF 0x01
1803 #define _UA 0x02
1804 #define _R_NOT_W 0x04
1805 #define _R_W 0x04
1806 #define _S 0x08
1807 #define _P 0x10
1808 #define _D_NOT_A 0x20
1809 #define _D_A 0x20
1810 #define _CKE 0x40
1811 #define _SMP 0x80
1813 //==============================================================================
1815 extern __at(0x0FC8) __sfr SSPADD;
1816 extern __at(0x0FC9) __sfr SSPBUF;
1818 //==============================================================================
1819 // T2CON Bits
1821 extern __at(0x0FCA) __sfr T2CON;
1823 typedef union
1825 struct
1827 unsigned T2CKPS0 : 1;
1828 unsigned T2CKPS1 : 1;
1829 unsigned TMR2ON : 1;
1830 unsigned TOUTPS0 : 1;
1831 unsigned TOUTPS1 : 1;
1832 unsigned TOUTPS2 : 1;
1833 unsigned TOUTPS3 : 1;
1834 unsigned : 1;
1837 struct
1839 unsigned T2CKPS : 2;
1840 unsigned : 6;
1843 struct
1845 unsigned : 3;
1846 unsigned TOUTPS : 4;
1847 unsigned : 1;
1849 } __T2CONbits_t;
1851 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits;
1853 #define _T2CKPS0 0x01
1854 #define _T2CKPS1 0x02
1855 #define _TMR2ON 0x04
1856 #define _TOUTPS0 0x08
1857 #define _TOUTPS1 0x10
1858 #define _TOUTPS2 0x20
1859 #define _TOUTPS3 0x40
1861 //==============================================================================
1863 extern __at(0x0FCB) __sfr PR2;
1864 extern __at(0x0FCC) __sfr TMR2;
1866 //==============================================================================
1867 // T1CON Bits
1869 extern __at(0x0FCD) __sfr T1CON;
1871 typedef union
1873 struct
1875 unsigned TMR1ON : 1;
1876 unsigned TMR1CS : 1;
1877 unsigned NOT_T1SYNC : 1;
1878 unsigned T1OSCEN : 1;
1879 unsigned T1CKPS0 : 1;
1880 unsigned T1CKPS1 : 1;
1881 unsigned : 1;
1882 unsigned RD16 : 1;
1885 struct
1887 unsigned : 1;
1888 unsigned : 1;
1889 unsigned T1SYNC : 1;
1890 unsigned : 1;
1891 unsigned : 1;
1892 unsigned : 1;
1893 unsigned : 1;
1894 unsigned T1RD16 : 1;
1897 struct
1899 unsigned : 4;
1900 unsigned T1CKPS : 2;
1901 unsigned : 2;
1903 } __T1CONbits_t;
1905 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits;
1907 #define _TMR1ON 0x01
1908 #define _TMR1CS 0x02
1909 #define _NOT_T1SYNC 0x04
1910 #define _T1SYNC 0x04
1911 #define _T1OSCEN 0x08
1912 #define _T1CKPS0 0x10
1913 #define _T1CKPS1 0x20
1914 #define _RD16 0x80
1915 #define _T1RD16 0x80
1917 //==============================================================================
1919 extern __at(0x0FCE) __sfr TMR1;
1920 extern __at(0x0FCE) __sfr TMR1L;
1921 extern __at(0x0FCF) __sfr TMR1H;
1923 //==============================================================================
1924 // RCON Bits
1926 extern __at(0x0FD0) __sfr RCON;
1928 typedef union
1930 struct
1932 unsigned NOT_BOR : 1;
1933 unsigned NOT_POR : 1;
1934 unsigned NOT_PD : 1;
1935 unsigned NOT_TO : 1;
1936 unsigned NOT_RI : 1;
1937 unsigned : 1;
1938 unsigned : 1;
1939 unsigned IPEN : 1;
1942 struct
1944 unsigned BOR : 1;
1945 unsigned POR : 1;
1946 unsigned PD : 1;
1947 unsigned TO : 1;
1948 unsigned RI : 1;
1949 unsigned : 1;
1950 unsigned : 1;
1951 unsigned NOT_IPEN : 1;
1953 } __RCONbits_t;
1955 extern __at(0x0FD0) volatile __RCONbits_t RCONbits;
1957 #define _NOT_BOR 0x01
1958 #define _BOR 0x01
1959 #define _NOT_POR 0x02
1960 #define _POR 0x02
1961 #define _NOT_PD 0x04
1962 #define _PD 0x04
1963 #define _NOT_TO 0x08
1964 #define _TO 0x08
1965 #define _NOT_RI 0x10
1966 #define _RI 0x10
1967 #define _IPEN 0x80
1968 #define _NOT_IPEN 0x80
1970 //==============================================================================
1973 //==============================================================================
1974 // WDTCON Bits
1976 extern __at(0x0FD1) __sfr WDTCON;
1978 typedef union
1980 struct
1982 unsigned SWDTEN : 1;
1983 unsigned : 1;
1984 unsigned : 1;
1985 unsigned : 1;
1986 unsigned : 1;
1987 unsigned : 1;
1988 unsigned : 1;
1989 unsigned : 1;
1992 struct
1994 unsigned SWDTE : 1;
1995 unsigned : 1;
1996 unsigned : 1;
1997 unsigned : 1;
1998 unsigned : 1;
1999 unsigned : 1;
2000 unsigned : 1;
2001 unsigned : 1;
2003 } __WDTCONbits_t;
2005 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits;
2007 #define _SWDTEN 0x01
2008 #define _SWDTE 0x01
2010 //==============================================================================
2013 //==============================================================================
2014 // LVDCON Bits
2016 extern __at(0x0FD2) __sfr LVDCON;
2018 typedef union
2020 struct
2022 unsigned LVDL0 : 1;
2023 unsigned LVDL1 : 1;
2024 unsigned LVDL2 : 1;
2025 unsigned LVDL3 : 1;
2026 unsigned LVDEN : 1;
2027 unsigned IRVST : 1;
2028 unsigned : 1;
2029 unsigned : 1;
2032 struct
2034 unsigned LVDL : 4;
2035 unsigned : 4;
2037 } __LVDCONbits_t;
2039 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits;
2041 #define _LVDL0 0x01
2042 #define _LVDL1 0x02
2043 #define _LVDL2 0x04
2044 #define _LVDL3 0x08
2045 #define _LVDEN 0x10
2046 #define _IRVST 0x20
2048 //==============================================================================
2051 //==============================================================================
2052 // OSCCON Bits
2054 extern __at(0x0FD3) __sfr OSCCON;
2056 typedef union
2058 struct
2060 unsigned RESERVED : 1;
2061 unsigned : 1;
2062 unsigned : 1;
2063 unsigned : 1;
2064 unsigned : 1;
2065 unsigned : 1;
2066 unsigned : 1;
2067 unsigned : 1;
2070 struct
2072 unsigned SCS : 1;
2073 unsigned : 1;
2074 unsigned : 1;
2075 unsigned : 1;
2076 unsigned : 1;
2077 unsigned : 1;
2078 unsigned : 1;
2079 unsigned : 1;
2081 } __OSCCONbits_t;
2083 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits;
2085 #define _RESERVED 0x01
2086 #define _SCS 0x01
2088 //==============================================================================
2091 //==============================================================================
2092 // T0CON Bits
2094 extern __at(0x0FD5) __sfr T0CON;
2096 typedef union
2098 struct
2100 unsigned T0PS0 : 1;
2101 unsigned T0PS1 : 1;
2102 unsigned T0PS2 : 1;
2103 unsigned PSA : 1;
2104 unsigned T0SE : 1;
2105 unsigned T0CS : 1;
2106 unsigned T08BIT : 1;
2107 unsigned TMR0ON : 1;
2110 struct
2112 unsigned T0PS : 3;
2113 unsigned : 5;
2115 } __T0CONbits_t;
2117 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits;
2119 #define _T0PS0 0x01
2120 #define _T0PS1 0x02
2121 #define _T0PS2 0x04
2122 #define _PSA 0x08
2123 #define _T0SE 0x10
2124 #define _T0CS 0x20
2125 #define _T08BIT 0x40
2126 #define _TMR0ON 0x80
2128 //==============================================================================
2130 extern __at(0x0FD6) __sfr TMR0;
2131 extern __at(0x0FD6) __sfr TMR0L;
2132 extern __at(0x0FD7) __sfr TMR0H;
2134 //==============================================================================
2135 // STATUS Bits
2137 extern __at(0x0FD8) __sfr STATUS;
2139 typedef struct
2141 unsigned C : 1;
2142 unsigned DC : 1;
2143 unsigned Z : 1;
2144 unsigned OV : 1;
2145 unsigned N : 1;
2146 unsigned : 1;
2147 unsigned : 1;
2148 unsigned : 1;
2149 } __STATUSbits_t;
2151 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits;
2153 #define _C 0x01
2154 #define _DC 0x02
2155 #define _Z 0x04
2156 #define _OV 0x08
2157 #define _N 0x10
2159 //==============================================================================
2161 extern __at(0x0FD9) __sfr FSR2L;
2162 extern __at(0x0FDA) __sfr FSR2H;
2163 extern __at(0x0FDB) __sfr PLUSW2;
2164 extern __at(0x0FDC) __sfr PREINC2;
2165 extern __at(0x0FDD) __sfr POSTDEC2;
2166 extern __at(0x0FDE) __sfr POSTINC2;
2167 extern __at(0x0FDF) __sfr INDF2;
2168 extern __at(0x0FE0) __sfr BSR;
2169 extern __at(0x0FE1) __sfr FSR1L;
2170 extern __at(0x0FE2) __sfr FSR1H;
2171 extern __at(0x0FE3) __sfr PLUSW1;
2172 extern __at(0x0FE4) __sfr PREINC1;
2173 extern __at(0x0FE5) __sfr POSTDEC1;
2174 extern __at(0x0FE6) __sfr POSTINC1;
2175 extern __at(0x0FE7) __sfr INDF1;
2176 extern __at(0x0FE8) __sfr WREG;
2177 extern __at(0x0FE9) __sfr FSR0L;
2178 extern __at(0x0FEA) __sfr FSR0H;
2179 extern __at(0x0FEB) __sfr PLUSW0;
2180 extern __at(0x0FEC) __sfr PREINC0;
2181 extern __at(0x0FED) __sfr POSTDEC0;
2182 extern __at(0x0FEE) __sfr POSTINC0;
2183 extern __at(0x0FEF) __sfr INDF0;
2185 //==============================================================================
2186 // INTCON3 Bits
2188 extern __at(0x0FF0) __sfr INTCON3;
2190 typedef union
2192 struct
2194 unsigned INT1IF : 1;
2195 unsigned INT2IF : 1;
2196 unsigned : 1;
2197 unsigned INT1IE : 1;
2198 unsigned INT2IE : 1;
2199 unsigned : 1;
2200 unsigned INT1IP : 1;
2201 unsigned INT2IP : 1;
2204 struct
2206 unsigned INT1F : 1;
2207 unsigned INT2F : 1;
2208 unsigned : 1;
2209 unsigned INT1E : 1;
2210 unsigned INT2E : 1;
2211 unsigned : 1;
2212 unsigned INT1P : 1;
2213 unsigned INT2P : 1;
2215 } __INTCON3bits_t;
2217 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits;
2219 #define _INT1IF 0x01
2220 #define _INT1F 0x01
2221 #define _INT2IF 0x02
2222 #define _INT2F 0x02
2223 #define _INT1IE 0x08
2224 #define _INT1E 0x08
2225 #define _INT2IE 0x10
2226 #define _INT2E 0x10
2227 #define _INT1IP 0x40
2228 #define _INT1P 0x40
2229 #define _INT2IP 0x80
2230 #define _INT2P 0x80
2232 //==============================================================================
2235 //==============================================================================
2236 // INTCON2 Bits
2238 extern __at(0x0FF1) __sfr INTCON2;
2240 typedef union
2242 struct
2244 unsigned RBIP : 1;
2245 unsigned INT3P : 1;
2246 unsigned TMR0IP : 1;
2247 unsigned INTEDG3 : 1;
2248 unsigned INTEDG2 : 1;
2249 unsigned INTEDG1 : 1;
2250 unsigned INTEDG0 : 1;
2251 unsigned NOT_RBPU : 1;
2254 struct
2256 unsigned : 1;
2257 unsigned : 1;
2258 unsigned T0IP : 1;
2259 unsigned : 1;
2260 unsigned : 1;
2261 unsigned : 1;
2262 unsigned : 1;
2263 unsigned RBPU : 1;
2265 } __INTCON2bits_t;
2267 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits;
2269 #define _RBIP 0x01
2270 #define _INT3P 0x02
2271 #define _TMR0IP 0x04
2272 #define _T0IP 0x04
2273 #define _INTEDG3 0x08
2274 #define _INTEDG2 0x10
2275 #define _INTEDG1 0x20
2276 #define _INTEDG0 0x40
2277 #define _NOT_RBPU 0x80
2278 #define _RBPU 0x80
2280 //==============================================================================
2283 //==============================================================================
2284 // INTCON Bits
2286 extern __at(0x0FF2) __sfr INTCON;
2288 typedef union
2290 struct
2292 unsigned RBIF : 1;
2293 unsigned INT0IF : 1;
2294 unsigned TMR0IF : 1;
2295 unsigned RBIE : 1;
2296 unsigned INT0IE : 1;
2297 unsigned TMR0IE : 1;
2298 unsigned PEIE_GIEL : 1;
2299 unsigned GIE_GIEH : 1;
2302 struct
2304 unsigned : 1;
2305 unsigned INT0F : 1;
2306 unsigned T0IF : 1;
2307 unsigned : 1;
2308 unsigned INT0E : 1;
2309 unsigned T0IE : 1;
2310 unsigned PEIE : 1;
2311 unsigned GIE : 1;
2314 struct
2316 unsigned : 1;
2317 unsigned : 1;
2318 unsigned : 1;
2319 unsigned : 1;
2320 unsigned : 1;
2321 unsigned : 1;
2322 unsigned GIEL : 1;
2323 unsigned GIEH : 1;
2325 } __INTCONbits_t;
2327 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits;
2329 #define _RBIF 0x01
2330 #define _INT0IF 0x02
2331 #define _INT0F 0x02
2332 #define _TMR0IF 0x04
2333 #define _T0IF 0x04
2334 #define _RBIE 0x08
2335 #define _INT0IE 0x10
2336 #define _INT0E 0x10
2337 #define _TMR0IE 0x20
2338 #define _T0IE 0x20
2339 #define _PEIE_GIEL 0x40
2340 #define _PEIE 0x40
2341 #define _GIEL 0x40
2342 #define _GIE_GIEH 0x80
2343 #define _GIE 0x80
2344 #define _GIEH 0x80
2346 //==============================================================================
2348 extern __at(0x0FF3) __sfr PROD;
2349 extern __at(0x0FF3) __sfr PRODL;
2350 extern __at(0x0FF4) __sfr PRODH;
2351 extern __at(0x0FF5) __sfr TABLAT;
2352 extern __at(0x0FF6) __sfr TBLPTR;
2353 extern __at(0x0FF6) __sfr TBLPTRL;
2354 extern __at(0x0FF7) __sfr TBLPTRH;
2355 extern __at(0x0FF8) __sfr TBLPTRU;
2356 extern __at(0x0FF9) __sfr PC;
2357 extern __at(0x0FF9) __sfr PCL;
2358 extern __at(0x0FFA) __sfr PCLATH;
2359 extern __at(0x0FFB) __sfr PCLATU;
2361 //==============================================================================
2362 // STKPTR Bits
2364 extern __at(0x0FFC) __sfr STKPTR;
2366 typedef union
2368 struct
2370 unsigned STKPTR0 : 1;
2371 unsigned STKPTR1 : 1;
2372 unsigned STKPTR2 : 1;
2373 unsigned STKPTR3 : 1;
2374 unsigned STKPTR4 : 1;
2375 unsigned : 1;
2376 unsigned STKUNF : 1;
2377 unsigned STKFUL : 1;
2380 struct
2382 unsigned STKPTR : 5;
2383 unsigned : 3;
2385 } __STKPTRbits_t;
2387 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits;
2389 #define _STKPTR0 0x01
2390 #define _STKPTR1 0x02
2391 #define _STKPTR2 0x04
2392 #define _STKPTR3 0x08
2393 #define _STKPTR4 0x10
2394 #define _STKUNF 0x40
2395 #define _STKFUL 0x80
2397 //==============================================================================
2399 extern __at(0x0FFD) __sfr TOS;
2400 extern __at(0x0FFD) __sfr TOSL;
2401 extern __at(0x0FFE) __sfr TOSH;
2402 extern __at(0x0FFF) __sfr TOSU;
2404 //==============================================================================
2406 // Configuration Bits
2408 //==============================================================================
2410 #define __CONFIG1H 0x300001
2411 #define __CONFIG2L 0x300002
2412 #define __CONFIG2H 0x300003
2413 #define __CONFIG4L 0x300006
2414 #define __CONFIG5L 0x300008
2415 #define __CONFIG5H 0x300009
2416 #define __CONFIG6L 0x30000A
2417 #define __CONFIG6H 0x30000B
2418 #define __CONFIG7L 0x30000C
2419 #define __CONFIG7H 0x30000D
2421 //----------------------------- CONFIG1H Options -------------------------------
2423 #define _OSC_HS_1H 0xFA // HS oscillator.
2424 #define _OSC_EC_1H 0xFC // EC oscillator w/ OSC2 configured as divide-by-4 clock output.
2425 #define _OSC_ECIO_1H 0xFD // EC oscillator w/ OSC2 configured as RA6.
2426 #define _OSC_HSPLL_1H 0xFE // HS oscillator with PLL enabled; clock frequency = (4 x FOSC).
2428 //----------------------------- CONFIG2L Options -------------------------------
2430 #define _PWRT_ON_2L 0xFE // PWRT enabled.
2431 #define _PWRT_OFF_2L 0xFF // PWRT disabled.
2432 #define _BOR_OFF_2L 0xFD // Brown-out Reset disabled.
2433 #define _BOR_ON_2L 0xFF // Brown-out Reset enabled.
2434 #define _BORV_45_2L 0xF3 // VBOR set to 4.5V.
2435 #define _BORV_42_2L 0xF7 // VBOR set to 4.2V.
2436 #define _BORV_27_2L 0xFB // VBOR set to 2.7V.
2437 #define _BORV_25_2L 0xFF // VBOR set to 2.5V.
2439 //----------------------------- CONFIG2H Options -------------------------------
2441 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit).
2442 #define _WDT_ON_2H 0xFF // WDT enabled.
2443 #define _WDTPS_1_2H 0xF1 // 1:1.
2444 #define _WDTPS_2_2H 0xF3 // 1:2.
2445 #define _WDTPS_4_2H 0xF5 // 1:4.
2446 #define _WDTPS_8_2H 0xF7 // 1:8.
2447 #define _WDTPS_16_2H 0xF9 // 1:16.
2448 #define _WDTPS_32_2H 0xFB // 1:32.
2449 #define _WDTPS_64_2H 0xFD // 1:64.
2450 #define _WDTPS_128_2H 0xFF // 1:128.
2452 //----------------------------- CONFIG4L Options -------------------------------
2454 #define _STVR_OFF_4L 0xFE // Stack Full/Underflow will not cause RESET.
2455 #define _STVR_ON_4L 0xFF // Stack Full/Underflow will cause RESET.
2456 #define _LVP_OFF_4L 0xFB // Low Voltage ICSP disabled.
2457 #define _LVP_ON_4L 0xFF // Low Voltage ICSP enabled.
2458 #define _DEBUG_ON_4L 0x7F // Background Debugger enabled. RB6 and RB7 are dedicated to In-Circuit Debug.
2459 #define _DEBUG_OFF_4L 0xFF // Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
2461 //----------------------------- CONFIG5L Options -------------------------------
2463 #define _CP0_ON_5L 0xFE // Block 0 (000200-001FFFh) code protected.
2464 #define _CP0_OFF_5L 0xFF // Block 0 (000200-001FFFh) not code protected.
2465 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code protected.
2466 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code protected.
2468 //----------------------------- CONFIG5H Options -------------------------------
2470 #define _CPB_ON_5H 0xBF // Boot block (000000-0001FFh) code protected.
2471 #define _CPB_OFF_5H 0xFF // Boot block (000000-0001FFh) not code protected.
2472 #define _CPD_ON_5H 0x7F // Data EEPROM code protected.
2473 #define _CPD_OFF_5H 0xFF // Data EEPROM not code protected.
2475 //----------------------------- CONFIG6L Options -------------------------------
2477 #define _WRT0_ON_6L 0xFE // Block 0 (000200h-001FFFh) write protected.
2478 #define _WRT0_OFF_6L 0xFF // Block 0 (000200h-001FFFh) not write protected.
2479 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write protected.
2480 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write protected.
2482 //----------------------------- CONFIG6H Options -------------------------------
2484 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write protected.
2485 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write protected.
2486 #define _WRTB_ON_6H 0xBF // Boot block (000000-0001FFh) write protected.
2487 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0001FFh) not write protected.
2488 #define _WRTD_ON_6H 0x7F // Data EEPROM write protected.
2489 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write protected.
2491 //----------------------------- CONFIG7L Options -------------------------------
2493 #define _EBTR0_ON_7L 0xFE // Block 0 (000200h-001FFFh) protected from Table Reads executed in other blocks.
2494 #define _EBTR0_OFF_7L 0xFF // Block 0 (000200h-001FFFh) not protected from Table Reads executed in other blocks.
2495 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from Table Reads executed in other blocks.
2496 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks.
2498 //----------------------------- CONFIG7H Options -------------------------------
2500 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0001FFh) protected from Table Reads executed in other blocks.
2501 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0001FFh) not protected from Table Reads executed in other blocks.
2503 //==============================================================================
2505 #define __DEVID1 0x3FFFFE
2506 #define __DEVID2 0x3FFFFF
2508 #define __IDLOC0 0x200000
2509 #define __IDLOC1 0x200001
2510 #define __IDLOC2 0x200002
2511 #define __IDLOC3 0x200003
2512 #define __IDLOC4 0x200004
2513 #define __IDLOC5 0x200005
2514 #define __IDLOC6 0x200006
2515 #define __IDLOC7 0x200007
2517 #endif // #ifndef __PIC18F4439_H__