Re: Programming ATMega2560
"Thomas D. Dean" <[email protected]>
| Newsgroups | gmane.comp.hardware.avr.gcc |
|---|---|
| Message-ID | <[email protected]> |
On 11/26/14 14:25, Andreas Höschler wrote:
#define F_CPU 16000000UL /* 16 MHz CPU clock */
#include <avr/io.h>
#include <util/delay.h>
#define OUTPUTPORT PORTB
#define OUTPUTPIN PB7
int main (void) {
DDRB = 0xff; // all outputs
while (1) /* loop forever */
{
if ((PORTB & _BV(PB7)) > 0) PORTB &= ~_BV(PB7);
else PORTB |= _BV(PB7);
_delay_ms(500);
}
return (0);
}
> avr-gcc -mmcu=atmega2560 -Wall -O2 -I /usr/lib/avr/include/ main.c
No errors.
Tom Dean