求大神根据下面的程序帮我画一个程序流程图,越详细越好。
#include "reg52.h"
***it IN = P1^0;
***it LED = P2^6;
***it RELAY=P2^0;
unsigned char
timeDelay=0; //5秒钟自动停止
voidTimerInit(void);
voidDelay_1ms(unsigned int i)
{
unsigned int x,j;
for(j=0;j
for(x=0;x<123;x++);
}
voidIN_Check(void)
{
if(IN==0)
{
Delay_1ms(10);
if(IN==0)
{
TimeDelay=3;
}
}
}
voidRelayControl(void)
{
if(TimeDelay>0)
{
RELAY=0;
LED=0;
}
else
{
RELAY=1;
LED=1;
}
}
void main(void)
{
TimerInit();
while(1)
{
IN_Check();
RelayControl();
}
}
voidTimer_ISR(void) interrupt 1
{
static unsigned char T50MS = 0;
TH0 = (65536-30000)/256;
TL0 = (65536-30000)%256;
if(TimeDelay>0)
{
T50MS++;
if(T50MS>=20)
{
T50MS=0;
if(TimeDelay>0)
TimeDelay--;
}
}
}
voidTimerInit(void)
{
TMOD = 0x01;
TH0 = (65536-50000)/256;
TL0 = (65536-50000)%256;
ET0 = 1;
TR0 = 1;
EA = 1;
}