/* ************************************************************** */ /* * Module TDS754DUI * This module contains functions for the Tektronix TDS754D * user interface. * * Zachary Wolf * 5/22/01 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "tds754duir.h" #include "tds754dui.h" #include "tds754d.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int tds754d_ID; static int tds754d_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void tds754dui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * tds754dui_init * This function initializes the user interface for the TDS754D. * * Input: * ID, TDS754D device identifier * * Zachary Wolf * 5/22/01 */ void tds754dui_init(int ID) { /* Save the TDS754D ID */ tds754d_ID = ID; /* Open the TDS754D panel */ tds754d_panel = LoadPanel(0, "tds754duir.uir", TDS754DPAN); if (tds754d_panel < 0) { tds754dui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(tds754d_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * tds754dui_error * This function handles error messages for the TDS754D user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 5/22/01 */ void tds754dui_error(char* message) { /* Declare variables */ char buf[TDS754D_MAX_CMD]; /* Notify the operator of the error */ printf("\nTDS754DUI 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, TDS754D_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK tds754dui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: tds754d_exit(tds754d_ID); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK tds754dui_get_waveform(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int chan; long int num_samp; double t[50000]; double v[50000]; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, TDS754DPAN_NUM_CHAN, &chan); tds754d_get_waveform(tds754d_ID, chan, &num_samp, t, v); //printf("num_samp = %i\n", num_samp); DeleteGraphPlot (panel, TDS754DPAN_GRAPH, -1, VAL_IMMEDIATE_DRAW); PlotXY (panel, TDS754DPAN_GRAPH, t, v, num_samp, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_SIMPLE_DOT, VAL_SOLID, 1, VAL_RED); break; } return 0; }