HP VXI 75000 C Series User's And Scpi Programming Manual page 390

Algorithmic closed loop controller
Table of Contents

Advertisement

INST_DECL(e1415, "E1415A", REGISTER);
/* Use something like this for HP-IB and HP E1405/6 Command Module */
/* #define E1415_ADDR "hpib,22,26"
/*INST_DECL(e1415, "E1415A", MESSAGE); /* E1415 */
/* Declare instruments that will be accessed with SICL. These declarations
* can also be moved into local contexts.
*/
INST
/* Trap instrument errors. If this function is used, it will be called every
* time a C-SCPI instrument puts an error in the error queue. As written, the
* function will figure out which instrument generated the error, retrieve the
* error, print a message, and exit. You may want to modify the way the error
* is printed, or comment out the exit if you want the program to continue.
*
* Note that this works only on REGISTER based instruments, because it was
* a C-SCPI register-based feature, not a general programming improvement.
* If you're using MESSAGE instruments, you'll still have to do SYST:ERR?:
*
* If your test program generates errors on purpose, you probably don't want
* this error function. If so, set the following "#if 1" to "#if 0". This
* function is most useful when you're trying to get your program running.
*/
#if 1
/*ARGSUSED*/
void cscpi_error(INST id, int err)
{
char errorbuf[255];
char idbuf[255];
cscpi_exe(id, "*IDN?\n", 6, idbuf, 255);
cscpi_exe(id, "SYST:ERR?\n", 10, errorbuf, 255);
(void) fprintf(stderr, "Instrument error %s from %s\n", errorbuf, idbuf);
}
#endif
/* The following routine allows you to type SCPI commands and see the results.
* If you don't call this from your program, set the following "#if 1" to
* "#if 0".
*/
#if 1
void do_interactive(void)
{
char command[5000];
char result[5000];
int32 error;
char string[256];
for(;;) {
(void) printf("SCPI command: ");
(void) fflush(stdout);
/* repeat until it actually gets something*/
while (!gets(command));
390 Example Program Listings
vxi;
/* VXI interface session */
/* Set to 0 to skip trapping errors */
/* Keeps lint happy */
/* Holds instrument error message */
/* Holds instrument response to *IDN? */
/* Set to 0 to skip this routine */
/* E1415 */
/* The SICL address of your E1415 */
Appendix G

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents