- This topic has 1 reply, 2 voices, and was last updated 9 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › PWM of servo motor using timer(mode 2) 89C51
hi all
i need a timer of 1usec,,using timer mode 2 of 89C51.
issue is: execution time of statements making up timer function is exceeding the net value of delay generated by timer,,
here it goes:
void timer()
{
TMOD=0x20;
TH1=0xFE;
TR1=1;
while(TF1==0);
TF1=0;
TR1=0;
}
we cn use 12/36 MhZ clock
plz repli
Hi Tahira,
You are continuously checking the timer flag inside a function to know whtehr the timer overflows or not, are you?. The better method is to enable the timer interrupt and use the timer ISR.