# Soft Elements and Special Relays Use this reference for Xinje XD/XL/XG soft-element questions, especially `SM0`, `SM2`, the common misconception around `M8000`, special auxiliary relays, special data registers, and soft-element allocation tables. Source priority: - Xinje official download center, `XD、XL系列可编程控制器用户手册【基本指令篇】`, version 1.6.1, updated 2026-06-26. - Xinje official download center, `XG系列PLC用户手册【基本指令篇】`, version 1.0, updated 2024-12-16. - When exact ranges differ by PLC model, ask for the specific CPU model and check the model's soft-element table in the original PDF. ## M8000 Clarification and SM0 Naming For current Xinje XD/XL/XG documentation, the always-on run bit is documented as `SM000` / `SM0`, not `M8000`. Important accuracy rule: do not state that `M8000` exists as a Xinje XD/XL/XG special relay, and do not state that `M8000 = SM000`. The bundled XD/XL and XG basic-instruction manuals document `SM000` as the PLC running always-ON coil. They do not define `M8000` as a run-state bit. If XDPPro or a project accepts an address such as `M8000`, treat it as a normal `M` auxiliary relay address if that address is within the model's valid `M` range. It is then user logic memory, not a system always-ON relay. A normal `M` coil only has the value written by the program/HMI/monitoring operation. Use these Xinje XD/XL/XG devices instead: | Need | Use | Meaning | |---|---|---| | PLC running always-ON | `SM000` / `SM0` | ON while PLC is in RUN. | | PLC running always-OFF | `SM001` / `SM1` | OFF while PLC is in RUN. | | First scan ON pulse | `SM002` / `SM2` | ON only during the first scan after PLC starts running. | | First scan OFF pulse | `SM003` / `SM3` | OFF only during the first scan after PLC starts running. | The XG manual contains an old XC-series communication example using `M8002`, but the XG special auxiliary relay appendix itself lists `SM000` through `SM003` for run and first-scan states. Treat those `M800x` appearances as example/migration residue, not as XD/XL/XG special-relay definitions. ## Core Soft Elements | Element | Purpose | Key notes | |---|---|---| | `X` | Input relay | Physical input points. X/Y addresses use octal-style numbering such as `X0~X7`, `X10~X17`. Expansion modules commonly start from `X10000`, BD from `X20000`, ED from `X30000`, depending on model. | | `Y` | Output relay | Drives external loads. Y addresses also use octal-style numbering. Extra internal Y points beyond physical outputs may be usable as normal internal coils/contacts. | | `M`, `HM` | Auxiliary relay | Internal relay bits only; they do not read external inputs or directly drive loads. `HM` is retentive. If an address like `M8000` is valid on the selected model, treat it as this ordinary `M` memory area, not as a special run-state relay. | | `SM` | Special auxiliary relay | System/special bit. Use for run state, first-scan pulse, clock pulses, communication status, error flags, etc. Avoid using as ordinary memory unless the manual marks it available. | | `S`, `HS` | State relay | Used for step ladder / process steps. If not used as step numbers, they can act like normal contacts/coils. `HS` is retentive. | | `T`, `HT` | Timer | Timers support 1 ms, 10 ms, and 100 ms time bases depending on timer range. Accumulative timers retain current value while the drive input is off; non-accumulative timers clear when drive input is off. | | `C`, `HC` | Counter | Internal counters are scan-cycle based; high-speed counters are assigned to specific input points and work independently of PLC scan cycle. | | `D`, `HD` | Data register | 16-bit data registers. Adjacent registers can be combined for 32-bit and 64-bit operations. `HD` is retentive. | | `SD`, `HSD` | Special data register | System/special word register. Use for scan time, clock, communication results, error codes, module state, and other system data. | | `FD`, `SFD` | FlashROM register | Retentive Flash storage. Frequent writes can wear Flash; avoid high-frequency writes. `SFD` contains special Flash parameters. | | `FS` | Secret register | Flash-backed register intended for IP protection. It can be written but cannot be read back normally; read returns 0. Commonly `FS0~FS47`, but verify online by model. | ## Addressing Rules To Remember - `X` and `Y` use octal-style point numbering in the base unit, for example `Y0~Y7`, `Y10~Y17`. - `M`, `HM`, `S`, `HS`, `T`, `HT`, `C`, `HC`, `D`, `HD`, `FD`, `FS`, `SM`, and `SD` use decimal numbering unless a specific table says otherwise. - A word can be built from 16 continuous bit elements by prefixing `D`: `DM10` means the 16-bit word made from `M10~M25`; `DY0` means the 16-bit word made from `Y0~Y17`. - Timer/counter identifiers can act as either bit contacts/coils or word current values depending on the instruction. Example concept: `LD T11` treats `T11` as a bit contact; `MOV T11 D0` treats it as the timer current-value word. - Register bit addressing uses `Dn.m`, where `m` is the bit index. The manual describes `0 <= m <= 63`; in practice, confirm instruction width and target model. - Offset addressing uses forms like `D10[D0]`, `Y0[D0]`, or `DX2[D0]`. Only XDH/XLH support `SFD` offset addressing in the referenced XD/XL manual. ## Frequently Used Special Auxiliary Relays Initial/run state: | Device | Function | |---|---| | `SM000` | PLC running always-ON coil. | | `SM001` | PLC running always-OFF coil. | | `SM002` | Initial positive pulse; ON only during the first scan cycle after PLC starts running. Use for one-shot initialization. | | `SM003` | Initial negative pulse; OFF only during the first scan cycle after PLC starts running. | | `SM004` | PLC runtime error indication; supported on firmware V3.4.5 and above in the referenced XD/XL manual. | | `SM005` | Low battery alarm on supported non-EtherCAT bus models. | Clock pulses: | Device | Function | |---|---| | `SM011` | 10 ms cycle pulse. | | `SM012` | 100 ms cycle pulse. | | `SM013` | 1 s cycle pulse. | | `SM014` | 1 minute cycle pulse. | Arithmetic flags: | Device | Function | |---|---| | `SM020` | Zero flag; ON when add/subtract result is 0. | | `SM021` | Borrow flag; ON on lower-limit overflow. | | `SM022` | Carry flag; ON on upper-limit overflow. | PC/mode and step flags: | Device | Function | |---|---| | `SM030` | PLC initialization / restore factory setting. Treat as potentially destructive. | | `SM032` | Clear retentive storage for `HM`, `HS`, `HT`, `HC`, `HD`. Treat as potentially destructive. | | `SM034` | Disable all outputs. The software may still show pulse changes, but actual outputs are inhibited. | | `SM040` | Step process executing flag. | Interrupt and high-speed counter groups: - `SM050~SM069`: disable input interrupts. - `SM070~SM089`: disable timer interrupts. - `SM090`: disable all interrupts. - `SM099`: high-speed ring counter enable; when ON, `SD099` increments every 0.1 ms and cycles 0 to 32767. - `SM100~SM109`: HSC0, HSC2, ... HSC18 100-segment count-completion flags. - `SM110~SM119`: HSC0, HSC2, ... HSC18 direction flags. - `SM120~SM129`: HSC0, HSC2, ... HSC18 error flags. - `SM130~SM139`: HSC0, HSC2, ... HSC18 overflow flags. Communication groups: - `SM140~SM193`: serial-port communication status. - For each port group, Modbus executing, X-NET executing, free-format sending, and free-format receive-complete flags repeat by port. - Example pattern: serial port 0 uses `SM140` Modbus executing, `SM141` X-NET executing, `SM142` free-format sending, `SM143` free-format receive complete. Error flags: | Device | Function | |---|---| | `SM400` | I/O error. | | `SM401` | Expansion module communication error. | | `SM402` | BD/ED communication error. | | `SM403` | FROM/TO instruction error flag. | | `SM404` | PID instruction error flag. | | `SM405` | No user program / internal code checksum error. | | `SM406` | User program error. | | `SM407` | SSFD checksum error. | | `SM408` | Memory error; cannot erase or write Flash. | | `SM409` | Operation/arithmetic error. | | `SM410` | Offset overflow error; offset exceeds soft-element range. | | `SM411` | FOR-NEXT overflow error. | | `SM413` | Encryption verification error. | | `SM414` | Flash register data error. | | `SM415` | RTC time/date verification failed. | ## Frequently Used Special Data Registers | Device | Function | |---|---| | `SD005` | Battery voltage display register. On supported models, 3.1 V displays 100; below 2.5 V displays 0. | | `SD010` | Current scan cycle, unit 100 us. | | `SD011` | Minimum scan time, unit 100 us. | | `SD012` | Maximum scan time, unit 100 us. | | `SD013~SD019` | Clock data: second, minute, hour, day, month, year, weekday. | | `SD020~SD031` | Model/version information and applicable host software version fields. | | `SD040` | Current executing step `S` number. | | `SD099` | High-speed ring counter value, enabled by `SM099`. | | `SD100~SD109` | Current HSC segment for HSC0, HSC2, ... HSC18. | | `SD120~SD129` | HSC error information for HSC0, HSC2, ... HSC18. | | `SD140~SD199` | Communication results. `SD140` is Modbus read/write result for serial port 0 in the referenced XD/XL manual. | | `SD400~SD414` | Detailed error types corresponding to `SM400~SM414`. | | `SD500~SD516` | Expansion module / BD / ED status. | ## SFD Flash Parameters Use `SFD` carefully: values often affect hardware behavior, some require power cycle, and Flash writes should not be frequent. - `SFD0*`: input filter time, default 10 ms. - `SFD2*`: watchdog action time, default 200 ms. - `SFD3*`: special function configuration word; supported from firmware V3.4.6b in the referenced XD/XL manual. - `SFD320~SFD329`: HSC multiplier settings for HSC0, HSC2, ... HSC18. - `SFD330`: 100-segment HSC absolute/relative selection bits. - `SFD331`: 100-segment HSC interrupt loop bits. The `*` marker in the manual means the setting requires PLC power cycle to take effect. ## Answering Checklist When a user asks about `M8000`, special relays, or soft elements: 1. Clarify PLC series if it affects the exact table: XD, XL, XG, XC, XDQ/XLQ, or XS. 2. For XD/XL/XG, answer that `M8000` is not a documented special relay and is not equivalent to `SM000`/`SM0`. If the software accepts `M8000`, treat it as ordinary `M` auxiliary relay memory within the valid model range. 3. Use `SM002`/`SM2` for one-time initialization at first scan. 4. Warn before suggesting `SM030`, `SM032`, SFD writes, output disable, forced outputs, online changes, or any operation that changes machine state. 5. For model-specific address ranges, check the original PDF soft-element table instead of guessing.