Problem setting modbus output module

I am planning to use IP Symcon (4.x) in combination with a Wago PLC.
I have setup a test configuration and am able to switch on a light using the PLC only.
After that I connected IP Symcon and am able to read the status of the modules.
Both the input as the output module are successfully polled for their status.

Now I would like to change the status with IP Symcon but I do not seem to get it to work.
I have it setup as below;

I used the following script too change the status;


// Object id of boolean status variable
$statusVariableId = 28354 /*[Toggle test\Toggle status]*/;

// Object id of modbus instance that controls the output
$instanceId = 21194 /*[Toggle test\Output]*/;

// Current status of output
$outputStatus = GetValue($statusVariableId);

// Script is executed by trigger event
if (isset($_IPS['EVENT']))
{
    // Toggle status
    $outputStatus = $outputStatus == true ? false : true;
}
// Script is executed by variable action
elseif (isset($_IPS['VARIABLE']))
{
    $outputStatus = $_IPS['VALUE'];
}

SetValue($statusVariableId, $outputStatus);
@ModBus_WriteCoil($instanceId, $outputStatus);

I do see the toggle status variable change.
I checked the id’s multiple times but can’t seem too find the problem.

Any help would be much appreciated.
Maybe another basic modbus „how to“ would leed me into the right direction.

Are you sure the write adress ist correct? AFAIK it should be zero for the first writing coil. After that you can just use ON/OFF in the configuration to test the function.

paresy

No, I am not sure the address is correct. But I do get the correct status from the read address.
So the „function (write)“ would be as it is; „Write single coil (05)“ and the „Address (write)“ would be „0512“?
I have not tried that. I will give it a tried tonight.

Yeah. Read and write address can be different :slight_smile:

paresy

I used „0512“ and tried on and off at the configuration test.
Unfortunately nothing seems to change.

Do you know any sources where I can find the correct addresses?

Have you tried write adresse 0?

paresy

Yeah, tried that. No success.

I can’t seem to find the right address…

Auf Seite 223 einer WAGO PDF steht, dass Modbus Funktionscode 3, 4 und 23 für das Lesen genommen werden sollten.
Schreiben soll man mit Funktionscode 6, steht auf der folgenden Seite.

Kenn mich nicht aus, wäre ein Test wert.
Gruß Helmut
Edit: Die Zeile

SetValue($statusVariableId, $outputStatus);
will eine readonly Variable setzen

I tried changing the function, but then the Unit needs to be changed as well.
And then I am not able to use the „Test-center“ on / off method.
I tried using a script to set a value, but no luck there either.

I can not seem to find a simple tutorial or explanation on how to set it up.

Nicht aufgeben,
Du könntest doch mit diesen Funktionen in der Instanz einen Wert sehen, wenn was in Deinen Registern steht, nicht gerade 00000, dann weißt Du, ob richtig gelesen wurde.

Mein Englisch ist nicht gut:

You can use these functions to see in the instance a value.

Is in your registers, not exactly 00000, then you know if read correctly

If read correctly, than write to Modbus Instanz with Modbuswrite CMD in IP-Symcon with PHP Script

Best regards
Helmut

I do not think I fully understand, sorry.

I tried using the different kind of functions to show what value will be returned in the location tree.
No luck there either.

I switched it back to „Read Coils (01)“ and „Write Single Coil (05)“ and then the value will change between On and Off if I change the module using CoDeSys (tool from Wago) correctly.
I just do not seem to be able to set it using IP-Symcon.

I removed all instances and started over;

  1. I clicked on „Add Object“ and choose „ModBus Device“.
  2. As location I picked IP-Symcon.
  3. I left is as default but only changed the addresses. Both the read and write address are now 512.
  4. I clicked on „A parent instance seems to be inactive. Please click here to open the configuration dialog.“
  5. I checked „Active“ and filled in the Host (192.168.1.100) and Port (502)
  6. I applied all changes and went back to „Location tree“.

I can now again see the value change if I do this externally, but I am not able to change it using the „Test center“.
Any thoughts are appreciated.

If the modbudadr is an output or a data point of the PLC, a write via IP symcon is immediately overwritten by the PLC when a program runs in the PLC there.

The input status can not be described externally.

Is it such an address on 512?

Best regards Helmut

I understand, thats why I stopped the program in the PLC. I will try again tonight, but I am pretty sure I stopped the program and logged out off CoDeSys.

I can read the output if I fill in 512 (or 513 because it is a dual digital output module) I get the correct status of PLC module.

Ich kann es nicht testen, habe kein CoDeSys, ich glaube man muß mit Merkern arbeiten

und Die dann mit einem Output verknüpfen, direkt den Ausgang ansteuern geht nicht,

ohne Prg sowieso sinnlos, mit laufenden Program nicht möglich

Jetzt sind WAGO IP-Symcon User gefragt, geht sowas ?
Gruß Helmut

I can not test it, i haven’t CoDeSys, I think you have to work with flags and then connect it with an output,

directly control the output is not possible, without Prg anyway senseless, with running program not possible, i think

Now WAGO IP Symcon users are asked, goes something like that?

I found the problem. With help on tweakers.net a Wago PLC user notified me about the „IO config’“ page in the web management of the Wago PLC. There was no configuration available so I choose „Create ea-config.xml“. After that I checked that the mapping was on „Fieldbus 1“, which is necessary for modbus usage. And after that I was able to use the „Test-center“ on and off features.

For the record; the settings of the addresses are the same, both 512. And the read function is „Read coils (01)“ and the write function is „Write Single Coil (05)“.

Thanks for the support!