2 * This declarations of the PIC12F629 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 __PIC12F629_H__
26 #define __PIC12F629_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 OPTION_REG_ADDR 0x0081
51 #define TRISIO_ADDR 0x0085
52 #define PIE1_ADDR 0x008C
53 #define PCON_ADDR 0x008E
54 #define OSCCAL_ADDR 0x0090
55 #define WPU_ADDR 0x0095
56 #define IOC_ADDR 0x0096
57 #define IOCB_ADDR 0x0096
58 #define VRCON_ADDR 0x0099
59 #define EEDAT_ADDR 0x009A
60 #define EEDATA_ADDR 0x009A
61 #define EEADR_ADDR 0x009B
62 #define EECON1_ADDR 0x009C
63 #define EECON2_ADDR 0x009D
65 #endif // #ifndef NO_ADDR_DEFINES
67 //==============================================================================
69 // Register Definitions
71 //==============================================================================
73 extern __at(0x0000) __sfr INDF
;
74 extern __at(0x0001) __sfr TMR0
;
75 extern __at(0x0002) __sfr PCL
;
77 //==============================================================================
80 extern __at(0x0003) __sfr STATUS
;
104 extern __at(0x0003) volatile __STATUSbits_t STATUSbits
;
115 //==============================================================================
117 extern __at(0x0004) __sfr FSR
;
119 //==============================================================================
122 extern __at(0x0005) __sfr GPIO
;
163 extern __at(0x0005) volatile __GPIObits_t GPIObits
;
178 //==============================================================================
180 extern __at(0x000A) __sfr PCLATH
;
182 //==============================================================================
185 extern __at(0x000B) __sfr INTCON
;
214 extern __at(0x000B) volatile __INTCONbits_t INTCONbits
;
227 //==============================================================================
230 //==============================================================================
233 extern __at(0x000C) __sfr PIR1
;
262 extern __at(0x000C) volatile __PIR1bits_t PIR1bits
;
269 //==============================================================================
271 extern __at(0x000E) __sfr TMR1
;
272 extern __at(0x000E) __sfr TMR1L
;
273 extern __at(0x000F) __sfr TMR1H
;
275 //==============================================================================
278 extern __at(0x0010) __sfr T1CON
;
286 unsigned NOT_T1SYNC
: 1;
287 unsigned T1OSCEN
: 1;
288 unsigned T1CKPS0
: 1;
289 unsigned T1CKPS1
: 1;
302 extern __at(0x0010) volatile __T1CONbits_t T1CONbits
;
306 #define _NOT_T1SYNC 0x04
307 #define _T1OSCEN 0x08
308 #define _T1CKPS0 0x10
309 #define _T1CKPS1 0x20
312 //==============================================================================
315 //==============================================================================
318 extern __at(0x0019) __sfr CMCON
;
341 extern __at(0x0019) volatile __CMCONbits_t CMCONbits
;
350 //==============================================================================
353 //==============================================================================
356 extern __at(0x0081) __sfr OPTION_REG
;
369 unsigned NOT_GPPU
: 1;
377 } __OPTION_REGbits_t
;
379 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits
;
388 #define _NOT_GPPU 0x80
390 //==============================================================================
393 //==============================================================================
396 extern __at(0x0085) __sfr TRISIO
;
402 unsigned TRISIO0
: 1;
403 unsigned TRISIO1
: 1;
404 unsigned TRISIO2
: 1;
405 unsigned TRISIO3
: 1;
406 unsigned TRISIO4
: 1;
407 unsigned TRISIO5
: 1;
419 extern __at(0x0085) volatile __TRISIObits_t TRISIObits
;
421 #define _TRISIO0 0x01
422 #define _TRISIO1 0x02
423 #define _TRISIO2 0x04
424 #define _TRISIO3 0x08
425 #define _TRISIO4 0x10
426 #define _TRISIO5 0x20
428 //==============================================================================
431 //==============================================================================
434 extern __at(0x008C) __sfr PIE1
;
463 extern __at(0x008C) volatile __PIE1bits_t PIE1bits
;
470 //==============================================================================
473 //==============================================================================
476 extern __at(0x008E) __sfr PCON
;
482 unsigned NOT_BOR
: 1;
483 unsigned NOT_POR
: 1;
494 unsigned NOT_BOD
: 1;
505 extern __at(0x008E) volatile __PCONbits_t PCONbits
;
507 #define _NOT_BOR 0x01
508 #define _NOT_BOD 0x01
509 #define _NOT_POR 0x02
511 //==============================================================================
514 //==============================================================================
517 extern __at(0x0090) __sfr OSCCAL
;
540 extern __at(0x0090) volatile __OSCCALbits_t OSCCALbits
;
549 //==============================================================================
552 //==============================================================================
555 extern __at(0x0095) __sfr WPU
;
569 extern __at(0x0095) volatile __WPUbits_t WPUbits
;
577 //==============================================================================
580 //==============================================================================
583 extern __at(0x0096) __sfr IOC
;
624 extern __at(0x0096) volatile __IOCbits_t IOCbits
;
639 //==============================================================================
642 //==============================================================================
645 extern __at(0x0096) __sfr IOCB
;
686 extern __at(0x0096) volatile __IOCBbits_t IOCBbits
;
688 #define _IOCB_IOC0 0x01
689 #define _IOCB_IOCB0 0x01
690 #define _IOCB_IOC1 0x02
691 #define _IOCB_IOCB1 0x02
692 #define _IOCB_IOC2 0x04
693 #define _IOCB_IOCB2 0x04
694 #define _IOCB_IOC3 0x08
695 #define _IOCB_IOCB3 0x08
696 #define _IOCB_IOC4 0x10
697 #define _IOCB_IOCB4 0x10
698 #define _IOCB_IOC5 0x20
699 #define _IOCB_IOCB5 0x20
701 //==============================================================================
704 //==============================================================================
707 extern __at(0x0099) __sfr VRCON
;
730 extern __at(0x0099) volatile __VRCONbits_t VRCONbits
;
739 //==============================================================================
741 extern __at(0x009A) __sfr EEDAT
;
742 extern __at(0x009A) __sfr EEDATA
;
743 extern __at(0x009B) __sfr EEADR
;
745 //==============================================================================
748 extern __at(0x009C) __sfr EECON1
;
762 extern __at(0x009C) volatile __EECON1bits_t EECON1bits
;
769 //==============================================================================
771 extern __at(0x009D) __sfr EECON2
;
773 //==============================================================================
775 // Configuration Bits
777 //==============================================================================
779 #define _CONFIG 0x2007
781 //----------------------------- CONFIG Options -------------------------------
783 #define _FOSC_LP 0x3FF8 // LP oscillator: Low power crystal on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
784 #define _LP_OSC 0x3FF8 // LP oscillator: Low power crystal on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
785 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
786 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
787 #define _FOSC_HS 0x3FFA // HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
788 #define _HS_OSC 0x3FFA // HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN.
789 #define _FOSC_EC 0x3FFB // EC: I/O function on GP4/OSC2/CLKOUT pin, CLKIN on GP5/OSC1/CLKIN.
790 #define _EC_OSC 0x3FFB // EC: I/O function on GP4/OSC2/CLKOUT pin, CLKIN on GP5/OSC1/CLKIN.
791 #define _FOSC_INTRCIO 0x3FFC // INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
792 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
793 #define _FOSC_INTRCCLK 0x3FFD // INTOSC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
794 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN.
795 #define _FOSC_EXTRCIO 0x3FFE // RC oscillator: I/O function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
796 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RC oscillator: I/O function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
797 #define _FOSC_EXTRCCLK 0x3FFF // RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
798 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on GP4/OSC2/CLKOUT pin, RC on GP5/OSC1/CLKIN.
799 #define _WDTE_OFF 0x3FF7 // WDT disabled.
800 #define _WDT_OFF 0x3FF7 // WDT disabled.
801 #define _WDTE_ON 0x3FFF // WDT enabled.
802 #define _WDT_ON 0x3FFF // WDT enabled.
803 #define _PWRTE_ON 0x3FEF // PWRT enabled.
804 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
805 #define _MCLRE_OFF 0x3FDF // GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD.
806 #define _MCLRE_ON 0x3FFF // GP3/MCLR pin function is MCLR.
807 #define _BOREN_OFF 0x3FBF // BOD disabled.
808 #define _BODEN_OFF 0x3FBF // BOD disabled.
809 #define _BOREN_ON 0x3FFF // BOD enabled.
810 #define _BODEN_ON 0x3FFF // BOD enabled.
811 #define _CP_ON 0x3F7F // Program Memory code protection is enabled.
812 #define _CP_OFF 0x3FFF // Program Memory code protection is disabled.
813 #define _CPD_ON 0x3EFF // Data memory code protection is enabled.
814 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
816 //==============================================================================
818 #define _DEVID1 0x2006
820 #define _IDLOC0 0x2000
821 #define _IDLOC1 0x2001
822 #define _IDLOC2 0x2002
823 #define _IDLOC3 0x2003
825 //==============================================================================
827 #ifndef NO_BIT_DEFINES
829 #define CM0 CMCONbits.CM0 // bit 0
830 #define CM1 CMCONbits.CM1 // bit 1
831 #define CM2 CMCONbits.CM2 // bit 2
832 #define CIS CMCONbits.CIS // bit 3
833 #define CINV CMCONbits.CINV // bit 4
834 #define COUT CMCONbits.COUT // bit 6
836 #define RD EECON1bits.RD // bit 0
837 #define WR EECON1bits.WR // bit 1
838 #define WREN EECON1bits.WREN // bit 2
839 #define WRERR EECON1bits.WRERR // bit 3
841 #define GP0 GPIObits.GP0 // bit 0, shadows bit in GPIObits
842 #define GPIO0 GPIObits.GPIO0 // bit 0, shadows bit in GPIObits
843 #define GP1 GPIObits.GP1 // bit 1, shadows bit in GPIObits
844 #define GPIO1 GPIObits.GPIO1 // bit 1, shadows bit in GPIObits
845 #define GP2 GPIObits.GP2 // bit 2, shadows bit in GPIObits
846 #define GPIO2 GPIObits.GPIO2 // bit 2, shadows bit in GPIObits
847 #define GP3 GPIObits.GP3 // bit 3, shadows bit in GPIObits
848 #define GPIO3 GPIObits.GPIO3 // bit 3, shadows bit in GPIObits
849 #define GP4 GPIObits.GP4 // bit 4, shadows bit in GPIObits
850 #define GPIO4 GPIObits.GPIO4 // bit 4, shadows bit in GPIObits
851 #define GP5 GPIObits.GP5 // bit 5, shadows bit in GPIObits
852 #define GPIO5 GPIObits.GPIO5 // bit 5, shadows bit in GPIObits
854 #define GPIF INTCONbits.GPIF // bit 0
855 #define INTF INTCONbits.INTF // bit 1
856 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
857 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
858 #define GPIE INTCONbits.GPIE // bit 3
859 #define INTE INTCONbits.INTE // bit 4
860 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
861 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
862 #define PEIE INTCONbits.PEIE // bit 6
863 #define GIE INTCONbits.GIE // bit 7
865 #define IOC0 IOCbits.IOC0 // bit 0, shadows bit in IOCbits
866 #define IOCB0 IOCbits.IOCB0 // bit 0, shadows bit in IOCbits
867 #define IOC1 IOCbits.IOC1 // bit 1, shadows bit in IOCbits
868 #define IOCB1 IOCbits.IOCB1 // bit 1, shadows bit in IOCbits
869 #define IOC2 IOCbits.IOC2 // bit 2, shadows bit in IOCbits
870 #define IOCB2 IOCbits.IOCB2 // bit 2, shadows bit in IOCbits
871 #define IOC3 IOCbits.IOC3 // bit 3, shadows bit in IOCbits
872 #define IOCB3 IOCbits.IOCB3 // bit 3, shadows bit in IOCbits
873 #define IOC4 IOCbits.IOC4 // bit 4, shadows bit in IOCbits
874 #define IOCB4 IOCbits.IOCB4 // bit 4, shadows bit in IOCbits
875 #define IOC5 IOCbits.IOC5 // bit 5, shadows bit in IOCbits
876 #define IOCB5 IOCbits.IOCB5 // bit 5, shadows bit in IOCbits
878 #define PS0 OPTION_REGbits.PS0 // bit 0
879 #define PS1 OPTION_REGbits.PS1 // bit 1
880 #define PS2 OPTION_REGbits.PS2 // bit 2
881 #define PSA OPTION_REGbits.PSA // bit 3
882 #define T0SE OPTION_REGbits.T0SE // bit 4
883 #define T0CS OPTION_REGbits.T0CS // bit 5
884 #define INTEDG OPTION_REGbits.INTEDG // bit 6
885 #define NOT_GPPU OPTION_REGbits.NOT_GPPU // bit 7
887 #define CAL0 OSCCALbits.CAL0 // bit 2
888 #define CAL1 OSCCALbits.CAL1 // bit 3
889 #define CAL2 OSCCALbits.CAL2 // bit 4
890 #define CAL3 OSCCALbits.CAL3 // bit 5
891 #define CAL4 OSCCALbits.CAL4 // bit 6
892 #define CAL5 OSCCALbits.CAL5 // bit 7
894 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
895 #define NOT_BOD PCONbits.NOT_BOD // bit 0, shadows bit in PCONbits
896 #define NOT_POR PCONbits.NOT_POR // bit 1
898 #define TMR1IE PIE1bits.TMR1IE // bit 0, shadows bit in PIE1bits
899 #define T1IE PIE1bits.T1IE // bit 0, shadows bit in PIE1bits
900 #define CMIE PIE1bits.CMIE // bit 3
901 #define EEIE PIE1bits.EEIE // bit 7
903 #define TMR1IF PIR1bits.TMR1IF // bit 0, shadows bit in PIR1bits
904 #define T1IF PIR1bits.T1IF // bit 0, shadows bit in PIR1bits
905 #define CMIF PIR1bits.CMIF // bit 3
906 #define EEIF PIR1bits.EEIF // bit 7
908 #define C STATUSbits.C // bit 0
909 #define DC STATUSbits.DC // bit 1
910 #define Z STATUSbits.Z // bit 2
911 #define NOT_PD STATUSbits.NOT_PD // bit 3
912 #define NOT_TO STATUSbits.NOT_TO // bit 4
913 #define RP0 STATUSbits.RP0 // bit 5
914 #define RP1 STATUSbits.RP1 // bit 6
915 #define IRP STATUSbits.IRP // bit 7
917 #define TMR1ON T1CONbits.TMR1ON // bit 0
918 #define TMR1CS T1CONbits.TMR1CS // bit 1
919 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
920 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
921 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
922 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
923 #define TMR1GE T1CONbits.TMR1GE // bit 6
925 #define TRISIO0 TRISIObits.TRISIO0 // bit 0
926 #define TRISIO1 TRISIObits.TRISIO1 // bit 1
927 #define TRISIO2 TRISIObits.TRISIO2 // bit 2
928 #define TRISIO3 TRISIObits.TRISIO3 // bit 3
929 #define TRISIO4 TRISIObits.TRISIO4 // bit 4
930 #define TRISIO5 TRISIObits.TRISIO5 // bit 5
932 #define VR0 VRCONbits.VR0 // bit 0
933 #define VR1 VRCONbits.VR1 // bit 1
934 #define VR2 VRCONbits.VR2 // bit 2
935 #define VR3 VRCONbits.VR3 // bit 3
936 #define VRR VRCONbits.VRR // bit 5
937 #define VREN VRCONbits.VREN // bit 7
939 #define WPU0 WPUbits.WPU0 // bit 0
940 #define WPU1 WPUbits.WPU1 // bit 1
941 #define WPU2 WPUbits.WPU2 // bit 2
942 #define WPU4 WPUbits.WPU4 // bit 4
943 #define WPU5 WPUbits.WPU5 // bit 5
945 #endif // #ifndef NO_BIT_DEFINES
947 #endif // #ifndef __PIC12F629_H__