<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 15 (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:"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:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
span.htmlpreformattedchar0
{mso-style-name:htmlpreformattedchar;
font-family:Consolas;}
span.emailstyle17
{mso-style-name:emailstyle17;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.emailstyle23
{mso-style-name:emailstyle23;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.emailstyle24
{mso-style-name:emailstyle24;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.spelle
{mso-style-name:spelle;}
span.EmailStyle26
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.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 bgcolor=white lang=EN-NZ link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>(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.)<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></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.<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p><span style='font-family:"Calibri",sans-serif;color:black'>Dear Gavin,<o:p></o:p></span></p><p><span style='font-family:"Calibri",sans-serif;color:black'><o:p> </o:p></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.<o:p></o:p></span></p><p><span style='font-family:"Calibri",sans-serif;color:black'><o:p> </o:p></span></p><p><span style='font-family:"Calibri",sans-serif;color:black'>Yours sincerely,<o:p></o:p></span></p><p><span style='font-family:"Calibri",sans-serif;color:black'>Jakub Sikorski<o:p></o:p></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'> <o:p></o:p></span></p><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> <o:p></o:p></span></p></div></div><div><div><p class=MsoNormal style='background:white'><span style='color:#1F497D'>Dear Gavin,</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal style='background:white'><span style='color:navy'> </span><span style='color:black'><o:p></o:p></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<o:p></o:p></span></p></div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></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<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>gives me:</span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>0x20580010 542638096<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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:<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>{0x6041, 0x00, 16}<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>which was the previous value.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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.<o:p></o:p></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?<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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.<o:p></o:p></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:<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>sudo ethercat config <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></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.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>Yours sincerely,<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>Jakub Sikorski<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal style='background:white'><span style='color:navy'> </span><span style='color:black'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></p></div></div><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:#1F497D'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div></div><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p><div><p class=MsoNormal style='background:white'><span style='color:black'>Dear <span class=spelle>EtherLab</span> Users,<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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.<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'>The ./<span class=spelle>ethercat</span> slaves command detects it.<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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:<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>};</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>};</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> {0xff}</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'>};</span><span style='color:black'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'>;<o:p></o:p></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'>{};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></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'>{};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></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'>{};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'>;<o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:green'>/****************************************************************************/</span><span style='color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>{<o:p></o:p></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},<o:p></o:p></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},<o:p></o:p></span></pre><pre style='background:white'><span style='color:silver'> </span><span style='color:black'>{}<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'>};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></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'>{<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'>};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>{<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'>};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>{<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>},<o:p></o:p></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'>}<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'>};<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:green'>/****************************************************************************/</span><span style='color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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>)<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'>{<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='font-family:"Cambria Math",serif;color:black'></span><span style='color:black'><o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>);<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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)<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='font-family:"Cambria Math",serif;color:black'></span><span style='color:black'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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);<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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)<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>(<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>{<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>);<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:silver'> </span><span style='color:black'>}<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>);<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>{<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>);<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:silver'> </span><span style='color:black'>}<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'>;<o:p></o:p></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'>;<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> <o:p></o:p></span></pre><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:12.0pt;color:black'> </span><span style='color:black'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></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'><o:p></o:p></span></p></div><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='color:black'> <o:p></o:p></span></p></div></div></div></div></div></div></div></body></html>