[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] AtMega128 and Timers
From: |
Andreas Mahr |
Subject: |
[avr-gcc-list] AtMega128 and Timers |
Date: |
Sun, 09 Jun 2002 14:11:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020313 |
Hi All!
I've got a Problem with my Mega 128 Device.
Some time ago I wrote a set of functions for millisecond, so far on all
Devices I tested it, it worked.
But now it dose not work any more and I can't see why. Here is a little
Code:
volatile uint_32 milliseconds;
volatile uint_32 tick;
SIGNAL(SIG_OVERFLOW0)
{
TCNT0 = RELOAD_VAL_TIMER0;
milliseconds++;
}
inline void timer0_init(void)
{
milliseconds = 0;
ASSR = 0x00;
TCNT0 = RELOAD_VAL_TIMER0;
TCCR0 = _BV(CS2);
TIMSK = _BV(TOIE0);
}
void delay_ms(uint_32 del)
{
tick = milliseconds + del;
while (milliseconds <= tick);
}
As You can see I use Timer 0 for a millisecond trigger Intervall.
This was compiled with:
gcc version 3.1
binutils version 020530 20020529
avr-libc version 20020531
For me it looks like the ISR was never Triggered, even if all Interrups
where enabled by sei(); in main Init Routine.
Is there any known Problem with the Timers on Mega128?? Or is there a
Problem with the Interrupt Table in libc?
Also the Makros for Program Space PSTR() seem not to work the expected way.
For the older Compilers the following was almost the same:
lcd_putstr("Hello");
and
lcd_putstr(PSTR("Hello"));
the only difference was the location of the Data .text and .data.
But whith the new compiler neither work!
Thanks for Your Help
A. Mahr
avr-gcc-list at http://avr1.org
- [avr-gcc-list] AtMega128 and Timers,
Andreas Mahr <=