struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c717.h
blob4c59d4b7360ba0346f92b46d37680d5b2cd4905a
1 /*
2 * This declarations of the PIC16C717 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:03 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 __PIC16C717_H__
26 #define __PIC16C717_H__
28 //==============================================================================
30 // Register Addresses
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF_ADDR 0x0000
37 #define TMR0_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR_ADDR 0x0004
41 #define PORTA_ADDR 0x0005
42 #define PORTB_ADDR 0x0006
43 #define PCLATH_ADDR 0x000A
44 #define INTCON_ADDR 0x000B
45 #define PIR1_ADDR 0x000C
46 #define PIR2_ADDR 0x000D
47 #define TMR1_ADDR 0x000E
48 #define TMR1L_ADDR 0x000E
49 #define TMR1H_ADDR 0x000F
50 #define T1CON_ADDR 0x0010
51 #define TMR2_ADDR 0x0011
52 #define T2CON_ADDR 0x0012
53 #define SSPBUF_ADDR 0x0013
54 #define SSPCON_ADDR 0x0014
55 #define CCPR1_ADDR 0x0015
56 #define CCPR1L_ADDR 0x0015
57 #define CCPR1H_ADDR 0x0016
58 #define CCP1CON_ADDR 0x0017
59 #define ADRESH_ADDR 0x001E
60 #define ADCON0_ADDR 0x001F
61 #define OPTION_REG_ADDR 0x0081
62 #define TRISA_ADDR 0x0085
63 #define TRISB_ADDR 0x0086
64 #define PIE1_ADDR 0x008C
65 #define PIE2_ADDR 0x008D
66 #define PCON_ADDR 0x008E
67 #define SSPCON2_ADDR 0x0091
68 #define PR2_ADDR 0x0092
69 #define SSPADD_ADDR 0x0093
70 #define SSPSTAT_ADDR 0x0094
71 #define WPUB_ADDR 0x0095
72 #define IOCB_ADDR 0x0096
73 #define P1DEL_ADDR 0x0097
74 #define REFCON_ADDR 0x009B
75 #define LVDCON_ADDR 0x009C
76 #define ANSEL_ADDR 0x009D
77 #define ADRESL_ADDR 0x009E
78 #define ADCON1_ADDR 0x009F
79 #define PMDATL_ADDR 0x010C
80 #define PMADRL_ADDR 0x010D
81 #define PMDATH_ADDR 0x010E
82 #define PMADRH_ADDR 0x010F
83 #define PMCON1_ADDR 0x018C
85 #endif // #ifndef NO_ADDR_DEFINES
87 //==============================================================================
89 // Register Definitions
91 //==============================================================================
93 extern __at(0x0000) __sfr INDF;
94 extern __at(0x0001) __sfr TMR0;
95 extern __at(0x0002) __sfr PCL;
97 //==============================================================================
98 // STATUS Bits
100 extern __at(0x0003) __sfr STATUS;
102 typedef union
104 struct
106 unsigned C : 1;
107 unsigned DC : 1;
108 unsigned Z : 1;
109 unsigned NOT_PD : 1;
110 unsigned NOT_TO : 1;
111 unsigned RP0 : 1;
112 unsigned RP1 : 1;
113 unsigned IRP : 1;
116 struct
118 unsigned : 5;
119 unsigned RP : 2;
120 unsigned : 1;
122 } __STATUSbits_t;
124 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
126 #define _C 0x01
127 #define _DC 0x02
128 #define _Z 0x04
129 #define _NOT_PD 0x08
130 #define _NOT_TO 0x10
131 #define _RP0 0x20
132 #define _RP1 0x40
133 #define _IRP 0x80
135 //==============================================================================
137 extern __at(0x0004) __sfr FSR;
139 //==============================================================================
140 // PORTA Bits
142 extern __at(0x0005) __sfr PORTA;
144 typedef struct
146 unsigned RA0 : 1;
147 unsigned RA1 : 1;
148 unsigned RA2 : 1;
149 unsigned RA3 : 1;
150 unsigned RA4 : 1;
151 unsigned RA5 : 1;
152 unsigned RA6 : 1;
153 unsigned RA7 : 1;
154 } __PORTAbits_t;
156 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
158 #define _RA0 0x01
159 #define _RA1 0x02
160 #define _RA2 0x04
161 #define _RA3 0x08
162 #define _RA4 0x10
163 #define _RA5 0x20
164 #define _RA6 0x40
165 #define _RA7 0x80
167 //==============================================================================
170 //==============================================================================
171 // PORTB Bits
173 extern __at(0x0006) __sfr PORTB;
175 typedef struct
177 unsigned RB0 : 1;
178 unsigned RB1 : 1;
179 unsigned RB2 : 1;
180 unsigned RB3 : 1;
181 unsigned RB4 : 1;
182 unsigned RB5 : 1;
183 unsigned RB6 : 1;
184 unsigned RB7 : 1;
185 } __PORTBbits_t;
187 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
189 #define _RB0 0x01
190 #define _RB1 0x02
191 #define _RB2 0x04
192 #define _RB3 0x08
193 #define _RB4 0x10
194 #define _RB5 0x20
195 #define _RB6 0x40
196 #define _RB7 0x80
198 //==============================================================================
200 extern __at(0x000A) __sfr PCLATH;
202 //==============================================================================
203 // INTCON Bits
205 extern __at(0x000B) __sfr INTCON;
207 typedef union
209 struct
211 unsigned RBIF : 1;
212 unsigned INTF : 1;
213 unsigned T0IF : 1;
214 unsigned RBIE : 1;
215 unsigned INTE : 1;
216 unsigned T0IE : 1;
217 unsigned PEIE : 1;
218 unsigned GIE : 1;
221 struct
223 unsigned : 1;
224 unsigned : 1;
225 unsigned TMR0IF : 1;
226 unsigned : 1;
227 unsigned : 1;
228 unsigned TMR0IE : 1;
229 unsigned : 1;
230 unsigned : 1;
232 } __INTCONbits_t;
234 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
236 #define _RBIF 0x01
237 #define _INTF 0x02
238 #define _T0IF 0x04
239 #define _TMR0IF 0x04
240 #define _RBIE 0x08
241 #define _INTE 0x10
242 #define _T0IE 0x20
243 #define _TMR0IE 0x20
244 #define _PEIE 0x40
245 #define _GIE 0x80
247 //==============================================================================
250 //==============================================================================
251 // PIR1 Bits
253 extern __at(0x000C) __sfr PIR1;
255 typedef struct
257 unsigned TMR1IF : 1;
258 unsigned TMR2IF : 1;
259 unsigned CCP1IF : 1;
260 unsigned SSPIF : 1;
261 unsigned : 1;
262 unsigned : 1;
263 unsigned ADIF : 1;
264 unsigned : 1;
265 } __PIR1bits_t;
267 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
269 #define _TMR1IF 0x01
270 #define _TMR2IF 0x02
271 #define _CCP1IF 0x04
272 #define _SSPIF 0x08
273 #define _ADIF 0x40
275 //==============================================================================
278 //==============================================================================
279 // PIR2 Bits
281 extern __at(0x000D) __sfr PIR2;
283 typedef struct
285 unsigned : 1;
286 unsigned : 1;
287 unsigned : 1;
288 unsigned BCLIF : 1;
289 unsigned : 1;
290 unsigned : 1;
291 unsigned : 1;
292 unsigned LVDIF : 1;
293 } __PIR2bits_t;
295 extern __at(0x000D) volatile __PIR2bits_t PIR2bits;
297 #define _BCLIF 0x08
298 #define _LVDIF 0x80
300 //==============================================================================
302 extern __at(0x000E) __sfr TMR1;
303 extern __at(0x000E) __sfr TMR1L;
304 extern __at(0x000F) __sfr TMR1H;
306 //==============================================================================
307 // T1CON Bits
309 extern __at(0x0010) __sfr T1CON;
311 typedef union
313 struct
315 unsigned TMR1ON : 1;
316 unsigned TMR1CS : 1;
317 unsigned NOT_T1SYNC : 1;
318 unsigned T1OSCEN : 1;
319 unsigned T1CKPS0 : 1;
320 unsigned T1CKPS1 : 1;
321 unsigned : 1;
322 unsigned : 1;
325 struct
327 unsigned : 1;
328 unsigned : 1;
329 unsigned T1INSYNC : 1;
330 unsigned : 1;
331 unsigned : 1;
332 unsigned : 1;
333 unsigned : 1;
334 unsigned : 1;
337 struct
339 unsigned : 4;
340 unsigned T1CKPS : 2;
341 unsigned : 2;
343 } __T1CONbits_t;
345 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
347 #define _TMR1ON 0x01
348 #define _TMR1CS 0x02
349 #define _NOT_T1SYNC 0x04
350 #define _T1INSYNC 0x04
351 #define _T1OSCEN 0x08
352 #define _T1CKPS0 0x10
353 #define _T1CKPS1 0x20
355 //==============================================================================
357 extern __at(0x0011) __sfr TMR2;
359 //==============================================================================
360 // T2CON Bits
362 extern __at(0x0012) __sfr T2CON;
364 typedef union
366 struct
368 unsigned T2CKPS0 : 1;
369 unsigned T2CKPS1 : 1;
370 unsigned TMR2ON : 1;
371 unsigned TOUTPS0 : 1;
372 unsigned TOUTPS1 : 1;
373 unsigned TOUTPS2 : 1;
374 unsigned TOUTPS3 : 1;
375 unsigned : 1;
378 struct
380 unsigned T2CKPS : 2;
381 unsigned : 6;
384 struct
386 unsigned : 3;
387 unsigned TOUTPS : 4;
388 unsigned : 1;
390 } __T2CONbits_t;
392 extern __at(0x0012) volatile __T2CONbits_t T2CONbits;
394 #define _T2CKPS0 0x01
395 #define _T2CKPS1 0x02
396 #define _TMR2ON 0x04
397 #define _TOUTPS0 0x08
398 #define _TOUTPS1 0x10
399 #define _TOUTPS2 0x20
400 #define _TOUTPS3 0x40
402 //==============================================================================
404 extern __at(0x0013) __sfr SSPBUF;
406 //==============================================================================
407 // SSPCON Bits
409 extern __at(0x0014) __sfr SSPCON;
411 typedef union
413 struct
415 unsigned SSPM0 : 1;
416 unsigned SSPM1 : 1;
417 unsigned SSPM2 : 1;
418 unsigned SSPM3 : 1;
419 unsigned CKP : 1;
420 unsigned SSPEN : 1;
421 unsigned SSPOV : 1;
422 unsigned WCOL : 1;
425 struct
427 unsigned SSPM : 4;
428 unsigned : 4;
430 } __SSPCONbits_t;
432 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits;
434 #define _SSPM0 0x01
435 #define _SSPM1 0x02
436 #define _SSPM2 0x04
437 #define _SSPM3 0x08
438 #define _CKP 0x10
439 #define _SSPEN 0x20
440 #define _SSPOV 0x40
441 #define _WCOL 0x80
443 //==============================================================================
445 extern __at(0x0015) __sfr CCPR1;
446 extern __at(0x0015) __sfr CCPR1L;
447 extern __at(0x0016) __sfr CCPR1H;
449 //==============================================================================
450 // CCP1CON Bits
452 extern __at(0x0017) __sfr CCP1CON;
454 typedef union
456 struct
458 unsigned CCP1M0 : 1;
459 unsigned CCP1M1 : 1;
460 unsigned CCP1M2 : 1;
461 unsigned CCP1M3 : 1;
462 unsigned DC1B0 : 1;
463 unsigned DC1B1 : 1;
464 unsigned PWM1M0 : 1;
465 unsigned PWM1M1 : 1;
468 struct
470 unsigned CCP1M : 4;
471 unsigned : 4;
474 struct
476 unsigned : 4;
477 unsigned DC1B : 2;
478 unsigned : 2;
481 struct
483 unsigned : 6;
484 unsigned PWM1M : 2;
486 } __CCP1CONbits_t;
488 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
490 #define _CCP1M0 0x01
491 #define _CCP1M1 0x02
492 #define _CCP1M2 0x04
493 #define _CCP1M3 0x08
494 #define _DC1B0 0x10
495 #define _DC1B1 0x20
496 #define _PWM1M0 0x40
497 #define _PWM1M1 0x80
499 //==============================================================================
501 extern __at(0x001E) __sfr ADRESH;
503 //==============================================================================
504 // ADCON0 Bits
506 extern __at(0x001F) __sfr ADCON0;
508 typedef union
510 struct
512 unsigned ADON : 1;
513 unsigned CHS3 : 1;
514 unsigned GO_NOT_DONE : 1;
515 unsigned CHS0 : 1;
516 unsigned CHS1 : 1;
517 unsigned CHS2 : 1;
518 unsigned ADCS0 : 1;
519 unsigned ADCS1 : 1;
522 struct
524 unsigned : 1;
525 unsigned : 1;
526 unsigned GO : 1;
527 unsigned : 1;
528 unsigned : 1;
529 unsigned : 1;
530 unsigned : 1;
531 unsigned : 1;
534 struct
536 unsigned : 1;
537 unsigned : 1;
538 unsigned NOT_DONE : 1;
539 unsigned : 1;
540 unsigned : 1;
541 unsigned : 1;
542 unsigned : 1;
543 unsigned : 1;
546 struct
548 unsigned : 1;
549 unsigned : 1;
550 unsigned GO_DONE : 1;
551 unsigned : 1;
552 unsigned : 1;
553 unsigned : 1;
554 unsigned : 1;
555 unsigned : 1;
558 struct
560 unsigned : 6;
561 unsigned ADCS : 2;
563 } __ADCON0bits_t;
565 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
567 #define _ADON 0x01
568 #define _CHS3 0x02
569 #define _GO_NOT_DONE 0x04
570 #define _GO 0x04
571 #define _NOT_DONE 0x04
572 #define _GO_DONE 0x04
573 #define _CHS0 0x08
574 #define _CHS1 0x10
575 #define _CHS2 0x20
576 #define _ADCS0 0x40
577 #define _ADCS1 0x80
579 //==============================================================================
582 //==============================================================================
583 // OPTION_REG Bits
585 extern __at(0x0081) __sfr OPTION_REG;
587 typedef union
589 struct
591 unsigned PS0 : 1;
592 unsigned PS1 : 1;
593 unsigned PS2 : 1;
594 unsigned PSA : 1;
595 unsigned T0SE : 1;
596 unsigned T0CS : 1;
597 unsigned INTEDG : 1;
598 unsigned NOT_RBPU : 1;
601 struct
603 unsigned PS : 3;
604 unsigned : 5;
606 } __OPTION_REGbits_t;
608 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
610 #define _PS0 0x01
611 #define _PS1 0x02
612 #define _PS2 0x04
613 #define _PSA 0x08
614 #define _T0SE 0x10
615 #define _T0CS 0x20
616 #define _INTEDG 0x40
617 #define _NOT_RBPU 0x80
619 //==============================================================================
622 //==============================================================================
623 // TRISA Bits
625 extern __at(0x0085) __sfr TRISA;
627 typedef struct
629 unsigned TRISA0 : 1;
630 unsigned TRISA1 : 1;
631 unsigned TRISA2 : 1;
632 unsigned TRISA3 : 1;
633 unsigned TRISA4 : 1;
634 unsigned TRISA5 : 1;
635 unsigned TRISA6 : 1;
636 unsigned TRISA7 : 1;
637 } __TRISAbits_t;
639 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
641 #define _TRISA0 0x01
642 #define _TRISA1 0x02
643 #define _TRISA2 0x04
644 #define _TRISA3 0x08
645 #define _TRISA4 0x10
646 #define _TRISA5 0x20
647 #define _TRISA6 0x40
648 #define _TRISA7 0x80
650 //==============================================================================
653 //==============================================================================
654 // TRISB Bits
656 extern __at(0x0086) __sfr TRISB;
658 typedef struct
660 unsigned TRISB0 : 1;
661 unsigned TRISB1 : 1;
662 unsigned TRISB2 : 1;
663 unsigned TRISB3 : 1;
664 unsigned TRISB4 : 1;
665 unsigned TRISB5 : 1;
666 unsigned TRISB6 : 1;
667 unsigned TRISB7 : 1;
668 } __TRISBbits_t;
670 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
672 #define _TRISB0 0x01
673 #define _TRISB1 0x02
674 #define _TRISB2 0x04
675 #define _TRISB3 0x08
676 #define _TRISB4 0x10
677 #define _TRISB5 0x20
678 #define _TRISB6 0x40
679 #define _TRISB7 0x80
681 //==============================================================================
684 //==============================================================================
685 // PIE1 Bits
687 extern __at(0x008C) __sfr PIE1;
689 typedef struct
691 unsigned TMR1IE : 1;
692 unsigned TMR2IE : 1;
693 unsigned CCP1IE : 1;
694 unsigned SSPIE : 1;
695 unsigned : 1;
696 unsigned : 1;
697 unsigned ADIE : 1;
698 unsigned : 1;
699 } __PIE1bits_t;
701 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
703 #define _TMR1IE 0x01
704 #define _TMR2IE 0x02
705 #define _CCP1IE 0x04
706 #define _SSPIE 0x08
707 #define _ADIE 0x40
709 //==============================================================================
712 //==============================================================================
713 // PIE2 Bits
715 extern __at(0x008D) __sfr PIE2;
717 typedef struct
719 unsigned : 1;
720 unsigned : 1;
721 unsigned : 1;
722 unsigned BCLIE : 1;
723 unsigned : 1;
724 unsigned : 1;
725 unsigned : 1;
726 unsigned LVDIE : 1;
727 } __PIE2bits_t;
729 extern __at(0x008D) volatile __PIE2bits_t PIE2bits;
731 #define _BCLIE 0x08
732 #define _LVDIE 0x80
734 //==============================================================================
737 //==============================================================================
738 // PCON Bits
740 extern __at(0x008E) __sfr PCON;
742 typedef union
744 struct
746 unsigned NOT_BOR : 1;
747 unsigned NOT_POR : 1;
748 unsigned : 1;
749 unsigned OSCF : 1;
750 unsigned : 1;
751 unsigned : 1;
752 unsigned : 1;
753 unsigned : 1;
756 struct
758 unsigned NOT_BO : 1;
759 unsigned : 1;
760 unsigned : 1;
761 unsigned : 1;
762 unsigned : 1;
763 unsigned : 1;
764 unsigned : 1;
765 unsigned : 1;
767 } __PCONbits_t;
769 extern __at(0x008E) volatile __PCONbits_t PCONbits;
771 #define _NOT_BOR 0x01
772 #define _NOT_BO 0x01
773 #define _NOT_POR 0x02
774 #define _OSCF 0x08
776 //==============================================================================
779 //==============================================================================
780 // SSPCON2 Bits
782 extern __at(0x0091) __sfr SSPCON2;
784 typedef struct
786 unsigned SEN : 1;
787 unsigned RSEN : 1;
788 unsigned PEN : 1;
789 unsigned RCEN : 1;
790 unsigned ACKEN : 1;
791 unsigned ACKDT : 1;
792 unsigned ACKSTAT : 1;
793 unsigned GCEN : 1;
794 } __SSPCON2bits_t;
796 extern __at(0x0091) volatile __SSPCON2bits_t SSPCON2bits;
798 #define _SEN 0x01
799 #define _RSEN 0x02
800 #define _PEN 0x04
801 #define _RCEN 0x08
802 #define _ACKEN 0x10
803 #define _ACKDT 0x20
804 #define _ACKSTAT 0x40
805 #define _GCEN 0x80
807 //==============================================================================
809 extern __at(0x0092) __sfr PR2;
810 extern __at(0x0093) __sfr SSPADD;
812 //==============================================================================
813 // SSPSTAT Bits
815 extern __at(0x0094) __sfr SSPSTAT;
817 typedef union
819 struct
821 unsigned BF : 1;
822 unsigned UA : 1;
823 unsigned R_NOT_W : 1;
824 unsigned S : 1;
825 unsigned P : 1;
826 unsigned D_NOT_A : 1;
827 unsigned CKE : 1;
828 unsigned SMP : 1;
831 struct
833 unsigned : 1;
834 unsigned : 1;
835 unsigned R : 1;
836 unsigned I2C_START : 1;
837 unsigned I2C_STOP : 1;
838 unsigned D : 1;
839 unsigned : 1;
840 unsigned : 1;
843 struct
845 unsigned : 1;
846 unsigned : 1;
847 unsigned I2C_READ : 1;
848 unsigned : 1;
849 unsigned : 1;
850 unsigned I2C_DATA : 1;
851 unsigned : 1;
852 unsigned : 1;
855 struct
857 unsigned : 1;
858 unsigned : 1;
859 unsigned R_W : 1;
860 unsigned : 1;
861 unsigned : 1;
862 unsigned D_A : 1;
863 unsigned : 1;
864 unsigned : 1;
867 struct
869 unsigned : 1;
870 unsigned : 1;
871 unsigned READ_WRITE : 1;
872 unsigned : 1;
873 unsigned : 1;
874 unsigned DATA_ADDRESS : 1;
875 unsigned : 1;
876 unsigned : 1;
879 struct
881 unsigned : 1;
882 unsigned : 1;
883 unsigned NOT_W : 1;
884 unsigned : 1;
885 unsigned : 1;
886 unsigned NOT_A : 1;
887 unsigned : 1;
888 unsigned : 1;
891 struct
893 unsigned : 1;
894 unsigned : 1;
895 unsigned NOT_WRITE : 1;
896 unsigned : 1;
897 unsigned : 1;
898 unsigned NOT_ADDRESS : 1;
899 unsigned : 1;
900 unsigned : 1;
902 } __SSPSTATbits_t;
904 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
906 #define _BF 0x01
907 #define _UA 0x02
908 #define _R_NOT_W 0x04
909 #define _R 0x04
910 #define _I2C_READ 0x04
911 #define _R_W 0x04
912 #define _READ_WRITE 0x04
913 #define _NOT_W 0x04
914 #define _NOT_WRITE 0x04
915 #define _S 0x08
916 #define _I2C_START 0x08
917 #define _P 0x10
918 #define _I2C_STOP 0x10
919 #define _D_NOT_A 0x20
920 #define _D 0x20
921 #define _I2C_DATA 0x20
922 #define _D_A 0x20
923 #define _DATA_ADDRESS 0x20
924 #define _NOT_A 0x20
925 #define _NOT_ADDRESS 0x20
926 #define _CKE 0x40
927 #define _SMP 0x80
929 //==============================================================================
932 //==============================================================================
933 // WPUB Bits
935 extern __at(0x0095) __sfr WPUB;
937 typedef struct
939 unsigned WPUB0 : 1;
940 unsigned WPUB1 : 1;
941 unsigned WPUB2 : 1;
942 unsigned WPUB3 : 1;
943 unsigned WPUB4 : 1;
944 unsigned WPUB5 : 1;
945 unsigned WPUB6 : 1;
946 unsigned WPUB7 : 1;
947 } __WPUBbits_t;
949 extern __at(0x0095) volatile __WPUBbits_t WPUBbits;
951 #define _WPUB0 0x01
952 #define _WPUB1 0x02
953 #define _WPUB2 0x04
954 #define _WPUB3 0x08
955 #define _WPUB4 0x10
956 #define _WPUB5 0x20
957 #define _WPUB6 0x40
958 #define _WPUB7 0x80
960 //==============================================================================
963 //==============================================================================
964 // IOCB Bits
966 extern __at(0x0096) __sfr IOCB;
968 typedef struct
970 unsigned IOCB0 : 1;
971 unsigned IOCB1 : 1;
972 unsigned IOCB2 : 1;
973 unsigned IOCB3 : 1;
974 unsigned IOCB4 : 1;
975 unsigned IOCB5 : 1;
976 unsigned IOCB6 : 1;
977 unsigned IOCB7 : 1;
978 } __IOCBbits_t;
980 extern __at(0x0096) volatile __IOCBbits_t IOCBbits;
982 #define _IOCB0 0x01
983 #define _IOCB1 0x02
984 #define _IOCB2 0x04
985 #define _IOCB3 0x08
986 #define _IOCB4 0x10
987 #define _IOCB5 0x20
988 #define _IOCB6 0x40
989 #define _IOCB7 0x80
991 //==============================================================================
993 extern __at(0x0097) __sfr P1DEL;
995 //==============================================================================
996 // REFCON Bits
998 extern __at(0x009B) __sfr REFCON;
1000 typedef struct
1002 unsigned : 1;
1003 unsigned : 1;
1004 unsigned : 1;
1005 unsigned : 1;
1006 unsigned VRLOEN : 1;
1007 unsigned VRHOEN : 1;
1008 unsigned VRLEN : 1;
1009 unsigned VRHEN : 1;
1010 } __REFCONbits_t;
1012 extern __at(0x009B) volatile __REFCONbits_t REFCONbits;
1014 #define _VRLOEN 0x10
1015 #define _VRHOEN 0x20
1016 #define _VRLEN 0x40
1017 #define _VRHEN 0x80
1019 //==============================================================================
1022 //==============================================================================
1023 // LVDCON Bits
1025 extern __at(0x009C) __sfr LVDCON;
1027 typedef union
1029 struct
1031 unsigned LV0 : 1;
1032 unsigned LV1 : 1;
1033 unsigned LV2 : 1;
1034 unsigned LV3 : 1;
1035 unsigned LVDEN : 1;
1036 unsigned BGST : 1;
1037 unsigned : 1;
1038 unsigned : 1;
1041 struct
1043 unsigned LV : 4;
1044 unsigned : 4;
1046 } __LVDCONbits_t;
1048 extern __at(0x009C) volatile __LVDCONbits_t LVDCONbits;
1050 #define _LV0 0x01
1051 #define _LV1 0x02
1052 #define _LV2 0x04
1053 #define _LV3 0x08
1054 #define _LVDEN 0x10
1055 #define _BGST 0x20
1057 //==============================================================================
1060 //==============================================================================
1061 // ANSEL Bits
1063 extern __at(0x009D) __sfr ANSEL;
1065 typedef union
1067 struct
1069 unsigned ANS0 : 1;
1070 unsigned ANS1 : 1;
1071 unsigned ANS2 : 1;
1072 unsigned ANS3 : 1;
1073 unsigned ANS4 : 1;
1074 unsigned ANS5 : 1;
1075 unsigned : 1;
1076 unsigned : 1;
1079 struct
1081 unsigned ANS : 6;
1082 unsigned : 2;
1084 } __ANSELbits_t;
1086 extern __at(0x009D) volatile __ANSELbits_t ANSELbits;
1088 #define _ANS0 0x01
1089 #define _ANS1 0x02
1090 #define _ANS2 0x04
1091 #define _ANS3 0x08
1092 #define _ANS4 0x10
1093 #define _ANS5 0x20
1095 //==============================================================================
1097 extern __at(0x009E) __sfr ADRESL;
1099 //==============================================================================
1100 // ADCON1 Bits
1102 extern __at(0x009F) __sfr ADCON1;
1104 typedef union
1106 struct
1108 unsigned : 1;
1109 unsigned : 1;
1110 unsigned : 1;
1111 unsigned : 1;
1112 unsigned VCFG0 : 1;
1113 unsigned VCFG1 : 1;
1114 unsigned VCFG2 : 1;
1115 unsigned ADFM : 1;
1118 struct
1120 unsigned : 4;
1121 unsigned VCFG : 3;
1122 unsigned : 1;
1124 } __ADCON1bits_t;
1126 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
1128 #define _VCFG0 0x10
1129 #define _VCFG1 0x20
1130 #define _VCFG2 0x40
1131 #define _ADFM 0x80
1133 //==============================================================================
1135 extern __at(0x010C) __sfr PMDATL;
1136 extern __at(0x010D) __sfr PMADRL;
1137 extern __at(0x010E) __sfr PMDATH;
1138 extern __at(0x010F) __sfr PMADRH;
1140 //==============================================================================
1141 // PMCON1 Bits
1143 extern __at(0x018C) __sfr PMCON1;
1145 typedef struct
1147 unsigned RD : 1;
1148 unsigned : 1;
1149 unsigned : 1;
1150 unsigned : 1;
1151 unsigned : 1;
1152 unsigned : 1;
1153 unsigned : 1;
1154 unsigned : 1;
1155 } __PMCON1bits_t;
1157 extern __at(0x018C) volatile __PMCON1bits_t PMCON1bits;
1159 #define _RD 0x01
1161 //==============================================================================
1164 //==============================================================================
1166 // Configuration Bits
1168 //==============================================================================
1170 #define _CONFIG1 0x2007
1172 //----------------------------- CONFIG1 Options -------------------------------
1174 #define _FOSC_LP 0x3FF8 // LP oscillator.
1175 #define _LP_OSC 0x3FF8 // LP oscillator.
1176 #define _FOSC_XT 0x3FF9 // XT oscillator.
1177 #define _XT_OSC 0x3FF9 // XT oscillator.
1178 #define _FOSC_HS 0x3FFA // HS oscillator.
1179 #define _HS_OSC 0x3FFA // HS oscillator.
1180 #define _FOSC_EXTCLK 0x3FFB // EC I/O.
1181 #define _EXTCLK_OSC 0x3FFB // EC I/O.
1182 #define _FOSC_INTRCIO 0x3FFC // INTRC, OSC2 is I/O.
1183 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTRC, OSC2 is I/O.
1184 #define _FOSC_INTRCCLK 0x3FFD // INTRC, clockout on OSC2.
1185 #define _INTRC_OSC_CLKOUT 0x3FFD // INTRC, clockout on OSC2.
1186 #define _FOSC_ER_NOCLKOUT 0x3FFE // ER I/O.
1187 #define _ER_OSC_NOCLKOUT 0x3FFE // ER I/O.
1188 #define _FOSC_ER_CLKOUT 0x3FFF // ER CLKOUT.
1189 #define _ER_OSC_CLKOUT 0x3FFF // ER CLKOUT.
1190 #define _WDTE_OFF 0x3FF7 // WDT disabled.
1191 #define _WDT_OFF 0x3FF7 // WDT disabled.
1192 #define _WDTE_ON 0x3FFF // WDT enabled.
1193 #define _WDT_ON 0x3FFF // WDT enabled.
1194 #define _PWRTE_ON 0x3FEF // PWRT enabled.
1195 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1196 #define _MCLRE_OFF 0x3FDF // Internal.
1197 #define _MCLRE_ON 0x3FFF // External.
1198 #define _BOREN_OFF 0x3FBF // BOR disabled.
1199 #define _BODEN_OFF 0x3FBF // BOR disabled.
1200 #define _BOREN_ON 0x3FFF // BOR enabled.
1201 #define _BODEN_ON 0x3FFF // BOR enabled.
1202 #define _CP_ALL 0x0CFF // All memory is code protected.
1203 #define _CP_OFF 0x3FFF // Code protection off.
1204 #define _BODENV_45 0x33FF // VBOR set to 4.5V.
1205 #define _VBOR_45 0x33FF // VBOR set to 4.5V.
1206 #define _BODENV_42 0x37FF // VBOR set to 4.2V.
1207 #define _VBOR_42 0x37FF // VBOR set to 4.2V.
1208 #define _BODENV_27 0x3BFF // VBOR set to 2.7V.
1209 #define _VBOR_27 0x3BFF // VBOR set to 2.7V.
1210 #define _BODENV_25 0x3FFF // VBOR set to 2.5V.
1211 #define _VBOR_25 0x3FFF // VBOR set to 2.5V.
1213 //==============================================================================
1215 #define _IDLOC0 0x2000
1216 #define _IDLOC1 0x2001
1217 #define _IDLOC2 0x2002
1218 #define _IDLOC3 0x2003
1220 //==============================================================================
1222 #ifndef NO_BIT_DEFINES
1224 #define ADON ADCON0bits.ADON // bit 0
1225 #define CHS3 ADCON0bits.CHS3 // bit 1
1226 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
1227 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
1228 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
1229 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
1230 #define CHS0 ADCON0bits.CHS0 // bit 3
1231 #define CHS1 ADCON0bits.CHS1 // bit 4
1232 #define CHS2 ADCON0bits.CHS2 // bit 5
1233 #define ADCS0 ADCON0bits.ADCS0 // bit 6
1234 #define ADCS1 ADCON0bits.ADCS1 // bit 7
1236 #define VCFG0 ADCON1bits.VCFG0 // bit 4
1237 #define VCFG1 ADCON1bits.VCFG1 // bit 5
1238 #define VCFG2 ADCON1bits.VCFG2 // bit 6
1239 #define ADFM ADCON1bits.ADFM // bit 7
1241 #define ANS0 ANSELbits.ANS0 // bit 0
1242 #define ANS1 ANSELbits.ANS1 // bit 1
1243 #define ANS2 ANSELbits.ANS2 // bit 2
1244 #define ANS3 ANSELbits.ANS3 // bit 3
1245 #define ANS4 ANSELbits.ANS4 // bit 4
1246 #define ANS5 ANSELbits.ANS5 // bit 5
1248 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0
1249 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1
1250 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2
1251 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3
1252 #define DC1B0 CCP1CONbits.DC1B0 // bit 4
1253 #define DC1B1 CCP1CONbits.DC1B1 // bit 5
1254 #define PWM1M0 CCP1CONbits.PWM1M0 // bit 6
1255 #define PWM1M1 CCP1CONbits.PWM1M1 // bit 7
1257 #define RBIF INTCONbits.RBIF // bit 0
1258 #define INTF INTCONbits.INTF // bit 1
1259 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
1260 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
1261 #define RBIE INTCONbits.RBIE // bit 3
1262 #define INTE INTCONbits.INTE // bit 4
1263 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
1264 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
1265 #define PEIE INTCONbits.PEIE // bit 6
1266 #define GIE INTCONbits.GIE // bit 7
1268 #define IOCB0 IOCBbits.IOCB0 // bit 0
1269 #define IOCB1 IOCBbits.IOCB1 // bit 1
1270 #define IOCB2 IOCBbits.IOCB2 // bit 2
1271 #define IOCB3 IOCBbits.IOCB3 // bit 3
1272 #define IOCB4 IOCBbits.IOCB4 // bit 4
1273 #define IOCB5 IOCBbits.IOCB5 // bit 5
1274 #define IOCB6 IOCBbits.IOCB6 // bit 6
1275 #define IOCB7 IOCBbits.IOCB7 // bit 7
1277 #define LV0 LVDCONbits.LV0 // bit 0
1278 #define LV1 LVDCONbits.LV1 // bit 1
1279 #define LV2 LVDCONbits.LV2 // bit 2
1280 #define LV3 LVDCONbits.LV3 // bit 3
1281 #define LVDEN LVDCONbits.LVDEN // bit 4
1282 #define BGST LVDCONbits.BGST // bit 5
1284 #define PS0 OPTION_REGbits.PS0 // bit 0
1285 #define PS1 OPTION_REGbits.PS1 // bit 1
1286 #define PS2 OPTION_REGbits.PS2 // bit 2
1287 #define PSA OPTION_REGbits.PSA // bit 3
1288 #define T0SE OPTION_REGbits.T0SE // bit 4
1289 #define T0CS OPTION_REGbits.T0CS // bit 5
1290 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1291 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
1293 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1294 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
1295 #define NOT_POR PCONbits.NOT_POR // bit 1
1296 #define OSCF PCONbits.OSCF // bit 3
1298 #define TMR1IE PIE1bits.TMR1IE // bit 0
1299 #define TMR2IE PIE1bits.TMR2IE // bit 1
1300 #define CCP1IE PIE1bits.CCP1IE // bit 2
1301 #define SSPIE PIE1bits.SSPIE // bit 3
1302 #define ADIE PIE1bits.ADIE // bit 6
1304 #define BCLIE PIE2bits.BCLIE // bit 3
1305 #define LVDIE PIE2bits.LVDIE // bit 7
1307 #define TMR1IF PIR1bits.TMR1IF // bit 0
1308 #define TMR2IF PIR1bits.TMR2IF // bit 1
1309 #define CCP1IF PIR1bits.CCP1IF // bit 2
1310 #define SSPIF PIR1bits.SSPIF // bit 3
1311 #define ADIF PIR1bits.ADIF // bit 6
1313 #define BCLIF PIR2bits.BCLIF // bit 3
1314 #define LVDIF PIR2bits.LVDIF // bit 7
1316 #define RD PMCON1bits.RD // bit 0
1318 #define RA0 PORTAbits.RA0 // bit 0
1319 #define RA1 PORTAbits.RA1 // bit 1
1320 #define RA2 PORTAbits.RA2 // bit 2
1321 #define RA3 PORTAbits.RA3 // bit 3
1322 #define RA4 PORTAbits.RA4 // bit 4
1323 #define RA5 PORTAbits.RA5 // bit 5
1324 #define RA6 PORTAbits.RA6 // bit 6
1325 #define RA7 PORTAbits.RA7 // bit 7
1327 #define RB0 PORTBbits.RB0 // bit 0
1328 #define RB1 PORTBbits.RB1 // bit 1
1329 #define RB2 PORTBbits.RB2 // bit 2
1330 #define RB3 PORTBbits.RB3 // bit 3
1331 #define RB4 PORTBbits.RB4 // bit 4
1332 #define RB5 PORTBbits.RB5 // bit 5
1333 #define RB6 PORTBbits.RB6 // bit 6
1334 #define RB7 PORTBbits.RB7 // bit 7
1336 #define VRLOEN REFCONbits.VRLOEN // bit 4
1337 #define VRHOEN REFCONbits.VRHOEN // bit 5
1338 #define VRLEN REFCONbits.VRLEN // bit 6
1339 #define VRHEN REFCONbits.VRHEN // bit 7
1341 #define SSPM0 SSPCONbits.SSPM0 // bit 0
1342 #define SSPM1 SSPCONbits.SSPM1 // bit 1
1343 #define SSPM2 SSPCONbits.SSPM2 // bit 2
1344 #define SSPM3 SSPCONbits.SSPM3 // bit 3
1345 #define CKP SSPCONbits.CKP // bit 4
1346 #define SSPEN SSPCONbits.SSPEN // bit 5
1347 #define SSPOV SSPCONbits.SSPOV // bit 6
1348 #define WCOL SSPCONbits.WCOL // bit 7
1350 #define SEN SSPCON2bits.SEN // bit 0
1351 #define RSEN SSPCON2bits.RSEN // bit 1
1352 #define PEN SSPCON2bits.PEN // bit 2
1353 #define RCEN SSPCON2bits.RCEN // bit 3
1354 #define ACKEN SSPCON2bits.ACKEN // bit 4
1355 #define ACKDT SSPCON2bits.ACKDT // bit 5
1356 #define ACKSTAT SSPCON2bits.ACKSTAT // bit 6
1357 #define GCEN SSPCON2bits.GCEN // bit 7
1359 #define BF SSPSTATbits.BF // bit 0
1360 #define UA SSPSTATbits.UA // bit 1
1361 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits
1362 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits
1363 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits
1364 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits
1365 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits
1366 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits
1367 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits
1368 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits
1369 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits
1370 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits
1371 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits
1372 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits
1373 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits
1374 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits
1375 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits
1376 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits
1377 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits
1378 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits
1379 #define CKE SSPSTATbits.CKE // bit 6
1380 #define SMP SSPSTATbits.SMP // bit 7
1382 #define C STATUSbits.C // bit 0
1383 #define DC STATUSbits.DC // bit 1
1384 #define Z STATUSbits.Z // bit 2
1385 #define NOT_PD STATUSbits.NOT_PD // bit 3
1386 #define NOT_TO STATUSbits.NOT_TO // bit 4
1387 #define RP0 STATUSbits.RP0 // bit 5
1388 #define RP1 STATUSbits.RP1 // bit 6
1389 #define IRP STATUSbits.IRP // bit 7
1391 #define TMR1ON T1CONbits.TMR1ON // bit 0
1392 #define TMR1CS T1CONbits.TMR1CS // bit 1
1393 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
1394 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
1395 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1396 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1397 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1399 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0
1400 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1
1401 #define TMR2ON T2CONbits.TMR2ON // bit 2
1402 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3
1403 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4
1404 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5
1405 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6
1407 #define TRISA0 TRISAbits.TRISA0 // bit 0
1408 #define TRISA1 TRISAbits.TRISA1 // bit 1
1409 #define TRISA2 TRISAbits.TRISA2 // bit 2
1410 #define TRISA3 TRISAbits.TRISA3 // bit 3
1411 #define TRISA4 TRISAbits.TRISA4 // bit 4
1412 #define TRISA5 TRISAbits.TRISA5 // bit 5
1413 #define TRISA6 TRISAbits.TRISA6 // bit 6
1414 #define TRISA7 TRISAbits.TRISA7 // bit 7
1416 #define TRISB0 TRISBbits.TRISB0 // bit 0
1417 #define TRISB1 TRISBbits.TRISB1 // bit 1
1418 #define TRISB2 TRISBbits.TRISB2 // bit 2
1419 #define TRISB3 TRISBbits.TRISB3 // bit 3
1420 #define TRISB4 TRISBbits.TRISB4 // bit 4
1421 #define TRISB5 TRISBbits.TRISB5 // bit 5
1422 #define TRISB6 TRISBbits.TRISB6 // bit 6
1423 #define TRISB7 TRISBbits.TRISB7 // bit 7
1425 #define WPUB0 WPUBbits.WPUB0 // bit 0
1426 #define WPUB1 WPUBbits.WPUB1 // bit 1
1427 #define WPUB2 WPUBbits.WPUB2 // bit 2
1428 #define WPUB3 WPUBbits.WPUB3 // bit 3
1429 #define WPUB4 WPUBbits.WPUB4 // bit 4
1430 #define WPUB5 WPUBbits.WPUB5 // bit 5
1431 #define WPUB6 WPUBbits.WPUB6 // bit 6
1432 #define WPUB7 WPUBbits.WPUB7 // bit 7
1434 #endif // #ifndef NO_BIT_DEFINES
1436 #endif // #ifndef __PIC16C717_H__