Subversion Repositories Projects

Rev

Rev 274 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 274 Rev 296
Line 34... Line 34...
34
        PORTC &= ~(1<<PORTC7);
34
        PORTC &= ~(1<<PORTC7);
35
        #endif
35
        #endif
Line 36... Line 36...
36
 
36
 
Line 37... Line 37...
37
        // Timer/Counter 0 Control Register A
37
        // Timer/Counter 0 Control Register A
38
 
-
 
39
        // Waveform Generation Mode is Fast PWM (Bits WGM02 = 0, WGM01 = 1, WGM00 = 1)
-
 
40
    // Clear OC0A on Compare Match, set OC0A at BOTTOM, noninverting PWM (Bits COM0A1 = 1, COM0A0 = 0)
-
 
41
    // Clear OC0B on Compare Match, set OC0B at BOTTOM, (Bits COM0B1 = 1, COM0B0 = 0)
38
 
Line 42... Line 39...
42
    TCCR0A &= ~((1<<COM0A0)|(1<<COM0B0));
39
        // Waveform Generation None (Bits WGM02 = 0, WGM01 = 0, WGM00 = 0)
Line 43... Line 40...
43
    TCCR0A |= (1<<COM0A1)|(1<<COM0B1)|(1<<WGM01)|(1<<WGM00);
40
    TCCR0A &= ~((1<<COM0A0)|(1<<COM0B0)|(1<<COM0A1)|(1<<COM0B1)|(1<<WGM01)|(1<<WGM00));
44
 
41
 
Line 50... Line 47...
50
 
47
 
51
        // divider 8 (Bits CS02 = 0, CS01 = 1, CS00 = 0)
48
        // divider 8 (Bits CS02 = 0, CS01 = 1, CS00 = 0)
52
        TCCR0B &= ~((1<<FOC0A)|(1<<FOC0B)|(1<<WGM02));
49
        TCCR0B &= ~((1<<FOC0A)|(1<<FOC0B)|(1<<WGM02));
Line 53... Line -...
53
    TCCR0B = (TCCR0B & 0xF8)|(0<<CS02)|(1<<CS01)|(0<<CS00);
-
 
54
 
-
 
55
        // initialize the Output Compare Register A & B used for PWM generation on port PB3 & PB4
-
 
56
    OCR0A =  0;  // for PB3
-
 
57
    OCR0B = 120; // for PB4
50
    TCCR0B = (TCCR0B & 0xF8)|(0<<CS02)|(1<<CS01)|(0<<CS00);
58
 
51
 
Line 59... Line 52...
59
        // init Timer/Counter 0 Register
52
        // init Timer/Counter 0 Register
60
    TCNT0 = 0;
53
    TCNT0 = 0;