#include "global.h" #if 0 void ChuanTou_AlarmProtect(void); void ChuanTou_ManualAction(void); void ChuanTou_AutoAction(void); void ChuanTou_StepCheckStart(void); void ChuanTou_Motor(void); void ChuanTou_SongLiaoAction(void); static unsigned cSongLiaoOk = 0; void CT_SetAlarmCode(unsigned alarm_code) { SetAlarmCode(CT_ALARM_ADDR,alarm_code); bAlarmStop = 1; } void ChuanTou_InitAction(void) { float length_buff,pulse_buff; save_limit_pos = CT_SAVE_POS; axis_x->speed_unit = 500; length_buff = CT_PARAM_CYCLE_LENGTH; pulse_buff = CT_PARAM_CYCLE_PULSE; XGearRatio = pulse_buff/length_buff; } void ChuanTou_Action(void) { ChuanTou_AlarmProtect(); ChuanTou_Motor(); ChuanTou_ManualAction(); ChuanTou_AutoAction(); ChuanTou_SongLiaoAction(); ChuanTou_StepCheckStart(); // 调用脚踏开关检测程序 } //手动动作 void ChuanTou_ManualAction(void) { if(bRunning == 0) { if(bClearTotal) //切断计数清零 { bClearTotal = 0; ClrcToTal(CT_TOTAL_ADDR); } if(CT_bGZ) { CT_bGZ = 0; CT_GZ_VAVLE = ~CT_GZ_VAVLE; } if(CT_bHL) { CT_bHL = 0; CT_HL_VAVLE = ~CT_HL_VAVLE; } if(CT_bJL) { CT_bJL = 0; CT_JL_VAVLE = ~CT_JL_VAVLE; } if(CT_bSL) { CT_bSL = 0; CT_SL_VAVEL = ~CT_SL_VAVEL; } if(CT_bHSL) { CT_bHSL = 0; CT_HSL_VAVLE = ~CT_HSL_VAVLE; } if(CT_bZL) { CT_bZL = 0; } if(CT_bGJ) { CT_bGJ = 0; CT_GJ_VAVLE = ~CT_GJ_VAVLE; } if(CT_bFZ) { CT_bFZ = 0; CT_FD_VAVLE = ~CT_FD_VAVLE; } if(CT_bCT_XM) { CT_bCT_XM = 0; } if(CT_bDW) { CT_bDW = 0; } if(CT_bAuto_ZL) { CT_bAuto_ZL = 0; } if(CT_bHM) { CT_bHM = 0; } } } void ChuanTou_AlarmProtect(void) { } void ChuanTou_HeMu_Action(void) { switch (CT_HeMuStep) { case 1: CT_HeMuStep = 2; break; case 2: CT_HeMuStep = 3; break; case 3: CT_HeMuStep = 4; break; } } //送料 void ChuanTou_SongLiaoAction(void) { switch(CT_SL_Step) { case 1: { if(cSongLiaoOk) { CT_SL_Step = 0; } else { if(CT_HSL_ORIGIN_IN && CT_SONG_LIAO_ORIGIN_IN) { CT_SL_VAVEL = 1; CT_SL_Delay = dwTickCount + VAVLE_ALARM_TIME; CT_SL_Step = 2; } } }break; case 2: { if(CT_SONG_LIAO_LIMIT_IN) { CT_SL_Step = 3; CT_SL_Delay = dwTickCount + CT_PARAM_SL_DELAY_BACK; } else if(dwTickCount >= CT_SL_Delay) { CT_SetAlarmCode(CT_SL_LIMIT_ALARM); } }break; case 3: { if(dwTickCount >= CT_SL_Delay) { CT_SL_VAVEL = 0; CT_SL_Delay = dwTickCount + VAVLE_ALARM_TIME; CT_SL_Step = 4; } }break; case 4: { if(CT_SONG_LIAO_ORIGIN_IN) { cSongLiaoOk = 1; CT_SL_Step = 0; } else if(dwTickCount >= CT_SL_Delay) { CT_SetAlarmCode(CT_SL_ORIGIN_ALARM); } } break; } } //横送料 void ChuanTou_HengSongLiao_Action(void) { switch(CT_HSL_Step) { case 1: { if(CT_SONG_LIAO_ORIGIN_IN && CT_HSL_ORIGIN_IN && CT_XIA_MU_IN && cSongLiaoOk) { CT_GJ_VAVLE = 0; CT_HSL_Step = 2; } else if(!bRunning) { CT_HSL_Step = 0; } } break; case 2: { CT_HSL_VAVLE = 1; cSongLiaoOk = 0; CT_HSL_Delay = dwTickCount + VAVLE_ALARM_TIME; CT_HSL_Step = 3; } break; case 3: { if(CT_HSL_LIMIT_IN) { CT_ZL_XM_VAVLE = 1; CT_HSL_Delay = dwTickCount + VAVLE_ALARM_TIME; CT_HSL_Step = 4; } else if(dwTickCount >= CT_HSL_Delay) { CT_SetAlarmCode(CT_HSL_LIMIT_ALARM); } } break; case 4: { if(CT_ZHUANG_LIAO_IN) { CT_HSL_Delay = dwTickCount + CT_PARAM_LOCK_TIME; CT_HSL_Step = 5; } else if(dwTickCount >= CT_HSL_Delay) { CT_SetAlarmCode(CT_ZL_LIMIT_ALARM); } } break; case 5: if(dwTickCount >= CT_HSL_Delay) { CT_GJ_VAVLE = 1; CT_HSL_Delay = dwTickCount + CT_PARAM_GJ_TIME; CT_HSL_Step = 6; } break; case 6: CT_HSL_VAVLE = 0; CT_HSL_Delay = dwTickCount + VAVLE_ALARM_TIME; CT_HSL_Step = 7; break; case 7: if(CT_HSL_ORIGIN_IN) { CT_ZL_XM_VAVLE = 0; CT_HSL_Step = 8; } else if(dwTickCount >= CT_HSL_Delay) { CT_SetAlarmCode(CT_HSL_ORIGIN_ALARM); } break; case 8: CT_HSL_Step = 0; CT_SL_Step = 1; break; } } void ChuanTou_AutoAction(void) { if(bRunning) { switch(CT_AutoStep) { case 1: if(dwTickCount >= CT_AutoDelay) { CT_AutoStep = 2; if(CT_MotorStep == 0) { CT_MotorStep = 61; //前点定位 // else CT_MotorStep = 1; } } break; case 2: if(CT_MotorStep == 0) { if(CT_PARAM_DC_MODE == 0) CT_MotorStep = 20; //后退到位 else CT_MotorStep = 30; CT_AutoStep = 3; } break; case 3: if(CT_MotorStep == 0) { if(CT_XiaQieStep == 0)CT_XiaQieStep = 1; CT_AutoStep = 4; } break; case 4: break; case 5: if(CT_MotorStep == 0) { cZipCnt++; CT_PARAM_NOW_CNT++; cTableCnt++; AddToTal(CT_TOTAL_ADDR); CalProSP(CT_PROSPEED_ADDR); if(cTableCnt >= CT_PARAM_TABLE_NUM) { cTableCnt = 0; CT_TABLE_VAVLE = 1; CT_TBDelay = dwTickCount + CT_PARAM_TB_TIME; } if((GetTotal(CT_TOTAL_ADDR) >= CT_PARAM_SET_TOTAL) || SingOneFlg) { bRunning = 0; CT_AutoStep = 0; SingOneFlg = 0; if(GetTotal(CT_TOTAL_ADDR) >= CT_PARAM_SET_TOTAL) CT_SetAlarmCode(CT_TOTAL_ALARM); } else { CT_AutoStep = 1; if(CT_PARAM_NOW_CNT >= CT_PARAM_ZHA_SHU) { CT_AutoDelay = dwTickCount + CT_PARAM_ZS_STOP_TIME + 50; CT_PARAM_NOW_CNT = 0; } else CT_AutoDelay = dwTickCount + CT_PARAM_CYCLE_DELAY; } } break; } } } void ChuanTou_StepCheckStart(void) { // 启动 if((START_IN_UP) || bStart || CT_bSingle) { bStart = 0; if(!bRunning && (CT_AutoStep == 0)) { if(!CT_SHANG_MU_ORIGIN_IN)CT_SetAlarmCode(CT_SM_YUANWEI); else if(CT_XIA_MU_LIMIT_IN)CT_SetAlarmCode(CT_XM_DAOWEI); else if(GetAlarmCode(CT_ALARM_ADDR) != 0); else if(GetTotal(CT_TOTAL_ADDR) >= CT_PARAM_SET_TOTAL) CT_SetAlarmCode(CT_TOTAL_ALARM); else if(CT_BL_VAVLE)CT_SetAlarmCode(CT_BL_ALARM); else if(CT_SM_VAVLE)CT_SetAlarmCode(CT_SM_ALARM); else { bRunning = 1; CT_AutoStep = 1; if(CT_bSingle) SingOneFlg= 1; cZhuangLiaoOk = 0; dwZipCnt = 0; } } CT_bSingle = 0; } //停止 if(STOP_IN_UP || bStop) { bStop = 0; user_datas[127] = 0; if(bRunning) { bRunning = 0; CT_AutoStep = 0; CT_MotorStep = 0; CT_AutoDelay = dwTickCount; CT_MotorDelay = dwTickCount; SingOneFlg = 0; if(GetAlarmCode(CT_ALARM_ADDR) != 0)SetAlarmCode(CT_ALARM_ADDR,0); } else { bRunning = 0; CT_AutoStep = 0; CT_MotorStep = 0; CT_AutoDelay = dwTickCount; CT_MotorDelay = dwTickCount; SingOneFlg = 0; AxisDecStop(X_AXIS); if(GetAlarmCode(CT_ALARM_ADDR) != 0)SetAlarmCode(CT_ALARM_ADDR,0); } } if(bAlarmStop) { bAlarmStop = 0; bRunning = 0; CT_AutoStep = 0; CT_MotorStep = 0; CT_AutoDelay = dwTickCount; CT_MotorDelay = dwTickCount; SingOneFlg = 0; AxisDecStop(X_AXIS); } } //电机动作 void ChuanTou_Motor(void) // { static long save_buff,length_buff,gou_zhen_buff,checkdelay_buff,dandao_buff,back_buff,gouzhen_buff,go_buff,go_length_buff; user_datas[124]= CT_MotorStep; // user_datas[125]= go_length_buff; // user_datas[123] = length_buff; user_datas[127] = cRealPos; user_datas[126] = go_buff - cRealPos; user_datas[121] = CT_PARAM_GOUZHEN_LENGTH; if(CT_GUO_LIAN_IN_DW)user_datas[122]++; switch(CT_MotorStep) { case 0: break; case 1: // 前点定位数控模式 if(CT_SZ_OUT) { CT_SZ_OUT = 0; CT_MotorDelay = dwTickCount + 50; } if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_N; if((CT_TuiLianStep == 0) && !CT_TL_VAVLE && !CT_PARAM_TL_MODE)CT_TuiLianStep = 1; CT_MotorStep = 2; break; case 2: if(dwTickCount >= CT_MotorDelay) { if(CT_QIAN_LIMIT_IN) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_P; MV_Set_Acc_CPU(X_AXIS, 10); AxisMovePos(X_AXIS,CT_PARAM_GO_HIGH_SPEED,CT_PARAM_ON_BACK_LENGTH); CT_MotorDelay = dwTickCount + 1000; } CT_MotorStep = 3; CT_JD_VAVEL = 0; } break; case 3: if(!X_DRV && !CT_QIAN_LIMIT_IN && (dwTickCount >= CT_MotorDelay)) { if(cZipCnt == 0) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_N; AxisContinueMove(X_AXIS,CT_PARAM_FIRST_SPEED,CT_DIR_P); //第一条走低速 } else { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_N; AxisMoveTwoPos(X_AXIS,CT_PARAM_GO_HIGH_SPEED,(length_buff - CT_PARAM_Go_LOW_SPEED_LENGTH + CT_PARAM_BACK_LENGTH +CT_PARAM_SJZ_LENGTH),CT_PARAM_GO_LOW_SPEED,0xFFFFFF,CT_DIR_P);//第二条开始走两段速 } CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 4; } break; case 4: if(CT_QIAN_LIMIT_IN_UP) { AxisEgmStop(X_AXIS); CT_MotorStep = 5; } else if(dwTickCount >= CT_MotorDelay)CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); else if(CT_JD_ORIGIN_IN)CT_SetAlarmCode(CT_JD_ORIGIN_ALARM); break; case 5: if(!X_DRV) { CT_MotorDelay = dwTickCount; CT_MotorStep = 6; } break; case 6: if((dwTickCount >= CT_MotorDelay) && (CT_TuiLianStep == 0)) { if(bRunning) { CT_JD_VAVEL = 1; } CT_MotorStep = 7; CT_MotorDelay = dwTickCount + 100; } break; case 7: if(dwTickCount >= CT_MotorDelay) { CT_YBD_VAVLE = 0; CT_TL_VAVLE = 0; CT_MotorStep = 0; } break; case 20:// 后退使用电机定长 CT_MotorDelay = dwTickCount + CT_PARAM_DELAY_BACK; CT_MotorStep = 21; break; case 21: if(dwTickCount >= CT_MotorDelay) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_N; AxisMovePos(X_AXIS,CT_PARAM_BACK_SPEED,-CT_PARAM_ZIPPER_LENGTH); CT_MotorStep = 22; } break; case 22: if(!X_DRV) { CT_MotorDelay = dwTickCount + CT_PARAM_DELAY_FZ; CT_MotorStep = 23; } break; case 23: if(dwTickCount >= CT_MotorDelay) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_DIR_P; AxisMovePos(X_AXIS,CT_PARAM_GO_LOW_SPEED,CT_PARAM_FZ_LENGTH); CT_MotorStep = 24; } break; case 24: if(!X_DRV) { CT_MotorStep = 0; CT_MotorDelay = dwTickCount; } break; case 30: CT_MotorDelay = dwTickCount + CT_PARAM_DELAY_BACK; CT_MotorStep = 31; if(CT_PARAM_BL_ENABLE)CT_BinLianStep = 1; break; case 31: // 后退使用钩针定长 if(dwTickCount >= CT_MotorDelay) { save_buff = cRealPos; back_buff = cRealPos; SetAccTime(X_AXIS,5); SetDecTime(X_AXIS,5); if(CT_PARAM_DEC_MODE == 0) { if(CT_PARAM_BACK_MODE) { if(cZipCnt < 2) { AxisContinueMove(X_AXIS,CT_PARAM_FIRST_SPEED,CT_DIR_P); CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 32; } else { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_P; AxisContinueMove(X_AXIS,CT_PARAM_BACK_SPEED,CT_DIR_P); CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 32; } } else { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_P; AxisContinueMove(X_AXIS,CT_PARAM_BACK_SPEED,CT_DIR_P); CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 32; } } else { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_P; if(cZipCnt < 2) { CT_XHG_VAVLE = 0; AxisContinueMove(X_AXIS,CT_PARAM_FIRST_SPEED,CT_DIR_P); CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 32; } else { gouzhen_buff = cRealPos; CT_XHG_VAVLE = 1; //AxisMoveTwoPos(X_AXIS,CT_PARAM_BACK_SPEED,(length_buff - CT_PARAM_Back_LOW_SPEED_LENGTH),CT_PARAM_GO_LOW_SPEED,CT_PARAM_Back_LOW_SPEED_LENGTH,CT_DIR_N); MV_Set_Acc_CPU(X_AXIS, 10); AxisMovePos(X_AXIS,CT_PARAM_BACK_SPEED,-length_buff); MoveChangSpeedPos(X_AXIS, CT_PARAM_BACK_LOW_SPEED,(PosToPulse(X_AXIS,CT_PARAM_Back_LOW_SPEED_LENGTH) + MV_Cal_Dec_pulse(CT_PARAM_BACK_SPEED,CT_PARAM_BACK_LOW_SPEED,10))); CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep = 33; } // AxisContinueMove(X_AXIS,CT_PARAM_BACK_SPEED,CT_DIR_N); } } break; case 32: if(CT_PARAM_DEC_MODE) { if(cZipCnt < 2) { if(CT_GUO_LIAN_IN_UP) { checkdelay_buff = cRealPos; CT_MotorDelay = dwTickCount; if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); CT_MotorStep = 33; } else if(dwTickCount >= CT_MotorDelay) { CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); } } else { CT_MotorStep = 36; } } else { if(CT_PARAM_BACK_MODE) { if(cZipCnt < 2) { if(CT_GUO_LIAN_IN_UP) { checkdelay_buff = cRealPos; CT_MotorDelay = dwTickCount; if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); CT_MotorStep = 33; } else if(dwTickCount >= CT_MotorDelay) { CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); } } else { if((cRealPos - back_buff) > (length_buff - (CT_PARAM_Back_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(CT_PARAM_BACK_SPEED,CT_PARAM_BACK_LOW_SPEED,10))))) { if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); } if(CT_GUO_LIAN_IN_UP) { checkdelay_buff = cRealPos; CT_MotorDelay = dwTickCount; if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); CT_MotorStep = 33; } else if(dwTickCount >= CT_MotorDelay) { CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); } } } else { if(CT_GUO_LIAN_IN_UP) { checkdelay_buff = cRealPos; if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); CT_MotorDelay = dwTickCount; CT_MotorStep = 33; } else if(dwTickCount >= CT_MotorDelay) { CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); } } } break; case 33: if((cZipCnt < 2) || (CT_PARAM_DEC_MODE == 0)) { if((cRealPos - checkdelay_buff) >= CT_PARAM_DELAY_CHECK) { if(CT_PARAM_GOUZHEN_LENGTH != 0)CT_GZ_VAVLE = 1; CT_MotorStep = 34; } } else { if((cRealPos - back_buff) > (length_buff - CT_PARAM_Back_LOW_SPEED_LENGTH)) { if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_BACK_LOW_SPEED); CT_MotorStep = 34; } } break; case 34: if((cZipCnt < 2) || (CT_PARAM_DEC_MODE == 0)) { if(CT_GUO_LIAN_IN_DW) { gou_zhen_buff = cRealPos; CT_MotorStep = 35; } } else { if(CT_PARAM_GOUZHEN_LENGTH != 0) { if((cRealPos - gouzhen_buff) >= (length_buff - CT_PARAM_GOUZHEN_LENGTH)) { if(CT_PARAM_GOUZHEN_LENGTH != 0)CT_GZ_VAVLE = 1; CT_MotorStep = 36; } } else { CT_MotorStep = 36; } } break; case 35: if(CT_GUO_LIAN_IN_DW) { gou_zhen_buff = cRealPos; } if(CT_GUO_LIAN_IN_UP) { gou_zhen_buff = cRealPos; } if((cRealPos - gou_zhen_buff) >= CT_PARAM_MOTOR_DELAY_LENGTH) { AxisEgmStop(X_AXIS); CT_MotorDelay = dwTickCount + VAVLE_ALARM_TIME; CT_MotorStep = 36; } break; case 36: if(!X_DRV && ((CT_PARAM_TIAOSHI_MODE && CT_bTS) || (CT_PARAM_TIAOSHI_MODE == 0))) { if(CT_PARAM_GOUZHEN_LENGTH == 0)CT_GZ_VAVLE = 1; if(CT_PARAM_DEC_MODE == 0)CT_GZ_VAVLE = 1; if(!CT_PARAM_TL_MODE)CT_YBD_VAVLE = 1; CT_MotorDelay = dwTickCount + CT_PARAM_TFK_DELAY; CT_MotorStep = 37; } break; case 37: if(dwTickCount >= CT_MotorDelay) { CT_TFK_VAVEL = 1; CT_MotorDelay = dwTickCount + 1000; CT_MotorStep = 38; } break; case 38: if(CT_GOUZHEN_IN && !X_DRV && ((CT_PARAM_TIAOSHI_MODE && CT_bTS) || (CT_PARAM_TIAOSHI_MODE == 0))) { if(CT_PARAM_TL_MODE)CT_YBD_VAVLE = 1; if(cZipCnt == 1) { length_buff = cRealPos - save_buff - CT_PARAM_OFFSET_LENGTH; } if(cZipCnt == 0) { go_length_buff = cRealPos - save_buff; } cTuiFangKuaiCnt = 0; CT_MotorStep = 0; } else if(dwTickCount >= CT_MotorDelay) { if(cTuiFangKuaiCnt == 0) { CT_MotorStep = 100; CT_TFK_VAVEL = 0; cTuiFangKuaiCnt++; CT_MotorDelay = dwTickCount + 1000; } else CT_SetAlarmCode(CT_GZ_ALARM); } break; case 100: if(dwTickCount >= CT_MotorDelay) { CT_MotorStep = 37; } break; case 40: if(dwTickCount >= CT_MotorDelay) { AxisMovePos(X_AXIS,CT_PARAM_CUT_BACK_SPEED,-(CT_PARAM_SJZ_LENGTH)); CT_MotorStep = 41; } break; case 41: if(!X_DRV) { CT_JD_VAVEL = 0; CT_MotorDelay = dwTickCount + 5; CT_MotorStep = 42; } break; case 42: if(dwTickCount >= CT_MotorDelay) { save_buff = cRealPos; if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_P; MV_Set_Acc_CPU(X_AXIS, 10); AxisMovePos(X_AXIS,CT_PARAM_CUT_BACK_SPEED,-(CT_PARAM_BACK_LENGTH)); CT_MotorStep = 44; } break; case 43: // 切断完成后拉电机动作 if(((CT_PARAM_SJZ_LENGTH) <= (cRealPos - save_buff))) { CT_JD_VAVEL = 0; CT_MotorStep = 44; } else if(!X_DRV) { CT_JD_VAVEL = 0; CT_MotorStep = 44; } break; case 44: // 切断完成后拉电机动作 if(!X_DRV) { CT_MotorStep = 0; CT_MotorDelay = dwTickCount; } break; case 61: // 前点定位数控模式 if(CT_SZ_OUT) { CT_SZ_OUT = 0; CT_MotorDelay = dwTickCount + 50; } if(CT_PARAM_TL_MODE) { // if(CT_TuiLianStep == 0)CT_TuiLianStep = 1; } else { if((CT_TuiLianStep == 0) && !CT_TL_VAVLE)CT_TuiLianStep = 1; } CT_MotorStep = 62; break; case 62: if(dwTickCount >= CT_MotorDelay) { if(CT_QIAN_LIMIT_IN) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_P; MV_Set_Acc_CPU(X_AXIS, 10); AxisMovePos(X_AXIS,CT_PARAM_FIRST_SPEED,-CT_PARAM_ON_BACK_LENGTH); CT_MotorDelay = dwTickCount + 1000; } CT_MotorStep = 63; CT_JD_VAVEL = 0; } break; case 63: if(!X_DRV && !CT_QIAN_LIMIT_IN && (dwTickCount >= CT_MotorDelay)) { if(CT_PARAM_TL_MODE)CT_JZ_DIR = CT_YDIR_N; go_buff = cRealPos; if(cZipCnt > 0) { MoveAction_Const_Stop(X_AXIS, CT_DIR_N,CT_PARAM_GO_HIGH_SPEED);// } else { MoveAction_Const_Stop(X_AXIS, CT_DIR_N,CT_PARAM_GO_LOW_SPEED); } // MoveAction_Const_Stop(X_AXIS, CT_DIR_P,CT_PARAM_GO_HIGH_SPEED);// // AxisContinueMove(X_AXIS,CT_PARAM_GO_HIGH_SPEED,CT_DIR_P); //第一条走低速 CT_MotorDelay = dwTickCount + MOTOR_ALARM_TIME; CT_MotorStep =64; } break; case 64: if(CT_PARAM_GO_MODE) { if(cZipCnt > 0) { if((go_buff - cRealPos) > (go_length_buff - (CT_PARAM_Go_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(CT_PARAM_BACK_SPEED,CT_PARAM_BACK_LOW_SPEED,10))) + CT_PARAM_BACK_LENGTH + CT_PARAM_SJZ_LENGTH)) { MoveChangSpeed(X_AXIS,CT_PARAM_GO_LOW_SPEED); CT_MotorStep =65; } } else { // if(CT_QIAN_DEC_IN) { // if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_GO_LOW_SPEED);//AxisChangeSpeed(X_AXIS,CT_PARAM_GO_LOW_SPEED); CT_MotorStep =65; } } } else { // if(CT_QIAN_DEC_IN) { // if(X_DRV)MoveChangSpeed(X_AXIS,CT_PARAM_GO_LOW_SPEED);//AxisChangeSpeed(X_AXIS,CT_PARAM_GO_LOW_SPEED); CT_MotorStep =65; } } break; case 65: if(CT_QIAN_LIMIT_IN_UP) { if(CT_PARAM_DAO_MODE) { dandao_buff = cRealPos; CT_MotorStep = 70; } else { AxisEgmStop(X_AXIS); CT_MotorStep = 66; } } else if(dwTickCount >= CT_MotorDelay)CT_SetAlarmCode(CT_NO_ZIPPER_ALARM); else if(CT_JD_ORIGIN_IN)CT_SetAlarmCode(CT_JD_ORIGIN_ALARM); break; case 70: if((dandao_buff - cRealPos) >= CT_PARAM_DANDAO_MODE_LENGTH) { AxisEgmStop(X_AXIS); CT_MotorStep = 66; } break; case 66: if(!X_DRV) { CT_MotorDelay = dwTickCount; CT_MotorStep = 67; } break; case 67: if((dwTickCount >= CT_MotorDelay) && (CT_TuiLianStep == 0) && ((CT_PARAM_TIAOSHI_MODE && CT_bTS) || (CT_PARAM_TIAOSHI_MODE == 0)) ) { if(bRunning) { CT_JD_VAVEL = 1; } CT_MotorStep = 68; CT_MotorDelay = dwTickCount + CT_PARAM_DELAY_BACK; } break; case 68: if(dwTickCount >= CT_MotorDelay) { CT_YBD_VAVLE = 0; CT_TL_VAVLE = 0; CT_MotorStep = 0; } break; } } #endif