main
Last change
on this file since 98713b5 was 98713b5, checked in by Adrien Destugues <pulkomandy@…>, 14 years ago |
Copy of blinkled as a baseproject for attiny2313 tests for microserial.
git-svn-id: svn://pulkomandy.tk/avrstuff@30 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe
|
-
Property mode
set to
100644
|
File size:
585 bytes
|
Rev | Line | |
---|
[98713b5] | 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.