Receiving Data
The following shows two ways to receive data. One way shows how to use the iscanf function from the
Agilent Standard Instrument Library to receive formatted data from an instrument. The other way uses the
iread function to receive unformatted data.
Sending SCPI Commands as Formatted Data
iprintf(addr, “ %s %i\n” , cmd, parm);
Function
Session ID
Command format
plus Line Feed
Variable containing the parameter
Variable containing the SCPI command
Sending SCPI Commands as a Block of Data
iwrite(addr, “ABORt\n” , 6, 1, NULL);
Function
Session ID
SCPI Command
plus Line Feed
NULL = No Returned Length Value
End Indicator
Length of SCPI Command
Receiving Formatted Data
iscanf(addr, "%f", &rd_data);
Function
Session ID
Variable that Receives the Data
Specifies Returned Data Format
Receiving Unformatted Data
iread(addr, rdmsg, length, NULL, &actual);
Function
Session ID
Variable that
Receives Data
Get length of the Returned Data
Reason for Termination
Set length of the Returned Data
Sending SCPI Commands 2-7