saudrehman
Member level 1
mscomm modbus
hi guys i am new to VB
i am implementing a VB GUI for an energy meter .A PC will send and receive modbus frames from the nergy meter.
i am using the comm control object in VB
will this work
suppose i need to trnasmit this Hex frame 01 06 00 08 00 01 CRC
then will this work
MSComm1.PortOpen = True
MSComm1.Output = Chr(&H0) & Chr(&H1) & Chr(&H0) & Chr(&H6) & Chr(&H0) & Chr(&H0) & Chr(&H0) & Chr(&H7) & Chr(&H0) & Chr(&H0) & Chr(&H0) & Chr(&H1) & Chr(&HD0) & Chr(&HF9)
and i receive the same response from the meter if OK
Dim ValResult As Double
ValResult = Val(MSComm1.Input)
If ValResult Then
MsgBox "Valid response"
Else
MsgBox "No response "
End If
mscomm1.portopen=false
plz tell me whats wrong
hi guys i am new to VB
i am implementing a VB GUI for an energy meter .A PC will send and receive modbus frames from the nergy meter.
i am using the comm control object in VB
will this work
suppose i need to trnasmit this Hex frame 01 06 00 08 00 01 CRC
then will this work
MSComm1.PortOpen = True
MSComm1.Output = Chr(&H0) & Chr(&H1) & Chr(&H0) & Chr(&H6) & Chr(&H0) & Chr(&H0) & Chr(&H0) & Chr(&H7) & Chr(&H0) & Chr(&H0) & Chr(&H0) & Chr(&H1) & Chr(&HD0) & Chr(&HF9)
and i receive the same response from the meter if OK
Dim ValResult As Double
ValResult = Val(MSComm1.Input)
If ValResult Then
MsgBox "Valid response"
Else
MsgBox "No response "
End If
mscomm1.portopen=false
plz tell me whats wrong