Saving last position from Encoder

I try to save my last position that my Encoder read, but I don’t know how to do it, it said that I have to use MC_BR_InitEndlessPosAcpEnc Function Block, but I have no clue how to configure it, I already read Help but I can’t figure it out, can someone help me?

Hello,

So first of all we have to ensure we are on the right functionality and software components…

  1. you have ACP10 in usage
  2. Your Encoder is connected to an ACOPOS Encoder Slot
  3. you have an external encoder which provides at least a singleturn absolute position
  4. your encoder can not move more that 1/2 encoder resolution while PLC is powered off

If one of the conditions is not given in your application, stop reading and provide more contend about your application.


How to use “MC_BR_InitEndlessPosAcpEnc”

The functionblock does hand over a Address of Retain Data to the motion System.
So first you have to Define a Retain Variable of correct Data Type.

After the BootUp of the PLC you have to execute the Functionblock with a Reference to the ACOPOS Axis (Encoder) and the Reference to the Retain Data. It should give a Done and DataVaild. You can remove the Execute afterwards.

PROGRAM _INIT

	
	MC_BR_InitEndlessPosAcpEnc_0.AcpEncoder.Axis 	:= ADR(gAxisEnc1);
    MC_BR_InitEndlessPosAcpEnc_0.AcpEncoder.Slot    := 1;
	MC_BR_InitEndlessPosAcpEnc_0.DataAddress 	    := ADR(gAxis1_EndlessData);
	MC_BR_InitEndlessPosAcpEnc_0.Execute 		    := 0; 
	
END_PROGRAM

PROGRAM _CYCLIC

	MC_BR_InitEndlessPosAcpEnc_0(); 
 
END_PROGRAM

The Data is still not initialised, you now have to make a Homing of the enocder to tell the system to initialise the Data in the Retain memory.

PROGRAM _INIT

	
	MC_BR_HomeAcpEncoder_0.AcpEncoder.Axis 	:= ADR(gAxisEnc1);
    MC_BR_HomeAcpEncoder_0.AcpEncoder.Slot  := 1
	MC_BR_HomeAcpEncoder_0.HomingParameter.HomingMode  := mcHOME_DIRECT;
	MC_BR_HomeAcpEncoder_0.Execute 		:= 0; 
	
END_PROGRAM

PROGRAM _CYCLIC

	MC_BR_HomeAcpEncoder_0(); 
 
END_PROGRAM

The Motion System knows now the Retain memory and it is initialised. It starts cyclicaly to monitor your encoder in the background.

After a PowerOff and PowerOn cycle of the PLC you can now use the HomingMode
mcHOME_RESTORE_POS to restore the Position from the Retain Memory.

If your PLC uses an Batterie buffered SRAM please provide a note in EndUser-Manual for your coustomer to service the Batterie.

I hope this helps you to use the functionality.

Greetings
Michael

1 Like

Ah thank you for the guidance, can I try this in Simulation mode or do I have to try it with the hardware for it to work?

Hello,

i think the functionality should work in ARsim. But you will have always same starting Point of your Encoder Raw Position (“0”) after BootUp.
I used it only with an Axis and not with an external Encoder.

Greetings
Michael

I will be using 80VD100PD ACOPOSmicro servo, and I believe it has an Encoder built in it right? and I don’t plan to use another external encoder, does your guide above work with it?

Hello,

if you use a normal Enocder of an Axis you can use the Standard Functionblocks, and don’t need to use the spezial ones for External Encoder.

Standard Versions:
MC_BR_InitEndlessPos
MC_Home

They function in the same way.

Greetings
Michael

Would it be possible to do something similar but with mappmotion? Meaning to retain the position in memory. I have an ACOPOS P3 and an external incremental encoder card. As for now, I request a home after every powercycle.

Hello,

After every Power-Cycle there must be a Home Function called to tell the system how to recover the Homing of the Axis/Encoder. This is done by execute a Home.

The only use case i know, were you don’t have to do it manualy is with MpAxisBasic in MappMotion if the InitEndless Memory has a Valid Dataset and the MpAxisBasic internaly calls the Home function. As far as i know its not the MappMotion System but the functionblock doing it.

So calling a Home after a Power-Cycle is the typical use-Case.

Greetings
Michael