#include #include #include #include "ps_gap_ui.h" #include "hp34970.h" #include "ps_gap.h" #include "runparammmf.h" #include "ps_gap_ctrl_ui.h" int main (int argc, char *argv[]) { /* Declare variables */ struct run_param_struct run_param; int err; char log_file[200]; char gap_dat_file[200]; int hp34970_id; FILE* fid; if (InitCVIRTE (0, argv, 0) == 0) return -1; /* out of memory */ /* Get the run parameters from the user */ try_again: runparam_get_run_param(&run_param); /* Create all output files */ err = runparam_create_file_extdir(run_param, "logfile", log_file); if (err != 0) goto try_again; err = runparam_create_file_extdir(run_param, "gap_dat", gap_dat_file); if (err != 0) goto try_again; /* Write file header for the log file */ runparam_write_header(run_param, log_file); fid = fopen(log_file, "a"); fprintf(fid, "\n\n"); fprintf(fid, " Date Time Enc (mm) Enc(count) Tref(C) Temp(C) Volt Up(V) Volt Dn(V) DistUp(mm) DistDn(mm) Gap (mm) \n"); fprintf(fid, "---------- -------- ---------- ---------- ------- ------- ---------- ---------- ---------- ---------- ----------\n"); fclose(fid); /* Write file header for the dat file */ runparam_write_header(run_param, gap_dat_file); fid = fopen(gap_dat_file, "a"); fprintf(fid, "\n\n"); fprintf(fid, "Capacitive Sensor Gap Measurements:\n"); fprintf(fid, "Distance Between Sensors = %10.4f mm\n", DIST_BTWN_SENSORS * 1000.); fprintf(fid, "Phase shifter measurements made in middle of center magnet.\n"); fprintf(fid, "\n"); fprintf(fid, " Date Time Meas Enc (mm) Enc(count) Tref(C) Temp(C) DistUp(mm) DistDn(mm) Gap (mm) \n"); fprintf(fid, "---------- -------- ------ ---------- ---------- ------- ------- ---------- ---------- ----------\n"); fclose(fid); /*Initialize the instruments */ hp34970_init(0, 9, &hp34970_id); /* Initialize the gap measurement user interface */ ps_gap_ui_init(hp34970_id, log_file, gap_dat_file); /* Initialize the phase shifter control user interface */ ps_gap_ctrl_ui_init(); /* Run the user interface */ RunUserInterface (); /* Exit the phase shifter control user interface */ ps_gap_ctrl_ui_exit(); return 0; }