English
Language : 

EVAL-AD5933EBZ Datasheet, PDF (16/32 Pages) Analog Devices – Evaluation Board for the 1 MSPS 12-Bit Impedance Converter Network Analyzer
EVAL-AD5933EB
Preliminary Technical Data
EVALUATION BOARD SOURCE CODE EXTRACT
‘-------------------------------------------------------------------------------------------------------
‘Code developed using visual basic® 6.
‘Datatype range
‘Byte
0-255
‘Double
-1.797e308 to – 4.94e-324 and 4.94e-324 to 1.7976e308
‘Integer -32,768 to 32767
‘Long
-2,147,483,648 to 2,147,483,647
‘Variant‘...when storing numbers same range as double. When storing strings same range as string.
‘-------------------------------------- Variable Declarations -----------------------------------------
Dim ReadbackStatusRegister As Long 'stores the contents of the status register.
Dim RealData As Double
'used to store the 16 bit 2s complement real data.
Dim RealDataUpper As Long
'used to store the upper byte of the real data.
Dim RealDataLower As Long
'used to store the lower byte of the real data.
Dim ImagineryData As Double
'used to store the 16 bit 2s complement real data.
Dim ImagineryDataLower As Long
'used to store the upper byte of the imaginary data.
Dim ImagineryDataUpper As Long
'used to store the lower byte of the imaginary data.
Dim Magnitude As Double
'used to store the sqrt (real^2+imaginary^2).
Dim Impedance As Double
'used to store the calculated impedance.
Dim MaxMagnitude As Double
'used to store the max impedance for the y axis plot.
Dim MinMagnitude As Double
'used to store the min impedance for the y axis plot.
Dim sweep_phase As Double
'used to temporarily store the phase of each sweep point.
Dim Frequency As Double
'used to temporarily store the current sweep frequency.
Dim Increment As Long
'used as a temporary counter
Dim i As Integer
'used as a temporary counter in (max/min) mag,phase loop
Dim xy As Variant
'used in the stripx profile
Dim varray As Variant
Dim Gainfactor as double
‘either a single mid point calibration or an array of calibration points
Dim TempStartFrequency
As Double
Dim StartFrequencybyte0 As Long
Dim StartFrequencybyte2 As Long
Dim StartFrequencybyte1A As Long
Dim StartFrequencybyte1B As Long
Dim DDSRefClockFrequency As Double
Dim NumberIncrementsbyte0 As Long
Dim NumberIncrementsbyte1 As Long
Dim FrequencyIncrementbyt0 As Long
Dim FrequencyIncrementbyt1 As Long
Dim FrequencyIncrementbyt2 As Long
Dim SettlingTimebyte0
As Long
Dim SettlingTimebyte1
As Long
‘-------------------------------------- I^2C read/write definitions-----------------------------------------
‘used in the main sweep routine to read and write to AD5933.This is the vendor request routines in the
firmware
Private Sub WritetToPart(RegisterAddress As Long, RegisterData As Long)
PortWrite &HD, RegisterAddress, RegisterData
‘parameters = device address register address register data
End Sub
Public Function PortWrite(DeviceAddress As Long, AddrPtr As Long, DataOut As Long) As Integer
PortWrite = VendorRequest(VRSMBus, DeviceAddress, CLng(256 * DataOut + AddrPtr), VRWRITE, 0, 0)
End Function
Public Function PortRead(DeviceAddress As Long, AddrPtr As Long) As Integer
PortRead = VendorRequest(VRSMBus, DeviceAddress, AddrPtr, VRREAD, 1, DataBuffer(0))
PortRead = DataBuffer(0)
End Function
‘------------------------------------- PHASE CONVERSION FUNCTION DEFINITION --------------------------------
‘This function accepts the real and imaginary data(R, I) at each measurement sweep point and converts it to
a degree
‘-----------------------------------------------------------------------------------------------------------
Public Function phase_sweep (ByVal img As Double, ByVal real As Double) As Double
Dim theta As Double
Dim pi As Double
pi = 3.141592654
If ((real > 0) And (img > 0)) Then
theta = Atn(img / real)
' theta = arctan (imaginary part/real part)
Rev. PrC | Page 16 of 32