382 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Creating and Downloading User–Data Files
User Flatness Correction Downloads Using C++ and VISA
//will hold the frequency and amplitude arrays
char** pairsList = new char* [lenArray]; //pointer array
for (int n=0; n < lenArray; n++)//initialize the pairsList
array
//pairsList[n]=0;
for (int i=0; i < num; i++)
{
char* nextFreq = new char[MAX_STRING1];
//frequency array
char* nextPower = new
char[MAX_STRING1];//amplitude array
//enter frequency and amplitude pairs i.e 10ghz .1db
printf("Enter Freq %d: ", i+1);
scanf("%s", nextFreq);
printf("Enter Power %d: ",i+1);
scanf("%s", nextPower);
pairsList[2*i] = nextFreq;//frequency
pairsList[2*i+1]=nextPower;//power correction
}
unsigned char str[256];//buffer used to hold SCPI command
//initialize the signal generator's user flatness table
sprintf((char*)str,":corr:flat:pres\n"); //write to buffer
viWrite(vi, str,strlen((char*str),0); //write to PSG
char c = ',';//comma separator for SCPI command
for (int j=0; j< num; j++) //download pairs to the PSG
{
sprintf((char*)str,":corr:flat:pair %s %c
%s\n",pairsList[2*j], c, pairsList[2*j+1]); // << on
SAME line!
viWrite(vi, str,strlen((char*)str),0);
}
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...