Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用McPLC,无法成功写入数据到设备 #26

Open
yangshuyi opened this issue Dec 11, 2024 · 1 comment
Open

使用McPLC,无法成功写入数据到设备 #26

yangshuyi opened this issue Dec 11, 2024 · 1 comment

Comments

@yangshuyi
Copy link

yangshuyi commented Dec 11, 2024

你好,我使用iot-communication的McPLC模块,往plc的一个地址写数据,没有报错,但是值没有写入成功。读取的还是旧的值。我试了Boolean,UInt等数据类型都是一样的效果。如果使用GX Work3可以正常读写地址。请问可能的原因是什么

    public static void nativeExecute() throws Exception {
        McPLC mcPLC = new McPLC(EMcSeries.IQ_R, ipAddress, 5002);

        mcPLC.writeBoolean(address, true);

        RuntimeUtils.threadSleep(1000);

        boolean result = mcPLC.readBoolean(address);
        System.out.println("result:" + result);
    }
@xingshuangs
Copy link
Owner

是不是PLC哪里设置了不允许写,读取数据是否正常,我目前用的是GX work2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants