System Bits and Words
 
Description
MC80 supports the following system words dedicated to communication functions. Some of them already exist on previous Premium or Quantum ranges but they are re-used with other semantic (highlighted in Bold).
%S
Bit
Function
Unity Rd/Wr
0
-
Cold-start
Normally at 0, this bit is set on 1 by:
  • Reset button
  • the user program
This bit is set to 1 during the first complete restored cycle of the PLC either in RUN or in STOP mode. It is reset to 0 by the system before the following cycle.
To detect the first cycle in run after cold start, refer to %SW10.
Rd/Wr
1
-
Warm-start
Normally at 0, this bit is set to 1 by:
  • power is restored with data save
  • the user program
It is reset to 0 by the system at the end of the first complete cycle and before the outputs are updated.
Rd/Wr
4
-
Timebase 10 ms
An internal timer regulates the change in status of this bit.
It is asynchronous in relation to the PLC cycle.
Rd
5
-
Timebase 100 ms
Rd
6
-
Timebase 1 sec
Rd
7
-
Timebase 1 min
Rd
10
-
Global I/O detected error
Normally at 1, this bit is set to 0 when an error on the embedded I/O or device on a network is detected (e.g. non-compliant configuration, exchange fault, hardware fault, etc.). The %S10 bit is reset to 1 by the system when all the detected errors have disappeared.
Rd
11
-
Watchdog overflow
Normally at 0, this is set to 1 by the system as soon as the task execution time becomes greater than the maximum execution time (i.e., the watchdog) declared in the task properties.
Rd/Wr
12
-
PLC running
This bit is set to 1 by the system when the PLC is in RUN.
It is set to 0 by the system as soon as the PLC is no longer in RUN (STOP, INIT, etc.).
Rd
13
-
1st scan in RUN
First cycle after switching to RUN.
Switching the PLC from STOP mode to RUN mode (including after a cold start with automatic start in run) is indicated by setting system bit %S13 to 1. This bit is reset to 0 at the end of the first cycle of the MAST task in RUN mode
Rd
15
-
Character string error
Normally set to 0, this bit is set to 1 when the destination zone for a character string transfer is not of sufficient size (including the number of characters and the end of string character) to receive this character string.
The application stops in error state if the %S78 bit is to set to 1.
This bit must be reset to 0 by the application.
Rd
16
-
Task I/O error
Normally set to 1, this bit is set to 0 by the system when a fault on an in-rack module is detected (For example, non-compliant configuration, exchange fault, hardware fault, etc.).
This bit must be set to 1 by the user.
Rd/Wr
17
-
Capacity overrun/carry
Rotate shift output
Normally at 0.
During a rotate shift operation, this bit takes the state of the outgoing bit.
Rd/Wr
18
-
Overflow or arithmetic error
Normally set to 0, this bit is set to 1 in the event of a capacity overflow if there is:
  • a result greater than + 32 767 or less than - 32 768, in integer (INT)
  • a result greater than + 65 535 or less than 0, in unsigned integer (UINT)
  • a result greater than + 2 147 483 647 or less than - 2 147 483 648, in double integer (DINT)
  • a result greater than +4 294 967 295 or less than 0, in double unsigned integer (UDINT)
  • real values outside limits
  • division by 0
  • the root of a negative number
  • stacking up of an already full register, emptying of an already empty register.
Rd/Wr
19
-
Task period overrun (periodical scanning)
Normally set to 0, this bit is set to 1 by the system in the event of a time period overrun (i.e., task execution time is greater than the period defined by the user in the configuration or programmed into the %SW word associated with the task). The user must reset this bit to 0. Each task manages its own %S19 bit.
Rd/Wr
20
-
Index overflow
Normally set to 0, this bit is set to 1 when the address of the indexed object becomes less than 0 or exceeds the number of objects declared in the configuration.
In this case, it is as if the index were equal to 0.
Test the user program after each operation where overflow may occur, then reset to 0 if there is indeed an overflow.
When the %S20 bit switches to 1, the application stops in error state if the %S78 bit has been to set to 1.
Rd/Wr
21
-
1st task scan in RUN
The bit %S21 indicates the first cycle of MAST task, including after a cold start with automatic start in run and a warm start.
%S21 is set to 1 at the start of the cycle and reset to zero at the end of the cycle.
30
-
Activation/deactivation of the master task
Normally set to 1. The master task is deactivated when the user sets the bit to 0. This bit is taken into consideration by the system at the end of each MAST task cycle.
Rd/Wr
40
-
Local input/output fault
The %S40 bit is assigned to rack 0.
Normally set to 1, this bit is set to 0 when a fault occurs on the rack's I/Os. In this case:
  • the %S10 bit is set to 0
  • the I/O processor LED is on
  • the %Ir.m.c.Err module bit is set to 1
  • this bit is reset to 1 when the fault disappears
Rd
50
-
Updating of time and date via words %SW50…%SW53
Normally set to 0, this bit is set to 1 or 0 by the program or the terminal.
  • set to 0: update of system words %SW50…%SW53 by the date and time supplied by the PLC real-time clock
  • set to 1: system words %SW50…%SW53 are no longer updated, therefore making it possible to modify them
The switch from 1 to 0 updates the real-time clock with the values entered in words %SW50…%SW53.
Rd/Wr
51
-
Time loss in real-time clock
The system-managed bit set to 1 indicates that the real-time clock is missing or that its system words (%SW50…%SW53) are meaningless. In this case, the clock must be reset to the correct time.
Rd
59
-
Incremental update of the time and date via word %SW59
Normally set to 0, this bit can be set to 1 or 0 by the program or the terminal:
  • set to 0: the system does not manage the system word %SW59
  • set to 1: the system manages edges on word %SW59 to adjust the date and current time (by increment)
Rd/Wr
66
-
Application backup
This bit is set to 1 by the user to start a backup operation. The system will detect the rising edge to start the backup. The state of this bit is polled by the system every second. A backup takes place only if the application in RAM is different from the one in the flash.
This bit is set to 0 by the system when the backup is finished.
Warning:Before creating a new backup by setting bit %S66 to 1, you must test that bit %S66 has been set to 0 by the system (which means the previous backup is finished). Never use %S66 if it is set to 1. This may lead to a loss of data.
Bit %S66 is particularly useful after replacement of initial value %S94 and save parameters.
Rd/Wr
78
-
Stop in the event of error
Normally at 0, this bit can be set to 1 by the user, to program a PLC stop on application fault: %S15, %S18, %20.
Rd/Wr
80
-
Reset message counters
Normally set to 0, this bit can be set to 1 to reset the message counters %SW80 to %SW86.
Rd/Wr
94
-
Saving adjustment values
Normally at 0, this bit can be set to 1 by the user to replace the initial values of the declared variables with a ‘Save’ attribute (For example, DFB variables) with the current values.
The system resets the bit %S94 to 0 when the replacement is made.
NOTE: This bit must be used with care: do not set this bit permanently to 1 and use the master task only.
Rd/Wr
97
-
Backup program OK
This bit compares the application as executed in RAM versus the internal backup saved to flash. Values are:
0: application backup not consistent. This state is obtained when application is auto modified (saveparam or replace init value) and not saved using %S66.
1: application backup is consistent
Rd/Wr
116
-
global Ethernet port status
0: both Ethernet port link down
1: at least one port link up
Rd
118
-
CanOpen IO errors
Normally at 1, this bit is at 0 on detection of a fault in a device on CANopen
Rd
%SW
Bit
Function
Rd/Wr
0
-
Master task scanning period
This word is used to modify the period of the master task via the user program or via the terminal.
The period is expressed in ms (1...255 ms) %SW0=0 in cyclic operation.
On a cold restart: it takes the value defined by the configuration.
Rd/Wr
6
-
IP Address LOW
Rd
7
-
IP Address HIGH
Rd
10
-
Task init First cycle after cold start
If the value of the current task bit is set to 0, it means that the task is performing its first cycle after a cold start.
  • %SW10.0: assigned to the MAST task.
Rd
11
-
Watchdog duration
Reads the duration of the watchdog. The duration is expressed in milliseconds (10...1500 ms).
This word cannot be modified.
Rd
12
-
Modbus slave address for terminal port
Gives the Modbus slave address of the CPU serial port. Modification is not taken into account. it is 0 if the CPU does not have a Serial Port link.
Rd
14
-
Commercial version of PLC processor
This word contains the current Operating System (OS) version of the PLC processor.
Example: 16#0135
version: 01
issue number: 35
Rd
15
-
PLC processor patch version
This word contains the commercial version of the PLC processor patch.
It is coded onto the least significant byte of the word.
Coding: 0 = no patch, 1 = A, 2 = B...
Example: 16#0003 corresponds to patch C.
Rd
16
-
Firmware version number
This word contains the Firmware version number in hexadecimal of the PLC processor firmware.
Example: 16#0011
version: 2.1
VN: 17
Rd
17
-
Error status on floating operation
When an error in a floating arithmetic operation is detected, bit %S18 is set to 1 and %SW17 error status is updated according to the following coding:
  • %SW17.0 = Invalid operation / result is not a number
  • %SW17.1 =Denormalized operand / result is acceptable (flag not managed by Modicon M340 or Quantum Safety PLCs)
  • %SW17.2 = Division by 0 / result is infinity
  • %SW17.3 = Overflow / result is infinity
  • %SW17.4 = Underflow / result is 0
  • %SW17.5 to 15 = not used
This word is reset to 0 by the system on cold start, and also by the program for re-usage purposes.
Rd/Wr
18, 19
-
Absolute time counter
%SW18 represents the least significant bytes and %SW19 the most significant bytes of the double word %SD18, which is incremented by the system every 1/10th of a second. The application can read or write these words in order to perform duration calculations.
%SD18 is incremented systematically, even in STOP mode and equivalent states. However, times when the PLC is switched off are not taken into account, since the function is not linked to the real-time scheduler, but only to the real-time clock.
For Quantum safety PLC, knowing that the 2 processors must process exactly the same data, the value of %SD18 is updated at the beginning of the mast task, and then frozen during the application execution.
Rd/Wr
20
-
1 ms counter low
Rd
21
-
1 ms counter high
Rd
23
-
Rotary switch value
Rd
7...0
Rotary switch value(Ethernet role name)
Rd
8
Rotary switch change since power up
Rd
9
Rotary switch error
Rd
26
-
Number of requests processed
This system word allows to verify on server side the number of requests processed by PLC per second.
Rd/Wr
27, 28, 29
-
System overhead time
  • %SW27 is the last system overhead time.
  • %SW28 contains the maximum system overhead time.
  • %SW29 contains the minimum system overhead time.
The system overhead time depends on the configuration (number of I/O) and on the current cycle requests (communication, diagnostics).
System overhead time = Mast Cycle Time - User code execution time.
This can be read and written by the user program or by the terminal.
Rd/Wr
30
-
Master task execution time
This word indicates the execution time of the last master task cycle (in ms).
Rd/Wr
31
-
Maximum master task execution time
This word indicates the longest master task execution time since the last cold start (in ms).
Rd/Wr
32
-
Minimum master task execution time
This word indicates the shortest master task execution time since the last cold start (in ms).
Rd/Wr
49…53
-
Real-time clock function
System words containing date and current time (in BCD):
  • %SW49: day of the week:
    • 1 = Monday
    • 2 = Tuesday
    • 3 = Wednesday
    • 4 = Thursday
    • 5 = Friday
    • 6 = Saturday
    • 7 = Sunday
  • %SW50: Seconds (16#SS00)
  • %SW51: Hours and Minutes (16#HHMM)
  • %SW52: Month and Day (16#MMDD)
  • %SW53: Year (16#YYYY)
These words are managed by the system when the bit %S50 is set to 0.
These words can be written by the user program or by the terminal when the bit %S50 is set to 1.
For M580:
The current time is in UTC (Coordinated Universal Time). If a local time is needed, use the RRTC_DT function.
Rd/Wr
54…58
-
Real-time clock function on last stop
System words containing date and time of the last power failure or PLC stop (in Binary Coded Decimal):
  • %SW54: Seconds (00SS)
  • %SW55: Hours and Minutes (HHMM)
  • %SW56: Month and Day (MMDD)
  • %SW57: Year (YYYY)
  • %SW58: the most significant byte contains the day of the week (1 for Monday through to 7 for Sunday), and the least significant byte contains the code for the last stop:
    • 1 = change from RUN to STOP by the terminal or the dedicated input
    • 2 = stop by watchdog (PLC task or SFC overrun)
    • 4 = power outage or memory card lock operation
    • 5 = stop on hardware fault
    • 6 = stop on software fault. Details on the type of software fault are stored in %SW125
Rd
59
-
Adjustment of current date
Contains two 8-bit series to adjust the current date.
The action is always performed on the rising edge of the bit.
This word is enabled by bit %S59=1.
Rd/Wr
70
-
Week of year
System word containing the number of the week in the year: 1…52 (in BCD).
Rd
76
-
Diagnostics function: recording
Result of the last registration
= 0 if the recording was successful
= 1 if the diagnostics buffer has not been configured
= 2 if the diagnostics buffer is full
Rd/Wr
77
-
Diagnostics function: non-recording
Result of the last de-registration
= 0 if the non-recording was successful
= 1 if the diagnostics buffer has not been configured
= 21 if the error identifier is invalid
= 22 if the error has not been recorded
Rd/Wr
78
-
Diagnostics function: number of errors
Number of errors currently in the diagnostics buffer.
Rd
80, 81
-
Message management
These words are updated by the system, and can also be reset using %S80.
  • %SW80: Number of message sent by the system to the terminal port (Modbus serial port)
  • %SW81: Number of message received by the system to the terminal port (Modbus serial port).
Rd
84, 85
-
Message send to USB
These words are updated by the system, and can also be reset using %S80.
  • %SW84: Number of messages sent to the USB port
  • %SW85: Number of messages received by the USB port.
Rd
86
-
Modbus exception messages
This word is updated by the system, and can also be reset using %S80.
  • Number of messages refused by the system, not treated because of lack of resources for example. If the message is refused by Modbus Server then it corresponds to Modbus exception messages, sent by the CPU to the remote Modbus client.
87
-
Communication flow management
Number of requests processed by synchronous server per master (MAST) task cycle.
The requests processed may come from all communication ports.
90
-
Maximum number of requests processed per master task cycle
N=4(minimum 2, maximum 4 + 4 = 8)
Rd/Wr
94, 95
-
Application modification signature
These two words contain a 32-bit value that changes at every application modification except when:
  • updating upload information
  • replacing the initial value with the current value
  • saving the parameter command
Rd
96
-
Command and Diagnostic of Save and Restore
Rd/Wr
108
-
Forced bit counting status register
Word %SW108:
  • increments each time an discrete bit (%I,%Q or %M) is forced
  • decrements each time an discrete bit is unforced
Rd
124
-
Type of processor or system error
The last type of system fault encountered is written into this word by the system (these codes are unchanged on a cold restart):
  • 16#30: system code fault
  • 16#53: time-out fault during I/O exchanges
  • 16#60 to 64: stack overrun
  • 16#65: Fast task period of execution is too low
  • 16#81: detection of backplane error
NOTE: If this error is detected, all racks have to be re-initialized.
  • 16#90: Detected Internal system error: Unexpected interruption
Rd
125
-
Last fault detected
The code of the last fault detected is given in this word. The following error codes cause the PLC to stop if %S78 is set to 1.
%S15, %S18 and %S20 are always activated independently of %S78:
  • 16#2258: execution of HALT instruction
  • 16#DE87: calculation error on floating-point numbers (%S18, these errors are listed in the word %SW17)
  • 16#DEB0: Watchdog overflow (%S11)
  • 16#DEF0: division by 0 (%S18)
  • 16#DEF1: character string transfer error (%S15)
  • 16#DEF2: arithmetic error; %S18
  • 16#DEF3: index overflow (%S20)
NOTE: The following codes 16#8xF4, 16#9xF4, and -16#DEF7 indicate an error on Sequence Function Chart (SFC).
Rd
126…127
-
Blocking error instruction address
Address of the instruction that generated the application blocking error.
  • %SW126 contains the least significant word for this address
  • %SW127 contains the most significant word for this address
For a system STOP due a watchdog overflow:
  • %SW126 contains the number of the MAST task with the overflow
  • %SW127 contains the value of the MAST task with the overflow
Rd
128
-
IP Netmask low
Rd
129
-
IP Netmask high
Rd
130
-
IP Gateway low
Rd
131
-
IP Gateway high
Rd
132
-
MAC address low
Rd
133
-
MAC address medium
Rd
134
-
MAC address high
Rd
135
-
FDR Client Status
0 = not initialized 1 = IP initialized 3= link ETH down 4= IP duplicate 5 = Wait for server 6= no conf or conf error 7= configuration conflict
Rd
136
-
RSTP status
Rd
2...0
Eth port 1 RSTP port role (0=none, 1 = alternate , 2=backup, 3=root, 4= designated, 5=non-RSTP port)
Rd
5…3
Eth port 2 RSTP port role
Rd
137
-
P502 opened connection nbr server mode
Rd
138
-
P502 opened connection nbr client mode
Rd
146
-
Communication status of Master
Rd
1
= 1: FIFO full cause message lost
2
= 1: CAN controller BUS OFF
3
: Reserved
4
= 1: CAN controller is warning status
5
= 1: Overflow of the low priority emission queue. The CANopen Master transmits "Heartbeat" and "Node guarding" messages as well as SSDOs and CSDOs via the low priority transmission queue.
6
= 1: Overflow of the high priority reception queue. The CANopen Master receives RPDOs, NMT commands, the message Sync and emergency messages via the high priority reception queue.
7
= 1: Overflow of the high priority transmit queue. The CANopen Master sends TPDOs, NMT commands, the message Sync and emergency messages via the high priority queue.
147
-
Status of CANopen Master
Rd
-
= 0x00 INIT: The CANopen Master is not initialized. This corresponds to the INITIALISATION status of the CANopen module. In this state, the CANopen Master cannot communicate with the network.
-
= 0x40 RESET: The CANopen Master is configured as master during NMT STARTUP. The object dictionary of CANopen Master can be configured by SDOs via the CAN bus and the interface of the SDO command. The application has read/write access rights to the object
-
= 0x60 NET INIT: Start-up according to CIA DSP-302. The CANopen Master checks the allocation of the slaves.
-
= 0x61 NET RESET: The network is re-initialized by the NMT command RESET COMMUNICATION ALL NODES.
-
= 0x62 NET WAIT: The CANopen Master waits (waiting time be defined) to allow the modules to run the command RESET COMMUNICATION.
-
= 0x64 BOOT CONF: The CANopen Master initializes modules according to CIA DSP-302 by scanning the network.
-
= 0x8x CLEAR: The network is scanned. The Master is waiting for a start command (START CANopen MASTER/MANAGER or START NETWORK).
-
= 0xAx RUN: The network is in the OPERATIONAL state.
-
= 0xCx STOP: The network is in the STOP state.
-
= 0xEx PREOPERATIONAL: The network is in the PREOPERATIONAL state.
-
= 0x9x FATAL ERROR: The CANopen Master is inoperative and must be re-initialized.
148
-
Event indicator
Rd
0
= 1: This bit is always set when a detected error has occurred in communication with the network. The communication status of CANopen Master gives the exact reason. (The CANopen Master is unable to run correctly and stops).
1
= 1: A module is using the node number of CANopen Master. (The CANopen Master is unable to run correctly and stops).
2…3
: Reserved
4
= 1: There is a detected identity error for an optional module. The boot slave process is repeated.
5...6
: Reserved.
7
= 1s: This bit is set if a bit in one of the bit lists changes.
8
= 1: At the beginning of the start-up procedure, the CANopen Master checks the individual slave assignments. This bit is set by the slave assignment if a module that contain features which are not supported by the CANopen Master (for example, bit 4 to bit
9
= 1: The CANopen Master has received an RPDO with not enough data bytes. (The CANopen Master does not change its state.)
10
= 1: Inconsistent or mismatch DCF bit.
11
: Reserved.
12
= 1: The last Master/Manager cycle time is greater than 256 ms.
13
= 1: The Master is the only CAN device on the network. It gets no acknowledgment to its transmitted frames. All nodes are marked as absent. The Master keeps its state until the ““alone”” situation is released.
14...15
: Reserved
149
-
Master Command Information
Rd/Wr
2
: Reset bit 7 (change bit list) of event indicator (%SW148)
3
: Reset all the bus analysis information (%SW155...%SW159, %SW176...%SW177)
5
: Reset the CANopen master
150
-
SDO Abort code low
Rd/Wr
151
-
SDO Abort code high
Rd/Wr
152
-
CANopen Node number
Rd/Wr
153
-
CANopen Index
Rd/Wr
154
-
CANopen Sub-index
Rd/Wr
155
-
CANopen Error A: Number of bits erro
Rd/Wr
156
-
CANopen Error B: Number of form error
Rd/Wr
157
-
CANopen Error C: Number of stuff error
Rd/Wr
158
-
CANopen Error D: Number of other errors
Rd/Wr
159
-
CANopen Error E: Last error code capture register: this register contains information about type and location of errors on the bus
Rd/Wr
160
-
Local IO health
bit 0: reserved
bit 1: 0 in case of error on HSC, else 1
bit 2: 0 in case of error on DDM, else 1
bit 3: 0 in case of error on AMI, else 1
Rd/Wr
168
-
CANOpen List of Assigned but configured slaves
Rd
169
-
CANOpen List of Configured Slaves
Rd
170
-
CANOpen List of Slaves with configuration faults
Rd
171
-
CANOpen List of Inoperative Slaves
Rd
172
-
CANOpen List of Operational Slaves
Rd
173
-
CANOpen List of Stopped slaves
Rd
174
-
CANOpen List of Pre-operational slaves
Rd
175
-
Number of CANOpen transmitted messages
Rd
176
-
Number of CANOpen received messages
Rd
177
-
Current CANOpen master cycle time
Rd
178
-
CANOpen master maximum execution time
Rd
179
-
CANOpen master minimum execution time
Rd
180
-
CANOpen master assigned cycle time
Rd/Wr
181
-
Ethernet Port 0 Rx Bad Frames Counter
Rd
182
-
Ethernet Port 0 Collisions Counter
Rd
183
-
Ethernet Port 0 In Filtered Counter
Rd
184
-
Ethernet Port 1 Rx Bad Frames Counter
Rd
185
-
Ethernet Port 1 Collisions Counter
Rd
186
-
Ethernet Port 1 In Filtered Counter
Rd
187
-
RSTP Topology Change Counter
Rd