当前位置:编程学习 > Delphi >>

Delphi中发现数据的问题

procedure SendData; var str1_D,str1_B:String; int1_D,int1_B:Integer; ViewStr:String; CommFlag:Boolean; begin str1_D:=Form1.Edit1.Text; int1_D:=StrToInt(str1_D); Str1_B:=IntToBin(int1_D,8); //str1_B:=IntToStr(int1_B); ViewStr:=''; CommFlag:=True; if not Form1.Comm1.WriteCommData(pchar(str1_B),8)then; begin Commflag:=false; end; ViewStr:='send'+str1_B; Form1.Memo1.Lines.Add(ViewStr); if not Commflag then messagedlg('sending falied' ,mterror,[mbyes],0); end; 这是利用SPCOMMV2.5控件发送信息的SENDDATA部分。我想请问一下,如果在edit1里输入1,数据会被转换为00000001,那么可以发送这8个BITS到下位机吗?
补充:IntToBin,是我写的一个FUNCTION,返回值就是STRING。
追问:昨晚尝试好多种,都不行。。刚试着把用ARRAY来作为输入的属性,看上去可以进行。谢谢你啊。
答案:呵呵  这个问题还没有解决啊? 可能你需要注意的是你下位机的通信协议 另外
WriteCommData(pchar(str1_B),8),是传送 Str1_B中的前8个byte(字节)  而不是位(BIT)
其他:我也是初学者,我就看问题1那个,我是想说你插入数据之后,想要查看查看新插入的数据才会执行下面的查询的,我没试过你的代码,我觉得你分开来试试,先插入 

上一个:delphi在同个单击事件中怎么实现两条查询语句
下一个:delphi 7强制关机程序 写了一个程序 用了这句WinExec('shutdown -s -t 1000', SW_SHOW);

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,