#include #include #include #include <ansi_c.h> <cvirte.h> <userint.h> "STRIPCHAR.h" /* Needed if linking in external compiler; harmless otherwise */ static int panelHandle; double temp[3]; double max; double min; int marcha=(0); double frecuencia,medidas; int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless other wise */ return -1; /* out of memory */ if ((panelHandle = LoadPanel (0, "STRIPCHAR.uir", PANEL)) < 0) return -1; DisplayPanel (panelHandle); RunUserInterface (); return 0; } int CVICALLBACK timer (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_TIMER_TICK: GetCtrlVal (panelHandle, PANEL_BINARYSWITCH, &marcha); GetCtrlVal (panelHandle, PANEL_NUMERICKNOB, &max); GetCtrlVal (panelHandle, PANEL_NUMERICKNOB_2, &min); if (marcha==1) { temp[0]=70+20*rand()/32000.0; temp[1]=max; temp[2]=min; if (temp[0]>temp[1]) { SetCtrlVal (panelHandle, PANEL_LED,1); } else SetCtrlVal (panelHandle, PANEL_LED,0); if (temp[0]<temp[2] ) { SetCtrlVal (panelHandle, PANEL_LED_2,1); } else SetCtrlVal (panelHandle, PANEL_LED_2,0); SetCtrlVal (panelHandle, PANEL_NUMERICTHERM, temp[0]); PlotStripChart (panelHandle, PANEL_STRIPCHART, temp, 3, 0, 1, VAL_DOUBLE); } GetCtrlVal (panelHandle, PANEL_NUMERIC_3, &medidas); frecuencia=1.0/medidas; SetCtrlAttribute (panelHandle, PANEL_TIMER, ATTR_INTERVAL,frecuencia); break; } return 0; } int CVICALLBACK SALIR (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; } return 0; }