'Receive a byte from the I2C bus and place it into variable VAR1. Symbol Control2 = % 10010001 Address = 0xaa ' Read the value at address I2Cin SDA, SCL, Control , Address, [ VAR1 ] ' Read the byte Print At 4,1,Inverse 0,Dec VAR1
my code is -----> ' Send a byte to the I2C bus. Dim VAR1 As Byte ' We'll only read 8-bits Dim Address As Word ' 16-bit address required Symbol Control = % 10010000 ' Target Symbol SDA = PORTC.4 ' Alias the SDA (Data) line Symbol SCL = PORTC.3 ' Alias the SSL (Clock) line Address = 0xa1 ' Write to address VAR1 = 100 ' The value place into address I2COUT SDA, SCL, Control , Address , [ VAR1 ] ' Send the byte DelayMS 10 ' Allow time for allocation of byte Address = 0xa2 ' Write to address VAR1 = 5 ' The value place into address I2COUT SDA, SCL, Control , Address , [ VAR1 ] ' Send the byte DelayMS 10 ' Allow time for allocation of byte
could you please help me, i am trying to make i2c connection but none of the codes in proton help could run perfectly(I can not get a response). connection is between DS1621(temperature sensor) and Pic16f877a I printed it to a GLCD and it prints 0