|
|
|
@ -38,6 +38,8 @@
|
|
|
|
|
extern char falpha[1024];
|
|
|
|
|
double companalyzer_raw_trace_data[1024];
|
|
|
|
|
|
|
|
|
|
double companalyzer_frequency;
|
|
|
|
|
|
|
|
|
|
unsigned long companalyzerTraceLength (const char * companalyzerType) {
|
|
|
|
|
if (strcmp("HP4191A", companalyzerType) == 0) {
|
|
|
|
|
return 417;
|
|
|
|
@ -80,7 +82,8 @@ int companalyzer_set_time(struct tm * datetime, const char * companalyzerType, i
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", timebuffer);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, timebuffer) == 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
char errorbuf[1000];
|
|
|
|
|
return companalyzer_set_measurement_frequency(1000000, companalyzerType, gpibDevice, errorbuf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 2;
|
|
|
|
@ -200,14 +203,52 @@ int companalyzer_set_measurement_parameters(companalyzer_measurement::companalyz
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int companalyzer_get_max_measurement_frequency(double * frequency, const char * companalyzerType, int gpibDevice, char * extendedError) {
|
|
|
|
|
if ((strcmp("HP4191A", companalyzerType) == 0)) {
|
|
|
|
|
printf("[INFO] Getting maximum component analyzer measurement frequency\n\r");
|
|
|
|
|
if (strcmp("HP4191A", companalyzerType) == 0) {
|
|
|
|
|
*frequency = 1000000000;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf(extendedError, "EXTAn invalid device was selected!°");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf(extendedError, "EXTAn invalid device was selected!°");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int companalyzer_get_min_measurement_frequency(double * frequency, const char * companalyzerType, int gpibDevice, char * extendedError) {
|
|
|
|
|
if ((strcmp("HP4191A", companalyzerType) == 0)) {
|
|
|
|
|
printf("[INFO] Getting minimum component analyzer measurement frequency\n\r");
|
|
|
|
|
if (strcmp("HP4191A", companalyzerType) == 0) {
|
|
|
|
|
*frequency = 1000000;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf(extendedError, "EXTAn invalid device was selected!°");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf(extendedError, "EXTAn invalid device was selected!°");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int companalyzer_set_measurement_frequency(double frequency, const char * companalyzerType, int gpibDevice, char * extendedError) {
|
|
|
|
|
if ((strcmp("HP4191A", companalyzerType) == 0)) {
|
|
|
|
|
printf("[INFO] Setting component analyzer measurement frequency to %eMHz\n\r", frequency);
|
|
|
|
|
if (strcmp("HP4191A", companalyzerType) == 0) {
|
|
|
|
|
falpha[0] = 0;
|
|
|
|
|
|
|
|
|
|
if ((frequency >= 1.0) && (frequency <= 1000.0)) {
|
|
|
|
|
sprintf(falpha, "FR%04.04fEN", frequency);
|
|
|
|
|
double adjusted_frequency = frequency / 1000000.0;
|
|
|
|
|
|
|
|
|
|
if ((adjusted_frequency >= 1.0) && (adjusted_frequency <= 1000.0)) {
|
|
|
|
|
sprintf(falpha, "FR%04.04fEN", adjusted_frequency);
|
|
|
|
|
}
|
|
|
|
|
if (strlen(falpha) == 0) {
|
|
|
|
|
sprintf(extendedError, "EXTAn invalid parameter or combination of parameters was requested°");
|
|
|
|
@ -218,6 +259,7 @@ int companalyzer_set_measurement_frequency(double frequency, const char * compan
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", falpha);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, falpha) == 0) {
|
|
|
|
|
companalyzer_frequency = frequency;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -401,6 +443,7 @@ int companalyzer_get_parameter_measurement(companalyzer_measurements_t * retval,
|
|
|
|
|
measurement.parameter_b_value = parameter_value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
measurement.frequency = companalyzer_frequency;
|
|
|
|
|
|
|
|
|
|
*retval = measurement;
|
|
|
|
|
}
|
|
|
|
|