原创
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
1. main()函数里初始化串口,函数的使用方法参考帮助手册即可OpenComConfig (7, "", 115200, 0, 8, 1, 512, 512); //打开串口	SetCTSMode (7, LWRS_HWHANDSHAKE_OFF); //无硬件交互	FlushInQ (7); //清空缓冲区	FlushOutQ (7);	//PromptPopup ("Event Charter", "Enter the Enevnt Character", gEventChar, 1);	InstallComCallback (7, LWRS_RECEIVE, 2, 0, Event_Char_Func, 0); //绑定串口事件回调函数	DisplayPanel (panelHandle);	RunUserInterface ();	CloseCom(7); //软件关闭时关闭串口	DiscardPanel (panelHandle);	return 0;2. 串口回调函数void CVICALLBACK Event_Char_Func(int portNo,int eventMask,void * callbackData) {	char strBuf[20]={0};	float dataBuf[200]={0.0} ;	float InputVoltageMv;	int InjectedConvData= 0;	unsigned int strLen=GetInQLen(7); //获取串口接收的数据缓冲区长度	ComRd(7, readBuf, strLen); //读取指定长度数据	PlotStripChart (panelHandle, PANEL_VOLTAGE_GRAPH, readBuf, strLen, 0, 0, VAL_FLOAT); //把数据在曲线图上从左至右实时更新
}
http://www.vihome.com.cn/bbs/v