1248
Keysight P9241/42/43A Oscilloscopes SCPI Programmer's Guide
38
Programming Examples
{
strcat(str_out, ", ");
strcat(str_out, str_err_val);
err = viQueryf(vi, ":SYSTem:ERRor?\n", "%t", str_err_val);
if (err != VI_SUCCESS) error_handler();
}
if (strcmp(str_out, "") != 0)
{
printf("INST Error%s\n", str_out);
err = viFlush(vi, VI_READ_BUF);
if (err != VI_SUCCESS) error_handler();
err = viFlush(vi, VI_WRITE_BUF);
if (err != VI_SUCCESS) error_handler();
}
}
/* Handle VISA errors.
* --------------------------------------------------------------- */
void error_handler()
{
char err_msg[1024] = {0};
viStatusDesc(vi, err, err_msg);
printf("VISA Error: %s\n", err_msg);
if (err < VI_SUCCESS)
{
exit(1);
}
}
VISA Example in Visual Basic
To run this example in Visual Basic for Applications:
1
Start the application that provides Visual Basic for Applications (for example,
Microsoft Excel).
2
Press ALT+F11 to launch the Visual Basic editor.
3
Add the visa32.bas file to your project:
a
Choose
File > Import File...
.
b
Navigate to the header file, visa32.bas (installed with Keysight IO Libraries
Suite and found in the Program Files (x86)\IVI Foundation\VISA\WinNT\
Include), select it, and click
Open
.
4
Choose
Insert > Module
.
5
Cut-and-paste the code that follows into the editor.
6
Edit the program to use the VISA address of your oscilloscope, and save the
changes.
7
Run the program.
Содержание P9241
Страница 1: ...Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide...
Страница 6: ...6 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide...
Страница 36: ...36 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 1 What s New...
Страница 41: ...Setting Up 2 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 41...
Страница 44: ...44 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 2 Setting Up...
Страница 222: ...222 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 7 Root Commands...
Страница 244: ...244 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 8 ACQuire Commands...
Страница 256: ...256 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 9 CALibrate Commands...
Страница 278: ...278 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 10 CHANnel n Commands...
Страница 328: ...328 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 15 EXTernal Trigger Commands...
Страница 386: ...386 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 17 FUNCtion m Commands...
Страница 390: ...390 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 18 HCOPY Commands...
Страница 416: ...416 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 20 MARKer Commands...
Страница 498: ...498 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 21 MEASure Commands...
Страница 532: ...532 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 22 MTESt Commands...
Страница 572: ...572 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 24 SAVE Commands...
Страница 596: ...596 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 25 SBUS n Commands SBUS n A429 SOURce on page 588...
Страница 900: ...900 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 28 TIMebase Commands...
Страница 1080: ...1080 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 31 WGEN w Commands...
Страница 1142: ...1142 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 34 Error Messages...
Страница 1204: ...1204 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide 37 More About Oscilloscope Commands...
Страница 1344: ...1344 Keysight P9241 42 43A Oscilloscopes SCPI Programmer s Guide Index...