zxm516585112
zxm516585112
2021-01-17 13:54

请问高手,以下代码,为什么同一个变量RET可以多次赋值,谢谢!

  • 开发语言
int main()
{
char * ip = (char *)"127.0.0.1"; //IP地址
ZMC_HANDLE handle = NULL; //连接句柄
int ret; //指令返回值
ret = ZAux_OpenEth(ip, &handle);
if (ret != 0)
{
printf("connected failed \n");
handle = NULL;
return -1;
}
else printf("connected success!\n");
float GetSramp;
int axislist[1] = { 0 }; //运动轴列表,其中轴1为主轴
/*设置轴参数*/
ret = ZAux_Direct_SetDpos(handle, axislist[0], 0); //设置轴0的DPOS
commandCheckHandler("ZAux_Direct_SetDpos", ret);
ret = ZAux_Direct_SetAtype(handle, axislist[0], 1);//设置轴0的类型
commandCheckHandler("ZAux_Direct_SetAtype", ret);
ZAux_Trigger(handle); //开启示波器
ret = ZAux_Direct_SetSpeed(handle, axislist[0], 1000);//设置轴0的速度
commandCheckHandler("ZAux_Direct_SetSpeed", ret);
ret = ZAux_Direct_SetUnits(handle, axislist[0], 1000); //设置轴0的脉冲当量
commandCheckHandler("ZAux_Direct_SetUnits", ret);
ret = ZAux_Direct_SetAccel(handle, axislist[0], 100);//设置轴0的加速度
commandCheckHandler("ZAux_Direct_SetAccel", ret);
ret = ZAux_Direct_SetDecel(handle, axislist[0], 100);//设置轴0的减速度
commandCheckHandler("ZAux_Direct_SetDecel", ret);
ret = ZAux_Direct_SetSramp(handle, axislist[0], 1000);//设置轴0的加减速曲线
commandCheckHandler("ZAux_Direct_SetSramp", ret);
ret = ZAux_Direct_Single_Move(handle, axislist[0], 200);
commandCheckHandler("ZAux_Direct_Single_Move", ret);
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换