Agilent Technologies E1465A Automobile Parts User Manual


 
Using the Matrix Modules 37Chapter 3
Example: Matrix
Module
Identification
(TURBO C)
#include <stdio.h>
#include <chpib.h> /*
Include file for GPIB
*/
#define ISC 7L
#define MATRIX 70915L /*
Matrix default address
*/
#define TASK1 "*RST;*CLS;*IDN?"/*
Reset, clear, and query id
*/
#define TASK2 "SYST:CDES? 1" /*
Command for card description
*/
#define TASK3 "SYST:CTYP? 1" /*
Command for card type
*/
main( )
{
char into1[51], into2[51], into3[51];
int length = 50;
/*
Output and enter commands to matrix module
*/
error_handler (IOTIMEOUT (7L,5.0), "TIMEOUT");
error_handler (IOOUTPUTS (MATRIX, TASK1, 15), "OUTPUT command");
error_handler (IOENTERS (MATRIX, into1, &length), "ENTER command");
error_handler (IOOUTPUTS (MATRIX, TASK2, 12), "OUTPUT command");
error_handler (IOENTERS (MATRIX, into2, &length), "ENTER command");
error_handler (IOOUTPUTS (MATRIX, TASK3, 12), "OUTPUT command");
error_handler (IOENTERS (MATRIX, into3, &length), "ENTER command");
printf("IDENTIFICATION: %s",into1);
printf("CARD DESCRIPTION: %s",into2);
printf("CARD TYPE: %s",into3);
return;
}
int error_handler (int error, char *routine)
{
char ch;
if (error != NOERR)
{
printf ("\n Error %d %s \n", error, errstr(error));
printf (" in call to GPIB function %s \n\n", routine);
printf ("Press 'Enter' to exit: ");
scanf ("%c", &ch);
exit(0);
}
return 0;
}