/* ************************************************************** */ /* * Module TDS3012BUI * This module contains functions for the Tektronix TDS3012B * user interface. * * Zachary Wolf * 5/22/01 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "tds3012buir.h" #include "tds3012bui.h" #include "tds3012b.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int tds3012b_ID; static int tds3012b_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void tds3012bui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * tds3012bui_init * This function initializes the user interface for the TDS3012B. * * Input: * ID, TDS3012B device identifier * * Zachary Wolf * 5/22/01 */ void tds3012bui_init(int ID) { /* Save the TDS3012B ID */ tds3012b_ID = ID; /* Open the TDS3012B panel */ tds3012b_panel = LoadPanel(0, "tds3012buir.uir", TDS3012PAN); if (tds3012b_panel < 0) { tds3012bui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(tds3012b_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * tds3012bui_error * This function handles error messages for the TDS3012B user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 5/22/01 */ void tds3012bui_error(char* message) { /* Declare variables */ char buf[TDS3012B_MAX_CMD]; /* Notify the operator of the error */ printf("\nTDS3012BUI 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, TDS3012B_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK tds3012bui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: tds3012b_exit(tds3012b_ID); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK tds3012bui_get_waveform(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int chan; long int num_samp; double t[10000]; double v[10000]; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, TDS3012PAN_NUM_CHAN, &chan); tds3012b_get_waveform(tds3012b_ID, chan, &num_samp, t, v); //printf("num_samp = %i\n", num_samp); DeleteGraphPlot (panel, TDS3012PAN_GRAPH, -1, VAL_IMMEDIATE_DRAW); PlotXY (panel, TDS3012PAN_GRAPH, t, v, num_samp, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_SIMPLE_DOT, VAL_SOLID, 1, VAL_RED); break; } return 0; }