Hi everybody!
I have a problem with PCF8574. I would have the necessity to read the state of 8 connected buttons to a PCF8574 and subsequently to visualize the sequence read on a display LCD of it. Have I written this firmware but doesn't it work, where am I being wrong?
Thanks everybody!
@ DEVICE HS_OSC
@ DEVICE pic16F877A
define OSC 20
ADCON1 = 7
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_LINES 2
Symbol SDA = PORTC.0
SYMBOL SCL = PORTC.1
symbol INT = PORTC.2
DATAPCF VAR BYTE
clear
LCDOUT $fe,1,"Test read PCF: "
Loop:
if INT = 0 then ReadPCF
goto Loop
ReadPCF:
I2Cread SDA,SCL,%01110001,DATAPCF
LCDOUT $FE,$C0,"Data: ",bin dataPCF," "
PAUSE 1000
goto Loop
Bookmarks