/* ************************************************************** */ /* * Module HP3457UI * This module contains functions for the HP3457 multimeter * user interface. * * Zachary Wolf * 8/3/98 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "hp3457uir.h" #include "hp3457ui.h" #include "hp3457.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int hp3457_ID; static int hp3457_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONS */ void hp3457ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * hp3457ui_init * This function initializes the user interface for the HP3457 DMM. * * Input: * ID, HP3457 device identifier * * Zachary Wolf * 8/3/98 */ void hp3457ui_init(int ID) { /* Save the HP3457 ID */ hp3457_ID = ID; /* Open the HP3457 panel */ hp3457_panel = LoadPanel(0, "hp3457uir.uir", HPPANEL); if (hp3457_panel < 0) { hp3457ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(hp3457_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * hp3457ui_error * This function handles error messages for the HP3457 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void hp3457ui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nHP3457UI ERROR: %s\n", message); Beep(); Delay(.5); Beep(); /* Terminate the program if the operator desires */ printf("Press ENTER to continue.\nPress any key then ENTER to terminate program.\n"); fgets(buf, 80, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK hp3457ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: hp3457_exit(hp3457_ID); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK hp3457ui_get_chan_voltage(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int chan; double voltage; switch (event) { case EVENT_COMMIT: GetCtrlVal(hp3457_panel, HPPANEL_HP3457_CHAN, &chan); hp3457_get_chan_voltage(hp3457_ID, chan, &voltage); SetCtrlVal(hp3457_panel, HPPANEL_HP3457_CHAN_VOLTAGE, voltage); break; case EVENT_RIGHT_CLICK: break; } return 0; }