📄 daqndemo.c
字号:
/* The example program demonstrates the use of a DAQ Numeric control. A DAQ Numeric is a control which can be configured to automatically read its value in from or write its value out to an analog I/O channel. This program uses the daq_num.fp instrument driver to create the DAQ Numeric controls.*/ #include <cvirte.h> /* Needed if linking in external compiler; harmless otherwise */#include <userint.h>#include "daq_num.h"#include "daqndemo.h"int thePanel;int main (int argc, char *argv[]){ if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */ return -1; /* out of memory */ thePanel = LoadPanel (0, "daqndemo.uir", PANEL); DAQ_Numeric_ConvertFromNumeric (thePanel, PANEL_NUMERICMETER, "Meter Configuration"); DAQ_Numeric_ConvertFromNumeric (thePanel, PANEL_NUMERICDIAL, "Dial Configuration"); DisplayPanel (thePanel); RunUserInterface (); DiscardPanel (thePanel); return 0;} /* This function does nothing in this demo. It is here to illustrate where you can place code to perform an action each time a DAQ Numeric updates its value when in input mode. */ int CVICALLBACK MeterCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2){ switch (event) { case EVENT_DAQ_NUMERIC_DATA_READY: /* this is where to place code that should take an action each time the meter reads a new value. The value read is in *(double *)eventData1, and the easy I/O result code is in eventData2. The result code will be negative if a DAQ error occurred. */ break; } return 0;}int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2){ switch (event) { case EVENT_COMMIT: QuitUserInterface (0); /* the quit button was pressed, exit RunUserInterface() */ break; } return 0;} /* This function displays information about the program when the help button is pressed */int CVICALLBACK HelpCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int helpPanel; switch (event) { case EVENT_COMMIT: helpPanel = LoadPanel(0, "daqndemo.uir", HELP_PANEL); InstallPopup(helpPanel); GetUserEvent(1, 0,0); /* wait for OK button (it is the only control on the panel) */ DiscardPanel(helpPanel); break; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -