Python Examples
This section illustrates using Python 3.9 to control FlexPLL. Even if you don't use Python, these scripts will help you to understand the program requirements. The examples were all tested using the following environment:
- Windows 10 PC
- Keysight IO Libraries Suite installed for VISA (Virtual Instrument Software Architecture) library. Go to http://www.keysight.com/find/iosuite.
- PyVISA which is a Python front end for the VISA library. To learn about PyVISA, go to https://sourceforge.net/projects/pyvisa/ and to pyvisa.readthedocs.org.
In any of the script topics, you'll find the script's code as shown in the following picture. Click the Copy button to copy the code to Windows clipboard and paste the code into your coding application.
General Notes
All of the examples shown in this section present a Python script that establishes a LAN connection using the HiSLIP interface. GPIB connections are not presented.
Some firewall applications might block SICL/LAN communications.
Do not modify the line indents of any lines within the script. The indentation of code lines in Python identifies code blocks and is critical to the ability of the code to run.
Copyright © 2016 – 2023 Keysight Technologies Inc. All rights reserved. You have a royalty-free right to use, modify, reproduce and distribute this example files (and/or any modified version) in any way you find useful, provided that you agree that Keysight has no warranty, obligations or liability for any Sample Application Files.
Python Environment
Although uncommon, you may run into a situation where the "byteness" of the Python installation does not match the "byteness" of the Visa library. If this happens, you can force the instantiation of the pyVisa object with the proper Visa version. For example, instead of using:
rm = visa.ResourceManager() Flex = rm.open_resource('TCPIP0::localhost::hislip0,4880::INSTR')
Pass an argument to include the correct dll:
rm = visa.ResourceManager(r'C:\WINDOWS\system32\visa64.dll') Flex = rm.open_resource('TCPIP0::localhost::hislip0,4880::INSTR')