Keysight E4428C ESG RF Programming Manual page 149

Signal generators
Table of Contents

Advertisement

int main1()
{
SOCKET instSock;
long bufBytes;
char *charBuf = (char *) malloc(INPUT_BUF_SIZE);
/*********************************************/
/* open a socket connection to the instrument*/
/*********************************************/
#ifdef WINSOCK
if (init_winsock() != 0) {
exit(1);
}
#endif /* WINSOCK */
instSock = openSocket("xxxxxx", SCPI_PORT); /* Put your hostname here */
if (instSock == INVALID_SOCKET) {
fprintf(stderr, "Unable to open socket.\n");
return 1;
}
/* fprintf(stderr, "Socket opened.\n"); */
bufBytes = queryInstrument(instSock, "*IDN?\n", charBuf, INPUT_BUF_SIZE);
printf("ID: %s\n",charBuf);
commandInstrument(instSock, "FREQ 2.5 GHz\n");
printf("\n");
bufBytes = queryInstrument(instSock, "FREQ:CW?\n", charBuf, INPUT_BUF_SIZE);
printf("Frequency: %s\n",charBuf);
commandInstrument(instSock, "POW:AMPL -5 dBm\n");
bufBytes = queryInstrument(instSock, "POW:AMPL?\n", charBuf, INPUT_BUF_SIZE);
printf("Power Level: %s\n",charBuf);
printf("\n");
#ifdef WINSOCK
closesocket(instSock);
close_winsock();
#else
Keysight Signal Generators Programming Guide
Programming Examples
LAN Programming Interface Examples
141

Advertisement

Table of Contents
loading

Table of Contents