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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/12/03 17:22
Read: times


 
#56555 - RE: help me with timer on 89c2051
Responding to: ???'s previous message
I found this example but it is in C wich i don't understand. Would it be possible that some one could translate it in asm?


1 #include <reg52.h>
2 #include <stdio.h>
3
4 /*------------------------------------------------
5 Timer 0 Interrupt Service Routine.
6
7 Set a breakpoint on 'overflow_count++' and run the
8 program in the debugger. You will see this line
9 executes every 65536 clock cycles.
10 ------------------------------------------------*/
11 static unsigned long ali = 0;
12
13 void timer0_ISR (void) interrupt 1
14 {
15 1 ali++; /* Increment the overflow count */
16 1 }
17
18 /*------------------------------------------------
19 MAIN C function
20 ------------------------------------------------*/
21 void main (void)
22 {
23 1 /*--------------------------------------
24 1 Set Timer0 for 16-bit timer mode. The
25 1 timer counts to 65535, overflows, and
26 1 generates an interrupt.
27 1
28 1 Set the Timer0 Run control bit.
29 1 --------------------------------------*/
30 1 TMOD = (TMOD & 0xF0) | 0x11; /* Set T/C0 Mode */
31 1 ET0 = 1; /* Enable Timer 0 Interrupts */
32 1 TR0 = 1; /* Start Timer 0 Running */
33 1 EA = 1; /* Global Interrupt Enable */
34 1
35 1 /*--------------------------------------
36 1 Do Nothing. Actually, the timer 0
37 1 interrupt will occur every 65536 clocks.
38 1 --------------------------------------*/
39 1 while (1)
40 1 {
41 2 }
42 1 }
43


List of 23 messages in thread
TopicAuthorDate
help me with timer on 89c2051            01/01/70 00:00      
   RE: help me with timer on 89c2051            01/01/70 00:00      
      RE: help me with timer on 89c2051            01/01/70 00:00      
         RE: help me with timer on 89c2051            01/01/70 00:00      
            RE: help me with timer on 89c2051            01/01/70 00:00      
               RE: help me with timer on 89c2051            01/01/70 00:00      
   RE: help me with timer on 89c2051            01/01/70 00:00      
      RE: help me with timer on 89c2051            01/01/70 00:00      
   RE: help me with timer on 89c2051            01/01/70 00:00      
      RE: help me with timer on 89c2051            01/01/70 00:00      
      RE: help me with timer on 89c2051            01/01/70 00:00      
         RE: help me with timer on 89c2051            01/01/70 00:00      
   RE: help me with timer on 89c2051            01/01/70 00:00      
      RE: help me with timer on 89c2051            01/01/70 00:00      
         RE: help me with timer on 89c2051            01/01/70 00:00      
            RE: help me with timer on 89c2051            01/01/70 00:00      
               RE: help me with timer on 89c2051            01/01/70 00:00      
                  RE: help me with timer on 89c2051            01/01/70 00:00      
                     RE: help me with timer on 89c2051            01/01/70 00:00      
                        RE: help me with timer on 89c2051            01/01/70 00:00      
                           RE: help me with timer on 89c2051            01/01/70 00:00      
   RE: help me with timer on lcd on 4bit            01/01/70 00:00      
      RE: help me with timer on lcd on 4bit            01/01/70 00:00      

Back to Subject List