-----Original Message-----
From: Per Arnold Blåsmo [mailto:address@hidden
Sent: 1. juni 2004 09:42
To: address@hidden
Subject: [avr-gcc-list] Bug in avr-libc or?
Hi,
I have been doing a program and got into a problem with a while loop.
Basically what I wanted to do was to do a while loop that
waited until a variable changed and so go out of the while loop.
The variable was altered by a interrupt routine.
What happen was that the variable in the while loop was
copied into a register and the while loop did test the
register instead of the variable.
Thereby never detecting any change of the variable done in
the interrupt routine.
I made a test program to show the result:
avrtest.c :
#include <avr/io.h>
#include <avr/signal.h>
uint8_t var;
SIGNAL(SIG_INTERRUPT0){
var = 0;
}
int main(void){
var = 1;
while(var==1){
// do nothing but wait
}
//Now do sometning
var = 2;
}