4, such as the be over string go communication, the close beats to rise of communication port.
For example, control Leica with the calculator when the Tc2002 whole station instrument auto measure writing the following code can nicely carry out two of communication:
The MS CommlCOmmPort=1'the constitution string go a communication
The MS CommlSettings=''2400, e.7, IP1'constitution wave especially rate, strange accidentally check a school, data number and stop number
The MS Comml InputLen=1'constitution or return to receive to use Input inside the buffer area an attribute to read the person's character list piece
The MS Comml InbufferSize =4096'establish Buffer area size
The MS CommlPortOpen=True'open a communication port
Attention:1, be the string that the procedure would automatically close to open while terminating line.2, if receiving buffer area is more big, the effective memory of procedure usage more small, whereas probably receive buffer area spillage, therefore should pass an experiment to enlarge its size gradually. According to the constitution like this, get up a calculator, the whole station instrument conjunction with an electric cable, can carry out the string of calculator and whole station instruments line communication.
Two, make use of the function of Windows API
Under the some condition, MSComm, control a piece isn't suitable for our requests. We can use Windows at this time API provides of communication function to carry out can transplant sex strong string of line of communication procedure with writing. Windows 98 correspondence the system provided the string of an improvement line application the procedure pick up a people API to use to carry on handing over type string with each other line correspondence. Among them, string the and other correspond by letter an equipments is a document to carry on the processed, open, close, reading of string and write in the function used similar to the function of the operation document.
Before adjusting to use APIA function, have to the first essentials pronouncement change to measure and function.
Dim dcb As DCB
Dim ofstructl As OFSTRUCT
Dim operport As Long
Open an API text to originally look into a machine in the V B wreath territory bottom, open Win32. Txt document, at"pronouncement"ing can the options win election in OpenFilc and Setup Cornm, Setup CommState and ReadFile, WriteFile, CIoscHand, le etc. function, in "type" can the options win election in DCB, OVERLAPPED etc. structure, in "constant" can the options win election in ODDPARITY, EVRXCHAR etc. often quantity, then choose a "replication", make duplicate them to the scrapbook, and glue to stick application procedure code in. Adjust to carry on a string of line communication with API in the VB 6.0 timeses:
1,adjust to use CreateFile line communication first carry on a beginning to start to turn to the string. CreateFile function for read an interview or write an interview to beat
Open a string of, return to that string of sentence handle after opening successfully, then adjust to use SetComm function is in a string of line allotment buffer area size, provide to read and write a string of usage, immediately after use DCB the structure change to measure a constitution to need to change the communication parameter of lacking the string line of saving the value, such as wave especially rate, strange accidentally the school check a , data, stop.
2,adjust to use Write File, the Read File function carries on reading and writing an operation to the string line. Carry on a data to send out with Write File, for synchronous I/O operation, its last parameter can be NULL, but tread an I/O operation to the difference, its last parameter musts be a direction OVERLAPPED structure of point needle, make reading and writing of data the operation carry on in the backstage and pass this OVERLAPPED'structure to acquire current operation appearance. Use Read File receive buffer area to read from the string data, data before reading, use Clear Comm Error the function acquire word stanza within buffer area number.
- 上一篇:网上电影票预订英文文献和中文翻译
- 下一篇:Linux网络时间协议英文文献和中文翻译
-
-
-
-
-
-
-
中国传统元素在游戏角色...
高警觉工作人群的元情绪...
C++最短路径算法研究和程序设计
浅析中国古代宗法制度
现代简约美式风格在室内家装中的运用
g-C3N4光催化剂的制备和光催化性能研究
上市公司股权结构对经营绩效的影响研究
巴金《激流三部曲》高觉新的悲剧命运
江苏省某高中学生体质现状的调查研究
NFC协议物理层的软件实现+文献综述