[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: first C program for an AVR2313
From: |
Bill Knight |
Subject: |
[avr-gcc-list] Re: first C program for an AVR2313 |
Date: |
Thu, 08 Nov 2001 14:23:34 -0600 |
Patrick
Congratulations!!
Since you asked and I want to know too, I have understood from postings
that the use of -O3 is dangerous with avr-gcc. Apparently it can frequently
cause the generation of incorrect code. maybe others on this list can
enlighten us both.
Regards
-Bill Knight
R O SoftWare
On Thu, 8 Nov 2001 09:00:30 -0500 (EST), Patrick Lanphier wrote:
>Below is my first C program for an AVR2313 chip. I don't undersand why
>when I incude the "SIGNAL" function things don't function at all. Thanks
>everyone for your help. Any general pointers would be great also.
>
>============================================================
>
>/*
>First C Program for the AVR-2313 Chip
>
>avr-gcc -O3 -mmcu=at90s2313 -c main.c -o main.elf
>avr-objcopy -S -O ihex main.elf main.hex
>*/
>
>#include <eeprom.h>
>#include <interrupt.h>
>#include <timer.h>
>#include <wdt.h>
>#include <math.h>
>#include <pgmspace.h>
>#include <stdlib.h>
>#include <errno.h>
>#include <io.h>
>#include <interrupt.h>
>#include <sig-avr.h>
>
>unsigned int led;
>SIGNAL(SIG_OVERFLOW0) {
> outp(0x1, PORTB);
> led = ~led;
> outp(led, PORTB);
> outp(0, TCNT0);
>}
>
>int main(void) {
> led = 0xFF;
> outp(0xFF,DDRB); // use all pins on PortB for output
> outp(led, PORTB);
> outp(0x1, PORTB);
> outp(TOIE0, TIMSK); // enable TCNT0 overflow
> outp(TOV0, TIFR); // TOV0: Timer/Counter0 Overflow Flag
> outp(0,TCNT0); // reset TCNT0
> outp(CS02 && CS00,TCCR0); //
> sei(); // enable interrupts
> while(1);
>}
>============================================================
>
>Patrick Lanphier
>The Artemis Group
>http://www.artemisgroup.com
>phone: 814-235-0444
> fax: 800-582-9710
>
>
>
>_______________________________________________
>avr-gcc-list mailing list
>address@hidden
>http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
>