Controlling Lite VNA using pyvisa

74 views Asked by At

I want to give an RF pulse using Lite VNA using the Python library pyVisa. VNA got connected via USB port and came to know using python script

import pyvisa

# Create resource manager object
rm = pyvisa.ResourceManager()

# List available resources
print(f"Available Resources: {rm.list_resources()}")

output

PS C:\\Users\\MEDICAL PHYSICS\> & "C:/Users/MEDICAL PHYSICS/AppData/Local/Programs/Python/Python310/python.exe" "c:/Users/MEDICAL PHYSICS/Desktop/import visa.py"
Available Resources: ('ASRL1::INSTR', 'ASRL2::INSTR', 'ASRL3::INSTR', 'ASRL9::INSTR')

on connecting Lite VNA I got additional resource named ASRL9.

python script:

import pyvisa

# Create resource manager object
rm = pyvisa.ResourceManager()

# List available resources
print(f"Available Resources: {rm.list_resources()}")

# Open the VNA using its resource name

# Open the instrument connected to port ASRL

# Get the instrument resource
instrument = rm.open_resource("ASRL9::INSTR")

# Print the resource name
print(f"instrument: {instrument}")

try:
  # Open the VNA resource
  vna = rm.open_resource("ASRL9::INSTR",timeout=10000)

  # Send a simple query to check communication
  response = vna.query('\*IDN?')

  # Check the response for success
  if response is not None and len(response) \> 0:
    print("VNA is connected and responding.")
  else:
    print("VNA is not responding.")

except Exception as e:
  print(f"Error connecting to VNA: {e}")

finally:
  # Close the VNA resource if it was opened
  if vna is not None:
    vna.close()

error:

PS C:\\Users\\MEDICAL PHYSICS\> & "C:/Users/MEDICAL PHYSICS/AppData/Local/Programs/Python/Python310/python.exe" "c:/Users/MEDICAL PHYSICS/Desktop/import visa.py"
Available Resources: ('ASRL1::INSTR', 'ASRL2::INSTR', 'ASRL3::INSTR', 'ASRL9::INSTR')
Traceback (most recent call last):
File "c:\\Users\\MEDICAL PHYSICS\\Desktop\\import visa.py", line 11, in \<module\>
instrument = rm.open_resource("ASRL9::INSTR")
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\highlevel.py", line 3292, in open_resource  
res.open(access_mode, open_timeout)
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\resources\\resource.py", line 281, in open  
self.session, status = self.\_resource_manager.open_bare_resource(
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\highlevel.py", line 3217, in open_bare_resource
return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\ctwrapper\\functions.py", line 1850, in open
ret = library.viOpen(
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\ctwrapper\\highlevel.py", line 226, in \_return_handler
return self.handle_return_value(session, ret_value)  # type: ignore
File "C:\\Users\\MEDICAL PHYSICS\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyvisa\\highlevel.py", line 251, in handle_return_value
raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_SYSTEM_ERROR (-1073807360): Unknown system error (miscellaneous error).

It is getting errors and getting output timeout or as per given above output. Where is the problem?

I tried to communicate with LITE VNA using python but I'm getting a error :timeout means getting no response from VNA but VNA is recognized.

0

There are 0 answers