[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] if test ignored?
From: |
Parthasaradhi Nayani |
Subject: |
Re: [avr-gcc-list] if test ignored? |
Date: |
Thu, 17 May 2007 20:45:45 -0700 (PDT) |
Rick Mann <address@hidden> wrote: On an AVR ATmega128:
I have two source files. In Serial.c, I define a global:
char sCommandReceived;
in the corresponding Serial.h file, I have:
extern char sCommandReceived;
sCommandReceived is set to 1 when enough bytes have been copied into
a buffer from the serial port. In main.c, which includes Serial.h, I
have:
while (true)
{
if (sCommandReceived)
{
parseCommand();
}
}
One probable cause could be 'sCommandReceived' not declared as volatile if it is being accessed in the interrupt
Nayani
Choose the right car based on your needs.
Check out Yahoo! Autos new Car Finder tool.
http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_ylc=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg--
hot CTA = Yahoo! Autos new Car Finder tool