Visa Com Example In Python For .Net Or Ironpython - Agilent Technologies InfiniiVision 3000 Programmer's Manual

X-series
Hide thumbs Also See for InfiniiVision 3000:
Table of Contents

Advertisement

39
Programming Examples
End Namespace

VISA COM Example in Python for .NET or IronPython

You can also control Agilent oscilloscopes using the VISA COM library and
Python programming language on the .NET platform using:
• The Python for .NET package ("http://pythonnet.sourceforge.net/") which
• IronPython ("http://ironpython.codeplex.com/") which is an
To run this example with Python for .NET or IronPython:
1
2
1124
Private Sub OpenIo()
m_ResourceManager = New ResourceManagerClass()
m_IoObject = New FormattedIO488Class()
' Open the default VISA COM IO object.
Try
m_IoObject.IO = _
DirectCast(m_ResourceManager.Open(m_strVisaAddress, _
AccessMode.NO_LOCK, 0, ""), IMessage)
Catch e As Exception
Console.WriteLine("An error occurred: {0}", e.Message)
End Try
End Sub
Public Sub SetTimeoutSeconds(ByVal nSeconds As Integer)
m_IoObject.IO.Timeout = nSeconds * 1000
End Sub
Public Sub Close()
Try
m_IoObject.IO.Close()
Catch
End Try
Try
Marshal.ReleaseComObject(m_IoObject)
Catch
End Try
Try
Marshal.ReleaseComObject(m_ResourceManager)
Catch
End Try
End Sub
End Class
integrates with the .NET Common Language Runtime (CLR).
implementation of the Python programming language running under
.NET.
Cut- and- paste the code that follows into a file named "example.py".
Edit the program to use the VISA address of your oscilloscope.
Agilent InfiniiVision 3000 X-Series Oscilloscopes Programmer's Guide

Advertisement

Table of Contents
loading

Table of Contents