|
爱科技、爱创意、爱折腾、爱极致,我们都是技术控
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 wang_00008 于 2020-3-7 03:59 编辑
#include<reg52.h> //52单片机头文件
#include <intrins.h> //包含有左右循环移位子函数的库
#define uint unsigned int //宏定义
#define uchar unsigned char //宏定义
sbit P1_0=P1^0;
uchar tt,a;
void main() //主函数
{
TMOD=0x01;//设置定时器0为工作方式1
EA=1;//开总中断
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
ET0=1;//开定时器0中断
TR0=1;//启动定时器0
a=0xfe;
while(1);//等待中断产生
}
void timer0() interrupt 1
{
//TR0=0;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
if(tt==2)
{
//for(a=0;a<7;a++)
{
tt=0;
P1=a;
a=_crol_(a,1);
}
}
}
/* for(a=0;a<7;a++)
{
tt=0;
P1=0x7f;
a=_cror_(a,1);
} */
请高手指点 中断重点
请问是计时中断0里面跑程序吗. 然后跳出再循环吗? |
|