Introduction - If you have any usage issues, please Google them yourself
This is a VB to omron Lettura_Dm = False
ricez_ok = -1: timeout = False
trasm = "@00RD"
trasm = trasm + Right$(Str$(10000 + dm!), 4)
trasm = trasm + "0001"
trasm = trasm + bcc(trasm) + Chr$(42) + Chr$(13)
Omron!Comm1.Output = trasm
conta = 0
Do
conta = conta + 1
If conta > 1200 Then timeout = True: Exit Do
Loop Until Omron!Comm1.InBufferCount >= 15
a = Omron!Comm1.Input
If Not timeout Then
fcs = Mid$(a, (Len(a) - 3), 2)
trasm = Left$(a, (Len(a) - 4))
If fcs <> bcc(trasm) Then
timeout = -1
Exit Function
End If
valore = Mid$(a, 8, 4)
V = Val("&H" + valore)
Lettura_Dm = True
End If
ricez_ok = 0
Omron!Comm1.InBufferCount = 0
End Function