新增导出XYZ工作台接口,新增导出灯光调节接口,完善debug信息输出。
This commit is contained in:
@@ -2,19 +2,169 @@
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <conio.h>
|
||||
#include "..\MachineInterfaceDll\MachineInterfaceDll.h"
|
||||
void ShowMessage(SSI_STATUS_MOTION status);
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
SSI_STATUS_MOTION status=Machine_Startup(false,false);
|
||||
double dPos(0.0);
|
||||
bool bb;
|
||||
status=Motion_GetPositionR(dPos);
|
||||
status=Motion_SetPositionR(dPos,true);
|
||||
status=Motion_IsHomed(bb);
|
||||
status=Motion_IsFinished(bb);
|
||||
status=Motion_MoveR(1);
|
||||
status=Machine_Sutdown();
|
||||
SSI_STATUS_MOTION status=Machine_Startup(false,HOME_NONE);
|
||||
printf("Machine_Startup:");
|
||||
ShowMessage(status);
|
||||
//=================================================================================
|
||||
//===============================Motion============================================
|
||||
bool bHomed(false);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
if (!bHomed)
|
||||
{
|
||||
status=Motion_DCCHomeXYZ(HOME_XYZ);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
do
|
||||
{
|
||||
Sleep(20);
|
||||
status=Motion_IsHomedXYZ(bHomed);
|
||||
printf("Motion_IsHomedXYZ:");
|
||||
ShowMessage(status);
|
||||
} while (!bHomed);
|
||||
}
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
status=Motion_Jog(MACHINE_AXIS_Y,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
status=Motion_Jog(MACHINE_AXIS_Z,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
double PositionX,PositionY,PositionZ;
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
PositionX=0.0;
|
||||
PositionY=0.0;
|
||||
PositionZ=0.0;
|
||||
printf("Motion_SetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||
status=Motion_SetPositionXYZ(PositionX,PositionY,PositionZ,true);
|
||||
|
||||
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionY,PositionX,PositionZ);
|
||||
|
||||
//status=Motion_IsFinishedXYZ(bool &bFinished);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,-3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
status=Motion_SetSpeedXYZ(MACHINE_AXIS_X,3,20,20,20,3,0.01);
|
||||
printf("Motion_SetSpeedXYZ:");
|
||||
ShowMessage(status);
|
||||
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||
printf("Motion_Jog:");
|
||||
ShowMessage(status);
|
||||
Sleep(3000);
|
||||
status=Motion_Stop();
|
||||
printf("Motion_Stop:");
|
||||
ShowMessage(status);
|
||||
|
||||
//===================================Rotary Table==================================
|
||||
//Motion_DCCHomeR();
|
||||
//Motion_IsHomedR(bool &bHomed);
|
||||
////Units:Rad
|
||||
//Motion_GetPositionR(double& dPos);
|
||||
//Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
||||
//Motion_IsFinishedR(bool &bFinished);
|
||||
//==============================Illumination=======================================
|
||||
//Range value:0.0-100.0
|
||||
status=Illumination_SetLampState(0,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,0,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
status=Illumination_SetLampState(100,100,0,0,0,0,0);
|
||||
printf("Illumination_SetLampState:");
|
||||
ShowMessage(status);
|
||||
Sleep(1000);
|
||||
|
||||
//==============================CMD================================================
|
||||
//SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data);
|
||||
status=Machine_Shutdown();
|
||||
printf("Machine_Shutdown:");
|
||||
ShowMessage(status);
|
||||
printf("Press any key to exit\r\n");
|
||||
_getch();
|
||||
return 0;
|
||||
}
|
||||
void ShowMessage(SSI_STATUS_MOTION status)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case SSI_STATUS_MOTION_NORMAL:
|
||||
{
|
||||
printf("SSI_STATUS_MOTION_NORMAL.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MOTION_DATALINK_ERROR:
|
||||
{
|
||||
printf("SSI_STATUS_MOTION_DATALINK_ERROR.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MOTION_LIMIT_REACHED:
|
||||
{
|
||||
printf("SSI_STATUS_MOTION_LIMIT_REACHED.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MOTION_INVALID_PARAMETERS:
|
||||
{
|
||||
printf("SSI_STATUS_MOTION_INVALID_PARAMETERS.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MOTION_TIMEOUT:
|
||||
{
|
||||
printf("SSI_STATUS_MOTION_TIMEOUT.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND:
|
||||
{
|
||||
printf("SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND:
|
||||
{
|
||||
printf("SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_MACHINE_UNINITIALIZED:
|
||||
{
|
||||
printf("SSI_STATUS_MACHINE_UNINITIALIZED.\r\n");
|
||||
break;
|
||||
}
|
||||
case SSI_STATUS_UNKNOWN_ERROR:
|
||||
{
|
||||
printf("SSI_STATUS_UNKNOWN_ERROR.\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user