PWM of servo motor using timer(mode 2) 89C51 | Microcontroller › 8051 › PWM of servo motor using timer(mode 2) 89C51 This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by AJISH ALFRED. Viewing 2 posts - 1 through 2 (of 2 total) Author Posts September 18, 2013 at 6:09 pm #2650 tahiraParticipant 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 September 19, 2013 at 5:05 am #10469 AJISH ALFREDParticipant 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. Author Posts Viewing 2 posts - 1 through 2 (of 2 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In