AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Writing an external encoder gear ratio: what persists, what activates

Servo and stepper motion Published 7 min read By AutomateDirectUSA engineering team

Short answer

Save the gear ratio with MC_BR_ProcessConfig and the mcCFG_ACP_EXT_ENC_AX_MECH_ELM datatype and it survives a restart but activates only at that restart. Write it with MC_BR_ProcessParam and it works immediately but is lost at restart. Save first, then load the saved configuration with mcPPM_LOAD_FROM_CONFIG to get both, and set the datatype to the external-encoder mechanical elements, not the real-axis ones.

On this page
  1. Saved configuration and active data are two different targets
  2. The datatype has to be the external-encoder one
  3. What Input and Output mean on the external encoder
  4. The write that survives a restart, step by step
  5. Checking that the new ratio really took
  6. Versions, and the component that looks relevant but is not
  7. Which route fits which job
  8. Questions asked

The external encoder's gear ratio lives in two layers of the drive, and writing one layer without the other is why a change either vanishes at restart or never seems to take effect at all. Save the ratio with MC_BR_ProcessConfig and it survives restarts but activates only at the next one. Write it with MC_BR_ProcessParam and it runs immediately but is gone at restart. Do both — save first, then load the saved configuration into active data with mcPPM_LOAD_FROM_CONFIG — and the new Input/Output rotations take effect right away and stay. Both writes must address the external-encoder mechanical elements through the datatype mcCFG_ACP_EXT_ENC_AX_MECH_ELM and a McCfgAcpExtEncAxMechElmType structure: the ordinary axis datatype does not reach the external encoder, and every member of the structure has to carry a valid value for the write to finish.

Saved configuration and active data are two different targets #

An ACOPOS external encoder axis carries its mechanical elements twice: once as saved configuration that the drive loads at startup, once as active parameter data it uses to scale counts right now. The two function blocks write different layers, and almost every confusion around this job starts with picking the wrong one.

MC_BR_ProcessConfig MC_BR_ProcessParam
What it writes Configuration data stored on the drive Active parameter data the drive is using
Survives a restart Yes No
Takes effect At the next restart, for the saved mechanical elements Immediately, where the datatype supports the operation
Commands Load, save, create Write, plus read and a configuration-load mode

MC_BR_ProcessConfig has no WRITE command, and that is deliberate: it edits a configuration structure and stores it, and it never touches live data. Its Done output confirms the transaction completed and nothing about what the drive is using this cycle. MC_BR_ProcessParam works the other layer: a write there changes active data without a restart, and its Done says nothing about persistence. For a side-by-side view of how the two blocks are wired, a walkthrough of the ProcessConfig versus ProcessParam setup covers the same pairing.

The axis in all of this is an external encoder axis, where the drive closes position on machine motion instead of motor motion; using a servo motor encoder as external machine feedback is the same arrangement built from a spare motor encoder.

Changing the ratio between two axes while both keep moving is a different job from rescaling one axis's feedback, and it belongs to a runtime gearing command rather than to either block; changing a servo axis gear ratio at runtime with MC_GearIn works that case on its own.

The datatype has to be the external-encoder one #

Both blocks address a structure through a datatype selector, and for the external encoder's mechanical elements that selector is mcCFG_ACP_EXT_ENC_AX_MECH_ELM with the structure McCfgAcpExtEncAxMechElmType. The axis configuration type behind MpAxisBasicConfig does not carry these members — it exposes mechanical elements only for the axis itself, which is why the ratio fields are missing there and the route runs through the ProcessConfig and ProcessParam blocks instead.

The real axis and the external encoder hold separate datatypes with separate write permissions. On one installation, a real-axis ratio write finished correctly with MC_BR_ProcessParam while the external-encoder write with the same block kept failing; selecting mcCFG_ACP_EXT_ENC_AX_MECH_ELM and testing that datatype explicitly is the check that tells the two apart.

Read the current structure before editing it, into a complete McCfgAcpExtEncAxMechElmType, and change only the two gearbox members, MechanicalElements.Gearbox.Input and MechanicalElements.Gearbox.Output. Every other member — the rotary-to-linear reference distance and the measurement resolution among them — keeps its existing value. Leaving the ReferenceDistance at 0.0 returned an error instead of Done in a reported test, so carry the configured value through untouched.

What Input and Output mean on the external encoder #

The gearbox pair maps revolutions on the mechanism's input side to revolutions on its output side, and reversing the pair scales every position and velocity the axis reports by the reciprocal. A syntactically valid write can therefore be physically wrong, and no error will say so.

Worked example, calculated for these inputs: the external encoder sits on the input side of a 10:1 gearbox, the load shaft is the output, and the engineer enters Gearbox.Input = 10 and Gearbox.Output = 1. The drive applies Output / Input, so one encoder revolution equals 1 / 10 = 0.1 output revolutions of load travel. Turn the load exactly one revolution and the encoder side turns 10 revolutions while the axis position reports 1.0 output revolutions.

Enter the same pair swapped, Gearbox.Input = 1 and Gearbox.Output = 10, and the drive assumes 10 / 1 = 10 output revolutions per encoder revolution. That is 10 / 0.1 = 100 times the true scale, so the accepted write reports position and velocity 100 times too fast. For a rotary axis whose commanded units are degrees, this pair is the entire unit decision; setting gear ratio for degree moves on a rotary servo axis works the same two numbers from the other side.

The write that survives a restart, step by step #

  1. Read or load the current external-encoder mechanical elements into a complete McCfgAcpExtEncAxMechElmType instance — a read with MC_BR_ProcessParam or a load with MC_BR_ProcessConfig. Editing a freshly declared structure risks clobbering the members the HMI never shows, including the reference distance the scale depends on.
  2. Copy the engineer's HMI entries into MechanicalElements.Gearbox.Input and MechanicalElements.Gearbox.Output after your own range and authorization checks, and never as zero: zero input revolutions make the ratio meaningless.
  3. Save with MC_BR_ProcessConfig. The values are now stored, they load at every startup from now on, and they are not yet active.
  4. Activate them either by restarting, which loads the saved mechanical elements, or by running MC_BR_ProcessParam with mcPPM_LOAD_FROM_CONFIG, which applies the saved configuration to active data straight away. Sequence matters: save first, load second — loading before saving pulls the old saved values back in.
  5. Read the structure back and jog a known mechanical revolution, as the next section lays out.

The write that changes active data straight away — the volatile half of the recipe, or the whole job when the next restart is coming anyway — looks like this, with example entries for the worked example above:

VAR
    MechElem        : McCfgAcpExtEncAxMechElmType;   // structure for mcCFG_ACP_EXT_ENC_AX_MECH_ELM
    FB_ProcessParam : MC_BR_ProcessParam;
END_VAR

// Example entries: gearbox input and output revolutions for this machine
MechElem.MechanicalElements.Gearbox.Input  := 10;
MechElem.MechanicalElements.Gearbox.Output := 1;

FB_ProcessParam.Component     := ADR(gAxis_1);
FB_ProcessParam.DataType      := mcCFG_ACP_EXT_ENC_AX_MECH_ELM;
FB_ProcessParam.DataAddress   := ADR(MechElem);
FB_ProcessParam.ExecutionMode := mcPPM_WRITE;
FB_ProcessParam.Execute       := TRUE;
FB_ProcessParam();
IF FB_ProcessParam.Done THEN
    FB_ProcessParam.Execute := FALSE;
END_IF

Time any restart under the machine's lockout procedure with everyone clear of the guarded space — the restart is the moment the drive's position scaling actually changes.

Checking that the new ratio really took #

Done on either block confirms the transaction, not the drive's state, so close the gap with three checks:

  • Read the structure back with the same block's read mode and compare the two gearbox members against what was sent. A mismatch means the write landed on the wrong datatype or on the wrong layer.
  • On the drive side, DriveLog inside MappCockpit exposes SCALE_ENCOD2_REV, which shows the external encoder's output gear — the output side only, not the two rotations as separate entries.
  • Jog a known mechanical revolution and compare the reported position against the ratio's prediction. If the axis runs the reciprocal of what the mechanics do, Input and Output are inverted; position and velocity inherit the same error, so one slow jog settles it.

A rejected write shows up in the block's Error output. An accepted-but-wrong write only shows up in the motion, which is why the jog outranks any status bit.

Versions, and the component that looks relevant but is not #

The function's documentation names MappMotion 5.16 as the minimum version, and a read-then-write test on MappMotion 5.29 completed correctly. Installed versions differ in practice: an Automation Studio 6.3.3.14 installation running MappMotion 6.4.1 completed the ProcessConfig save while the ProcessParam write to the external-encoder datatype kept failing, and a 6.5 build used in another test turned out to be a prerelease rather than a publicly available upgrade — treat that one as a test result, not a release to plan around.

Setting the McAcpPar component to a newer version changed nothing in these tests: McAcpPar supplies ACOPOS parameter constants and is not where the stored ratio lives, so leave it alone.

When a write is rejected, record four things before changing anything: the Automation Studio version, the MappMotion version, whether the target is simulation or hardware, and the Error output. Version numbers alone rarely explain a rejection; the datatype selector and the member values explain most of them.

Which route fits which job #

  • The change must survive power-ups and a restart is acceptable: save with MC_BR_ProcessConfig and let the restart activate it.
  • The change must run now and the machine restarts soon anyway on its own schedule: write with MC_BR_ProcessParam, and save the same values too unless the next restart is already planned.
  • The change must run now and stay: save with MC_BR_ProcessConfig, then load the saved configuration into active data with MC_BR_ProcessParam and mcPPM_LOAD_FROM_CONFIG — immediate and retained, no restart.
  • The write is rejected: check the datatype selector first, then the member values, then the installed MappMotion version against the documented 5.16 minimum, Error output in hand.
  • The write is accepted but motion reads wrong by a constant factor: the gearbox pair is inverted or the reference distance is wrong — correct the pair, save again, and re-verify with the jog.

Questions asked

Why does MC_BR_ProcessConfig have no WRITE command?

Because it works on the configuration layer, where writing live data is not an option. Its load, save and create commands edit the structure stored on the drive's CF card, and that stored data only becomes active when the drive loads it at startup. Writing active data without a restart is MC_BR_ProcessParam's job, which is why that block takes effect immediately but loses the change at restart.

What happens if I only write with MC_BR_ProcessParam and never save?

The axis runs with the new ratio until the next restart, then the previously saved configuration loads and the old ratio returns. That makes an unsaved change a delayed fault: the machine can behave correctly for days and revert at the next power-up with nothing in the error log. If you cannot save immediately, treat the change as temporary and reapply it after any restart until it is stored.

Does Done on the function block prove the drive accepted the values?

No. Done confirms the transaction between PLC and block finished; it says nothing about which layer now holds the values or whether the drive uses them. Check the block's Error output on any failed path, read the structure back with the same block's read mode and compare the gearbox members, then confirm the scaling itself with one known mechanical revolution.

Can the write be tested in simulation first?

The sequencing can. A simulation pass proves the program logic — structure handling, datatype selector, block order — executes without runtime errors. It cannot prove that the installed MappMotion version and the real ACOPOS drive accept the write to the external-encoder datatype, because that acceptance lives in the target, not the logic. Plan the final read-back and jog check on the real PLC and drive before trusting the change.

Keep reading

  • Troubleshooting

    Servo Drive Over-Speed Alarm: Causes and Checks

    An over-speed alarm means the drive measured motor speed above the limit configured in its speed-limit parameter, not that the motor is broken. Confirm whether the limit, the command, the ramps, false encoder feedback, unstable tuning or a load that back-drives the motor put it there, cheapest first, and never raise the limit to silence a trip whose cause you have not confirmed.

    Servo and stepper motion

  • Explainer

    Why a servo feeder stops on motor position, not strip position

    The servo stops on its motor encoder's position, so the strip encoder can never be the stop condition itself. Read the strip encoder in the controller and correct the running relative move through its documented continuous-update distance input — a position reset needs the axis stopped and cannot recover lost travel. Begin deceleration early: braking travel v²/(2a) plus v·t of command delay; at 300 mm/s and 2,000 mm/s² with 10 ms delay that lead is 25.5 mm.

    Servo and stepper motion

  • Troubleshooting

    Why MC_Home Absolute Encoder Adjustment Is Lost After Power Cycle

    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.

    Servo and stepper motion