Getting Started

The purpose of this chapter is to walk you through the steps to successfully run our 'Hello World' remote control example. The example sends one command to your instrument and reads its response.

From all different operating systems and physical connections we choose the most common case: LAN connection on Windows OS. As a programming environment we take the one that is free to use – Python in PyCharm. Many of the described steps are universal and can be used in other cases as well.

Step 1: Set up LAN connection between your computer and your instrument

Objective: Working LAN connection

  • Connect your computer and your instrument to the same LAN network.
  • Use instrument’s menu to find out or adjust its IP address. Windows-based instrument IP address can be adjusted in the instrument menu or in Windows Control Panel -> Network and Sharing Center menu. For example, R&S RTO IP address menu: Setup button -> System.
  • Make sure your instrument is reachable over LAN from your computer. To verify this, use e.g. ping test: Use WinKey + R, type 'cmd' + ENTER to open Windows command console. Type 'ping <instrument_IP_address>', e.g: ping 192.168.2.2
  • Do not proceed further, unless you have the TCP-IP connection working properly.

Step 2: Establish a VISA connection to your instrument

Objective: Successfull *IDN? query with VISA Tester Tool

For R&S VISA:

  • Install R&S VISA on your computer. If you use GPIB connection, you have to use the matching VISA. For example, to use NI GPIB hardware, you must use NI VISA.
  • Open R&S VISA Tester: Start->R&S VISA-> RsVisaTester.
  • To the Resource field enter 'TCPIP::<instrument_IP_address>::INSTR', e.g. 'TCPIP::192.168.2.2::INSTR'
  • Press Connect button.
  • In the Basics Tab, from the string combobox select a command *IDN?\n and press Query button.
  • See Chapter 3: VISA and VISA Tools for more details and screenshots.

For NI VISA:

  • Install NI VISA on your computer. If you use GPIB connection, you have to install NI-488.2 drivers in addition.
  • Open NI MAX, right-click on Devices and Interfaces -> Network devices and choose Create new VISA TCPI/IP Resource.
  • Select Manual entry of LAN Instrument, enter the instrument’s IP address into the field Hostname or IP address.Leave LAN Device Name field empty.
  • Use Validate button to verify if the VISA connection can be successfully established.
  • Open VISA Test Panel, select the Tab Input/Output, select the command *IDN?\n and press Query button.
  • See Chapter 3: VISA and VISA Tools for more details and screenshots.

Step 3: Install Python, PyCharm and PyVISA

Objective: Working Python installation, installed PyVISA package, working PyCharm environment.

  • Download and install Python 2.7.13 or newer (32-bit & 64-bit installer)
  • Download and install PyCharm (Professional or Community version)
  • Download Python Hello World example, extract it and open the file Python_directSCPI_Hello_World.py in PyCharm.
  • In Menu File->Settings->Project->Project Interpreter select the Python version you have downloaded.
  • Make sure you have PyVISA package installed: It has to be listed in the Project Interpreter Package list. If not, click on the green '+' button to download it. If you are behind a Proxy server, configure it in Menu File->Settings->Appearance->System Settings -> HTTP Proxy.
  • For offline package installation, see *Note1.

Step 4: Run the Hello World script

Objective: Obtain the instrument's reponse in the 'idn_response' variable and see the communication log.

  • In the file Python_directSCPI_Hello_World.py adjust the IP address in resourceString1 variable to to fit your instrument.
  • Start the script: Menu Run-> Run 'Python_directSCPI_Hello_World'. Your instrument responds with an identification string that is stored in the 'idn_response' variable. The script outputs the string e.g.: 'Hello, I am Rohde&Schwarz,RTO,...' into the Python Console.
  • Open VISA Trace Tool (described in Chapter 3) and run the script again to see the log of the communication.

*Note 1 - Offline installation of PyVISA package

To install PyVISA package offline:

  • Close PyCharm.
  • Download PyVISA package and a dependency package enum34
  • Create a batch file install_setup.bat with the following content:
    • c:\Python27\python.exe setup.py install
      pause
  • Extract the enum34 zip package to your local folder.
  • Copy created install_setup.bat file to the same folder where the extracted enum34 setup.py file is located.
  • Execute the batch file. That starts the package installation.
  • Repeat the same procedure for the PyVISA zip package.
  • Open PyCharm and check Menu File->Settings->Project->Project Interpreter Package list again.

Informationen anfordern

Haben Sie Fragen oder benötigen Sie weitere Informationen? Nutzen Sie hierzu einfach unser Kontaktformular und wir setzen uns umgehend mit Ihnen in Verbindung.

Ich möchte Informationen von Rohde & Schwarz erhalten per

Marketing-Einverständniserklärung

Was bedeutet das im Einzelnen?

Ich bin damit einverstanden, dass die ROHDE & SCHWARZ GmbH & Co. KG und die im Impressum dieser Website genannte, ROHDE & SCHWARZ zugehörige Gesellschaft oder Niederlassung, mich über den gewählten Kommunikationskanal (E-Mail oder Post) zu Marketing- und Werbezwecken kontaktiert (z.B. zur Übersendung von Informationen über Sonderangebote und Rabattaktionen), die in Zusammenhang mit Produkten und Lösungen aus den Bereichen Messtechnik, sichere Kommunikation, Monitoring and Network Testing, Rundfunk- und Medientechnik sowie Cybersicherheit stehen, aber nicht auf diese beschränkt sind.

Ihre Rechte

Diese Einverständniserklärung kann jederzeit durch Senden einer E-Mail, in deren Betreffzeile "Unsubscribe" steht, an news@rohde-schwarz.com, widerrufen werden. Darüber hinaus enthält jede von uns versandte E-Mail einen Link, durch den das Abbestellen zukünftiger Werbung per E-Mail möglich ist. Weitere Einzelheiten zur Verarbeitung personenbezogener Daten und zum Widerrufsverfahren finden sich in unserer Datenschutzerklärung..

Ihre Anfrage wurde erfolgreich versendet. Wir nehmen in Kürze Kontakt mit Ihnen auf.
An error is occurred, please try it again later.