We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
Dear Sir,
We are using GL868-DUAL module built in processor using python. We are able to Impliment I2C bus sucessfully, but it is responding garbage value.
Kindly refer attached example code and let us know, what is the issue.
#start of I2C example for a particular I2C device
import IIC
import SER
I2C_SDA = 3 # GPIO used for SDA pin
I2C_SCL = 4 # GPIO used for SCL pin
I2C_ADDR = 0x48 # myIIC1 address
SER.set_speed(‘115200′,’8N1’)
Thanks,
Diwakar
a = SER.send(‘————————————————————————rn’)
a = SER.send(‘ Example of I2C control: ADC PCF8591 rn’)
a = SER.send(‘————————————————————————rn’)
myIIC1 = IIC.new(I2C_SDA, I2C_SCL, I2C_ADDR)
status = myIIC1.init()
a = SER.send( ‘ STATUS: %srn’ % status)
ret = myIIC1.readwrite(‘x00’, 2)
ret1 = ret[0] # Assign 1st byte to ret1
ret2 = ret[1]
a = SER.send( ‘ ret: %srn’ % ret)
a = SER.send( ‘ ret1 %srn’ % ret1)
a = SER.send( ‘ ret2 %srn’ % ret2)
Please help us to getback.
I don’t know much about the PCF8591 AD/DA but you shouldn’t first set the control byte?
Try with the address shifted right, ie 0x24.