Serial communication

xiaoxiao2021-03-06  38

About MSCOMM Usage MSCOMM control is a good thing, if you can fully understand him, he will work with you. Greatly looked at the topic of discussing MScomm in the afternoon, I feel that I need to talk about my experience, I usually only do hardware, there is no system, just have the use of software, how much is it, I also take it here. Out of play, I don't know if it is wrong, I thought I had already done it. ^ _ ^ This is a VB universal serial event driver receiver. Receive a packet at one time, the packet can be arbitrary bytes, ensuring that one data will not be lost! Private sub mscomm_oncomm () DIM S () AS BYTE DIM SS (1024) AS BYTE Static N as long static t as variant if (mscomm.commmevent = comVreceive) THEN S = MSCOMM.INPUT 'As long as there is data, it is only charged, even if it is just One IF (Timer - T> 0.01) THEN 'interval 10ms or more considered a new package text1 = "" "TEXT1 for collecting and displaying reception (HEX format) n = 0 end if timer for i = 0 TO Ubound (s) 'a packet may result in several ONCOMM events text1.text = text1.text & right ("0" & ​​hex (s (i)) & "h", 3) "" SS (N i ) = S (i) 'Receiving data packets to SS () n = n ubound (s) Next i end ifend sub

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

New Post(0)