avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: avr-gcc-list digest, Vol 1 #222 - 4 msgs


From: Patrick Lanphier
Subject: [avr-gcc-list] Re: avr-gcc-list digest, Vol 1 #222 - 4 msgs
Date: Thu, 8 Nov 2001 09:00:30 -0500 (EST)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]