⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amppvt_8cpp-source.html

📁 美国COPLEY驱动器,程序开发工具之一.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00134"></a>00134 }<a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="comment">/***************************************************************************/</span><span class="comment"></span><a name="l00137"></a>00137 <span class="comment">/**</span><a name="l00138"></a>00138 <span class="comment">  Set the initial position for a PVT trajectory.  This function sends a full</span><a name="l00139"></a>00139 <span class="comment">  32-bit position value which can be used to start a PVT move beyond the 24-bit</span><a name="l00140"></a>00140 <span class="comment">  limit of normal segments.  It's normally used at the beginning of a PVT </span><a name="l00141"></a>00141 <span class="comment">  trajectory when the starting position is greater then 24-bits and the commanded</span><a name="l00142"></a>00142 <span class="comment">  position at the time of the move's start is not obvious.</span><a name="l00143"></a>00143 <span class="comment"></span><a name="l00144"></a>00144 <span class="comment">  @param pos The 32-bit initial position</span><a name="l00145"></a>00145 <span class="comment">  @param viaSDO If true, use a SDO to download the message.  If false, use a PDO.</span><a name="l00146"></a>00146 <span class="comment">  default is true.</span><a name="l00147"></a>00147 <span class="comment">  @return An error object</span><a name="l00148"></a>00148 <span class="comment">  */</span><a name="l00149"></a>00149 <span class="comment">/***************************************************************************/</span><a name="l00150"></a><a class="code" href="classAmp.html#b7">00150</a> <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *<a class="code" href="classAmp.html#b7">Amp::SetPvtInitialPos</a>( <a class="code" href="CML__Utils_8h.html#a9">int32</a> pos, <span class="keywordtype">bool</span> viaSDO )<a name="l00151"></a>00151 {<a name="l00152"></a>00152    <a class="code" href="CML__Utils_8h.html#a2">byte</a> data[8];<a name="l00153"></a>00153 <a name="l00154"></a>00154    data[0] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(7 &amp; pvtSegID);<a name="l00155"></a>00155    data[0] |= 0x20;<a name="l00156"></a>00156 <a name="l00157"></a>00157    data[1] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(pos);<a name="l00158"></a>00158    data[2] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(pos&gt;&gt;8);<a name="l00159"></a>00159    data[3] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(pos&gt;&gt;16);<a name="l00160"></a>00160    data[4] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(pos&gt;&gt;24);<a name="l00161"></a>00161 <a name="l00162"></a>00162    <span class="keywordflow">if</span>( viaSDO )<a name="l00163"></a>00163       <span class="keywordflow">return</span> <a class="code" href="classNode.html#o0">sdo</a>.<a class="code" href="classSDO.html#a4">Download</a>( OBJID_PVT_DATA, 0, 8, data );<a name="l00164"></a>00164    <span class="keywordflow">else</span><a name="l00165"></a>00165       <span class="keywordflow">return</span> pvtPdo.<a class="code" href="classRPDO__Pvt.html#a2">Transmit</a>( data );<a name="l00166"></a>00166 }<a name="l00167"></a>00167 <a name="l00168"></a>00168 <span class="comment">/***************************************************************************/</span><span class="comment"></span><a name="l00169"></a>00169 <span class="comment">/**</span><a name="l00170"></a>00170 <span class="comment">  Flush the amplifier's PVT trajectory buffer.  Flushing the buffer in this </span><a name="l00171"></a>00171 <span class="comment">  way will cause any running profile to be aborted.</span><a name="l00172"></a>00172 <span class="comment">  @param viaSDO If true, use a SDO to download the message.  If false, use a PDO.</span><a name="l00173"></a>00173 <span class="comment">  default is true.</span><a name="l00174"></a>00174 <span class="comment">  @return An error object.</span><a name="l00175"></a>00175 <span class="comment">  */</span><a name="l00176"></a>00176 <span class="comment">/***************************************************************************/</span><a name="l00177"></a><a class="code" href="classAmp.html#b8">00177</a> <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *<a class="code" href="classAmp.html#b8">Amp::PvtBufferFlush</a>( <span class="keywordtype">bool</span> viaSDO )<a name="l00178"></a>00178 {<a name="l00179"></a>00179    <a class="code" href="CML__Utils_8h.html#a2">byte</a> data[8];<a name="l00180"></a>00180 <a name="l00181"></a>00181    data[0] = 0x80;<a name="l00182"></a>00182    <span class="keywordflow">if</span>( viaSDO ) <a name="l00183"></a>00183       <span class="keywordflow">return</span> <a class="code" href="classNode.html#o0">sdo</a>.<a class="code" href="classSDO.html#a4">Download</a>( OBJID_PVT_DATA, 0, 8, data );<a name="l00184"></a>00184    <span class="keywordflow">else</span><a name="l00185"></a>00185       <span class="keywordflow">return</span> pvtPdo.<a class="code" href="classRPDO__Pvt.html#a2">Transmit</a>( data );<a name="l00186"></a>00186 }<a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="comment">/***************************************************************************/</span><span class="comment"></span><a name="l00189"></a>00189 <span class="comment">/**</span><a name="l00190"></a>00190 <span class="comment">  Clear the specified PVT buffer errors.  </span><a name="l00191"></a>00191 <span class="comment">  @param mask A bit mask representing which PVT buffer errors to clear.</span><a name="l00192"></a>00192 <span class="comment">  @param viaSDO If true, use a SDO to download the message.  If false, use a PDO.</span><a name="l00193"></a>00193 <span class="comment">  default is true.</span><a name="l00194"></a>00194 <span class="comment">  @return An error object.</span><a name="l00195"></a>00195 <span class="comment">  */</span><a name="l00196"></a>00196 <span class="comment">/***************************************************************************/</span><a name="l00197"></a><a class="code" href="classAmp.html#b10">00197</a> <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *<a class="code" href="classAmp.html#b10">Amp::PvtClearErrors</a>( <a class="code" href="CML__Utils_8h.html#a6">uint8</a> mask, <span class="keywordtype">bool</span> viaSDO )<a name="l00198"></a>00198 {<a name="l00199"></a>00199    <a class="code" href="CML__Utils_8h.html#a2">byte</a> data[8];<a name="l00200"></a>00200 <a name="l00201"></a>00201    data[0] = 0x82;<a name="l00202"></a>00202    data[1] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(mask);<a name="l00203"></a>00203 <a name="l00204"></a>00204    <span class="keywordflow">if</span>( viaSDO )<a name="l00205"></a>00205       <span class="keywordflow">return</span> <a class="code" href="classNode.html#o0">sdo</a>.<a class="code" href="classSDO.html#a4">Download</a>( OBJID_PVT_DATA, 0, 8, data );<a name="l00206"></a>00206    <span class="keywordflow">else</span><a name="l00207"></a>00207       <span class="keywordflow">return</span> pvtPdo.<a class="code" href="classRPDO__Pvt.html#a2">Transmit</a>( data );<a name="l00208"></a>00208 }<a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="comment">/***************************************************************************/</span><span class="comment"></span><a name="l00211"></a>00211 <span class="comment">/**</span><a name="l00212"></a>00212 <span class="comment">  Pop the N most recently sent segments off the amplifier's PVT trajectory buffer.</span><a name="l00213"></a>00213 <span class="comment">  If there are less then N segments on the buffer, then the buffer is cleared.</span><a name="l00214"></a>00214 <span class="comment">  Any profile running on the amplifier will continue to run (is not aborted)</span><a name="l00215"></a>00215 <span class="comment">  unless a buffer underflow occurs.</span><a name="l00216"></a>00216 <span class="comment">  @param n The number of segments to pop off the buffer.  Defaults to 1.</span><a name="l00217"></a>00217 <span class="comment">  @param viaSDO If true, use a SDO to download the message.  If false, use a PDO.</span><a name="l00218"></a>00218 <span class="comment">  default is true.</span><a name="l00219"></a>00219 <span class="comment">  @return An error object.</span><a name="l00220"></a>00220 <span class="comment">  */</span><a name="l00221"></a>00221 <span class="comment">/***************************************************************************/</span><a name="l00222"></a><a class="code" href="classAmp.html#b9">00222</a> <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *<a class="code" href="classAmp.html#b9">Amp::PvtBufferPop</a>( <a class="code" href="CML__Utils_8h.html#a8">uint16</a> n, <span class="keywordtype">bool</span> viaSDO )<a name="l00223"></a>00223 {<a name="l00224"></a>00224    <a class="code" href="CML__Utils_8h.html#a2">byte</a> data[8];<a name="l00225"></a>00225 <a name="l00226"></a>00226    data[0] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(0x81);<a name="l00227"></a>00227    data[1] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(n);<a name="l00228"></a>00228    data[2] = <a class="code" href="CML__Utils_8h.html#a0">ByteCast</a>(n&gt;&gt;8);<a name="l00229"></a>00229 <a name="l00230"></a>00230    <span class="keywordflow">if</span>( viaSDO )<a name="l00231"></a>00231       <span class="keywordflow">return</span> <a class="code" href="classNode.html#o0">sdo</a>.<a class="code" href="classSDO.html#a4">Download</a>( OBJID_PVT_DATA, 0, 8, data );<a name="l00232"></a>00232    <span class="keywordflow">else</span><a name="l00233"></a>00233       <span class="keywordflow">return</span> pvtPdo.<a class="code" href="classRPDO__Pvt.html#a2">Transmit</a>( data );<a name="l00234"></a>00234 }<a name="l00235"></a>00235 <a name="l00236"></a>00236 <span class="comment">/***************************************************************************/</span><span class="comment"></span><a name="l00237"></a>00237 <span class="comment">/**</span><a name="l00238"></a>00238 <span class="comment">  Upload a PVT move trajectory to the amplifier and optionally start the move.</span><a name="l00239"></a>00239 <span class="comment"></span><a name="l00240"></a>00240 <span class="comment">  @param trj Reference to the trajectory that will be feed to the amp.  A local</span><a name="l00241"></a>00241 <span class="comment">  pointer to this trajectory will be stored if the entire profile will </span><a name="l00242"></a>00242 <span class="comment">  not fit in the amplifiers on-board buffer.  This pointer will be kept</span><a name="l00243"></a>00243 <span class="comment">  until the entire profile has been uploaded to the amp.  It is therefore </span><a name="l00244"></a>00244 <span class="comment">  important to ensure that the trajectory object will remain valid (i.e. not be</span><a name="l00245"></a>00245 <span class="comment">  deallocated) until the amplifier object has called the Trajectory.Finish() </span><a name="l00246"></a>00246 <span class="comment">  method on it.</span><a name="l00247"></a>00247 <span class="comment"></span><a name="l00248"></a>00248 <span class="comment">  @param start If true (the default), the profile will be started by this call.</span><a name="l00249"></a>00249 <span class="comment">  If false, the profile will be uploaded, but not started.  Use true if</span><a name="l00250"></a>00250 <span class="comment">  this is a single axis move, false if this is part of a multi-axis move</span><a name="l00251"></a>00251 <span class="comment">  which needs to be synchronized.</span><a name="l00252"></a>00252 <span class="comment"></span><a name="l00253"></a>00253 <span class="comment">  @return An error object.</span><a name="l00254"></a>00254 <span class="comment">  */</span><a name="l00255"></a>00255 <span class="comment">/***************************************************************************/</span><a name="l00256"></a><a class="code" href="classAmp.html#z13_0">00256</a> <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *<a class="code" href="classAmp.html#z13_0">Amp::SendTrajectory</a>( <a class="code" href="classTrajectory.html">Trajectory</a> &amp;trj, <span class="keywordtype">bool</span> start )<a name="l00257"></a>00257 {<a name="l00258"></a>00258    <span class="keyword">const</span> <a class="code" href="classError.html">Error</a> *err;<a name="l00259"></a>00259 <a name="l00260"></a>00260    <span class="comment">// Make sure we are in interpolated position mode</span><a name="l00261"></a>00261    err = <a class="code" href="classAmp.html#z1_0">SetAmpMode</a>( <a class="code" href="CML__AmpDef_8h.html#a397a197">AMPMODE_CAN_PVT</a> );<a name="l00262"></a>00262    <span class="keywordflow">if</span>( err ) <span class="keywordflow">return</span> err;<a name="l00263"></a>00263 <a name="l00264"></a>00264    <span class="comment">// Get the trajectory buffer status value.</span><a name="l00265"></a>00265    <a class="code" href="CML__Utils_8h.html#a10">uint32</a> stat;<a name="l00266"></a>00266    err = <a class="code" href="classAmp.html#z13_4">GetPvtBuffStat</a>( stat );<a name="l00267"></a>00267    <span class="keywordflow">if</span>( err ) <span class="keywordflow">return</span> err;<a name="l00268"></a>00268 <a name="l00269"></a>00269    <span class="comment">// Clear any buffer errors that are outstanding.</span><a name="l00270"></a>00270    <span class="keywordflow">if</span>( stat &amp; <a class="code" href="AmpPVT_8cpp.html#a5">PVTSTAT_ERROR</a> )<a name="l00271"></a>00271    {<a name="l00272"></a>00272       err = <a class="code" href="classAmp.html#b10">PvtClearErrors</a>( (<a class="code" href="CML__Utils_8h.html#a6">uint8</a>)( (stat &amp; <a class="code" href="AmpPVT_8cpp.html#a5">PVTSTAT_ERROR</a>) &gt;&gt; 24 ) );<a name="l00273"></a>00273       <span class="keywordflow">if</span>( !err ) err = <a class="code" href="classAmp.html#z13_4">GetPvtBuffStat</a>( stat );<a name="l00274"></a>00274       <span class="keywordflow">if</span>( err ) <span class="keywordflow">return</span> err;<a name="l00275"></a>00275    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -