资源描述:
《基于labwindows的串口通信》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#include#include#includeinclude”串口通信.h“#definetextjength2048staticintconfig_handle;config_flag;portindex;port_open;RS232Error;comport;baudrate;parity;databits;stopbits;inputq;o
2、utputq;xmode;ctsmode;type;stringsize;bytes_sent;send_byte;send_mode;read_cnt;bytes_read;chardevicenamef301;charsend_data[textjength];charread_dataltext_length];chartbox_read_data[text_length];doubletimeout;staticvoid*callbackdata;staticintpanelHandle,graphpanel,c
3、onfig;voidComCallbcick(intCOMport,inteventMask,void*callbackdata);voidSetConfigParms();voidGetConfigParms();voidEnablePanelControls(int);voidSendAscii(void);voidSendByte(void);voidDisplayRS232Error(void);voidSetConfigParms(){SetCtrlVal(config_handle,CONFIG_COMPOR
4、T,comport);SetCtrlVal(config.handle,CONFIG_BAUDRATE,baudrate);SetCtrlVal(config_handle,CONFIG_PARITY,parity);SetCtrlVal(config_handle,CONFIG.DATABITS,databits);SetCtrlVal(config_handle,CONFIG_STOPBITS,stopbits);SetCtrlVal(config_handle,CONFIG」NPUTQ,inputq);SetCtr
5、lVal(config_handle,CONFIG.OUTPUTQ,outputq);SetCtrlVal(config_handle,CONFIG.CTSMODE,ctsmode);SetCtrlVal(config_handle,CONFIG_XMODE,xmode);SetCtrllndex(config_handle,CONFIG_COMPORT,portindex);voidGetConfigParms(){GetCtrlVal(config_handle,CONFIG_COMPORT,&comport);Ge
6、tCtrlVal(config_handle,CONFIG_BAUDRATE,&baudrate);GetCtrlVal(config_handle,CONFIG.PARITY,&parity);GetCtrlVal(config.handle,CONFIG.DATABITS,&databits);GetCtrlVal(config_handle,CONFIG.STOPBITS,&stopbits);GetCtrlVal(config_handle,CONFIG」NPUTQ,&inputq);GetCtrlVal(con
7、fig_handle,CONFIG_OUTPUTQ,&outputq);GetCtrlVal(config_handle,CONFIG_CTSMODE,&ctsmode);GetCtrlVal(config_handle,CONFIG_XMODE,&xmode);GetCtrlVal(config_handle,CONFIG_TIMEOUT,&timeout);GetCtrlIndex(config_handle,CONFIG_COMPORT,&portindex);#ifdef_Nl_unix_devicename[0
8、]=0;#elseGetLabelFromlndex(config_handle,CONFIG_COMPORT,portindex,devicename);#endifvoidEnablePanelControls(intenable)冷uoA。jui4[oj)uoojui4puudjui)>
9、ouq[
10、B09pou