Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cscpi_exe_s(3) — HP-UX SCPI B.02.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

cscpi_exe_stream()

 

NAME

cscpi_exe_stream − Compiled SCPI Function
 

SYNOPSIS

 
cscpi_exe_stream (id, fin, fout);
 

DESCRIPTION

 
The C-SCPI execute stream function (HP-UX 9.0 or later ONLY) allows you to specify a file or pipe that contains SCPI commands to be used as input.  The commands are executed and the results are stored in the file or pipe specified for output. This function only works with REGISTER configurations.  With this function the SCPI commands are parsed and executed at runtime.
 

PARAMETERS

 

id

The user variable name for the instrument.  This is the variable name that you assign to the instrument in the INST_DECL or INST_EXTERN command.  For example,
 
INST_DECL (vm, "E1411B", REGISTER);
 
assigns vm as an instrument data pointer to the E1411B.  Now when you use vm as the id in cscpi_exe_stream, the SCPI command is sent to the HP E1411B.
 

fin

A FILE* that contains SCPI commands to be executed.  This stream must contain ONLY SCPI commands for the REGISTER configured instrument specified in the id parameter.  stdin can be used to get input from the terminal keyboard. 
 

fout

A FILE* where the results of the executed SCPI commands will be stored.  stdout or stderr can be used to display the results on the terminal display. 
 

COMMENTS

 
Since stdin, stdout, and stderr can be used, you can do terminal I/O without having to open extra files.
 
ONLY SCPI commands for the instrument specified in the id parameter can be used in the input file.
 
The input and output may be piped or redirected to other controlling processes.  Connecting stdin (0) and stdout (1) to pipes allows you to have a separate process that is independent of SCPI or C-SCPI.  See "Programming on HP-UX" for more information on piping or redirecting to other processes.
 
If fout is a pipe, the c function setbuf (fout, NULL); must be used to disable buffering.  If this function is not used, you will not get an output until the stream buffer is full.   See the "Programming on HP-UX" manual for details.
 

EXAMPLE

 
This example uses the stdin and stdout files with cscpi_exe_stream.  The user can enter the SCPI commands from the terminal keyboard and the results are displayed on the terminal screen.  The program continues until the user enters a Ctrl D which indicates the end of the file.
 
 

INST_DECL (vm, "E1411B", REGISTER);
main ()
{
INST_STARTUP ();
INST_OPEN (vm, "VXI,24");

printf ("Enter SCPI Commands for E1411B.  Enter Ctrl D to quit0);
cscpi_exe_stream (vm, stdin, stdout);
printf ("Done0);
}

  —  December 08, 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026