Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 36216

Re: AD5933 source code

$
0
0

Hello,

 

1. I tried with unknown resistors of 22 kOhms (that gives correct results), then 18 kOhms, 28 kOhms  and 49.9 kOhms. In last three measurements the results are closed to 21-22 kOhms or they are totally unpredictable- 180 kOhms, 38 kOhms... Before that I tried with 49.9 kOhms as Rfb and in that case or measurement results are closed to that value (for 28, 22 and 18 kOhms). Because of that I think that there is some problem with my code and signed and unsigned values, it is obviously that results are ok only if unknown resistance is closed to calibration value. I used "AD5933 theoretical" for calculations and for my settings the resistance range is from 13 do 300 kOhms (see attachment).

2. Can we discuss about the following program sequence (for begging we can assume that function "write_byte" is written correctly).

*********************************************

unsigned char Rh, Rl, Ih, Il;

signed short int R, I;

double Z = 0.0, GF = 1.0, Result = 0.0;

********************************************

//start frequency register - 50 kHz

  Byte_write (0x84, 0x00);

  Byte_write (0x83, 0x6A);

  Byte_write (0x82, 0x18);

 

//frequency increment register - 1 kHz

  Byte_write (0x87, 0x02);

  Byte_write (0x86, 0x7D);

  Byte_write (0x85, 0x00);

 

//number of increments - 10

  Byte_write (0x89, 0x0A);

  Byte_write (0x88, 0x00);

 

//settling time cycles register - 15

  Byte_write (0x8B, 0x0F);

  Byte_write (0x8A, 0x00);

 

//CONTROL register

//AD5933 in standby mode

  Byte_write (0x80, 0xB0);

 

//internal clock 16.77 MHz

  Byte_write (0x81, 0x00);

 

//range 1 (1vp-p, 1.6v) PGA = x1

  Byte_write (0x80, 0x07);

 

  //Initialize

  Byte_write(0x80, 0x17); //initialize with start frequency

  Byte_write(0x80, 0x27); //start sweep

 

  //wait for correct results

  while(!(Byte_read(0x8F) & 0x02));

 

  //real data

  Rh = Byte_read(0x94);

  Rl = Byte_read(0x95);

R = 256*Rh+Rl;

 

  //Imag data

  Ih = Byte_read(0x96);

  Il = Byte_read(0x97);

I = 256*Ih+Il;

 

//Z calculating

  Z = sqrt(R*R+I*I);

  Result = 1.0/(Z*GF);

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 36216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>