AnsweredAssumed Answered

E5061B IVI driver, how to read marker value ?

Question asked by denis on Jun 18, 2013
Latest reply on Jun 21, 2013 by denis
I am working with Microsoft Visual studio 2012, visual basic and with IVI driver. I do not found the way to read marker value. Marker are activate and visible on the NA display. I am able to read the marker frequency (set previously by me) but not the marker value (in db). My init is done properly and ch1 is configured ch1 S21 and i am able to read ch1 data (801 points) and freq (801 point too)  with my test software. But I do not found a way to read marker level. 
Please, help me.  Here is a quick list of my vb code.

Imports Ivi.Driver.Interop
Imports Agilent.AgilentNA.Interop
Imports System
'Imports System.Runtime.InteropServices

Module Network_analyzer

Dim resourceDesc As String = "TCPIP0::" & My.Settings.IP_NA & "::inst0::INSTR"
Public Sub Set_ch1_S21_and_read_mkr_level()

        ' Create an instance of the driver

        Dim NA As New Agilent.AgilentNA.Interop.AgilentNA

        Dim initOptions As String = "QueryInstrStatus=true, Simulate=false, DriverSetup= Model=, Trace=false"
       Dim idquery As Boolean = True
        Dim reset As Boolean = True
          NA.Initialize(resourceDesc, idquery, reset, initOptions)
            ' Setup convineient pointers to Channels and Measurements
            Dim Ch1 As Agilent.AgilentNA.Interop.AgilentNAChannel

            Ch1 = NA.Channels.Item("Channel1")
            Dim points As Int32
            Ch1.Points = 801
            Ch1.StimulusRange.Start = 25000000
            Ch1.StimulusRange.Stop = 1025000000
            Ch1.IFBandwidth = 30000
            Ch1.SourcePower.Level(1) = -20

             Dim Ch1S21 As Agilent.AgilentNA.Interop.AgilentNAMeasurement

            Ch1S21 = Ch1.Measurements.Item("Measurement1")
            ' Setup S21 imaginary data measurement
            Ch1S21.Create(2, 1) ' Define S21 measurement
            Ch1S21.Trace.ReferenceValue = 0
            Ch1S21.Trace.ReferencePosition = 5
            Ch1S21.Trace.YScale = 0.5
            ' Ch1S21.Trigger.Source = AgilentNATriggerSourceEnum.AgilentNATriggerSourceInternal
            NA.Trigger.Source = AgilentNATriggerSourceEnum.AgilentNATriggerSourceInternal
            Ch1.TriggerMode = Agilent.AgilentNA.Interop.AgilentNATriggerModeEnum.AgilentNATriggerModeContinuous
           '"creation of one markers
Dim Ch1_markers1 As Agilent.AgilentNA.Interop.AgilentNAMarker
            Ch1_markers1 = Ch1S21.Markers.Item("Marker1")
            'Placer le frequence des marqueurs
            Ch1_markers1.Stimulus = 54000000.0
             'Demarer les marqueurs.
            Ch1_markers1.Enabled = True
         ' "How to read marker level ??
'"Marker reading code here

  ' Setup a measurement and output data
            Dim data() As Double
            Dim freq() As Double
            ' Read and output data
            data = Ch1S21.FetchFormatted()  'I am able to read this array (801 point of trace level)
            freq = Ch1S21.FetchX() ' I am able to read this array (801 point of freq)
            points = data.Length

         ReadInstruemtError(NA)  'Sub to catch error
        Catch err As System.Exception
            MsgBox("Exception Error:" & "  " + err.Message())
        End Try

        ' Close driver if initialized.
        If (NA.Initialized) Then
        End If

    End Sub