I want to get Count as output from weighing machine using com port
My Port Connect Event Code is Below:
Private Sub cmdConnect_Click()
If cmdConnect.Caption = "Connect Machine" Then
Dim str As String
str = Combo1.Text
Dim i As Integer, j As String
i = Mid(str, 4, 1)
MSComm1.CommPort = i
MSComm1.PortOpen = False
MSComm1.PortOpen = True
MsgBox "Communication Created Successfully"
MSComm1.Settings = "9600,N,8,1"
MSComm1.Output = "0" + Chr(13)
MSComm1.DTREnable = True
MSComm1.Handshaking = 1
MSComm1.NullDiscard = True
MSComm1.RTSEnable = True
MSComm1.EOFEnable = True
MSComm1.RThreshold = 12
MSComm1.SThreshold = 1
MSComm1.InputMode = comInputModeText
cmdConnect.BackColor = &HC0&
cmdConnect.Caption = "Disconnect Machine"
My OnComm Event Code is Here:
<pre>Dim str As String, res As Variant, com As String, txt As String, i As Integer
MSComm1.DTREnable = True
MSComm1.Handshaking = 1
MSComm1.NullDiscard = True
MSComm1.RTSEnable = True
MSComm1.EOFEnable = True
MSComm1.RThreshold = 15
MSComm1.SThreshold = 1
MSComm1.InputMode = comInputModeText
Select Case MSComm1.CommEvent
Case comEvReceive
txtDisplay.Text = ""
Do While MSComm1.InBufferCount > 0
txtDisplay.Text = txtDisplay.Text + vbNewLine + MSComm1.Input
Loop
If OptAuto.Value = True Then
ReportPrint
ElseIf OptManu.Value = True Then
cmdPrint.Visible = True
End If
Case Is > 1000
MsgBox "Unknown Weight"
End Select
My Output Format is
Same Weight Come in two Different Format
First Output Like
0001.600013660S
here count is 1366
Second time Output like 0.0001.60001366 here count is 1366
some other weight give output like this
2.1852.185 here count is 185
Please tell me it's the correct coding
or tell me correct coding to receive com port data in uniform format
i want to split count from this output here count come in last digit of every single output