OMRON FINS Reading REAL & STRING Data Types

Hi there,

Just wanted to know how I can read STRING and REAL data types via FINS.

INT and BOOL are working fine.

Do I need to parser it? Does somebody have got some example nodes?

Best thanks in advance

Andy

From the documentation here: node-red-contrib-omron-fins (node) - Node-RED

Example flows have been included to help you get started. In the node-red editor, click the hamburger menu, select import then examples (or press ctrl+i)

In the readme that @HaroldPetersInskipp linked to mentions a helper node "buffer parser" that is like a sister node for all this.

If you want technical reasons - FINS protocol only does bits and WORDS so something has to parse the data & as I wrote in the readme...

Data formats and conversion

As I use multiple PLCs and didn't want to write boolean / 32bit / float / double functionality into each node (it's best to keep things atomic and good at what they do) so I wrote a separate second node for handling data conversions.

This node "node-red-contrib-buffer-parser" node-red-contrib-buffer-parser (node) - Node-RED is capable of pretty much anything you will need for this or any PLC that returns 16bit data or a NodeJS Buffer.

Hi Guys,

many thanks for this information.

I will launch some test :slight_smile:

Best greetings,

Andy

Hi there,

I had success with getting the data of my CJ2M Reals and Strings :slight_smile:

Another problem .. I would like to host the data in one MSSQL DB but always getting syntax error ...

Do you have some advices?

I am just sharing my node with you:

[
    {
        "id": "ec9cf53f5ff54f3b",
        "type": "tab",
        "label": "FINS to MS SQL",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "0d29b076a5b30a0f",
        "type": "inject",
        "z": "ec9cf53f5ff54f3b",
        "name": "Query FINS to CJ2M",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 270,
        "y": 390,
        "wires": [
            [
                "4f1161ae4a5f53c5"
            ]
        ]
    },
    {
        "id": "4f1161ae4a5f53c5",
        "type": "FINS Read",
        "z": "ec9cf53f5ff54f3b",
        "name": "Read 8 Words from CJ2M PLC",
        "connection": "cb0566115f7073ac",
        "addressType": "str",
        "address": "D0",
        "countType": "num",
        "count": "8",
        "msgPropertyType": "msg",
        "msgProperty": "payload_to_Buffer",
        "outputFormatType": "buffer",
        "outputFormat": "",
        "x": 520,
        "y": 390,
        "wires": [
            [
                "44daa4972f363279"
            ]
        ]
    },
    {
        "id": "e1dc3da53a8c42d6",
        "type": "debug",
        "z": "ec9cf53f5ff54f3b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1030,
        "y": 420,
        "wires": []
    },
    {
        "id": "bde6896c9aa88707",
        "type": "MSSQL",
        "z": "ec9cf53f5ff54f3b",
        "mssqlCN": "a05e2c4980b5eb14",
        "name": "Insert Into Query",
        "query": "DECLARE @Bool_Test bit\nDECLARE @Int_Test int\nDECLARE @Real_Test real\nDECLARE @String_Test varchar(11)\n\nSET @Bool_Test = {{{payload.Bool_T[0]}}};\nSET @Int_Test = {{{payload.Int_T}}};\nSET @Real_Test = {{{payload.Real_T}}};\nSET @String_Test = {{{payload.String_T}}};\n\nINSERT INTO CJ2M_NodeRed\n\n        (\n            CurrentTime,    \n            Bool_Test,\n            Int_Test,\n            Real_Test,\n            String_Test\n        )\n        \n        VALUES \n        \n        (\n            CURRENT_TIMESTAMP,\n            @Bool_Test,\n            @Int_Test,\n            @Real_Test,\n            @String_Test\n        )",
        "outField": "payload",
        "x": 1050,
        "y": 345,
        "wires": [
            []
        ]
    },
    {
        "id": "44daa4972f363279",
        "type": "buffer-parser",
        "z": "ec9cf53f5ff54f3b",
        "name": "buffer to key/value object",
        "data": "payload_to_Buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "bool",
                "name": "Bool_T",
                "offset": 1,
                "length": 16,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "int16be",
                "name": "Int_T",
                "offset": 2,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "floatbe",
                "name": "Real_T",
                "offset": 6,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "string",
                "name": "String_T",
                "offset": 8,
                "length": 10,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "output",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": false,
        "outputs": 1,
        "x": 785,
        "y": 390,
        "wires": [
            [
                "e1dc3da53a8c42d6",
                "bde6896c9aa88707"
            ]
        ]
    },
    {
        "id": "cb0566115f7073ac",
        "type": "FINS Connection",
        "name": "CJ2M",
        "host": "192.168.1.201",
        "port": "9600",
        "MODE": "",
        "MODEType": "CJ",
        "protocol": "",
        "protocolType": "tcp",
        "ICF": "0x80",
        "DNA": "",
        "DA1": "201",
        "DA2": "",
        "SNA": "",
        "SA1": "179",
        "SA2": "",
        "autoConnect": true
    },
    {
        "id": "a05e2c4980b5eb14",
        "type": "MSSQL-CN",
        "name": "MS SQL Server",
        "server": "localhost",
        "encyption": true,
        "database": "NX102_DB"
    }
]

Many thanks,

Andy

screen_MSSQL
screen_MSSQL_debug

Change your query to use parameters.

Hi there,

many thanks it does work :slight_smile:

Best greetings,

Andy