Modicon M340-specific System Words
Original instructions
Detailed Description
WARNING
UNEXPECTED APPLICATION BEHAVIOR
Do not use system objects (%Si, %SWi) as variables when they are not documented.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
These system words allow shifting memory addresses for a Modbus Server by applying an offset on the located memory addresses. This feature allows having the same mapping addresses from external Modbus accesses between a Modicon M340 located addresses and other devices in which located addresses do not start from address 0. The value contained in those system words corresponds to the Modbus server offset, the base address.
Description of system words %SW138 to %SW141:
Word
Symbol
%SW138 and %SW140
Function
Modbus objects base
Initial State
Base addresses for %I (discrete input) and %IW (input register)
NOTE: The base addresses for %I and %IW are not used when State RAM is configured in the CPU (from CPU firmware V2.4). Configuring State RAM allows the Modbus server to access the %I area (for all input bit operations) and the %IW area (for all input word operations).
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.
%SW139 and %SW141
Function
Modbus objects base
Initial State
Base addresses for %M (coil address) and %MW (holding register)
The base address is the number of %M or %MW which corresponds to Modbus address 0000.
WARNING
UNINTENDED EQUIPMENT OPERATION
You must set the values of the 4 system words %SW138, %SW139, %SW140 and %SW141 using the “Initial value” mechanism.
Do not use programming code to set the values.
Otherwise, when using the PLC init command or setting %S0 to 1 or downloading an application, the 4 system words are set to 0000 and the behavior of Modbus server is wrong.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Description of system words %SW142 to %SW167:
Word
Symbol
%SW142 to %SW145
Function
CANopen device deactivate
Initial State
Inhibit the I/O error raised by the system when a configured device on the CANopen bus is not present.
This inhibition can be managed with 4 system words %SW142, %SW143, %SW144 and %SW145.
These System words implement a bit list indicating CANopen node error to inhibit:
  • bit 0 of %SW142 concerns device at node address 1.
  • bit 1 of %SW142 concerns device at node address 2.
  • ...
  • bit15 of %SW145 concerns device at node address 64.
Bit values:
  • If the bit is at 0 and device not present, then an error is raised.
  • If the bit is at 1 and device not present, then no error is raised.
NOTE: The default value is 0.
NOTE: This inhibition can be performed on the fly, but in order for it to be taken into account, the CANopen Master must be reset (by setting bit 5 of the output word, %QW0.0.2.0 to 1).
NOTE: The system words %SW142 to %SW145 are available since SV 2.1 of the CPU OS.
%SW146 and %SW147
Function
SD card serial number
Initial State
Those 2 system words contain the unique SD card serial number (32bits). If there is not an SD card or an unrecognized SD card, the 2 system words are set to 0. This information can be used to protect an application against duplication.
NOTE: The system words %SW146 and %SW147 are available since SV 2.1 of the CPU OS.
%SW150 to %SW154
Function
CANopen SDO abort code
Initial State
Informations concerning the last SDO abort transfer:
  • %SW150: Low word of the SDO abort code.
  • %SW151: High word of the SDO abort code.
  • %SW152: Node number of the SDO transfer.
  • %SW153: Index number of the SDO transfer.
  • %SW154: Sub-index number of the SDO transfer.
%SW160 to %SW163
PREMRACK0 to PREMRACK3
Function
Detected errors for racks 0 to 3
Initial State
Words %SW160 to %SW163 are associated, respectively, to racks 0 to 3.
Bits 0 to 15 of each of these words are associated with the modules located in positions 0 to 15 of these racks.
The bit is at 0 if the module has a detected error, and at 1 if the module is operating correctly.
Example: %SW163.5 = 0, the module located in position 5 on rack 3 has a detected error.
In case of half racks, 2 contiguous half racks make a complete normal rack, referenced by only one %SWi.