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

Algorithmic closed loop controller
Table of Contents

Advertisement

* 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));
if (!*command) {
}
result[0] = 0;
cscpi_exe(e1415, command, strlen(command), result, sizeof(result));
INST_QUERY(e1415, "syst:err?", "%d,%s", &error, string);
while ( error ) {
}
if (result[0]) {
}
}
}
#endif
412 Example Program Listings
/* 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 */
break;
(void) printf("syst:err %d,'%s'\n", error, string);
INST_QUERY(e1415,"syst:err?", "%d,%s", &error, string);
(void) printf("result: %s\n", result);
Appendix G

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents