Hi all,
I am trying to send 1 string variable to an omron "CP1L" PLC
My goal in this test is to send 8 characters: "abcdefghij" to the 5 memory channels D2110...D2114
2 characters on each channel
However, I only manage to send one character to each channel.
In this way the string does not look good. 10 channels instead of 5.
I am doing something wrong. I hope you can help me.
Thanks in advance
Json Code:
[
{
"id": "8cee613acd48c93d",
"type": "tab",
"label": "string to PLC",
"disabled": false,
"info": "",
"env": []
},
{
"id": "655187c5c69cb47d",
"type": "buffer-parser",
"z": "8cee613acd48c93d",
"name": "",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "byte",
"name": "item1",
"offset": 0,
"length": 10,
"offsetbit": 0,
"scale": "1",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "str",
"resultType": "value",
"resultTypeType": "output",
"multipleResult": true,
"fanOutMultipleResult": false,
"setTopic": true,
"outputs": 1,
"x": 1190,
"y": 340,
"wires": [
[
"d6e72b2886026920",
"137fcbce36ef6b68"
]
]
},
{
"id": "d6e72b2886026920",
"type": "debug",
"z": "8cee613acd48c93d",
"name": "to byte Array",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1250,
"y": 400,
"wires": []
},
{
"id": "9a9cacb1ecfa0e66",
"type": "inject",
"z": "8cee613acd48c93d",
"name": "abcdefghij",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "7",
"topic": "",
"payload": "abcdefghij",
"payloadType": "str",
"x": 760,
"y": 340,
"wires": [
[
"c17a9f731cc5d8f4",
"265ce15741e2dcfa"
]
]
},
{
"id": "a92407da7bbb3f32",
"type": "debug",
"z": "8cee613acd48c93d",
"name": "as a buffer",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1010,
"y": 400,
"wires": []
},
{
"id": "c17a9f731cc5d8f4",
"type": "debug",
"z": "8cee613acd48c93d",
"name": "string data",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 790,
"y": 400,
"wires": []
},
{
"id": "7725cd9626bd2c49",
"type": "debug",
"z": "8cee613acd48c93d",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1630,
"y": 340,
"wires": []
},
{
"id": "137fcbce36ef6b68",
"type": "FINS Write",
"z": "8cee613acd48c93d",
"name": "",
"connection": "7e9569d1d6c8014c",
"addressType": "str",
"address": "D2110",
"dataType": "msg",
"data": "payload",
"msgPropertyType": "str",
"msgProperty": "payload",
"x": 1430,
"y": 340,
"wires": [
[
"7725cd9626bd2c49"
]
]
},
{
"id": "265ce15741e2dcfa",
"type": "function",
"z": "8cee613acd48c93d",
"name": "string to buffer",
"func": "var buf = Buffer(msg.payload); \nmsg.payload = buf;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 960,
"y": 340,
"wires": [
[
"655187c5c69cb47d",
"a92407da7bbb3f32"
]
]
},
{
"id": "7e9569d1d6c8014c",
"type": "FINS Connection",
"name": "CP1L Test",
"host": "192.168.3.10",
"port": "9600",
"MODE": "",
"MODEType": "CP",
"protocol": "",
"protocolType": "tcp",
"ICF": "128",
"DNA": "1",
"DA1": "10",
"DA2": "0",
"SNA": "",
"SA1": "99",
"SA2": "",
"autoConnect": true
}
]