Giter Site home page Giter Site logo

dfins's Introduction

dfins

This is an implementation of the OMRON FINS protocol using D.

Usage

The examples sub directory contains examples explaining how use this library.

Import the module:

import dfins;

Create an udp channel:

enum TIMEOUT_MS = 2000;
IChannel chan = createUdpChannel("192.168.221.22", TIMEOUT_MS);

Create a FinsClient object and pass it:

  • channel
  • header
Header h = header(22);
FinsClient f = new FinsClient(chan, h);

Finally read and write:

/* Reads 10 registers starting from register 00000 in the DM Memory Area */
ubyte[] d0 = f.readArea(MemoryArea.DM, 0, 10);

/* Writes the values 42, 19, 64 into DM registers 0, 1, 2 */
ushort[] v = [42, 19, 64];
f.writeArea(MemoryArea.DM, 0, v.toBytes!ushort);

Documentation

dfins uses ddoc. One way of building and serving the documentation locally (you will need libevent for serving) is:

dub build -b ddox && dub run -b ddox

Or use your favorite DDOC compiler.

Omron PLC data example

Data type Value FINS rep. Std rep.
float 3.14 0xF5C34048 0x4048F5C3
string 'abcdefghi' 0x4241444346454847049 0x4041424344454547484900
uint (32bit) 0x0a0b0c0d 0x0c0d0a0b 0x0a0b0c0d
float string uint
Value 3.14 'abcdefghi' 0x0a0b0c0d
FINS rep. 0xF5C34048 0x4241444346454847049 0x0c0d0a0b
Std rep. 0x4048F5C3 0x4041424344454547484900 0x0a0b0c0d

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.