' {$STAMP BS2} ' {$PBASIC 2.5} Old1 VAR Byte(8) Cur1 VAR Byte(8) Status VAR Bit I VAR Nib MAIN: GOSUB ReadBoard GOSUB CheckBoard IF (Status = 1) THEN GOSUB ReportStatus Status = 0 ENDIF PAUSE 100 ' Scan every 100 mSec (1/10 second) GOTO MAIN ReadBoard: FOR I = 0 TO 7 HIGH I+8 Old1(I) = INL ' INL == Bits zero..7 LOW I+8 NEXT RETURN CheckBoard: Status = 0 FOR I = 0 TO 7 IF Old1(I) <> Cur1(I) THEN Status = 1 ENDIF NEXT IF Status = 1 THEN ' Then changed. Copy values FOR I = 0 TO 7 Cur1(I) = Old1(I) NEXT ENDIF RETURN ReportStatus: SEROUT 16, 16864, [DEC Cur1(0)] FOR I = 1 TO 7 SEROUT 16, 16864, [", ", DEC Cur1(I)] NEXT SEROUT 16, 16864, [CR] RETURN