Technical FAQs

Ask a Question

M340 specific system words, %SW138 %SW141

Goals and Symptoms

To facilitate the migration from LL984 to M340, four new System Words have been added to offset the starting address of variables which are accessed by Modbus requests.

Facts and Changes

 

System Word Modbus request impacted First accessed variable
when Starting Address = 0
%SW138
Modbus Discrete Input Offset
FC02 Read Discrete Inputs %M[%SW138]
%SW139
Modbus Coil Offset
FC01 Read Coils
FC05 Write Single Coil
FC15 Write Multiple Coils
%M[%SW139]
%SW140
Modbus Input Register Offset
FC04 Read Input Registers %MW[%SW140]
%SW141
Modbus Holding Register Offset
FC03 Read Holding Registers
FC06 Write Single Register
FC16 Write Multiple Registers
FC22 Mask Write Register
FC23 Read/Write Multiple Registers
%MW[%SW141]

The base address is the number of %M or %MW which correspond to Modbus address 0000.
Examples:
    • %SW140 contains 1000. When the Modbus server receives a Read Input Registers request (code 04) with starting address equal to 0000, it returns values from %MW1000.

      %SW138 contains 0001. When the Modbus server receives a Read Discrete Inputs request (code 02) with starting address equal to 0000, it returns values from %M1.

Warning : it is mandatory to set the value of those 4 words with Initial value mechanism, rather than writing in an application section. Otherwise, upon PLC Init command or setting %S0 to 1 or downloading application, the 4 system words are set to 0000 and the behaviour of Modbus server is wrong.

Causes and Fixes

This information will be included in UnityPro V7.00 Help on line documentation

Was this helpful?
What can we do to improve the information ?