Hi all,

I'm using the TwinCAT ads driver with the 0.8.0 realease of PLC4X. I can read 
all the values from the PLC without issue, but writing doesn't seem to work.
I don't know what Im doing wrong.

Here is the writing code:
        PlcDriverManager driver = new PlcDriverManager();
        try {
            PlcConnection plcConnection = driver.getConnection(
                    
"ads:tcp://10.10.11.77?sourceAmsNetId=172.29.64.1.1.1&sourceAmsPort=32&targetAmsNetId=5.62.206.200.1.1&targetAmsPort=851");



    if (!plcConnection.getMetadata().canWrite()) {
      return;
    }


  PlcWriteRequest.Builder builder = plcConnection.writeRequestBuilder();
          builder.addItem("lightToggle", "MAIN.E_Lum_1:BOOL", true);
          PlcWriteRequest request = builder.build();

          request.execute().whenComplete((response, exception) -> {

            if (exception == null)
              System.out.println("WRITING DONE....");
            else
              exception.printStackTrace();
          });

If I change the "MAIN.E_Lum_1:BOOL" to a value that doesn't exists I get a 
error saying me the name is invalid which is fine and tells me its really 
communicating with the PLC.

Now, when using the good name, I don't get an exception and I see thee "WRITING 
DONE..." in the console. However, the value is unchanged in the Beckhoff PLC.

Is there anything I don't understand ??
Thank you very much !!!


Here's the Beckhoff PLC setup:
[cid:[email protected]]

Patrick Boisclair
Analyste - Programmeur senior / Senior Analyst Programmer
462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA
noovelia.com

Reply via email to