• 大小: 30.08MB
    文件类型: .zip
    金币: 2
    下载: 3 次
    发布日期: 2023-06-14
  • 语言: 其他
  • 标签:

资源简介

PLC通信测试工具。支持西门子,欧姆龙,松下等各类型PLC。下载下来就可以用。有需要的可以放心下载。

资源截图

代码片段和文件信息

import HslCommunication.Core.Net.NetHandle;
import HslCommunication.Core.Transfer.DataFormat;
import HslCommunication.Core.Types.ActionOperateExThree;
import HslCommunication.Core.Types.ActionOperateExTwo;
import HslCommunication.Core.Types.OperateResult;
import HslCommunication.Core.Types.OperateResultExOne;
import HslCommunication.Enthernet.ComplexNet.NetComplexClient;
import HslCommunication.Enthernet.PushNet.NetPushClient;
import HslCommunication.Enthernet.SimplifyNet.NetSimplifyClient;
import HslCommunication.ModBus.ModbusTcpNet;
import HslCommunication.Profinet.Melsec.MelsecMcAsciiNet;
import HslCommunication.Profinet.Melsec.MelsecMcNet;
import HslCommunication.Profinet.Melsec.MelsecA1ENet;
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;

import java.util.Arrays;

public class Main {

    public static void main(String[] args) {

        //NetSimplifyClientTest();

        MelsecA1ETest();
        //MelsecTest();
        //PushNetTest();

        //ModbusTcpTets();
        //SiemesTest();



        try {
            //Constructor[] aa = Integer.class.getDeclaredConstructors();
            //int i = (Integer) (aa[1].newInstance(“1“));
            //System.out.println(Utilities.bytes2HexString( Utilities.getBytes(String.format(“%04x“100)“ASCII“)));
            //System.out.println(i);

            //System.out.println(Arrays.toString(“123“.split(“\\.“ )));
            //ModbusTcpTets();
            //MelsecMcNet melsec_net = new MelsecMcNet(“192.168.8.12“ 6001);
            //System.out.println(melsec_net.ReadInt16(“D100“).Content);

            SiemensS7Net siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200“192.168.8.12“);
            OperateResult write = siemensS7Net.Write(“M200“(short)200);

            if(!write.IsSuccess){
                System.out.println(“Write failed:“+write.Message);
            }

            OperateResultExOne read = siemensS7Net.ReadInt16(“M200“);
            if(read.IsSuccess){
                System.out.println(“Value:“+read.Content.toString());
            }
            else {
                System.out.println(“Read failed:“+read.Message);
            }
        }
        catch (Exception ex){
            System.out.println(ex.getMessage());
        }

        try {
            Thread.sleep(1000);
        } catch (Exception ex) {

        }
    }


    public static void NetSimplifyClientTest() {
        NetSimplifyClient client = new NetSimplifyClient(“127.0.0.1“ 12345);

        OperateResultExOne read = client.ReadFromServer(new NetHandle(2) “测试数据“);
        if (read.IsSuccess) {
            System.out.println(read.Content);
        } else {
            System.out.println(“读取失败:“ + read.Message);
        }
    }

    private static void MelsecA1ETest() {
        MelsecA1ENet melsec_net = new MelsecA1ENet(“192.168.0.100“ 5000);
        melsec_net.SetPersistentConnection();

        boolean[] M100 = melsec_net.ReadBool(“M100“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-11-19 09:15  HslCommunication-master\
     文件        2518  2018-11-15 06:32  HslCommunication-master\.gitattributes
     文件        4305  2018-11-15 06:32  HslCommunication-master\.gitignore
     目录           0  2019-11-19 09:13  HslCommunication-master\.vs\
     目录           0  2020-03-09 19:49  HslCommunication-master\.vs\HslCommunication\
     目录           0  2019-11-19 09:13  HslCommunication-master\.vs\HslCommunication\DesignTimeBuild\
     文件      690408  2020-03-09 19:50  HslCommunication-master\.vs\HslCommunication\DesignTimeBuild\.dtbcache
     目录           0  2019-11-19 09:13  HslCommunication-master\.vs\HslCommunication\v15\
     文件      417792  2019-09-26 10:27  HslCommunication-master\.vs\HslCommunication\v15\.suo
     目录           0  2019-11-19 09:13  HslCommunication-master\.vs\HslCommunication\v15\Server\
     目录           0  2019-11-19 09:13  HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\
     文件           0  2018-11-16 17:01  HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\db.lock
     文件     8736768  2019-08-01 16:01  HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide
     文件       32768  2019-09-25 19:01  HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide-shm
     文件     4206552  2019-09-26 10:27  HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide-wal
     目录           0  2020-03-09 19:49  HslCommunication-master\.vs\HslCommunication\v16\
     文件      353792  2020-03-09 19:50  HslCommunication-master\.vs\HslCommunication\v16\.suo
     目录           0  2020-03-09 19:49  HslCommunication-master\.vs\HslCommunication\v16\Server\
     目录           0  2020-03-09 19:50  HslCommunication-master\.vs\HslCommunication\v16\Server\sqlite3\
     文件           0  2020-03-09 19:49  HslCommunication-master\.vs\HslCommunication\v16\Server\sqlite3\db.lock
     文件     3407872  2020-03-09 19:50  HslCommunication-master\.vs\HslCommunication\v16\Server\sqlite3\storage.ide
     文件        3746  2018-11-15 06:32  HslCommunication-master\chmHelper.shfbproj
     目录           0  2019-11-19 09:13  HslCommunication-master\docs\
     文件        8254  2018-11-15 06:32  HslCommunication-master\docs\English.md
     文件        6609  2018-11-15 06:32  HslCommunication-master\docs\Melsec.md
     文件        5277  2018-11-15 06:32  HslCommunication-master\docs\ModbusServer.md
     文件        5863  2018-11-15 06:32  HslCommunication-master\docs\ModbusTcp.md
     文件        5790  2018-11-15 06:32  HslCommunication-master\docs\Omron.md
     文件        7026  2018-11-15 06:32  HslCommunication-master\docs\Siemens.md
     目录           0  2019-11-19 09:13  HslCommunication-master\Download\
     文件      148209  2018-11-15 06:32  HslCommunication-master\Download\HslCommunication.jar
............此处省略1411个文件信息

评论

共有 条评论