8051 timer interrupt for generating 500 KHz

Status
Not open for further replies.

bagusdj

Member level 3
Joined
Nov 25, 2012
Messages
67
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,766
hey guys, i tried to interface adc 0809 to 8051 (at89s52). adc 0809 needs external clock, like adc 0808.

from my reference to generate clock it can be done using timer interrupt. the clock is 500 KHz.

the code is like this:

Code:
TMOD=0x02;  
TH0=0xFD;
IE=0x82;
TR0=1;

so tmod set to timer interrupt 0, IE set to enable interrupt timer 0, and TR0 makes timer run/start. i dont get it, why there is no lower value (TL)? this is the initialization for timer interrupt 0. how this initialization can be 500KHz clock?

please help me.
 

Timer 2 in clockout mode is the only feasible way to get output clock rates in the intended range. Review your 89S52 manual.
 

how about with code that i posted above?
 

I said "the only feasible way" with a reason. It's impossible to run 8051 interrupts at 500 kHz. 50 kHz will be demanding yet.
 

you r using mode 2 autoreload its a 8bit timer thats why it doesnt needs TL0 the value FD is stored in TL0 and when when TF flag sets that is TH value is increasing it autoreloads with FD
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…