2021年10月23日 星期六

Node-Red ModBus RTU 控制4 Port Relay

Node-Red ModBus RTU  控制4 Port Relay

 RTU= COM8 , 9600,N,8,1









[{"id":"522d876e16cb1db1","type":"debug","z":"ddab17b2d505caf7","name":"received","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":420,"y":840,"wires":[]},{"id":"e3be284ca15809b3","type":"function","z":"ddab17b2d505caf7","name":"","func":"\nvar fc=msg.payload.fc;\nvar sa=msg.payload.sa;\nvar addresses=msg.payload.addresses;\nvar slave_ip=msg.payload.slave_ip;\nvar payload={ 'fc': fc, 'unitid': 1, 'address': sa , 'quantity': addresses };\nmsg.payload=JSON.stringify(payload);\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":540,"wires":[["328353582b6bfea3","40dc1a3d4bc82d0f"]]},{"id":"fa40ca3e4f265b23","type":"function","z":"ddab17b2d505caf7","name":"write mqtt","func":"var fc=msg.payload.fc;\nvar sa=msg.payload.sa;\nvar addresses=msg.payload.addresses;\nvar value=msg.payload.value;\nvar values=msg.payload.values;\nvar slave_ip=msg.payload.slave_ip;\nif (fc==16 || fc==15){\n     value=JSON.parse(msg.payload.values);\n    node.log(value);\n}\npayload={\"value\":value , 'fc': fc, 'unitid': 1, 'address': sa , 'quantity': addresses };\n\nmsg.payload=JSON.stringify(payload);\nreturn msg\n\n","outputs":1,"noerr":0,"x":580,"y":40,"wires":[["12a43c3cf3860912"]]},{"id":"40dc1a3d4bc82d0f","type":"debug","z":"ddab17b2d505caf7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":630,"y":500,"wires":[]},{"id":"b96fbc0dda434cac","type":"function","z":"ddab17b2d505caf7","name":"","func":"node.log(\"payload \"+msg.payload);\ndata=msg.payload[0]*65535 +msg.payload[1];\nnode.log(\"payload \"+data);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":580,"wires":[["40dc1a3d4bc82d0f"]]},{"id":"c9822f89346037ca","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=1;\nvar sa=0;\nvar addresses=8;\nvar slave_ip=\"COM8\";\nmsg.payload={value: msg.payload, 'fc': fc, 'unitid': 1, 'address': sa , 'quantity': addresses };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":540,"wires":[["e3be284ca15809b3"]]},{"id":"328353582b6bfea3","type":"mqtt out","z":"ddab17b2d505caf7","name":"","topic":"alex9ufo/modbus/commands/read","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2db287b.addf978","x":720,"y":540,"wires":[]},{"id":"f070bdbd9d66b8d1","type":"mqtt in","z":"ddab17b2d505caf7","name":"","topic":"alex9ufo/modbus/response/#","qos":"0","datatype":"json","broker":"2db287b.addf978","nl":false,"rap":false,"x":160,"y":740,"wires":[["bc4ab30e52072dff","cfbf871b2c6ef4bc","44360ac95b01c552"]]},{"id":"12a43c3cf3860912","type":"mqtt out","z":"ddab17b2d505caf7","name":"","topic":"alex9ufo/modbus/commands/write","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2db287b.addf978","x":820,"y":40,"wires":[]},{"id":"bc4ab30e52072dff","type":"switch","z":"ddab17b2d505caf7","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"alex9ufo/modbus/response/read","vt":"str"},{"t":"eq","v":"alex9ufo/modbus/response/write","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":720,"wires":[[],[]]},{"id":"279a5a1977924b9a","type":"ui_text","z":"ddab17b2d505caf7","group":"b1e93ddb.38aa38","order":3,"width":"0","height":"0","name":"","label":"Result Write","format":"{{msg.write}}","layout":"row-left","className":"","x":670,"y":740,"wires":[]},{"id":"ee4eccb3ef44e3e8","type":"mqtt in","z":"ddab17b2d505caf7","name":"","topic":"alex9ufo/modbus/commands/read","qos":"0","datatype":"json","broker":"2db287b.addf978","nl":false,"rap":false,"x":180,"y":800,"wires":[["522d876e16cb1db1","a516ad9fcbcfdf64"]]},{"id":"c1d2bf83a5ea2027","type":"mqtt out","z":"ddab17b2d505caf7","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2db287b.addf978","x":790,"y":860,"wires":[]},{"id":"a516ad9fcbcfdf64","type":"modbus-flex-getter","z":"ddab17b2d505caf7","name":"local getter","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"54dde46e.53267c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":430,"y":800,"wires":[[],["87948de507654efc","52947ea28ed3666c"]]},{"id":"87948de507654efc","type":"debug","z":"ddab17b2d505caf7","name":"out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":780,"wires":[]},{"id":"cfbf871b2c6ef4bc","type":"debug","z":"ddab17b2d505caf7","name":"received","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":380,"y":680,"wires":[]},{"id":"44360ac95b01c552","type":"function","z":"ddab17b2d505caf7","name":"received function","func":"var topic=msg.topic;\nif(topic==\"alex9ufo/modbus/response/read\")\nmsg.read=msg.payload.data;\nelse\nmsg.write=msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":760,"wires":[["279a5a1977924b9a","d098fefd943a6a93","7a32845ec3e1b5a7"]]},{"id":"46aff3a2b52790a1","type":"mqtt in","z":"ddab17b2d505caf7","name":"","topic":"alex9ufo/modbus/commands/write","qos":"0","datatype":"json","broker":"2db287b.addf978","nl":false,"rap":false,"x":180,"y":880,"wires":[["522d876e16cb1db1","1536012b0abbcdbc"]]},{"id":"1536012b0abbcdbc","type":"modbus-flex-write","z":"ddab17b2d505caf7","name":"","showStatusActivities":false,"showErrors":false,"server":"54dde46e.53267c","emptyMsgOnFail":false,"keepMsgProperties":false,"x":450,"y":880,"wires":[[],["06fdabc749a20ee4"]]},{"id":"52947ea28ed3666c","type":"change","z":"ddab17b2d505caf7","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"alex9ufo/modbus/response/read","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":820,"wires":[["c1d2bf83a5ea2027"]]},{"id":"06fdabc749a20ee4","type":"change","z":"ddab17b2d505caf7","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"alex9ufo/modbus/response/write","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":880,"wires":[["c1d2bf83a5ea2027"]]},{"id":"d098fefd943a6a93","type":"ui_text","z":"ddab17b2d505caf7","group":"f9918dcb.b9e1f8","order":3,"width":"0","height":"0","name":"","label":"Result read","format":"{{msg.read}}","layout":"row-left","className":"","x":670,"y":700,"wires":[]},{"id":"1b40a644c8dfb136","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":40,"wires":[["234fd4d3f13abb5a"]]},{"id":"234fd4d3f13abb5a","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=0;\nvar addresses=1;\nvar value=1;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":40,"wires":[["fa40ca3e4f265b23"]]},{"id":"711ddc54b126d9d5","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":120,"wires":[["82c0f8960c6ae8a6"]]},{"id":"82c0f8960c6ae8a6","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=0;\nvar addresses=1;\nvar value=0;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":120,"wires":[["fa40ca3e4f265b23"]]},{"id":"214586dfd0d2cd59","type":"inject","z":"ddab17b2d505caf7","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":540,"wires":[["c9822f89346037ca"]]},{"id":"6dadb6cb866d0848","type":"inject","z":"ddab17b2d505caf7","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":620,"wires":[["b1ca054523b7657b"]]},{"id":"b1ca054523b7657b","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=2;\nvar sa=0;\nvar addresses=8;\nvar slave_ip=\"COM8\";\nmsg.payload={value: msg.payload, 'fc': fc, 'unitid': 1, 'address': sa , 'quantity': addresses };\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":620,"wires":[["e3be284ca15809b3"]]},{"id":"7ebc3122a2e587e4","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"ba9061f811e2071a","order":2,"width":0,"height":0,"passthru":false,"label":"Read Coil Status FC=01","tooltip":"","color":"","bgcolor":"blue","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":580,"wires":[["c9822f89346037ca"]]},{"id":"2db0742a020cce68","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"ba9061f811e2071a","order":2,"width":0,"height":0,"passthru":false,"label":"Read Input Status FC=02","tooltip":"","color":"red","bgcolor":"yellow","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":660,"wires":[["b1ca054523b7657b"]]},{"id":"7a32845ec3e1b5a7","type":"debug","z":"ddab17b2d505caf7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":660,"wires":[]},{"id":"7d5f063f1541cecc","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 0 =  ON FC=05","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":80,"wires":[["234fd4d3f13abb5a"]]},{"id":"67a03583b490f4ec","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 0 =  OFF FC=05","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":160,"wires":[["82c0f8960c6ae8a6"]]},{"id":"96f2d165f70bc251","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":200,"wires":[["c13452b57e09cb5e"]]},{"id":"c13452b57e09cb5e","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=1;\nvar addresses=1;\nvar value=1;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":200,"wires":[["fa40ca3e4f265b23"]]},{"id":"4ab7a78d547cc3e5","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":280,"wires":[["ca22a2278c951dcd"]]},{"id":"ca22a2278c951dcd","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=1;\nvar addresses=1;\nvar value=0;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":280,"wires":[["fa40ca3e4f265b23"]]},{"id":"e9ae93ae872a4141","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 1 =  ON FC=05","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":240,"wires":[["c13452b57e09cb5e"]]},{"id":"0a986731020f3c10","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 1 =  OFF FC=05","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":320,"wires":[["ca22a2278c951dcd"]]},{"id":"ba1fc1fba77d452d","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":550,"y":100,"wires":[["1c491c2b9475f811"]]},{"id":"1c491c2b9475f811","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=2;\nvar addresses=1;\nvar value=1;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":100,"wires":[["f2092557033e6b80"]]},{"id":"6fd452c0e7b826af","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":550,"y":180,"wires":[["323c28da879c3e94"]]},{"id":"323c28da879c3e94","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=2;\nvar addresses=1;\nvar value=0;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":180,"wires":[["f2092557033e6b80"]]},{"id":"4619cbf0f7895cb4","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 2 =  ON FC=05","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":590,"y":140,"wires":[["1c491c2b9475f811"]]},{"id":"d1cad4d6061c7973","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 2 =  OFF FC=05","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":590,"y":220,"wires":[["323c28da879c3e94"]]},{"id":"f2092557033e6b80","type":"link out","z":"ddab17b2d505caf7","name":"","links":["ac39745ab2bd8afd"],"x":865,"y":160,"wires":[]},{"id":"ac39745ab2bd8afd","type":"link in","z":"ddab17b2d505caf7","name":"","links":["f2092557033e6b80","3ac44dbcff56f8af","fc17a171eea95aa4"],"x":425,"y":20,"wires":[["fa40ca3e4f265b23"]]},{"id":"fceecb28cbe9d5bf","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":550,"y":260,"wires":[["e99b87d788610ab5"]]},{"id":"e99b87d788610ab5","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=3;\nvar addresses=1;\nvar value=1;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":260,"wires":[["3ac44dbcff56f8af"]]},{"id":"5f6284521de62d8c","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":550,"y":340,"wires":[["72c7de2d37d1753f"]]},{"id":"72c7de2d37d1753f","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=5;\nvar slave_ip='COM8';\nvar sa=3;\nvar addresses=1;\nvar value=0;\nvar values=\"\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":340,"wires":[["3ac44dbcff56f8af"]]},{"id":"2f5f7cf2c42915bb","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 3 =  ON FC=05","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":590,"y":300,"wires":[["e99b87d788610ab5"]]},{"id":"e282aefc9253a124","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil 3 =  OFF FC=05","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":590,"y":380,"wires":[["72c7de2d37d1753f"]]},{"id":"3ac44dbcff56f8af","type":"link out","z":"ddab17b2d505caf7","name":"","links":["ac39745ab2bd8afd"],"x":865,"y":320,"wires":[]},{"id":"4f9418c86e96d1fb","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":360,"wires":[["7d3155c512d1c45e"]]},{"id":"7d3155c512d1c45e","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=15;\nvar slave_ip='COM8';\nvar sa=0;\nvar addresses=4;\nvar value=1;\nvar values=\"[1,1,1,1]\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":360,"wires":[["fc17a171eea95aa4"]]},{"id":"5871c029053b0c24","type":"inject","z":"ddab17b2d505caf7","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":440,"wires":[["d62735c700a9c01b"]]},{"id":"d62735c700a9c01b","type":"function","z":"ddab17b2d505caf7","name":"","func":"var fc=15;\nvar slave_ip='COM8';\nvar sa=0;\nvar addresses=4;\nvar value=0;\nvar values=\"[0,0,0,0]\";\n\n//msg.payload={value: msg.payload, 'fc': fc, 'slave_ip':slave_ip ,'unitid': 1, 'address': sa , 'quantity': addresses ,'value':value ,'values':values};\nmsg.payload={'fc': fc, 'slave_ip':slave_ip ,'sa': sa , 'addresses': addresses ,'value':value ,'values':values};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":440,"wires":[["fc17a171eea95aa4"]]},{"id":"ec453a7ed4fc05c4","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil  =  All ON FC=15","tooltip":"","color":"","bgcolor":"Maroon","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":400,"wires":[["7d3155c512d1c45e"]]},{"id":"d9e00d7aa725b4cd","type":"ui_button","z":"ddab17b2d505caf7","name":"","group":"771d9f65fda8ad9f","order":0,"width":0,"height":0,"passthru":false,"label":"Write  Coil  All OFF FC=15","tooltip":"","color":"","bgcolor":"Violet","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":480,"wires":[["d62735c700a9c01b"]]},{"id":"fc17a171eea95aa4","type":"link out","z":"ddab17b2d505caf7","name":"","links":["ac39745ab2bd8afd"],"x":405,"y":420,"wires":[]},{"id":"2db287b.addf978","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"/vm/mqtt/birth","birthQos":"0","birthPayload":"birth","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"b1e93ddb.38aa38","type":"ui_group","name":"Write","tab":"c6d493fc.df122","order":2,"disp":true,"width":"12","collapse":false,"className":""},{"id":"54dde46e.53267c","type":"modbus-client","name":"local","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":false,"tcpHost":"192.168.1.31","tcpPort":"502","tcpType":"TCP-RTU-BUFFERED","serialPort":"COM8","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":false,"reconnectTimeout":2000,"parallelUnitIdsAllowed":false},{"id":"f9918dcb.b9e1f8","type":"ui_group","name":"Read Result","tab":"c6d493fc.df122","order":3,"disp":true,"width":"12","collapse":false,"className":""},{"id":"ba9061f811e2071a","type":"ui_group","name":"ReadICON","tab":"c6d493fc.df122","order":5,"disp":true,"width":"4","collapse":false,"className":""},{"id":"771d9f65fda8ad9f","type":"ui_group","name":"WriteICON","tab":"c6d493fc.df122","order":4,"disp":true,"width":"4","collapse":false,"className":""},{"id":"c6d493fc.df122","type":"ui_tab","name":"Modbus","icon":"dashboard","disabled":false,"hidden":false}]

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...