[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] AVR simulator and interrupts
From: |
James Fitzsimons |
Subject: |
[avr-gcc-list] AVR simulator and interrupts |
Date: |
Wed, 14 Jul 2004 19:15:47 +0100 |
Hi all,
I am new to the AVR and am trying to write a few simple test programs
before I get my stk500 and real parts. I have downloaded and installed
Klaus's avr simulator, and have managed to get it working with DDD and
avr-gdb.
I can single step through my program and watch variable values as they
change, however for some reason my Timer0 interrupt routine doesn't get
called.
I am using the build of the simulator found here
(http://home.comcast.net/~Bill5107/index.html) and am running it with
the command "simulavr -d at90s8515 -g".
I have included my (extremely simple) program below. It is more than
likely my own programming that is in error, so if anyone can help I
would very much appreciate it.
Cheers,
James Fitzsimons
#include <avr/io.h> // include I/O definitions (port names, pin
names, etc)
#include <avr/signal.h> // include "signal" names (interrupt
names)
#include <avr/interrupt.h> // include interrupt support
#include <avr/eeprom.h>
//#include "global.h" // include our global settings
#include <avr/timer.h> // include timer function library
(timing, PWM, etc)
volatile char flag;
volatile unsigned int clk;
void main(void)
{
int i=0;
flag = 0;
clk = TCNT0 = 0;
TIFR = 1<<TOV0;
TIMSK = 1<<TOIE0;
// timer stuff
timer0_source( CK ); // Writes 'src' into the TCCR0 register.
timer0_start();
for(i=0; i < 1000; i++)
clk = TCNT0;
timer0_stop(); // Stops Timer 0 by clearing the TCNT0 register.
}
SIGNAL(SIG_OVERFLOW0)
{
flag = ~flag;
}
- [avr-gcc-list] AVR simulator and interrupts,
James Fitzsimons <=