📄 pic12f520.h
字号:
#ifndef _HTC_H_
#warning Header file pic12f520.h included directly. Use #include <htc.h> instead.
#endif
/* header file for the MICROCHIP PIC microcontroller
12F520
*/
#ifndef __PIC12F520_H
#define __PIC12F520_H
//
// Configuration mask definitions
//
// Config Register: CONFIG
#define CONFIG 0x0FFF
// Oscillator
// LP Osc With 18 ms DRT
#define OSC_LP 0xFFFC
// XT Osc With 18 ms DRT
#define OSC_XT 0xFFFD
// INTRC With 1 ms DRT
#define OSC_INTRC 0xFFFE
// EXTRC With 1 ms DRT
#define OSC_EXTRC 0xFFFF
// Watchdog Timer Enable
// WDT enabled
#define WDT_ON 0xFFFF
// WDT disabled
#define WDT_OFF 0xFFFB
// Code Protect
// Code protection off
#define CP_OFF 0xFFFF
// Code protection on
#define CP_ON 0xFFF7
// Master Clear Enable
// RB3/MCLR Functions as MCLR
#define MCLR_ON 0xFFFF
// RB3/MCLR Functions as RB3
#define MCLR_OFF 0xFFEF
// Internal Oscillator Frequency Select
// 8 MHz INTOSC Speed
#define IOSCFS_8MHZ 0xFFFF
// 4 MHz INTOSC Speed
#define IOSCFS_4MHZ 0xFFDF
// Code Protect bit - Self Writable Memory
// Code protection off
#define CPDF_OFF 0xFFFF
// Code protection on
#define CPDF_ON 0xFFBF
//
// Special function register definitions: Bank 0
//
// Register: INDF
volatile unsigned char INDF @ 0x000;
// bit and bitfield definitions
// Register: TMR0
volatile unsigned char TMR0 @ 0x001;
// bit and bitfield definitions
// Register: PCL
volatile unsigned char PCL @ 0x002;
// bit and bitfield definitions
// Register: STATUS
volatile unsigned char STATUS @ 0x003;
// bit and bitfield definitions
volatile bit CARRY @ ((unsigned)&STATUS*8)+0;
volatile bit DC @ ((unsigned)&STATUS*8)+1;
volatile bit ZERO @ ((unsigned)&STATUS*8)+2;
volatile bit nPD @ ((unsigned)&STATUS*8)+3;
volatile bit nTO @ ((unsigned)&STATUS*8)+4;
volatile bit PA0 @ ((unsigned)&STATUS*8)+5;
volatile bit PA1 @ ((unsigned)&STATUS*8)+6;
volatile bit RBWUF @ ((unsigned)&STATUS*8)+7;
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned C : 1;
volatile unsigned DC : 1;
volatile unsigned Z : 1;
volatile unsigned nPD : 1;
volatile unsigned nTO : 1;
volatile unsigned PA0 : 1;
volatile unsigned PA1 : 1;
volatile unsigned RBWUF : 1;
};
} STATUSbits @ 0x003;
#endif
// Register: FSR
volatile unsigned char FSR @ 0x004;
// bit and bitfield definitions
// Register: OSCCAL
volatile unsigned char OSCCAL @ 0x005;
// bit and bitfield definitions
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned : 1;
volatile unsigned CAL : 7;
};
} OSCCALbits @ 0x005;
#endif
// Register: PORTB
volatile unsigned char PORTB @ 0x006;
// bit and bitfield definitions
volatile bit RB0 @ ((unsigned)&PORTB*8)+0;
volatile bit RB1 @ ((unsigned)&PORTB*8)+1;
volatile bit RB2 @ ((unsigned)&PORTB*8)+2;
volatile bit RB3 @ ((unsigned)&PORTB*8)+3;
volatile bit RB4 @ ((unsigned)&PORTB*8)+4;
volatile bit RB5 @ ((unsigned)&PORTB*8)+5;
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned RB0 : 1;
volatile unsigned RB1 : 1;
volatile unsigned RB2 : 1;
volatile unsigned RB3 : 1;
volatile unsigned RB4 : 1;
volatile unsigned RB5 : 1;
};
} PORTBbits @ 0x006;
#endif
//
// Special function register definitions: Bank 1
//
// Register: EECON
volatile unsigned char EECON @ 0x021;
// bit and bitfield definitions
volatile bit RD @ ((unsigned)&EECON*8)+0;
volatile bit WR @ ((unsigned)&EECON*8)+1;
volatile bit WREN @ ((unsigned)&EECON*8)+2;
volatile bit WRERR @ ((unsigned)&EECON*8)+3;
volatile bit FREE @ ((unsigned)&EECON*8)+4;
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned RD : 1;
volatile unsigned WR : 1;
volatile unsigned WREN : 1;
volatile unsigned WRERR : 1;
volatile unsigned FREE : 1;
};
} EECONbits @ 0x021;
#endif
// Register: EEDATA
volatile unsigned char EEDATA @ 0x025;
// bit and bitfield definitions
// Register: EEADR
volatile unsigned char EEADR @ 0x026;
// bit and bitfield definitions
// Register: WREG
volatile unsigned char WREG @ 0x051;
// bit and bitfield definitions
// Register: STKPTR
volatile unsigned char STKPTR @ 0x052;
// bit and bitfield definitions
// Register: TRISB
volatile unsigned char TRISB @ 0x053;
// bit and bitfield definitions
volatile bit TRISB0 @ ((unsigned)&TRISB*8)+0;
volatile bit TRISB1 @ ((unsigned)&TRISB*8)+1;
volatile bit TRISB2 @ ((unsigned)&TRISB*8)+2;
volatile bit TRISB3 @ ((unsigned)&TRISB*8)+3;
volatile bit TRISB4 @ ((unsigned)&TRISB*8)+4;
volatile bit TRISB5 @ ((unsigned)&TRISB*8)+5;
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned TRISB0 : 1;
volatile unsigned TRISB1 : 1;
volatile unsigned TRISB2 : 1;
volatile unsigned TRISB3 : 1;
volatile unsigned TRISB4 : 1;
volatile unsigned TRISB5 : 1;
volatile unsigned : 2;
};
} TRISBbits @ 0x053;
#endif
// Register: OPTION_REG
volatile unsigned char OPTION_REG @ 0x054;
// bit and bitfield definitions
volatile bit PSA @ ((unsigned)&OPTION_REG*8)+3;
volatile bit T0SE @ ((unsigned)&OPTION_REG*8)+4;
volatile bit T0CS @ ((unsigned)&OPTION_REG*8)+5;
volatile bit nRBPU @ ((unsigned)&OPTION_REG*8)+6;
volatile bit nRBWU @ ((unsigned)&OPTION_REG*8)+7;
#ifndef _LIB_BUILD
union {
struct {
volatile unsigned PS : 3;
volatile unsigned PSA : 1;
volatile unsigned T0SE : 1;
volatile unsigned T0CS : 1;
volatile unsigned nRBPU : 1;
volatile unsigned nRBWU : 1;
};
} OPTION_REGbits @ 0x054;
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -