Microcontroller › 8051 › Power supply problem for 8051 › Sorry if forgot the time
May 31, 2013 at 7:04 pm
#9874
HallBrooks
Participant
Sorry if forgot the time delay but here is the code:
#include <reg52.h>
#define ON 0
#define OFF 1
sbit LED = P2^0;
void DelayMs(unsigned int msec);
void DelayMs(unsigned int msec)
{
unsigned int x,y;
for(x=0; x<=msec;x++)
{
for(y=0;y<=210;y++);
}
}
void main(void)
{
for(;
{
LED = ON;
DelayMs(100);
LED = OFF;
DelayMs(100);
}
}
#