source: avrstuff/blinkled/main.c@ 26d7f34

main
Last change on this file since 26d7f34 was 26d7f34, checked in by Adrien Destugues <pulkomandy@…>, 14 years ago

Ajout de blinkdel (projet de test basique) et beep (synthèse musicale sur atmega8)

git-svn-id: svn://pulkomandy.tk/avrstuff@20 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

  • Property mode set to 100644
File size: 570 bytes
Line 
1#include <avr/io.h>
2#include <avr/interrupt.h>
3#include <avr/wdt.h>
4#include <avr/pgmspace.h>
5#include <util/delay.h>
6
7#include <string.h>
8#include <stdbool.h>
9
10int main() {
11 wdt_enable(WDTO_2S);
12 // configure timer 0 for a rate of 16M/(256 * 256) = ~244Hz
13 TCCR0 = 4; // timer 0 prescaler: 256
14
15 //debug LED - output
16 DDRB |= 255;
17
18 PORTB = 0xAA;
19
20 while(1) {
21 wdt_reset();
22
23
24 // check timer if we need periodic reports
25 if (TIFR & (1 << TOV0)) {
26 TIFR = (1 << TOV0); // reset flag
27 PORTB++;
28 }
29 }
30
31 return 0;
32}
33
Note: See TracBrowser for help on using the repository browser.