Hello,
in my project I want to write Data from a MSSQL Database in one DB of S7-PLC.
Can I write all 11 Arrays of Data in the DB in one turn, or only one?
How can I Adress all Variables at once?
Thanks for your help.
Hello,
in my project I want to write Data from a MSSQL Database in one DB of S7-PLC.
Can I write all 11 Arrays of Data in the DB in one turn, or only one?
Or is it better to use the S7-knode?
I don't know about the node-red-contrib-s7comm
, but with node-red-contrib-s7
you can use the s7 out
node and send an array of values to be written on msg.payload
, with the names of the variables being an array of their names on msg.variables
.
Here's a sample flow as an example
[{"id":"4dd0a4a3.141a9c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d0365f50.6cdef","type":"s7 out","z":"4dd0a4a3.141a9c","endpoint":"f93ce6f4.8dccc8","variable":"","name":"","x":700,"y":360,"wires":[]},{"id":"146aaa14.0e6926","type":"s7 in","z":"4dd0a4a3.141a9c","endpoint":"f93ce6f4.8dccc8","mode":"all","variable":"","diff":true,"name":"","x":240,"y":100,"wires":[["916db5ae.0434c8"]]},{"id":"916db5ae.0434c8","type":"debug","z":"4dd0a4a3.141a9c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":670,"y":100,"wires":[]},{"id":"2bd16383.d74d9c","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"B0","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":240,"wires":[["43867ead.fea44"]]},{"id":"addcbd04.431fb","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"B0","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":200,"wires":[["43867ead.fea44"]]},{"id":"6f576722.7ac128","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"B1","payload":"15","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":320,"wires":[["43867ead.fea44"]]},{"id":"1ef8cc84.dca1e3","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"B1","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":280,"wires":[["43867ead.fea44"]]},{"id":"43867ead.fea44","type":"change","z":"4dd0a4a3.141a9c","name":"","rules":[{"t":"set","p":"variable","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["d0365f50.6cdef"]]},{"id":"43dd1926.af3a18","type":"change","z":"4dd0a4a3.141a9c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[payload, payload, payload, payload]","tot":"jsonata"},{"t":"set","p":"variable","pt":"msg","to":"[\"B0\", \"B1\", \"B2\", \"B3\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":460,"wires":[["d0365f50.6cdef"]]},{"id":"c9136c43.260c2","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":420,"wires":[["43dd1926.af3a18"]]},{"id":"7fb7169c.d904b8","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"","payload":"2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":460,"wires":[["43dd1926.af3a18"]]},{"id":"7d76a8c3.d9ab88","type":"inject","z":"4dd0a4a3.141a9c","name":"","topic":"","payload":"4","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":500,"wires":[["43dd1926.af3a18"]]},{"id":"f93ce6f4.8dccc8","type":"s7 endpoint","z":"","address":"192.168.15.211","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","cycletime":"500","timeout":"1500","verbose":"default","name":"TestPLC","vartable":[{"addr":"DB2,B0","name":"B0"},{"addr":"DB2,B1","name":"B1"},{"addr":"DB2,B2","name":"B2"},{"addr":"DB2,B3","name":"B3"}]}]