Chapter 7 Application Programs

Example Programs for Excel 7.0

Excel 7.0 Example: Port Configuration Macro

Option Explicit

Declarations for VISA.DLL

Basic I/O Operations

Private Declare Function viOpenDefaultRM Lib "VISA32.DLL" Alias "#141" (sesn As Long) As Long Private Declare Function viOpen Lib "VISA32.DLL" Alias "#131" (ByVal sesn As Long, _

ByVal desc As String, ByVal mode As Long, ByVal TimeOut As Long, vi As Long) As Long Private Declare Function viClose Lib "VISA32.DLL" Alias "#132" (ByVal vi As Long) As Long Private Declare Function viRead Lib "VISA32.DLL" Alias "#256" (ByVal vi As Long, _

ByVal Buffer As String, ByVal Count As Long, retCount As Long) As Long Private Declare Function viWrite Lib "VISA32.DLL" Alias "#257" (ByVal vi As Long, _

ByVal Buffer As String, ByVal Count As Long, retCount As Long) As Long

’ Error Codes

 

Global Const VI_SUCCESS = 0

 

’ Global Variables

 

Global videfaultRM As Long

’ Resource manager id for VISA GPIB

Global vi As Long

’ Stores the session for VISA

Dim errorStatus As Long

’ VTL error code

Global VISAaddr As String

 

’""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

This routine requires the file ’VISA32.DLL’ which typically resides in the

c:\windows\system directory on your PC. This routine uses the VTL Library to send

commands to the instrument. A description of these and additional VTL commands can be

found in the Agilent VISA User’s Guide. ’"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Public Sub SendSCPI(SCPICmd As String)

This routine sends a SCPI command string to the GPIB port. If the command is a

query command (contains a question mark), you must read the response with ’getScpi’

Dim

commandstr As String

Command passed to instrument

Dim

actual As Long

Number of characters sent/returned

’Write the command to the instrument terminated by a line feed commandstr = SCPICmd & Chr$(10)

errorStatus = viWrite(vi, ByVal commandstr, Len(commandstr), actual) End Sub

Function getScpi() As String Dim readbuf As String * 2048 Dim replyString As String Dim nulpos As Integer

Dim actual As Long

Buffer used for returned string

Store the string returned

Location of any nul’s in readbuf

Number of characters sent/returned

’ Read the response string

 

errorStatus = viRead(vi, ByVal readbuf, 2048, actual)

7

replyString = readbuf

’ Strip out any nul’s from the response string

nulpos = InStr(replyString, Chr$(0)) If nulpos Then

replyString = Left(replyString, nulpos - 1) End If

getScpi = replyString End Function

Continued on next page

323

Page 325
Image 325
Agilent Technologies 34970A manual 323

34970A specifications

Agilent Technologies 34970A is a versatile data acquisition and measurement system that has gained popularity in various industries, including research and development, manufacturing, and education. The primary purpose of the 34970A is to offer an efficient solution for data collection, monitoring, and analysis, which can significantly enhance productivity and accuracy in testing applications.

One of the main features of the 34970A is its modular design, allowing users to customize the system according to their specific measurement needs. The mainframe can accommodate up to three plug-in measurement modules, which can include various types of measurements such as analog, digital, temperature, and frequency. This modularity provides flexibility for users to tailor the system to their requirements, making it highly adaptable to different applications.

Another notable characteristic of the Agilent 34970A is its impressive channel configuration. The system can support up to 120 measurement channels when fully configured, enabling extensive data acquisition without the need for multiple devices. This capability is essential for applications requiring simultaneous monitoring of multiple parameters or locations.

The 34970A utilizes advanced signal processing technologies to ensure high-accuracy measurements. The internal 6.5-digit resolution multimeter provides precise readings, while the device also supports various input types, such as thermocouples and RTDs for temperature measurements. The ability to perform mathematical functions, such as summation and averaging, on the acquired data further enhances its usability.

For data storage and management, the Agilent 34970A features built-in memory for storing up to 20,000 readings. Users can also easily transfer data to a PC through the RS-232 interface or GPIB (IEEE 488) for further analysis and reporting. Additionally, it offers the capability to program automatic data logging and scheduling of measurements, which streamlines the testing process and reduces manual intervention.

In terms of user interface, the 34970A is equipped with a large graphical display that provides clear visualization of measurement data and easy navigation through settings and options. The menu-driven interface makes it accessible for users of all skill levels, simplifying the setup and operation of the device.

Overall, the Agilent Technologies 34970A stands out for its modularity, high channel capacity, advanced measurement technologies, and user-friendly interface. As a reliable and efficient data acquisition system, it is well-suited for a wide range of applications, making it an essential tool for engineers and technicians looking to enhance measurement precision and efficiency.