Explain the purpose of %SW138 to %SW141 for a M340/M580 PLC CPU.



Goals and Symptoms

To explain the functionality the purpose of %SW138 to %SW141 in a M340/M580 PLC.

Facts and Changes

The M340 PLC CPU must be using firmware version 2.2 or higher. The M580 CPU must be higher than firmware version 2.20.
If the CPU is not configured for Mixed Topological and State RAM then System words 138 & 140 are not functional.
If testing in the Simulator, this functionality was not added to it until Unity Pro Version 13.1.

Causes and Fixes

To facilitate the migration from LL984 to a M340 PLC 4 new System Words were added to offset the Starting Address of variables accessed by Modbus and ModbusTCP requests.

Initialization of %SW138, %SW139, %SW140 and %SW141.
To ensure that these 4 System Words are initialized immediately after the download of application, a specific declaration must be done in UnityPro.
1) Create 4 named variables of type INT.
2) Give initial values to these 4 named variables.
3) Map these variables to the 4 System Words %SW138 .. %SW141

Caution : Failure to follow these instructions can result in injury or EQUIPMENT damage (risk that Modbus request access to wrong variables)