Back to top

External Encoder with KAS (PDMM) Project

In a PLCopen project you can create a new axis for an Encoder master.  In the axis setup popup screen, change the type to Digitizing, change the interface to EtherCAT, and the address to be 1001 if the encoder is going to be connected to the PDMM which is the first EtherCAT device (or 1002 for the second, 1003 for third, and so on)


You can then create a new Axis_ref variable in your dictionary and assign the axis number to the same as the digitizing axis (from the above setup screen it would be 3).  You can then use many of the built in PLCopen functions with this encoder axis.  MC_ReadActPos and MC_ReadActVel will work, and you can use the MC_GearIn function with your servo axis as the slave and the encoder axis as the master to have it follow at a set gearing ratio.  You can use a MC_CamIn as well with the encoder axis being the master and the a servo slave axis following a cam profile.

You will also have to setup the encoder settings through workbench in the Feedback 2 screen to set the resolution of the encoder.


Also, if there is no Z-channel in your encoder you might get some drive faults associated with the secondary feedback signal. Instead of having to modify your cable to jumper Z channel wires, you can instead go to the terminal screen of AKD workbench and modify the setting for FAULT130.ACTION (or fault 131, 132, etc.) and change the setting to 1 in order to ignore this fault. 



allanh's picture
How do I set the scaling?

I have an encoder 3600ppr (14400 counts/rev)
It is mapped correctly, and I can see a position.

If I set UU=1 and FU=1 I would expect to read 14400 counts/rev in PlcOpen, but the return value is scaled wrong.
When looking at index 0x2050 mapped into a variable, I get the correct value in counts.

I moved the encoder approx. 10 revs.
Index 0x2050 shows 144236 counts
MC_ReadActPos gives 35.0
A strange scaling?
Joe Parks's picture
Joe Parks
You enter the encoder scaling into the Feedback 2 setup screen of AKD Workbench in the Resolution section shown in the screenshot above. This will ensure the correct position value for the external encoder is sent over EtherCAT to our controller.

The User Units and Feedback Units that you set inside the KAS IDE for the digitizing axis do not need to match the specs on your encoder, but are meant to allow you to set user units to make it easier to program your application. UU is the user units per revolution that you want, so if you want to work in degrees you keep the default of 360 but in your example if you want counts you enter 14400. You only need to change FU if you want non-integer user units, otherwise you have to keep it at the default 1048676. We have examples in our online help documentation showing how to setup user units. You can think of this parameter as a default denominator to set non-integer user units. For example, if you wanted user units to be 5 cm per rev, then you would enter UU = 5 and FU = 1048576. If you wanted user units to be 5.5 cm per rev you enter UU=55 and FU = 10485760. You cannot enter 5.5 directly because only integer values are accepted.
aabdelhakim's picture

Would this option support connecting two external encoders to the same PDMM by any chance?
Our application involves connecting two separate incremental encoders to X10 and X9. 

Joe Parks's picture
Joe Parks
You can have two feedback devices connected to each AKD drive in the system, including the one connected to a PDMM. A digitizing axis can be setup with hte X9 connector and a servo axis can be connected to the X10 connector. We have had customers that connect an external encoder to the X10 connector, and do not have a servo motor connected to the PDMM so that yes you can have two incremental encoders connected to the PDMM at one time but you cannot have two incremental encoders and a servo motor with another feedback device connected at one time.
aabdelhakim's picture
Hi Joe,

Thanks for the quick reply. Just to clarify, could we use a digitizing axis on both encoders, or would one definitely need to be a servo axis?
The reason is we need to measure the position and velocity from both encoders in real time, which setting up as a digitizing axis seems to be the best solution. 

Many thanks
Joe Parks's picture
Joe Parks
You can only connect two feedback devices to a PDMM or AKD at one time. A digitizing axis in a KAS project can only be tied to the X9 connector feedback, and a "servo" axis can only be tied to X10. You can connect an external encoder to X10 and set it up in the KAS IDE software as a servo axis, but since no motor is connected to it then it will act just like a digitizing axis. You can use the same function blocks MC_ReadActPos and MC_ReadActVel with both digitizing and servo axis
aabdelhakim's picture
That's great, thanks very much.