单片机流程图
程序如下做流程图#include<reg52.h>sbitBeep=P3^0;unsignedchart1,t2;unsignedchara30=0,a1=0;voidd...
程序如下 做流程图
#include <reg52.h>
sbit Beep = P3^0;
unsigned char t1,t2;
unsigned char a30 = 0,a1 = 0;
void delayms(unsigned int x)
{
unsigned int i,j;
for(i=0; i<x; i++)
for(j=0; j<1000; j++);
}
void Alarm(void)
{
Beep = 0;
delayms(20);
Beep = 1;
}
void main()
{
TMOD = 0x01;
TH0 = 0x3C;
TL0 = 0xB0;//50ms
EA = 1;
ET0 = 1;
TR0 = 1;
while(1)
{
if(a30)Beep = 0;//30s
if(a1)//1s
{
a1 = 0;
Alarm();
}
}
}
void TIM0(void) interrupt 1
{
TH0 = 0x3C;
TL0 = 0xB0;
t2++;
if(t2 == 20)//1s
{
t2 = 0;
t1++;
a1 = 1;
if(t1 == 30)//30s
{
TR0 = 0;
a30 = 1;
}
}
} 展开
#include <reg52.h>
sbit Beep = P3^0;
unsigned char t1,t2;
unsigned char a30 = 0,a1 = 0;
void delayms(unsigned int x)
{
unsigned int i,j;
for(i=0; i<x; i++)
for(j=0; j<1000; j++);
}
void Alarm(void)
{
Beep = 0;
delayms(20);
Beep = 1;
}
void main()
{
TMOD = 0x01;
TH0 = 0x3C;
TL0 = 0xB0;//50ms
EA = 1;
ET0 = 1;
TR0 = 1;
while(1)
{
if(a30)Beep = 0;//30s
if(a1)//1s
{
a1 = 0;
Alarm();
}
}
}
void TIM0(void) interrupt 1
{
TH0 = 0x3C;
TL0 = 0xB0;
t2++;
if(t2 == 20)//1s
{
t2 = 0;
t1++;
a1 = 1;
if(t1 == 30)//30s
{
TR0 = 0;
a30 = 1;
}
}
} 展开
展开全部
在想想 集体怎么做啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
程序不完整,就串口1和串口2初始化程序,以及中断服务程序,一个发送字符程序,没有主程序,画什么框图?
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询