在定时器0工作方式1下,从51单片机芯片的P1.0引脚产生400ms为周期的方波,一个周期中高电平
答案:1 悬赏:80
解决时间 2021-02-18 00:26
- 提问者网友:斑駁影
- 2021-02-17 19:17
在定时器0工作方式1下,从51单片机芯片的P1.0引脚产生400ms为周期的方波,一个周期中高电平
最佳答案
- 二级知识专家网友:洒脱疯子
- 2021-02-17 20:52
#include
#define uchar unsigned char
uchar time;
sbit pluse=P1^0;
void t0isr() interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
time++;
time%=20;
if(time==0)pluse=~pluse;
}
main()
{
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
#define uchar unsigned char
uchar time;
sbit pluse=P1^0;
void t0isr() interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
time++;
time%=20;
if(time==0)pluse=~pluse;
}
main()
{
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯