Download Compiled SCPI Functions

Transcript
Programming with Compiled SCPI
Using C-SCPI in the Interactive Mode
Since the interactive functions allow you to enter the SCPI commands at run
time, you can write your program to prompt the user for a SCPI command at
run time. An example program using the cscpi_exe function is described
in this section. This example is stored in the /usr/hp75000/demos/cscpi
directory. See Chapter 5 for examples of the other two interactive functions.
Equipment Needed
-- Embedded VXI Controller
-- HP VXI Mainframe
-- HP E1326B or HP E1411B Digital Multimeter
Program Description This program sets up and initializes the HP Multimeter. It prompts the user
for an address and loops prompting for SCPI commands. The SCPI
commands are parsed by the Controller and executed by the HP Multimeter.
When a null string is entered, the loop is exited.
This program demonstrates how you can use the C-SCPI execute function in an
interactive mode. See Chapter 5 for more details on the C-SCPI execute call.
Program Listing
/*example6.cs*/
/*This is a C-SCPI example of using the interactive mode. The
/*program is written to prompt the user for the SCPI command.
/*The command is then executed using the cscpi_exe function.
#include
#include
#include
#include
*/
*/
*/
<stdio.h>
<stdlib.h>
<string.h>
<cscpi.h>
#define LENGTH 1000
/*maximum length of SCPI command & result*/
INST_DECL (vm, “E1411B”, REGISTER);
main()
{
char command [LENGTH];
char result [LENGTH];
/*declaration for voltmeter
*/
/*string variable for SCPI command*/
/*string variable for result
*/
Continued on Next Page
62
Chapter 3