2 * This declarations of the PIC16F630 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:22:57 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 __PIC16F630_H__
26 #define __PIC16F630_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 PORTA_ADDR 0x0005
42 #define PORTC_ADDR 0x0007
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 CMCON_ADDR 0x0019
51 #define OPTION_REG_ADDR 0x0081
52 #define TRISA_ADDR 0x0085
53 #define TRISC_ADDR 0x0087
54 #define PIE1_ADDR 0x008C
55 #define PCON_ADDR 0x008E
56 #define OSCCAL_ADDR 0x0090
57 #define WPU_ADDR 0x0095
58 #define WPUA_ADDR 0x0095
59 #define IOC_ADDR 0x0096
60 #define IOCA_ADDR 0x0096
61 #define VRCON_ADDR 0x0099
62 #define EEDAT_ADDR 0x009A
63 #define EEDATA_ADDR 0x009A
64 #define EEADR_ADDR 0x009B
65 #define EECON1_ADDR 0x009C
66 #define EECON2_ADDR 0x009D
68 #endif // #ifndef NO_ADDR_DEFINES
70 //==============================================================================
72 // Register Definitions
74 //==============================================================================
76 extern __at(0x0000) __sfr INDF
;
77 extern __at(0x0001) __sfr TMR0
;
78 extern __at(0x0002) __sfr PCL
;
80 //==============================================================================
83 extern __at(0x0003) __sfr STATUS
;
107 extern __at(0x0003) volatile __STATUSbits_t STATUSbits
;
118 //==============================================================================
120 extern __at(0x0004) __sfr FSR
;
122 //==============================================================================
125 extern __at(0x0005) __sfr PORTA
;
148 extern __at(0x0005) volatile __PORTAbits_t PORTAbits
;
157 //==============================================================================
160 //==============================================================================
163 extern __at(0x0007) __sfr PORTC
;
186 extern __at(0x0007) volatile __PORTCbits_t PORTCbits
;
195 //==============================================================================
197 extern __at(0x000A) __sfr PCLATH
;
199 //==============================================================================
202 extern __at(0x000B) __sfr INTCON
;
231 extern __at(0x000B) volatile __INTCONbits_t INTCONbits
;
244 //==============================================================================
247 //==============================================================================
250 extern __at(0x000C) __sfr PIR1
;
279 extern __at(0x000C) volatile __PIR1bits_t PIR1bits
;
286 //==============================================================================
288 extern __at(0x000E) __sfr TMR1
;
289 extern __at(0x000E) __sfr TMR1L
;
290 extern __at(0x000F) __sfr TMR1H
;
292 //==============================================================================
295 extern __at(0x0010) __sfr T1CON
;
303 unsigned NOT_T1SYNC
: 1;
304 unsigned T1OSCEN
: 1;
305 unsigned T1CKPS0
: 1;
306 unsigned T1CKPS1
: 1;
319 extern __at(0x0010) volatile __T1CONbits_t T1CONbits
;
323 #define _NOT_T1SYNC 0x04
324 #define _T1OSCEN 0x08
325 #define _T1CKPS0 0x10
326 #define _T1CKPS1 0x20
329 //==============================================================================
332 //==============================================================================
335 extern __at(0x0019) __sfr CMCON
;
358 extern __at(0x0019) volatile __CMCONbits_t CMCONbits
;
367 //==============================================================================
370 //==============================================================================
373 extern __at(0x0081) __sfr OPTION_REG
;
386 unsigned NOT_RAPU
: 1;
398 unsigned NOT_GPPU
: 1;
406 } __OPTION_REGbits_t
;
408 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits
;
417 #define _NOT_RAPU 0x80
418 #define _NOT_GPPU 0x80
420 //==============================================================================
423 //==============================================================================
426 extern __at(0x0085) __sfr TRISA
;
449 extern __at(0x0085) volatile __TRISAbits_t TRISAbits
;
458 //==============================================================================
461 //==============================================================================
464 extern __at(0x0087) __sfr TRISC
;
487 extern __at(0x0087) volatile __TRISCbits_t TRISCbits
;
496 //==============================================================================
499 //==============================================================================
502 extern __at(0x008C) __sfr PIE1
;
531 extern __at(0x008C) volatile __PIE1bits_t PIE1bits
;
538 //==============================================================================
541 //==============================================================================
544 extern __at(0x008E) __sfr PCON
;
550 unsigned NOT_BOR
: 1;
551 unsigned NOT_POR
: 1;
562 unsigned NOT_BOD
: 1;
573 extern __at(0x008E) volatile __PCONbits_t PCONbits
;
575 #define _NOT_BOR 0x01
576 #define _NOT_BOD 0x01
577 #define _NOT_POR 0x02
579 //==============================================================================
582 //==============================================================================
585 extern __at(0x0090) __sfr OSCCAL
;
608 extern __at(0x0090) volatile __OSCCALbits_t OSCCALbits
;
617 //==============================================================================
620 //==============================================================================
623 extern __at(0x0095) __sfr WPU
;
637 extern __at(0x0095) volatile __WPUbits_t WPUbits
;
645 //==============================================================================
648 //==============================================================================
651 extern __at(0x0095) __sfr WPUA
;
665 extern __at(0x0095) volatile __WPUAbits_t WPUAbits
;
667 #define _WPUA_WPUA0 0x01
668 #define _WPUA_WPUA1 0x02
669 #define _WPUA_WPUA2 0x04
670 #define _WPUA_WPUA4 0x10
671 #define _WPUA_WPUA5 0x20
673 //==============================================================================
676 //==============================================================================
679 extern __at(0x0096) __sfr IOC
;
702 extern __at(0x0096) volatile __IOCbits_t IOCbits
;
711 //==============================================================================
714 //==============================================================================
717 extern __at(0x0096) __sfr IOCA
;
740 extern __at(0x0096) volatile __IOCAbits_t IOCAbits
;
742 #define _IOCA_IOCA0 0x01
743 #define _IOCA_IOCA1 0x02
744 #define _IOCA_IOCA2 0x04
745 #define _IOCA_IOCA3 0x08
746 #define _IOCA_IOCA4 0x10
747 #define _IOCA_IOCA5 0x20
749 //==============================================================================
752 //==============================================================================
755 extern __at(0x0099) __sfr VRCON
;
778 extern __at(0x0099) volatile __VRCONbits_t VRCONbits
;
787 //==============================================================================
789 extern __at(0x009A) __sfr EEDAT
;
790 extern __at(0x009A) __sfr EEDATA
;
791 extern __at(0x009B) __sfr EEADR
;
793 //==============================================================================
796 extern __at(0x009C) __sfr EECON1
;
810 extern __at(0x009C) volatile __EECON1bits_t EECON1bits
;
817 //==============================================================================
819 extern __at(0x009D) __sfr EECON2
;
821 //==============================================================================
823 // Configuration Bits
825 //==============================================================================
827 #define _CONFIG 0x2007
829 //----------------------------- CONFIG Options -------------------------------
831 #define _FOSC_LP 0x3FF8 // LP oscillator: Low power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
832 #define _LP_OSC 0x3FF8 // LP oscillator: Low power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
833 #define _FOSC_XT 0x3FF9 // XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
834 #define _XT_OSC 0x3FF9 // XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
835 #define _FOSC_HS 0x3FFA // HS oscillator: High speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
836 #define _HS_OSC 0x3FFA // HS oscillator: High speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN.
837 #define _FOSC_EC 0x3FFB // EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN.
838 #define _EC_OSC 0x3FFB // EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN.
839 #define _FOSC_INTRCIO 0x3FFC // INTOSC oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
840 #define _INTRC_OSC_NOCLKOUT 0x3FFC // INTOSC oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
841 #define _FOSC_INTRCCLK 0x3FFD // INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
842 #define _INTRC_OSC_CLKOUT 0x3FFD // INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN.
843 #define _FOSC_EXTRCIO 0x3FFE // RC oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
844 #define _EXTRC_OSC_NOCLKOUT 0x3FFE // RC oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
845 #define _FOSC_EXTRCCLK 0x3FFF // RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
846 #define _EXTRC_OSC_CLKOUT 0x3FFF // RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN.
847 #define _WDTE_OFF 0x3FF7 // WDT disabled.
848 #define _WDT_OFF 0x3FF7 // WDT disabled.
849 #define _WDTE_ON 0x3FFF // WDT enabled.
850 #define _WDT_ON 0x3FFF // WDT enabled.
851 #define _PWRTE_ON 0x3FEF // PWRT enabled.
852 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
853 #define _MCLRE_OFF 0x3FDF // RA3/MCLR pin function is digital I/O, MCLR internally tied to VDD.
854 #define _MCLRE_ON 0x3FFF // RA3/MCLR pin function is MCLR.
855 #define _BOREN_OFF 0x3FBF // BOD disabled.
856 #define _BODEN_OFF 0x3FBF // BOD disabled.
857 #define _BOREN_ON 0x3FFF // BOD enabled.
858 #define _BODEN 0x3FFF // BOD enabled.
859 #define _CP_ON 0x3F7F // Program Memory code protection is enabled.
860 #define _CP 0x3F7F // Program Memory code protection is enabled.
861 #define _CP_OFF 0x3FFF // Program Memory code protection is disabled.
862 #define _CPD_ON 0x3EFF // Data memory code protection is enabled.
863 #define _CPD 0x3EFF // Data memory code protection is enabled.
864 #define _CPD_OFF 0x3FFF // Data memory code protection is disabled.
866 //==============================================================================
868 #define _DEVID1 0x2006
870 #define _IDLOC0 0x2000
871 #define _IDLOC1 0x2001
872 #define _IDLOC2 0x2002
873 #define _IDLOC3 0x2003
875 //==============================================================================
877 #ifndef NO_BIT_DEFINES
879 #define CM0 CMCONbits.CM0 // bit 0
880 #define CM1 CMCONbits.CM1 // bit 1
881 #define CM2 CMCONbits.CM2 // bit 2
882 #define CIS CMCONbits.CIS // bit 3
883 #define CINV CMCONbits.CINV // bit 4
884 #define COUT CMCONbits.COUT // bit 6
886 #define RD EECON1bits.RD // bit 0
887 #define WR EECON1bits.WR // bit 1
888 #define WREN EECON1bits.WREN // bit 2
889 #define WRERR EECON1bits.WRERR // bit 3
891 #define RAIF INTCONbits.RAIF // bit 0
892 #define INTF INTCONbits.INTF // bit 1
893 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
894 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
895 #define RAIE INTCONbits.RAIE // bit 3
896 #define INTE INTCONbits.INTE // bit 4
897 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
898 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
899 #define PEIE INTCONbits.PEIE // bit 6
900 #define GIE INTCONbits.GIE // bit 7
902 #define IOCA0 IOCbits.IOCA0 // bit 0
903 #define IOCA1 IOCbits.IOCA1 // bit 1
904 #define IOCA2 IOCbits.IOCA2 // bit 2
905 #define IOCA3 IOCbits.IOCA3 // bit 3
906 #define IOCA4 IOCbits.IOCA4 // bit 4
907 #define IOCA5 IOCbits.IOCA5 // bit 5
909 #define PS0 OPTION_REGbits.PS0 // bit 0
910 #define PS1 OPTION_REGbits.PS1 // bit 1
911 #define PS2 OPTION_REGbits.PS2 // bit 2
912 #define PSA OPTION_REGbits.PSA // bit 3
913 #define T0SE OPTION_REGbits.T0SE // bit 4
914 #define T0CS OPTION_REGbits.T0CS // bit 5
915 #define INTEDG OPTION_REGbits.INTEDG // bit 6
916 #define NOT_RAPU OPTION_REGbits.NOT_RAPU // bit 7, shadows bit in OPTION_REGbits
917 #define NOT_GPPU OPTION_REGbits.NOT_GPPU // bit 7, shadows bit in OPTION_REGbits
919 #define CAL0 OSCCALbits.CAL0 // bit 2
920 #define CAL1 OSCCALbits.CAL1 // bit 3
921 #define CAL2 OSCCALbits.CAL2 // bit 4
922 #define CAL3 OSCCALbits.CAL3 // bit 5
923 #define CAL4 OSCCALbits.CAL4 // bit 6
924 #define CAL5 OSCCALbits.CAL5 // bit 7
926 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits
927 #define NOT_BOD PCONbits.NOT_BOD // bit 0, shadows bit in PCONbits
928 #define NOT_POR PCONbits.NOT_POR // bit 1
930 #define TMR1IE PIE1bits.TMR1IE // bit 0, shadows bit in PIE1bits
931 #define T1IE PIE1bits.T1IE // bit 0, shadows bit in PIE1bits
932 #define CMIE PIE1bits.CMIE // bit 3
933 #define EEIE PIE1bits.EEIE // bit 7
935 #define TMR1IF PIR1bits.TMR1IF // bit 0, shadows bit in PIR1bits
936 #define T1IF PIR1bits.T1IF // bit 0, shadows bit in PIR1bits
937 #define CMIF PIR1bits.CMIF // bit 3
938 #define EEIF PIR1bits.EEIF // bit 7
940 #define RA0 PORTAbits.RA0 // bit 0
941 #define RA1 PORTAbits.RA1 // bit 1
942 #define RA2 PORTAbits.RA2 // bit 2
943 #define RA3 PORTAbits.RA3 // bit 3
944 #define RA4 PORTAbits.RA4 // bit 4
945 #define RA5 PORTAbits.RA5 // bit 5
947 #define RC0 PORTCbits.RC0 // bit 0
948 #define RC1 PORTCbits.RC1 // bit 1
949 #define RC2 PORTCbits.RC2 // bit 2
950 #define RC3 PORTCbits.RC3 // bit 3
951 #define RC4 PORTCbits.RC4 // bit 4
952 #define RC5 PORTCbits.RC5 // bit 5
954 #define C STATUSbits.C // bit 0
955 #define DC STATUSbits.DC // bit 1
956 #define Z STATUSbits.Z // bit 2
957 #define NOT_PD STATUSbits.NOT_PD // bit 3
958 #define NOT_TO STATUSbits.NOT_TO // bit 4
959 #define RP0 STATUSbits.RP0 // bit 5
960 #define RP1 STATUSbits.RP1 // bit 6
961 #define IRP STATUSbits.IRP // bit 7
963 #define TMR1ON T1CONbits.TMR1ON // bit 0
964 #define TMR1CS T1CONbits.TMR1CS // bit 1
965 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2
966 #define T1OSCEN T1CONbits.T1OSCEN // bit 3
967 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4
968 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5
969 #define TMR1GE T1CONbits.TMR1GE // bit 6
971 #define TRISA0 TRISAbits.TRISA0 // bit 0
972 #define TRISA1 TRISAbits.TRISA1 // bit 1
973 #define TRISA2 TRISAbits.TRISA2 // bit 2
974 #define TRISA3 TRISAbits.TRISA3 // bit 3
975 #define TRISA4 TRISAbits.TRISA4 // bit 4
976 #define TRISA5 TRISAbits.TRISA5 // bit 5
978 #define TRISC0 TRISCbits.TRISC0 // bit 0
979 #define TRISC1 TRISCbits.TRISC1 // bit 1
980 #define TRISC2 TRISCbits.TRISC2 // bit 2
981 #define TRISC3 TRISCbits.TRISC3 // bit 3
982 #define TRISC4 TRISCbits.TRISC4 // bit 4
983 #define TRISC5 TRISCbits.TRISC5 // bit 5
985 #define VR0 VRCONbits.VR0 // bit 0
986 #define VR1 VRCONbits.VR1 // bit 1
987 #define VR2 VRCONbits.VR2 // bit 2
988 #define VR3 VRCONbits.VR3 // bit 3
989 #define VRR VRCONbits.VRR // bit 5
990 #define VREN VRCONbits.VREN // bit 7
992 #define WPUA0 WPUbits.WPUA0 // bit 0
993 #define WPUA1 WPUbits.WPUA1 // bit 1
994 #define WPUA2 WPUbits.WPUA2 // bit 2
995 #define WPUA4 WPUbits.WPUA4 // bit 4
996 #define WPUA5 WPUbits.WPUA5 // bit 5
998 #endif // #ifndef NO_BIT_DEFINES
1000 #endif // #ifndef __PIC16F630_H__