As a comment, and room for improvements, if one so wishes.
The stepspermm variable is set up as a pdos. Meaning that this value
will be updated every servo cycle (miilisecond). That is not very optimal,
the steps per mm scaling factor is a constant. Set it once and it stays there.
It is not like one will change the scaling value during operation.
The options I saw when I put it as a pdos was to either make it a sdos or a constant in the MCU program.
As a constant in the MCU program it becomes kind of inaccessible, but apart from that it will work fine.
Making it a sdos adds a bit of complexity when giving it a value. There is no interface for sdos to hal
that I know about. One can give a value to a sdos in the ethercat-conf.xml config file, but that brings
its own unnecessary complexity. One need to enter a line like the last line below
Code:
<slave idx="4" type="generic" vid="00000a88" pid="0a880002" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<sdoConfig idx="2000" subIdx="0"><sdoDataRaw data ="40 06"/></sdoConfig> <!-- Steps per mm axis 1: 1600 -->
To end up with "40 06" one brings up a decimal to hex converter and converts 1600 which gives 640.
Shift place on the two bytes 06 40 => 40 06 which one then enters in ethercat-conf.xml.
The code in the MCU stays the same, still Obj.StepsPerMM1 (or what is is called). It is just not updated
every serocycle but once in the beginning.
Just a bit of background and rambling.