打印
[其他产品]

pic16f877a.h中文注释

[复制链接]
997|19
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
features|  楼主 | 2020-8-10 09:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
存放路径:在PICC软件hi-tech安装目录下,?:\Microchip\cc8.05\include,找到pic1687xa.h,里面即有
以下是头文件内容及详细注释:

使用特权

评论回复
沙发
features|  楼主 | 2020-8-10 09:40 | 只看该作者
/*
* Header file for the Microchip
* PIC 16F873A chip
* PIC 16F874A chip
* PIC 16F876A chip
* PIC 16F877A chip
* Midrange Microcontroller
*/

使用特权

评论回复
板凳
features|  楼主 | 2020-8-10 09:41 | 只看该作者
#if defined(_16F874A) || defined(_16F877A)
#define __PINS_40
#endif

使用特权

评论回复
地板
features|  楼主 | 2020-8-10 09:41 | 只看该作者
static volatile unsigned char INDF @ 0x00;   //间接寻址寄存器
static volatile unsigned char TMR0 @ 0x01;   //定时器0
static volatile unsigned char PCL  @ 0x02;   //低8位程序计数器
static volatile unsigned char STATUS @ 0x03;   //程序状态寄存器
static          unsigned char FSR  @ 0x04;   //特殊功能寄存器
static volatile unsigned char PORTA @ 0x05;   //端口A寄存器
static volatile unsigned char PORTB @ 0x06;   //端口B寄存器
static volatile unsigned char PORTC @ 0x07;   //端口C寄存器
#ifdef __PINS_40
static volatile unsigned char PORTD @ 0x08;   //端口D寄存器
static volatile unsigned char PORTE @ 0x09;   //端口E寄存器
#endif

使用特权

评论回复
5
features|  楼主 | 2020-8-10 09:43 | 只看该作者
static          unsigned char PCLATH @ 0x0A;   //高5位程序计数器
static volatile unsigned char INTCON @ 0x0B;   //中断控制寄存器
static volatile unsigned char PIR1 @ 0x0C;   //中断标志寄存器PIR1
static volatile unsigned char PIR2 @ 0x0D;   //中断标志寄存器PIR2
static volatile unsigned char TMR1L @ 0x0E;   //低字节计数寄存器
static volatile unsigned char TMR1H @ 0x0F;   //高字节计数寄存器
static volatile unsigned char T1CON @ 0x10;   //TMR1控制寄存器
static volatile unsigned char TMR2 @ 0x11;   //定时/计数器TMR2
static volatile unsigned char T2CON @ 0x12;   //TMR2控制寄存器
static volatile unsigned char SSPBUF @ 0x13;   //收/发数据缓冲器
static volatile unsigned char SSPCON @ 0x14;   //同步串口控制寄存器,对MSSP模块的功能和指标进行设置和定义
static volatile unsigned char CCPR1L @ 0x15;   //捕获/比较/PWM寄存器低字节
static volatile unsigned char CCPR1H @ 0x16;   //捕获/比较/PWM寄存器低字节
static volatile unsigned char CCP1CON @ 0x17;   //CCP1CON寄存器
static volatile unsigned char RCSTA @ 0x18;   //USART接收控制兼状态寄存器
static volatile unsigned char TXREG @ 0x19;   //USART发生缓冲器
static volatile unsigned char RCREG @ 0x1A;   //USART接收缓冲器
static volatile unsigned char CCPR2L @ 0x1B;   //捕获/比较/PWM寄存器低字节
static volatile unsigned char CCPR2H @ 0x1C;   //捕获/比较/PWM寄存器低字节
static volatile unsigned char CCP2CON @ 0x1D;   //CCP2CON寄存器
static volatile unsigned char ADRESH @ 0x1E;   //ADC转换结果寄存器高字节
static volatile unsigned char ADCON0 @ 0x1F;   //A/D转换器开关位

使用特权

评论回复
6
features|  楼主 | 2020-8-10 09:44 | 只看该作者
/* bank 1 registers */
static unsigned char bank1 OPTION @ 0x81;  //选择寄存器,用于配置TMR0/WDT预分频系数、外部INT中断、TMR0和端口B的弱上拉。
static volatile unsigned char bank1 TRISA @ 0x85;  //A口方向寄存器
static volatile unsigned char bank1 TRISB @ 0x86;  //B口方向寄存器
static volatile unsigned char bank1 TRISC @ 0x87;  //C口方向寄存器
#ifdef __PINS_40
static volatile unsigned char bank1 TRISD @ 0x88;  //D口方向寄存器
static volatile unsigned char bank1 TRISE @ 0x89;  //E口方向寄存器
#endif
static volatile unsigned char bank1 PIE1 @ 0x8C;  //中断允许寄存器PIE1
static volatile unsigned char bank1 PIE2 @ 0x8D;  //中断允许寄存器PIE2
static volatile unsigned char bank1 PCON @ 0x8E;  //电源控制状态寄存器
static volatile unsigned char bank1 SSPCON2 @ 0x91;  //MSSP控制寄存器2
static volatile unsigned char bank1 PR2  @ 0x92;  //TMR2周期寄存器
static volatile unsigned char bank1 SSPADD @ 0x93;  //同步串口地址寄存器
static volatile unsigned char bank1 SSPSTAT @ 0x94;  //同步串口状态寄存器
static volatile unsigned char bank1 TXSTA @ 0x98;  //USART发生控制兼状态寄存器
static volatile unsigned char bank1 SPBRG @ 0x99;  //USART波特率发生器初值寄存器
static volatile unsigned char bank1 CMCON @ 0x9C;  //比较控制寄存器
static volatile unsigned char bank1 CVRCON @ 0x9D;  //比较电压参考控制寄存器
static volatile unsigned char bank1 ADRESL @ 0x9E;  //ADC转换结果寄存器低字节
static volatile unsigned char bank1 ADCON1 @ 0x9F;  //ADC控制寄存器ADCON1

使用特权

评论回复
7
features|  楼主 | 2020-8-10 09:45 | 只看该作者
/* bank 2 registers */
static volatile unsigned char bank2 EEDATA @ 0x10C; //EEPROM数据寄存器低字节
static volatile unsigned char bank2 EEADR @ 0x10D; //EEPROM地址寄存器低字节
static volatile unsigned char bank2 EEDATH @ 0x10E; //EEPROM数据寄存器高字节
static volatile unsigned char bank2 EEADRH @ 0x10F; //EEPROM地址寄存器高字节

使用特权

评论回复
8
features|  楼主 | 2020-8-10 09:45 | 只看该作者
/* bank 3 registers */
static volatile unsigned char bank3 EECON1 @ 0x18C; //EEPROM控制寄存器1
static volatile unsigned char bank3 EECON2 @ 0x18D; //EEPROM控制寄存器2

使用特权

评论回复
9
features|  楼主 | 2020-8-10 09:46 | 只看该作者
//* STATUS bits状态寄存器 */
static volatile bit IRP     @ (unsigned)&STATUS*8+7; //寄存器bank选择位(用于间接寻址)。0:bank0,1;1:bank2,3
static volatile bit RP1  @ (unsigned)&STATUS*8+6; //寄存器bank选择位(用于直接寻址)
PR1:PR0:00:BANK0;01:BANK1;10:BANK2;11BANK3.
static volatile bit RP0     @ (unsigned)&STATUS*8+5; //
static volatile bit TO  @ (unsigned)&STATUS*8+4; //超时位。0:WDT超时发生;1:上电后,执行了CLRWDT或者SLEEP指令
static volatile bit PD  @ (unsigned)&STATUS*8+3; //掉电标志位。0:执行完SLEEP指令;1:上电后或者执行CLRWDT指令
static volatile bit ZERO    @ (unsigned)&STATUS*8+2; //零标志位。0:算术或逻辑操作结果不为0;1:反之。
static volatile bit DC      @ (unsigned)&STATUS*8+1; //数字进位/退位标志位。0:结果的低4位没有发生进位;1:反之。
static volatile bit CARRY   @ (unsigned)&STATUS*8+0; //进位/退位标志位。0:结果的高4位没有发生进位;1:反之。

使用特权

评论回复
10
features|  楼主 | 2020-8-10 09:48 | 只看该作者
/*      PORTA bits      */
static volatile bit RA5 @ (unsigned)&PORTA*8+5;   //RA5
static volatile bit RA4 @ (unsigned)&PORTA*8+4;   //RA4
static volatile bit RA3 @ (unsigned)&PORTA*8+3;   //RA3
static volatile bit RA2 @ (unsigned)&PORTA*8+2;   //RA2
static volatile bit RA1 @ (unsigned)&PORTA*8+1;   //RA1
static volatile bit RA0 @ (unsigned)&PORTA*8+0;   //RA0

使用特权

评论回复
11
features|  楼主 | 2020-8-10 09:48 | 只看该作者
/*      PORTB bits      */
static volatile bit RB7 @ (unsigned)&PORTB*8+7;   //RB7
static volatile bit RB6 @ (unsigned)&PORTB*8+6;   //RB6
static volatile bit RB5 @ (unsigned)&PORTB*8+5;   //RB5
static volatile bit RB4 @ (unsigned)&PORTB*8+4;   //RB4
static volatile bit RB3 @ (unsigned)&PORTB*8+3;   //RB3
static volatile bit RB2 @ (unsigned)&PORTB*8+2;   //RB2
static volatile bit RB1 @ (unsigned)&PORTB*8+1;   //RB1
static volatile bit RB0 @ (unsigned)&PORTB*8+0;   //RB0

使用特权

评论回复
12
features|  楼主 | 2020-8-10 09:49 | 只看该作者
/*      PORTC bits      */
static volatile bit RC7 @ (unsigned)&PORTC*8+7;   //RC7
static volatile bit RC6 @ (unsigned)&PORTC*8+6;   //RC6
static volatile bit RC5 @ (unsigned)&PORTC*8+5;   //RC5
static volatile bit RC4 @ (unsigned)&PORTC*8+4;   //RC4
static volatile bit RC3 @ (unsigned)&PORTC*8+3;   //RC3
static volatile bit RC2 @ (unsigned)&PORTC*8+2;   //RC2
static volatile bit RC1 @ (unsigned)&PORTC*8+1;   //RC1
static volatile bit RC0 @ (unsigned)&PORTC*8+0;   //RC0

使用特权

评论回复
13
features|  楼主 | 2020-8-10 09:49 | 只看该作者
/*      PORTD bits      */
#ifdef __PINS_40         
static volatile bit RD7 @ (unsigned)&PORTD*8+7;   //RD7
static volatile bit RD6 @ (unsigned)&PORTD*8+6;   //RD6
static volatile bit RD5 @ (unsigned)&PORTD*8+5;   //RD5
static volatile bit RD4 @ (unsigned)&PORTD*8+4;   //RD4
static volatile bit RD3 @ (unsigned)&PORTD*8+3;   //RD3
static volatile bit RD2 @ (unsigned)&PORTD*8+2;   //RD2
static volatile bit RD1 @ (unsigned)&PORTD*8+1;   //RD1
static volatile bit RD0 @ (unsigned)&PORTD*8+0;   //RD0

使用特权

评论回复
14
features|  楼主 | 2020-8-10 09:50 | 只看该作者
/*      PORTE bits      */
static volatile bit RE2 @ (unsigned)&PORTE*8+2;   //RE2
static volatile bit RE1 @ (unsigned)&PORTE*8+1;   //RE1
static volatile bit RE0 @ (unsigned)&PORTE*8+0;   //RE0
#endif

使用特权

评论回复
15
features|  楼主 | 2020-8-10 09:51 | 只看该作者
//* INTCON bits 中断控制寄存器 */
static volatile bit GIE  @ (unsigned)&INTCON*8+7; //总中断使能位。0:屏蔽所有的中断请求;1:允许非屏蔽的中断。
static volatile bit PEIE @ (unsigned)&INTCON*8+6; //外部中断使能位。0:禁止;1:使能
static volatile bit T0IE @ (unsigned)&INTCON*8+5; //TMR0溢出中断使能位。0:禁止;1:使能
static volatile bit INTE @ (unsigned)&INTCON*8+4; //RB0/INT外部中断使能位。0:不使能;1:使能。
static volatile bit RBIE @ (unsigned)&INTCON*8+3; //RB端口变化中断时能位。0:不使能;1:使能。
static volatile bit T0IF @ (unsigned)&INTCON*8+2; //TMR0溢出中断标志位。0:无溢出;1:溢出。
static volatile bit INTF @ (unsigned)&INTCON*8+1; //RB0/INT外部中断标志位。0:RB0外部中断未发生;1:RB0外部中断发生。
static volatile bit RBIF @ (unsigned)&INTCON*8+0; //RB端口变化中断标志位。0:RB口无变化;1:RB口至少有一个引脚变化。
// alternate definitions
static volatile bit TMR0IE @ (unsigned)&INTCON*8+5; //
static volatile bit TMR0IF @ (unsigned)&INTCON*8+2; //

使用特权

评论回复
16
features|  楼主 | 2020-8-10 09:53 | 只看该作者
//* PIR1 bits中断标志寄存器PIR1 */
#ifdef __PINS_40
static volatile bit PSPIF @ (unsigned)&PIR1*8+7;  //并行从端口读写中断标志位。0:没有读写操作发生;1:反之
#endif
static volatile bit ADIF @ (unsigned)&PIR1*8+6;  //A/D转换器中断标志位。0:A/D转换没有完成;1:A/D转换完成。
static volatile bit RCIF @ (unsigned)&PIR1*8+5;  //USART接收中断标志位。0:接收缓冲器空;1:反之。
static volatile bit TXIF @ (unsigned)&PIR1*8+4;  //USART发送中断标志位。0:发生缓冲器满;1:反之。
static volatile bit SSPIF @ (unsigned)&PIR1*8+3;  //同步串行端口(ssp)中断标志位。0:没有ssp中断条件发生;
static volatile bit CCP1IF @ (unsigned)&PIR1*8+2;  //CCP1中断标志位。
static volatile bit TMR2IF @ (unsigned)&PIR1*8+1;  //TMR2 TO PR2匹配中断标志位。0:没有匹配发生
static volatile bit TMR1IF @ (unsigned)&PIR1*8+0;  //TMR1溢出中断标志位,0:无溢出

使用特权

评论回复
17
features|  楼主 | 2020-8-10 09:54 | 只看该作者
/* PIR2 bits */
static volatile bit CMIF @ (unsigned)&PIR2*8+6;  //比较器中断标志位;0:比较器输入没有改变
static volatile bit EEIF @ (unsigned)&PIR2*8+4;  //EEPROM写操作中断标志位。0:写操作没有完成或没有开始
static volatile bit BCLIF @ (unsigned)&PIR2*8+3;  //总线冲突中断标志位。0:没有总线冲突发生
static volatile bit CCP2IF @ (unsigned)&PIR2*8+0;  //CCP2中断标志位

使用特权

评论回复
18
features|  楼主 | 2020-8-10 09:54 | 只看该作者
//* T1CON bits TMR1控制寄存器 */
static volatile bit T1CKPS1 @ (unsigned)&T1CON*8+5;  //TMR1输入时钟预分频选择位
static volatile bit T1CKPS0 @ (unsigned)&T1CON*8+4;  //TMR1输入时钟预分频选择位
static volatile bit T1OSCEN @ (unsigned)&T1CON*8+3;  //TMR1震荡器使能控制位。0:振荡器关闭
static volatile bit T1SYNC  @ (unsigned)&T1CON*8+2;  //TMR1外部时钟输入同步控制位。
static volatile bit TMR1CS  @ (unsigned)&T1CON*8+1;  //TMR1时钟源选择位。0:内部时钟的/4
static volatile bit TMR1ON  @ (unsigned)&T1CON*8+0;  //TMR1使能位。0:禁止

使用特权

评论回复
19
features|  楼主 | 2020-8-10 09:55 | 只看该作者
//* T2CON bits TMR2控制寄存器 */
static volatile bit TOUTPS3 @ (unsigned)&T2CON*8+6;  //TMR2后分频选择位。
static volatile bit TOUTPS2 @ (unsigned)&T2CON*8+5;  //TMR2后分频选择位
static volatile bit TOUTPS1 @ (unsigned)&T2CON*8+4;  //TMR2后分频选择位
static volatile bit TOUTPS0 @ (unsigned)&T2CON*8+3;  //TMR2后分频选择位。
static volatile bit TMR2ON  @ (unsigned)&T2CON*8+2;  //TMR2使能位。
static volatile bit T2CKPS1 @ (unsigned)&T2CON*8+1;  //TMR2预分频选择位。
static volatile bit T2CKPS0 @ (unsigned)&T2CON*8+0;  //TMR2预分频选择位

使用特权

评论回复
20
features|  楼主 | 2020-8-10 09:56 | 只看该作者

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

41

主题

463

帖子

1

粉丝