Hello,

I wrote a timer program using Darrels
EE_Vars.PBP
DT_INTS-18.bas
ReEnterPBP-18.bas
Elapsed_INT-18.bas
and my program works great until I decided to try and save some code space by re-writing some of the code where I used IF-THEN-AND-ENDIF's. I can't seem to convert the code segment below to get it to work, as re-written the alarm won't sound for some reason. I'm using a PIC18f452-20/P. Its really starting to bug me why I can't figure it out as it seems pretty simple and straight forward enough?

Does anyone have any ideas on what I did wrong?

Thanks
jessey

Code:
This code works good.....

'This is the alarm check. The first IF-THEN here 
'prevents the alarm from sounding when the timer 
'set points aren't set, as it will be on the 
'initial power-up or when both resets buttons 
'have been pressed..............................
'==============================================='

IF Seconds = 0 AND Minutes = 0 AND Hours = 0 AND _
   Seconds_Alarm_Set_Point = 0 AND _
   Minutes_Alarm_Set_Point = 0 AND _
    Hours_Alarm_Set_Point = 0 THEN  
ELSE 'If above code is true then don't check the code below 
 IF Start_Stop_Mode = StartTime THEN 'if the clock is running    
  IF Seconds = Seconds_Alarm_Set_Point AND _
     Minutes = Minutes_Alarm_Set_Point AND _
        Hours = Hours_Alarm_Set_Point THEN
    GOSUB StopTimer : LOW Clock_Set_Green_Led 
    Alarm_Is = On_
  ENDIF
 ENDIF
ENDIF
Code:
This converted code from above doesn't work.....

IF Seconds = 0 THEN 
 IF Minutes = 0 THEN 
  IF Hours = 0 THEN
   IF Seconds_Alarm_Set_Point = 0 THEN
    IF Minutes_Alarm_Set_Point = 0 THEN
     IF Hours_Alarm_Set_Point = 0 then
     ELSE 'If above code is true then don't check the code below
      IF Start_Stop_Mode = StartTime THEN 'if the clock is running   
        IF Hours = Hours_Alarm_Set_Point THEN
         IF Minutes = Minutes_Alarm_Set_Point THEN
          IF Seconds = Seconds_Alarm_Set_Point THEN
            GOSUB StopTimer
            LOW Clock_Set_Green_Led : Alarm_Is = On_  
          ENDIF
         ENDIF    
        ENDIF
      ENDIF
     ENDIF
    ENDIF
   ENDIF
  ENDIF
 ENDIF
ENDIF