diff options
| author | Sudar <sudar@sudarmuthu.com> | 2014-09-21 12:05:12 +0530 |
|---|---|---|
| committer | Sudar <sudar@sudarmuthu.com> | 2014-09-21 12:05:12 +0530 |
| commit | ee1855c6b1aabf4d50afcfba69cecd2417d27237 (patch) | |
| tree | 05db0503f3cb1ffbd41f077ecf6135a429d5b66b /examples/BlinkInAVRC | |
| parent | 6f46722abb40c60dcaa0e40292342d015906c8bf (diff) | |
| parent | d092c14d7ec845246f6588704e22718615626982 (diff) | |
Merge pull request #268 from peplin/259-move-examples
Move tests back to 'examples', skip non-testable examples when testing.
Fix #259
Fix #260
Diffstat (limited to 'examples/BlinkInAVRC')
| -rw-r--r-- | examples/BlinkInAVRC/Makefile | 17 | ||||
| -rw-r--r-- | examples/BlinkInAVRC/blink.c | 38 |
2 files changed, 55 insertions, 0 deletions
diff --git a/examples/BlinkInAVRC/Makefile b/examples/BlinkInAVRC/Makefile new file mode 100644 index 0000000..9080b24 --- /dev/null +++ b/examples/BlinkInAVRC/Makefile @@ -0,0 +1,17 @@ +# This sample Makefile, explains how you can compile plain AVR C file. +# +# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile + +NO_CORE = Yes + +BOARD_TAG = atmega16 +MCU = atmega16 +F_CPU = 8000000L + +ISP_PROG = stk500v1 +AVRDUDE_ISP_BAUDRATE = 19200 + +include ../TestSuiteCommon.mk +include $(ARDMK_DIR)/Arduino.mk + +# !!! Important. You have to use make ispload to upload when using ISP programmer diff --git a/examples/BlinkInAVRC/blink.c b/examples/BlinkInAVRC/blink.c new file mode 100644 index 0000000..d8b7c8f --- /dev/null +++ b/examples/BlinkInAVRC/blink.c @@ -0,0 +1,38 @@ +/* + * © Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com + * + * ATmega48/88/168, ATmega16/32 + * + * Example Blink. Toggles all IO pins at 1Hz + */ + +#include <avr/io.h> +#include <util/delay.h> + +void init_io(void) +{ + // 1 = output, 0 = input + DDRB = 0b11111111; // All outputs + DDRC = 0b11111111; // All outputs + DDRD = 0b11111110; // PORTD (RX on PD0). Just for demo +} + +int main(void) +{ + init_io(); + + while (1) + { + PORTC = 0xFF; + PORTB = 0xFF; + PORTD = 0xFF; + _delay_ms(500); + + PORTC = 0x00; + PORTB = 0x00; + PORTD = 0x00; + _delay_ms(500); + } + + return 0; +} |
