I have made the program below to run a simple leak test fixture. The problem I am having is that the machine randomly gets lost and the two bottom seal variables lock in the 0 or off position and do not function unless the power is taken away and the chip is reset. I have tried several different versions of the program to try and fix the problem and by everything i know and have read this should neevr happen in this situatyion. Any help would be much appreciated.
\\code\\
CMCON = %00000111 ' set all pins to digital
GPIO = %00000000 ' set all pin states to off
TRISIO = %00001000 ' All pin states to out except MCLR for trigger
WPU = %00000000 ' Shut off weak pull ups
INTCON = %00000000
'Register Initializations'
'Variables'
SWING_EXT VAR GPIO.0 ' Set variable names for pins
SWING_RET VAR GPIO.1
BOT_SEAL_RET VAR GPIO.4
BOT_SEAL_EXT VAR GPIO.5
MAIN_TRIGGER VAR GPIO.3
a0 VAR BYTE ' Byte variables for button
I VAR WORD ' Word variable for looping
'Variables'
'************************************************* ***************************
'************************************************* ***************************
INITIALIZE:
A0 = %00000000 ' INITIALIZE BUTTON BYTE TO ZERO
BOT_SEAL_RET = 1
PAUSE 500
BOT_sEAL_RET = 0
PAUSE 500
MAIN:
SWING_EXT = 1
PAUSE 500
GOTO MAIN_TRIG_CHECK
GOTO MAIN
MAIN_TRIG_CHECK:
BUTTON MAIN_TRIGGER, 1, 255, 0, A0, 1, START_OP
GOTO MAIN_TRIG_CHECK
START_OP:
SWING_EXT = 0
PAUSE 500
SWING_RET = 1
PAUSE 500
GOTO TEST
TEST:
BOT_SEAL_EXT = 1
PAUSE 500
GOTO TEST_TRIG_CHECK
GOTO TEST
TEST_TRIG_CHECK:
BUTTON MAIN_TRIGGER, 1, 255, 0, A0, 1, START_OVER
GOTO TEST_TRIG_CHECK
START_OVER:
BOT_SEAL_EXT = 0
pause 100
BOT_SEAL_RET = 0
pause 100
SWING_RET = 0
pause 100
swing_ext = 0
GOTO INITIALIZE
END
\\code\\
Bookmarks