New logo site2 3

Communication c# application with Siemens S7-300 PLC (Libnodave library)

# 28/11/2015 à 09:24 azaiez01

I am looking for any sample program. Communication PLC S7-300 to PC with libnodave and C#.
Can you help me please ?

# 29/11/2015 à 03:33 (site web)

here a part of code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AutomationSenseSpace
class SiemensPLC
public static libnodave.daveOSserialType fds; //declaration connection type
public static libnodave.daveInterface di; //declaration of connection interface
public static libnodave.daveConnection dc; //declaration of connection
public static int res; // déclaration of res value for fonction return
public static byte plcValue; //declaration of plcValue to Read from PLC it's a byte in this case
public static int memoryRes; //declaratiob of memoryRes memoryRes for ReadBytes function return
public static byte[] memoryBuffer = new byte[10]; //declaration of an byte array with 10 bytes value

// Let's code the connect function

public static void connectTo()

fds.rfd = libnodave.openSocket(102, ""); //connect to PLC with IP address
fds.wfd = fds.rfd;
di = new libnodave.daveInterface(fds, "IF1", 0, libnodave.daveProtoISOTCP, libnodave.daveSpeed187k);
res = di.initAdapter();
dc = new libnodave.daveConnection(di, 0, 0, 2);
res = dc.connectPLC();
memoryRes = dc.readBytes(libnodave.daveFlags, 0, 0, 1, memoryBuffer); //read a buffer of 1 byte and put it on memoryBuffer variable
plcValue = memoryBuffer[0]; //put memoryBuffer byte value on plcValue variable
dc.disconnectPLC(); // disconnect PLC
di.disconnectAdapter(); //disconnect Adapter
libnodave.closePort(fds.rfd); // close connection



# 25/04/2016 à 03:18 VILSON ARANTES

Hello Friend,

congratulations for your site, very good.

you could help me

I'm trying to make communication with plc but I am not getting

when I try to read the PLCSIM the program becomes unresponsive.


Project link

thank you so much

# 25/04/2016 à 11:36 yassine12

I am looking for any sample program. Communication micro -850 Rockwell to PC with libnodave and C#.
Can you help me please ?

# 25/04/2016 à 15:35 (site web)

Hello Vilson Arantes,

That's normal your application freeze when you run it because you must put the library named libnodave.dll into the bin folder like this picture


# 25/04/2016 à 15:37 (site web)

Hello Yassine12,
Libnodave library is only for Siemens PLC.You must use DF1 library for Allen Bradley PLC

# 29/04/2016 à 17:14 Michal


I would like to watch your movie through the Youtube but it isn't possible to watch because into movie is used music which is forbid in my country. Is it possible to download this movie through the another web system? The name of movie is Libnodave library tutorial with C# (Siemens PLC) -> the published 16.7.2015.
Thank you for your answer and have a nice day.

Greeting Michal.

Best Regards

Ing. Michal Hrkeľ, PhD.

HYDAC Electronic s.r.o.
Krásna Hôrka 290
SK-027 44 Tvrdošín
Fon: +421 435831990
Fax: +421 435831915

Geschäftsführer: Dr. Franz Josef Eckle; Dipl. Ing. Jozef Líška
Registergericht: Žilina
Handelsregister: Sro, 13116/L

# 29/04/2016 à 17:16 Alexander


can you please sent me the vb project /source code for the libnodave
library to communicate with the Siemens PLC.

Thank you for your help.

Best regards
Alexander Sauer

# 01/06/2016 à 10:05 Ndzalie

Good day,

I did everything right as the video instructed but i get 0 even if i keep on changing the values from the simulator. Please help.

Thanks in advance.

# 21/10/2016 à 05:56 TextSa (site web)

I can not add libnodave.dll . Please can you help me ?

# 29/12/2016 à 07:54 Matt

Hello, is that code will work on Siemens LOGO 8?

# 29/12/2016 à 17:11 automationsense

Hello,nop this code not work with Logo 8.You must do some changes (e.g : plc slot and rack).You should read Libnodave manual for more informations.


" Travailles pour tes propres rêves sinon quelqu'un d'autres t'embauchera pour réaliser les siens "

Répondre à ce message

                     S'inscrire à la formation TIA Portal WINCC

Tablette pc siemens