Expected M255.5 behavior
It is not a one-scan pulse.
Clock-memory bits run asynchronously to the CPU scan. During a long scan, M255.5 can change state more than once. Do not treat its sampled state as proof that exactly one second elapsed.
Separate confirmed behavior from possible faults
| Observation | Engineering interpretation | Check |
|---|---|---|
| Count increases repeatedly while M255.5 is ON | Level logic is probably counting once per scan instead of once per rising edge. | Monitor M255.5 and the counter trigger together. |
| M200.0 already provides the required positive edge | A second edge bit such as M200.2 is redundant and may complicate the sequence. | Use one edge result consistently. |
| Edge behavior is inconsistent | The edge-storage marks may be reused or overwritten elsewhere. | Search for all accesses to the relevant M100 and M200 areas, including byte and word writes. |
Correct the counting logic
- Confirm in the hardware configuration that clock memory is enabled and assigned to MB255.
- Use the existing positive-edge result M200.0 to trigger the seconds counter. Do not increment the counter directly from the level of M255.5.
- Remove the duplicate M200.2 edge function if it performs the same job as M200.0.
- Check the complete program for repeated edge-storage marks and for byte or word operations that include MB100 or MB200. Such writes can overwrite individual edge bits.
Verify the repair
Use a variable table to observe M255.5, M200.0, M200.2 if retained, and the seconds counter simultaneously.
If the edge mark changes unexpectedly, trace every write to its containing byte or word before changing the hardware configuration. The evidence does not identify a CPU model, firmware version, or instruction identifier, so validate the final implementation against the project’s actual platform.
FAQ
Why does Siemens M255.5 make my seconds counter run fast?
If the counter uses its level directly, it can increment on every CPU scan during that interval; trigger the counter from the positive edge instead.
What timing does M255.5 provide when MB255 is clock memory?
The clock memory operates asynchronously to the CPU scan.
Why can a Siemens edge-detection mark behave incorrectly?
The storage mark may be reused or overwritten by another bit, byte, or word operation. Monitor it in a variable table and search all accesses to its containing M100 or M200 area.