Recent

Author Topic: ModBus with lazarus  (Read 10504 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
ModBus with lazarus
« on: May 17, 2018, 10:59:07 am »
Hi guys, I need advice. I have to make a commercial product that uses the modbus protocol. I saw that mbutils and pascalSCADA exist. The first I tried to download it and seemed abandoned (over all the name identifies a beta version). The second seems better but less specific. I have to use only the modbus. What do you recommend?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: ModBus with lazarus
« Reply #1 on: May 17, 2018, 11:08:39 am »
My advice is pascalscada I am still using for my few projects.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: ModBus with lazarus
« Reply #2 on: May 17, 2018, 11:42:30 am »
Thanks. Are there any small examples to understand how to use modbus with lazarus and pascalSCADA?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: ModBus with lazarus
« Reply #3 on: May 17, 2018, 01:13:21 pm »
Ok.

My project created on windows 7 but pascal scada can be work on linux too.

You need a modbus device on my project my modbus device was modsim software.

I contact two software by com0com project.

So if you look at project you will see a com port connector, a modbus protocol component, a tag number component and a modbus block component.

But you have to connect this components with by a tag bit for bit states and a blockelement for analog values.

Also Analog values can be scale 0..100 like as. I used linearscale componet.

So modsim running on COM7 and my project running COM6 and checked com port component as active

Thats all.

Note: I can't add whole pictures in one message but you can solve.
« Last Edit: May 17, 2018, 01:16:21 pm by tr_escape »

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: ModBus with lazarus
« Reply #4 on: May 17, 2018, 01:15:05 pm »
For other pics

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: ModBus with lazarus
« Reply #5 on: May 17, 2018, 07:32:24 pm »
Do you need a modbus master or slave ? Serial modbus or modbus over IP ?

Andreas
regards
Andreas

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: ModBus with lazarus
« Reply #6 on: May 17, 2018, 11:57:34 pm »
I am currently picking away at an HMI interface that will have the Modbus Serial/Ethernet server built in and it will
support ASC/RTU.

 Other servers I may make it to connect with OPC drivers.

 But currently I am working on a common access point for the HMI port that will see these different types of
drivers/hardward interfaces as transparent so it'll be easy to simply add a new data link without touching the HMI code.

The only true wisdom is knowing you know nothing

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: ModBus with lazarus
« Reply #7 on: May 18, 2018, 08:28:35 am »
I am currently picking away at an HMI interface that will have the Modbus Serial/Ethernet server built in and it will
support ASC/RTU.

 Other servers I may make it to connect with OPC drivers.

 But currently I am working on a common access point for the HMI port that will see these different types of
drivers/hardward interfaces as transparent so it'll be easy to simply add a new data link without touching the HMI code.

Some of HMI/Operator Panel devices allows create your own scripts, I used once Delta HMI it has got scripts but ofcourse not working as OOP or pascal style.


avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: ModBus with lazarus
« Reply #8 on: January 22, 2019, 12:54:44 am »
I have to use only the modbus. What do you recommend?
This one has both master and slave (MODBUS TCP only) and has a Lazarus package:
https://github.com/coassoftwaresystems/delphi-modbus
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: ModBus with lazarus
« Reply #9 on: January 22, 2019, 12:58:31 am »
Other servers I may make it to connect with OPC drivers.
Latest Kassl dOPC client works with Lazarus and supports OPC UA (!!!), XML, DA, AE and HDA:
https://www.kassl.de/opc/delphi.shtml
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: ModBus with lazarus
« Reply #10 on: January 22, 2019, 06:27:39 am »
I have to use only the modbus. What do you recommend?
This one has both master and slave (MODBUS TCP only) and has a Lazarus package:
https://github.com/coassoftwaresystems/delphi-modbus
It is running well with Lazarus and on RasPi. Master and Slave are smooth working, but you have to dig into the managment of the buffer and to undersstand, how modbus is working and what parts of data are transfered.
The component itself use Indy(10) this was for me in the past more an issue, in the meantime indy is available in OPM.
regards
Andreas

 

TinyPortal © 2005-2018