pb如何使用mscomm32发送16进制的数据而不是字符型
pb如何使用mscomm32发送16进制的数据而不是字符型
我使用mscomm32.ocx的
方法
快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载
,问题是向Com端口发送数据使用O
utput方法,只能使用string类型的数据,在vb中我定义成byte类
型,向端口发送后,能够正确显示,但是在pb中我只能定义成strin
g,发送后就不能正确显示。
例如发送数据FF(注意这是16进制的数据,不是string型的“FF”),
请问在pb中如何处理,,
在vb中我只需要将发送的数据定义成byte类型就可以了,那么在p
b 中如何发送16进制的数据呢,,,,
2004-11-14 11:37:00
第 2 楼 冰寒刀
头衔:Member 试试这个: 等级:上等兵 1、Windows SDK函数介绍 文章:554 积分:874 门派:无门无派 注册:2002年7月11日 OpenComm
int OpenComm(LpszDevControl,
CbInQueue,cbOutQueue)
LPCSTR lpszdevcontro
l 设备控制信息的地址
UINT CbInQueue
接受队列的大小(以字节为单位)
UINT cbOutQueue
发送队列的大小
返回:如调用成功,返回值标示此打开的设备否则其返回值小于0
?CloseComm
Int CloseComm(idComDev)
Int idComDey 要关闭的设备
返回值:调用成功返回0,否则返回负值
?WriteComm
int WriteComm(idComDev,lpvBuf,cbWrite)
int idComDev 通讯设备标示符
const void FAR * lpvBuf 数据缓存区地址
int ,cbWrite 要写的长度 repeat the above procedure, the data processing, classification, process, or report Design Studio. 2, basic operating instructions (1) drawings: for the operation of, first of all to have comprehensive understanding of drawing, not only for curtain wall construction, civil construction, structure also needs to understand, mainly to understand elevation changes location, elevation, features, to fully grasp the need to control the actual construction drawings. (2) on whole engineering for partition, and points surface, and prepared measurement plans, for workload larger of or more complex of engineering, measurement to classification ordered of for, in on buildings profile measurement Qian to prepared measurement plans, on by measurement object for partition, and points surface, and Division of plans measurement, then for integrated, measurement regional of divided
返回值:如果成功返回所写的字节数,否则返回值小于0
?ReadComm
Int ReadComm(idComDev,lpvBuf,cbRead)
int idComDev 通讯设备标示符
const void FAR * lpvBuf 数据缓存区地址
int cbRead 要读的字节数
返回值:如果成功返回所读的字节数,否则返回值小于0
?FlushComm
Int FluseComm(idComDev,fnQueue)
Int idComDev 通讯设备标示符
Int fnQueue 要刷新的队列
返回值:成功时返回0,否则返回为负
---- 2、示例:
---- 图一(略)为一人事管理系统中的查询窗口。如果想与被查询人拨打电话,可输入该人姓名,在输入过程中,数据窗口会显示满足要求的所有人姓名,双击该行即将该人电话号码显示于单行编辑窗
内,然后按“拨号”按钮即可。
---- 程序设计如下:
---- 在窗口设计菜单中选取:Declare菜单?Declare External Fun
ction 输入:
Function int OpenComm(String Comm,
Uint Inqueue,Uint Outqueue)Library
“USER.EXE”
Function int CloseComm(int lpt)Library
“USER.EXE”
Function int WriteComm(int lpt,String
buf,int Size) Library “USER.EXE”
Function int FlushComm(int lpt,
repeat the above procedure, the data processing, classification, process, or report Design Studio. 2, basic operating instructions (1) drawings: for the operation of, first of all to have comprehensive understanding of drawing, not only for curtain wall construction, civil construction, structure also needs to understand, mainly to understand elevation changes location, elevation, features, to fully grasp the need to control the actual construction drawings. (2) on whole engineering for partition, and points surface, and prepared measurement plans, for workload larger of or more complex of engineering, measurement to classification ordered of for, in on buildings profile measurement Qian to prepared measurement plans, on by measurement object for partition, and points surface, and Division of plans measurement, then for integrated, measurement regional of divided
int no_que)Library “USER.EXE”
“拨号”按钮的”Clicked” 事件编程如下:
int ret
String port_2,ph_code
port_2=”Com2”
//取单行编辑框内容,并用atdt拨号
ph_code=”atdt”+sle_code+”~r~n”
//打开串口
ret=OpenComm(port_2,128,128)
//拨号开始
FlushComm(ret,0)
FlushComm(ret,1)
WriteComm(ret,ph_code,len(ph_code))
WriteComm(ret,”~r~n”,2)
CloseComm(ret)
2004-11-14 12:05:00
第 3 楼 老马
头衔:Member ole_1.object.output=BLOB(char(255)+CHAR(0)+char(255)) 等级:无业游民 //发送FF 00 FF 文章:26 积分:137
注册:2002年5月20日
2004-11-14 12:06:00
第 4 楼 chencms
头衔:Member ole_1.object.output=BLOB(char(255)+CHAR(0)+char(255)) 等级:无业游民 //发送FF 00 FF 文章:23 首先非常感谢~ 积分:135 但我发送char(0)时,使用串口跟踪工具,发现并无数据显示,请 门派:无门无派 问是什么问题啊, 注册:2002年7月6日
repeat the above procedure, the data processing, classification, process, or report Design Studio. 2, basic operating instructions (1) drawings: for the operation of, first of all to have comprehensive understanding of drawing, not only for curtain wall construction, civil construction, structure also needs to understand, mainly to understand elevation changes location, elevation, features, to fully grasp the need to control the actual construction drawings. (2) on whole engineering for partition, and points surface, and prepared measurement plans, for workload larger of or more complex of engineering, measurement to classification ordered of for, in on buildings profile measurement Qian to prepared measurement plans, on by measurement object for partition, and points surface, and Division of plans measurement, then for integrated, measurement regional of divided
2004-11-14 21:36:00
第 5 楼 老马
头衔:Member 忘了告诉你,00发是发了,只不过你的下位机(单片机)一般不 等级:无业游民 接收00,可以通知单片机人员你把00该为其他数即可 文章:26
积分:137
注册:2002年5月20日
repeat the above procedure, the data processing, classification, process, or report Design Studio. 2, basic operating instructions (1) drawings: for the operation of, first of all to have comprehensive understanding of drawing, not only for curtain wall construction, civil construction, structure also needs to understand, mainly to understand elevation changes location, elevation, features, to fully grasp the need to control the actual construction drawings. (2) on whole engineering for partition, and points surface, and prepared measurement plans, for workload larger of or more complex of engineering, measurement to classification ordered of for, in on buildings profile measurement Qian to prepared measurement plans, on by measurement object for partition, and points surface, and Division of plans measurement, then for integrated, measurement regional of divided