Home Forums HTBasic Forum Programming modern SCPI equipment over the USB port

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7479
    K9VMY
    Participant

      I just purchased a Siglent SVA1032X Vector Network Analyzer and would like to be able to program it using HTbasic 10.1 that I purchased.

      I know how to load the USBS Driver, and set the GPIB address in the unit.

      Can anyone provide a simple program code example for setting the SPAN or CENTER FREQuency of this or any similar device?

      Thank you

      #7532
      ZeRider
      Participant

        Hi,
        I think you can download programming manual here : https://www.siglenteu.com/resources/documents/spectrum-analyzers/
        For example in this document “ProgrammingGuide_PG0703P_E02A.pdf” you will found SCPI commands overview and some programming example at the end.
        As I see, it’s seem very similar to KEYSIGHT programming.
        Please find some lines extract of my dedicated E4990A Analyzer HTBasic code
        Hope that could help …

        !——————————————————————
        ! ANALYZER KEYSIGHT E4990A
        !——————————————————————
        Analyzer=717
        !
        Fstart=1000 ! KHz
        Fstop=20000 ! KHz
        Fstep=50 ! KHz
        Npoint=((Fstop-Fstart)/Fstep)+1! #
        Average=256 ! #
        !
        OUTPUT Analyzer;”*CLS” ! Interface Device CLEAR
        OUTPUT Analyzer;”:SYST:PRES” ! Initial Setup
        !
        !—————————–
        ! SETUP CHANNEL1
        !—————————–
        OUTPUT Analyzer;”:DISP:WIND1:TRAC1:Y:SPAC LIN” ! Set Y-Axis at LIN Format
        OUTPUT Analyzer;”:DISP:WIND1:TRAC2:Y:SPAC LIN” ! Set Y-Axis at LIN Format
        !
        OUTPUT Analyzer;”:DISP:WIND1:TRAC1:STAT ON” !
        OUTPUT Analyzer;”:DISP:WIND1:TRAC2:STAT ON” !
        OUTPUT Analyzer;”:DISP:WIND1:TITL OFF” !
        OUTPUT Analyzer;”:DISP:WIND1:LAB ON” ! Axle Labels
        !
        OUTPUT Analyzer;”:CALC1:PAR1:DEF Z” ! Set Measurement parameter Trace1 : |Z|
        OUTPUT Analyzer;”:CALC1:PAR2:DEF TZ” ! Trace2 : Phi
        !
        OUTPUT Analyzer;”:CALC1:PAR:COUN 2″ ! Nb of Trace = 2
        !
        !—————————–
        ! SETUP STIMULUS1
        !—————————–
        OUTPUT Analyzer;”:SENS1:SWE:POIN “&VAL$(Npoint) ! Set Number of Points
        OUTPUT Analyzer;”:SENS1:FREQ:STAR “&VAL$(Fstart)! Set START Frequency
        OUTPUT Analyzer;”:SENS1:FREQ:STOP “&VAL$(Fstop) ! Set STOP Frequency

        OUTPUT Analyzer;”:SENS1:SWE:TYPE LIN” ! Set SWEEP Type at LIN
        OUTPUT Analyzer;”:SENS1:AVER:COUN “&VAL$(Avg) ! Average
        OUTPUT Analyzer;”:SENS1:AVER:STAT OFF”
        OUTPUT Analyzer;”:SENS1:APER 1″ ! Measurement Time FAST
        !
        OUTPUT Analyzer;”:SOUR1:MODE VOLT” ! Set OSC Mode
        OUTPUT Analyzer;”:SOUR1:VOLT 750E-3″ ! Set OSC Level
        OUTPUT Analyzer;”:SOUR1:ALC OFF” ! Turn OFF ALC
        !
        OUTPUT Analyzer;”:CALC1:AVER:COUN “&VAL$(Avg) !
        OUTPUT Analyzer;”:CALC1:AVER:STAT ON” !
        OUTPUT Analyzer;”:CALC1:AVER:CLE” !
        !
        END

        #7533
        K9VMY
        Participant

          Thank you for the example.
          I see that your program uses a GPIB Controller (7) plugged into the USB port. Obviously, the E8990A is set to 17.
          I have 2 Agilent 82357B GPIB Interface for my PC and a Siglent USB-GPIB Adapter which has a USB-A connector and a female GPIB connector. Unfortunatly, I cannot plug either into the USB-B GPIB port on the instrument.

          The other option would be to use the USB-A to USB-B cable to the instrument, but I don’t know what address to use for the Analyzer= line in your code? Would it be Analyzer=17? since there is no Adapter?

          Again, many thanks

          #7540
          ZeRider
          Participant

            Hi, I think you could try to connect directly your device to PC through USB.

            DIM Cmd$[80],Response$[1024]
            !
            Isc=13 ! Free Interface Select Code
            Devname$=”USBInstrument1″ ! Your Instrument Find in AGILENT Connection Expert / USB Interface
            ON ERROR GOSUB Erreur
            LOAD BIN “USBS;DEV “&Devname$&” ISC “&VAL$(Isc)&” TIME 10″
            !
            Identity: Response$=””
            Cmd$=”*IDN?”
            OUTPUT Isc;Cmd$
            ENTER Isc;Response$
            !
            PRINT Response$
            GOTO Exit
            !
            Erreur: OFF ERROR
            ERROR RETURN
            !
            Exit: END

            #7541
            K9VMY
            Participant

              Thank you, Very helpful!!!
              Have GREAT day

              #8651
              K9VMY
              Participant

                I noticed that your program only has OUTPUT Statements.

                My program works great, until I try to read a marker with my analyzer.

                I can turn it on a peak signal and send the following commands.

                OUTPUT Analyzer;”:CALC:MARK1:FCO:STAT ON”
                OUTPUT Analyzer;”:CALC:MARK1:FUNC FCO”
                OUTPUT Analyzer;”:CALC:MARK1:FCO:X?”;B ! This statement asks for data from the device

                When I try to read the result with:
                ENTER Analyzer;B
                The program times out and give me an error: “168 in 2380 Device Timeout”

                Traditionally I have used this procedure, it seems to no longer work with 10.2 or the new trial software.

                Also, I noticed in a previous post in setting up the USB driver you had an ON ERROR statement
                That program has an ENTER Statement, but the *IDN? never returns anything.

                Your thoughts on reading from an instrument

                #8652
                ZeRider
                Participant

                  I never test the 10.2 HTBasic version. I’m still on 10.1.
                  Have you try to read data with a STRING variable ?

                  DIM I$[200]
                  !
                  OUTPUT Analyzer;”:CALC1:MARK1 ON”
                  OUTPUT Analyzer;”:CALC1:MARK1:X:POS 1″
                  !
                  I$=””
                  OUTPUT Analyzer;”:CALC1:MARK1:Y?”
                  ENTER Analyzer;I$
                  I$=TRIM$(I$)
                  PRINT I$

                  #8653
                  K9VMY
                  Participant

                    Check with Ralph, we spent many e-mails working on this issue.
                    It starts with \n “Newline” issues from these instruments.
                    1 Your original code did not return the instrument’s ID. Here are the changes I made to make it work.
                    ***************************************************************
                    Newl$=CHR$(10)
                    ON ERROR GOSUB Erreur
                    Isc=18
                    Devname$=”USBInstrument1″ ! Your Instrument Find in AGILENT Connection Expert / USB Interface
                    Devname$=”SVA1032X” ! I changed the name of my device with the HTBasic Tools–>Devices
                    LOAD BIN “USBS;DEV “&Devname$&” ISC “&VAL$(Isc)&” TIME 10″

                    Identity: Response$=””
                    OUTPUT Isc;”*IDN?”&Newl$; !!!! NOTE THE NeWL$ and especially the SEMICOLON AT THE END of the line!!!
                    ENTER Isc USING “#,50A”;Response$ !!! We found that formatting allowed HTBasic to read the string
                    CLEAR SCREEN
                    PRINT Response$
                    PRINT “ISC Setup Success”
                    WAIT 10
                    GOTO Exit

                    Erreur: OFF ERROR
                    ERROR RETURN
                    **************************************
                    Result was printed on the screen as:
                    Siglent Technologies,SVA1032X,SSA3PCDX5R0598,3.2.2.5.0
                    ISC Setup Success

                    Next I played around with formatting the output statement for reading the marker, here is the code I came up with.
                    **************************************
                    Newl$=CHR$(10)
                    ON ERROR GOTO Err
                    B$=””
                    OUTPUT @Analyzer;”:CALC:MARK1:FCO:X?”&Newl$; !!!SEMICOLON PUT one at the end of all of our output statements!!!
                    ENTER @Analyzer USING “#,6A”;B$ !!!Only 6 characters
                    Marker=VAL(B$)
                    Err: OFF ERROR
                    PRINT ERRM$ !!!Print an error to prevent program from halting
                    PRINT B$
                    PRINT “Marker Frequency= “;Marker;” MHz”
                    **************************************
                    Again Check with Ralph, we had a very long exchange, he contacted other resources that helped define the problem.
                    HTBasic was written around old GPIB/HPIB instruments, the new stuff is designed entirely differently and CR/LF is not used even ignored by them. So extreme changes need to be made in HTBasic code to accommodate them.
                    The “Agilent Connection Expert” APP (Windows 10) was the main tool in verifying that it wasn’t an equipment issue!!!
                    Also “Agilent Interactive I/O tool” APP came along with it. I know I got it with my Agilent 82357B USB-GPIB interface CD,
                    I have it on all of my machines.

                    Hope this helps,
                    Thanks again for all of Ralph’s help!!!
                    73

                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • You must be logged in to reply to this topic.
                  Scroll to Top
                  HTB icon

                  Please Sign In