Add an example to show how to compile AVR C files
This commit is contained in:
parent
0028fabc64
commit
0149f34daf
3 changed files with 56 additions and 0 deletions
|
@ -10,6 +10,7 @@ The following is the rough list of changes that went into different versions. I
|
|||
- Add the ability to configure avrdude options. Fix issue #53
|
||||
- Handle cases where certain fuse bits are not present. Fix issue #61
|
||||
- Add support for compiling plain AVR C files. Fix issue #63
|
||||
- Add an example to show how to compile AVR C files. Fix issue #73
|
||||
|
||||
### 0.10.6 (2013-06-14)
|
||||
- Fix whitespace and add /dev/null redirection (https://github.com/sej7278)
|
||||
|
|
17
examples/BlinkInAVRC/Makefile
Normal file
17
examples/BlinkInAVRC/Makefile
Normal file
|
@ -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
|
||||
ISP_PORT = /dev/ttyACM*
|
||||
|
||||
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
|
||||
|
||||
# !!! Important. You have to use make ispload to upload when using ISP programmer
|
38
examples/BlinkInAVRC/blink.c
Normal file
38
examples/BlinkInAVRC/blink.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue