AnsweredAssumed Answered

AD5933 Measurement (Status Reg)

Question asked by Maemo on May 26, 2016
Latest reply on Jul 1, 2016 by Maemo

Hello,

im pretty new in programming IC's so please excuse my mistakes if they are dumb. So i use a Raspberry Pi for the communication and my code is in Python. My problem is i always keep getting 0x60, 0x66 in the Status Register which makes no sense. Just sometimes i get 0x62 which should indicate valid real/img data. As a result my measurements are wrong. I can show you my code maybe there are some mistakes

 

import smbus

import math

 

bus = smbus.SMBus(1)


ADRESSE = 0x0D

j=0

x=0


 

#Startfrequency

bus.write_byte_data(ADRESSE, 0x82, 0x07)          #051EB8 @10khz #028F5C @5khz

bus.write_byte_data(ADRESSE, 0x83, 0xAE)         #0F5C28 @30khz #07AE14 @15 khZ

bus.write_byte_data(ADRESSE, 0x84, 0x14)          #199999 @50khz #0CCCCC @25khz


 

#Frequency increment

bus.write_byte_data(ADRESSE, 0x85, 0x00)          #00014F @10hz

bus.write_byte_data(ADRESSE, 0x86, 0x41)          #004189 @500hz

bus.write_byte_data(ADRESSE, 0x87, 0x89)


 

#Number of increments

bus.write_byte_data(ADRESSE, 0x88, 0x00)

bus.write_byte_data(ADRESSE, 0x89, 0x96)


 

#Control Register Settling Time Cycles

bus.write_byte_data(ADRESSE, 0x8A, 0x00)

bus.write_byte_data(ADRESSE, 0x8B, 0x32)


   

#Control Register Standby Mode

bus.write_byte_data(ADRESSE, 0x80,bus.read_byte_data(ADRESSE,0x80)&0x07 |0xB0)

 

 

#Control Register Initialiaze with start frequency

bus.write_byte_data(ADRESSE, 0x80, bus.read_byte_data(ADRESSE,0x80)&0x07 |0x10)

 

 

  #Control Register Start Frequency Sweep

bus.write_byte_data(ADRESSE, 0x80, bus.read_byte_data(ADRESSE,0x80)&0x07 |0x20)


  #Control Register Increment Frequency

bus.write_byte_data(ADRESSE, 0x80, bus.read_byte_data(ADRESSE,0x80)&0x07 |0x31)

bus.write_byte_data(ADRESSE, 0x81, bus.read_byte_data(ADRESSE,0x80)&0x07 |0x00)


 


while x<8000:

 

  status = bus.read_byte_data(ADRESSE,0x8F)

 

  if status==0x62:

  real1= bus.read_byte_data(ADRESSE, 0x94)

  real2= bus.read_byte_data(ADRESSE, 0x95)

 

  imag1= bus.read_byte_data(ADRESSE, 0x96)

  imag2= bus.read_byte_data(ADRESSE, 0x97)

 

  r= (real1*256)+real2

  i= (imag1*256)+imag2

 

  #Magnitude Calculation

b=math.sqrt((r**2)+(i**2))

 

  #Gain Factior

  c=4.62e-11                #515.819e-12 #5.39e-11#6.93e-11

 

  #Impedance Calculation

  z=1/(b*c)

 

  print (z)

  print (r)

  print ( i)

  print (status)

  break

 

  if status!=0x62:

bus.write_byte_data(ADRESSE, 0x80,bus.read_byte_data(ADRESSE,0x80)&0x07 | 0x30)

print(status)

  x=x+1

 


 

Outcomes