Need a way to write External Encoder Gear ratio input/output

Hi All,

I need a way to dynamically write my acopos drive configuration, so from HMI I want an engineer to write the Input/Output rotations of the external encoder in a variable and then write it to the configuration. It seems a restart is needed to accomplish that and that is fine for me.

Now I understand I can use MpAxisBasicConfig or use MC_BR_ProcessConfig for this.

I have tried MpAxisBasicConfig but in the datatype MpAxisBasicConfigType I cannot find the mechanical elements for the external encoder, only for my own axis.

MC_BR_ProcessConfig is just as confusing as I lack the knowledge on this block.

Can someone show me in the right direction?

Hi there,

There is a headline Changing the hardware-dependent "Mechanical elements" settings of an ACOPOS external encoder axis which seems to be exactly what you need:

VAR
	MechElem : McCfgAcpExtEncAxMechElmType;
	FB_ProcessParam : MC_BR_ProcessParam;
END_VAR

Code:


PROGRAM _CYCLIC
	MechElem.MechanicalElements.Gearbox.Input := <yourInput>;
	MechElem.MechanicalElements.Gearbox.Output := <yourOutput>;
	
	IF <condition> THEN
	
		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
			<condition> := FALSE;
		ELSIF FB_ProcessParam.Error THEN
			// some error handling
		END_IF
	END_IF
	 
END_PROGRAM

Should do the trick?

2 Likes

Hi Michael,

That does seem to be what I am looking for, but wouldn’t I need to use MC_BR_ProcessConfig (because it retains the configuration even after a restart, whereas ProcessParam only keeps the value until restart?)

But for some reason this does not have a WRITE command, only load, save or create.

Any thought on that?

Hello,

It depends on your software architecture which Functionblock will better suite.
MC_BR_ProcessConfig does save the values on the CF and is retain, but needs a restart for activating the changes.
MC_BR_ProcessParam does make the changes in the active Data whithout an Restart, but is volitile.

If you have some own Configuration File it could be nice to use MC_BR_Param after you loaded your own File. It is also nice to skip the Restart.
You could even think of use both, make it retain in configruation via ProcessConfig and the use ProcessParam with mcPPM_LOAD_FROM_CONFIG to activate the changes immediatly without restart.

You have the choise.

Here we had a nice Picture about the two Functionblocks and some notes.
One Functionblock uses Write the other Save | Read vs. Load.
Picture for Overview

Greetings
Michael

1 Like

Hi Michael,

It seems writing to this specific datatype is not permitted:

afbeelding

for testing:
Test1 := 7
test2 := 3

Hello,

Can you please have a look at the used MappMotion Version. The Documentations states that a minimal Version 5.16 is reqired for this function. I have tested in the newest Version 5.29.

For me it looks good. I made first a Read then a Write.

You may have to think about the ReferenceDistance, but if i let this 0.0 i got an different Error.

Greetings
Michael

Hi Michael

I am using AS6.3.3.14, MappMotion version is 6.4.1. When I click “Advanced” the component McAcpPar (which looked like it had something to do with parametrization writing) was disabled, I put it on 6.4.1 but this does not make the difference so far.

I have also tested with the Real Axis gear ratio and there the function block finishes correctly. Is there a function block to monitor if the values have succesfully transferred?

Yes, the “Done” output of your FB is exactly that!

2 Likes

With mappCockpit and DriveLog it is possible to see which parameters are written to the drive (ProcessParam).

The library McAcpPar only contains constant definitions for the different Acopos parameters.

2 Likes

Hello,

The only way i know how to have some feedback of whats happening with the active Parameters is the display in the MappCockpit.

I have tested with ARsim, do you use a real PLC and ACOPOS?

I have used now AS6.3 and MappMotion 6.5 (i could not find a 6.4.1)

Greetings
Michael

Hi Michael, Corne,

I will try MappCockpit in a bit, that would be great if it shows the right values there.

Unfortunately no luck on the ProcessParam + external encoder gear ratio. However, ProcessConfig on the other hand seems to work (no error and Done gets high).

I am currently only on simulation, but will be testing on hardware in a few days.

Strange that it cannot find 6.4.1 for you. I on the other hand can’t seem to find 6.5, the latest upgrade is 6.3.2, also weird because my version is higher, but it still wants to download a lower version

Hello,

MappMotion 6.3.2 was the newest version in Upgrades and Website.
The 6.5 i used was prety sure a preRelease only available for B&R at the moment. I just thought to use a newer would include the Status of the older. I loaded it from internal B&R Source. Sorry if this lead to a confusion.

I thought 6.4 was released on ~1.9.2025 but not sure what happend to it.

If you used ARsim, i don’t know were’s the differnce.
Good to read that the ProcessConfig had worked.

Greetings
Michael

Hi again,

In the DriveLog on MappCockpit I could only find SCALE_ENCOD2_REV which showed me the output gear of my external encoder.

I also want to change my own axis’s gear ratio with MC_BR_ProcessParam, I have executed the block and it gives a done signal, is there some way to also read the input/output gear somewhere, to make sure the block was succesful, not only relying on the done signal.

Hi,

the gear ratio of the axis ends up on these ParIDs:
VCTRL_SCALE_LOAD_MOTREV = Mechanical elements/Gearbox/Input
VCTRL_SCALE_LOAD_UNITS = Mechanical elements/Gearbox/Output x Mechanical elements/Rotary to linear transformation/Reference distance x 1/Measurement resolution

1 Like