'Codesys: Is there a way to enable or disable a Modbus Com Port during runtime?

I got an MODBUS COM PORT for external communication hooked on a RS485 interface. However, not all of my units should communicate with external devices. As a slave i got a Modbus Serial Device running as RTU.

Is there any way to disable or enable this Port during runtime with structured text?

Do you know an example project, where this was done before?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source