Recent

Author Topic: Modbus on Raspberry Pi  (Read 11091 times)

jdp

  • Full Member
  • ***
  • Posts: 144
Modbus on Raspberry Pi
« on: November 02, 2019, 08:21:46 pm »
Hi.

What should I use to get Modbus Serial working on Raspberry Pi. I have it all working in Python but would like to get it working in Lazarus as well.

I tried to install Pascal Scada on the Pi but it wont compile as I am using to new FPC and Lazarus.

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: Modbus on Raspberry Pi
« Reply #1 on: November 03, 2019, 08:39:46 am »
Pascal Scada is working here on Win32/64, Raspian (as well Jessie,Buster), Debian -Linux 64,... out of the box. Sometimes there are issues with the trunk of fpc, because of changes in the fcl. I use actual fixes of fpc and fixes of Lazarus for production enviroment.

This version works too (need Indy) https://github.com/coassoftwaresystems/delphi-modbus - can master and slave, but is a little tricky to understand. On my git i have an older version frozen for my Lazarus/FPC version with a special version of Indy of mine.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Modbus on Raspberry Pi
« Reply #2 on: November 03, 2019, 08:49:49 am »
I tried to install Pascal Scada on the Pi but it wont compile as I am using to new FPC and Lazarus.
What does the compiler say? "won't compile" without any other information isn't helpful...

I suppose the bottlenecks are Bgracontrols and  Bgrabitmap, that currently do not compile for arm (fpc 3.2 and fpc trunk 43374 + ).
« Last Edit: November 03, 2019, 09:05:15 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Modbus on Raspberry Pi
« Reply #3 on: November 04, 2019, 07:46:01 am »
I tried to install Pascal Scada on the Pi but it wont compile as I am using to new FPC and Lazarus.
What does the compiler say? "won't compile" without any other information isn't helpful...

I suppose the bottlenecks are Bgracontrols and  Bgrabitmap, that currently do not compile for arm (fpc 3.2 and fpc trunk 43374 + ).

Yes, Thaddy you are correct. It does not compile when I try to install from the online lib manager and it breaks when it wants to install those components.
I did not add the errors for it as I asked what the best Modbus module is.  Is Pascal Scada the best Modbus library for Lazarus?

Regards.

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Modbus on Raspberry Pi
« Reply #4 on: November 04, 2019, 11:43:39 am »
Should I use a older version of Lazarus so Pascal Scada compiles? If so what version will work on the Raspberry Pi.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Modbus on Raspberry Pi
« Reply #5 on: November 04, 2019, 12:09:24 pm »
I don't know where it got broken for arm but it is quite some time ago - years -. Better to ask the maintainers of BGRA* to fix the regression than to install an old and un-maintained Lazarus....

Note it is possible to compile just the modbus units for console I believe, and those units all compile (but I did not test them). It is pure the BGRA libraries that fail.
« Last Edit: November 04, 2019, 12:13:38 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

jdp

  • Full Member
  • ***
  • Posts: 144
Re: Modbus on Raspberry Pi
« Reply #6 on: November 04, 2019, 12:39:29 pm »
Yes I only want the cli modbus parts anyway. What modules should I compile to get that working? Can you point me in a direction.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Modbus on Raspberry Pi
« Reply #7 on: November 05, 2019, 10:18:02 am »
It does not compile when I try to install from the online lib manager and it breaks when it wants to install those components.
Try to just download PascalSCADA and install packages manually with opening each package and deleting dependencies to BGRA packages. Then report if that helped.
http://www.pascalscada.com/how-install-pascalscada/
« Last Edit: November 05, 2019, 10:20:24 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Modbus on Raspberry Pi
« Reply #8 on: November 05, 2019, 10:40:36 am »
@Avra
Do you know a good emulator? (I know there is one from Siemens but that feels uncomfortable - and is not free!)
Your answer was basically what I did, and factored out some code from the GUI: PascalScada is a bit of a mess in the sense that it has no good separation between functionality and user interface.
It would be great if we had something like that for our Raspberry Pi's
« Last Edit: November 05, 2019, 10:46:10 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Modbus on Raspberry Pi
« Reply #9 on: November 05, 2019, 11:26:40 am »
There some instructions by qemu on windows like as below link but not tested:

https://projects-raspberry.com/simulation-raspberry-pi-emulator-for-windows-10-using-qemu/

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Modbus on Raspberry Pi
« Reply #10 on: November 05, 2019, 11:31:02 am »
There some instructions by qemu on windows like as below link but not tested:

https://projects-raspberry.com/simulation-raspberry-pi-emulator-for-windows-10-using-qemu/
No, I mean a simulator for hardware. Not the OS. Avra knows what I mean.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Modbus on Raspberry Pi
« Reply #11 on: November 05, 2019, 11:56:14 am »
Ok.

As I know only modbus simulator for windows that name is modrsim2

https://sourceforge.net/projects/modrssim2/


Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Modbus on Raspberry Pi
« Reply #12 on: November 05, 2019, 12:32:46 pm »
Yes, something like that (at first glance) tnx!
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: Modbus on Raspberry Pi
« Reply #13 on: November 05, 2019, 01:24:30 pm »
Yes, something like that (at first glance) tnx!

Also if your OS is windows you can create a virtual com port by com0com project http://com0com.sourceforge.net/

Create two virtual com port as figured this link https://mehmetulukaya.files.wordpress.com/2016/12/com0com.png

Set your modrsim2 com port to the one of virtual com and connect by pascalscada (or whatever your software) to other virtual com port (com15 for modrsim2 and com16 for your software).

com0com will be create a pipe between two software like as nearly real com port.


mig-31

  • Sr. Member
  • ****
  • Posts: 305
Re: Modbus on Raspberry Pi
« Reply #14 on: November 05, 2019, 01:38:35 pm »
PascalScada consist of  5 packages (lpk files). I have not tested the newest version. In version 7.3 only pascalscada-HMI depends on BRGABitmap. For ModBus TCP or RTU(RS-232) only pascalscada and  pascalscada-common are needed. I did this a year ago and it worked. I had same problem with BRGABitmap and PascalScada on CentOS 7 x86-64.
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

 

TinyPortal © 2005-2018