⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 4_1.c

📁 cvi编程举例
💻 C
字号:
#include <analysis.h>
#include <cvirte.h>		
#include <userint.h>
#include "4_1.h"
static double Deal_S[1024];
static double Noise_S[1024];
static double phase;
static double sinA[1024];

static int panelHandle;

int main (int argc, char *argv[])
{
	if (InitCVIRTE (0, argv, 0) == 0)
		return -1;	/* out of memory */
	if ((panelHandle = LoadPanel (0, "4_1.uir", PANEL)) < 0)
		return -1;
	DisplayPanel (panelHandle);
	RunUserInterface ();
	DiscardPanel (panelHandle);
	return 0;
}

int CVICALLBACK EXitP (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			QuitUserInterface (0);
			break;
	}
	return 0;
}

int CVICALLBACK Generate (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	double WH_Noise[1024];
	double fre=00;
	switch (event)
	{
		case EVENT_COMMIT:  
			
			fre=0.001953125;
			SineWave (1024, 5.0,fre, &phase, sinA);
		//	Sinc (1024, 5.0, 0.0, 2, sinA);
			
			PlotY (panelHandle, PANEL_GRAPH, sinA, 1024, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE,
				   VAL_SOLID, 1, VAL_RED);

			WhiteNoise (1024, 1.0, 1, WH_Noise);
			Add1D (sinA, WH_Noise, 1024, Noise_S);
			PlotY (panelHandle, PANEL_GRAPH_2, Noise_S, 1024, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE,
				   VAL_SOLID, 1, VAL_RED);
			
			
			
			break;
	}
	return 0;
}

int CVICALLBACK FilterDeal (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			Bw_LPF (Noise_S, 1024, 10000, 200, 5, Deal_S);
 			PlotY (panelHandle, PANEL_GRAPH_3, Deal_S, 1024, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE,
				   VAL_SOLID, 1, VAL_RED);

			break;
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -