void CDlgIOTest::OnMainPosDir() 
{
	unsigned short tempbyte = this->m_IOout&MAIN_AXE_POS_DIR;
	if (tempbyte!=0)
	{
	    this->m_BtnMainAxePosDir.SetBkColor(RGB(34,189,17));
	    this->m_IOout&=(~MAIN_AXE_POS_DIR);
	    GT_ExOpt(this->m_IOout);
		//outport_bit(1,IO_FOR_MAINAXE_POSITIVE_DIR,0);
	}
	else
	{
	    this->m_BtnMainAxePosDir.SetBkColor(RGB(255,0,0));
	    this->m_IOout|=MAIN_AXE_POS_DIR;
        GT_ExOpt(this->m_IOout);
	    //outport_bit(1,IO_FOR_MAINAXE_POSITIVE_DIR,1);
    }	
}
void CDlgIOTest::OnMainNegDir() 
{
	// TODO: Add your control notification handler code here
	unsigned short tempbyte = this->m_IOout&MAIN_AXE_NEG_DIR;
	if (tempbyte!=0)
	{		
		this->m_BtnMainAxeNegDir.SetBkColor(RGB(34,189,17));
		this->m_IOout&=(~MAIN_AXE_NEG_DIR);
		GT_ExOpt(this->m_IOout);
		//outport_bit(1,IO_FOR_MAINAXE_NEGETIVE_DIR,0);
	}
	else
	{
		this->m_BtnMainAxeNegDir.SetBkColor(RGB(255,0,0));
		this->m_IOout|=MAIN_AXE_NEG_DIR;
		GT_ExOpt(this->m_IOout);
		//outport_bit(1,IO_FOR_MAINAXE_NEGETIVE_DIR,1);
	}
}
Пример #3
0
bool GES_CCS_Ctrl::ges_ccs_control(sAcqEasyParam* acqEasyParam,MCHR_ID SensorID,
                                   HANDLE evAcquisition,cAcqEasy* pAcqEasy,
                                   FILE *File_z,int x,int y,int step,float vel,int height,int width,int countSum,int* nowCount)
{

    rtn = ges.GT_System_Initinal();						//平台初始化
    if(rtn!=0)
    {
        printf("电机初始化失败!");
        return false;
    }

    rtn = ges.AxisInitial(2,15);							//控制轴初始化函数
    if(rtn!=0)
    {
        printf("电机控制轴初始化失败!");

        return false;

    }
    rtn = ges.MotionInitial();							//轴运动参数初始化
    if(rtn!=0)
    {
        printf("电机控制轴运动参数初始化失败!");
        return false;
    }

    //电机指令缓冲区设置需要运动的轨迹初始化(X、Y轴未运动)
    /*(2)*/
    rtn = ges.GT_Buffer();

    if(rtn!=0)
    {

        printf("电机缓冲区运动指令设置失败!");
        return false;
    }

    for(int i=1; i<=height; i++)
    {
        (*nowCount)++;
        printf("已完成 %.2f %% !!!\n",((*nowCount)*1.0/countSum*100));
        rtn = ges.GT_Check_status();
        if(rtn!=0)
        {
            printf("检测电机状态失败!");
            return false;
        }
        GT_ExOpt(0x0000);       //外部触发Exo6置0
        Sleep(10);
        pAltitude = new float[width];
        pIntensity = new float[width];
        //read acquisition result
        ges.GT_ADD_Buffer_trigger(x,y,vel);//速度12.5mm/s
        Sleep(10);
        GT_ExOpt(0x0000);
        //控制CCS
        resultProcess = ccs.Process(pAcqEasy, evAcquisition, *acqEasyParam,
                                    pAltitude, pIntensity,&DataCount);
        if (resultProcess == STATUS_NO_ERROR)
        {
            //保存数据
            if (!DataSave(File_z,pAltitude,1,width))
                printf("DataSave Error!");
            if (!DataSave(File_z,pIntensity,1,width))
                printf("DataSave Error!");
        }
        else
        {
            if (resultProcess != STATUS_TIMEOUT_ERROR)
            {
                printf("Main : Process() : Error 0x%X\n", resultProcess);
            }
        }

        y = y + step;//12.5um	pluse = 0.5um
        if(rtn!=0)
        {
            printf("电机缓冲区指令执行失败!");
            return false;
        }
        else
        {
            rtn = ges.GT_Check_status();
            if(rtn!=0)
            {
                printf("检测电机状态失败!");
                return false;
            }
        }
        rtn = ges.GT_ADD_Buffer_continue(0,y,100);
        if(rtn!=0)
        {
            printf("电机缓冲区指令执行失败!");
            return false;
        }
        else
        {
            rtn = ges.GT_Check_status();
            if(rtn!=0)
            {
                printf("检测电机状态失败!");
                return false;
            }
            Sleep(1000);//?
        }
        delete[] pAltitude;
        delete[] pIntensity;
    }
    return true;
}