main
Last change
on this file since 3587f7f was df91872, checked in by Adrien Destugues <pulkomandy@…>, 13 years ago |
- Blinkdel for attiny2313 (and easier to adapt)
- Ramcard schematic update
git-svn-id: svn://pulkomandy.tk/avrstuff@36 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe
|
-
Property mode
set to
100644
|
File size:
585 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 |
|
---|
10 | int main() {
|
---|
11 | wdt_enable(WDTO_2S);
|
---|
12 | // configure timer 0 for a rate of 16M/(256 * 256) = ~244Hz
|
---|
13 | TCCR0A = 0; // timer 0 prescaler: 256
|
---|
14 | TCCR0B = 4;
|
---|
15 |
|
---|
16 | //debug LED - output
|
---|
17 | DDRD |= 255;
|
---|
18 |
|
---|
19 | PORTD = 0xAA;
|
---|
20 |
|
---|
21 | while(1) {
|
---|
22 | wdt_reset();
|
---|
23 |
|
---|
24 |
|
---|
25 | // check timer if we need periodic reports
|
---|
26 | if (TIFR & (1 << TOV0)) {
|
---|
27 | TIFR = (1 << TOV0); // reset flag
|
---|
28 | PORTD++;
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | return 0;
|
---|
33 | }
|
---|
34 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.