CCP1输入捕捉仿真不对请高手指点

[复制链接]
2805|1
 楼主| zhql168 发表于 2011-12-22 19:24 | 显示全部楼层 |阅读模式

#include<pic.h>
int  count=0;
interrupt CCP1INT();
display();
initCCP1();
initPORTB();
main()
{
initPORTB();
initCCP1();
while(1)
{
display();
;;
}
}
initCCP1()
{
TRISC=0x04;
T1CON=0X00;
GIE=0;
PEIE=0;
CCP1IE=0;
CCP1IF=0;
CCP1IE=1;
PEIE=1;
GIE=1;
//TMR1ON=1;
CCP1CON=0x04;
}
interrupt CCP1INT()
{
GIE=0;
CCP1IE=0;
CCP1IF=0;
//TMR1ON=0;
count++;
if(count>9) {count=0;}
//display();
CCP1IE=1;
//TMR1ON=1;
GIE=1;
}
initPORTB()
{
TRISB=0x00;
PORTB=0x00;
}
display()
{
int disp;
disp=count&0x0f;
PORTB=disp;
//PORTB=count;
}
以上为程序,具体的PROTEUS仿真工程在附件,请高手帮帮忙

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:未来要做一个追风的大爷!

62

主题

288

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部