Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/07/05 18:46
Read: times


 
#102108 - Need Help !!!!!
Hello to All!

I am very very new to Assembly so don't smile at my stupid questions :)

I have the following example code

Q: 1khz square wave. write a program using timer 0 to create a 1khz square wave on p1.0 ?

Ans:
ORG 008H
MOV TMOD, #01H ;16-bit timer mode
LOOP: MOV THO, #0FEH ;-500 (high byte)
MOV TL0, #0ch ;-500 (low byte)
SETB TR0
WAIT: JNB TF0, WAIT
CLR TRO
CPL P1.0
SJMP LOOP
END

I don't understand here about TH0 AND TL0? that how 1khz is converted to -500 and its assigned to TH0 AND TL0.

I think that for 500 times the pulses will be +ve (high) and 500 times -ve (low).

I have another example with different freq.

Q: 10khz Square Wave. Write a program using timer 0 to create 10khz square wave on p1.0 ?

Ans:
org....
MOV TMOD, #02H
MOV THO, -50 ;-50 RELOAD VALUE IN THO
......
......

Now howz that value of 10khz converted and the value of TH0 came?

I would be very thankful for your Reply .

List of 2 messages in thread
TopicAuthorDate
Need Help !!!!!            01/01/70 00:00      
   Clue            01/01/70 00:00      

Back to Subject List