CVI串口回调安装问题请教大家 恳请帮忙
时间:12-13
整理:3721RD
点击:
实现功能:单片机给rs232发数据 CVI接受数据
int CVICALLBACK ConfigCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char devicename[10];
switch (event)
{
case EVENT_COMMIT:
//获取COMPORT、BAUDRATE控件值
GetCtrlVal (panel, PANEL_COMPORT, &comport);
GetCtrlVal (panel, PANEL_BAUDRATE, &baudrate);
//从COMPORT控件得到设备名
GetLabelFromIndex (panel, PANEL_COMPORT, comport-1, devicename);
//配置COM 端口
status = OpenComConfig (comport, devicename, baudrate, 0, 8, 1, 0, 0);
InstallComCallback (1,LWRS_RECEIVE, 10, 0, ComCallback,NULL);
。。。。。。。。。。
void CVICALLBACK ComCallback(int COMPort,int eventMask,
void *callbackdata)
{
int bytes;
switch (event)
{
case EVENT_COMMIT:
//获取BYTESTOREAD控件值
GetCtrlVal (panel, PANEL_BYTESTOREAD, &bytes);
//从COM端口读取数据
status=ComRd (comport, data, bytes);
//将读取的数据显示在TEXTBOX控件中
ResetTextBox (panel, PANEL_TEXTBOX, data);
//在温度计上显示温度
Fmt (&temp,"%f<%s",data);
SetCtrlAttribute (panel, PANEL_TEMP, ATTR_CTRL_VAL, temp);
//作曲线图
PlotStripChart(panel,PANEL_STRIPCHART,data,2000,0,0,VAL_CHAR);
请问:串口回调是这么写的么?
这句 InstallComCallback (1,LWRS_RECEIVE, 10, 0, ComCallback,NULL);
提示说ComCallback没有定义,需要是ComCallbackPtr格式是什么意思?
如何改?谢谢
int CVICALLBACK ConfigCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char devicename[10];
switch (event)
{
case EVENT_COMMIT:
//获取COMPORT、BAUDRATE控件值
GetCtrlVal (panel, PANEL_COMPORT, &comport);
GetCtrlVal (panel, PANEL_BAUDRATE, &baudrate);
//从COMPORT控件得到设备名
GetLabelFromIndex (panel, PANEL_COMPORT, comport-1, devicename);
//配置COM 端口
status = OpenComConfig (comport, devicename, baudrate, 0, 8, 1, 0, 0);
InstallComCallback (1,LWRS_RECEIVE, 10, 0, ComCallback,NULL);
。。。。。。。。。。
void CVICALLBACK ComCallback(int COMPort,int eventMask,
void *callbackdata)
{
int bytes;
switch (event)
{
case EVENT_COMMIT:
//获取BYTESTOREAD控件值
GetCtrlVal (panel, PANEL_BYTESTOREAD, &bytes);
//从COM端口读取数据
status=ComRd (comport, data, bytes);
//将读取的数据显示在TEXTBOX控件中
ResetTextBox (panel, PANEL_TEXTBOX, data);
//在温度计上显示温度
Fmt (&temp,"%f<%s",data);
SetCtrlAttribute (panel, PANEL_TEMP, ATTR_CTRL_VAL, temp);
//作曲线图
PlotStripChart(panel,PANEL_STRIPCHART,data,2000,0,0,VAL_CHAR);
请问:串口回调是这么写的么?
这句 InstallComCallback (1,LWRS_RECEIVE, 10, 0, ComCallback,NULL);
提示说ComCallback没有定义,需要是ComCallbackPtr格式是什么意思?
如何改?谢谢