社区
非技术版
帖子详情
llitcwl(中国龙)还是上次串口通讯的问题帮我写一个API吧,
nettang
2002-02-05 12:47:14
我的邮箱是:nettang@8848.net
QQ:1306644
...全文
85
6
打赏
收藏
llitcwl(中国龙)还是上次串口通讯的问题帮我写一个API吧,
我的邮箱是:nettang@8848.net QQ:1306644
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dgzdx
2002-02-06
打赏
举报
回复
关注!
nettang
2002-02-06
打赏
举报
回复
兄弟啊!
我怎么没有收到啊!
nettang@163.net
llitcwl
2002-02-05
打赏
举报
回复
算了,还是发一个以前网友用COMM 写的程序吧。
llitcwl
2002-02-05
打赏
举报
回复
一大堆的,不好说明:
//相关API
Function Boolean CloseHandle(ulong hObject ) Library "kernel32.dll"
FUNCTION boolean ReadFile(ulong fhand, ref string lpbuffer, ulong numbyte, ref ulong bytesread, ulong lpover) LIBRARY "kernel32.dll"
FUNCTION ulong CreateFileA(ref string fname, ulong f_access, ulong f_share, ulong f_sec, ulong f_create, ulong f_flag, ulong f_attrib) LIBRARY "kernel32.dll"
Function Boolean WriteFile(uLong handle,ref string lpbuffer,ulong numbytes, ref ulong bytesread, ulong lpOverLaped) Library "Kernel32.dll"
Function Boolean GetCommProperties(ulong hFile,ref COMMPROP lpCommProp ) Library "Kernel32.dll"
Function Boolean BuildCommDCBA(ref string lpDef,ref DCB lpDCB ) Library "Kernel32.dll"
Function Boolean SetCommState(ulong hCommDev,ref DCB lpdcb ) Library "Kernel32.dll"
Function Boolean GetCommState(ulong hCommDev,ref DCB lpdcb ) Library "Kernel32.dll"
Function ulong GetLastError() Library "Kernel32.dll"
Function Boolean SetCommTimeouts(ulong hCommDev, ref COMMTIMEOUTS lpctmo ) Library "Kernel32.dll"
Function Boolean PurgeComm(ulong hCommDev, ulong fdwAction ) Library "Kernel32.dll"
//相关结构(PB中要进行相关变化,其他见我前两天的C变量与PB对应表)
typedef struct _DCB {
DWORD DCBlength; // sizeof(DCB)
DWORD BaudRate; // current baud rate
DWORD fBinary: 1; // binary mode, no EOF check
DWORD fParity: 1; // enable parity checking
DWORD fOutxCtsFlow:1; // CTS output flow control
DWORD fOutxDsrFlow:1; // DSR output flow control
DWORD fDtrControl:2; // DTR flow control type
DWORD fDsrSensitivity:1; // DSR sensitivity
DWORD fTXContinueOnXoff:1; // XOFF continues Tx
DWORD fOutX: 1; // XON/XOFF out flow control
DWORD fInX: 1; // XON/XOFF in flow control
DWORD fErrorChar: 1; // enable error replacement
DWORD fNull: 1; // enable null stripping
DWORD fRtsControl:2; // RTS flow control
DWORD fAbortOnError:1; // abort on error
DWORD fDummy2:17; // reserved
WORD wReserved; // not currently used
WORD XonLim; // transmit XON threshold
WORD XoffLim; // transmit XOFF threshold
BYTE ByteSize; // number of bits/byte, 4-8
BYTE Parity; // 0-4=no,odd,even,mark,space
BYTE StopBits; // 0,1,2 = 1, 1.5, 2
char XonChar; // Tx and Rx XON character
char XoffChar; // Tx and Rx XOFF character
char ErrorChar; // error replacement character
char EofChar; // end of input character
char EvtChar; // received event character
WORD wReserved1; // reserved; do not use
} DCB;
//简单代码示例
//打开串口及初始化
dcb lst_dcb
ulong ll_hnd
//打开串口
ll_hnd = CreateFileA('com1',3221225472,0,0,3,128,0)
//设置串口
//初始化DCB
BuildCommDcbA ( '9600,N,8,1', lst_dcb )
setcommstate ( ll_hnd, lst_dcb )
//写串口
ulong lu_byte, lu_numbytes
string ls_buff
ulong ul_temp
setnull(ul_temp)
string ls_temp
ls_temp=char(27) + char(67) + char(ai_line+ads_1.dynamic rowcount( ))
writefile ( ll_hnd, ls_temp, len(ls_temp),lu_byte,ul_temp)
lionkings
2002-02-05
打赏
举报
回复
老兄﹐我也需要一個串口通信的程序﹐幫幫忙﹐有的話咱討論討論如何﹖
nettang
2002-02-05
打赏
举报
回复
dsadsd
一个
pb程序员的心声(转载)
2007-08-16PB程序员必读! 这几稿是去年我在PDRIVRE上贴的,现在做一些小的修改。 对PB的正面评价----我的PB观之一 PB是
一个
最快速的客户机/服务器开发工具,这一点已被无数次实践证实。 PB的快速来自以下几个方面: 一:数据窗口: PowerBuilder仍然具有最强大的报表
PB程序员必读
PB程序员必读! 这几稿是去年我在PDRIVRE上贴的,现在做一些小的修改。 对PB的正面评价----我的PB观之一 PB是
一个
最快速的客户机/服务器开发工具,这一点已被无数次实践证实。 PB的快速来自以下几个方面: 一:数据窗口: PowerBuilder仍然具有最强大的报表功能,只有它具有可以直接在应用程序中使用的报表生成器。PowerBuild支持Crosstab、
pb 数据导出到excel
鉴于现在很多朋友询问 pb 数据导出到excel 中的
问题
,导出去后格式和数据类型不对了,自己
写
了几个用户对象,希望能抛砖引玉,加强技术交流,得到大家的支持。 1. nvo_excel 只要是两个接口函数导出数据存储的数据,可以定义 excel 的标题public function integer uf_toexcel (datastore ads_data, readonly string...
pb 嵌套数据窗口怎样导出为XML文件
鉴于现在很多朋友询问 PB 数据导出到Excel 中的
问题
,导出去后格式和数据 类型不对了,自己
写
了几个用户对象, 希望能抛砖引玉,加强技术交流,得到大家的支持。 1. nvo_excel 只要是两个接口函数 导出数据存储的数据,可以定义 excel 的标题 public function integer uf_toexcel (datastore ads_data, readonl
将DW数据窗口导出为EXCEL文件的方法(整理)
本文为摘自csdn论坛帖子收集整理后汇总版本: ---2004年9月3日整理 ---原贴见: http://community.csdn.net/expert/topic/3328/3328715.xml?temp=8.050799e-04 鉴于现在很多朋友询问 pb 数据导出到excel 中的
问题
,导出去后格式和数据 类型不对了,自己
写
了几个用户对象, 希望能抛砖引玉
非技术版
401
社区成员
11,495
社区内容
发帖
与我相关
我的任务
非技术版
PowerBuilder 非技术版
复制链接
扫一扫
分享
社区描述
PowerBuilder 非技术版
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章