Need help on atmega32 for senior project asap

Sorry for posting something for a non-atmega 168 here but this is the forum I most frequent. I have a friend who is using an atmega 32 for his electrical engineering senior project. He is having some trouble with his code so I figured I'd ask here for any obvious mistakes.

The code is meant to light one of three leds and/or sound a piezo and activate a vib motor depending on the value of an analog sensor on port A0 and how long it has been below a threshold voltage(greater than .5s, greater than 1.5s). Also, no external crystal seems to have been used based on the schematic he sent me. Any help at all would be appreciated.

Here's the code:

#include<mega32.h>
#include<delay.h>


#define GREEN  PORTB.0        // Output port designations
#define YELLOW PORTB.1
#define RED    PORTB.2
#define BUZZER    PORTB.3
#define MOTOR  PORTB.4

#define START    PINC.0        // Input pin designations
#define RESET  PINC.1

unsigned char buzzer_on;    // Declaration of variables
unsigned char adc_data = 0xff;

// ADC interrupt service routine       
interrupt [ADC_INT] void adc_isr(void)               
{
// Read the 8 most significant bits
// of the AD conversion result
adc_data=ADCH;
ADCSRA=0xDE;   //start new conversion
}

interrupt [TIM0_OVF ] void ISR_TIMER0 (void)
{
    TCNT0 = 241;  //init count
    if(buzzer_on!=0)     //if buzzer on star tbuzzer at 1khz frec
        BUZZER = ~BUZZER;
}
void main (void)
{
   int i;   
// Declaration of variables
   char reset,state;

   PORTA=0x00;   
// Clear all ports
   DDRA=0x00;
// Clear all memory


// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
   ACSR=0x80;                                           
   SFIOR=0x00;

// ADC initialization
// ADC Clock frequency: 125.000 kHz
// ADC Voltage Reference: AVCC pin
// Only the 8 most significant bits of
// the AD conversion result are used
   ADMUX=0x60;
   ADCSRA=0xDE;

   DDRB = 0x1F; //outpus// Sets ports to output
   DDRC = 0x00; //inputs// Sets pin inputs

       /***init Timer0***/
    TCCR0 = 0x04;  //prescaler  256
    TCNT0 = 241;  //init count
    TIMSK |= 0x01; //unmask timer 0 overflow interrupt
   SREG |= 0x80;

   PORTB = 0x00;
   reset = 0;

   while(1)
   {
      YELLOW = RED = buzzer_on = MOTOR = 0;   
// Sets all to 0 (Green is go!)
      GREEN = 1;
      state = 0;

      do{
         while(adc_data > 230);    //wait eye to lose if not green led on
         delay_ms(110);        //test if is not a tab

         if(adc_data > 230)  //in eye still closed  go to green
            state = 1;
         else
            state = 0;

    }while(state == 0);
// Eye closes, interrupts green

      GREEN = 0;        //gren led off
      YELLOW = buzzer_on = 1;  //buzzer on
      reset = 0;
      i=0;
   do{
         delay_us(999);
         if(!RESET)
         {
           while(!RESET); //wait reset
           reset = 1;    //indicate has been a reset
         }

         i++;
      }while(!reset && i <100);   
// reset routine

     if(reset != 1 )  //if reset don't wait
     {
         YELLOW = 0;
         RED = MOTOR = 1;

         while(RESET);     //wait reset
         while(!RESET);
      }
   }
}

Ick, reminds me why I like using Arduino. Hardware abstration FTW.

What seems to be the problem?

(Reminds me of a joke. Customer calls up support for a software package. "It doesn't work" he says. "Can you be more explicit?" asks the support rep. "Sure," says Customer, "it doesn't ******g work").

The program seems to be not triggering the yellow led while it detects something (value lower than 230) but rather after it has detected something and is now going back above 230. It is supposed to trigger the yellow led and piezo after .5s of "seeing" less than 230 on the adc and trigger a red led and vib motor after 1.5s. It seems like the part in the first do while(state==1) loop is the problem. Is something flip flopped?

Also, Ive already said to change the interrupt variable to a volatile and am going to try expanding to the full adc value instead of the most significant 8 bits

adc_data has not been specified to be 'volatile'.

yea, thanks madworm, he's gonna change that and test it tomorrow. would that cause it to perform as described or just erratically in general? Reading through this has made me see how much I like arduino IDE and also how much I am missing by using it-both good and bad