Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 147
Programming Examples
LAN Programming Interface Examples
#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
close(instSock);
#endif /* WINSOCK */
return 0;
}
/******************************************************************
Содержание X-Series
Страница 4: ...4 ...
Страница 10: ...10 Contents ...