© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
Page 48 of 52
' -----[ Program Code ]----------------------------------------------------
' Your program code goes here.
END
' -----[ Subroutines ]-----------------------------------------------------
' -----[ Ready ]-----------------------------------------------------------
' Wait for the driver to become not busy.
Ready:
DO
OWIN owio, 4, [busy] 'Read busy bit.
LOOP WHILE busy 'Keep checking until it goes low.
RETURN
' -----[ GetError ]--------------------------------------------------------
' Read the error flags from the driver.
GetError:
OWOUT owio, 0, [DUMPFLAGS] 'Read the error flags.
OWIN owio, 0, [flags]
IF (flags = $FF) THEN 'If $FF, driver is waiting for a reset.
OWOUT owio, 1, [DUMPFLAGS] 'So reset and try again.
OWIN owio, 0, [flags]
ENDIF
RETURN