<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; } @font-face { font-family: "Cambria Math"; } @font-face { font-family: Calibri; } @font-face { font-family: Consolas; } p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; } a:link, span.MsoHyperlink { color: rgb(5, 99, 193); text-decoration: underline; } a:visited, span.MsoHyperlinkFollowed { color: rgb(149, 79, 114); text-decoration: underline; } pre { margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New"; } span.HTMLPreformattedChar { font-family: Consolas; } p.msochpdefault, li.msochpdefault, div.msochpdefault { margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: Calibri, sans-serif; } span.htmlpreformattedchar0 { font-family: Consolas; } span.emailstyle17 { font-family: Calibri, sans-serif; color: windowtext; } span.emailstyle23 { font-family: Calibri, sans-serif; color: rgb(31, 73, 125); } span.emailstyle24 { font-family: Calibri, sans-serif; color: rgb(31, 73, 125); } span.spelle { } span.EmailStyle26 { font-family: Calibri, sans-serif; color: rgb(31, 73, 125); } .MsoChpDefault { font-size: 10pt; } @page WordSection1 { margin: 72pt; } div.WordSection1 { }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear Gavin and other EtherLAB users<br>
</p>
<p><br>
</p>
<p>Thanks for your e-mail. It made everything more clear, as the documentation is not very obvious about the precise action of those functions. <br>
</p>
<p><br>
</p>
<p>Indeed I did not call ecrt_master_activate - and that was one of my mistakes.<br>
</p>
<p><br>
</p>
<p>Another thing that confused me was, that even if I called it after all the configs, the state of PDO mapping objects did not change. Setting the "ethercat debug 1" helped there.<br>
</p>
<p><br>
</p>
<p>It turns out that I have a steady 4 seconds delay between SDO download request, and the confirmation. Hence , when I now call ecrt_master_activate, it takes the master a total of few minutes to run through the entire config. Thus, I was just too impatient
to see the effects of this function.<br>
</p>
<p><br>
</p>
<p>I do not know yet the reason for that delay, but I will be digging further. I will reply in this topic once I have it done, so it is saved in the archive forever for others who may stumble upon those issues. :)<br>
</p>
<p><br>
</p>
<p>Thank you very much for all your assistance once again.<br>
</p>
<p><br>
</p>
<p>Yours sincerely,<br>
</p>
<p>Jakub Sikorski<br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Gavin Lambert <gavinl@compacsort.com><br>
<b>Sent:</b> 16 June 2016 00:11<br>
<b>To:</b> Sikorski, J. (CTW)<br>
<b>Cc:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> RE: [etherlab-users] I cannot proceed with configuration of PDOs using Libethercat.</font>
<div> </div>
</div>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="">Well, of course. Unless otherwise indicated by the device vendor, PDOs and SDOs are both in RAM only so will naturally revert to defaults if you reboot the device.</span></p>
<p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal"><span style="">Regarding your other issue, does your program actually exit immediately after calling ecrt_slave_config_pdos? I assumed that you had a complete application and you had just edited the rest out.</span></p>
<p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal"><span style="">If so, that won’t work. The various ecrt_slave_config_* functions just specify to the master library what you would like the configuration to be – nothing actually changes on the network until you call ecrt_master_activate
afterwards. Additionally, PDOs are only actually exchanged while you have a master loop running. Have a look at the example programs included with EtherLab.</span></p>
<p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal"><span style="">(If you just want to verify the configuration manually without actually running an application loop, then you can call ecrt_master_activate and then immediately release the master and exit if you like, but to actually accomplish
anything useful you need an application loop.)</span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span></p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> j.sikorski@utwente.nl [mailto:j.sikorski@utwente.nl]
<br>
<b>Sent:</b> Thursday, 16 June 2016 00:06<br>
<b>To:</b> Gavin Lambert <gavin.lambert@compacsort.com><br>
<b>Cc:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> Re: [etherlab-users] I cannot proceed with configuration of PDOs using Libethercat.</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p><span style="font-family:"Calibri",sans-serif; color:black">Dear Gavin,</span></p>
<p><span style="font-family:"Calibri",sans-serif; color:black"> </span></p>
<p><span style="font-family:"Calibri",sans-serif; color:black">Oh, and I forgot. Any changes I introduce using "<span style="background:white">sudo ethercat download" </span>are reverted once the I reboot (power off - power on) my controllers.</span></p>
<p><span style="font-family:"Calibri",sans-serif; color:black"> </span></p>
<p><span style="font-family:"Calibri",sans-serif; color:black">Yours sincerely,</span></p>
<p><span style="font-family:"Calibri",sans-serif; color:black">Jakub Sikorski</span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center; background:white">
<span style="font-size:12.0pt; color:black">
<hr size="2" width="98%" align="center">
</span></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal" style="background:white"><b><span style="color:black">From:</span></b><span style="color:black"> etherlab-users <<a href="mailto:etherlab-users-bounces@etherlab.org">etherlab-users-bounces@etherlab.org</a>> on behalf of
<a href="mailto:j.sikorski@utwente.nl">j.sikorski@utwente.nl</a> <<a href="mailto:j.sikorski@utwente.nl">j.sikorski@utwente.nl</a>><br>
<b>Sent:</b> 15 June 2016 13:59<br>
<b>To:</b> <a href="mailto:gavinl@compacsort.com">gavinl@compacsort.com</a><br>
<b>Cc:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] I cannot proceed with configuration of PDOs using Libethercat.</span><span style="font-size:12.0pt; color:black">
</span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="color:#1F497D">Dear Gavin,</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:#1F497D">Thank you very, very much for your help!</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#1F497D">According to the manual of my slave I should be able to map
</span><span style="color:navy">0x2058 to PDO. What is puzzling me is that it seems that I have done that, using the following series of console commands:</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:navy"> </span><span style="color:black"></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">sudo ethercat download -a 0 0x1a00 00 0x00</span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">sudo ethercat download -a 0 0x1a00 01 0x20580010</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black; background:white">sudo ethercat download -a 0 0x1a00 00 0x02</span><span style="font-size:12.0pt; color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black; background:white">Now polling the slave with:</span><span style="font-size:12.0pt; color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<p class="MsoNormal" style="background:white"><span class="spelle"><span style="font-size:12.0pt; color:black">sudo</span></span><span style="font-size:12.0pt; color:black">
<span class="spelle">ethercat</span> upload -a 0 0x1a00 01</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">gives me:</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">0x20580010 542638096</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">However, if I execute ethercat cstruct -a 0, the field corresponding to 0x1a00 01 is still:</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">{0x6041, 0x00, 16}</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">which was the previous value.</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Running the ecrt_slave_config_pdos changes nothing in the slave config, as inspected later on by sudo ethercat upload.</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">But do I understand correctly, that it should alter the configuration of the slave automatically, using the slave config, to the mapping I specified ealier in the file?
Or do I have to run ecrt_master_activate(master) first so that all my actions are implemented?</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"><br>
I thought that all of this might also be caused by ec_slave_config_t passed on to ecrt_slave_config_pdos not being correct. I tried to dereference and output it, after it was generated by ecrt_master_slave_config, but I failed to compile such code.</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"><br>
This realisation was brought to me, as command:</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">sudo ethercat config </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">gives no visible output for any for my slaves.</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">I will be grateful for any more feedback.</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Yours sincerely,</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Jakub Sikorski</span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:navy"> </span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="background:white"><b><span lang="EN-US" style="color:black">From:</span></b><span lang="EN-US" style="color:black"> Gavin Lambert [<a href="mailto:gavinl@compacsort.com">mailto:gavinl@compacsort.com</a>]
<br>
<b>Sent:</b> <span class="spelle">woensdag</span> 15 <span class="spelle">juni</span> 2016 1:31<br>
<b>To:</b> Sikorski, J. (CTW) <<a href="mailto:j.sikorski@utwente.nl">j.sikorski@utwente.nl</a>><br>
<b>Cc:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> RE: [<span class="spelle">etherlab</span>-users] I cannot proceed with configuration of PDOs using
<span class="spelle">Libethercat</span>.</span><span style="color:black"></span></p>
</div>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black">Hi </span>
<span style="font-size:12.0pt; color:black">Jakub,</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Most
<span class="spelle">EtherCAT</span> slaves do not allow you to arbitrarily remap the contents of PDOs (the entries in the
<span class="spelle">ec_pdo_entry_info_t</span>); only to select between different predefined groups of PDOs via the
<span class="spelle">ec_pdo_info_t</span>. Some don’t support even that and just have a fixed layout (especially devices that don’t support
<span class="spelle">CoE</span>).</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Have a look in the manual for your slave device to see what combinations it supports. Also note that indexes outside the 0x6000 or 0xA000 range are rarely available to
be mapped as PDOs; you may need to access it as an SDO instead. If this is for a one-time
<span class="spelle">startup</span> configuration setting rather than for cyclic data, then look at the
<span class="spelle">ecrt_slave_config_sdo</span>* family of functions.</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Another thing that you can look at is to look in the syslog after running your application; if you’re trying to change a PDO and the device does not support this then
it should log a warning. You might need to set “<span class="spelle">ethercat</span> debug 1” before running your application – this includes quite a bit of extra detail about the slave configuration process.</span><span style="color:black"></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#1F497D"> </span><span style="color:black"></span></p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="background:white"><b><span lang="EN-US" style="color:black">From:</span></b><span lang="EN-US" style="color:black">
<span class="spelle">etherlab</span>-users [</span><span style="color:black"><a href="mailto:etherlab-users-bounces@etherlab.org"><span lang="EN-US">mailto:etherlab-users-bounces@etherlab.org</span></a></span><span lang="EN-US" style="color:black">]
<b>On Behalf Of </b></span><span style="color:black"><a href="mailto:j.sikorski@utwente.nl"><span lang="EN-US">j.sikorski@utwente.nl</span></a></span><span lang="EN-US" style="color:black"><br>
<b>Sent:</b> Wednesday, 15 June 2016 06:40<br>
<b>To:</b> </span><span style="color:black"><a href="mailto:etherlab-users@etherlab.org"><span lang="EN-US">etherlab-users@etherlab.org</span></a></span><span lang="EN-US" style="color:black"><br>
<b>Subject:</b> [<span class="spelle">etherlab</span>-users] I cannot proceed with configuration of PDOs using
<span class="spelle">Libethercat</span>.</span><span style="color:black"></span></p>
</div>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="color:black">Dear <span class="spelle">
EtherLab</span> Users,</span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black">I installed the
<span class="spelle">IgH</span> <span class="spelle">EtherCAT</span> master, and to educate myself how to implement the communication, I set up a small network comprising of
<span class="spelle">IgH</span> master and one <span class="spelle">Technosoft</span> Motion iPOS4808 drive.</span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black">The ./<span class="spelle">ethercat</span> slaves command detects it.</span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black">The ./<span class="spelle">ethercat</span>
<span class="spelle">cstruct</span> gives me the following configuration:</span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<p class="MsoNormal" style="background:white"><span class="spelle"><span style="font-size:12.0pt; color:black">ec_pdo_entry_info_t</span></span><span style="font-size:12.0pt; color:black"> slave_0_pdo_entries[] = {</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x6040, 0x00, 16},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x607a, 0x00, 32},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x6041, 0x00, 16},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x6064, 0x00, 32},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x6077, 0x00, 16},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x60f4, 0x00, 32},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x60fd, 0x00, 32},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">};</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span class="spelle"><span style="font-size:12.0pt; color:black">ec_pdo_info_t</span></span><span style="font-size:12.0pt; color:black"> slave_0_pdos[] = {</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x1600, 2, slave_0_pdo_entries + 0},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x1a00, 3, slave_0_pdo_entries + 2},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0x1a01, 2, slave_0_pdo_entries + 5},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">};</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span class="spelle"><span style="font-size:12.0pt; color:black">ec_sync_info_t</span></span><span style="font-size:12.0pt; color:black"> slave_0_syncs[] = {</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_DISABLE},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {3, EC_DIR_INPUT, 2, slave_0_pdos + 1, EC_WD_DISABLE},</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> {0xff}</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">};</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Now I want to use C++ functions, to change the value outputted at 0x1a00 x02 to the object 0x2058 x00 with size 16 bit.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Hence, based on the
<span class="spelle">cstruct</span> file, as well as ~/ethercat-1.5.2/example/user/<span class="spelle">main.c</span> , I write the following code (spread over
<span class="spelle">main.h</span> and main.cpp) to achieve this.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<pre style="background:white"><span style="color:navy">#include</span><span style="color:silver"> </span><span style="color:green">"<span class="spelle">auxfun.h</span>"</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">Application</span><span style="color:silver"> </span><span style="color:green">parameters</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span style="color:navy">FREQUENCY</span><span style="color:silver"> </span><span style="color:navy">100</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span style="color:navy">PRIORITY</span><span style="color:silver"> </span><span style="color:navy">1</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">Optional</span><span style="color:silver"> </span><span style="color:green">features</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span style="color:navy">CONFIGURE_PDOS</span><span style="color:silver"> </span><span style="color:navy">1</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span style="color:navy">SDO_ACCESS</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span class="spelle"><span style="color:green">EtherCAT</span></span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_master_t</span></span><span style="color:silver"> </span><span style="color:black">*master</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_master_state_t</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:black">master_state</span></span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_domain_t</span></span><span style="color:silver"> </span><span style="color:black">*domain1</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_domain_state_t</span></span><span style="color:silver"> </span><span style="color:black">domain1_state</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_slave_config_t</span></span><span style="color:silver"> </span><span style="color:black">*sc_iPOS0</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_slave_config_state_t</span></span><span style="color:silver"> </span><span style="color:black">sc_iPOS0_state</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">Timer</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span style="color:olive">unsigned</span><span style="color:silver"> </span><span class="spelle"><span style="color:olive">int</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:black">sig_alarms</span></span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span style="color:olive">unsigned</span><span style="color:silver"> </span><span class="spelle"><span style="color:olive">int</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:black">user_alarms</span></span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">/****************************************************************************/</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">process</span><span style="color:silver"> </span><span style="color:green">data</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:olive">static</span><span style="color:silver"> </span><span style="color:black">uint8_t</span><span style="color:silver"> </span><span style="color:black">*domain1_pd</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span class="spelle"><span style="color:navy">AxisBotPos</span></span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:silver"> </span><span style="color:green">//Bottom</span><span style="color:silver"> </span><span style="color:green">frame</span><span style="color:silver"> </span><span class="spelle"><span style="color:green">iPOS</span></span><span style="color:silver"> </span><span style="color:green">Alias</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:navy">#define</span><span style="color:silver"> </span><span style="color:navy">IPOS4808BX_CAT</span><span style="color:silver"> </span><span style="color:navy">0x000001a3</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x019f418d</span><span style="color:silver"> </span><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">Vendor</span><span style="color:silver"> </span><span style="color:green">ID,</span><span style="color:silver"> </span><span style="color:green">Product</span><span style="color:silver"> </span><span style="color:green">Code</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span class="spelle"><span style="color:olive">const</span></span><span style="color:silver"> </span><span style="color:olive">static</span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">ec_pdo_entry_reg_t</span></span><span style="color:silver"> </span><span style="color:black">domain1_regs[]</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span class="spelle"><span style="color:navy">AxisBotPos</span></span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">IPOS4808BX_CAT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x6060</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">&off_iPOS0_Rx},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span class="spelle"><span style="color:navy">AxisBotPos</span></span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">IPOS4808BX_CAT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x2058</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">&off_iPOS0_Tx},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{}</span></pre>
<pre style="background:white"><span style="color:black">};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">Analog</span><span style="color:silver"> </span><span style="color:green">in</span><span style="color:silver"> </span><span style="color:green">--------------------------</span><span style="color:black"></span></pre>
<pre style="background:white"><span class="spelle"><span style="color:purple">ec_pdo_entry_info_t</span></span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo_entries[]</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x6040</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">16</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x6060</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">8</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x6041</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">16</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x2058</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">16</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x6077</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">16</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x60f4</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">32</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x60fd</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0x00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">32</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:black">};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span class="spelle"><span style="color:purple">ec_pdo_info_t</span></span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo[]</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x1600</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">2</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo_entries</span><span style="color:silver"> </span><span style="color:black">+</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x1a00</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">3</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo_entries</span><span style="color:silver"> </span><span style="color:black">+</span><span style="color:silver"> </span><span style="color:navy">2</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0x1a01</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">2</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo_entries</span><span style="color:silver"> </span><span style="color:black">+</span><span style="color:silver"> </span><span style="color:navy">5</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:black">};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span class="spelle"><span style="color:purple">ec_sync_info_t</span></span><span style="color:silver"> </span><span style="color:black">iPOS0_syncs[]</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_DIR_OUTPUT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_WD_DISABLE</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">1</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_DIR_INPUT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">NULL</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_WD_DISABLE</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">2</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_DIR_OUTPUT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">1</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo</span><span style="color:silver"> </span><span style="color:black">+</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_WD_DISABLE</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">3</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_DIR_INPUT</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">2</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_pdo</span><span style="color:silver"> </span><span style="color:black">+</span><span style="color:silver"> </span><span style="color:navy">1</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:purple">EC_WD_DISABLE</span><span style="color:black">},</span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">{</span><span style="color:navy">0xff</span><span style="color:black">}</span></pre>
<pre style="background:white"><span style="color:black">};</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:navy">#include</span><span style="color:silver"> </span><span style="color:green">"<span class="spelle">main.h</span>"</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:green">/****************************************************************************/</span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span class="spelle"><span style="color:olive">int</span></span><span style="color:silver"> </span><span style="color:black">main(</span><span class="spelle"><span style="color:olive">int</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:black">argc</span></span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:olive">char</span><span style="color:silver"> </span><span style="color:black">**<span class="spelle">argv</span>)</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="font-family:"Cambria Math",serif; color:black"></span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:silver"> </span><span class="spelle"><span style="color:olive">struct</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:purple">itimerval</span></span><span style="color:silver"> </span><span class="spelle"><span style="color:black">tv</span></span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">master</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span class="spelle"><span style="color:black">ecrt_request_master</span></span><span style="color:black">(</span><span style="color:navy">0</span><span style="color:black">);</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(!master)</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">return</span><span style="color:silver"> </span><span style="color:black">-</span><span style="color:navy">1</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="font-family:"Cambria Math",serif; color:black"></span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">domain1</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span class="spelle"><span style="color:black">ecrt_master_create_domain</span></span><span style="color:black">(master);</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(!domain1)</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">return</span><span style="color:silver"> </span><span style="color:black">-</span><span style="color:navy">1</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(!(sc_iPOS0</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span class="spelle"><span style="color:black">ecrt_master_slave_config</span></span><span style="color:black">(</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">master,</span><span style="color:silver"> </span><span class="spelle"><span style="color:navy">AxisBotPos</span></span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:navy">IPOS4808BX_CAT</span><span style="color:black">)))</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span class="spelle"><span style="color:black">fprintf</span></span><span style="color:black">(<span class="spelle">stderr</span>,</span><span style="color:silver"> </span><span style="color:green">"Failed</span><span style="color:silver"> </span><span style="color:green">to</span><span style="color:silver"> </span><span style="color:green">get</span><span style="color:silver"> </span><span style="color:green">slave</span><span style="color:silver"> </span><span style="color:green">configuration.\n"</span><span style="color:black">);</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">return</span><span style="color:silver"> </span><span style="color:black">-</span><span style="color:navy">1</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">}</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span class="spelle"><span style="color:black">printf</span></span><span style="color:black">(</span><span style="color:green">"Configuring</span><span style="color:silver"> </span><span style="color:green">PDOs...\n"</span><span style="color:black">);</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(<span class="spelle">ecrt_slave_config_pdos</span>(sc_iPOS0,</span><span style="color:silver"> </span><span style="color:navy">4</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">iPOS0_syncs))</span><span style="color:silver"> </span><span style="color:black">{</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span class="spelle"><span style="color:black">fprintf</span></span><span style="color:black">(<span class="spelle">stderr</span>,</span><span style="color:silver"> </span><span style="color:green">"Failed</span><span style="color:silver"> </span><span style="color:green">to</span><span style="color:silver"> </span><span style="color:green">configure</span><span style="color:silver"> </span><span style="color:green">PDOs.\n"</span><span style="color:black">);</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:olive">return</span><span style="color:silver"> </span><span style="color:black">-</span><span style="color:navy">1</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span style="color:black">}</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:silver"> </span><span class="spelle"><span style="color:black">cout</span></span><span style="color:silver"> </span><span style="color:black"><<</span><span style="color:silver"> </span><span style="color:green">"Done"</span><span style="color:silver"> </span><span style="color:black"><<</span><span style="color:silver"> </span><span class="spelle"><span style="color:black">endl</span></span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:olive">return</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">;</span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<pre style="background:white"><span style="color:black">}</span><span style="font-family:"Cambria Math",serif; color:black"></span><span style="color:black"></span></pre>
<pre style="background:white"><span style="color:black"> </span></pre>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">I run the code above. It executes with no problem.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Now, I checked, using: </span><span style="color:black"></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<div>
<p class="MsoNormal" style="background:white"><span class="spelle"><span style="font-size:12.0pt; color:black">sudo</span></span><span style="font-size:12.0pt; color:black">
<span class="spelle">ethercat</span> upload -a 0 0x1a00 01</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">whether the introduced mapping modification worked. Unfortunately it seems that it is not the case and I get the same variable that was in ./<span class="spelle">ethercat</span> <span class="spelle">cstruct</span>
at that position.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Then I tried to change the variable manually using ./<span class="spelle">ethercat</span> download <span style="background:white">-a 0 0x1a00 01 </span>0x20580010. This
worked, at least in the console (confirmed by ./<span class="spelle">ethercat</span> upload). However,
<span class="spelle">cstruct</span> still outputs previous values. I also tried the same procedure with other PDO variables to the same effect, my C++ code changes nothing in the mapping.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">If anyone of you could look into the code and tell me whether what I am doing is correct (or wrong), I would be
<span class="spelle">exteremely</span> grateful. I mostly do not know where even to start debugging right now.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Thank you a lot in advance.</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Yours faithfully,</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt; color:black">Jakub Sikorski</span><span style="color:black"></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:12.0pt; color:black"> </span><span style="color:black"></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
<p class="MsoNormal" style="background:white"><span style="color:black"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>