VXi VT1529A/B 사용자 설명서

다운로드
페이지 529
32 Getting Started  
Verifying a Successful Configuration
An example C program source is shown on the following pages. This program is 
included on the VXI Technology VXIplug&play Drivers & Product Manuals CD 
that comes with the VT1422A (file name verif.cpp). The program uses the *IDN? 
query command to verify the VT1422A is operational and responding to 
commands. The program also has an error checking function (check()). It is 
important to include an instrument error checking routine in the programs created, 
particularly the initial trial programs, so that instant feedback can be attained while 
learning about the VT1422A. Compile this program according to the plug&play help 
file (hpe1422.hlp) topics "Introduction to Programming" 
 "Compiling and Linking 
Programs Using Integrated Environments."
/*******************************************************************************
   verif.cpp
   This example program verifies your instrument installation by reading the
   instrument IDs and then querying for and printing the SCP types found.
   
   Use the "Copy Button" in the Help File's "Example" window to place this code
   into the clipboard, then paste this code text into your development tool's
    editor window. Similarly, "Copy" the actual example code from the help file's 
   "Example" window and paste it into the location provided below.
   
   link with the hpe1422_32.lib - library file
 *******************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hpe1422.h>    /* include the driver header file */
 /* GPIB-VXI addressing (0 is the interface number, 208 is the */
 /* instrument logical address, INSTR is a VISA resource type) */
#define INSTR_ADDRESS "GPIB-VXI0::208::INSTR"
ViSession  addr;
ViStatus   errStatus;
 /* Function Prototypes */
void main (void);  /* Main function */
void rst_inst(void); /* Resets the instrument and sends a device clear */
void reads_instrument_id(void); /* reads instrument software revision */
void check (ViSession addr, ViStatus errStatus); /* checks module errors */
/*******************************************************************************/
void main (void) /* Main function */
{
 ViChar  err_message[256];
 /* open device session and reset the instrument; check if successful */
 errStatus = hpe1422_init(INSTR_ADDRESS,0,0,&addr);
     if( VI_SUCCESS > errStatus)
     {
         hpe1422_error_message( addr, errStatus, err_message);
         printf("Unable to open %s\n", INSTR_ADDRESS);
         printf("hpe1422_init() returned error message %s\n", err_message);