Modbus RTU Master Help Needed ...

Hi there ....

I am new in VB(2008 Express) and I want to develop Modbus RTU Master program ..

I am expert in Modbus communication and I have designed the Modbus pre-programmed remote controls ,, Now I want to interface some Modbus RTU slave devices to my own developed application ... and looking for kind guidance ..

I am much familiar with the Modbus RTU syntax and I've tried following to initiate the the master query but I am getting initial 3 bytes ok ,, rest of them are changing the values on COM port so slave is not responding to my command ..

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

Dim BYTE1 As Byte = 1
Dim BYTE2 As Byte = 6
Dim BYTE3 As Byte = 95
Dim BYTE4 As Byte = 201
Dim BYTE5 As Byte = 254
Dim BYTE6 As Byte = 1
Dim BYTE7 As Byte = 202
Dim BYTE8 As Byte = 64

SerialPort1.Write(Chr(BYTE1) & Chr(BYTE2) & Chr(BYTE3) & Chr(BYTE4) & Chr(BYTE5) & Chr(BYTE6) & Chr(BYTE7) & Chr(BYTE8))

End Sub
Thanks in advance for the guidance and help



  • This reply might be a little late for you, but here goes.

    The reason that I see that the slave is not responding to your request is because you don't have your CRC checksum appended to the end of your string.

    According to my CRC checksum program (which goes without saying that I wouldn't mind independent verification ;> ), your checksum should be 2400 hex. With endian byte swapping, that should make it 0024 hex, or CHR$(0) + CHR$(36).

    Your slave will not respond to any request from the master without a correct checksum.

  • hi maan
    i am santosh, i am looking for code that can communicate with PLC, just started working on this. As you are expert in PLC communication, Please can your share the code to communicate the PLC with Modbus. --- my email id.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!