Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c782.h
blob3ce37ea097dbc332d5b9c332bc4da867b1267969
1 /*
2 * This declarations of the PIC16C782 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 __PIC16C782_H__
26 #define __PIC16C782_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 TMR1_ADDR 0x000E
47 #define TMR1L_ADDR 0x000E
48 #define TMR1H_ADDR 0x000F
49 #define T1CON_ADDR 0x0010
50 #define ADRES_ADDR 0x001E
51 #define ADCON0_ADDR 0x001F
52 #define OPTION_REG_ADDR 0x0081
53 #define TRISA_ADDR 0x0085
54 #define TRISB_ADDR 0x0086
55 #define PIE1_ADDR 0x008C
56 #define PCON_ADDR 0x008E
57 #define WPUB_ADDR 0x0095
58 #define IOCB_ADDR 0x0096
59 #define REFCON_ADDR 0x009B
60 #define LVDCON_ADDR 0x009C
61 #define ANSEL_ADDR 0x009D
62 #define ADCON1_ADDR 0x009F
63 #define PMDATL_ADDR 0x010C
64 #define PMADRL_ADDR 0x010D
65 #define PMDATH_ADDR 0x010E
66 #define PMADRH_ADDR 0x010F
67 #define CALCON_ADDR 0x0110
68 #define PSMCCON0_ADDR 0x0111
69 #define PSMCCON1_ADDR 0x0112
70 #define CM1CON0_ADDR 0x0119
71 #define CM2CON0_ADDR 0x011A
72 #define CM2CON1_ADDR 0x011B
73 #define OPACON_ADDR 0x011C
74 #define DAC_ADDR 0x011E
75 #define DACON0_ADDR 0x011F
76 #define PMCON1_ADDR 0x018C
78 #endif // #ifndef NO_ADDR_DEFINES
80 //==============================================================================
82 // Register Definitions
84 //==============================================================================
86 extern __at(0x0000) __sfr INDF;
87 extern __at(0x0001) __sfr TMR0;
88 extern __at(0x0002) __sfr PCL;
90 //==============================================================================
91 // STATUS Bits
93 extern __at(0x0003) __sfr STATUS;
95 typedef union
97 struct
99 unsigned C : 1;
100 unsigned DC : 1;
101 unsigned Z : 1;
102 unsigned NOT_PD : 1;
103 unsigned NOT_TO : 1;
104 unsigned RP0 : 1;
105 unsigned RP1 : 1;
106 unsigned IRP : 1;
109 struct
111 unsigned : 5;
112 unsigned RP : 2;
113 unsigned : 1;
115 } __STATUSbits_t;
117 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
119 #define _C 0x01
120 #define _DC 0x02
121 #define _Z 0x04
122 #define _NOT_PD 0x08
123 #define _NOT_TO 0x10
124 #define _RP0 0x20
125 #define _RP1 0x40
126 #define _IRP 0x80
128 //==============================================================================
130 extern __at(0x0004) __sfr FSR;
132 //==============================================================================
133 // PORTA Bits
135 extern __at(0x0005) __sfr PORTA;
137 typedef struct
139 unsigned RA0 : 1;
140 unsigned RA1 : 1;
141 unsigned RA2 : 1;
142 unsigned RA3 : 1;
143 unsigned RA4 : 1;
144 unsigned RA5 : 1;
145 unsigned RA6 : 1;
146 unsigned RA7 : 1;
147 } __PORTAbits_t;
149 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
151 #define _RA0 0x01
152 #define _RA1 0x02
153 #define _RA2 0x04
154 #define _RA3 0x08
155 #define _RA4 0x10
156 #define _RA5 0x20
157 #define _RA6 0x40
158 #define _RA7 0x80
160 //==============================================================================
163 //==============================================================================
164 // PORTB Bits
166 extern __at(0x0006) __sfr PORTB;
168 typedef struct
170 unsigned RB0 : 1;
171 unsigned RB1 : 1;
172 unsigned RB2 : 1;
173 unsigned RB3 : 1;
174 unsigned RB4 : 1;
175 unsigned RB5 : 1;
176 unsigned RB6 : 1;
177 unsigned RB7 : 1;
178 } __PORTBbits_t;
180 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
182 #define _RB0 0x01
183 #define _RB1 0x02
184 #define _RB2 0x04
185 #define _RB3 0x08
186 #define _RB4 0x10
187 #define _RB5 0x20
188 #define _RB6 0x40
189 #define _RB7 0x80
191 //==============================================================================
193 extern __at(0x000A) __sfr PCLATH;
195 //==============================================================================
196 // INTCON Bits
198 extern __at(0x000B) __sfr INTCON;
200 typedef struct
202 unsigned RBIF : 1;
203 unsigned INTF : 1;
204 unsigned T0IF : 1;
205 unsigned RBIE : 1;
206 unsigned INTE : 1;
207 unsigned T0IE : 1;
208 unsigned PEIE : 1;
209 unsigned GIE : 1;
210 } __INTCONbits_t;
212 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
214 #define _RBIF 0x01
215 #define _INTF 0x02
216 #define _T0IF 0x04
217 #define _RBIE 0x08
218 #define _INTE 0x10
219 #define _T0IE 0x20
220 #define _PEIE 0x40
221 #define _GIE 0x80
223 //==============================================================================
226 //==============================================================================
227 // PIR1 Bits
229 extern __at(0x000C) __sfr PIR1;
231 typedef struct
233 unsigned TMR1IF : 1;
234 unsigned : 1;
235 unsigned : 1;
236 unsigned : 1;
237 unsigned C1IF : 1;
238 unsigned C2IF : 1;
239 unsigned ADIF : 1;
240 unsigned LVDIF : 1;
241 } __PIR1bits_t;
243 extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
245 #define _TMR1IF 0x01
246 #define _C1IF 0x10
247 #define _C2IF 0x20
248 #define _ADIF 0x40
249 #define _LVDIF 0x80
251 //==============================================================================
253 extern __at(0x000E) __sfr TMR1;
254 extern __at(0x000E) __sfr TMR1L;
255 extern __at(0x000F) __sfr TMR1H;
257 //==============================================================================
258 // T1CON Bits
260 extern __at(0x0010) __sfr T1CON;
262 typedef union
264 struct
266 unsigned TMR1ON : 1;
267 unsigned TMR1CS : 1;
268 unsigned NOT_T1SYNC : 1;
269 unsigned T1OSCEN : 1;
270 unsigned T1CKPS0 : 1;
271 unsigned T1CKPS1 : 1;
272 unsigned TMR1GE : 1;
273 unsigned : 1;
276 struct
278 unsigned : 1;
279 unsigned : 1;
280 unsigned T1INSYNC : 1;
281 unsigned : 1;
282 unsigned : 1;
283 unsigned : 1;
284 unsigned : 1;
285 unsigned : 1;
288 struct
290 unsigned : 4;
291 unsigned T1CKPS : 2;
292 unsigned : 2;
294 } __T1CONbits_t;
296 extern __at(0x0010) volatile __T1CONbits_t T1CONbits;
298 #define _TMR1ON 0x01
299 #define _TMR1CS 0x02
300 #define _NOT_T1SYNC 0x04
301 #define _T1INSYNC 0x04
302 #define _T1OSCEN 0x08
303 #define _T1CKPS0 0x10
304 #define _T1CKPS1 0x20
305 #define _TMR1GE 0x40
307 //==============================================================================
309 extern __at(0x001E) __sfr ADRES;
311 //==============================================================================
312 // ADCON0 Bits
314 extern __at(0x001F) __sfr ADCON0;
316 typedef union
318 struct
320 unsigned ADON : 1;
321 unsigned CHS3 : 1;
322 unsigned GO_NOT_DONE : 1;
323 unsigned CHS0 : 1;
324 unsigned CHS1 : 1;
325 unsigned CHS2 : 1;
326 unsigned ADCS0 : 1;
327 unsigned ADCS1 : 1;
330 struct
332 unsigned : 1;
333 unsigned : 1;
334 unsigned GO : 1;
335 unsigned : 1;
336 unsigned : 1;
337 unsigned : 1;
338 unsigned : 1;
339 unsigned : 1;
342 struct
344 unsigned : 1;
345 unsigned : 1;
346 unsigned NOT_DONE : 1;
347 unsigned : 1;
348 unsigned : 1;
349 unsigned : 1;
350 unsigned : 1;
351 unsigned : 1;
354 struct
356 unsigned : 1;
357 unsigned : 1;
358 unsigned GO_DONE : 1;
359 unsigned : 1;
360 unsigned : 1;
361 unsigned : 1;
362 unsigned : 1;
363 unsigned : 1;
366 struct
368 unsigned : 6;
369 unsigned ADCS : 2;
371 } __ADCON0bits_t;
373 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
375 #define _ADON 0x01
376 #define _CHS3 0x02
377 #define _GO_NOT_DONE 0x04
378 #define _GO 0x04
379 #define _NOT_DONE 0x04
380 #define _GO_DONE 0x04
381 #define _CHS0 0x08
382 #define _CHS1 0x10
383 #define _CHS2 0x20
384 #define _ADCS0 0x40
385 #define _ADCS1 0x80
387 //==============================================================================
390 //==============================================================================
391 // OPTION_REG Bits
393 extern __at(0x0081) __sfr OPTION_REG;
395 typedef union
397 struct
399 unsigned PS0 : 1;
400 unsigned PS1 : 1;
401 unsigned PS2 : 1;
402 unsigned PSA : 1;
403 unsigned T0SE : 1;
404 unsigned T0CS : 1;
405 unsigned INTEDG : 1;
406 unsigned NOT_RBPU : 1;
409 struct
411 unsigned PS : 3;
412 unsigned : 5;
414 } __OPTION_REGbits_t;
416 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
418 #define _PS0 0x01
419 #define _PS1 0x02
420 #define _PS2 0x04
421 #define _PSA 0x08
422 #define _T0SE 0x10
423 #define _T0CS 0x20
424 #define _INTEDG 0x40
425 #define _NOT_RBPU 0x80
427 //==============================================================================
430 //==============================================================================
431 // TRISA Bits
433 extern __at(0x0085) __sfr TRISA;
435 typedef struct
437 unsigned TRISA0 : 1;
438 unsigned TRISA1 : 1;
439 unsigned TRISA2 : 1;
440 unsigned TRISA3 : 1;
441 unsigned TRISA4 : 1;
442 unsigned TRISA5 : 1;
443 unsigned TRISA6 : 1;
444 unsigned TRISA7 : 1;
445 } __TRISAbits_t;
447 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
449 #define _TRISA0 0x01
450 #define _TRISA1 0x02
451 #define _TRISA2 0x04
452 #define _TRISA3 0x08
453 #define _TRISA4 0x10
454 #define _TRISA5 0x20
455 #define _TRISA6 0x40
456 #define _TRISA7 0x80
458 //==============================================================================
461 //==============================================================================
462 // TRISB Bits
464 extern __at(0x0086) __sfr TRISB;
466 typedef struct
468 unsigned TRISB0 : 1;
469 unsigned TRISB1 : 1;
470 unsigned TRISB2 : 1;
471 unsigned TRISB3 : 1;
472 unsigned TRISB4 : 1;
473 unsigned TRISB5 : 1;
474 unsigned TRISB6 : 1;
475 unsigned TRISB7 : 1;
476 } __TRISBbits_t;
478 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
480 #define _TRISB0 0x01
481 #define _TRISB1 0x02
482 #define _TRISB2 0x04
483 #define _TRISB3 0x08
484 #define _TRISB4 0x10
485 #define _TRISB5 0x20
486 #define _TRISB6 0x40
487 #define _TRISB7 0x80
489 //==============================================================================
492 //==============================================================================
493 // PIE1 Bits
495 extern __at(0x008C) __sfr PIE1;
497 typedef struct
499 unsigned TMR1IE : 1;
500 unsigned : 1;
501 unsigned : 1;
502 unsigned : 1;
503 unsigned C1IE : 1;
504 unsigned C2IE : 1;
505 unsigned ADIE : 1;
506 unsigned LVDIE : 1;
507 } __PIE1bits_t;
509 extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
511 #define _TMR1IE 0x01
512 #define _C1IE 0x10
513 #define _C2IE 0x20
514 #define _ADIE 0x40
515 #define _LVDIE 0x80
517 //==============================================================================
520 //==============================================================================
521 // PCON Bits
523 extern __at(0x008E) __sfr PCON;
525 typedef union
527 struct
529 unsigned NOT_BOR : 1;
530 unsigned NOT_POR : 1;
531 unsigned : 1;
532 unsigned OSCF : 1;
533 unsigned WDTON : 1;
534 unsigned : 1;
535 unsigned : 1;
536 unsigned : 1;
539 struct
541 unsigned NOT_BO : 1;
542 unsigned : 1;
543 unsigned : 1;
544 unsigned : 1;
545 unsigned : 1;
546 unsigned : 1;
547 unsigned : 1;
548 unsigned : 1;
550 } __PCONbits_t;
552 extern __at(0x008E) volatile __PCONbits_t PCONbits;
554 #define _NOT_BOR 0x01
555 #define _NOT_BO 0x01
556 #define _NOT_POR 0x02
557 #define _OSCF 0x08
558 #define _WDTON 0x10
560 //==============================================================================
563 //==============================================================================
564 // WPUB Bits
566 extern __at(0x0095) __sfr WPUB;
568 typedef struct
570 unsigned WPUB0 : 1;
571 unsigned WPUB1 : 1;
572 unsigned WPUB2 : 1;
573 unsigned WPUB3 : 1;
574 unsigned WPUB4 : 1;
575 unsigned WPUB5 : 1;
576 unsigned WPUB6 : 1;
577 unsigned WPUB7 : 1;
578 } __WPUBbits_t;
580 extern __at(0x0095) volatile __WPUBbits_t WPUBbits;
582 #define _WPUB0 0x01
583 #define _WPUB1 0x02
584 #define _WPUB2 0x04
585 #define _WPUB3 0x08
586 #define _WPUB4 0x10
587 #define _WPUB5 0x20
588 #define _WPUB6 0x40
589 #define _WPUB7 0x80
591 //==============================================================================
594 //==============================================================================
595 // IOCB Bits
597 extern __at(0x0096) __sfr IOCB;
599 typedef struct
601 unsigned IOCB0 : 1;
602 unsigned IOCB1 : 1;
603 unsigned IOCB2 : 1;
604 unsigned IOCB3 : 1;
605 unsigned IOCB4 : 1;
606 unsigned IOCB5 : 1;
607 unsigned IOCB6 : 1;
608 unsigned IOCB7 : 1;
609 } __IOCBbits_t;
611 extern __at(0x0096) volatile __IOCBbits_t IOCBbits;
613 #define _IOCB0 0x01
614 #define _IOCB1 0x02
615 #define _IOCB2 0x04
616 #define _IOCB3 0x08
617 #define _IOCB4 0x10
618 #define _IOCB5 0x20
619 #define _IOCB6 0x40
620 #define _IOCB7 0x80
622 //==============================================================================
625 //==============================================================================
626 // REFCON Bits
628 extern __at(0x009B) __sfr REFCON;
630 typedef union
632 struct
634 unsigned : 1;
635 unsigned : 1;
636 unsigned VROE : 1;
637 unsigned VREN : 1;
638 unsigned : 1;
639 unsigned : 1;
640 unsigned : 1;
641 unsigned : 1;
644 struct
646 unsigned : 1;
647 unsigned : 1;
648 unsigned VREFOE : 1;
649 unsigned VREFEN : 1;
650 unsigned : 1;
651 unsigned : 1;
652 unsigned : 1;
653 unsigned : 1;
655 } __REFCONbits_t;
657 extern __at(0x009B) volatile __REFCONbits_t REFCONbits;
659 #define _VROE 0x04
660 #define _VREFOE 0x04
661 #define _VREN 0x08
662 #define _VREFEN 0x08
664 //==============================================================================
667 //==============================================================================
668 // LVDCON Bits
670 extern __at(0x009C) __sfr LVDCON;
672 typedef union
674 struct
676 unsigned LV0 : 1;
677 unsigned LV1 : 1;
678 unsigned LV2 : 1;
679 unsigned LV3 : 1;
680 unsigned LVDEN : 1;
681 unsigned BGST : 1;
682 unsigned : 1;
683 unsigned : 1;
686 struct
688 unsigned LV : 4;
689 unsigned : 4;
691 } __LVDCONbits_t;
693 extern __at(0x009C) volatile __LVDCONbits_t LVDCONbits;
695 #define _LV0 0x01
696 #define _LV1 0x02
697 #define _LV2 0x04
698 #define _LV3 0x08
699 #define _LVDEN 0x10
700 #define _BGST 0x20
702 //==============================================================================
705 //==============================================================================
706 // ANSEL Bits
708 extern __at(0x009D) __sfr ANSEL;
710 typedef struct
712 unsigned ANS0 : 1;
713 unsigned ANS1 : 1;
714 unsigned ANS2 : 1;
715 unsigned ANS3 : 1;
716 unsigned ANS4 : 1;
717 unsigned ANS5 : 1;
718 unsigned ANS6 : 1;
719 unsigned ANS7 : 1;
720 } __ANSELbits_t;
722 extern __at(0x009D) volatile __ANSELbits_t ANSELbits;
724 #define _ANS0 0x01
725 #define _ANS1 0x02
726 #define _ANS2 0x04
727 #define _ANS3 0x08
728 #define _ANS4 0x10
729 #define _ANS5 0x20
730 #define _ANS6 0x40
731 #define _ANS7 0x80
733 //==============================================================================
736 //==============================================================================
737 // ADCON1 Bits
739 extern __at(0x009F) __sfr ADCON1;
741 typedef union
743 struct
745 unsigned : 1;
746 unsigned : 1;
747 unsigned : 1;
748 unsigned : 1;
749 unsigned VCFG0 : 1;
750 unsigned VCFG1 : 1;
751 unsigned : 1;
752 unsigned : 1;
755 struct
757 unsigned : 4;
758 unsigned VCFG : 2;
759 unsigned : 2;
761 } __ADCON1bits_t;
763 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
765 #define _VCFG0 0x10
766 #define _VCFG1 0x20
768 //==============================================================================
770 extern __at(0x010C) __sfr PMDATL;
771 extern __at(0x010D) __sfr PMADRL;
772 extern __at(0x010E) __sfr PMDATH;
773 extern __at(0x010F) __sfr PMADRH;
775 //==============================================================================
776 // CALCON Bits
778 extern __at(0x0110) __sfr CALCON;
780 typedef struct
782 unsigned : 1;
783 unsigned : 1;
784 unsigned : 1;
785 unsigned : 1;
786 unsigned : 1;
787 unsigned CALREF : 1;
788 unsigned CALERR : 1;
789 unsigned CAL : 1;
790 } __CALCONbits_t;
792 extern __at(0x0110) volatile __CALCONbits_t CALCONbits;
794 #define _CALREF 0x20
795 #define _CALERR 0x40
796 #define _CAL 0x80
798 //==============================================================================
801 //==============================================================================
802 // PSMCCON0 Bits
804 extern __at(0x0111) __sfr PSMCCON0;
806 typedef union
808 struct
810 unsigned DC0 : 1;
811 unsigned DC1 : 1;
812 unsigned MAXDC0 : 1;
813 unsigned MAXDC1 : 1;
814 unsigned MINDC0 : 1;
815 unsigned MINDC1 : 1;
816 unsigned SMCCL0 : 1;
817 unsigned SMCCL1 : 1;
820 struct
822 unsigned DC : 2;
823 unsigned : 6;
826 struct
828 unsigned : 2;
829 unsigned MAXDC : 2;
830 unsigned : 4;
833 struct
835 unsigned : 4;
836 unsigned MINDC : 2;
837 unsigned : 2;
840 struct
842 unsigned : 6;
843 unsigned SMCCL : 2;
845 } __PSMCCON0bits_t;
847 extern __at(0x0111) volatile __PSMCCON0bits_t PSMCCON0bits;
849 #define _DC0 0x01
850 #define _DC1 0x02
851 #define _MAXDC0 0x04
852 #define _MAXDC1 0x08
853 #define _MINDC0 0x10
854 #define _MINDC1 0x20
855 #define _SMCCL0 0x40
856 #define _SMCCL1 0x80
858 //==============================================================================
861 //==============================================================================
862 // PSMCCON1 Bits
864 extern __at(0x0112) __sfr PSMCCON1;
866 typedef union
868 struct
870 unsigned SMCCS : 1;
871 unsigned PWM_NOT_PSM : 1;
872 unsigned SMCOM : 1;
873 unsigned SCEN : 1;
874 unsigned : 1;
875 unsigned S1BPOL : 1;
876 unsigned S1APOL : 1;
877 unsigned SMCON : 1;
880 struct
882 unsigned : 1;
883 unsigned PWM : 1;
884 unsigned : 1;
885 unsigned : 1;
886 unsigned : 1;
887 unsigned : 1;
888 unsigned : 1;
889 unsigned : 1;
892 struct
894 unsigned : 1;
895 unsigned PSM : 1;
896 unsigned : 1;
897 unsigned : 1;
898 unsigned : 1;
899 unsigned : 1;
900 unsigned : 1;
901 unsigned : 1;
904 struct
906 unsigned : 1;
907 unsigned NOT_PSM : 1;
908 unsigned : 1;
909 unsigned : 1;
910 unsigned : 1;
911 unsigned : 1;
912 unsigned : 1;
913 unsigned : 1;
915 } __PSMCCON1bits_t;
917 extern __at(0x0112) volatile __PSMCCON1bits_t PSMCCON1bits;
919 #define _SMCCS 0x01
920 #define _PWM_NOT_PSM 0x02
921 #define _PWM 0x02
922 #define _PSM 0x02
923 #define _NOT_PSM 0x02
924 #define _SMCOM 0x04
925 #define _SCEN 0x08
926 #define _S1BPOL 0x20
927 #define _S1APOL 0x40
928 #define _SMCON 0x80
930 //==============================================================================
933 //==============================================================================
934 // CM1CON0 Bits
936 extern __at(0x0119) __sfr CM1CON0;
938 typedef union
940 struct
942 unsigned C1CH0 : 1;
943 unsigned C1CH1 : 1;
944 unsigned C1R : 1;
945 unsigned C1SP : 1;
946 unsigned C1POL : 1;
947 unsigned C1OE : 1;
948 unsigned C1OUT : 1;
949 unsigned C1ON : 1;
952 struct
954 unsigned C1CH : 2;
955 unsigned : 6;
957 } __CM1CON0bits_t;
959 extern __at(0x0119) volatile __CM1CON0bits_t CM1CON0bits;
961 #define _C1CH0 0x01
962 #define _C1CH1 0x02
963 #define _C1R 0x04
964 #define _C1SP 0x08
965 #define _C1POL 0x10
966 #define _C1OE 0x20
967 #define _C1OUT 0x40
968 #define _C1ON 0x80
970 //==============================================================================
973 //==============================================================================
974 // CM2CON0 Bits
976 extern __at(0x011A) __sfr CM2CON0;
978 typedef union
980 struct
982 unsigned C2CH0 : 1;
983 unsigned C2CH1 : 1;
984 unsigned C2R : 1;
985 unsigned C2SP : 1;
986 unsigned C2POL : 1;
987 unsigned C2OE : 1;
988 unsigned C2OUT : 1;
989 unsigned C2ON : 1;
992 struct
994 unsigned C2CH : 2;
995 unsigned : 6;
997 } __CM2CON0bits_t;
999 extern __at(0x011A) volatile __CM2CON0bits_t CM2CON0bits;
1001 #define _C2CH0 0x01
1002 #define _C2CH1 0x02
1003 #define _C2R 0x04
1004 #define _C2SP 0x08
1005 #define _C2POL 0x10
1006 #define _C2OE 0x20
1007 #define _C2OUT 0x40
1008 #define _C2ON 0x80
1010 //==============================================================================
1013 //==============================================================================
1014 // CM2CON1 Bits
1016 extern __at(0x011B) __sfr CM2CON1;
1018 typedef struct
1020 unsigned C2SYNC : 1;
1021 unsigned : 1;
1022 unsigned : 1;
1023 unsigned : 1;
1024 unsigned : 1;
1025 unsigned : 1;
1026 unsigned MC2OUT : 1;
1027 unsigned MC1OUT : 1;
1028 } __CM2CON1bits_t;
1030 extern __at(0x011B) volatile __CM2CON1bits_t CM2CON1bits;
1032 #define _C2SYNC 0x01
1033 #define _MC2OUT 0x40
1034 #define _MC1OUT 0x80
1036 //==============================================================================
1039 //==============================================================================
1040 // OPACON Bits
1042 extern __at(0x011C) __sfr OPACON;
1044 typedef struct
1046 unsigned GBWP : 1;
1047 unsigned : 1;
1048 unsigned : 1;
1049 unsigned : 1;
1050 unsigned : 1;
1051 unsigned : 1;
1052 unsigned CMPEN : 1;
1053 unsigned OPAON : 1;
1054 } __OPACONbits_t;
1056 extern __at(0x011C) volatile __OPACONbits_t OPACONbits;
1058 #define _GBWP 0x01
1059 #define _CMPEN 0x40
1060 #define _OPAON 0x80
1062 //==============================================================================
1065 //==============================================================================
1066 // DAC Bits
1068 extern __at(0x011E) __sfr DAC;
1070 typedef struct
1072 unsigned DA0 : 1;
1073 unsigned DA1 : 1;
1074 unsigned DA2 : 1;
1075 unsigned DA3 : 1;
1076 unsigned DA4 : 1;
1077 unsigned DA5 : 1;
1078 unsigned DA6 : 1;
1079 unsigned DA7 : 1;
1080 } __DACbits_t;
1082 extern __at(0x011E) volatile __DACbits_t DACbits;
1084 #define _DA0 0x01
1085 #define _DA1 0x02
1086 #define _DA2 0x04
1087 #define _DA3 0x08
1088 #define _DA4 0x10
1089 #define _DA5 0x20
1090 #define _DA6 0x40
1091 #define _DA7 0x80
1093 //==============================================================================
1096 //==============================================================================
1097 // DACON0 Bits
1099 extern __at(0x011F) __sfr DACON0;
1101 typedef union
1103 struct
1105 unsigned DARS0 : 1;
1106 unsigned DARS1 : 1;
1107 unsigned : 1;
1108 unsigned : 1;
1109 unsigned : 1;
1110 unsigned : 1;
1111 unsigned DAOE : 1;
1112 unsigned DAON : 1;
1115 struct
1117 unsigned DARS : 2;
1118 unsigned : 6;
1120 } __DACON0bits_t;
1122 extern __at(0x011F) volatile __DACON0bits_t DACON0bits;
1124 #define _DARS0 0x01
1125 #define _DARS1 0x02
1126 #define _DAOE 0x40
1127 #define _DAON 0x80
1129 //==============================================================================
1132 //==============================================================================
1133 // PMCON1 Bits
1135 extern __at(0x018C) __sfr PMCON1;
1137 typedef struct
1139 unsigned RD : 1;
1140 unsigned : 1;
1141 unsigned : 1;
1142 unsigned : 1;
1143 unsigned : 1;
1144 unsigned : 1;
1145 unsigned : 1;
1146 unsigned : 1;
1147 } __PMCON1bits_t;
1149 extern __at(0x018C) volatile __PMCON1bits_t PMCON1bits;
1151 #define _RD 0x01
1153 //==============================================================================
1156 //==============================================================================
1158 // Configuration Bits
1160 //==============================================================================
1162 #define _CONFIG1 0x2007
1164 //----------------------------- CONFIG1 Options -------------------------------
1166 #define _FOSC_LP 0x3FF8 // LP oscillator.
1167 #define _LP_OSC 0x3FF8 // LP oscillator.
1168 #define _FOSC_XT 0x3FF9 // XT oscillator.
1169 #define _XT_OSC 0x3FF9 // XT oscillator.
1170 #define _FOSC_HS 0x3FFA // HS oscillator.
1171 #define _HS_OSC 0x3FFA // HS oscillator.
1172 #define _FOSC_EXTCLK 0x3FFB // EC I/O.
1173 #define _EXTCLK_OSC 0x3FFB // EC I/O.
1174 #define _FOSC_INTRCIO 0x3FFC // INTRC, OSC2 is I/O.
1175 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTRC, OSC2 is I/O.
1176 #define _FOSC_INTRCCLK 0x3FFD // INTRC, clockout on OSC2.
1177 #define _INTRC_OSC_CLKOUT 0x3FFD // INTRC, clockout on OSC2.
1178 #define _FOSC_ER_NOCLKOUT 0x3FFE // RC I/O.
1179 #define _ER_OSC_NOCLKOUT 0x3FFE // RC I/O.
1180 #define _FOSC_ER_CLKOUT 0x3FFF // RC CLKOUT.
1181 #define _ER_OSC_CLKOUT 0x3FFF // RC CLKOUT.
1182 #define _WDTE_OFF 0x3FF7 // WDT disabled.
1183 #define _WDT_OFF 0x3FF7 // WDT disabled.
1184 #define _WDTE_ON 0x3FFF // WDT enabled.
1185 #define _WDT_ON 0x3FFF // WDT enabled.
1186 #define _PWRTE_ON 0x3FEF // PWRT enabled.
1187 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
1188 #define _MCLRE_OFF 0x3FDF // Internal.
1189 #define _MCLRE_ON 0x3FFF // External.
1190 #define _BOREN_OFF 0x3FBF // BOR disabled.
1191 #define _BODEN_OFF 0x3FBF // BOR disabled.
1192 #define _BOREN_ON 0x3FFF // BOR enabled.
1193 #define _BODEN_ON 0x3FFF // BOR enabled.
1194 #define _CP_ALL 0x0CFF // All memory is code protected.
1195 #define _CP_OFF 0x3FFF // Code protection off.
1196 #define _BODENV_45 0x33FF // VBOR set to 4.5V.
1197 #define _VBOR_45 0x33FF // VBOR set to 4.5V.
1198 #define _BODENV_42 0x37FF // VBOR set to 4.2V.
1199 #define _VBOR_42 0x37FF // VBOR set to 4.2V.
1200 #define _BODENV_27 0x3BFF // VBOR set to 2.7V.
1201 #define _VBOR_27 0x3BFF // VBOR set to 2.7V.
1202 #define _BODENV_25 0x3FFF // VBOR set to 2.5V.
1203 #define _VBOR_25 0x3FFF // VBOR set to 2.5V.
1205 //==============================================================================
1207 #define _IDLOC0 0x2000
1208 #define _IDLOC1 0x2001
1209 #define _IDLOC2 0x2002
1210 #define _IDLOC3 0x2003
1212 //==============================================================================
1214 #ifndef NO_BIT_DEFINES
1216 #define ADON ADCON0bits.ADON // bit 0
1217 #define CHS3 ADCON0bits.CHS3 // bit 1
1218 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
1219 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
1220 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
1221 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
1222 #define CHS0 ADCON0bits.CHS0 // bit 3
1223 #define CHS1 ADCON0bits.CHS1 // bit 4
1224 #define CHS2 ADCON0bits.CHS2 // bit 5
1225 #define ADCS0 ADCON0bits.ADCS0 // bit 6
1226 #define ADCS1 ADCON0bits.ADCS1 // bit 7
1228 #define VCFG0 ADCON1bits.VCFG0 // bit 4
1229 #define VCFG1 ADCON1bits.VCFG1 // bit 5
1231 #define ANS0 ANSELbits.ANS0 // bit 0
1232 #define ANS1 ANSELbits.ANS1 // bit 1
1233 #define ANS2 ANSELbits.ANS2 // bit 2
1234 #define ANS3 ANSELbits.ANS3 // bit 3
1235 #define ANS4 ANSELbits.ANS4 // bit 4
1236 #define ANS5 ANSELbits.ANS5 // bit 5
1237 #define ANS6 ANSELbits.ANS6 // bit 6
1238 #define ANS7 ANSELbits.ANS7 // bit 7
1240 #define CALREF CALCONbits.CALREF // bit 5
1241 #define CALERR CALCONbits.CALERR // bit 6
1242 #define CAL CALCONbits.CAL // bit 7
1244 #define C1CH0 CM1CON0bits.C1CH0 // bit 0
1245 #define C1CH1 CM1CON0bits.C1CH1 // bit 1
1246 #define C1R CM1CON0bits.C1R // bit 2
1247 #define C1SP CM1CON0bits.C1SP // bit 3
1248 #define C1POL CM1CON0bits.C1POL // bit 4
1249 #define C1OE CM1CON0bits.C1OE // bit 5
1250 #define C1OUT CM1CON0bits.C1OUT // bit 6
1251 #define C1ON CM1CON0bits.C1ON // bit 7
1253 #define C2CH0 CM2CON0bits.C2CH0 // bit 0
1254 #define C2CH1 CM2CON0bits.C2CH1 // bit 1
1255 #define C2R CM2CON0bits.C2R // bit 2
1256 #define C2SP CM2CON0bits.C2SP // bit 3
1257 #define C2POL CM2CON0bits.C2POL // bit 4
1258 #define C2OE CM2CON0bits.C2OE // bit 5
1259 #define C2OUT CM2CON0bits.C2OUT // bit 6
1260 #define C2ON CM2CON0bits.C2ON // bit 7
1262 #define C2SYNC CM2CON1bits.C2SYNC // bit 0
1263 #define MC2OUT CM2CON1bits.MC2OUT // bit 6
1264 #define MC1OUT CM2CON1bits.MC1OUT // bit 7
1266 #define DA0 DACbits.DA0 // bit 0
1267 #define DA1 DACbits.DA1 // bit 1
1268 #define DA2 DACbits.DA2 // bit 2
1269 #define DA3 DACbits.DA3 // bit 3
1270 #define DA4 DACbits.DA4 // bit 4
1271 #define DA5 DACbits.DA5 // bit 5
1272 #define DA6 DACbits.DA6 // bit 6
1273 #define DA7 DACbits.DA7 // bit 7
1275 #define DARS0 DACON0bits.DARS0 // bit 0
1276 #define DARS1 DACON0bits.DARS1 // bit 1
1277 #define DAOE DACON0bits.DAOE // bit 6
1278 #define DAON DACON0bits.DAON // bit 7
1280 #define RBIF INTCONbits.RBIF // bit 0
1281 #define INTF INTCONbits.INTF // bit 1
1282 #define T0IF INTCONbits.T0IF // bit 2
1283 #define RBIE INTCONbits.RBIE // bit 3
1284 #define INTE INTCONbits.INTE // bit 4
1285 #define T0IE INTCONbits.T0IE // bit 5
1286 #define PEIE INTCONbits.PEIE // bit 6
1287 #define GIE INTCONbits.GIE // bit 7
1289 #define IOCB0 IOCBbits.IOCB0 // bit 0
1290 #define IOCB1 IOCBbits.IOCB1 // bit 1
1291 #define IOCB2 IOCBbits.IOCB2 // bit 2
1292 #define IOCB3 IOCBbits.IOCB3 // bit 3
1293 #define IOCB4 IOCBbits.IOCB4 // bit 4
1294 #define IOCB5 IOCBbits.IOCB5 // bit 5
1295 #define IOCB6 IOCBbits.IOCB6 // bit 6
1296 #define IOCB7 IOCBbits.IOCB7 // bit 7
1298 #define LV0 LVDCONbits.LV0 // bit 0
1299 #define LV1 LVDCONbits.LV1 // bit 1
1300 #define LV2 LVDCONbits.LV2 // bit 2
1301 #define LV3 LVDCONbits.LV3 // bit 3
1302 #define LVDEN LVDCONbits.LVDEN // bit 4
1303 #define BGST LVDCONbits.BGST // bit 5
1305 #define GBWP OPACONbits.GBWP // bit 0
1306 #define CMPEN OPACONbits.CMPEN // bit 6
1307 #define OPAON OPACONbits.OPAON // bit 7
1309 #define PS0 OPTION_REGbits.PS0 // bit 0
1310 #define PS1 OPTION_REGbits.PS1 // bit 1
1311 #define PS2 OPTION_REGbits.PS2 // bit 2
1312 #define PSA OPTION_REGbits.PSA // bit 3
1313 #define T0SE OPTION_REGbits.T0SE // bit 4
1314 #define T0CS OPTION_REGbits.T0CS // bit 5
1315 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1316 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
1318 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1319 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits
1320 #define NOT_POR PCONbits.NOT_POR // bit 1
1321 #define OSCF PCONbits.OSCF // bit 3
1322 #define WDTON PCONbits.WDTON // bit 4
1324 #define TMR1IE PIE1bits.TMR1IE // bit 0
1325 #define C1IE PIE1bits.C1IE // bit 4
1326 #define C2IE PIE1bits.C2IE // bit 5
1327 #define ADIE PIE1bits.ADIE // bit 6
1328 #define LVDIE PIE1bits.LVDIE // bit 7
1330 #define TMR1IF PIR1bits.TMR1IF // bit 0
1331 #define C1IF PIR1bits.C1IF // bit 4
1332 #define C2IF PIR1bits.C2IF // bit 5
1333 #define ADIF PIR1bits.ADIF // bit 6
1334 #define LVDIF PIR1bits.LVDIF // bit 7
1336 #define RD PMCON1bits.RD // bit 0
1338 #define RA0 PORTAbits.RA0 // bit 0
1339 #define RA1 PORTAbits.RA1 // bit 1
1340 #define RA2 PORTAbits.RA2 // bit 2
1341 #define RA3 PORTAbits.RA3 // bit 3
1342 #define RA4 PORTAbits.RA4 // bit 4
1343 #define RA5 PORTAbits.RA5 // bit 5
1344 #define RA6 PORTAbits.RA6 // bit 6
1345 #define RA7 PORTAbits.RA7 // bit 7
1347 #define RB0 PORTBbits.RB0 // bit 0
1348 #define RB1 PORTBbits.RB1 // bit 1
1349 #define RB2 PORTBbits.RB2 // bit 2
1350 #define RB3 PORTBbits.RB3 // bit 3
1351 #define RB4 PORTBbits.RB4 // bit 4
1352 #define RB5 PORTBbits.RB5 // bit 5
1353 #define RB6 PORTBbits.RB6 // bit 6
1354 #define RB7 PORTBbits.RB7 // bit 7
1356 #define DC0 PSMCCON0bits.DC0 // bit 0
1357 #define DC1 PSMCCON0bits.DC1 // bit 1
1358 #define MAXDC0 PSMCCON0bits.MAXDC0 // bit 2
1359 #define MAXDC1 PSMCCON0bits.MAXDC1 // bit 3
1360 #define MINDC0 PSMCCON0bits.MINDC0 // bit 4
1361 #define MINDC1 PSMCCON0bits.MINDC1 // bit 5
1362 #define SMCCL0 PSMCCON0bits.SMCCL0 // bit 6
1363 #define SMCCL1 PSMCCON0bits.SMCCL1 // bit 7
1365 #define SMCCS PSMCCON1bits.SMCCS // bit 0
1366 #define PWM_NOT_PSM PSMCCON1bits.PWM_NOT_PSM // bit 1, shadows bit in PSMCCON1bits
1367 #define PWM PSMCCON1bits.PWM // bit 1, shadows bit in PSMCCON1bits
1368 #define PSM PSMCCON1bits.PSM // bit 1, shadows bit in PSMCCON1bits
1369 #define NOT_PSM PSMCCON1bits.NOT_PSM // bit 1, shadows bit in PSMCCON1bits
1370 #define SMCOM PSMCCON1bits.SMCOM // bit 2
1371 #define SCEN PSMCCON1bits.SCEN // bit 3
1372 #define S1BPOL PSMCCON1bits.S1BPOL // bit 5
1373 #define S1APOL PSMCCON1bits.S1APOL // bit 6
1374 #define SMCON PSMCCON1bits.SMCON // bit 7
1376 #define VROE REFCONbits.VROE // bit 2, shadows bit in REFCONbits
1377 #define VREFOE REFCONbits.VREFOE // bit 2, shadows bit in REFCONbits
1378 #define VREN REFCONbits.VREN // bit 3, shadows bit in REFCONbits
1379 #define VREFEN REFCONbits.VREFEN // bit 3, shadows bit in REFCONbits
1381 #define C STATUSbits.C // bit 0
1382 #define DC STATUSbits.DC // bit 1
1383 #define Z STATUSbits.Z // bit 2
1384 #define NOT_PD STATUSbits.NOT_PD // bit 3
1385 #define NOT_TO STATUSbits.NOT_TO // bit 4
1386 #define RP0 STATUSbits.RP0 // bit 5
1387 #define RP1 STATUSbits.RP1 // bit 6
1388 #define IRP STATUSbits.IRP // bit 7
1390 #define TMR1ON T1CONbits.TMR1ON // bit 0
1391 #define TMR1CS T1CONbits.TMR1CS // bit 1
1392 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits
1393 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits
1394 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1395 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1396 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1397 #define TMR1GE T1CONbits.TMR1GE // bit 6
1399 #define TRISA0 TRISAbits.TRISA0 // bit 0
1400 #define TRISA1 TRISAbits.TRISA1 // bit 1
1401 #define TRISA2 TRISAbits.TRISA2 // bit 2
1402 #define TRISA3 TRISAbits.TRISA3 // bit 3
1403 #define TRISA4 TRISAbits.TRISA4 // bit 4
1404 #define TRISA5 TRISAbits.TRISA5 // bit 5
1405 #define TRISA6 TRISAbits.TRISA6 // bit 6
1406 #define TRISA7 TRISAbits.TRISA7 // bit 7
1408 #define TRISB0 TRISBbits.TRISB0 // bit 0
1409 #define TRISB1 TRISBbits.TRISB1 // bit 1
1410 #define TRISB2 TRISBbits.TRISB2 // bit 2
1411 #define TRISB3 TRISBbits.TRISB3 // bit 3
1412 #define TRISB4 TRISBbits.TRISB4 // bit 4
1413 #define TRISB5 TRISBbits.TRISB5 // bit 5
1414 #define TRISB6 TRISBbits.TRISB6 // bit 6
1415 #define TRISB7 TRISBbits.TRISB7 // bit 7
1417 #define WPUB0 WPUBbits.WPUB0 // bit 0
1418 #define WPUB1 WPUBbits.WPUB1 // bit 1
1419 #define WPUB2 WPUBbits.WPUB2 // bit 2
1420 #define WPUB3 WPUBbits.WPUB3 // bit 3
1421 #define WPUB4 WPUBbits.WPUB4 // bit 4
1422 #define WPUB5 WPUBbits.WPUB5 // bit 5
1423 #define WPUB6 WPUBbits.WPUB6 // bit 6
1424 #define WPUB7 WPUBbits.WPUB7 // bit 7
1426 #endif // #ifndef NO_BIT_DEFINES
1428 #endif // #ifndef __PIC16C782_H__