Using Single Function to Send and Receive Data
The ipromptf function sends formatted SCPI commands and immediately reads the returned data as
formatted data. This function is a combination of the
iprintf and iscanf functions.
Program Example to Send and Read Unformatted Data
The following program example uses the “iread” function to read unformatted raw data.
#include < stdio.h>
#include < string.h>
#include < sicl.h> /* Included with SICL * /
#defineDEV_ADDR "hpib7,9,0" /* Assign the instrument GPIB address * /
/*****************************************************************/
void main(void)
{
INST addr;
unsigned long actual;
int length = 256;
char into[256],
* cmd = “ SYSTem:ERRor?\n” ; /* SCPI command * /
#if defined(__BORLANDC__) && !defined(__WIN_32)
_InitEasyWin(); /* Required for Borland EasyWin program * /
#endif
/* Enable communication path to the instrument * /
addr= iopen(DEV_ADDR);
/* Send SCPI command */
iwrite(addr, cmd, strlen(cmd), 1, NULL);
Continued on Next Page
Sending/Receiving Formatted Data
ipromptf(addr, “*OPC?\n” , “ %i”, &into);
Function
Session ID
SCPI Command
plus Line Feed
Variable to received returned data
Returned data format specifier
2-8 Sending SCPI Commands