網(wǎng)上有很多關(guān)于pos機(jī)一直網(wǎng)絡(luò)初始化, 雷賽DMC3000 系列運(yùn)動控制卡初始化+運(yùn)動原碼的知識,也有很多人為大家解答關(guān)于pos機(jī)一直網(wǎng)絡(luò)初始化的問題,今天pos機(jī)之家(www.dsth100338.com)為大家整理了關(guān)于這方面的知識,讓我們一起來看下吧!
本文目錄一覽:
pos機(jī)一直網(wǎng)絡(luò)初始化
using csLTDMC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _1.軸卡初始化
{
public partial class Form1 : Form
{
private ushort[] axises = new ushort[8];
private bool mb_init;
private ushort _CardNO;
public Form1()
{
InitializeComponent();
}
private void btl_Init_Click(object sender, EventArgs e)
{
//初始化按鈕
btl_Init.Enabled = false;
blt_Close.Enabled = true;
short res;
// 初始化軸止
res = LTDMC.dmc_board_init();
if (res <= 0 || res > 8)
{
MessageBox.Show("控制卡初始化失敗");
return;
}
uint[] CardTypeList = new uint[8];
ushort[] CardIdList = new ushort[8];
ushort CardNum = 0;
// 獲取軸卡信息
res = LTDMC.dmc_get_CardInfList(ref CardNum, CardTypeList, CardIdList);
if (res == 0)
{
//賦值卡號
lbl_CardNO.Text = CardIdList[0].ToString();
_CardNO = CardIdList[0];
// 獲取固件版本
lbl_Version.Text = Convert.ToString(CardTypeList[0], 16);
uint TotalAxis = 0;
//獲取軸數(shù)
res = LTDMC.dmc_get_total_axes(CardNum, ref TotalAxis);
lbl_TotalAxis.Text = TotalAxis.ToString();
if (res == 0)
{
comboBox_axis.Items.Clear();
for (ushort i = 0; i < TotalAxis; i++)
{
axises[i] = i;
// 填充列表框的項
comboBox_axis.Items.Add($"{i}.Axis");
}
}
comboBox_axis.SelectedIndex = 0;
mb_init = true;// 標(biāo)記初化完成
}
}
private void blt_Close_Click(object sender, EventArgs e)
{
LTDMC.dmc_board_close();
this.Close();
}
/// <summary>
/// 設(shè)置運(yùn)行參數(shù)
/// </summary>
private void SetMoveParametes()
{
// 起始速度
double startVal = decimal.ToDouble(numericUpDown_Startval.Value);
// 運(yùn)行速度
double moveVal = decimal.ToDouble(numericUpDown_Moveval.Value);
// 停止速度
double stopVal = decimal.ToDouble(numericUpDown_stopval.Value);
// 加速時間
double acc = decimal.ToDouble(numericUpDown_Acc.Value);
// 減速時間
double dec = decimal.ToDouble(numericUpDown_Dec.Value);
// S段時間
double s = decimal.ToDouble(numericUpDown_Spara.Value);
//獲取當(dāng)前選擇的軸
ushort axis = axises[comboBox_axis.SelectedIndex];
//設(shè)置單軸速度曲線 S 段參數(shù)值(設(shè)置S段時間)
short res = LTDMC.dmc_set_s_profile(_CardNO, axis, 0, s);
if (res != 0)
{
MessageBox.Show($"dmc_set_s_profile=={res}");
return;
}
//設(shè)置單軸運(yùn)動速度曲線
res = LTDMC.dmc_set_profile(_CardNO, axis, startVal, moveVal, acc, dec, stopVal);
if (res != 0)
{
MessageBox.Show($"dmc_set_profile=={res}");
return;
}
//設(shè)置停止時間
res = LTDMC.dmc_set_dec_stop_time(_CardNO, axis, dec);
if (res != 0)
{
MessageBox.Show($"dmc_set_dec_stop_time=={res}");
return;
}
}
private void button_start_Click(object sender, EventArgs e)
{
//獲取運(yùn)動距離
double dist = decimal.ToDouble(numericUpDown_movePos.Value);
//獲取運(yùn)動模式
ushort mode = (ushort)(radioButton_rel.Checked ? 0 : 1);
if (mb_init)
{
// 執(zhí)行運(yùn)動
short res = LTDMC.dmc_pmove(_CardNO, axises[comboBox_axis.SelectedIndex], (int)dist, mode);
if (res != 0)
{
MessageBox.Show($"dmc_pmove=={res}");
return;
}
}
}
}
}
以上就是關(guān)于pos機(jī)一直網(wǎng)絡(luò)初始化, 雷賽DMC3000 系列運(yùn)動控制卡初始化+運(yùn)動原碼的知識,后面我們會繼續(xù)為大家整理關(guān)于pos機(jī)一直網(wǎng)絡(luò)初始化的知識,希望能夠幫助到大家!
