JohnS (Customer) asked a question.

I am using DL262 to communicate with tGW-715 modbus converter.
I want t eventually read back 5 modbus devices addr 20-24.
I having trouble getting the write and readback working on just one device.

I need to know why its not working on one, also where does the modbus id addr need to put to identify which reading is which.

I need to send dec 7 to the device to intiate a sensor read and 450ms later read the values back to the plc.

Initially get one to work would be great, but then the other four, I'd like to sned the 'writes' 100ms apart, then the readbacks 100ms apart.

can anyone assist?


  • HOST_franji1 (HOST Engineering)

    Do-more CPUs speak Modbus/TCP much easier than Direct Logic (have you learned about the mapping of DL octal V addresses to Modbus Register memory?).

     

    H2-DM1E CPU in a 205 I/O base can be utilized instead of a 262 CPU and most likely your ECOM100 module (not sure what else you are "Ethernetting" out your ECOM100).

     

    Also Do-more supports Stage programming better than DL. You will be needing to do some handshaking with each RTU slave, one at a time, so a well-designed Stage diagram would definitely help implement this (think error handling also, e.g. what do you do if device at address 23 goes down - you still want to do 20, 21, 22, and 24). A Stage implementation is close to a state-transition diagram that you would draw out by hand).

     

    Send Command to 20

    On Success, Read Response from 20

    On Error, Send Command to 21 // don't bother trying to read response from 20, move on to dev 21

     

    Read Response from 20

    On Success, Send Command to 21 // move on to dev 21

    On Error, Send Command to 21 // move on to dev 21

     

    Send Command to 21

    On Success, Read Response from 21

    On Error, goto Send Command to 22

     

    ...

     

     

    The actual PLC code ends up being something like:

     

    Program DoAllCommands

    SG S0 // Dev 20 handler

    MWX OnSuccess JMP S1, OnError JMP S10

    SG S1

    MRX OnSuccess JMP S10, OnError JMP S10

     

    SG S10 // Dev 21 handler

    MWX (similar pattern as above)

    SG S11

    MRX

     

    SG S20 // Dev 22 handler

    MWX

    SG S21

    MRX

     

    ...

     

    I had each RTU "handler" in its own Stage block of 10 (0x for dev 20, 1x for dev 21, 2x for dev 22, 3x for dev 23, 4x for dev24). You may need to add other stages for any "command response" handling (S12, S22, S32, etc). Just draw out your diagram on paper (circles and arcs, with each arc having its "transition" condition, and each circle describes what you are doing in that "stage", e.g. "Send Cmd to Dev 20".

     

    You technically can this in straight ladder. You can technically do it in DL.

    But if you will need to understand DL and IBoxes and Modbus/TCP and ECOM100s, Do-more greatly simplifies all that.

     

    Expand Post
    • JohnS (Customer)

      Thank you for your reply, I dont have the choice of cpu as its modifications to an exiting system. Anything you could add with that in mind would be appreciated.

      • HOST_franji1 (HOST Engineering)

        Just get a single READ working. Don't try to implement any command/response handshaking yet.

         

        Have you set up your Modbus/TCP address table in your ECOM100?

         

        You specify the specific Slave ID in the "Peer to Peer" ECOM100 Configuration dialog in NetEdit (e.g. RX/WX Slave ID is mapped to RTU slave 20):

         

        image

        Expand Post
      • JohnS (Customer)

        Yes thats sounds good.

        I didnt know about the peeer to peer setup, I have a look into that.

        Thank you very much :-)

      • HOST_franji1 (HOST Engineering)

        Eventually, you will configure all 5 RTU slaves, but just get ONE working. And just get it working with a simple ECRX. Get that nailed down and working like a hose.

         

        imageThe 1-5 Device ID will be the Modbus/TCP Slave ID "index" you put in the ECRX/ECWX instructions.

        Expand Post
      • JohnS (Customer)

        Hi yes that looks exactly like what I want to do.

        I've had a look around the program platform but can find where this peer to peer is to enter the 1 to 5 listing as you've mentioned, could i beg you to give me a pointer please.

        I very much appreciate your help.

      • JohnS (Customer)

        The IP address above, is that the cpu or TCP/Modbus device writing to ?

        I believe it would be the TCP/Modbus device if I'm looking at it right?

        My cpu Ecom100 IP is 192.168.1.160 and TCP/modbus device IP 192.168.1.146.

      • JohnS (Customer)

        Further update

        I've found the peer to peer (netedit3) and setup the slave id needed, I'm getting the write success now but the following read is giving error flag output, any ideas please please?

      • HOST_franji1 (HOST Engineering)

        Just get ANY read to work. Don't get bogged down in the handshaking yet (write command, read response, next slave, write command, read response, next slave).

         

        Get 1 read working (firmware register, anything). Make sure you have the addressing correct. Some devices publish the addresses off by 1 (you have to add 1 or subtract 1 in your DL code).

         

        You have to make sure you are getting the CORRECT value, not just ANY value (see previous paragraph).

        Expand Post