Skip to content

o3o/dinodave

Repository files navigation

dinodave

Build Status Dub version Dub download Status

A simple D binding to LIBNODAVE, a free library to communicate to Siemens S7 PLCs

Note that project's development happens on the GitLab. GitHub repository is a mirror, it might not always be up-to-date.

Compiling

With dub:

$ dub build

with make (linux):

$ make

(win32)

$ make -f makefile.win32

On Win32 see also wiki.

Testing

With dub:

$ dub test

with make (only for linux):

$ make test

Example usage

import std.stdio;
import dinodave;

void main(string[] args) {
   enum string IP = "192.168.221.102";
   enum DB = 11;
   try {
      auto s7 = new IsoTcp(IP);
      s7.openConnection(0);
      scope(exit) s7.closeConnection();

      int start = 160;
      int length = 2;
      s7.readBytes(DB, start, length);

      int a = s7.getU16();
      writeln("db11.160: ", a);

   } catch(Exception e) {
      writeln(e);
   }
}

See also directory examples/ and wiki.

Install libnodave

$ git clone git@github.com:netdata/libnodave.git
$ cd libnodave
$ make
$ sudo make install

or use install-libnodave.sh