Troubleshooting
Why MC_Home Absolute Encoder Adjustment Is Lost After Power Cycle
Short answer
The MC_Home offset is stored retentively in the CPU technology object, not in the encoder, so it survives a power cycle only when the TO encoder type is Absolute, MC_Home reported Done = TRUE, and nothing cleared retentive memory in between. Mode 6 is relative, so Position = 0.0 correctly changes nothing; use Mode 7 for an absolute adjustment.

On this page
When an absolute encoder adjustment made with MC_Home disappears after a CPU power cycle, the encoder is almost never at fault. The offset is stored retentively in the CPU technology object (TO), not written into the encoder, and it survives a restart only under three conditions: the TO's encoder type is Absolute, MC_Home finished with Done = TRUE, and nothing between the adjustment and the restart cleared retentive data or reinitialized the TO. Work through the causes below in order; each one has a confirming check.
Mode 6 doing nothing is expected behavior #
MC_Home Modes 6 and 7 differ only in how they interpret the Position input. Mode 6 (absolute encoder adjustment, relative) computes current position + Position. Mode 7 (absolute encoder adjustment, absolute) writes Position directly. A Mode 6 call with Position = 0.0 adds zero and therefore changes nothing; that is correct arithmetic, not a rejected job. For a proximity-switch home that defines the current location as zero, use Mode 7.
Cause 1: the TO is not parameterized as absolute #
On an External Encoder TO, the encoder type must be set to Absolute (or Cyclic absolute when the traversing range exceeds the encoder range). If the sensor is declared incremental, the TO has no persistent reference to preserve and the adjustment behaves as a volatile setpoint that dies with the power cycle.
Confirming check: open the TO configuration under the encoder/hardware interface section and read the encoder type field. While there, verify the increments per revolution, number of revolutions and code type against the encoder datasheet, and the load gear ratio and inversion under the mechanics parameters. A wrong revolution count gives a position that is retained but scaled wrong; changing the mechanics after an adjustment invalidates the offset.
Cause 2: MC_Home never reported Done = TRUE #
A job that is aborted, started before MC_Power finished enabling the TO, or started before the encoder value is valid, does not latch the offset. The position may look briefly correct and then revert.
Confirming check: in a watch table, trigger the Mode 7 job and confirm Done = TRUE in the same cycle sequence, not just by watching the position. If Error = TRUE, latch ErrorID and ErrorInfo and decode them against the Motion Control error list for your firmware version. The Siemens documentation for absolute value adjustment on S7-1500/S7-1500T describes the stored offset value under the TO status structure; if it reads zero after a supposedly successful adjustment, the job never completed.
Two coding rules prevent a false negative. Do not drop Execute before Done or Error has been evaluated, and latch the outputs so a one-shot call cannot hide a completed job:
// SCL example; tags declared as: homeReq, proxBit_prev, homeExec,
// homeDone, homeError : Bool := FALSE; homeErrID : Word := 16#0000
#homeReq := #proxBit AND NOT #proxBit_prev AND #encEnabled;
#proxBit_prev := #proxBit;
IF #homeReq THEN
#homeExec := TRUE;
END_IF;
"MC_Home_DB"(Axis := "ExtEnc_1",
Execute := #homeExec,
Position := 0.0,
Mode := 7,
Done => #homeDone,
Error => #homeError,
ErrorID => #homeErrID);
IF #homeDone OR #homeError THEN
#homeExec := FALSE; // reset Execute only after Done/Error
END_IF;
These variable names are illustrative; MC_Home, Axis, Execute, Position, Mode, Done, Error and ErrorID are the documented instruction names. The test that proves the fix is the power-cycle sequence below, with Done observed true and the position surviving.
Cause 3: retentive data was cleared in between #
This is the classic signature: adjustment works, then vanishes on the next start. The usual culprits, cheapest to check first:
- A hardware or software download made after the adjustment, or a download with the retentive-data-erase option enabled. Re-run MC_Home after every download and make that a written commissioning step.
- Reinitializing the TO after a parameter change, which the engineering tool prompts for and which resets the absolute encoder adjustment.
- A CPU memory reset (MRES), reset to factory settings, firmware update or memory card replacement. These discard all retentive values, not just the encoder offset; if other retentive tags also reverted, this is your cause.
Confirming check: ask what happened to the CPU between the adjustment and the restart. If nothing did, and other retentive data survived, the offset loss is not a retention problem and you are back at Cause 1 or 2.
Cause 4: the position is retained but not what you expect #
If the position survives the restart yet is a modulo-shifted or scaled version of the expected value, the offset is intact. Check whether modulo is active on the TO; with modulo on, the home position value must lie inside the modulo range. Check whether the shaft moved while the CPU was off beyond the multiturn traversing range, which overflows the raw encoder value. Both are parameterization issues, corrected before the next adjustment, not after.
Verification procedure #
Run this once, recording every step:
- Power the CPU, enable the TO with MC_Power, confirm Status = TRUE and Error = FALSE.
- In a watch table, note the raw position before homing.
- Trigger MC_Home Mode 7 with Position = 0.0 and confirm Done = TRUE. If Error = TRUE, stop and decode ErrorID.
- Confirm the position reads 0.0 and the homed status bit is set.
- Rotate the shaft by hand to a non-zero value, for example 0.5, and record it.
- Download nothing. Power-cycle the CPU.
- After restart, re-enable the TO and read the position before any homing job runs.
It must read approximately 0.5 with the homed status bit already set. If it reads the raw encoder value instead, the offset was never stored: fix Cause 1 or 2 and repeat. If it reads 0.5 only after a re-run of MC_Home, look again at Cause 3. For the separate problems of an absolute encoder alarm rather than a lost offset, see clearing an absolute system down alarm on a servo drive or capturing serial absolute encoder data at machine startup.
Questions asked
Why does MC_Home Mode 6 seem to do nothing on my absolute encoder?
Mode 6 is the relative adjustment: the resulting position is the current position plus the Position input. With Position = 0.0 the sum is unchanged, so the axis behaves exactly as commanded. Use Mode 7 when you want the current shaft location to become a defined value.
Does the home offset get written into the encoder itself?
No. The encoder always reports its own raw absolute value; the technology object adds an offset held in CPU retentive memory. That is why a memory reset or a retentive-clearing download loses the adjustment even though the encoder hardware is fine.
My position survives the restart but is wrong by a fixed factor. What is that?
That points to encoder parameterization, not the offset: the increments per revolution, number of revolutions or code type in the technology object does not match the encoder datasheet, or the gearbox ratio changed after the adjustment. Correct the parameters, then re-run the Mode 7 adjustment.
