Interfacing I2C IC with Proton Developement Board V1.0

Status
Not open for further replies.

Tamil.selvam

New Member
Hi all.....I'm trying to interface an 8-bit ADC circuit to a proton development board via a I2C IC (PCF 8574P)....but all i'm getting on the LCD is 11111111 regardless of what the input is....i know for certain that the ADC works as i'm getting the correct value on the LCD when i connect the ADC directly to the proton board....i've checked to make sure the all appropriate pins have been grounded.....the proton board uses a 16F877A Pic....does anyone have any suggestions? thank you for your time.

regards
Tamil
 
Hi Steve....here is my code....
Device 16F877A
XTAL = 20

ALL_DIGITAL = True

Declare SDA_PORT PORTC.4
Declare SCL_PORT PORTC.3
Declare HBUS_BITRATE 100


Dim ADC_Data As Byte

LCD_DTPIN = PORTD.4
LCD_ENPIN = PORTE.1

LCD_RSPIN = PORTE.0
LCD_LINES = 2

Main:

HBStart
HBusOut %01000100

If SSPCON2.6 = %1 Then
Cls
Print "No Ack"
DelayMS 3000
Else
ADC_Data = HBusIn
Cls
Print Dec ADC_Data
DelayMS 1000
End If


HBStop


GoTo Main

End sub

regards
Tamil
 
i think you need to examine your handshaking a bit

try using the high level i2c commands first, hbusin addr, loc, [data] ... and then try the low level

if I recall, a read happens like this

start
write device address R/w = w
write memory address
restart
write device address R/w = R
read
ack or stop
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…