Changes for page 1 Communication
Last modified by xingzhi lin on 2025/08/01 15:25
From version 245.1
edited by Hunter
on 2023/07/05 11:36
on 2023/07/05 11:36
Change comment:
There is no comment for this version
To version 262.1
edited by xingzhi lin
on 2025/08/01 15:25
on 2025/08/01 15:25
Change comment:
Rollback to version 260.1
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 11 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. Hunter1 +XWiki.lxz - Content
-
... ... @@ -1,6 +1,6 @@ 1 -= Create communication withWECONPLC=1 += WECON = 2 2 3 -== **LX3V Serial Protocol** ==3 +== **LX3V Serial ** == 4 4 5 5 Supported series: Wecon LX2V/ LX2E/ LX3V/LX3VP/LX3VE/LX3VM 6 6 ... ... @@ -48,7 +48,7 @@ 48 48 49 49 [[image:image-20220824120524-3.png]] 50 50 51 -== **LX5V Serial Protocol** ==51 +== **LX5V Serial ** == 52 52 53 53 This example introduces the establishment of serial port communication between V-BOX and LX5V. It is introduced through three parts: PLC software configuration, V-BOX software configuration, and hardware wiring. 54 54 ... ... @@ -118,7 +118,7 @@ 118 118 119 119 The above are all the steps for establishing serial port communication between V-BOX with LX5V PLC. 120 120 121 -== **LX5V-N Ethernet protocol** ==121 +== **LX5V-N Ethernet ** == 122 122 123 123 This example introduces the establishment of Ethernet communication between V-BOX and LX5V-N. It is introduced through three parts: PLC software configuration, V-BOX software configuration, and hardware wiring. 124 124 ... ... @@ -176,9 +176,9 @@ 176 176 177 177 The above are all the steps for establishing ethernet communication between V-BOX with LX5V PLC. 178 178 179 -= Create communication withAllen-Bradley(**Rockwell**)** PLC**=179 += Allen-Bradley(**Rockwell**) = 180 180 181 -== **DF1 Advanced Protocol** ==181 +== **DF1 Advanced Serial** == 182 182 183 183 MicroLogix 1000/1100/1200/1400/1500; SLC 5/03 5/04 5/05; PLC-5 184 184 ... ... @@ -277,7 +277,7 @@ 277 277 (% class="wikigeneratedid" id="HMicroLogixA0Protocol" %) 278 278 (% id="cke_bm_5621S" style="display:none" %)** ** 279 279 280 -== **MicroLogix Protocol** ==280 +== **MicroLogix Serial** == 281 281 282 282 (% class="wikigeneratedid" %) 283 283 MicroLogix 1000/1100/1200/1400/1500; SLC 5/03 5/04 5/05 PLC-5 ... ... @@ -317,7 +317,7 @@ 317 317 318 318 [[image:image-20220824110724-1.png]] 319 319 320 -== **Micro850_FreeTag Protocol** ==320 +== **Micro850_FreeTag Ethernet** == 321 321 322 322 ((( 323 323 ((( ... ... @@ -520,7 +520,7 @@ 520 520 The above are all the steps for establishing Ethernet communication between Wecon V-box with CompactLogix L1769 PLC. 521 521 522 522 523 -== **Micro850_FreeTag Protocol(new)** ==523 +== **Micro850_FreeTag Ethernet(new)** == 524 524 525 525 This example introduces the establishment of Ethernet communication between Wecon V-box and 2080-LC50-48QWB,Micro850. It is introduced through three parts: PLC software configuration, V-box software configuration. 526 526 ... ... @@ -605,13 +605,13 @@ 605 605 606 606 ))) 607 607 608 -== **Ethernet DF1 Protocol** ==608 +== **Ethernet DF1** == 609 609 610 610 [[download link>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Allen-Bradley%20Ethernet%20DF1.zip]] 611 611 612 -= Create communication with**Crouzet PLC** =612 += **Crouzet PLC** = 613 613 614 -== **CROUZET M3 (FBD)** == 614 +== **CROUZET M3 (FBD) Serial** == 615 615 616 616 Support Series: Crouzet Millenium 3 CD12/CB12 617 617 ... ... @@ -663,12 +663,10 @@ 663 663 **✎Note: **As the wiring diagram indicated, this protocol requires the DB9 serial port pin 4. But pin 4 is undefined for all V-Box, so it need the user to solder a Pull-up resistor to make the pin 4 working. As for how to solder the resistor on the motherboard, please contact with Wecon technical support for the details. 664 664 {{/info}} 665 665 666 -= Create communication withEMERSONPLC=666 += EMERSON = 667 667 668 -= Createcommunicationwith EMERSON PLC=668 += **RTU Slave ** = 669 669 670 -= **RTU Slave Protocol** = 671 - 672 672 Supported series: EC10 series 673 673 674 674 **1)V-BOX setting** ... ... @@ -728,9 +728,9 @@ 728 728 (% style="text-align:center" %) 729 729 [[image:Emerson.png]] 730 730 731 -= Create communication withHollySys PLC =729 += HollySys PLC = 732 732 733 -== **LK Modbus RTU** == 731 +== **LK Modbus RTU ** == 734 734 735 735 Supported Series: HollySys LK series PLC 736 736 ... ... @@ -761,15 +761,54 @@ 761 761 (% style="text-align:center" %) 762 762 [[image:Hollysys485-2.png]] 763 763 764 -= Createcommunication with **SiemensPLC** =762 +== **LM Modbus RTU** == 765 765 766 -== **S7-200 Smart Ethernet Protocol** == 764 +(% class="wikigeneratedid" %) 765 +Supported Series: HollySys LM3109/LM3107 PLC 767 767 768 -[[download link>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20S7-200%20Smart.zip]] 767 +(% class="wikigeneratedid" %) 768 +**1)V-BOX setting** 769 769 770 +|(% style="width:208px" %)**Items**|(% style="width:310px" %)**Settings**|(% style="width:365px" %)**Optional**|(% style="width:152px" %)**Note** 771 +|(% style="width:208px" %)Protocol|(% style="width:310px" %)HollySys LM Modbus RTU|(% style="width:365px" %)HollySys LM Modbus RTU|(% style="width:152px" %) 772 +|(% style="width:208px" %)Connection|(% style="width:310px" %)RS232|(% style="width:365px" %)RS485|(% style="width:152px" %) 773 +|(% style="width:208px" %)Baud rate|(% style="width:310px" %)38400|(% style="width:365px" %)38400|(% style="width:152px" %) 774 +|(% style="width:208px" %)Data bit|(% style="width:310px" %)8|(% style="width:365px" %)8|(% style="width:152px" %) 775 +|(% style="width:208px" %)Parity|(% style="width:310px" %)None|(% style="width:365px" %)None|(% style="width:152px" %) 776 +|(% style="width:208px" %)Stop bit|(% style="width:310px" %)1|(% style="width:365px" %)1|(% style="width:152px" %) 777 +|(% style="width:208px" %)Device station No.|(% style="width:310px" %)1|(% style="width:365px" %)1|(% style="width:152px" %) 770 770 771 - ==**S7-300 EthernetProtocol**==779 +**2)Address List** 772 772 781 +|=**Type**|=**Device registers**|=**Format**|=**Range**|=**Note** 782 +|Bit|QX|QXDDDDD.o|0~~99999.7| 783 +|Bit|IX|IXDDDDD.o|0~~99999.7| 784 +|Bit|MX|MXDDDDD.o|0~~99999.7| 785 +|Word|QW|QWDDDDD|0~~99999| 786 +|Word|IW|IWDDDDD|0~~99999| 787 +|Word|MW|MWDDDDD|0~~99999| 788 +|Word|MD|MDDDDDD|0~~99999| 789 + 790 +**Cable Wiring** 791 + 792 +RS232 793 + 794 +(% style="text-align:center" %) 795 +[[image:HollySysRS232.png]] 796 + 797 +RS485 798 + 799 +(% style="text-align:center" %) 800 +[[image:Hollysys LM Modbus RTU.gif]] 801 + 802 += **Siemens ** = 803 + 804 +== **S7-200 Smart Ethernet ** == 805 + 806 +[[download link>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20S7-200%20Smart.zip]] 807 + 808 +== **S7-300 Ethernet ** == 809 + 773 773 Supported Series: Siemens S7-300 series PLC 774 774 775 775 **1)V-BOX setting** ... ... @@ -826,11 +826,11 @@ 826 826 ))) 827 827 ))) 828 828 829 -== **S7-1200 Ethernet Protocol** ==866 +== **S7-1200 Ethernet ** == 830 830 831 831 [[download link>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communicate%20with%20S7-1200%20via%20Ehernet.zip]] 832 832 833 -== **S7-XXX Ethernet Protocol** ==870 +== **S7-XXX Ethernet l** == 834 834 835 835 Supported Series: Siemens S7-400, S7-1200 and S7-1500 836 836 ... ... @@ -944,7 +944,7 @@ 944 944 945 945 [[image:image-20220824162342-2.png]] 946 946 947 -== **LOGO Ethernet Protocol** ==984 +== **LOGO Ethernet ** == 948 948 949 949 Supported Series: Siemens Logo 0BA0, 0BA1 series 950 950 ... ... @@ -1035,9 +1035,9 @@ 1035 1035 ** Register VD: Use only registers that are multiples of 4, such as 0, 4, 8, etc. 1036 1036 ** Register VW: Use only registers thay are multiples of 2, such as 0, 2, 4 etc. (Using an odd-length register may result in data errors, such as 2 3 4 ) 1037 1037 1038 -= Create communication with**MitsubishiPLC** =1075 += **Mitsubishi ** = 1039 1039 1040 -== **FX1S,1N,2N Serial Protocol** ==1077 +== **FX1S,1N,2N Serial ** == 1041 1041 1042 1042 Supported Series: Mitsubishi FX1S, FX1N, FX2N series 1043 1043 ... ... @@ -1084,7 +1084,7 @@ 1084 1084 [[image:image-20220825100845-4.png]] 1085 1085 1086 1086 1087 -== **FX3U,3G,3GA Serial Protocol** ==1124 +== **FX3U,3G,3GA Serial ** == 1088 1088 1089 1089 Supported Series: Mitsubishi FX3U, FX3G, FX3GA series 1090 1090 ... ... @@ -1131,7 +1131,7 @@ 1131 1131 [[image:image-20220825100845-4.png]] 1132 1132 1133 1133 1134 -== **FX3U Ethernet Protocol** ==1171 +== **FX3U Ethernet ** == 1135 1135 1136 1136 Supported Modules: FX3U-ENET-ADP, FX3U-ENET-L 1137 1137 ... ... @@ -1226,7 +1226,7 @@ 1226 1226 1227 1227 [[image:image-20221119101946-2.png||height="395" width="695"]] 1228 1228 1229 -== **FX5U Serial Protocol** ==1266 +== **FX5U Serial ** == 1230 1230 1231 1231 Mitsubishi FX5U series PLC 1232 1232 ... ... @@ -1308,7 +1308,7 @@ 1308 1308 1309 1309 [[image:image-20220825105533-3.png]] 1310 1310 1311 -== **FX5U Ethernet Protocol** ==1348 +== **FX5U Ethernet ** == 1312 1312 1313 1313 Mitsubishi FX5U series PLC 1314 1314 ... ... @@ -1384,7 +1384,7 @@ 1384 1384 1385 1385 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/12.PLC%20Protocol_html_2297240b57346b2a.png?width=401&height=170&rev=1.1||alt="12.可编程逻辑控制器Protocol_html_2297240b57346b2a.png" height="170" width="401"]] 1386 1386 1387 -== **L02 Serial Protocol** ==1424 +== **L02 Serial ** == 1388 1388 1389 1389 Mitsubishi L02 series CPU built-in serial port. 1390 1390 ... ... @@ -1444,7 +1444,7 @@ 1444 1444 1445 1445 [[image:image-20220825160820-4.png]] 1446 1446 1447 -== **L02 Ethernet Protocol** ==1484 +== **L02 Ethernet ** == 1448 1448 1449 1449 Mitsubishi L series CPU built-in Ethernet port. 1450 1450 ... ... @@ -1517,13 +1517,13 @@ 1517 1517 1518 1518 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/12.PLC%20Protocol_html_2297240b57346b2a.png?width=401&height=170&rev=1.1||alt="12.PLC Protocol_html_2297240b57346b2a.png" height="170" width="401"]] 1519 1519 1520 -== **Q12H Serial Protocol** ==1557 +== **Q12H Serial ** == 1521 1521 1522 1522 This Demo shows V-BOX communicate with Q12H PLC by Q02H serial Protocol 1523 1523 1524 1524 [[**Download link**>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Communication/V-Box%20connect%20PLC%20Q12H.rar]] 1525 1525 1526 -== **QJ71E71 Ethernet Protocol** ==1563 +== **QJ71E71 Ethernet ** == 1527 1527 1528 1528 Mitsubishi QJ71E71 Ethernet communication module; 1529 1529 ... ... @@ -1598,9 +1598,9 @@ 1598 1598 1599 1599 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/12.PLC%20Protocol_html_2297240b57346b2a.png?width=401&height=170&rev=1.1||alt="12.PLC Protocol_html_2297240b57346b2a.png"]] 1600 1600 1601 -= Create communication with**DeltaPLC** =1638 += **Delta** = 1602 1602 1603 -== **DVP Ethernet Protocol** ==1640 +== **DVP Ethernet** == 1604 1604 1605 1605 Supoort Series: DELTA DVP20/32/40/60ES200RE/200TE or any DVP models with built-in Ethernet port, DELTA DVPEN01-SL module 1606 1606 ... ... @@ -1665,7 +1665,7 @@ 1665 1665 (% style="text-align:center" %) 1666 1666 [[image:DVPEthernetVNETPortocol.png]] 1667 1667 1668 -== **DVP serial protocol** ==1705 +== **DVP serial** == 1669 1669 1670 1670 Supoort Series: DELTA DVP EH/ES/SS/EX/EH2/SV/SA/SC/SX 1671 1671 ... ... @@ -1701,7 +1701,7 @@ 1701 1701 (% style="text-align:center" %) 1702 1702 [[image:Delta DVP PROTOCOLSerial232.png]] 1703 1703 1704 -== **AS Ethernet Protocol** ==1741 +== **AS Ethernet** == 1705 1705 1706 1706 **1)V-BOX Settings** 1707 1707 ... ... @@ -1746,19 +1746,18 @@ 1746 1746 1747 1747 [[image:image-20220831155157-3.png]] 1748 1748 1749 -= Create communication with**OmronPLC** =1786 += **Omron** = 1750 1750 1751 -== **CP1 Series Protocol** ==1788 +== **CP1 Series** == 1752 1752 1753 -[[ 下载链接>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20ORMON%20CP1%20Series.zip]]1790 +[[Download>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20ORMON%20CP1%20Series.zip]] 1754 1754 1755 -== **CP2M Series Protocol** ==1792 +== **CP2M Series** == 1756 1756 1757 -[[ 下载链接>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20ORMON%20CJ2M.zip]]1794 +[[Download>>https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communication%20with%20ORMON%20CJ2M.zip]] 1758 1758 1796 +== **EC55 Series ** == 1759 1759 1760 -== **EC55 Series Protocol** == 1761 - 1762 1762 Supported device: EC55 temperature instrument 1763 1763 1764 1764 **1)V-BOX Settings** ... ... @@ -1818,9 +1818,9 @@ 1818 1818 * Please set the communication delay time of 10ms in setting, to avoid that the instrument may not be able to communicate in a short time due to too fast data access and too much connection requests. 1819 1819 * [[image:image-20220831161356-1.png]]Because of the particularity of the instrument, it is necessary to write the value of the address in the menu interface corresponding to the address, and to enter the menu where the address locates, so that the value could be written. 1820 1820 1821 -= Create communication withXinje** PLC**=1857 += Xinje = 1822 1822 1823 -== **XC serial protocol** ==1859 +== **XC serial** == 1824 1824 1825 1825 **1)V-BOX Settings** 1826 1826 ... ... @@ -1862,7 +1862,7 @@ 1862 1862 1863 1863 [[image:image-20220831163441-4.png]] 1864 1864 1865 -== **XD serial protocol** ==1901 +== **XD serial** == 1866 1866 1867 1867 **1)V-BOX Settings** 1868 1868 ... ... @@ -1936,7 +1936,7 @@ 1936 1936 1937 1937 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/image-20220830160232-3.png?rev=1.1||alt="image-20220830160232-3.png"]] 1938 1938 1939 -= Create communication with**SchneiderPLC** =1975 += **Schneider** = 1940 1940 1941 1941 == **Schneider MODBUS RTU** == 1942 1942 ... ... @@ -1970,9 +1970,9 @@ 1970 1970 1971 1971 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/image-20220817154212-1.jpeg?width=554&height=315&rev=1.1||alt="image-20220817154212-1.jpeg" height="315" width="554"]] 1972 1972 1973 -= Create communication withInovance** PLC**=2009 += Inovance = 1974 1974 1975 -== **H3U serial protocol** ==2011 +== **H3U serial** == 1976 1976 1977 1977 **1)V-BOX Settings** 1978 1978 ... ... @@ -2022,9 +2022,9 @@ 2022 2022 2023 2023 [[image:image-20220831164731-4.png]] 2024 2024 2025 -= Create communication withPanasonic** PLC**=2061 += Panasonic = 2026 2026 2027 -== **FP serial protocol** ==2063 +== **FP serial** == 2028 2028 2029 2029 **1)V-BOX Settings** 2030 2030 ... ... @@ -2072,9 +2072,9 @@ 2072 2072 2073 2073 [[image:image-20220831165008-1.png]] 2074 2074 2075 -= Create communication withLS** PLC**=2111 += LS = 2076 2076 2077 -== **XBC serial protocol** ==2113 +== **XBC serial** == 2078 2078 2079 2079 **1)V-BOX Settings** 2080 2080 ... ... @@ -2126,7 +2126,7 @@ 2126 2126 2127 2127 [[image:image-20220831170215-2.png]] 2128 2128 2129 -== **XGK FEnet Ethernet protocol** ==2165 +== **XGK FEnet Ethernet** == 2130 2130 2131 2131 Supported Series: LS XGT series XGK CPU with XGL-EFMT Ethernet module 2132 2132 ... ... @@ -2169,8 +2169,76 @@ 2169 2169 2170 2170 [[image:https://docs.we-con.com.cn/bin/download/PIStudio/12.PLC%20protocols/WebHome/12.PLC%20Protocol_html_2297240b57346b2a.png?width=401&height=170&rev=1.1||alt="12.可编程逻辑控制器Protocol_html_2297240b57346b2a.png" height="170" width="401"]] 2171 2171 2172 -= Createcommunication with **Modbus **=2208 += INVT = 2173 2173 2210 +**1)V-BOX setting** 2211 + 2212 +|**Item**|**Settings**|**Note** 2213 +|Protocol|INVT_IVC2L| 2214 +|Connection|RS232| 2215 +|Baud rate|19200| 2216 +|Data bit|8| 2217 +|Parity|EVEN| 2218 +|Stop bit|1| 2219 +|PLC station No.|1 2220 + 2221 +**2)Address List** 2222 + 2223 + 2224 +|**Type**|**Device registers**|**Format**|**Range**|**Note** 2225 +|(% colspan="1" rowspan="7" %)Bit|X|XOOO|0~~377| 2226 +|Y|YOOO|0~~377| 2227 +|M|MDDDD|0~~1999| 2228 +|SM|SMDDD|0~~255| 2229 +|S|SDDD|0~~991| 2230 +|T|TDDD|0~~255| 2231 +|C|CDDD|0~~255| 2232 +|(% rowspan="5" %)Word|D|DDDDD|0~~7999| 2233 +|SD|SDDDD|0~~255| 2234 +|Z|ZDD|0~~15| 2235 +|T|TDDD|0~~255| 2236 +|C|CDDD|0~~199| 2237 +|Double word|C|CDDD|200~~255| 2238 + 2239 +**3)Communication Settings** 2240 + 2241 +(% style="text-align:center" %) 2242 +[[image:盒子创建英威腾.png]] 2243 + 2244 +**4)PLC software** 2245 + 2246 +(% style="text-align:center" %) 2247 +[[image:英威腾软件.png]] 2248 + 2249 +**5)PLC setting ** 2250 + 2251 +Open the INVI plc software, create a new project or open a project that has already been created 2252 + 2253 +(% style="text-align:center" %) 2254 +[[image:英威腾创建1.png]] 2255 + 2256 +Configure serial port parameters. 2257 + 2258 +(% style="text-align:center" %) 2259 +[[image:英威腾创建2.png]] 2260 + 2261 +PC connect PLC 2262 + 2263 +(% style="text-align:center" %) 2264 +[[image:英威腾创建3.png]] 2265 + 2266 +Download 2267 + 2268 +(% style="text-align:center" %) 2269 +[[image:英威腾下载.png]] 2270 + 2271 +**6)Cable Wiring** 2272 + 2273 +(% style="text-align:center" %) 2274 +[[image:wire.png]] 2275 + 2276 += **Modbus ** = 2277 + 2174 2174 == **MODBUS RTU Slave (All function)** == 2175 2175 2176 2176 Select the protocol "Modbus RTU Slave (All Fuction)", ... ... @@ -2180,7 +2180,7 @@ 2180 2180 (% style="text-align:center" %) 2181 2181 [[image:1624342015914-382.png||height="486" width="800" class="img-thumbnail"]] 2182 2182 2183 -== ** Communicate withModbus Meter** ==2287 +== **Modbus Meter** == 2184 2184 2185 2185 The following example is using the Linfee meter LNF96EY to demonstrate how to set up the Modbus communication. 2186 2186 ... ... @@ -2355,7 +2355,7 @@ 2355 2355 2356 2356 [[download link>>url:https://ftp.we-con.com.cn/Download/WIKI/V-BOX/Demo/%E9%80%9A%E8%AE%AF%E6%A1%88%E4%BE%8B/Communicate%20with%20VB%20inverter.zip]] 2357 2357 2358 -= **User define protocol** =2462 += **User define** = 2359 2359 2360 2360 More serial port script instruction,please refer manual:[[Lua script function>>doc:V-BOX.V-Net.Manual.04 Lua Script.01 Lua Functions.WebHome]]~-~-->[[3.Serial port operation>>url:http://docs.we-con.com.cn/wiki/vbox/view/HMI/04.Lua%20script%20%20function%20and%20operation/01.Lua%20script%20function/#H3.Serialportoperation]] 2361 2361 ... ... @@ -2373,66 +2373,63 @@ 2373 2373 2374 2374 Script Demo: 2375 2375 2376 -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-- 2377 - 2480 +{{code language="lua"}} 2378 2378 function com.main() 2379 - ~-~-dosomething 2380 - openPlc() 2482 + --dosomething 2483 + openPlc() 2484 +end 2485 + 2486 +function openPlc() 2487 + if obj then 2488 + -- If the serial port opened,then read/write data by timing 2489 + local wri = string.pack(">HHHH",0X0103,0X0200,0X0003,0X0473) 2490 + local arr = reading(wri) 2491 + -- if arr ~=nil then 2492 + if arr[1] ==33 and arr[2] ==v[2][2] and arr[3] ==v[2][3] then 2493 + local A = arr[4]*256 2494 + local B = A+arr[5] 2495 + -- addr_setword(v[1],B) 2496 + end 2497 +-- end 2498 + else 2499 + --judge if there is a serial object, then initialize and open the serial port 2500 + local configs = { 2501 + name = 'COM1', --Select serial port COM1 2502 + mode = 485, --Communication mode RS485 2503 + baud_rate = 9600, --Baud rate 9600 2504 + stop_bit = 1, --stop bit 1 2505 + data_len = 8, --data length 8 2506 + check_bit = 'NONE', --no parity 2507 + } 2508 + obj,err = serial.open(configs) --Open serial port 2509 + if not obj then 2510 + print("serial open :failed", err) -- Open serial port failed 2511 + end 2512 + end 2381 2381 end 2382 - function openPlc() 2383 - if obj then 2384 - ~-~- If the serial port opened,then read/write data by timing 2385 2385 2386 - local wri = string.pack(">HHHH",0X0103,0X0200,0X0003,0X0473) 2387 - local arr = reading(wri) 2388 - ~-~- if arr ~~=nil then 2389 - ~-~- if arr[1] ==33 and arr[2] ==v[2][2] and arr[3] ==v[2][3] then 2390 - ~-~- local A = arr[4]*256 2391 - ~-~- local B = A+arr[5] 2392 - ~-~- addr_setword(v[1],B) 2393 - ~-~- end 2394 - ~-~- end 2395 2395 2396 - lse2397 - ~-~-judge ifthereisa serialobject, then initializeand open theserial port2398 - localconfigs = {2399 - ame = 'COM1', ~-~-Selecterial portCOM12400 - mode= 485, ~-~-CommunicationmodeRS4852401 - baud_rate =600,~-~-Baudrate96002402 - stop_bit=1,-~-stopbit12403 - ata_len= 8, ~-~-datalength82404 - check_bit = 'NONE', ~-~-noparity2405 - 2406 - }2407 - obj,err=serial.open(configs) ~-~-Open serial port2408 - if not obj then2409 - print("serial open :failed", err) ~-~- Openserial port failed2410 - nd2516 +function reading(wri) 2517 + obj:flush() -- Clear serial port 2518 + obj:write(wri)-- Write serial port 2519 + print(string.byte(wri,1,#wri)) 2520 + obj:flush() -- Clear serial port 2521 + local readed =obj:read(9,1000) -- Read 9 bytes, timeout 1 second 2522 + if readed and readed ~= "" then 2523 + -- judge that a non-empty string is read 2524 + print(string.byte(readed,1,#readed)) 2525 + a={string.byte(readed, 1, #readed)} 2526 + if nil ~= a[4] and nil ~= a[5] and nil ~= a[6] and nil ~= a[7] then 2527 + a1=a[4]*256+a[5] 2528 + a2=a[6]*256+a[7] 2529 + addr_setword("@HDW0",a1) 2530 + addr_setword("@HDW1",a2) 2411 2411 end 2412 - end 2413 - 2414 - function reading(wri) 2415 - obj:flush() ~-~- Clear serial port 2416 - obj:write(wri) ~-~- Write serial port 2417 - print(string.byte(wri,1,#wri)) 2418 - obj:flush() ~-~- Clear serial port 2419 - local readed =obj:read(9,1000) ~-~- Read 9 bytes, timeout 1 second 2420 - if readed and readed ~~= "" then 2421 - ~-~- judge that a non-empty string is read 2422 - print(string.byte(readed,1,#readed)) 2423 - a={string.byte(readed, 1, #readed)} 2424 - if nil ~~= a[4] and nil ~~= a[5] and nil ~~= a[6] and nil ~~= a[7] then 2425 - a1=a[4]*256+a[5] 2426 - a2=a[6]*256+a[7] 2427 - addr_setword("@HDW0",a1) 2428 - addr_setword("@HDW1",a2) 2429 - end 2430 - return {string.byte(readed, 1, #readed)} 2431 - elseif readed == nil then 2432 - print("serial read err:", err or "") 2433 - return nil 2434 - end 2532 + return {string.byte(readed, 1, #readed)} 2533 + elseif readed == nil then 2534 + print("serial read err:", err or "") 2435 2435 return nil 2436 - end 2437 - 2438 -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- 2536 + end 2537 + return nil 2538 +end 2539 +{{/code}}
- HollySysRS232.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +10.4 KB - Content
- Hollysys LM Modbus RTU.gif
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +7.1 KB - Content
- plc 软件.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +106.8 KB - Content
- wire.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +137.2 KB - Content
- 企业微信截图_16889606174191.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +20.7 KB - Content
- 盒子创建英威腾.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +86.5 KB - Content
- 英威腾下载.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +49.0 KB - Content
- 英威腾创建1.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +36.7 KB - Content
- 英威腾创建2.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +115.7 KB - Content
- 英威腾创建3.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +76.6 KB - Content
- 英威腾软件.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.AiXia - Size
-
... ... @@ -1,0 +1,1 @@ 1 +52.6 KB - Content