It appears that the hi2cin 0,(j) command sets all lines on the PCF8574A low. This means that when a button is detected the appropriate LED lights for 1 sec and then goes out when the prog loops around for the next hi2cin 0,(j) command.
Circuit and prog attached.
Circuit and prog attached.
Code:
symbol i = b23
symbol j = b22
Symbol Speaker = c.7
sound Speaker, (120,3)
HI2CSETUP I2CMASTER, $40, i2cfast, i2cbyte
TestMain1:
; Button Test
hi2cin 0,(j)
i = j & 16
if i > 0 then
hi2cout 0,(%00001110)
PAUSE 1000
endif
i = j & 32
if i > 0 then
hi2cout 0,(%00001101)
PAUSE 1000
endif
goto TestMain1
#no_table
Attachments
-
355 bytes Views: 5
-
30.1 KB Views: 19
Last edited by a moderator: