Evaluation Board User Guide
SettlingTimebyte0 = 0F '15 cycles (decimal) = 0F hex
SettlingTimebyte1 = 00 '00 = X1
WritetToPart &H8B, SettlingTimebyte0
WritetToPart &H8A, SettlingTimebyte1
'-------------------------------------- PLACE AD5933 IN STANDBYMODE ----------------------------------------
'Standby mode command = B0 hex
WritetToPart &H80, &HB0
'------------------------- Program the system clock and output excitation range and PGA setting-----------
'Enable external Oscillator
WritetToControlRegister2 &H81, &H8
'Set the output excitation range to be 2vp-p and the PGA setting to = x1
WritetToControlRegister2 &H80, &H1
'-----------------------------------------------------------------------------------------------------------
'------------- ------------ Initialize impedance under test with start frequency ---------------------------
'Initialize Sensor with Start Frequency
WritetToControlRegister &H80, &H10
msDelay 2
'this is a user determined delay dependent upon the network under analysis (2ms delay)
'-------------------------------------- Start the frequency sweep ------------------------------------------
'Start Frequency Sweep
WritetToControlRegister &H80, &H20
'Enter Frequency Sweep Loop
ReadbackStatusRegister = PortRead(&HD, &H8F)
ReadbackStatusRegister = ReadbackStatusRegister And &H4 ' mask off bit D2 (i.e. is the sweep complete)
Do While ((ReadbackStatusRegister <> 4) And (Increment <> 0))
'check to see if current sweep point complete
ReadbackStatusRegister = PortRead(&HD, &H8F)
ReadbackStatusRegister = ReadbackStatusRegister And &H2
'mask off bit D1 (valid real and imaginary data available)
'-------------------------------------------------------------------------
If (ReadbackStatusRegister = 2) Then
' this sweep point has returned valid data so we can proceed with sweep
Else
Do
'if valid data has not been returned then we need to pole stat reg until such time as valid data
'has been returned
'i.e. if point is not complete then Repeat sweep point and pole status reg until valid data
returned
WritetToControlRegister &H80, &H40 'repeat sweep point
ReadbackStatusRegister = PortRead(&HD, &H8F)
ReadbackStatusRegister = ReadbackStatusRegister And &H2
' mask off bit D1- Wait until dft complete
Loop Until (ReadbackStatusRegister = 2)
End If
'-------------------------------------------------------------------------
RealDataUpper = PortRead(&HD, &H94)
RealDataLower = PortRead(&HD, &H95)
RealData = RealDataLower + (RealDataUpper * 256)
'The Real data is stored in a 16 bit 2's complement format.
'In order to use this data it must be converted from 2's complement to decimal format
If RealData <= &H7FFF Then
' Positive
Else
' Negative
'
RealData = RealData And &H7FFF
RealData = RealData - 65536
End If
ImagineryDataUpper = PortRead(&HD, &H96)
Do
Loop While (ReadbackStatusRegister <> 2)
' h7fff 32767
Rev. 0 | Page 15 of 28
UG-364
Need help?
Do you have a question about the EVAL-AD5933EBZ and is the answer not in the manual?
Questions and answers