About a week ago i purchased the PmodIA from Digikey, right now i have it connected to a RaspberryPi3 to the 5V supply.
The select pin is connected to ground, SCL and SDA from the board are connected to the SCL and SDA from the RPi respectiveley.
Until now I've been able to read and write at the register 0x81, but I am not able to read the temperature of the device as you can see from the simple code I provide next:
import smbus
from time import sleep
ADDR_DEV = 0x0D
def write_reg(reg, value):
bus.write_byte_data(ADDR_DEV, reg, value)
def read_reg( reg):
return bus.read_byte_data(ADDR_DEV, reg)
bus = smbus.SMBus(1)
#reset
write_reg(0x81,0x10)
#Command measure temperature
write_reg(0x80,0x90)
#Command read register
print("0x80: ",bin(read_reg(0x80)))
#status
status = 0
while status == 0:
status = read_reg(0x8F) & 0x01
print("0x8F: ",bin(read_reg(0x8F)))
print("data not available")
sleep(2)
temp1=read_reg(0x92)
temp2=read_reg(0x93)
temp = ((temp1 & 0b111111)<<8 ) + temp2
temp = temp/32
print("temperature: ", temp)
#Power down
write_reg(0x80,0xA0)
The result of executing this simple program are here:
Quote
0x80: 0b10010000
0x8F: 0b1110000
data not available
0x8F: 0b1110000
data not available
0x8F: 0b1110000
data not available
0x8F: 0b1110000
data not available
I tested this same program with a single AD5933 with a 100k RFB connected and it works propperly.
If anyone would be so kind to provide any insight on what could be the issue with my device i would apreciate it very much.
Question
guillem sans
Hello,
About a week ago i purchased the PmodIA from Digikey, right now i have it connected to a RaspberryPi3 to the 5V supply.
The select pin is connected to ground, SCL and SDA from the board are connected to the SCL and SDA from the RPi respectiveley.
Until now I've been able to read and write at the register 0x81, but I am not able to read the temperature of the device as you can see from the simple code I provide next:
import smbus from time import sleep ADDR_DEV = 0x0D def write_reg(reg, value): bus.write_byte_data(ADDR_DEV, reg, value) def read_reg( reg): return bus.read_byte_data(ADDR_DEV, reg) bus = smbus.SMBus(1) #reset write_reg(0x81,0x10) #Command measure temperature write_reg(0x80,0x90) #Command read register print("0x80: ",bin(read_reg(0x80))) #status status = 0 while status == 0: status = read_reg(0x8F) & 0x01 print("0x8F: ",bin(read_reg(0x8F))) print("data not available") sleep(2) temp1=read_reg(0x92) temp2=read_reg(0x93) temp = ((temp1 & 0b111111)<<8 ) + temp2 temp = temp/32 print("temperature: ", temp) #Power down write_reg(0x80,0xA0)
The result of executing this simple program are here:
I tested this same program with a single AD5933 with a 100k RFB connected and it works propperly.
If anyone would be so kind to provide any insight on what could be the issue with my device i would apreciate it very much.
Thank you for your time.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.