Home > Software engineering >  Shanghai yao hua electronic pounds xk3190 - A9 serial code
Shanghai yao hua electronic pounds xk3190 - A9 serial code

Time:09-18

Vb to read scale load information: must breakpoint debugging, to read, and the data are not
Private Sub MSComm1_OnComm ()
On the Error Resume Next
The Static CNT As Integer
Dim receive_cnt As Integer
Dim As Integer I

Dim Buffer As the Variant
Dim Arr () As Byte
Dim s As String
Dim STR As String
Select Case mEvent MSComm1.Com
Case comEvReceive
Receive_cnt=MSComm1. InBufferCount

Buffer=MSComm1. Input

Arr=Buffer
S=""
For I=0 To receive_cnt - 1
If Arr (I) & gt; 15 Then
S=s + Hex (Arr (I)) + "
"The Else
S=s + "0" + Hex (Arr (I)) + "
"End the If
CNT=CNT + 1
If I & gt; Then 100
DoEvents
STR=STR & amp; S

End the If
Next I

If CNT & gt; Then=100
CNT=0
The Exit Sub
End the If
Case comEvSend

End the Select
End Sub

CodePudding user response:

The great spirit if familiar with serial and scale load development, can contact me, appreciate,

CodePudding user response:

"Break" to debug. Estimate is a data not complete.
As long as with a serial port test tools: no problem. That is your code didn't set

CodePudding user response:

See you "events" code, the first is to a On the Error Resume Next,
So, the phenomenon of the "incorrect", is a natural thing,

PS: just saw "that two lines", later I also not interested to see...
But, after all, the most basic is the most important "communication protocols", the original poster unexpectedly didn't mention a word!

CodePudding user response:

"Compiler principle" reference of lexical analysis and the finite state automata,
  • Related