-
大小: 135KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2021-05-10
- 語言: C#
- 標(biāo)簽:
資源簡介
雷賽運動控制卡C#案例。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?csLTDMC;
namespace?定長運動
{
????public?partial?class?Form1?:?Form
????{
????????private?ushort?_CardID?=?0;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????short?num?=?LTDMC.dmc_board_init();//獲取卡數(shù)量
????????????if?(num?<=?0?||?num?>?8)
????????????{
????????????????MessageBox.Show(“初始卡失敗!“?“出錯“);
????????????}
????????????ushort?_num?=?0;
????????????ushort[]?cardids?=?new?ushort[8];
????????????uint[]?cardtypes?=?new?uint[8];
????????????short?res?=?LTDMC.dmc_get_CardInfList(ref?_num?cardtypes?cardids);
????????????if?(res?!=?0)
????????????{
????????????????MessageBox.Show(“獲取卡信息失敗!“);
????????????}
????????????_CardID?=?cardids[0];
????????????//
????????????timer1.Start();
????????}
????????private?ushort?GetAxis()
????????{
????????????return?decimal.ToUInt16(numericUpDown1.Value);
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();?//軸號
????????????
????????????double?dStartVel;//起始速度
????????????double?dMaxVel;//運行速度
????????????double?dTacc;//加速時間
????????????double?dTdec;//減速時間
????????????double?dStopVel;//停止速度
????????????double?dS_para;//S段時間
????????????int?dDist;//目標(biāo)位置
????????????ushort?sPosi_mode;?//運動模式0:相對坐標(biāo)模式,1:絕對坐標(biāo)模式
????????????
????????????dStartVel?=?decimal.ToDouble(numericUpDown3.Value);
????????????dMaxVel?=?decimal.ToDouble(numericUpDown4.Value);
????????????dTacc?=?decimal.ToDouble(numericUpDown5.Value);
????????????dTdec?=?decimal.ToDouble(numericUpDown6.Value);
????????????dStopVel?=?decimal.ToDouble(numericUpDown8.Value);
????????????dS_para?=?decimal.ToDouble(numericUpDown7.Value);
????????????dDist?=?decimal.ToInt32(numericUpDown9.Value);
????????????sPosi_mode?=?0;
???
????????????
???????
????????????LTDMC.dmc_set_profile(_CardID?axis?dStartVel?dMaxVel?dTacc?dTdec?dStopVel);//設(shè)置速度參數(shù)
????????????LTDMC.dmc_set_s_profile(_CardID?axis?0?dS_para);//設(shè)置S段速度參數(shù)
????????????LTDMC.dmc_set_dec_stop_time(_CardID?axis?dTdec);?//設(shè)置減速停止時間
????????????LTDMC.dmc_pmove(_CardID?axis?dDist?sPosi_mode);//定長運動
???????????
????????}
????????private?void?button4_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();?//軸號
????????????ushort?stop_mode?=?0;?//制動方式,0:減速停止,1:緊急停止
????????????LTDMC.dmc_stop(_CardID?axis?stop_mode);
????????}
????????private?void?button5_Click(object?sender?EventArgs?e)
????????{
????????????ushort?axis?=?GetAxis();?//軸號
????????????int?dpos?=?0;//?當(dāng)前位置
????????????LTDMC.dmc_set_position(_CardID?axis?dpos);?//設(shè)置指定軸的當(dāng)前指令位置值
????????}
????????private?void?button7_Cli
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\定長運動\
?????文件?????????187??2017-12-04?00:00??例1_定長運動\定長運動\App.config
?????文件???????35196??2017-12-04?00:00??例1_定長運動\定長運動\Form1.Designer.cs
?????文件????????4970??2017-12-04?00:00??例1_定長運動\定長運動\Form1.cs
?????文件????????6011??2017-12-04?00:00??例1_定長運動\定長運動\Form1.resx
?????文件???????76212??2017-12-04?00:00??例1_定長運動\定長運動\LTDMC.cs
?????文件?????????524??2017-12-04?00:00??例1_定長運動\定長運動\Program.cs
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\定長運動\Properties\
?????文件????????1390??2017-12-04?00:00??例1_定長運動\定長運動\Properties\AssemblyInfo.cs
?????文件????????2904??2017-12-04?00:00??例1_定長運動\定長運動\Properties\Resources.Designer.cs
?????文件????????5612??2017-12-04?00:00??例1_定長運動\定長運動\Properties\Resources.resx
?????文件????????1113??2017-12-04?00:00??例1_定長運動\定長運動\Properties\Settings.Designer.cs
?????文件?????????249??2017-12-04?00:00??例1_定長運動\定長運動\Properties\Settings.settings
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\定長運動\bin\
?????目錄???????????0??2019-07-24?17:47??例1_定長運動\定長運動\bin\Debug\
?????文件???????42496??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.exe
?????文件?????????187??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.exe.config
?????文件???????54784??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.pdb
?????文件???????22472??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.vshost.exe
?????文件?????????187??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.vshost.exe.config
?????文件?????????490??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動.vshost.exe.manifest
?????文件?????????187??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動(脈沖當(dāng)量).exe.config
?????文件???????22472??2019-07-24?17:47??例1_定長運動\定長運動\bin\Debug\定長運動(脈沖當(dāng)量).vshost.exe
?????文件?????????187??2017-12-04?00:00??例1_定長運動\定長運動\bin\Debug\定長運動(脈沖當(dāng)量).vshost.exe.config
?????文件?????????490??2015-06-04?12:48??例1_定長運動\定長運動\bin\Debug\定長運動(脈沖當(dāng)量).vshost.exe.manifest
?????目錄???????????0??2019-09-11?09:41??例1_定長運動\定長運動\bin\Release\
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\定長運動\obj\
?????目錄???????????0??2019-07-09?08:54??例1_定長運動\定長運動\obj\Debug\
?????文件????????1711??2017-12-04?00:00??例1_定長運動\定長運動\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7101??2019-07-24?17:47??例1_定長運動\定長運動\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
............此處省略18個文件信息
評論
共有 條評論