<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to SM_Drive_PosControl</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/269d8bbe01/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Motion/thread/269d8bbe01/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Motion/thread/269d8bbe01/</id><updated>2020-02-27T18:44:09.886000Z</updated><subtitle>Recent posts to SM_Drive_PosControl</subtitle><entry><title>SM_Drive_PosControl</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/269d8bbe01/?limit=25#47e7" rel="alternate"/><published>2020-02-27T18:44:09.886000Z</published><updated>2020-02-27T18:44:09.886000Z</updated><author><name>adv</name><uri>https://forge.codesys.com/u/adv/</uri></author><id>https://forge.codesys.comb5bac1961a6d322c0b10d515e811a938091856c9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ok i solved the problem by myself. &lt;/p&gt;
&lt;p&gt;I had to change the bus cycle task to (in my case) "Profinet_IOTask" :&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Andreas&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 12" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=3345"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SM_Drive_PosControl</title><link href="https://forge.codesys.com/forge/talk/Motion/thread/269d8bbe01/?limit=25#8eae" rel="alternate"/><published>2020-02-27T18:44:06.614000Z</published><updated>2020-02-27T18:44:06.614000Z</updated><author><name>adv</name><uri>https://forge.codesys.com/u/adv/</uri></author><id>https://forge.codesys.com5fb39e67fb4a969ef3877969fd3bd675fe65ed3d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;i have a stepper motor with encoder and a custom hardware to control this stepper motor. This hardware is controlled as a SPI Slave in velocity mode.&lt;/p&gt;
&lt;p&gt;I want to use &lt;strong&gt;CODESYS V3 SM_Drive_PosControl&lt;/strong&gt; to control the stepper. &lt;br/&gt;
I already feedback the act position from the motor encoder by writing: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Axis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dwActPosition&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DINT_TO_DWORD&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actEncoderPosition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I also can use the MC_Power FB to enable the drive ```&lt;/p&gt;
&lt;p&gt;IF Axis.bRegulatorOn THEN&lt;br/&gt;
   // Enable the drive with an SPI command&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;```&lt;br/&gt;
I already see that the control loop of the SM_Drive_PosControl is working. The variable Axis.out.fSetVelocity is changed and when i move the stepper. When i write this variable via SPI as set velocity i see how the position control loop is already working.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The only problem is, when i call MC_MoveVelocity (or another motion FB) it sets the SM_Drive_PosControl Axis in "errorstop" immediately after calling the FB.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;I see that fSetPosition is calculated the first time:&lt;/p&gt;
&lt;p&gt;Screenshot before executing the FB (stopped in breakpoint):&lt;/p&gt;
&lt;p&gt;Screenshot after executing the FB (stopped in breakpoint):&lt;/p&gt;
&lt;p&gt;Why the Axis is set to errorstop? I dont find any errorcode?!&lt;/p&gt;
&lt;p&gt;Thanks for your help,&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Andreas&lt;/p&gt;
&lt;p&gt;P.S.: I already read this documentation:&lt;br/&gt;
&lt;a class="" href="https://help.codesys.com/webapp/sm-example-poscontrol;product=CODESYS_SoftMotion;version=4.3.0.0" rel="nofollow"&gt;https://help.codesys.com/webapp/sm-example-poscontrol;product=CODESYS_SoftMotion;version=4.3.0.0&lt;/a&gt;&lt;br/&gt;
&lt;a class="" href="https://help.codesys.com/webapp/u_QTw72HcW4SW_lc4tlmE1hlxQs%2FSMC_AXIS_STATE;product=SM3_Basic;version=4.2.0.0" rel="nofollow"&gt;https://help.codesys.com/webapp/u_QTw72HcW4SW_lc4tlmE1hlxQs%2FSMC_AXIS_STATE;product=SM3_Basic;version=4.2.0.0&lt;/a&gt;&lt;br/&gt;
&lt;a class="" href="https://help.codesys.com/webapp/_sm_edt_drive_scaling_mapping;product=CODESYS_SoftMotion;version=4.3.0.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_sm_edt_drive_scaling_mapping;product=CODESYS_SoftMotion;version=4.3.0.0&lt;/a&gt;&lt;br/&gt;
&lt;a class="" href="https://help.codesys.com/webapp/yMh8bsZYTxWN3bfJc4A4zjmoLqc%2FMC_MoveVelocity;product=SM3_Basic;version=4.3.0.0" rel="nofollow"&gt;https://help.codesys.com/webapp/yMh8bsZYTxWN3bfJc4A4zjmoLqc%2FMC_MoveVelocity;product=SM3_Basic;version=4.3.0.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 11" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=3343"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 11" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=3342"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>