Modbus RTU Master Help Needed ... - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Modbus RTU Master Help Needed ...

maan2kmaan2k Posts: 1Member
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


Maan

Comments

  • rootboyrootboy Posts: 1Member
    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.


    John
  • santosh751santosh751 Posts: 1Member
    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.

    [email protected] --- my email id.

    santosh
Sign In or Register to comment.