指令265
ZAux_DirectCommand
指令原型
int32 __stdcall ZAux_DirectCommand(ZMC_HANDLE handle, const char *pszCommand,char *psResponse, uint32 uiResponseLength)
指令说明
发送字符串命令到控制器,直接方式(不进缓冲区,有少数命令,暂时不支持)。
输入参数
[tr][/tr][tr][/tr][/table][tr][/tr][tr][/tr][tr][/tr]参数名 | 描述 | handle | 连接句柄。 | pszCommand | 发送的命令字符串。 | uiResponseLength | 返回的字符长度。 |
输出参数 | [table] |
参数名 | 描述 | uiResponseLength | 返回的字符串。 |
返回值 | 成功返回值为0,非0详见错误码说明。 | 指令示例 | 在线命令函数的使用 | 详细说明 | 上位机调用上位机未封装的Basic指令功能 |
C#主体代码:
private void auto_move()
{
ThreadFlag = true;
zmcaux.ZAux_Direct_SetSpeed(g_handle, 0, Convert.ToSingle(C_AutoSpeed.Text));
zmcaux.ZAux_Direct_SetAccel(g_handle, 0, Convert.ToSingle(C_AutoAccel.Text));
zmcaux.ZAux_Direct_SetDecel(g_handle, 0, Convert.ToSingle(C_AutoDecel.Text));
string cmdbuff = "AXIS_ZSET(0) = 19 ";
UInt32 uiResponseLength = 2048;
StringBuilder psResponse = new StringBuilder((Int32)uiResponseLength);
Int32 iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength); //设置主轴开启精准输出模式
zmcaux.ZAux_Direct_MoveAbs(g_handle, 2, new int[] { 0,1}, new float[] { 0, 0 });//走到零位
while (true)
{
if (checkFrameAxisIdleState() == true) break;
}
zmcaux.ZAux_Trigger(g_handle);
//相对运动走轨迹
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 0, -35}); //走到开胶点
cmdbuff = "MOVEOP_DELAY = 0";
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
if (!ifTimeControl) //距离控制
{
cmdbuff = "MOVEOP_ADIST = " + C_OpenDis.Text;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
else
{
if (Convert.ToSingle(C_OpenTime.Text) > 0) //提前
{
cmdbuff = "MOVEOP_AHEADMS = " + C_OpenTime.Text;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
else //滞后
{
string T_Value = (-Convert.ToSingle(C_OpenTime.Text)).ToString(); //moveop_delay滞后需要正值
cmdbuff = "MOVEOP_DELAY = " + T_Value;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
}
zmcaux.ZAux_Direct_MoveOp(g_handle, 0, 0, 1);
//测试走点胶轨迹
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 50, 0});
//iresult = zmcaux.ZAux_Direct_MSpherical(g_handle, virAxisList.Length, virAxisList, 0, 100, 0, 50, 50, 0, mSphericalMode, 5, 90);
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 0, 70 });
//iresult = zmcaux.ZAux_Direct_MSpherical(g_handle, virAxisList.Length, virAxisList, 0, -100, 0, -50, -50, 0, mSphericalMode, 5, 90);
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { -100, 0 });
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 0, -70});
zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 50,0 }); //走到关胶点
//zmcaux.ZAux_Direct_Move(g_handle, 2, new int[] { 0, 1 }, new float[] { 0, 35 }); //走到关胶点
cmdbuff = "MOVEOP_DELAY = 0";
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
if (!ifTimeControl) //距离控制
{
cmdbuff = "MOVEOP_ADIST = " + C_CloseDis.Text;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
else
{
if (Convert.ToSingle(C_CloseTime.Text) > 0) //提前
{
cmdbuff = "MOVEOP_AHEADMS = " + C_CloseTime.Text;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
else //滞后
{
string T_Value = (-Convert.ToSingle(C_CloseTime.Text)).ToString(); //moveop_delay滞后需要正值
cmdbuff = "MOVEOP_DELAY = " + T_Value;
iresult = zmcaux.ZAux_DirectCommand(g_handle, cmdbuff, psResponse, uiResponseLength);
}
}
zmcaux.ZAux_Direct_MoveOp(g_handle, 0, 0, 0);
zmcaux.ZAux_Direct_MoveAbs(g_handle, 2, new int[] { 0, 1 }, new float[] { 0, 0 }); //走到零位
}
六.效果演示
下面以C#代码跑测试和RTSys示波器抓取波形分析。
1.同步输出效果:
2.距离控制提前滞后输出效果:
3.时间控制提前滞后效果:
视频讲解。
以下视频来源于
正运动小助手
已关注 关注 重播 分享 赞 观看更多运控CMCIA0/0
00:00/09:02进度条,百分之0播放00:00
/09:02
09:02
全屏 倍速播放中
0.5倍 0.75倍 1.0倍 1.5倍 2.0倍 超清 流畅 继续观看
PCIe EtherCAT实时运动控制卡PCIE464点胶工艺中的同步/提前/延时开关胶
转载
,
PCIe EtherCAT实时运动控制卡PCIE464点胶工艺中的同步/提前/延时开关胶
运控CMCIA已同步到看一看
写下你的评论 视频详情 完整代码获取地址
▼本次,正运动技术PCIe EtherCAT实时运动控制卡PCIE464点胶工艺中的同步/提前/延时开关胶,就分享到这里。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!