/[avr-libc]/avr-libc/doc/examples/demo/demo.c
ViewVC logotype

Diff of /avr-libc/doc/examples/demo/demo.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by joerg_wunsch, Sat Apr 9 14:53:04 2005 UTC revision 1.6 by joerg_wunsch, Fri Nov 4 22:55:15 2005 UTC
# Line 17  Line 17 
17  #include <inttypes.h>  #include <inttypes.h>
18  #include <avr/io.h>  #include <avr/io.h>
19  #include <avr/interrupt.h>  #include <avr/interrupt.h>
 #include <avr/signal.h>  
20    
21  #if defined(__AVR_AT90S2313__)  #if defined(__AVR_AT90S2313__)
22  #  define OC1 PB3  #  define OC1 PB3
# Line 68  enum { UP, DOWN }; Line 67  enum { UP, DOWN };
67  volatile uint16_t pwm; /* Note [1] */  volatile uint16_t pwm; /* Note [1] */
68  volatile uint8_t direction;  volatile uint8_t direction;
69    
70  SIGNAL (SIG_OVERFLOW1) /* Note [2] */  ISR (TIMER1_OVF_vect) /* Note [2] */
71  {  {
72      switch (direction) /* Note [3] */      switch (direction) /* Note [3] */
73      {      {
# Line 101  ioinit (void) /* Note [5] */ Line 100  ioinit (void) /* Note [5] */
100      /* enable OC1 and PB2 as output */      /* enable OC1 and PB2 as output */
101      DDROC = _BV (OC1);      DDROC = _BV (OC1);
102    
     timer_enable_int (_BV (TOIE1));  
   
103      /* enable interrupts */      /* enable interrupts */
104        TIMSK = _BV (TOIE1);
105      sei ();      sei ();
106  }  }
107    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26