pos机一直显示初始化, 雷赛DMC3000 系列运动控制卡初始化+运动原码

 新闻资讯2  |   2023-05-22 08:33  |  投稿人:pos机之家

网上有很多关于pos机一直显示初始化, 雷赛DMC3000 系列运动控制卡初始化+运动原码的知识,也有很多人为大家解答关于pos机一直显示初始化的问题,今天pos机之家(www.poszjia.com)为大家整理了关于这方面的知识,让我们一起来看下吧!

本文目录一览:

1、pos机一直显示初始化

pos机一直显示初始化

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;

//获取轴数

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;// 标记初化完成

}

}

private void blt_Close_Click(object sender, EventArgs e)

{

LTDMC.dmc_board_close();

this.Close();

}

/// <summary>

/// 设置运行参数

/// </summary>

private void SetMoveParametes()

{

// 起始速度

double startVal = decimal.ToDouble(numericUpDown_Startval.Value);

// 运行速度

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);

//获取当前选择的轴

ushort axis = axises[comboBox_axis.SelectedIndex];

//设置单轴速度曲线 S 段参数值(设置S段时间)

short res = LTDMC.dmc_set_s_profile(_CardNO, axis, 0, s);

if (res != 0)

{

MessageBox.Show($"dmc_set_s_profile=={res}");

return;

}

//设置单轴运动速度曲线

res = LTDMC.dmc_set_profile(_CardNO, axis, startVal, moveVal, acc, dec, stopVal);

if (res != 0)

{

MessageBox.Show($"dmc_set_profile=={res}");

return;

}

//设置停止时间

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)

{

//获取运动距离

double dist = decimal.ToDouble(numericUpDown_movePos.Value);

//获取运动模式

ushort mode = (ushort)(radioButton_rel.Checked ? 0 : 1);

if (mb_init)

{

// 执行运动

short res = LTDMC.dmc_pmove(_CardNO, axises[comboBox_axis.SelectedIndex], (int)dist, mode);

if (res != 0)

{

MessageBox.Show($"dmc_pmove=={res}");

return;

}

}

}

}

}

以上就是关于pos机一直显示初始化, 雷赛DMC3000 系列运动控制卡初始化+运动原码的知识,后面我们会继续为大家整理关于pos机一直显示初始化的知识,希望能够帮助到大家!

转发请带上网址:http://www.poszjia.com/newsone/51540.html

你可能会喜欢:

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 babsan@163.com 举报,一经查实,本站将立刻删除。