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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/12/09 07:28
Read: times


 
#168332 - 8 bit auto reload
I have connected a LED to p1.4 and the below code glows the LED for some ms and turns off. The time delay is close to 1 sec, plz tell me how can i make it exact 1 second time delay. It is a 8 bit auto reload timer mode.

$mod51
LED EQU P1.4

org 0000h

MOV TMOD,#20h ;Timer0 8-bit Auto Reload Mode
loop: MOV R3,#250H


CH: MOV TH0,#00h

CLR LED ;Turn ON LED

SETB TR0 ;Start Timer 0

JNB TF0,$ ;Wait till Timer 0 overflows

CLR TF0 ;Timer0 has overflowed clear the Flag

CLR TR0 ;Stop Timer0
DJNZ R3,CH

SETB LED ;Turn OFF LED

SETB TR0 ; Start Timer 0

JNB TF0,$ ;Wait till Timer 0 overflows

CLR TF0 ;Timer0 has overflowed clear the Flag

CLR TR0 ;Stop Timer0

ajmp loop

END

List of 6 messages in thread
TopicAuthorDate
8 bit auto reload            01/01/70 00:00      
   what crystal frequency?            01/01/70 00:00      
      11.05 Mhz            01/01/70 00:00      
         be precise            01/01/70 00:00      
   what happen at MOV R3,#250H            01/01/70 00:00      
      250            01/01/70 00:00      

Back to Subject List