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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/09/03 11:31
Read: times


 
#38647 - difference between counter and timer
Responding to: ???'s previous message
firstly whats the difference b/w a counter and timer

i know that a counter+osciallaor makes a timer but whats the difference theorically speaking


Now I undertsand how to use the TCOn and TMOD like if I want to write a program to blink a LED after each second, 1 second delay then :-
I select timer 0 , timer mode 16 bit….

Now I have to play with timer TH0 and TL0 functions….
But I don’t understand the calculation work that I have to do before writing the code…

Like iam using 12 Mhz crsytal
That means

Timer will increment 1000000 times per second.

Now I have to divide 1000000 by such number that shows that the 1 second has passed

1000000 / 1000000 = 1 second has passed

So the timer has to count from 0 to 1000000

But in case of 16 bit timer will count maximum value of 0 to (256 x 256 = 65536 times )

Lets take a round of value like 50000 .

Now I know the following instruction helping me in writing a code for 1 second or 1 minute but how to make calculation to get values for the following equation to get a delay of 1 second or 1 minute

MOV TH0,___;High byte of _______ (____ * 256 = ?)
MOV TL0,#01;Low byte of 1 (? + 1 = ?)
MOV TMOD,#01;Put Timer 0 in 16-bit mode
SETB TR0;Make Timer 0 start counting
JNB TF0,$;If TF0 is not set, jump back to this same instruction


List of 19 messages in thread
TopicAuthorDate
1 Minute Delay            01/01/70 00:00      
   RE: 1 Minute Delay            01/01/70 00:00      
   RE: 1 Minute Delay            01/01/70 00:00      
   RE: 1 Minute Delay            01/01/70 00:00      
   Check my Delay            01/01/70 00:00      
      checking on simulator            01/01/70 00:00      
         Now 1 Minute delay program in assembly            01/01/70 00:00      
         RE: delay of x minutes            01/01/70 00:00      
            I really tried hard but no use            01/01/70 00:00      
               RE: I really tried hard but no use            01/01/70 00:00      
   RE: Check my Delay            01/01/70 00:00      
   RE: 1 Minute Delay            01/01/70 00:00      
   RE: I really tried hard but no use            01/01/70 00:00      
      Ijaz is right            01/01/70 00:00      
         RE: Waqar            01/01/70 00:00      
   RE: Software            01/01/70 00:00      
   difference between counter and timer            01/01/70 00:00      
      RE: difference between counter and timer            01/01/70 00:00      
      RE: difference between counter and timer            01/01/70 00:00      

Back to Subject List