Generating one second delay using internal timers of 8051|Keil C – AT89C51| Assembly Language|

 Write a program and blink led connected to Port 1 having delay of 1 seconds using timers

Source code:

#include<reg51.h>

void delay ()

{

int i;

for (i=0;i<20;i++)

{

TMOD=0x01; //timer0

TL0=0xB0;

TH0=0x3C;

TR0=1;

while (TF0==0) ;

TF0=0;

TR0=0;

}

}

void main ()

{

while (1)

{

P1=0x00;

delay () ;

P1=0xFF;

delay () ;

}

}

Result:











Post a Comment

0 Comments