Project

General

Profile

Statistics
| Revision:

root / branches / charge_station_isp / code / projects / template / timerBlink.c @ 578

History | View | Annotate | Download (902 Bytes)

1
#include <avr/io.h>
2

    
3
int main (void)
4
{
5

    
6
        /*
7
        TCCR1 is the timer counter compare register. 3 bits full of different settings you can change.
8
        We only cared about options in the first two bits.
9
        */
10

    
11
   //Timer Counter Compare Register 1
12
   TCCR1A = 0b11000011;
13

    
14
   //Timer Counter Compare Register 1
15
   TCCR1B = 0b00001001;
16
   
17
   //TCCR1C = 0b10000000;
18
   
19
   
20
   /*data direction register for d. Used to change between read and write.*/
21
   DDRD = 0b00100000;
22
   
23
   /*
24
   output compare register
25
   the output is high when the counter counts higher than this
26
   the higher the number, the lower the duty cycle
27
   note: this is a 10 bit counter so changing the left six won't do anything
28
   */
29
   OCR1A = 0b0000001000000000;
30
   
31
   //i tried to enable output compare A match interrupts; apparently this is useless
32
   //TIMSK1 = 0b00000010;
33

    
34
   while (1)
35
   {
36
   }
37
}