Communication port assembly of multi-thread, overlapping IO

zhaozj2021-02-11  171

Everyone knows that MS Visual Studio provides MSComm.ocx controls for access to communication ports via COM component package. A friend of my friend requested real-time data acquisitions with a serial port, and also draws the acquired data in real time. The effect is very unsatisfactory with MSCOMM. I wrote this component -LiteSerial.dll, a light-control communication port of the COM server. Developed with ATL 3.0 of Microsoft Visual C 6.0. It achieves this effect: Under the serial port 9600bps, the sender is not interposed in 2 seconds within 2 seconds (which is the fastest speed of 9600bps can reach), the receiving end is set as an asynchronous reception, in the foreground drawing Under conditions, the background can receive all the data in a standard time (2 seconds), and the operation of the front desk does not have obvious interruption, and the overall use is not more than 3 seconds, depending on the strength of the front desk. Later I was further improved, forming a communication port control interface close to MSCOMM and a relatively complete function. Since it focuses on resolving communication resources such as the real-time quick reading of the real-time quick reading series with the least resource, it is not added to the functionality of the MODEM, and the component aggregation can be used to inherit the direct interface. This component is dedicated by summing up a lot of online information, and is therefore dedicated to explore the exchange. The ILITSERIALPORT interface of the component encapsulates the synchronization of the standard communication resource that can be opened by the serial port, parallel port, etc., asynchronously read and write asynchronously. Components use Win32 overlapping I / O technology in the serial port. When reading and writing asynchronous, multi-threaded programming and a loop buffer control similar to Producter / Consumer are used to implement concurrent read. The overall performance is better than MScomm.ocx, and it takes up less resources. You can maximize the use of communication rates to meet data acquisition requirements under extreme conditions. Component LITESERIAL.DLL and its source code, help files LITESERIAL.CHM, VC client example SIN.EXE and its source code, VB client example vbcomtest.exe and its source code.

BBS file title of the following file: LITESERIAL related files, keywords: LITESERIALFILES: LITESERIAL.ZIP-LITESERIAL.DLLELITSERIALSIALSOURCE.ZIP - LITESERIAL Source code, ATL project. Note LITSERIAL.DLL is compiled into Win32 Release Mindependency, which is small in size and does not require additional ATL.dll. But LITESERIAL.DLL cannot be stored in a folder containing non-ANSI characters, otherwise it is not registered, which is the bug in the ATL. SIN.ZIP - SIN.EXE and its source code VBCOMTEST - VBCOMTEST.EXE and its source code

LITESERIAL.CHM - HTMLHELP format help documentation, because I don't know if I don't allow transfill compressed files outside of ZIP, the first time is transmitted with the first few files, so this file sends a file to BBS, the title is : LITESERIAL help file, keyword: LITESERIALHELP. Please read the LITSERIAL.CHM help file in detail before use.

转载请注明原文地址:https://www.9cbs.com/read-5772.html

New Post(0)