ping9719 / McProtocol

三菱plc通信MC协议的实现。(This is a protocol for communicating with Mitsubishi PLCs.)
32 stars 15 forks source link

读数据程序无响应 #3

Open easyboot opened 1 year ago

easyboot commented 1 year ago

我用工具读很快就可以读出来 image

用下面的代码 mcProtocolTcp = new McProtocolTcp(ip, port, McFrame.MC3E);

        result = await mcProtocolTcp.Open();

    public async Task<int[]> GetBitDevice(string DeviceName, int iSize)
    {
        var bytes = await mcProtocolTcp.GetBitDevice(DeviceName, iSize);
        return bytes;
        // var oDataNew2 = await mcProtocolTcp.GetBitDevice("M85", 10);//以位方式读取10个
        // return oDataNew2
    }

程序没有报错,但是也不会返回数据结果。

ping9719 commented 1 year ago

1.PMcProtocol是否尝试过其他的McFrame类型 2.可以使用HslCommunication,在某个版本前是开源的免费的。 3.可以尝试试试IotClient,这是开源的,也是实现了'MC'协议。 4.继续等待,我也正在出一款类似于HslCommunication的开源的类库,可能还需要半年或更长的时间。

easyboot commented 1 year ago

image 原因是PLC设置为二进制码通讯就好了,之前设置的是ascii码通讯,