<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:14px"><div id="yui_3_16_0_1_1455523887705_10904"><span><br></span></div><div id="yui_3_16_0_1_1455523887705_10904"><span id="yui_3_16_0_1_1455523887705_11046">Thanks for that. Very helpful.</span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 14px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Thursday, 11 February 2016, 23:25:38, Graeme Foot <Graeme.Foot@touchcut.com> wrote:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv5157799637"><style>#yiv5157799637 #yiv5157799637 --
_filtered #yiv5157799637 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv5157799637 {panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered #yiv5157799637 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv5157799637 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv5157799637
#yiv5157799637 p.yiv5157799637MsoNormal, #yiv5157799637 li.yiv5157799637MsoNormal, #yiv5157799637 div.yiv5157799637MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 a:link, #yiv5157799637 span.yiv5157799637MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv5157799637 a:visited, #yiv5157799637 span.yiv5157799637MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv5157799637 p.yiv5157799637MsoAcetate, #yiv5157799637 li.yiv5157799637MsoAcetate, #yiv5157799637 div.yiv5157799637MsoAcetate
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv5157799637 p.yiv5157799637msoacetate, #yiv5157799637 li.yiv5157799637msoacetate, #yiv5157799637 div.yiv5157799637msoacetate
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal, #yiv5157799637 li.yiv5157799637msonormal, #yiv5157799637 div.yiv5157799637msonormal
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault, #yiv5157799637 li.yiv5157799637msochpdefault, #yiv5157799637 div.yiv5157799637msochpdefault
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal1, #yiv5157799637 li.yiv5157799637msonormal1, #yiv5157799637 div.yiv5157799637msonormal1
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msoacetate1, #yiv5157799637 li.yiv5157799637msoacetate1, #yiv5157799637 div.yiv5157799637msoacetate1
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault1, #yiv5157799637 li.yiv5157799637msochpdefault1, #yiv5157799637 div.yiv5157799637msochpdefault1
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal2, #yiv5157799637 li.yiv5157799637msonormal2, #yiv5157799637 div.yiv5157799637msonormal2
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msoacetate2, #yiv5157799637 li.yiv5157799637msoacetate2, #yiv5157799637 div.yiv5157799637msoacetate2
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal3, #yiv5157799637 li.yiv5157799637msonormal3, #yiv5157799637 div.yiv5157799637msonormal3
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault2, #yiv5157799637 li.yiv5157799637msochpdefault2, #yiv5157799637 div.yiv5157799637msochpdefault2
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal11, #yiv5157799637 li.yiv5157799637msonormal11, #yiv5157799637 div.yiv5157799637msonormal11
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msoacetate11, #yiv5157799637 li.yiv5157799637msoacetate11, #yiv5157799637 div.yiv5157799637msoacetate11
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault11, #yiv5157799637 li.yiv5157799637msochpdefault11, #yiv5157799637 div.yiv5157799637msochpdefault11
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 span.yiv5157799637msohyperlink
{}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed
{}
#yiv5157799637 span.yiv5157799637msohyperlink2
{}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed2
{}
#yiv5157799637 span.yiv5157799637msohyperlink11
{}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed11
{}
#yiv5157799637 span.yiv5157799637emailstyle1711
{}
#yiv5157799637 span.yiv5157799637emailstyle291
{}
#yiv5157799637 span.yiv5157799637emailstyle42
{}
#yiv5157799637 p.yiv5157799637msonormal4, #yiv5157799637 li.yiv5157799637msonormal4, #yiv5157799637 div.yiv5157799637msonormal4
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 span.yiv5157799637msohyperlink1
{color:blue;text-decoration:underline;}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed1
{color:purple;text-decoration:underline;}
#yiv5157799637 p.yiv5157799637msoacetate3, #yiv5157799637 li.yiv5157799637msoacetate3, #yiv5157799637 div.yiv5157799637msoacetate3
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal5, #yiv5157799637 li.yiv5157799637msonormal5, #yiv5157799637 div.yiv5157799637msonormal5
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault3, #yiv5157799637 li.yiv5157799637msochpdefault3, #yiv5157799637 div.yiv5157799637msochpdefault3
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal12, #yiv5157799637 li.yiv5157799637msonormal12, #yiv5157799637 div.yiv5157799637msonormal12
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msoacetate12, #yiv5157799637 li.yiv5157799637msoacetate12, #yiv5157799637 div.yiv5157799637msoacetate12
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault12, #yiv5157799637 li.yiv5157799637msochpdefault12, #yiv5157799637 div.yiv5157799637msochpdefault12
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal21, #yiv5157799637 li.yiv5157799637msonormal21, #yiv5157799637 div.yiv5157799637msonormal21
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 span.yiv5157799637msohyperlink21
{color:blue;text-decoration:underline;}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed21
{color:purple;text-decoration:underline;}
#yiv5157799637 p.yiv5157799637msoacetate21, #yiv5157799637 li.yiv5157799637msoacetate21, #yiv5157799637 div.yiv5157799637msoacetate21
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal31, #yiv5157799637 li.yiv5157799637msonormal31, #yiv5157799637 div.yiv5157799637msonormal31
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msochpdefault21, #yiv5157799637 li.yiv5157799637msochpdefault21, #yiv5157799637 div.yiv5157799637msochpdefault21
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv5157799637 p.yiv5157799637msonormal111, #yiv5157799637 li.yiv5157799637msonormal111, #yiv5157799637 div.yiv5157799637msonormal111
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv5157799637 span.yiv5157799637msohyperlink111
{color:blue;text-decoration:underline;}
#yiv5157799637 span.yiv5157799637msohyperlinkfollowed111
{color:purple;text-decoration:underline;}
#yiv5157799637 p.yiv5157799637msoacetate111, #yiv5157799637 li.yiv5157799637msoacetate111, #yiv5157799637 div.yiv5157799637msoacetate111
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv5157799637 span.yiv5157799637emailstyle17111
{color:#1F497D;}
#yiv5157799637 p.yiv5157799637msochpdefault111, #yiv5157799637 li.yiv5157799637msochpdefault111, #yiv5157799637 div.yiv5157799637msochpdefault111
{margin-right:0cm;margin-left:0cm;font-size:10.0pt;}
#yiv5157799637 span.yiv5157799637emailstyle2911
{color:#1F497D;}
#yiv5157799637 span.yiv5157799637emailstyle421
{color:#1F497D;}
#yiv5157799637 span.yiv5157799637EmailStyle62
{color:#1F497D;}
#yiv5157799637 span.yiv5157799637BalloonTextChar
{}
#yiv5157799637 .yiv5157799637MsoChpDefault
{font-size:10.0pt;}
_filtered #yiv5157799637 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}
#yiv5157799637 div.yiv5157799637WordSection1
{}
#yiv5157799637 </style><div>
<div class="yiv5157799637WordSection1">
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">Hi,</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">In the case of the EL7031 the A010 status bit cannot be set up as PDO items, so the only option is SDO access.</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">You have a couple of options:</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">1) use complete sdo access methods</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">There are some patches in the etherlab-dev forum from Gavin Lambert that adds an
</span><span style="font-size:11.0pt;">ecrt_master_sdo_upload_complete()</span><span style="font-size:11.0pt;"> method. I haven’t used it but I gather it will let you get
all subindex values of an index with one call.</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">2) use
</span><span style="font-size:11.0pt;">ecrt_sdo_request_index()</span><span style="font-size:11.0pt;"></span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">This lets you configure one sdo item (per motor) and change the index / subindex as required. This method requires an SDO statemachine that will also iterate
across all of the sub indexes one at a time. Some of the required calls (ignoring the SDO statemachine calls):</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// create sdo request object</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">m_sdoErrorCode = ecrt_slave_config_create_sdo_request(dev->slaveConfig, 0xA010, 0x00, sizeof(uint8_t));</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// inside a state machine loop, incrementing the sub index each time:</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// request a read of a sub index</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">ecrt_sdo_request_index(m_sdoErrorCode, 0xA010, m_errorCodeSubIdx);</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">ecrt_sdo_request_read(m_sdoErrorCode);</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">...
</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// get the bit data and add it to the error code</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">void *data = ecrt_sdo_request_data(m_sdoErrorCode);</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">uint16_t val = EC_READ_U8(data);</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// update sm error code</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">m_errorCode |= val << (m_errorCodeSubIdx-1);</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">// prepare to get next subindex</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">m_errorCodeSubIdx++;</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">Notes:</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">- you first need to read subindex zero even though you don’t want to use its data, this is to tell the slave to prepare the status bits for reading. I vaguely
remember the status bits not always working unless subindex 0 was read.</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">- once the m_errorCodeSubIdx value is incremented past 10 you have your error code, reset the index and use the error code</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">-
</span><span style="font-size:11.0pt;">ecrt_slave_config_create_sdo_request()</span><span style="font-size:11.0pt;"> must be called with the biggest size you are going to
use so that enough memory can be reserved, in this case we are reading a byte at most each time</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">- if using
</span><span style="font-size:11.0pt;">ecrt_sdo_request_index()</span><span style="font-size:11.0pt;"> to write SDO values then you must call
</span><span style="font-size:11.0pt;">ecrt_sdo_request_read()</span><span style="font-size:11.0pt;"> before the write to correctly initialise the internal data size</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">This is of course slower than using the complete access method, but you already know there’s an error via the PDO error status bit so you have already done
the appropriate error handling steps, now its just finding out why there was an error.</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">Regards,</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;">Graeme.</span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637MsoNormal"><span style="font-size:11.0pt;"> </span></div>
<div class="yiv5157799637yqt2508008126" id="yiv5157799637yqt83222"><div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div class="yiv5157799637MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;"> Paul Mulligan [mailto:mulligan252@yahoo.ie]
<br clear="none">
<b>Sent:</b> Friday, 12 February 2016 1:30 a.m.<br clear="none">
<b>To:</b> Graeme Foot; etherlab-users@etherlab.org<br clear="none">
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers</span></div>
</div>
</div>
<div class="yiv5157799637MsoNormal"> </div>
<div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Hi Graeme,</span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">There are not many examples, but if I want to check the motor diagnostic bits A010 during runtime, with 5 motors for example, an ec_sdo_request_t
object would need to be created for each error bit on each motor, so 50 objects in total. </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Then at runtime, when necessary, I would need to go through the state machine with the ecrt_sdo_request_* commands for each of these
50 bits? Is there a way to read all the error bits at once in one word? </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Would it not be possible to register these diagnostic bits in an ec_pdo_entry_reg_t structure and exchange them at runtime like the
pdos?</span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks again,</span></div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1455179043251_16850">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Paul </span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;"> </span></div>
</div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.0pt;">On Sunday, 24 January 2016, 22:19:58, Graeme Foot <<a rel="nofollow" shape="rect" ymailto="mailto:Graeme.Foot@touchcut.com" target="_blank" href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>> wrote:</span><span style=""></span></div>
</div>
<div class="yiv5157799637MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div>
<div>
<div id="yiv5157799637">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Hi,</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">The Target Position is an absolute position (not incremental). If you ask it to go to position 2 it will move there and then stay
there. If you want to move from zero to 200 over 100 cycles you need to explicitly change the Target Position every cycle:</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 0: Target Position = 0</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 1: Target Position = 2</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 2: Target Position = 4</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 3: Target Position = 6</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 4: Target Position = 8</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 5: Target Position = 10</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">...</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 99: Target Position = 198</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Cycle 100: Target Position = 200</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">If your increment per cycle is too big for the motor to handle you will get errors.</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_slave_config_sdo() is used for one time setup of SDO configuration values (before the master is activated). The EtherCAT master
will apply the SDO configuration values when it is activated, or if the module is repowered, ensuring it is correctly configured every time it starts up and is enabled.</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">If you want to manually interact with SDO values (read/write values at arbitrary times) at runtime you use ecrt_slave_config_create_sdo_request()
to create a request object you can interact with. You then use a state machine with the following functions:</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_sdo_request_data()</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_sdo_request_data_size()</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_sdo_request_state()</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_sdo_request_write()</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ecrt_sdo_request_read()</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">You should be able to find some older forum message re how to use them (there’s also various patches out there that make them a bit
more powerful, not sure if any of them are currently added to the etherlab master).</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">I can’t really comment as to why the Ready to Enable bit is not on, except that there is probably an warning or error. Check the warning
and error bits from the PDO and also check the A010 bits. You can also access this data (and any SDO data) while the app is running from the EtherCAT master command line:</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ethercat upload -p<pos> 0xA010 0x01</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">ethercat upload -p<pos> 0xA010 0x02</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">...</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Regards,</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Graeme.</span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
<div id="yiv5157799637yqt68540">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><b><span lang="EN-US" style="font-size:10.0pt;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;"> Paul
Mulligan [<a rel="nofollow" shape="rect" ymailto="mailto:mulligan252@yahoo.ie" target="_blank" href="mailto:mulligan252@yahoo.ie">mailto:mulligan252@yahoo.ie</a>]
<br clear="none">
<b>Sent:</b> Saturday, 23 January 2016 5:33 a.m.<br clear="none">
<b>To:</b> Graeme Foot<br clear="none">
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
<div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3939">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Hi Graeme,</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3938">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3798">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Many thanks for your help.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3801">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3942">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">I thought that by replying here , it would also get written on the forum also but I can update it.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3943">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3944">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Sorry, I know, many questions. I won't keep hassling you but there is just one or two things more that I don't understand. I feel that
there is a lack of code examples out there on how to communicate using the master, especially for motor control.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4551">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4387">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">When setting the target position in each cycle, say for example with value 2, I assume that this moves the motor by 2 steps every cycle.
If 200 is the number of steps per revolution (I even explicitly set it with the 8010:06 SDO parameter), I would expect that after 100 cycles, the motor would do a full revolution but it's not the case. I tried different time periods of calling the cyclical
function, even as high as one second, but the motor just instantaneously moves into some position and stays there.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_7346">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_7470">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">The state machine for initialising the motor fails for me. On reading the ready to enable bit (6010:01), it never gets set. I enable
the motor anyways but then the 6010:02 bit also never gets set.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_7938">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_7939">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">When writing SDOs, is it just a matter of calling ecrt_slave_config_sdo() without having to register them first like the PDOs? In order
to read the error bits of A010 , i'm not sure how.</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_8360">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_8361">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks again ,</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_8362">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Paul</span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_6746">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4330">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4332">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4333">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4334">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4231">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_4183">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453471121411_3946">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div style="margin-bottom:12.0pt;">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.0pt;">On Thursday, 21 January 2016, 22:40:52, Graeme Foot <<a rel="nofollow" shape="rect" ymailto="mailto:Graeme.Foot@touchcut.com" target="_blank" href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>>
wrote:</span><span style=""></span></div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
<div>
<div id="yiv5157799637">
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Hi,</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">I don’t use ecrt_domain_reg_pdo_entry_list() so can’t comment on that one.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">To configure my devices I use (without error checking):</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> /* configure the slave */</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> dev->slaveConfig = ecrt_master_slave_config(ecMod->master, dev->alias, dev->position, dev->vendorID, dev->productCode);</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> /* configure the PDOs */</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> ecRes = ecrt_slave_config_pdos(dev->slaveConfig, EC_END, EL7031_syncs);</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">I then use the following to get addresses for the PDO items:</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> offset = ecrt_slave_config_reg_pdo_entry(dev->slaveConfig, EL7031_pdoEntries[pdoIdx].index,</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> EL7031_pdoEntries[_pdoIdx].subindex,</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> ecMod->domains[domIdx].domain, &bitPos);</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Re Target Position updating:</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">EtherCAT works with PDO’s and SDO’s. The PDO’s (Process Data Objects) are sent every cycle to exchange data with the slaves. The
SDO’s (Service Data Objects) are used to exchange non-cyclic / non-urgent data (eg configuration). You want the PDO data to be as minimal as possible to reduce the amount of data being send across the fieldbus. This allows you to either have more slaves
or smaller cycle times.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">EtherCAT motors in position mode get the Target Position updated via PDO’s. This means each and every cycle your app needs to tell
the motor where you want it to be at the end of that cycle. If your motor is to be stationary you do not need to update the Target Position value from your app if you don’t want to, but your app still has to send out the PDO, which will be sending out the
old value until your app starts changing it again.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">When you want to move your motor you need to update the Target Position with the new value for that cycle. The Motor slave’s (ie the
EL7031) job is to take that Target Position and over the period of the next cycle to interpolate the motor between the last cycles Target Position and the new Target Position.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">So if you have an EtherCAT cycle time of 1000Hz (1 ms) then:</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- to turn the motor forward at a velocity of 5000 counts/second then you need to increment the Target Position value by 5 counts each
cycle</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- to turn the motor reverse at a velocity of 5000 counts/second then you need to increment the Target Position value by -5 counts each
cycle</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- to turn the motor forward at a velocity of 10000 counts/second then you need to increment the Target Position value by 10 counts
each cycle</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- to turn the motor reverse at a velocity of 10000 counts/second then you need to increment the Target Position value by -10 counts
each cycle</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">It is up to your app to decide the speed and therefore the per cycle increment. You can’t just set a final Target Position and wait
for the motor to get there as it will try to get there in one cycle.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">This motor module is a very low level of control. The app needs to provide the high level control ie:</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- what does motor count mean (ie you need a scale factor between you realworld units (eg mm) and the motors counts units.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- when you want to move the motor to a new position you need to calculate the speed profile and therefore the motor position at each
cycle increment</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">- also motors don’t like instantaneous speed changes so you also need to take care of acceleration and deceleration.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">If you want a motor where you can set and forget a final target position then you will probably need an EtherCAT servo amp with an
Interpolated Position Mode.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Regards,</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Graeme.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">PS: remember to also reply to the etherlab forums so others can learn and comment too.</span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
<div id="yiv5157799637yqt95560">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><b><span lang="EN-US" style="font-size:10.0pt;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;"> Paul
Mulligan [<a rel="nofollow" shape="rect" ymailto="mailto:mulligan252@yahoo.ie" target="_blank" href="mailto:mulligan252@yahoo.ie">mailto:mulligan252@yahoo.ie</a>]
<br clear="none">
<b>Sent:</b> Friday, 22 January 2016 4:37 a.m.<br clear="none">
<b>To:</b> Graeme Foot<br clear="none">
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
<div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3124">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks for that Graeme.</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3125">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3123">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">I am having issues however. I copied your set-up for the motor driver to my application as shown below but at run-time on calling ecrt_domain_reg_pdo_entry_list
I am receiving the error "Failed to register PDO entry: No such file or directory".
</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4432">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4473">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">If I remove the motor entries from the domain1_regs[] however, there are no problems. Am I missing something else?</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4610">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4609">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">With regards to stepping the motor, you mentioned that I must update the target position on every cycle. I'm not sure I understand
that. Won't the target position always be the same when it's set? Do I increment the motor by one step on each cycle until it reaches the target position?</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4378">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4430">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3551">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3552">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3655">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">/* Master 0, Slave 6, "EL7031"<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3554">
* Vendor ID: 0x00000002<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3556">
* Product code: 0x1b773052<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3558">
* Revision number: 0x00170000<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3560">
*/<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3562">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3564">
ec_pdo_entry_info_t slave_6_pdo_entries[] =<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3566">
{<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3568">
// 0x1602, stepper control (0)<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3570">
{0x7010, 0x01, 1}, // Enable<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3572">
{0x7010, 0x02, 1}, // Reset<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3574">
{0x7010, 0x03, 1}, // Reduce torque<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3576">
{0x0000, 0x00, 5}, // spacer<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3578">
{0x0000, 0x00, 8}, // spacer<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3580">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3582">
// 0x1603, stepper pos (5)<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3584">
{0x7010, 0x11, 32}, // Target position<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3586">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3588">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3590">
// 0x1a03, stepper status (6)<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3592">
{0x6010, 0x01, 1}, // Ready to enable<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3594">
{0x6010, 0x02, 1}, // Ready<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3596">
{0x6010, 0x03, 1}, // Warning<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3598">
{0x6010, 0x04, 1}, // Error<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3600">
{0x6010, 0x05, 1}, // Moving positive<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3602">
{0x6010, 0x06, 1}, // Moving negative<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3604">
{0x6010, 0x07, 1}, // Torque reduced<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3606">
{0x0000, 0x00, 1}, // spacer<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3608">
{0x0000, 0x00, 3}, // spacer<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3610">
{0x6010, 0x0c, 1}, // Digital input 1<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3612">
{0x6010, 0x0d, 1}, // Digital input 2<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3614">
{0x1c32, 0x20, 1}, // Sync error<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3616">
{0x0000, 0x00, 1}, // spacer<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3618">
{0x1803, 0x09, 1}, // *** unknown ***<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3620">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3622">
};<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3624">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3626">
ec_pdo_info_t slave_6_pdos[] =<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3628">
{<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3630">
{0x1602, 5, slave_6_pdo_entries + 0},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3632">
{0x1603, 1, slave_6_pdo_entries + 5},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3634">
{0x1a03, 14, slave_6_pdo_entries + 6},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3636">
};<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3638">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3640">
ec_sync_info_t slave_6_syncs[] =<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3642">
{<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3644">
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3646">
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3648">
{2, EC_DIR_OUTPUT, 2, slave_6_pdos + 0, EC_WD_DISABLE},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3650">
{3, EC_DIR_INPUT, 1, slave_6_pdos + 2, EC_WD_DISABLE},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3652">
{0xff}<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3654">
};</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3749">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3753">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">/*------------------------------------------------------------*/</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4216">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3922">
<div style="margin-bottom:12.0pt;">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">//motor<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3853">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3855">
//commands<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3857">
static unsigned int off_motor_speed;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3859">
static unsigned int off_motor_enable;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3861">
static unsigned int off_motor_reset;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3863">
static unsigned int off_motor_target_pos;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3865">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3867">
//status<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3869">
static unsigned int off_motor_err_status;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3871">
static unsigned int off_motor_ready_to_enable;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3873">
static unsigned int off_motor_ready_status;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3875">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3877">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3879">
static unsigned int bitPosit = 1;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3883">
<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3885">
const static ec_pdo_entry_reg_t domain1_regs[] =<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3887">
{<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3889">
{DigOutSlave1Pos, Beckhoff_EL2008, 0x7000, 1, &off_digout1},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3891">
{DigOutSlave2Pos, Beckhoff_EL2008, 0x7000, 1, &off_digout2},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3893">
{DigInSlave1Pos, Beckhoff_EL1008, 0x6000, 1, &off_digin1},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3895">
{DigInSlave2Pos, Beckhoff_EL1008, 0x6000, 1, &off_digin2},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3897">
{AnaInSlavePos, Beckhoff_EL3001, 0x6000, 0x11, &off_anain},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3899">
{MotorSlavePos, Beckhoff_EL7031, 0x7010, 0x21, &off_motor_speed},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3901">
{MotorSlavePos, Beckhoff_EL7031, 0x7010, 0x01, &off_motor_enable},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3903">
{MotorSlavePos, Beckhoff_EL7031, 0x6010, 0x04, &off_motor_err_status, &bitPosit},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3905">
{MotorSlavePos, Beckhoff_EL7031, 0x7010, 0x02, &off_motor_reset, &bitPosit},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3907">
{MotorSlavePos, Beckhoff_EL7031, 0x6010, 0x01, &off_motor_ready_to_enable, &bitPosit},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3909">
{MotorSlavePos, Beckhoff_EL7031, 0x6010, 0x02, &off_motor_ready_status, &bitPosit},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3911">
{MotorSlavePos, Beckhoff_EL7031, 0x7010, 0x11, &off_motor_target_pos, &bitPosit},<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3913">
{}<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_3915">
};</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_3122">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">/*-----------------------------------------------------------------------------------------------------------------------*/</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4119">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">/* Inside main function*/</span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4120">
<div>
<div style="margin-bottom:12.0pt;">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4429">
<div>
<div style="margin-bottom:12.0pt;">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453387034244_4118">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs))<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_4111">
{<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_4113">
fprintf(stderr, "PDO entry registration failed!\n");<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_4115">
return -1;<br clear="none" id="yiv5157799637yui_3_16_0_1_1453387034244_4117">
}</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div style="margin-bottom:12.0pt;">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.0pt;">On Wednesday, 20 January 2016, 22:54:33, Graeme Foot <<a rel="nofollow" shape="rect" ymailto="mailto:Graeme.Foot@touchcut.com" target="_blank" href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>>
wrote:</span><span style=""></span></div>
</div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
<div>
<div id="yiv5157799637">
<div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Hi,</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">To get information about what PDO’s can be mapped for a device you will need to look into the in device documentation.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Some devices do not allow reconfiguration so you must match what is already there (cstruct command fine for this). Some devices allow
you to map different PDO’s, but only from preconfigured group options (the EL7031 falls into this category). And lastly some devices allow you to configure any PDO item in any order as long as you have enough space to do so, however with these devices not
all items can be used as PDO’s.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">If you have a Beckhoff module you can easily download its documentation from their site using the url:
<a rel="nofollow" shape="rect" target="_blank" href="http://www.beckhoff.com/%3cmodel_number%3e/">http://www.beckhoff.com/<model_number>/</a></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Eg:
<a rel="nofollow" shape="rect" target="_blank" href="http://www.beckhoff.com/EL7031/">http://www.beckhoff.com/EL7031/</a></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"><img id="yiv5157799637_x0000_i1033" border="0" width="764" height="426" src="cid:image001.png@01D16581.C152A320"></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Then click on the “Documentation (CHM)” link and it will download the documentation. Note: being a chm file you will need to open
it in Windows from a local drive. The content will also be blocked until you select “Unblock” from right-click, properties:</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"><img id="yiv5157799637_x0000_i1034" border="0" width="374" height="168" src="cid:image002.png@01D16581.C152A320"></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Have a look at the “Object description and parameterization” section (in this case it is under: EL70x1 - Stepper Motor Interfaces,
Configuration with the TwinCAT System Manager, EL7031, ...)</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Have a look at the 0x160x groups. These are the preconfigured read/write item groups. The value of each item tells you which PDO
item addresses will be used.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Then have a look at the 0x1a0x groups. These are the preconfigured readonly item groups.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Note: there may be restrictions as to which groups you can use together. This is generally found in the XML device description files.
These files are what tells TwinCAT what configuration options are valid. Also note that different module firmware revisions will probably support different options and PDO mappings. If over time you need to support different firmware revisions you will need
to read the modules revision from your app and match the correct configuration.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">It’s also a good idea to get the Beckhoff XML device descriptions from:
<a rel="nofollow" shape="rect" target="_blank" href="http://download.beckhoff.com/download/Config/EtherCAT/XML_Device_Description/Beckhoff_EtherCAT_XML.zip">
http://download.beckhoff.com/download/Config/EtherCAT/XML_Device_Description/Beckhoff_EtherCAT_XML.zip</a></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">You can view them in Internet Explorer, but they are large and really slow. I generally load them into Notepad++ and delete the irrelevant
modules and revisions (without saving) to speed things up and make searching easier.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">In the XML file find the “AlternativeSmMapping” nodes. This tells you what various “modes” the module is designed to be used in and
what PDO mapping groups are used.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">For my application I wanted “Position control”, so I used the following:</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <AlternativeSmMapping></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Name>Position control</Name></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Sm No="2"></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Pdo>#x1601</Pdo></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Pdo>#x1602</Pdo></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Pdo>#x1603</Pdo></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </Sm></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Sm No="3"></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Pdo>#x1a01</Pdo></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> <Pdo>#x1a03</Pdo></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </Sm></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </AlternativeSmMapping></span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">But I also didn’t want to use latching, so in my case I left off 0x1601 and 0x1a01.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">As to changing moving direction, you just need to change the Position Target in the negative direction.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Eg, if you want to move from position 0 to 20 and then back to 0 you would output the positions (one each scan):</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">0</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">0 // accelerate moving forward</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">1</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">3</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">6</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">10 // decelerate moving forward</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">14</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">17</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">19</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">20 // pause
</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">20</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">20</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">20 // accelerate moving reverse</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">19</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">17</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">14</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">10 // decelerate moving reverse</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">6</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">3</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">1</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">0</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">0</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">...</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Note: If the above scan time is 1000Hz then the above would be accelerating/decelerating at 1000 counts/second.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">It is up to you to come up with the trajectory of the motor (ie where you want to go) and the kinematics (ie how fast do you want to
go and accelerate / decelerate). Then for each scan period output the target position.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">You can use kinematic equations to figure out a simple kinematic profile (eg from:
<a rel="nofollow" shape="rect" target="_blank" href="http://www.physicsclassroom.com/class/1DKin/Lesson-6/Kinematic-Equations">
http://www.physicsclassroom.com/class/1DKin/Lesson-6/Kinematic-Equations</a>). However you may need to get into some more advanced mathematics if you want to introduce smoothing factors (jerk etc.)</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">However, if you want to move forward and the motor goes in reverse for your mechanical configuration (and vice-versa) then the motor
has a Reverse configuration option (0x8012:09, Invert motor polarity).</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Regards,</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Graeme Foot</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Kinetic Engineering Design Ltd.</span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yqt39867">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><b><span lang="EN-US" style="font-size:10.0pt;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;"> Paul
Mulligan [<a rel="nofollow" shape="rect" ymailto="mailto:mulligan252@yahoo.ie" target="_blank" href="mailto:mulligan252@yahoo.ie">mailto:mulligan252@yahoo.ie</a>]
<br clear="none">
<b>Sent:</b> Thursday, 21 January 2016 3:32 a.m.<br clear="none">
<b>To:</b> Graeme Foot<br clear="none">
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers</span><span style=""></span></div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
<div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Hi Graeme,</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks alot for that.</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">I'm completely new to Ethercat. Where can I find the SDO entries with indexes that you mentioned, for any device? </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Up until now I have only been using the Ethercat command line tool to retrieve the c-structures relating to the PDOs for the slave
device and then copying and pasting this information into my code.</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Also, in order to change moving direction of the motor, do I need to change an SDO value ? </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Regards,</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div id="yiv5157799637yui_3_16_0_1_1453295784417_6224">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Paul</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div>
<div style="margin-bottom:12.0pt;">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="font-size:10.0pt;">On Tuesday, 19 January 2016, 22:55:37, Graeme Foot <<a rel="nofollow" shape="rect" ymailto="mailto:Graeme.Foot@touchcut.com" target="_blank" href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>>
wrote:</span><span style=""></span></div>
</div>
</div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style="">Hi,<br clear="none">
<br clear="none">
We also use the EL7041 in production, but have also used an EL7031 for testing.<br clear="none">
<br clear="none">
The default the PDO mapping is for velocity control. You need to change it to use the position control PDO's.<br clear="none">
<br clear="none">
<br clear="none">
For the EL7031 the PDO setup I use is:<br clear="none">
<br clear="none">
ec_pdo_entry_info_t EL7031_pdoEntries[] = {<br clear="none">
// 0x1602, stepper control (0)<br clear="none">
{0x7010, 0x01, 1}, // Enable<br clear="none">
{0x7010, 0x02, 1}, // Reset <br clear="none">
{0x7010, 0x03, 1}, // Reduce torque <br clear="none">
{0x0000, 0x00, 5}, // spacer <br clear="none">
{0x0000, 0x00, 8}, // spacer <br clear="none">
<br clear="none">
// 0x1603, stepper pos (5)<br clear="none">
{0x7010, 0x11, 32}, // Target position<br clear="none">
<br clear="none">
<br clear="none">
// 0x1a03, stepper status (6)<br clear="none">
{0x6010, 0x01, 1}, // Ready to enable <br clear="none">
{0x6010, 0x02, 1}, // Ready <br clear="none">
{0x6010, 0x03, 1}, // Warning <br clear="none">
{0x6010, 0x04, 1}, // Error <br clear="none">
{0x6010, 0x05, 1}, // Moving positive <br clear="none">
{0x6010, 0x06, 1}, // Moving negative <br clear="none">
{0x6010, 0x07, 1}, // Torque reduced <br clear="none">
{0x0000, 0x00, 1}, // spacer <br clear="none">
{0x0000, 0x00, 3}, // spacer<br clear="none">
{0x6010, 0x0c, 1}, // Digital input 1 <br clear="none">
{0x6010, 0x0d, 1}, // Digital input 2 <br clear="none">
{0x1c32, 0x20, 1}, // Sync error <br clear="none">
{0x0000, 0x00, 1}, // spacer <br clear="none">
{0x1803, 0x09, 1}, // *** unknown ***<br clear="none">
<br clear="none">
};<br clear="none">
<br clear="none">
ec_pdo_info_t EL7031_pdos[] = {<br clear="none">
{0x1602, 5, EL7031_pdoEntries + 0},<br clear="none">
{0x1603, 1, EL7031_pdoEntries + 5},<br clear="none">
{0x1a03, 14, EL7031_pdoEntries + 6},<br clear="none">
};<br clear="none">
<br clear="none">
ec_sync_info_t EL7031_syncs[] = {<br clear="none">
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},<br clear="none">
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<br clear="none">
{2, EC_DIR_OUTPUT, 2, EL7031_pdos + 0, EC_WD_DISABLE},<br clear="none">
{3, EC_DIR_INPUT, 1, EL7031_pdos + 2, EC_WD_DISABLE},<br clear="none">
{0xff}<br clear="none">
};<br clear="none">
<br clear="none">
<br clear="none">
PDO Item #5 {0x7010, 0x11, 32} is the Target position.<br clear="none">
<br clear="none">
<br clear="none">
You will want to pre-configure some of the SDO values:<br clear="none">
<br clear="none">
maxCurrent 0x8010, 0x01<br clear="none">
reducedCurrent 0x8010, 0x02<br clear="none">
nominalVoltage 0x8010, 0x03<br clear="none">
motorCoilResistance 0x8010, 0x04<br clear="none">
motorFullSteps 0x8010, 0x06<br clear="none">
maxSpeedRange 0x8012, 0x05<br clear="none">
reversed 0x8012, 0x09<br clear="none">
<br clear="none">
<br clear="none">
On initialisation you need to set the motor to use the Position Controller mode of operation (3):<br clear="none">
<br clear="none">
ecrt_slave_config_sdo8(dev->slaveConfig, 0x8012, 0x01, 3);<br clear="none">
<br clear="none">
<br clear="none">
You may also want to set up the distributed clock (eg:)<br clear="none">
<br clear="none">
ecrt_slave_config_dc(dev->slaveConfig, 0x0300, g_app.scanTimeNS, 500000, 0, 0);<br clear="none">
<br clear="none">
<br clear="none">
You will probably want to set up a motor enable state machine but the guts of it is that you will want to:<br clear="none">
<br clear="none">
- before enabling, if the error status bit (PDO Item #9 {0x6010, 0x04, 1}) is set<br clear="none">
set the faultReset control bit (PDO Item #1 {0x7010, 0x02, 1}) for around 100ms<br clear="none">
<br clear="none">
- ensure the readyToEnable status bit (PDO Item #6 {0x6010, 0x01, 1}) is on<br clear="none">
if there is no error set the enable control bit (PDO Item #0 {0x7010, 0x01, 1})<br clear="none">
wait until the ready status bit (PDO Item #7 {0x6010, 0x02, 1}) is on<br clear="none">
<br clear="none">
<br clear="none">
Once enabled you need to update the target position (PDO Item #5 {0x7010, 0x11, 32}) every scan cycle with the position you want to go to. It is up to you to create a motion profile for the motor and then figure out what the target position is at each time
increment.<br clear="none">
<br clear="none">
<br clear="none">
Lastly, if you get the warning or error status bits set you can look up what the error or warning is via the 0xA010 SDO diagnostic bits (0xA010:0x01 - 0xA010:0x11). Note: these are only available via SDO access, so what I do is have a state machine that looks
them up if the warning or error status bits are set.<br clear="none">
<br clear="none">
<br clear="none">
Hope this helps.<br clear="none">
<br clear="none">
<br clear="none">
Regards,<br clear="none">
<br clear="none">
Graeme Foot<br clear="none">
Kinetic Engineering Design Ltd.<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
-----Original Message-----<br clear="none">
From: etherlab-users [mailto:<a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users-bounces@etherlab.org" target="_blank" href="mailto:etherlab-users-bounces@etherlab.org">etherlab-users-bounces@etherlab.org</a>] On Behalf Of Thomas Bitsky Jr<br clear="none">
Sent: Wednesday, 20 January 2016 3:57 a.m.<br clear="none">
To: Paul Mulligan; <a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users@etherlab.org" target="_blank" href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br clear="none">
Subject: Re: [etherlab-users] Controlling motor drivers<br clear="none">
<br clear="none">
I use the EL7041 often. He’s a quick copy/paste of how I make it move to position. The code snippet below writes to EtherLAB through a library I wrote, but the tasks required should be pretty obvious.<br clear="none">
<br clear="none">
Thanks!<br clear="none">
============<br clear="none">
<br clear="none">
static int<br clear="none">
stateIdle(void* lp)<br clear="none">
{<br clear="none">
EL7041StepperInterface* p; <br clear="none">
EL7041_ENTER(p, lp);<br clear="none">
<br clear="none">
if (p->doMove)<br clear="none">
{<br clear="none">
p->doMove = false;<br clear="none">
<br clear="none">
<br clear="none">
if ( !lcxReadPdoBit(p->pdoOffset + IX_READY) )<br clear="none">
{<br clear="none">
PRINT( "EL7041.%s not ready for motion. Cancelling.\n",<br clear="none">
__FUNCTION__ );<br clear="none">
return StateMachineRunning;<br clear="none">
}<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
lcxWritePdoUInt16(p->pdoOffset + QW_SETACCEL, p->targetAccel );<br clear="none">
lcxWritePdoUInt16(p->pdoOffset + QW_SETDECEL, p->targetDecel );<br clear="none">
lcxWritePdoUInt16(p->pdoOffset + QW_SETVELOCITY, p->targetVelocity );<br clear="none">
<br clear="none">
p->fsm = &stateWaitWriteMotionParameters;<br clear="none">
return StateMachineTransition;<br clear="none">
}<br clear="none">
<br clear="none">
}<br clear="none">
<br clear="none">
static int<br clear="none">
stateWaitWriteMotionParameters(void* lp) {<br clear="none">
EL7041StepperInterface* p;<br clear="none">
EL7041_ENTER(p, lp);<br clear="none">
<br clear="none">
p->fsm = &stateWriteStartType;<br clear="none">
return StateMachineTransition;<br clear="none">
}<br clear="none">
<br clear="none">
<br clear="none">
static int<br clear="none">
stateWriteStartType(void* lp)<br clear="none">
{<br clear="none">
EL7041StepperInterface* p;<br clear="none">
EL7041_ENTER(p, lp);<br clear="none">
<br clear="none">
lcxWritePdoUInt32(p->pdoOffset + QW_SETTARGETPOSITION, p->setTargetPosition );<br clear="none">
lcxWritePdoUInt32(p->pdoOffset + QW_SETSTARTTYPE, p->setStartType );<br clear="none">
<br clear="none">
p->ton = TON_ENDTIME(100);<br clear="none">
<br clear="none">
p->fsm = &stateWaitWriteStartType;<br clear="none">
return StateMachineTransition;<br clear="none">
}<br clear="none">
<br clear="none">
<br clear="none">
static int<br clear="none">
stateWaitWriteStartType(void* lp)<br clear="none">
{<br clear="none">
EL7041StepperInterface* p;<br clear="none">
EL7041_ENTER(p, lp);<br clear="none">
<br clear="none">
if (TON_ISDONE(p->ton))<br clear="none">
{<br clear="none">
/*<br clear="none">
* ALERT!<br clear="none">
* This command should start motion on the axis.<br clear="none">
*/<br clear="none">
lcxWritePdoBit(p->pdoOffset + QX_CONTROLEXECUTE, true);<br clear="none">
<br clear="none">
p->ton = TON_ENDTIME(500);<br clear="none">
p->fsm = &stateWaitExecute;<br clear="none">
return StateMachineTransition;<br clear="none">
}<br clear="none">
<br clear="none">
return StateMachineRunning;<br clear="none">
}<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
Thomas C. Bitsky Jr. | Lead Developer<br clear="none">
ADC | automateddesign.com <<a rel="nofollow" shape="rect" target="_blank" href="http://automateddesign.com/">http://automateddesign.com/</a>><br clear="none">
<br clear="none">
Follow ADC news and media:<br clear="none">
Facebook <<a rel="nofollow" shape="rect" target="_blank" href="https://facebook.com/automateddesigncorp">https://facebook.com/automateddesigncorp</a>> | Twitter <<a rel="nofollow" shape="rect" target="_blank" href="https://twitter.com/ADCSportsLogic">https://twitter.com/ADCSportsLogic</a>> | YouTube <<a rel="nofollow" shape="rect" target="_blank" href="https://www.youtube.com/user/ADCSportsLogic">https://www.youtube.com/user/ADCSportsLogic</a>><br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
From: etherlab-users <<a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users-bounces@etherlab.org" target="_blank" href="mailto:etherlab-users-bounces@etherlab.org">etherlab-users-bounces@etherlab.org</a>> on behalf of Paul Mulligan <<a rel="nofollow" shape="rect" ymailto="mailto:mulligan252@yahoo.ie" target="_blank" href="mailto:mulligan252@yahoo.ie">mulligan252@yahoo.ie</a>><br clear="none">
Reply-To: Paul Mulligan <<a rel="nofollow" shape="rect" ymailto="mailto:mulligan252@yahoo.ie" target="_blank" href="mailto:mulligan252@yahoo.ie">mulligan252@yahoo.ie</a>><br clear="none">
Date: Tuesday, January 19, 2016 at 7:49 AM<br clear="none">
To: "<a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users@etherlab.org" target="_blank" href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a>" <<a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users@etherlab.org" target="_blank" href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a>><br clear="none">
Subject: [etherlab-users] Controlling motor drivers<br clear="none">
<br clear="none">
<br clear="none">
Hi, (Formatting was wrong on previous post)<br clear="none">
<br clear="none">
We bought various Beckoff modules for Digital in , Digital out, Analogue in and Stepper Motor control.
<br clear="none">
<br clear="none">
I am able to communicate with with the digital I/O and analogue input slave modules from Ethercat master IGH 1.5.2 without problems, but the stepper motor controller (EL7031) is more complicated.<br clear="none">
<br clear="none">
Below is a list of the PDO entries for the motor controller retrieved from the Ethercat bus using the command line tool with the cstruct option.<br clear="none">
<br clear="none">
I am only able to set the velocity and then set the enable bit to start the motor running. I have no idea how to command the motor to just turn a certain amount of steps and change direction etc. I have tried to set a counter value but it doesn't make a difference.
Also, if I set the bits to move positive or move negative, it doesn't change direction as I would expect. I can't seem to find any documentation or examples on how to control motors with this module EL7031. If anyone has any information or knowledge , I would
really appreciate your help. Thanks<br clear="none">
<br clear="none">
<br clear="none">
<br clear="none">
ec_pdo_entry_info_t slave_6_pdo_entries[] = {<br clear="none">
{0x0000, 0x00, 1}, /* Gap */<br clear="none">
{0x7000, 0x02, 1}, /* Enable latch extern on positive edge */<br clear="none">
{0x7000, 0x03, 1}, /* Set counter */<br clear="none">
{0x7000, 0x04, 1}, /* Enable latch extern on negative edge */<br clear="none">
{0x0000, 0x00, 4}, /* Gap */<br clear="none">
{0x0000, 0x00, 8}, /* Gap */<br clear="none">
{0x7000, 0x11, 16}, /* Set counter value */<br clear="none">
{0x7010, 0x01, 1}, /* Enable */<br clear="none">
{0x7010, 0x02, 1}, /* Reset */<br clear="none">
{0x7010, 0x03, 1}, /* Reduce torque */<br clear="none">
{0x0000, 0x00, 5}, /* Gap */<br clear="none">
{0x0000, 0x00, 8}, /* Gap */<br clear="none">
{0x7010, 0x21, 16}, /* Velocity */<br clear="none">
{0x0000, 0x00, 1}, /* Gap */<br clear="none">
{0x6000, 0x02, 1}, /* Latch extern valid */<br clear="none">
{0x6000, 0x03, 1}, /* Set counter done */<br clear="none">
{0x6000, 0x04, 1}, /* Counter underflow */<br clear="none">
{0x6000, 0x05, 1}, /* Counter overflow */<br clear="none">
{0x0000, 0x00, 3}, /* Gap */<br clear="none">
{0x0000, 0x00, 4}, /* Gap */<br clear="none">
{0x6000, 0x0d, 1}, /* Status of extern latch */<br clear="none">
{0x6000, 0x0e, 1}, /* Sync error */<br clear="none">
{0x0000, 0x00, 1}, /* Gap */<br clear="none">
{0x6000, 0x10, 1}, /* TxPDO Toggle */<br clear="none">
{0x6000, 0x11, 16}, /* Counter value */<br clear="none">
{0x6000, 0x12, 16}, /* Latch value */<br clear="none">
{0x6010, 0x01, 1}, /* Ready to enable */<br clear="none">
{0x6010, 0x02, 1}, /* Ready */<br clear="none">
{0x6010, 0x03, 1}, /* Warning */<br clear="none">
{0x6010, 0x04, 1}, /* Error */<br clear="none">
{0x6010, 0x05, 1}, /* Moving positive */<br clear="none">
{0x6010, 0x06, 1}, /* Moving negative */<br clear="none">
{0x6010, 0x07, 1}, /* Torque reduced */<br clear="none">
{0x0000, 0x00, 1}, /* Gap */<br clear="none">
{0x0000, 0x00, 3}, /* Gap */<br clear="none">
{0x6010, 0x0c, 1}, /* Digital input 1 */<br clear="none">
{0x6010, 0x0d, 1}, /* Digital input 2 */<br clear="none">
{0x6010, 0x0e, 1}, /* Sync error */<br clear="none">
{0x0000, 0x00, 1}, /* Gap */<br clear="none">
{0x6010, 0x10, 1}, /* TxPDO Toggle */ }; _______________________________________________<br clear="none">
etherlab-users mailing list</span></div>
</div>
</div>
</div>
<div id="yiv5157799637yqtfd93031">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""><br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:etherlab-users@etherlab.org" target="_blank" href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a></span></div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://lists.etherlab.org/mailman/listinfo/etherlab-users">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a></span></div>
</div>
</div>
</div>
<div id="yiv5157799637yqtfd01225">
<div>
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div>
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div>
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="margin-bottom:12.0pt;">
<div class="yiv5157799637MsoNormal" style="background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="yiv5157799637MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div><br><br></div> </div> </div> </div></div></body></html>