Wednesday, 13 March 2013
Timer 0 program in 8051
2) /******* Timer 0******/
#include
void delay();
void main()
{
P0=0x00;
while(1)
{
delay(); // calling delay function
P0=~P0; //toggling P0
}
}
void delay()
{
TMOD=0x01; //Declaring or initialization of timer 0 in mode 1
TH0=0x10; // some delay using in 16bit timer mode
TL0=0x20;
TR0=1; // start timer
while(TF0==0); // checking for the TF flag to rise
TR0=0; // stop timer
TF0=0; // clearing the flag
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment