I think this will work...
Code:
<<<SNIP>>>
EEAddress=0
I2CREAD I2cData,I2cClock,$A0,EEAddress,[CheckPanelDigit]
pause 50
gosub TestHex
if ValidDigits = 1 then
EEAddress=1
I2CREAD DPIN,CPIN,$A0,EEAddress,[CheckPanelDigit]
pause 50
gosub TestHex
if ValidDigits = 1 then
Goto Vista
else
goto SnifferErr
endif
else
goto SnifferErr
endif
goto MainLoop
SnifferErr:
LCDout $fe, 1
LCDout $fe, 2, " ERROR "
Lcdout $fe, $C0, "PANEL NOT RECOGNIZED"
Lcdout $fe, $94, "CHECK CONNECTIONS OR"
Lcdout $fe, $D4, "SELECT CORRECT PANEL"
GOTO MainLoop
TestHex:
ValidDigits = 0
TestDigit = CheckPanelDigit & $0F ' Isolate the lower nibble
if TestDigit < 10 then ' First digit is 0-9
TestDigit = CheckPanelDigit >> 4 ' move high nibble to low nibble
if TestDigit < 10 then ' Second digit is 0-9
ValidDigits = 1 ' Set flag for good digits
endif
endif
return
How does that look? Am I thinking along the correct lines?
Thanks guys,
Chris
Bookmarks