Attribute VB_Name = "Declare"
Option Explicit
'---------------------------------------------------------------------------------
'This is where the global variables are defined.These variables need to be visible to the entire
'project as the global parameters are used in multiple locations throughout the software.
'---------------------------------------------------------------------------------

'Global sweep parameters
Global StartFrequency As Double
Global midfrequency As Double
Global FrequencyIncrements As Double
Global NumberIncrements As Long
Global num_ave As Double
Global SettlingTime As Long
'Global control variables
Global Temperature As Double
Global Gain As Long
Global OutputVoltage As Long
Global GainFactor As Double

'Global stripx variables: stripx is the activx component (licence required)
'that this software uses to plot the impedance and phase vs frequency.

Global MinFrequencyPlot As Double
Global MaxFrequencyPlot As Double
Global DDSRefClockFrequency As Double
Global RealDataArray(512) As Double
Global ImagineryDataArray(512) As Double
Global code(512) As Double
Global MagnitudeArray(512) As Double
Global PhaseArray(512) As Double                    'final phase data
Global calibration_phase_mid_point As Double        'single point calibratipon phase
Global calibration_phase_multi_point(512) As Double 'Multi point calibration phase
Global calibration_GainFactors(512) As Double       'Multi point Gain factors
Global calibration_AveGainFactor As Double          'Average multipoint gain factor
Global conductivityArray(512) As Double             'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Global impedancechoice As Integer                   'used to track the calibration impedance topology.resistor,capacitor, R+C,R||c
Global systemclock As Integer                       'used to track the current device clock ing mechanism i.e either internal oscillator (AD5933 only) of external clock
Global IndexArray As Integer                        ' used as a counter variable in the sweep routine
Global IndexImpedance As Integer
Global IndexPhase As Integer
Global MinPhase As Double
Global MaxPhase As Double

Global GlobalDataArray(512) As Double  'generic data array
Global CalibratedImpedance1 As Double
Global CalibratedImpedance2 As Double
Global temp As Double
'-------------- Download data global variable-------------------------
Global GlobalDataArray1(512) As Double 'real data contained in this array
Global GlobalDataArray2(512) As Double 'imag data contained in this array
Global GlobalDataArray3(512) As Double 'impedance data contained in this array
Global GlobalDataArray4(512) As Double 'phase data contained in this array
Global GlobalDataArray5(512) As Double 'Code =sqrt r^2+i^2 data contained in this array
Global FrequencyPoints(512) As Double ' frequency data contained in this array
Global GlobaldataArray6(512) As Double
''-------------conductivity calibration data-------------------------
'Global AD5933_Gain As Double
'Global AD5933_Offset As Double
'Global Conductivity_gain As Double
'Global Conductivity_offset As Double
'-------------------------------------------------------------------

 


Sub Main()

'Initialise
Do Until DownLoadFirmware >= 0
        If vbRetry <> MsgBox("Firmware failed to download-Check USB connections", _
                            vbExclamation + vbRetryCancel, _
                            "Error") _
        Then
            End
        End If
    Loop


Form1.Show
'Load Form1

End Sub

