Menu

Looking for basic help MODBUS TCP

Help
Peter May
2016-10-20
2017-03-08
  • Peter May

    Peter May - 2016-10-20

    Hi all.

    I am an industrial electrician that as a hobby writes software using Delphi and Lazarus. At work we use Redlion G# HMI panels to talk to Allen Bradly PLC units. The HMI panels also have the facility to convert protocols.

    So I have mapped a few tags to the HMI panel as Modbus slaves. The addresses are limited in what we can chiose so I have 4 registers at 400001 400002 400003 and 400004

    I can read the values at these addresses using other scada software.

    So I was looking for a tutorial for PascalScada and couldnt find one but to get me started I simply need to read the values at those addresses.

    On a form I have placed

    TCP_UDPport
    Set the host to the HMI panel address 192.168.0.91
    Port type PTTCP
    Port 502
    Timeout 3000
    Logfile c:\tmp\log.txt
    Logioactions true

    and then hit the Active setting it to true. It changes back to false after about 3 seconds.

    If I run the app I get a connection error and continue to do so each reconnect attempt.

    What am I missing?

     
  • Fabio Luis Girardi

    Hi Mr. May!

    What are the components inserted into your application?

    A basic Modbus TCP with PascalSCADA should have (inserted in this order):

    1) a TTCP_UDPPort object;
    2) a TModbusTCPDriver object, with CommunicationPort property pointing to your TTCP_UDPPort object;
    3) one TPLCTagNumber for each variable that you want to read, with property ProtocoloDriver pointing to the TModbusTCPDriver object. To read the Holding Registers area, you should change the properties MemReadFuncion to 3, MemWriteFunction to 16 and MemAddress to YourRegisterAddress - 40001.

    You can take a look into this example:

    https://sourceforge.net/p/pascalscada/code/HEAD/tree/trunk/examples/both_modbus_rtu_corn_weigh/

    I don't know whats your PascalSCADA version, but try activate your TTCP_UDPPort on the OnCreate event of your form, because some versions has a bug handling Active=true on design time.

    I'm waiting your feedback...

    The best regards,

    Fabio

     
  • Robin Holum

    Robin Holum - 2017-03-08

    Hi again Fabio.

    I tried the above. But when i run the form is blank.
    Any suggestions?

    Best regards
    Robin

    I managed to figure it out. It was the port and the offset :)

     

    Last edit: Robin Holum 2017-03-08
  • Fabio Luis Girardi

    Hi Robin!

    If you are following my instructions that I posted 2016-10-21, you only added the data components (Tag and protocol drivers), and you should add a display control, like a THMILabel, to show the value of your tag.

    Please add a THMILabel into your form and link the property PLCTag of these label with the tag created on step 3 of the previous instructions.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.