Recent

Author Topic: Pasettimino - Ethernet communication library for S7 Siemens Simatic PLCs  (Read 6015 times)

avra

  • Hero Member
  • *****
  • Posts: 1378
    • Additional info
Pasettimino

Pasettimino is a very lite native Pascal ethernet communication library for S7 Siemens Simatic PLC. S7 200/300/400/400H/1200/1500 and LOGO 0BA7 PLC families are supported. You can read PLC info and status, start/stop PLC, read/write from/to any PLC area (full access to I, Q, M, DB, C and T), get a list of existing PLC blocks (OB, DB, SDB, FC, SFC, FB, SFB), read CPU product number and firmware revision, read leds, read/write PLC time, and get PLC battery status. It is a greatly extended FreePascal port of Arduino Settimino library with Lazarus examples, and besides Synapse for ethernet communication it does not have any other dependency (although example projects themselves need BitHelpers package). Pasettimino is running 24/7 in industrial environment since 2016. If you need more heavy weight S7 ethernet/serial libraries, S7 PLC protocol simulator or S7 rich graphical client then take a look at Snap7 and LibNoDave. They both have Pascal wrappers, but unlike Pasettimino their core is not native Pascal.


Info and Download

https://bitbucket.org/avra/pasettimino


License

Pasettimino is released under LGPLv3, the same as the original Settimino license, so commercial use is allowed (License explained in plain English).


Author

Made by Avra (Zeljko Avramovic). Big thanks go to Davide Nardella, the author of the original Settimino and Snap7 libraries.
« Last Edit: August 14, 2018, 10:44:52 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Full Member
  • ***
  • Posts: 172
Thanks for this great news :-)

A native pascal system is always better to understand and to fix :-)

regards
Andreas

avra

  • Hero Member
  • *****
  • Posts: 1378
    • Additional info
Thanks for this great news :-)
You are most welcome!

Quote
A native pascal system is always better to understand and to fix :-)
That was my main motivation. Original library had a bug where wrong running state was reported on redundant S7-400H PLCs. I have fixed it in Pasettimino and reported back to the author of the original Settimino library so he can fix it too. Understanding it more and more, I was also able to implement some quite unique features like getting status of all PLC leds (even on redundant CPU pairs) and getting status of power supply memory backup batteries.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

edwinyzh

  • New member
  • *
  • Posts: 32
@Avra, thank you very much!

Thaddy

  • Hero Member
  • *****
  • Posts: 7199
Looks very nice and tidy! Good job.
One remark:why synapse and not fcl-net?
You know I myself prefer synapse in most cases  :D, but from what I see in the code fcl-net is more than enough here and it is in the standard distribution.
So it removes a third-party dependency. Also: can the bit helpers be merged/patched into sysutils? The number of bit-tinkerers is fastly growing with so many people having at least one Raspberry Pi or the likes. And once they have that, half of them start using arduino's  :D 8-) O:-)
« Last Edit: August 18, 2018, 08:51:36 am by Thaddy »
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

avra

  • Hero Member
  • *****
  • Posts: 1378
    • Additional info
@Avra, thank you very much!
You are most welcome!
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 1378
    • Additional info
Looks very nice and tidy! Good job.
You are very kind!

why synapse and not fcl-net?
I use Synapse in applications running 24/7, and that's what I am used to. Besides, although I do not care much for Delphi compatibility any more, if someone makes Pasettimino Delphi compatible I would be glad to include the patch. I do not have anything against fcl-net. I just do not have any experience with it.

can the bit helpers be merged/patched into sysutils?
My end goal is to try to make BitHelpers part of FPC, which could probably have been guessed from it's license. I was thinking about simple unit donation, although sysutils idea also seams tempting. I wonder what would FPC developers say about it? I see less includes and out of the box experience as benefits doing it that way. Are there other benefits that I am missing? SysUtils is platform specific, so maintenance would require more effort even if BitHelpers would be split into interface and implementation include files, and there is no way I could test for all the platforms. Maybe there are some other drawbacks as well. Anyway, I do not have time to deal with that now so it will have be filed for a while.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Full Member
  • ***
  • Posts: 172
Re: Pasettimino - Ethernet communication library for S7 Siemens Simatic PLCs
« Reply #7 on: October 12, 2018, 07:24:38 am »
In s7pas the unit windows is used, so it is not compilable on linux (arm) :-(

Sometimes you use bool and sometimes boolean.  In windows bool is defined as winbool and winbool is longbool. Is there any reason not to use a compatible Boolean like WordBool, ByteBool or LongBool and remove the depency of windows. Problems with the windows copymemory too. A soloution is to use Move(<source>,<Destination>,<size>) witch is IMHO plattformindependent.

Andreas
 
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 7199
Re: Pasettimino - Ethernet communication library for S7 Siemens Simatic PLCs
« Reply #8 on: October 12, 2018, 09:10:16 am »
SysUtils is platform specific, so maintenance would require more effort even if BitHelpers
Well. No. sysutils is only partially platform specific. The type helpers are also implemented in a platform independent way.
(directory rtl/objpas would have told you it is not platform!). I think it could go in sysutils.
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

avra

  • Hero Member
  • *****
  • Posts: 1378
    • Additional info
Re: Pasettimino - Ethernet communication library for S7 Siemens Simatic PLCs
« Reply #9 on: October 12, 2018, 10:42:01 am »
In s7pas the unit windows is used, so it is not compilable on linux (arm) :-(
Thank you for the code review! I will put both linux and booleans usage on my TODO list and see what can be done when time comes (not quite soon since I am very busy these days).

I think it could go in sysutils.
You are right. After another look there seams to be a way to make BitHelpers part of FPC without platform specific maintenance mess, so I will probably go that way. Thanks for pointing this out one more time!
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib