PComm Lite ---- 用VC 封装串口通信协议 DLL

用了Pcomm lite,只需要打开串口,建个线程收数据,然后只需要关注自己要收发的数据就行了。

PComm Lite是家叫moxa的公司出的,做了几十年工业串口卡、串口服务器之类设备了。提供的pcomm易用性、可靠性久经考验。

下载地址:http://www.moxa.com/product/download_pcommlite_info.htm
成熟的PCOMM PRO确实好用,例子和使用方法都比较简单
成熟串口DLL产品, PCOMM, 如果你还要封装自已的协议, 再写一个DLL中间件 调用串口DLL 就行了, 省去了 串口封装这一大难题。

注意可以会搜到另外一个Version 2.6. Released Jul 8, 2008是WIN9x/NT4用的,不要看版本号高下错了。
国外工业上还有很多老系统在用。

用起来很简单,pcomm.h/pcomm.lib两个文件复制到项目目录并引用,pcomm.dll丢到windows\system32下。
整个库包含50多个函数,最常用的也就10来个:
打开、关闭、设波特率的:sio_open ()、sio_close()、sio_baut()
发送数据的:sio_putch(),sio_write()
接收数据的:sio_getch(),sio_read()
查询输入输出缓冲区状态的:sio_iqueue(), sio_oqueue()
有时可能要设读写超时:sio_SetReadTimeouts(), sio_SetWriteTimeouts()
这些函数见名知义,用法查一下PComm.chm就行了。
接收数据一般免不了要开线程的,在接收线程里sio_iqueue()看一下有没有数据,有就处理,没就Sleep()一会。接收数据时它至少会帮你缓冲几十k,一般也不会丢数据。也可以用sio_term_irq()指定接收一定长数据数据就调用一个CALLBACK函数。
这些基本就齐活了。需要控制DTS/RTS、自动流控件有都有,甚至还有Xmoderm/Ymoderm/Zmoderm发送文件。如果要Modbus之类的协议就要自己写了。

https://www.moxa.com/product/download_pcommlite_info.htm

Features and Benefits

Easy-to-use APIs (more than 50 functions)
Supports ZModem, YModem, XModem, Kermit, and ASCII file transfer protocols
Supports VB, C/C++, Delphi interfaces—sample programs provided
Supports serial comm speeds up to 921.6 Kbps
Supports Multi-Session Terminal Emulators (VT100, ANSI)
Compatible with standard COM ports that support Win32 COMM API
Free lifetime upgrades
Royalty Free

Introduction

MOXA PComm Lite provides software developers with an alternative to using Microsoft’s more complex Win32 COMM API. In fact, PComm Lite can be used with several different brands of multiport serial board, including Digi, Equinox, and Moxa. MOXA PComm Pro can help you:

• Speed up the development of serial comm applications
• Troubleshoot serial comm problems between two connected devices
• Analyze serial comm performance

扫描二维码关注公众号,回复: 1874631 查看本文章

MOXA PComm Lite includes easy-to-use API functions that are specially designed for async communication applications. Use one of more than 50 easy-to-use API functions with VB, C/C++, and Delphi interfaces for serial comm applications. PComm Lite also supports built-in functions for file transfer protocols such as ZModem, YModem, XModem, Kermit, and ASCII, making the programming of file uploading-and-downloading easier than ever before.

这里写图片描述

这里写图片描述

下载下来如下文件:
setup_pcommlite_1.6_12041917.zip

解压之后 得到 :setup_pcommlite_1.6_12041917.exe
这里写图片描述

这里写图片描述

C:\Program Files\Moxa\PCommLite 1.6
这里写图片描述

这里写图片描述

资料下载地址 :
https://download.csdn.net/download/wowocpp/10515930

After installation, under PComm directory, there will be sub-directories:

Lib, Example\C, Example\Vb and Example\Delphi to contain library, DLL library and sample programs, respectively. And the files contained in those sub-directories are:

Lib\PComm.hlp                The online help file.

Lib\PComm.cnt                The online help file.

Lib\PComm.dll                 The dynamic link library.

Lib\PComm.lib                 The import library. Link the application with this import library to resolve the calls to the dynamic link library PComm.dll.

Lib\PCommb.lib               The import library (for Borland C/C++). 

Lib\PComm.h                  The C header file for PComm.

Lib\PComm.pas               The Delphi unit for PComm.

Lib\PComm.bas               The VB module for PComm.

Example\C\*.*                  The C sample program.

Example\Vb\*.*                The Visual Basic sample program.

Example\Delphi\*.*           The Delphi Sample Program.


The file Pcomm.dll will also be put under %Windows%System\PComm.dll for Windows 95/98. For Windows NT/2000/XP/2003/Vista, PComm.dll will also be put under %Windows%System32\PComm.dll. The file will be used for Visual C++, Visual Basic and Borland Delphi application programs.

猜你喜欢

转载自blog.csdn.net/wowocpp/article/details/80896422
今日推荐