pic16f877a.h中文注释
扫描二维码
随时随地手机看文章
存放路径:在PICC软件hi-tech安装目录下,?:Microchipcc8.05include,找到pic1687xa.h,里面即有
以下是头文件内容及详细注释:
/*
*Header file for the Microchip
*PIC 16F873A chip
*PIC 16F874A chip
*PIC 16F876A chip
*PIC 16F877A chip
*Midrange Microcontroller
*/
#if defined(_16F874A)|| defined(_16F877A)
#define__PINS_40
#endif
static volatile unsigned charINDF@ 0x00;//间接寻址寄存器
static volatile unsigned charTMR0@ 0x01;//定时器0
static volatile unsigned charPCL@ 0x02;//低8位程序计数器
static volatile unsigned charSTATUS@ 0x03;//程序状态寄存器
static unsigned charFSR@ 0x04;//特殊功能寄存器
static volatile unsigned charPORTA@ 0x05;//端口A寄存器
static volatile unsigned charPORTB@ 0x06;//端口B寄存器
static volatile unsigned charPORTC@ 0x07;//端口C寄存器
#ifdef __PINS_40
static volatile unsigned charPORTD@ 0x08;//端口D寄存器
static volatile unsigned charPORTE@ 0x09;//端口E寄存器
#endif
static unsigned charPCLATH@ 0x0A;//高5位程序计数器
static volatile unsigned charINTCON@ 0x0B;//中断控制寄存器
static volatile unsigned charPIR1@ 0x0C;//中断标志寄存器PIR1
static volatile unsigned charPIR2@ 0x0D;//中断标志寄存器PIR2
static volatile unsigned charTMR1L@ 0x0E;//低字节计数寄存器
static volatile unsigned charTMR1H@ 0x0F;//高字节计数寄存器
static volatile unsigned charT1CON@ 0x10;//TMR1控制寄存器
static volatile unsigned charTMR2@ 0x11;//定时/计数器TMR2
static volatile unsigned charT2CON@ 0x12;//TMR2控制寄存器
static volatile unsigned charSSPBUF@ 0x13;//收/发数据缓冲器
static volatile unsigned charSSPCON@ 0x14;//同步串口控制寄存器,对MSSP模块的功能和指标进行设置和定义
static volatile unsigned charCCPR1L@ 0x15;//捕获/比较/PWM寄存器低字节
static volatile unsigned charCCPR1H@ 0x16;//捕获/比较/PWM寄存器低字节
static volatile unsigned charCCP1CON@ 0x17;//CCP1CON寄存器
static volatile unsigned charRCSTA@ 0x18;//USART接收控制兼状态寄存器
static volatile unsigned charTXREG@ 0x19;//USART发生缓冲器
static volatile unsigned charRCREG@ 0x1A;//USART接收缓冲器
static volatile unsigned charCCPR2L@ 0x1B;//捕获/比较/PWM寄存器低字节
static volatile unsigned charCCPR2H@ 0x1C;//捕获/比较/PWM寄存器低字节
static volatile unsigned charCCP2CON@ 0x1D;//CCP2CON寄存器
static volatile unsigned charADRESH@ 0x1E;//ADC转换结果寄存器高字节
static volatile unsigned charADCON0@ 0x1F;//A/D转换器开关位
/*bank 1 registers */
static unsigned char bank1OPTION@ 0x81;//选择寄存器,用于配置TMR0/WDT预分频系数、外部INT中断、TMR0和端口B的弱上拉。
static volatileunsigned char bank1TRISA@ 0x85;//A口方向寄存器
static volatileunsigned char bank1TRISB@ 0x86;//B口方向寄存器
static volatileunsigned char bank1TRISC@ 0x87;//C口方向寄存器
#ifdef__PINS_40
static volatile unsigned char bank1TRISD@ 0x88;//D口方向寄存器
static volatile unsigned char bank1TRISE@ 0x89;//E口方向寄存器
#endif
static volatile unsigned char bank1PIE1@ 0x8C;//中断允许寄存器PIE1
static volatile unsigned char bank1PIE2@ 0x8D;//中断允许寄存器PIE2
static volatile unsigned char bank1PCON@ 0x8E;//电源控制状态寄存器
static volatile unsigned char bank1SSPCON2@ 0x91;//MSSP控制寄存器2
static volatile unsigned char bank1PR2@ 0x92;//TMR2周期寄存器
static volatile unsigned char bank1SSPADD@ 0x93;//同步串口地址寄存器
static volatile unsigned char bank1SSPSTAT@ 0x94;//同步串口状态寄存器
static volatile unsigned char bank1TXSTA@ 0x98;//USART发生控制兼状态寄存器
static volatile unsigned char bank1SPBRG@ 0x99;//USART波特率发生器初值寄存器
static volatile unsigned char bank1CMCON@ 0x9C;//比较控制寄存器
static volatile unsigned char bank1CVRCON@ 0x9D;//比较电压参考控制寄存器
static volatile unsigned char bank1ADRESL@ 0x9E;//ADC转换结果寄存器低字节
static volatile unsigned char bank1ADCON1@ 0x9F;//ADC控制寄存器ADCON1
/*bank 2 registers */
static volatile unsigned char bank2EEDATA@ 0x10C;//EEPROM数据寄存器低字节
static volatile unsigned char bank2EEADR@ 0x10D;//EEPROM地址寄存器低字节
static volatile unsigned char bank2EEDATH@ 0x10E;//EEPROM数据寄存器高字节
static volatile unsigned char bank2EEADRH@ 0x10F;//EEPROM地址寄存器高字节
/*bank 3 registers */
staticvolatile unsigned char bank3EECON1@ 0x18C;//EEPROM控制寄存器1
static volatile unsigned char bank3EECON2@ 0x18D;//EEPROM控制寄存器2
//*STATUS bits状态寄存器*/
static volatile bitIRP @ (unsigned)&STATUS*8+7;//寄存器bank选择位(用于间接寻址)。0:bank0,1;1:bank2,3
static volatile bitRP1 @ (unsigned)&STATUS*8+6;//寄存器bank选择位(用于直接寻址)
PR1:PR0:00:BANK0;01:BANK1;10:BANK2;11BANK3.
static volatile bitRP0 @ (unsigned)&STATUS*8+5;//
static volatile bitTO@ (unsigned)&STATUS*8+4;//超时位。0:WDT超时发生;1:上电后,执行了CLRWDT或者SLEEP指令
static volatile bitPD@ (unsigned)&STATUS*8+3;//掉电标志位。0:执行完SLEEP指令;1:上电后或者执行CLRWDT指令
static volatile bitZERO @ (unsigned)&STATUS*8+2;//零标志位。0:算术或逻辑操作结果不为0;1:反之。
static volatile bitDC @ (unsigned)&STATUS*8+1;//数字进位/退位标志位。0:结果的低4位没有发生进位;1:反之。
static volatile bitCARRY @ (unsigned)&STATUS*8+0;//进位/退位标志位。0:结果的高4位没有发生进位;1:反之。
/* PORTA bits */
static volatile bitRA5@ (unsigned)&PORTA*8+5;//RA5
static volatile bitRA4@ (unsigned)&PORTA*8+4;//RA4
static volatile bitRA3@ (unsigned)&PORTA*8+3;//RA3
static volatile bitRA2@ (unsigned)&PORTA*8+2;//RA2
static volatile bitRA1@ (unsigned)&PORTA*8+1;//RA1
static volatile bitRA0@ (unsigned)&PORTA*8+0;//RA0
/* PORTB bits */
static volatile bitRB7@ (unsigned)&PORTB*8+7;//RB7
static volatile bitRB6@ (unsigned)&PORTB*8+6;//RB6
static volatile bitRB5@ (unsigned)&PORTB*8+5;//RB5
static volatile bitRB4@ (unsigned)&PORTB*8+4;//RB4
static volatile bitRB3@ (unsigned)&PORTB*8+3;//RB3
static volatile bitRB2@ (unsigned)&PORTB*8+2;//RB2
static volatile bitRB1@ (unsigned)&PORTB*8+1;//RB1
static volatile bitRB0@ (unsigned)&PORTB*8+0;//RB0
/* PORTC bits */
static volatile bitRC7@ (unsigned)&PORTC*8+7;//RC7
static volatile bitRC6@ (unsigned)&PORTC*8+6;//RC6
static volatile bitRC5@ (unsigned)&PORTC*8+5;//RC5
static volatile bitRC4@ (unsigned)&PORTC*8+4;//RC4
static volatile bitRC3@ (unsigned)&PORTC*8+3;//RC3
static volatile bitRC2@ (unsigned)&PORTC*8+2;//RC2
static volatile bitRC1@ (unsigned)&PORTC*8+1;//RC1
static volatile bitRC0@ (unsigned)&PORTC*8+0;//RC0
/* PORTD bits */
#ifdef__PINS_40
static volatile bitRD7@ (unsigned)&PORTD*8+7;//RD7
static volatile bitRD6@ (unsigned)&PORTD*8+6;//RD6
static volatile bitRD5@ (unsigned)&PORTD*8+5;//RD5
static volatile bitRD4@ (unsigned)&PORTD*8+4;//RD4
static volatile bitRD3@ (unsigned)&PORTD*8+3;//RD3
static volatile bitRD2@ (unsigned)&PORTD*8+2;//RD2
static volatile bitRD1@ (unsigned)&PORTD*8+1;//RD1
static volatile bitRD0@ (unsigned)&PORTD*8+0;//RD0