Wednesday 6 March 2013

program to calculating the delays by using timers in 8051


//program to calculating the delays by using timers

#include<reg51.h>

void delay(void);
void main()
{

 while(1)
  {
    P1=0x55;
                delay();
                P1=0xAA;
                delay();
  }
}

void delay()
{
 TMOD=0x01;
 TH1=0x35;
 TL1=0xFF;
 TR0=1;
 while(TF0==0);
 TR0=0;
 TF0=0;
}

No comments:

Post a Comment