Recent

Author Topic: New 32/64 bit S7 communication library  (Read 42095 times)

davenardella

  • New member
  • *
  • Posts: 8
Re: New 32/64 bit S7 communication library
« Reply #15 on: April 01, 2014, 10:08:34 am »
Hi Guys, Snap7 is neat work for sure.
I have a S7 1200 and i am trying to pull some DB out of it using c# VS2010 Express 32bit but the simplest project is throwing exception about platform. tried to run the dotnet.bat but of no use. can anybody help ??

Sorry for the delay..
Please send me an email (use the address in the snap7 site) with a detailed description, unluckily in spite of its apparent simplicity Net environment is not so user friendly with various platforms (like Lazarus  :D).
I'ts a config problem...

@dorry
Sorry but wince is not natively supported. However Snap7 needs only socket and thread layer, if you want to try a port I could help you with some suggestions.

Davide

Hannes Kuhn

  • Newbie
  • Posts: 2
Re: New 32/64 bit S7 communication library
« Reply #16 on: April 09, 2014, 09:25:40 pm »
Hello davenardella,

thank you for this nice library.

My Lazarus program reads every 1500 ms data from several DB's on a S7-1200 (in client-mode). It takes around 50 msec.
Up to here everything works fine.

But now a user can press a button and write data back to the S7-1200:

  ErrorCode:= FMyClient.DBWrite(DBNrIN,       // DB Number
                                i,                  // Start from
                                Length(TwoBytes),   // How many
                                @TwoBytes);         // Target address

Normally it works fine. But here and there data are not written to the PLC (always ErrorCode = 0).

Do I have to live with this behavior ?

Thank you for your help.
Hannes   




avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: New 32/64 bit S7 communication library
« Reply #17 on: April 10, 2014, 08:41:26 am »
But now a user can press a button and write data back to the S7-1200:
...
Normally it works fine. But here and there data are not written to the PLC (always ErrorCode = 0).
Maybe data writing is messed when a user pushes button and at the same time your timer tries to read data? If that is the case then you can try to solve it in different ways by serializing reading and writing. Like adding data write request to some list, and then sending everything from this list at the start of the timer and then execute data read requests. Or you could hold reading while writing is in progress and vice versa, or...

If you are using more then one S7/PG connection (like creating new connection for each data write packet), then you should change that and use only one S7/PG connection for all communication. The reason for this is that number of S7/PG connections is limited and must be reserved in advance, so if you don't have any available your connection will be refused. Depending on your ethernet card model you should be able to parametrize this setting and increase reserved number of S7, PG or OP connections.

Btw1: Are you aware of PascalSCADA (http://www.pascalscada.com)?

Btw2: Polling period of 1500 ms is good if you have only one polling tags group in your SCADA application. If you have many groups (for example 1st at 1500ms, 2nd at 500ms, 3rd at 1000ms), then you could use prime numbers to prevent all of them constantly trying to communicate with PLC at the same time and avoid congestion. In such a case setting polling periods to near by prime numbers would have a consequence of much more PLC communication friendly polling distribution. For example 1511ms, 503ms and 997ms. In first poll after SCADA is started all 3 groups will try to communicate at the same time, but it will take more then 8 days until that happens again!
http://www.mathsisfun.com/numbers/prime-numbers-to-10k.html
« Last Edit: April 10, 2014, 09:21:35 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Vbxler

  • Newbie
  • Posts: 3
Re: New 32/64 bit S7 communication library
« Reply #18 on: August 19, 2014, 07:45:52 pm »
Hallo Mr. Nardella,

many thanks for your great library Snap7!

I have successfully made the first tests under Windows with Lazarus,
but I have problems on my BeagleBone Black with Lazarus and the same source.
I can compile the project successfully, but the debugger crashes at startup of the program.

I tried it with libsnap7.so (17.4.2014) from Raspberry and UDOO, without success.
Is it possible that these files are not suitable for BEAGLEBONE Black?

Thank you for your help,

davenardella

  • New member
  • *
  • Posts: 8
Re: New 32/64 bit S7 communication library
« Reply #19 on: August 21, 2014, 09:22:38 am »
Hi Vbxler,
You cannot use Raspberry's library because Rpy is an ARM V6 but BB is ARM V7.
UDOO library "could" work but it depends on GLIBC of your distro.

Your way is to rebuild Snap7 under your distro, it's a very simple task  ;)
After deleting all libsnap7.so that you used for your test, open a terminal, go in /build/unix and type:

sudo make –f arm_v7_linux.mk install

that's all.

Snap7 runs fine in Beaglebone BLACK (tested under Angstrom 2013.05)

Let me know..

Davide

Vbxler

  • Newbie
  • Posts: 3
Re: New 32/64 bit S7 communication library
« Reply #20 on: August 21, 2014, 02:47:49 pm »
Mille grazie per il vostro aiuto! Funziona perfettamente!  :) :) :)

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: New 32/64 bit S7 communication library
« Reply #21 on: July 07, 2016, 11:23:08 am »
This is bug report. On S7 414H and 417H CPUs Snap7 lib for running CPUs gives a plc status as if they are in stop. This info is wrong. Server demo returns good status, but these CPUs give wrong status. Status for S7 317 is correctly reported. If you guide me I can provide any necessary troubleshooting steps.
« Last Edit: July 07, 2016, 12:11:41 pm by avra »
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: New 32/64 bit S7 communication library
« Reply #22 on: July 08, 2016, 10:07:57 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018