Hi,
Running into a little problem. When My Gosub functions ends, it does not return. Instead it stalls there and Both buttons do not work.. I have RB2 for Select and RB3 for Next (buttons) when it finished the minutes, the LCD freezes and nothing happens... some have a clue??
Code:'///////////////////////////////////// '/////////// SetProgrammerTime //////////// '///////////////////////////////////// SetProgrammerTime: pause 400 while Selection = 0 ' exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Time?" lcdout $FE,$C0, "Next or Select" pause 300 if NextOption=1 then return 'button NextOption, wend ThisYear = 2011 Pause 500 while Selection = 0 ' exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Year" lcdout $FE,$C0, dec4 ThisYear pause 300 if NextOption=1 then ThisYear = ThisYear +1 'Button on NextOption (PORTB.3) wend ThisMonth= 1 Pause 500 while Selection = 0 'exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Month" lcdout $FE,$C0, dec2 ThisMonth pause 300 if NextOption=1 then ThisMonth=ThisMonth +1 : pause 50 if ThisMonth > 12 then ThisMonth = 1 wend ThisDay= 1 Pause 500 while Selection = 0 ' exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Day" lcdout $FE,$C0, dec2 ThisDay pause 300 if NextOption=1 then ThisDay=ThisDay +1 if ThisDay > 31 then ThisDay = 1 wend ThisHour= 0 Pause 500 while Selection = 0 ' exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Hour" lcdout $FE,$C0, dec2 ThisHour pause 300 if NextOption=1 then ThisHour=ThisHour +1 if ThisHour > 59 then ThisHour = 1 wend ThisMin= 0 Pause 500 while Selection = 0 ' exit when selection becomes 1 Selection is a buton and next1 is another button on the main panel lcdout $FE,1, "Set Min" lcdout $FE,$C0, dec2 ThisMin pause 300 if NextOption=1 then ThisMin=ThisMin +1 if ThisMin > 59 then ThisMin = 0 wend Pause 300 'I2CWRITE SDApin,SCLpin,$D0,$00,[$00,ThisMin,ThisHour,$6,ThisDay,ThisMonth,ThisYear,$00] ' Writes to DS1307 'Pause 30 return



. The problem might be in your main code after the line GOSUB SetProgrammerTime. See how far the code runs before it freezes.

Bookmarks