1. Installing prerequisites
Download and install NI VISA software: NI-VISA Download
Download and install latest Python 3 version: Download Python
1.1. Checking Python installation
Checking Python installation
Open command prompt:
on Windows: press Win+R, type cmd
, press Enter. You will see a window where you can type commands:

In command prompt type
python --version
or
python3 --version
followed by Enter to check if python is correctly installed. You should get response indicating installed python version, like this:
Python 3.11.4
On Windows, if Microsoft Store is open when you execute “python” command or the command simply gives no response:
On Windows 11 go to Start Menu → Settings → Apps → Advanced app settings → App execution aliases and disable “python” and “python3” aliases.
On Windows 10 open Start Menu → Settings (“Gear” icon) → Applications → Applications and functions → Link “Application execution aliases”. Disable “python” and “python3” items.
1.2. PyVISA library installation
Open source PyVISA library can be used for interaction with NI VISA software which, in turn, provides functionality required to support communication with measurement instruments using protocols such as HiSLIP.
To install PyVisa library open command prompt and type:
pip install pyvisa
If you receive error message saying “’pip’ is not recognized as an internal or external command, operable program or batch file.“, then ensure that Python is correctly installed.
Check if communication with Pendulum CNT-104S device is possible from python (at the very basic level):
- 1. Ensure your instrument is connected to the network.
- 2. Start Python in interactive mode by typing in command prompt:
python

In python command prompt type the following lines replacing 192.168.0.25
with the actual IP address of your instrument (can be checked in Settings → User options → Network → Ethernet IP address):
import pyvisa as visa
rm = visa.ResourceManager()
instr = rm.open_resource('TCPIP::192.168.0.25::hislip0::INSTR')
instr.query('*IDN?')
The last line executes “*IDN?” query which asks the instrument for identification information. You should get response from the instrument like this:
'Pendulum, CNT-104S, 607017, v1.2.0 2023-07-13\n'
- 4. Type the following to disconnect from the instrument and exit python:
instr.close()
quit()
2. Examples
More complex scenarios imply using Python in non-interactive mode.
Here is an example showing very basic usage of python programming language to control the instrument.
#!/usr/bin/env python
# REPLACE WITH THE IP ADDRESS OR YOUR INSTRUMENT!
# (See Settings -> Settings -> User options -> Network -> Ethernet IP address)
INSTRUMENT_IP = '192.168.0.25'
import pyvisa as visa
rm = visa.ResourceManager()
def example(resource_str):
instr = rm.open_resource(resource_str) # Connect to the instrument
instr.timeout = 5000 # VISA I/O operations timeout, in milliseconds
idn = instr.query('*IDN?') # Send '*IDN?' and read response.
print('Running example 1 with {} at {}'.format(idn.strip(), resource_str))
print('In this example frequency measurement is performed on input A')
instr.write('*RST;*CLS') # Reset to default settings, clear error and message queues.
# Configure the measurement: simple frequency measurement, with timeout.
# (Pay attention to double and single quotes)
instr.write(':SYSTEM:CONFIGURE "Function=Frequency A; SampleCount=10; SampleInterval=0.01; '
'Timeout=On; TimeoutTime=1.0"')
# It's a good practice to check for errors.
err = instr.query(':SYST:ERR?')
if err.strip() != '0,"No error"':
raise Exception('Error configuring measurement: {}'.format(err))
instr.write(':INIT')
# Waiting (in a blocking manner) for measurement completion.
# *OPC? query responds back only when all pending operations (measurement in this case) are completed.
# Measurement will be complete when all requested samples are collected or if timeout occurs.
instr.query('*OPC?') # No need to use response here, because it is always '1' by SCPI standard.
data_str = instr.query(':FETCH:ARRAY? MAX, A') # Will return a string of comma-separated numbers
data_str = data_str.strip() # to remove \n at the end
if len(data_str) > 0:
data = list(map(float, data_str.split(','))) # Convert the string to python array
else:
data = []
# Display measurement results
print('Results: {}'.format(data if data else 'no data (signal not connected?)'))
instr.close()
if __name__ == '__main__':
resource_str = 'TCPIP::{}::hislip0::INSTR'.format(INSTRUMENT_IP)
try:
example(resource_str)
except visa.VisaIOError as e:
print('Error occurred: {}'.format(e))