is just a few inches away from a k... in the p.... 
Your code will get stuck if any phase fails. This is your code as I interpret it.
Code:
mainstest:'check phase rotation, using each phase as the ref, if all fwd or rev
'then supply is ok, if any disagree then a phase is down
rot1 = 0:rot2 = 0:rot3 = 0
while phase1 : wend
while !phase1 : wend 'wait for phase to go to beginning of a low cycle
while phase1 : wend
if phase2 then rot1=1 ' if next phase is high then rotation is fwd
while phase2:wend
while !phase2:wend
while phase2:wend
if phase3 then rot2 = 1
while phase3:wend
while !phase3:wend
while phase3:wend
if phase1 then rot3=1
'now test to see if all 3 rotations are the same
if rot1+rot2+rot3 & 3 then ' either 1 or 2 is not acceptable
high supply 'turn on supply fault led, and go check again
pause 100
goto mainstest
endif
low supply
return
And this is how it would work without hanging
Code:
mainstest:
temp.0 = phase1
temp.1 = phase2
temp.2 = phase3
temp = temp & 7 ' mask out the unwanted bits
if temp <> 0 or temp <> 7 then
high supply 'turn on supply fault led, and go check again
pause 100
goto mainstest
endif
low supply
return
Bookmarks