Tool/software: Linux
I am using ADC128D818 to read feedback of my loads current. I am able to communicate with the device, the reading I am getting does not make sense. Could some one able to see my setup commands make suggestions
We are using: python 3.4.2
FEEDBACK SETUP
def setupFB(self, addresses):
for adr in addresses:
if self.bus.read_byte_data(adr, 0x0c) <= 1:
self.bus.write_byte_data(adr, 0x00, 0x00)
if self.bus.read_byte_data(adr, 0x0b) != 0x02:
print("set advanced config")
self.bus.write_byte_data(adr, 0x0b, 0x02)
else:
print("advanced config already set")
if self.bus.read_byte_data(adr, 0x07) != 0x01:
print("done1")
self.bus.write_byte_data(adr, 0x07, 0x01)
else:
print("done2")
if self.bus.read_byte_data(adr,0x08) != 0x00:
print("set channel")
self.bus.write_byte_data(adr, 0x08, 0x00)
else:
print("channel already set")
self.bus.write_byte_data(adr, 0x00, 0x01)
READING VALUES
if self.bus.read_byte_data(address, 0x0c) <= 1:
array = self.bus.read_i2c_block_data(address, 0x22, 0x02)
print("if")
print(bin(array[0]), bin(array[1]))
else:
print("else")
print((array[0]) << 8 + array[1] & 0xFF)