Using the Matrix Modules 37
Chapter 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;
}
Summary of Contents for E1465A
Page 2: ......
Page 6: ...6 ...
Page 10: ...10 Notes ...
Page 18: ...18 Getting Started Chapter 1 Notes ...
Page 80: ...80 Matrix Modules Command Reference Chapter 4 Notes ...
Page 98: ...98 Register Based Programming Appendix B Notes ...