천상 단편기 학습의 LED 깜빡임
#include<reg52.h>
sbit D0=P1^0; // P1 ( LED )
sbit beep=P2^3; // P2 ( )
//
void delay(unsigned int time);
//
void main()
{
while(1)
{
D0=0; //LED
beep=0; //
delay(200); //
D0=1; //LED
beep=1; //
delay(200); //
}
}
//
void delay(unsigned int time)
{
unsigned int i=0,j=0;
for(i=0;i<time;i++)
{
for(j=0;j<200;j++);
}
}