<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
p.yiv1852865082msoacetate, li.yiv1852865082msoacetate, div.yiv1852865082msoacetate
        {mso-style-name:yiv1852865082msoacetate;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.yiv1852865082msonormal, li.yiv1852865082msonormal, div.yiv1852865082msonormal
        {mso-style-name:yiv1852865082msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.yiv1852865082msochpdefault, li.yiv1852865082msochpdefault, div.yiv1852865082msochpdefault
        {mso-style-name:yiv1852865082msochpdefault;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.yiv1852865082msohyperlink
        {mso-style-name:yiv1852865082msohyperlink;}
span.yiv1852865082msohyperlinkfollowed
        {mso-style-name:yiv1852865082msohyperlinkfollowed;}
span.yiv1852865082emailstyle17
        {mso-style-name:yiv1852865082emailstyle17;}
p.yiv1852865082msonormal1, li.yiv1852865082msonormal1, div.yiv1852865082msonormal1
        {mso-style-name:yiv1852865082msonormal1;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.yiv1852865082msohyperlink1
        {mso-style-name:yiv1852865082msohyperlink1;
        color:blue;
        text-decoration:underline;}
span.yiv1852865082msohyperlinkfollowed1
        {mso-style-name:yiv1852865082msohyperlinkfollowed1;
        color:purple;
        text-decoration:underline;}
p.yiv1852865082msoacetate1, li.yiv1852865082msoacetate1, div.yiv1852865082msoacetate1
        {mso-style-name:yiv1852865082msoacetate1;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Times New Roman","serif";}
span.yiv1852865082emailstyle171
        {mso-style-name:yiv1852865082emailstyle171;
        color:#1F497D;}
p.yiv1852865082msochpdefault1, li.yiv1852865082msochpdefault1, div.yiv1852865082msochpdefault1
        {mso-style-name:yiv1852865082msochpdefault1;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle29
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I don’t use
</span><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">ecrt_domain_reg_pdo_entry_list()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> so can’t comment on that one.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">To configure my devices I use (without error checking):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">  /* configure the slave */<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">  dev->slaveConfig = ecrt_master_slave_config(ecMod->master, dev->alias, dev->position, dev->vendorID, dev->productCode);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">  /* configure the PDOs */<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">  ecRes = ecrt_slave_config_pdos(dev->slaveConfig, EC_END, EL7031_syncs);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I then use the following to get addresses for the PDO items:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">  offset = ecrt_slave_config_reg_pdo_entry(dev->slaveConfig, EL7031_pdoEntries[pdoIdx].index,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                                           EL7031_pdoEntries[_pdoIdx].subindex,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">                                           ecMod->domains[domIdx].domain, &bitPos);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Re Target Position updating:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So if you have an EtherCAT cycle time of 1000Hz (1 ms) then:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- 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<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- 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<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- 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<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- 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<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This motor module is a very low level of control.  The app needs to provide the high level control ie:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- what does motor count mean (ie you need a scale factor between you realworld units (eg mm) and the motors counts units.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- 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<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">- also motors don’t like instantaneous speed changes so you also need to take care of acceleration and deceleration.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">PS: remember to also reply to the etherlab forums so others can learn and comment too.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Paul Mulligan [mailto:mulligan252@yahoo.ie]
<br>
<b>Sent:</b> Friday, 22 January 2016 4:37 a.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div id="yui_3_16_0_1_1453387034244_3124">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Thanks for that Graeme.<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3125">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3123">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">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".
<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4432">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4473">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">If I remove the motor entries from the domain1_regs[] however, there are no problems. Am I missing something else?<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4610">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4609">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">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?<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4378">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4430">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3551">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3552">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3655">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">/* Master 0, Slave 6, "EL7031"<br id="yui_3_16_0_1_1453387034244_3554">
 * Vendor ID:       0x00000002<br id="yui_3_16_0_1_1453387034244_3556">
 * Product code:    0x1b773052<br id="yui_3_16_0_1_1453387034244_3558">
 * Revision number: 0x00170000<br id="yui_3_16_0_1_1453387034244_3560">
 */<br id="yui_3_16_0_1_1453387034244_3562">
<br id="yui_3_16_0_1_1453387034244_3564">
ec_pdo_entry_info_t slave_6_pdo_entries[] =<br id="yui_3_16_0_1_1453387034244_3566">
{<br id="yui_3_16_0_1_1453387034244_3568">
    // 0x1602, stepper control (0)<br id="yui_3_16_0_1_1453387034244_3570">
    {0x7010, 0x01, 1},    // Enable<br id="yui_3_16_0_1_1453387034244_3572">
    {0x7010, 0x02, 1},    // Reset<br id="yui_3_16_0_1_1453387034244_3574">
    {0x7010, 0x03, 1},    // Reduce torque<br id="yui_3_16_0_1_1453387034244_3576">
    {0x0000, 0x00, 5},    //  spacer<br id="yui_3_16_0_1_1453387034244_3578">
    {0x0000, 0x00, 8},    //  spacer<br id="yui_3_16_0_1_1453387034244_3580">
<br id="yui_3_16_0_1_1453387034244_3582">
    // 0x1603, stepper pos (5)<br id="yui_3_16_0_1_1453387034244_3584">
    {0x7010, 0x11, 32},  // Target position<br id="yui_3_16_0_1_1453387034244_3586">
<br id="yui_3_16_0_1_1453387034244_3588">
<br id="yui_3_16_0_1_1453387034244_3590">
    // 0x1a03, stepper status (6)<br id="yui_3_16_0_1_1453387034244_3592">
    {0x6010, 0x01, 1},    // Ready to enable<br id="yui_3_16_0_1_1453387034244_3594">
    {0x6010, 0x02, 1},    // Ready<br id="yui_3_16_0_1_1453387034244_3596">
    {0x6010, 0x03, 1},    // Warning<br id="yui_3_16_0_1_1453387034244_3598">
    {0x6010, 0x04, 1},    // Error<br id="yui_3_16_0_1_1453387034244_3600">
    {0x6010, 0x05, 1},    // Moving positive<br id="yui_3_16_0_1_1453387034244_3602">
    {0x6010, 0x06, 1},    // Moving negative<br id="yui_3_16_0_1_1453387034244_3604">
    {0x6010, 0x07, 1},    // Torque reduced<br id="yui_3_16_0_1_1453387034244_3606">
    {0x0000, 0x00, 1},    //  spacer<br id="yui_3_16_0_1_1453387034244_3608">
    {0x0000, 0x00, 3},    //  spacer<br id="yui_3_16_0_1_1453387034244_3610">
    {0x6010, 0x0c, 1},    // Digital input 1<br id="yui_3_16_0_1_1453387034244_3612">
    {0x6010, 0x0d, 1},    // Digital input 2<br id="yui_3_16_0_1_1453387034244_3614">
    {0x1c32, 0x20, 1},    // Sync error<br id="yui_3_16_0_1_1453387034244_3616">
    {0x0000, 0x00, 1},    //  spacer<br id="yui_3_16_0_1_1453387034244_3618">
    {0x1803, 0x09, 1},    // *** unknown ***<br id="yui_3_16_0_1_1453387034244_3620">
<br id="yui_3_16_0_1_1453387034244_3622">
};<br id="yui_3_16_0_1_1453387034244_3624">
<br id="yui_3_16_0_1_1453387034244_3626">
ec_pdo_info_t slave_6_pdos[] =<br id="yui_3_16_0_1_1453387034244_3628">
{<br id="yui_3_16_0_1_1453387034244_3630">
    {0x1602, 5, slave_6_pdo_entries + 0},<br id="yui_3_16_0_1_1453387034244_3632">
    {0x1603, 1, slave_6_pdo_entries + 5},<br id="yui_3_16_0_1_1453387034244_3634">
    {0x1a03, 14, slave_6_pdo_entries + 6},<br id="yui_3_16_0_1_1453387034244_3636">
};<br id="yui_3_16_0_1_1453387034244_3638">
<br id="yui_3_16_0_1_1453387034244_3640">
ec_sync_info_t slave_6_syncs[] =<br id="yui_3_16_0_1_1453387034244_3642">
{<br id="yui_3_16_0_1_1453387034244_3644">
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},<br id="yui_3_16_0_1_1453387034244_3646">
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<br id="yui_3_16_0_1_1453387034244_3648">
    {2, EC_DIR_OUTPUT, 2, slave_6_pdos + 0, EC_WD_DISABLE},<br id="yui_3_16_0_1_1453387034244_3650">
    {3, EC_DIR_INPUT, 1, slave_6_pdos + 2, EC_WD_DISABLE},<br id="yui_3_16_0_1_1453387034244_3652">
    {0xff}<br id="yui_3_16_0_1_1453387034244_3654">
};<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3749">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3753">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">/*------------------------------------------------------------*/<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4216">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3922">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">//motor<br id="yui_3_16_0_1_1453387034244_3853">
<br id="yui_3_16_0_1_1453387034244_3855">
//commands<br id="yui_3_16_0_1_1453387034244_3857">
static unsigned int off_motor_speed;<br id="yui_3_16_0_1_1453387034244_3859">
static unsigned int off_motor_enable;<br id="yui_3_16_0_1_1453387034244_3861">
static unsigned int off_motor_reset;<br id="yui_3_16_0_1_1453387034244_3863">
static unsigned int off_motor_target_pos;<br id="yui_3_16_0_1_1453387034244_3865">
<br id="yui_3_16_0_1_1453387034244_3867">
//status<br id="yui_3_16_0_1_1453387034244_3869">
static unsigned int off_motor_err_status;<br id="yui_3_16_0_1_1453387034244_3871">
static unsigned int off_motor_ready_to_enable;<br id="yui_3_16_0_1_1453387034244_3873">
static unsigned int off_motor_ready_status;<br id="yui_3_16_0_1_1453387034244_3875">
<br id="yui_3_16_0_1_1453387034244_3877">
<br id="yui_3_16_0_1_1453387034244_3879">
static unsigned int bitPosit = 1;<br id="yui_3_16_0_1_1453387034244_3883">
<br id="yui_3_16_0_1_1453387034244_3885">
const static ec_pdo_entry_reg_t domain1_regs[] =<br id="yui_3_16_0_1_1453387034244_3887">
{<br id="yui_3_16_0_1_1453387034244_3889">
    {DigOutSlave1Pos,  Beckhoff_EL2008, 0x7000, 1, &off_digout1},<br id="yui_3_16_0_1_1453387034244_3891">
    {DigOutSlave2Pos,  Beckhoff_EL2008, 0x7000, 1, &off_digout2},<br id="yui_3_16_0_1_1453387034244_3893">
    {DigInSlave1Pos,   Beckhoff_EL1008, 0x6000, 1, &off_digin1},<br id="yui_3_16_0_1_1453387034244_3895">
    {DigInSlave2Pos,   Beckhoff_EL1008, 0x6000, 1, &off_digin2},<br id="yui_3_16_0_1_1453387034244_3897">
    {AnaInSlavePos,    Beckhoff_EL3001, 0x6000, 0x11, &off_anain},<br id="yui_3_16_0_1_1453387034244_3899">
    {MotorSlavePos,    Beckhoff_EL7031, 0x7010, 0x21, &off_motor_speed},<br id="yui_3_16_0_1_1453387034244_3901">
    {MotorSlavePos,    Beckhoff_EL7031, 0x7010, 0x01, &off_motor_enable},<br id="yui_3_16_0_1_1453387034244_3903">
    {MotorSlavePos,    Beckhoff_EL7031, 0x6010, 0x04, &off_motor_err_status, &bitPosit},<br id="yui_3_16_0_1_1453387034244_3905">
    {MotorSlavePos,    Beckhoff_EL7031, 0x7010, 0x02, &off_motor_reset, &bitPosit},<br id="yui_3_16_0_1_1453387034244_3907">
    {MotorSlavePos,    Beckhoff_EL7031, 0x6010, 0x01, &off_motor_ready_to_enable, &bitPosit},<br id="yui_3_16_0_1_1453387034244_3909">
    {MotorSlavePos,    Beckhoff_EL7031, 0x6010, 0x02, &off_motor_ready_status, &bitPosit},<br id="yui_3_16_0_1_1453387034244_3911">
    {MotorSlavePos,    Beckhoff_EL7031, 0x7010, 0x11, &off_motor_target_pos, &bitPosit},<br id="yui_3_16_0_1_1453387034244_3913">
    {}<br id="yui_3_16_0_1_1453387034244_3915">
};<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_3122">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">/*-----------------------------------------------------------------------------------------------------------------------*/<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4119">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">/* Inside main function*/<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4120">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><br>
<br>
<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4429">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><br>
<br>
<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_1_1453387034244_4118">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs))<br id="yui_3_16_0_1_1453387034244_4111">
{<br id="yui_3_16_0_1_1453387034244_4113">
        fprintf(stderr, "PDO entry registration failed!\n");<br id="yui_3_16_0_1_1453387034244_4115">
        return -1;<br id="yui_3_16_0_1_1453387034244_4117">
}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">On Wednesday, 20 January 2016, 22:54:33, Graeme Foot <<a href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>> wrote:</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
<div>
<div id="yiv1852865082">
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Hi,</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">If you have a Beckhoff module you can easily download its documentation from their site using the url:
<a href="http://www.beckhoff.com/%3cmodel_number%3e/">http://www.beckhoff.com/<model_number>/</a></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Eg:
<a href="http://www.beckhoff.com/EL7031/" target="_blank">http://www.beckhoff.com/EL7031/</a></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"><img border="0" width="764" height="426" id="yiv1852865082Picture_x0020_1" src="cid:image001.png@01D154FC.1E6D0CD0"></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"><img border="0" width="374" height="168" id="yiv1852865082Picture_x0020_2" src="cid:image002.png@01D154FC.1E6D0CD0"></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Then have a look at the 0x1a0x groups.  These are the preconfigured readonly item groups.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">It’s also a good idea to get the Beckhoff XML device descriptions from:
<a href="http://download.beckhoff.com/download/Config/EtherCAT/XML_Device_Description/Beckhoff_EtherCAT_XML.zip" target="_blank">
http://download.beckhoff.com/download/Config/EtherCAT/XML_Device_Description/Beckhoff_EtherCAT_XML.zip</a></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">For my application I wanted “Position control”, so I used the following:</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">  <AlternativeSmMapping></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">    <Name>Position control</Name></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">    <Sm No="2"></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">      <Pdo>#x1601</Pdo></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">      <Pdo>#x1602</Pdo></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">      <Pdo>#x1603</Pdo></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">    </Sm></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">    <Sm No="3"></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">      <Pdo>#x1a01</Pdo></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">      <Pdo>#x1a03</Pdo></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">    </Sm></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">  </AlternativeSmMapping></span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">But I also didn’t want to use latching, so in my case I left off 0x1601 and 0x1a01.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">As to changing moving direction, you just need to change the Position Target in the negative direction.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">0</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">0   // accelerate moving forward</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">1</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">3</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">6</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">10  // decelerate moving forward</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">14</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">17</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">19</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">20  // pause 
</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">20</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">20</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">20  // accelerate moving reverse</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">19</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">17</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">14</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">10  // decelerate moving reverse</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">6</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">3</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">1</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">0</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">0</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">...</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Note: If the above scan time is 1000Hz then the above would be accelerating/decelerating at 1000 counts/second.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">You can use kinematic equations to figure out a simple kinematic profile (eg from:
<a href="http://www.physicsclassroom.com/class/1DKin/Lesson-6/Kinematic-Equations" target="_blank">
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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Regards,</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Graeme Foot</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black">Kinetic Engineering Design Ltd.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11.0pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<div id="yiv1852865082yqt39867">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div>
<p class="MsoNormal" style="background:white"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Helvetica","sans-serif";color:black">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Helvetica","sans-serif";color:black"> Paul
 Mulligan [<a href="mailto:mulligan252@yahoo.ie">mailto:mulligan252@yahoo.ie</a>]
<br>
<b>Sent:</b> Thursday, 21 January 2016 3:32 a.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Subject:</b> Re: [etherlab-users] Controlling motor drivers</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"> <o:p></o:p></span></p>
</div>
<div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Hi Graeme,</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Thanks alot for that.</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">I'm completely new to Ethercat. Where can I find the SDO entries with indexes that you mentioned, for any device? </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">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="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Also, in order to change moving direction of the motor, do I need to change an SDO value ? </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Regards,</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div id="yiv1852865082yui_3_16_0_1_1453295784417_6224">
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black">Paul</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div>
<div style="margin-bottom:12.0pt">
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:"Helvetica","sans-serif";color:black"> </span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Helvetica","sans-serif";color:black">On Tuesday, 19 January 2016, 22:55:37, Graeme Foot <<a href="mailto:Graeme.Foot@touchcut.com" target="_blank">Graeme.Foot@touchcut.com</a>>
 wrote:</span><span style="font-family:"Helvetica","sans-serif";color:black"><o:p></o:p></span></p>
</div>
</div>
<div style="margin-bottom:12.0pt">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"> <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black">Hi,<br>
<br>
We also use the EL7041 in production, but have also used an EL7031 for testing.<br>
<br>
The default the PDO mapping is for velocity control.  You need to change it to use the position control PDO's.<br>
<br>
<br>
For the EL7031 the PDO setup I use is:<br>
<br>
ec_pdo_entry_info_t EL7031_pdoEntries[] = {<br>
    // 0x1602, stepper control (0)<br>
    {0x7010, 0x01, 1},    // Enable<br>
    {0x7010, 0x02, 1},    // Reset <br>
    {0x7010, 0x03, 1},    // Reduce torque <br>
    {0x0000, 0x00, 5},    //  spacer <br>
    {0x0000, 0x00, 8},    //  spacer <br>
    <br>
    // 0x1603, stepper pos (5)<br>
    {0x7010, 0x11, 32},  // Target position<br>
<br>
    <br>
    // 0x1a03, stepper status (6)<br>
    {0x6010, 0x01, 1},    // Ready to enable <br>
    {0x6010, 0x02, 1},    // Ready <br>
    {0x6010, 0x03, 1},    // Warning <br>
    {0x6010, 0x04, 1},    // Error <br>
    {0x6010, 0x05, 1},    // Moving positive <br>
    {0x6010, 0x06, 1},    // Moving negative <br>
    {0x6010, 0x07, 1},    // Torque reduced <br>
    {0x0000, 0x00, 1},    //  spacer <br>
    {0x0000, 0x00, 3},    //  spacer<br>
    {0x6010, 0x0c, 1},    // Digital input 1 <br>
    {0x6010, 0x0d, 1},    // Digital input 2 <br>
    {0x1c32, 0x20, 1},    // Sync error <br>
    {0x0000, 0x00, 1},    //  spacer <br>
    {0x1803, 0x09, 1},    // *** unknown ***<br>
  <br>
};<br>
<br>
ec_pdo_info_t EL7031_pdos[] = {<br>
    {0x1602, 5, EL7031_pdoEntries + 0},<br>
    {0x1603, 1, EL7031_pdoEntries + 5},<br>
    {0x1a03, 14, EL7031_pdoEntries + 6},<br>
};<br>
<br>
ec_sync_info_t EL7031_syncs[] = {<br>
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},<br>
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<br>
    {2, EC_DIR_OUTPUT, 2, EL7031_pdos + 0, EC_WD_DISABLE},<br>
    {3, EC_DIR_INPUT, 1, EL7031_pdos + 2, EC_WD_DISABLE},<br>
    {0xff}<br>
};<br>
<br>
<br>
PDO Item #5 {0x7010, 0x11, 32} is the Target position.<br>
<br>
<br>
You will want to pre-configure some of the SDO values:<br>
<br>
  maxCurrent          0x8010, 0x01<br>
  reducedCurrent      0x8010, 0x02<br>
  nominalVoltage      0x8010, 0x03<br>
  motorCoilResistance 0x8010, 0x04<br>
  motorFullSteps      0x8010, 0x06<br>
  maxSpeedRange      0x8012, 0x05<br>
  reversed            0x8012, 0x09<br>
<br>
<br>
On initialisation you need to set the motor to use the Position Controller mode of operation (3):<br>
<br>
  ecrt_slave_config_sdo8(dev->slaveConfig, 0x8012, 0x01, 3);<br>
<br>
<br>
You may also want to set up the distributed clock (eg:)<br>
<br>
  ecrt_slave_config_dc(dev->slaveConfig, 0x0300, g_app.scanTimeNS, 500000, 0, 0);<br>
<br>
<br>
You will probably want to set up a motor enable state machine but the guts of it is that you will want to:<br>
<br>
- before enabling, if the error status bit (PDO Item #9 {0x6010, 0x04, 1}) is set<br>
  set the faultReset control bit (PDO Item #1 {0x7010, 0x02, 1}) for around 100ms<br>
<br>
- ensure the readyToEnable status bit (PDO Item #6 {0x6010, 0x01, 1}) is on<br>
  if there is no error set the enable control bit (PDO Item #0 {0x7010, 0x01, 1})<br>
  wait until the ready status bit (PDO Item #7 {0x6010, 0x02, 1}) is on<br>
<br>
<br>
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>
<br>
<br>
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>
<br>
<br>
Hope this helps.<br>
<br>
<br>
Regards,<br>
<br>
Graeme Foot<br>
Kinetic Engineering Design Ltd.<br>
<br>
  <br>
<br>
-----Original Message-----<br>
From: etherlab-users [mailto:<a href="mailto:etherlab-users-bounces@etherlab.org" target="_blank">etherlab-users-bounces@etherlab.org</a>] On Behalf Of Thomas Bitsky Jr<br>
Sent: Wednesday, 20 January 2016 3:57 a.m.<br>
To: Paul Mulligan; <a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a><br>
Subject: Re: [etherlab-users] Controlling motor drivers<br>
<br>
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>
<br>
Thanks!<br>
============<br>
<br>
static int<br>
stateIdle(void* lp)<br>
{<br>
    EL7041StepperInterface* p;    <br>
    EL7041_ENTER(p, lp);<br>
        <br>
    if (p->doMove)<br>
    {<br>
        p->doMove = false;<br>
        <br>
        <br>
        if ( !lcxReadPdoBit(p->pdoOffset + IX_READY) )<br>
        {<br>
            PRINT( "EL7041.%s not ready for motion. Cancelling.\n",<br>
                __FUNCTION__ );<br>
            return StateMachineRunning;<br>
        }<br>
        <br>
<br>
        <br>
        <br>
        lcxWritePdoUInt16(p->pdoOffset + QW_SETACCEL, p->targetAccel );<br>
        lcxWritePdoUInt16(p->pdoOffset + QW_SETDECEL, p->targetDecel );<br>
        lcxWritePdoUInt16(p->pdoOffset + QW_SETVELOCITY, p->targetVelocity );<br>
        <br>
        p->fsm = &stateWaitWriteMotionParameters;<br>
        return StateMachineTransition;<br>
    }<br>
<br>
}<br>
<br>
static int<br>
stateWaitWriteMotionParameters(void* lp) {<br>
    EL7041StepperInterface* p;<br>
    EL7041_ENTER(p, lp);<br>
        <br>
    p->fsm = &stateWriteStartType;<br>
    return StateMachineTransition;<br>
}<br>
<br>
<br>
static int<br>
stateWriteStartType(void* lp)<br>
{<br>
    EL7041StepperInterface* p;<br>
    EL7041_ENTER(p, lp);<br>
    <br>
    lcxWritePdoUInt32(p->pdoOffset + QW_SETTARGETPOSITION, p->setTargetPosition );<br>
    lcxWritePdoUInt32(p->pdoOffset + QW_SETSTARTTYPE, p->setStartType );<br>
    <br>
    p->ton = TON_ENDTIME(100);<br>
<br>
    p->fsm = &stateWaitWriteStartType;<br>
    return StateMachineTransition;<br>
}<br>
<br>
<br>
static int<br>
stateWaitWriteStartType(void* lp)<br>
{<br>
    EL7041StepperInterface* p;<br>
    EL7041_ENTER(p, lp);<br>
<br>
    if (TON_ISDONE(p->ton))<br>
    {<br>
        /*<br>
        * ALERT!<br>
        * This command should start motion on the axis.<br>
        */<br>
        lcxWritePdoBit(p->pdoOffset + QX_CONTROLEXECUTE, true);<br>
<br>
        p->ton = TON_ENDTIME(500);<br>
        p->fsm = &stateWaitExecute;<br>
        return StateMachineTransition;<br>
    }<br>
<br>
    return StateMachineRunning;<br>
}<br>
<br>
<br>
<br>
Thomas C. Bitsky Jr. | Lead Developer<br>
ADC | automateddesign.com <<a href="http://automateddesign.com/" target="_blank">http://automateddesign.com/</a>><br>
<br>
Follow ADC news and media:<br>
Facebook <<a href="https://facebook.com/automateddesigncorp" target="_blank">https://facebook.com/automateddesigncorp</a>> | Twitter <<a href="https://twitter.com/ADCSportsLogic" target="_blank">https://twitter.com/ADCSportsLogic</a>> | YouTube <<a href="https://www.youtube.com/user/ADCSportsLogic" target="_blank">https://www.youtube.com/user/ADCSportsLogic</a>><br>
<br>
<br>
<br>
<br>
<br>
<br>
From:  etherlab-users <<a href="mailto:etherlab-users-bounces@etherlab.org" target="_blank">etherlab-users-bounces@etherlab.org</a>> on behalf of Paul Mulligan <<a href="mailto:mulligan252@yahoo.ie" target="_blank">mulligan252@yahoo.ie</a>><br>
Reply-To:  Paul Mulligan <<a href="mailto:mulligan252@yahoo.ie" target="_blank">mulligan252@yahoo.ie</a>><br>
Date:  Tuesday, January 19, 2016 at 7:49 AM<br>
To:  "<a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a>" <<a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a>><br>
Subject:  [etherlab-users] Controlling motor drivers<br>
<br>
<br>
Hi,  (Formatting was wrong on previous post)<br>
<br>
We bought various Beckoff modules for Digital in , Digital out, Analogue in and Stepper Motor control.
<br>
<br>
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>
<br>
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>
<br>
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>
<br>
<br>
<br>
ec_pdo_entry_info_t slave_6_pdo_entries[] = {<br>
    {0x0000, 0x00, 1}, /* Gap */<br>
    {0x7000, 0x02, 1}, /* Enable latch extern on positive edge */<br>
    {0x7000, 0x03, 1}, /* Set counter */<br>
    {0x7000, 0x04, 1}, /* Enable latch extern on negative edge */<br>
    {0x0000, 0x00, 4}, /* Gap */<br>
    {0x0000, 0x00, 8}, /* Gap */<br>
    {0x7000, 0x11, 16}, /* Set counter value */<br>
    {0x7010, 0x01, 1}, /* Enable */<br>
    {0x7010, 0x02, 1}, /* Reset */<br>
    {0x7010, 0x03, 1}, /* Reduce torque */<br>
    {0x0000, 0x00, 5}, /* Gap */<br>
    {0x0000, 0x00, 8}, /* Gap */<br>
    {0x7010, 0x21, 16}, /* Velocity */<br>
    {0x0000, 0x00, 1}, /* Gap */<br>
    {0x6000, 0x02, 1}, /* Latch extern valid */<br>
    {0x6000, 0x03, 1}, /* Set counter done */<br>
    {0x6000, 0x04, 1}, /* Counter underflow */<br>
    {0x6000, 0x05, 1}, /* Counter overflow */<br>
    {0x0000, 0x00, 3}, /* Gap */<br>
    {0x0000, 0x00, 4}, /* Gap */<br>
    {0x6000, 0x0d, 1}, /* Status of extern latch */<br>
    {0x6000, 0x0e, 1}, /* Sync error */<br>
    {0x0000, 0x00, 1}, /* Gap */<br>
    {0x6000, 0x10, 1}, /* TxPDO Toggle */<br>
    {0x6000, 0x11, 16}, /* Counter value */<br>
    {0x6000, 0x12, 16}, /* Latch value */<br>
    {0x6010, 0x01, 1}, /* Ready to enable */<br>
    {0x6010, 0x02, 1}, /* Ready */<br>
    {0x6010, 0x03, 1}, /* Warning */<br>
    {0x6010, 0x04, 1}, /* Error */<br>
    {0x6010, 0x05, 1}, /* Moving positive */<br>
    {0x6010, 0x06, 1}, /* Moving negative */<br>
    {0x6010, 0x07, 1}, /* Torque reduced */<br>
    {0x0000, 0x00, 1}, /* Gap */<br>
    {0x0000, 0x00, 3}, /* Gap */<br>
    {0x6010, 0x0c, 1}, /* Digital input 1 */<br>
    {0x6010, 0x0d, 1}, /* Digital input 2 */<br>
    {0x6010, 0x0e, 1}, /* Sync error */<br>
    {0x0000, 0x00, 1}, /* Gap */<br>
    {0x6010, 0x10, 1}, /* TxPDO Toggle */ }; _______________________________________________<br>
etherlab-users mailing list<o:p></o:p></span></p>
</div>
<div id="yiv1852865082yqtfd93031">
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"><br>
<a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"><br>
<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a><o:p></o:p></span></p>
</div>
<div id="yiv1852865082yqtfd01225">
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"> <o:p></o:p></span></p>
</div>
</div>
<div style="margin-bottom:12.0pt">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica","sans-serif";color:black"> <o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>