WIFI 模块 串口 调试 助手
2009-06-13 21:57
239 查看
本人在调试wifi模块时,用delphi写了个wifi模块调试助手的程序,
串口采用mscomm,
开启mscomm
procedure TForm1.FormCreate(Sender: TObject);
begin
try
configinifile:=Tinifile.create('config/config.ini');
mscomm1.CommPort:=configinifile.readinteger('gsmmscomm','commport',2);
mscomm1.Settings:=configinifile.readString('gsmmscomm','settings','9600,n,8,1');
mscomm1.PortOpen:=true;
except
MessageBox(0,'请修改配置文件config.ini的端口号','串口端口号设置错误或者不存在此端口号!',MB_OK);
end;
edit2.Text:=inttostr(mscomm1.CommPort);
end;
mscomm接收事件处理程序:
procedure TForm1.MSComm1Comm(Sender: TObject);
var
inputCount:integer;
tmpStr:string;
tmpArray:array of byte;
i:integer;
begin
tmpStr:='';
case mscomm1.CommEvent of
comEvReceive:
begin
tmpStr:='';
inputCount:=mscomm1.InBufferCount;
// tmpReadCount:=inputCount;
setLength(tmpArray,inputcount);
tmpArray:=mscomm1.input;
// analizeData(tmpArray );
//-------------------------------------------------//
for i:=0 to inputCount -1 do
begin
if blnHex then
tmpStr:=tmpstr +' '+intTohex(tmpArray[i],2)
else
tmpStr:=tmpStr+chr(tmpArray[i]);
if (tmpArray[i-1]=13)and(tmpArray[i]=10) then
begin
memInfo.Text:=memInfo.Text+tmpStr+#13#10;
memInfo.SelStart:=length(memInfo.Text);
tmpStr:='';
end;
end;//end for
memInfo.Text:=memInfo.Text+tmpstr;
memInfo.SelStart:=length(memInfo.Text);
// memInfo.ScrollBars.
// sendmessage(memInfo.Handle,WM_VSCROLL,SB_BOTTOM,0);
//滚动条下滑
memInfo.SelStart:= getTextlen;
memInfo.SelLength:= Length(memInfo.text);
//-----------------------------------------------------//
end;
else;
end; //end case;
end;
模块和程序效果图如下:
![](http://p.blog.csdn.net/images/p_blog_csdn_net/wangtingguang/EntryImages/20090613/11.jpg)
![](http://p.blog.csdn.net/images/p_blog_csdn_net/wangtingguang/EntryImages/20090613/12.jpg)
串口采用mscomm,
开启mscomm
procedure TForm1.FormCreate(Sender: TObject);
begin
try
configinifile:=Tinifile.create('config/config.ini');
mscomm1.CommPort:=configinifile.readinteger('gsmmscomm','commport',2);
mscomm1.Settings:=configinifile.readString('gsmmscomm','settings','9600,n,8,1');
mscomm1.PortOpen:=true;
except
MessageBox(0,'请修改配置文件config.ini的端口号','串口端口号设置错误或者不存在此端口号!',MB_OK);
end;
edit2.Text:=inttostr(mscomm1.CommPort);
end;
mscomm接收事件处理程序:
procedure TForm1.MSComm1Comm(Sender: TObject);
var
inputCount:integer;
tmpStr:string;
tmpArray:array of byte;
i:integer;
begin
tmpStr:='';
case mscomm1.CommEvent of
comEvReceive:
begin
tmpStr:='';
inputCount:=mscomm1.InBufferCount;
// tmpReadCount:=inputCount;
setLength(tmpArray,inputcount);
tmpArray:=mscomm1.input;
// analizeData(tmpArray );
//-------------------------------------------------//
for i:=0 to inputCount -1 do
begin
if blnHex then
tmpStr:=tmpstr +' '+intTohex(tmpArray[i],2)
else
tmpStr:=tmpStr+chr(tmpArray[i]);
if (tmpArray[i-1]=13)and(tmpArray[i]=10) then
begin
memInfo.Text:=memInfo.Text+tmpStr+#13#10;
memInfo.SelStart:=length(memInfo.Text);
tmpStr:='';
end;
end;//end for
memInfo.Text:=memInfo.Text+tmpstr;
memInfo.SelStart:=length(memInfo.Text);
// memInfo.ScrollBars.
// sendmessage(memInfo.Handle,WM_VSCROLL,SB_BOTTOM,0);
//滚动条下滑
memInfo.SelStart:= getTextlen;
memInfo.SelLength:= Length(memInfo.text);
//-----------------------------------------------------//
end;
else;
end; //end case;
end;
模块和程序效果图如下:
![](http://p.blog.csdn.net/images/p_blog_csdn_net/wangtingguang/EntryImages/20090613/11.jpg)
![](http://p.blog.csdn.net/images/p_blog_csdn_net/wangtingguang/EntryImages/20090613/12.jpg)
![](http://p.blog.csdn.net/images/p_blog_csdn_net/wangtingguang/EntryImages/20090613/14.jpg)
相关文章推荐
- Android 调试助手ATools [WIFI BT NFC GPS USB BLE 蓝牙串口 iBeacon ......]
- 调试wifi转串口的板子成功了
- WinCE下串口蓝牙模块的调试
- 4.0-华为MW269V2模块wifi调试
- ESP8266 WiFi串口模块的学习与使用(一)
- 编程练习:串口通信调试助手
- WinCE下串口蓝牙模块的调试
- 4.0-华为MW269V2模块wifi调试
- Wifi小车之 – 无线路由串口调试篇
- 高通平台串口调试 AP与模块串口通讯调试总结
- ESP8266 WiFi串口模块的学习与使用(一)
- WIFI转串口无线传输模块,个人体会
- WinCE下串口蓝牙模块的调试
- 高通平台串口调试 AP与模块串口通讯调试总结
- Fedora10下安装xgcom串口调试小助手
- ESP8266-12F WIFI转串口模块底板设计
- 高通平台串口调试 AP与模块串口通讯调试总结
- 串口wifi- 无线局域网wlan模块
- c#的串口开发调试助手
- Fedora10下安装xgcom串口调试小助手