Subversion Repositories MK3Mag

Rev

Rev 19 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 22
Line 66... Line 66...
66
/*****************************************************/
66
/*****************************************************/
67
/*              Initialize Timer 0                   */
67
/*              Initialize Timer 0                   */
68
/*****************************************************/
68
/*****************************************************/
69
void TIMER0_Init(void)
69
void TIMER0_Init(void)
70
{
70
{
71
        uint8_t sreg = SREG;
-
 
72
 
-
 
73
        // disable all interrupts before reconfiguration
-
 
74
        cli();
-
 
75
 
-
 
76
        // set PB2 as output for the PWM used to signal compass heading
71
        // set PB2 as output for the PWM used to signal compass heading
77
        DDRB |= (1<<DDB2);
72
        DDRB |= (1<<DDB2);
78
        PORTB &= ~(1<<PORTB2);
73
        PORTB &= ~(1<<PORTB2);
Line 101... Line 96...
101
        // Timer/Counter 0 Interrupt Mask Register
96
        // Timer/Counter 0 Interrupt Mask Register
102
        // enable timer overflow interrupt only
97
        // enable timer overflow interrupt only
103
        TIMSK0 &= ~((1<<OCIE0B)|(1<<OCIE0A));
98
        TIMSK0 &= ~((1<<OCIE0B)|(1<<OCIE0A));
104
        TIMSK0 |= (1<<TOIE0);
99
        TIMSK0 |= (1<<TOIE0);
Line 105... Line -...
105
 
-
 
106
        SREG = sreg;
100
 
Line 107... Line 101...
107
}
101
}
108
 
102