2 * This declarations of the PIC12F675 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:04 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 __PIC12F675_H__
26 #define __PIC12F675_H__
28 //==============================================================================
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 GPIO_ADDR 0x0005
42 #define PCLATH_ADDR 0x000A
43 #define INTCON_ADDR 0x000B
44 #define PIR1_ADDR 0x000C
45 #define TMR1_ADDR 0x000E
46 #define TMR1L_ADDR 0x000E
47 #define TMR1H_ADDR 0x000F
48 #define T1CON_ADDR 0x0010
49 #define CMCON_ADDR 0x0019
50 #define ADRESH_ADDR 0x001E
51 #define ADCON0_ADDR 0x001F
52 #define OPTION_REG_ADDR 0x0081
53 #define TRISIO_ADDR 0x0085
54 #define PIE1_ADDR 0x008C
55 #define PCON_ADDR 0x008E
56 #define OSCCAL_ADDR 0x0090
57 #define WPU_ADDR 0x0095
58 #define IOC_ADDR 0x0096
59 #define IOCB_ADDR 0x0096
60 #define VRCON_ADDR 0x0099
61 #define EEDAT_ADDR 0x009A
62 #define EEDATA_ADDR 0x009A
63 #define EEADR_ADDR 0x009B
64 #define EECON1_ADDR 0x009C
65 #define EECON2_ADDR 0x009D
66 #define ADRESL_ADDR 0x009E
67 #define ANSEL_ADDR 0x009F
69 #endif // #ifndef NO_ADDR_DEFINES
71 //==============================================================================
73 // Register Definitions
75 //==============================================================================
77 extern __at(0x0000) __sfr INDF
;
78 extern __at(0x0001) __sfr TMR0
;
79 extern __at(0x0002) __sfr PCL
;
81 //==============================================================================
84 extern __at(0x0003) __sfr STATUS
;
108 extern __at(0x0003) volatile __STATUSbits_t STATUSbits
;
119 //==============================================================================
121 extern __at(0x0004) __sfr FSR
;
123 //==============================================================================
126 extern __at(0x0005) __sfr GPIO
;
167 extern __at(0x0005) volatile __GPIObits_t GPIObits
;
182 //==============================================================================
184 extern __at(0x000A) __sfr PCLATH
;
186 //==============================================================================
189 extern __at(0x000B) __sfr INTCON
;
218 extern __at(0x000B) volatile __INTCONbits_t INTCONbits
;
231 //==============================================================================
234 //==============================================================================
237 extern __at(0x000C) __sfr PIR1
;
266 extern __at(0x000C) volatile __PIR1bits_t PIR1bits
;
274 //==============================================================================
276 extern __at(0x000E) __sfr TMR1
;
277 extern __at(0x000E) __sfr TMR1L
;
278 extern __at(0x000F) __sfr TMR1H
;
280 //==============================================================================
283 extern __at(0x0010) __sfr T1CON
;
291 unsigned NOT_T1SYNC
: 1;
292 unsigned T1OSCEN
: 1;
293 unsigned T1CKPS0
: 1;
294 unsigned T1CKPS1
: 1;
307 extern __at(0x0010) volatile __T1CONbits_t T1CONbits
;
311 #define _NOT_T1SYNC 0x04
312 #define _T1OSCEN 0x08
313 #define _T1CKPS0 0x10
314 #define _T1CKPS1 0x20
317 //==============================================================================
320 //==============================================================================
323 extern __at(0x0019) __sfr CMCON
;
346 extern __at(0x0019) volatile __CMCONbits_t CMCONbits
;
355 //==============================================================================
357 extern __at(0x001E) __sfr ADRESH
;
359 //==============================================================================
362 extern __at(0x001F) __sfr ADCON0
;
369 unsigned GO_NOT_DONE
: 1;
381 unsigned GO_DONE
: 1;
393 unsigned NOT_DONE
: 1;
422 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits
;
425 #define _GO_NOT_DONE 0x02
426 #define _GO_DONE 0x02
427 #define _NOT_DONE 0x02
434 //==============================================================================
437 //==============================================================================
440 extern __at(0x0081) __sfr OPTION_REG
;
453 unsigned NOT_GPPU
: 1;
461 } __OPTION_REGbits_t
;
463 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits
;
472 #define _NOT_GPPU 0x80
474 //==============================================================================
477 //==============================================================================
480 extern __at(0x0085) __sfr TRISIO
;
486 unsigned TRISIO0
: 1;
487 unsigned TRISIO1
: 1;
488 unsigned TRISIO2
: 1;
489 unsigned TRISIO3
: 1;
490 unsigned TRISIO4
: 1;
491 unsigned TRISIO5
: 1;
503 extern __at(0x0085) volatile __TRISIObits_t TRISIObits
;
505 #define _TRISIO0 0x01
506 #define _TRISIO1 0x02
507 #define _TRISIO2 0x04
508 #define _TRISIO3 0x08
509 #define _TRISIO4 0x10
510 #define _TRISIO5 0x20
512 //==============================================================================
515 //==============================================================================
518 extern __at(0x008C) __sfr PIE1
;
547 extern __at(0x008C) volatile __PIE1bits_t PIE1bits
;
555 //==============================================================================
558 //==============================================================================
561 extern __at(0x008E) __sfr PCON
;
567 unsigned NOT_BOR
: 1;
568 unsigned NOT_POR
: 1;
579 unsigned NOT_BOD
: 1;
590 extern __at(0x008E) volatile __PCONbits_t PCONbits
;
592 #define _NOT_BOR 0x01
593 #define _NOT_BOD 0x01
594 #define _NOT_POR 0x02
596 //==============================================================================
599 //==============================================================================
602 extern __at(0x0090) __sfr OSCCAL
;
625 extern __at(0x0090) volatile __OSCCALbits_t OSCCALbits
;
634 //==============================================================================
637 //==============================================================================
640 extern __at(0x0095) __sfr WPU
;
654 extern __at(0x0095) volatile __WPUbits_t WPUbits
;
662 //==============================================================================
665 //==============================================================================
668 extern __at(0x0096) __sfr IOC
;
709 extern __at(0x0096) volatile __IOCbits_t IOCbits
;
724 //==============================================================================
727 //==============================================================================
730 extern __at(0x0096) __sfr IOCB
;
771 extern __at(0x0096) volatile __IOCBbits_t IOCBbits
;
773 #define _IOCB_IOC0 0x01
774 #define _IOCB_IOCB0 0x01
775 #define _IOCB_IOC1 0x02
776 #define _IOCB_IOCB1 0x02
777 #define _IOCB_IOC2 0x04
778 #define _IOCB_IOCB2 0x04
779 #define _IOCB_IOC3 0x08
780 #define _IOCB_IOCB3 0x08
781 #define _IOCB_IOC4 0x10
782 #define _IOCB_IOCB4 0x10
783 #define _IOCB_IOC5 0x20
784 #define _IOCB_IOCB5 0x20
786 //==============================================================================
789 //==============================================================================
792 extern __at(0x0099) __sfr VRCON
;
815 extern __at(0x0099) volatile __VRCONbits_t VRCONbits
;
824 //==============================================================================
826 extern __at(0x009A) __sfr EEDAT
;
827 extern __at(0x009A) __sfr EEDATA
;
828 extern __at(0x009B) __sfr EEADR
;
830 //==============================================================================
833 extern __at(0x009C) __sfr EECON1
;
847 extern __at(0x009C) volatile __EECON1bits_t EECON1bits
;
854 //==============================================================================
856 extern __at(0x009D) __sfr EECON2
;
857 extern __at(0x009E) __sfr ADRESL
;
859 //==============================================================================
862 extern __at(0x009F) __sfr ANSEL
;
892 extern __at(0x009F) volatile __ANSELbits_t ANSELbits
;
902 //==============================================================================
905 //==============================================================================
907 // Configuration Bits
909 //==============================================================================
911 #define _CONFIG 0x2007
913 //----------------------------- CONFIG Options -------------------------------
915 #define _FOSC_LP 0x3FF8 // LP oscillator: Low power crystal on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
916 #define _LP_OSC 0x3FF8 // LP oscillator: Low power crystal on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
917 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
918 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
919 #define _FOSC_HS 0x3FFA // HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
920 #define _HS_OSC 0x3FFA // HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
921 #define _FOSC_EC 0x3FFB // EC: I/O function on GP4/OSC2/CLKOUT pin, CLKIN on GP5/OSC1/CLKIN.
922 #define _EC_OSC 0x3FFB // EC: I/O function on GP4/OSC2/CLKOUT pin, CLKIN on GP5/OSC1/CLKIN.
923 #define _FOSC_INTRCIO 0x3FFC // INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
924 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
925 #define _FOSC_INTRCCLK 0x3FFD // INTOSC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
926 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
927 #define _FOSC_EXTRCIO 0x3FFE // RC oscillator: I/O function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
928 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RC oscillator: I/O function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
929 #define _FOSC_EXTRCCLK 0x3FFF // RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
930 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
931 #define _WDTE_OFF 0x3FF7 // WDT disabled.
932 #define _WDT_OFF 0x3FF7 // WDT disabled.
933 #define _WDTE_ON 0x3FFF // WDT enabled.
934 #define _WDT_ON 0x3FFF // WDT enabled.
935 #define _PWRTE_ON 0x3FEF // PWRT enabled.
936 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
937 #define _MCLRE_OFF 0x3FDF // GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD.
938 #define _MCLRE_ON 0x3FFF // GP3/MCLR pin function is MCLR.
939 #define _BOREN_OFF 0x3FBF // BOD disabled.
940 #define _BODEN_OFF 0x3FBF // BOD disabled.
941 #define _BOREN_ON 0x3FFF // BOD enabled.
942 #define _BODEN_ON 0x3FFF // BOD enabled.
943 #define _CP_ON 0x3F7F // Program Memory code protection is enabled.
944 #define _CP_OFF 0x3FFF // Program Memory code protection is disabled.
945 #define _CPD_ON 0x3EFF // Data memory code protection is enabled.
946 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
948 //==============================================================================
950 #define _DEVID1 0x2006
952 #define _IDLOC0 0x2000
953 #define _IDLOC1 0x2001
954 #define _IDLOC2 0x2002
955 #define _IDLOC3 0x2003
957 //==============================================================================
959 #ifndef NO_BIT_DEFINES
961 #define ADON ADCON0bits.ADON // bit 0
962 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 1, shadows bit in ADCON0bits
963 #define GO_DONE ADCON0bits.GO_DONE // bit 1, shadows bit in ADCON0bits
964 #define NOT_DONE ADCON0bits.NOT_DONE // bit 1, shadows bit in ADCON0bits
965 #define GO ADCON0bits.GO // bit 1, shadows bit in ADCON0bits
966 #define CHS0 ADCON0bits.CHS0 // bit 2
967 #define CHS1 ADCON0bits.CHS1 // bit 3
968 #define VCFG ADCON0bits.VCFG // bit 6
969 #define ADFM ADCON0bits.ADFM // bit 7
971 #define ANS0 ANSELbits.ANS0 // bit 0
972 #define ANS1 ANSELbits.ANS1 // bit 1
973 #define ANS2 ANSELbits.ANS2 // bit 2
974 #define ANS3 ANSELbits.ANS3 // bit 3
975 #define ADCS0 ANSELbits.ADCS0 // bit 4
976 #define ADCS1 ANSELbits.ADCS1 // bit 5
977 #define ADCS2 ANSELbits.ADCS2 // bit 6
979 #define CM0 CMCONbits.CM0 // bit 0
980 #define CM1 CMCONbits.CM1 // bit 1
981 #define CM2 CMCONbits.CM2 // bit 2
982 #define CIS CMCONbits.CIS // bit 3
983 #define CINV CMCONbits.CINV // bit 4
984 #define COUT CMCONbits.COUT // bit 6
986 #define RD EECON1bits.RD // bit 0
987 #define WR EECON1bits.WR // bit 1
988 #define WREN EECON1bits.WREN // bit 2
989 #define WRERR EECON1bits.WRERR // bit 3
991 #define GP0 GPIObits.GP0 // bit 0, shadows bit in GPIObits
992 #define GPIO0 GPIObits.GPIO0 // bit 0, shadows bit in GPIObits
993 #define GP1 GPIObits.GP1 // bit 1, shadows bit in GPIObits
994 #define GPIO1 GPIObits.GPIO1 // bit 1, shadows bit in GPIObits
995 #define GP2 GPIObits.GP2 // bit 2, shadows bit in GPIObits
996 #define GPIO2 GPIObits.GPIO2 // bit 2, shadows bit in GPIObits
997 #define GP3 GPIObits.GP3 // bit 3, shadows bit in GPIObits
998 #define GPIO3 GPIObits.GPIO3 // bit 3, shadows bit in GPIObits
999 #define GP4 GPIObits.GP4 // bit 4, shadows bit in GPIObits
1000 #define GPIO4 GPIObits.GPIO4 // bit 4, shadows bit in GPIObits
1001 #define GP5 GPIObits.GP5 // bit 5, shadows bit in GPIObits
1002 #define GPIO5 GPIObits.GPIO5 // bit 5, shadows bit in GPIObits
1004 #define GPIF INTCONbits.GPIF // bit 0
1005 #define INTF INTCONbits.INTF // bit 1
1006 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
1007 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
1008 #define GPIE INTCONbits.GPIE // bit 3
1009 #define INTE INTCONbits.INTE // bit 4
1010 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
1011 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
1012 #define PEIE INTCONbits.PEIE // bit 6
1013 #define GIE INTCONbits.GIE // bit 7
1015 #define IOC0 IOCbits.IOC0 // bit 0, shadows bit in IOCbits
1016 #define IOCB0 IOCbits.IOCB0 // bit 0, shadows bit in IOCbits
1017 #define IOC1 IOCbits.IOC1 // bit 1, shadows bit in IOCbits
1018 #define IOCB1 IOCbits.IOCB1 // bit 1, shadows bit in IOCbits
1019 #define IOC2 IOCbits.IOC2 // bit 2, shadows bit in IOCbits
1020 #define IOCB2 IOCbits.IOCB2 // bit 2, shadows bit in IOCbits
1021 #define IOC3 IOCbits.IOC3 // bit 3, shadows bit in IOCbits
1022 #define IOCB3 IOCbits.IOCB3 // bit 3, shadows bit in IOCbits
1023 #define IOC4 IOCbits.IOC4 // bit 4, shadows bit in IOCbits
1024 #define IOCB4 IOCbits.IOCB4 // bit 4, shadows bit in IOCbits
1025 #define IOC5 IOCbits.IOC5 // bit 5, shadows bit in IOCbits
1026 #define IOCB5 IOCbits.IOCB5 // bit 5, shadows bit in IOCbits
1028 #define PS0 OPTION_REGbits.PS0 // bit 0
1029 #define PS1 OPTION_REGbits.PS1 // bit 1
1030 #define PS2 OPTION_REGbits.PS2 // bit 2
1031 #define PSA OPTION_REGbits.PSA // bit 3
1032 #define T0SE OPTION_REGbits.T0SE // bit 4
1033 #define T0CS OPTION_REGbits.T0CS // bit 5
1034 #define INTEDG OPTION_REGbits.INTEDG // bit 6
1035 #define NOT_GPPU OPTION_REGbits.NOT_GPPU // bit 7
1037 #define CAL0 OSCCALbits.CAL0 // bit 2
1038 #define CAL1 OSCCALbits.CAL1 // bit 3
1039 #define CAL2 OSCCALbits.CAL2 // bit 4
1040 #define CAL3 OSCCALbits.CAL3 // bit 5
1041 #define CAL4 OSCCALbits.CAL4 // bit 6
1042 #define CAL5 OSCCALbits.CAL5 // bit 7
1044 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
1045 #define NOT_BOD PCONbits.NOT_BOD // bit 0, shadows bit in PCONbits
1046 #define NOT_POR PCONbits.NOT_POR // bit 1
1048 #define TMR1IE PIE1bits.TMR1IE // bit 0, shadows bit in PIE1bits
1049 #define T1IE PIE1bits.T1IE // bit 0, shadows bit in PIE1bits
1050 #define CMIE PIE1bits.CMIE // bit 3
1051 #define ADIE PIE1bits.ADIE // bit 6
1052 #define EEIE PIE1bits.EEIE // bit 7
1054 #define TMR1IF PIR1bits.TMR1IF // bit 0, shadows bit in PIR1bits
1055 #define T1IF PIR1bits.T1IF // bit 0, shadows bit in PIR1bits
1056 #define CMIF PIR1bits.CMIF // bit 3
1057 #define ADIF PIR1bits.ADIF // bit 6
1058 #define EEIF PIR1bits.EEIF // bit 7
1060 #define C STATUSbits.C // bit 0
1061 #define DC STATUSbits.DC // bit 1
1062 #define Z STATUSbits.Z // bit 2
1063 #define NOT_PD STATUSbits.NOT_PD // bit 3
1064 #define NOT_TO STATUSbits.NOT_TO // bit 4
1065 #define RP0 STATUSbits.RP0 // bit 5
1066 #define RP1 STATUSbits.RP1 // bit 6
1067 #define IRP STATUSbits.IRP // bit 7
1069 #define TMR1ON T1CONbits.TMR1ON // bit 0
1070 #define TMR1CS T1CONbits.TMR1CS // bit 1
1071 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
1072 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
1073 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
1074 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
1075 #define TMR1GE T1CONbits.TMR1GE // bit 6
1077 #define TRISIO0 TRISIObits.TRISIO0 // bit 0
1078 #define TRISIO1 TRISIObits.TRISIO1 // bit 1
1079 #define TRISIO2 TRISIObits.TRISIO2 // bit 2
1080 #define TRISIO3 TRISIObits.TRISIO3 // bit 3
1081 #define TRISIO4 TRISIObits.TRISIO4 // bit 4
1082 #define TRISIO5 TRISIObits.TRISIO5 // bit 5
1084 #define VR0 VRCONbits.VR0 // bit 0
1085 #define VR1 VRCONbits.VR1 // bit 1
1086 #define VR2 VRCONbits.VR2 // bit 2
1087 #define VR3 VRCONbits.VR3 // bit 3
1088 #define VRR VRCONbits.VRR // bit 5
1089 #define VREN VRCONbits.VREN // bit 7
1091 #define WPU0 WPUbits.WPU0 // bit 0
1092 #define WPU1 WPUbits.WPU1 // bit 1
1093 #define WPU2 WPUbits.WPU2 // bit 2
1094 #define WPU4 WPUbits.WPU4 // bit 4
1095 #define WPU5 WPUbits.WPU5 // bit 5
1097 #endif // #ifndef NO_BIT_DEFINES
1099 #endif // #ifndef __PIC12F675_H__