123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827 |
- #include "global.h"
- #if TONG_YONG_MACHINE
- void HL_InitAction(void);
- void HL_Action(void);
- void HL_SetAlarmCode(unsigned alarm_code);
- void HL_StartStopAction(void);
- void HL_AutoRunStep(void);
- void HL_Motor(void);
- void HL_Step(void);
- unsigned char cDWflg=0,cZCXflg=0,cHLflg=0;
- unsigned char cBBflg = 0;
- short *offset_length_buff;
- void HL_SetAlarmCode(unsigned alarm_code)
- {
- SetAlarmCode(HL_ALARM_ADDR,alarm_code);
- HL_bAlarmStop = 1;
- }
- void HL_InitAction(void)
- {
- CalFreqTab_X_Free(14);
- XGearRatio = 1;
- }
- //手动动作
- void HL_ManualAction(void)
- {
- if(!HL_bRunning)
- {
- //警告跳出
- if(bClearTotal)
- {
- bClearTotal = 0;
- ClrcToTal(HL_TOTAL_ADDR);
- HL_bSetWorkData = 1;
- }
-
- if(HL_bAdd)
- {
- HL_bAdd = 0;
- HL_PARAM_DELAY_STOP += 10;
- }
- if(HL_bDec)
- {
- HL_bDec = 0;
- if(HL_PARAM_DELAY_STOP >= 10)HL_PARAM_DELAY_STOP -= 10;
- }
- if(HL_bHM)
- {
- HL_bHM = 0;
- HL_HM_VAVLE = ~HL_HM_VAVLE;
-
- if(HL_HM_VAVLE == 0)HL_YD_VAVLE = 0;
- }
- if(HL_bTFK)
- {
- HL_bTFK = 0;
- HL_TFK_VAVLE = ~HL_TFK_VAVLE;
- }
- if(HL_bBB)
- {
- HL_bBB = 0;
- HL_BB_VAVLE = ~HL_BB_VAVLE;
- if(HL_BB_VAVLE)cBBflg = 1;
- }
-
- if(cBBflg)
- {
- if(HL_BB_LIMIT_IN)
- {
- cBBflg = 0;
- }
- }
-
- if(HL_bYCX)
- {
- HL_bYCX = 0;
- HL_YCX_VAVLE = 1;
- HL_YCXDelay = dwTickCount + HL_PARAM_YCX_TIME;
- }
-
- if(HL_bDK_UP)
- {
- HL_bDK_UP = 0;
- HL_DK_UP_VAVLE = ~HL_DK_UP_VAVLE;
- }
- if(HL_bJD)
- {
- HL_bJD = 0;
- HL_JD_VAVLE = ~HL_JD_VAVLE;
- }
- if(HL_bCCX)
- {
- HL_bCCX = 0;
- HL_CCX_VAVLE = ~HL_CCX_VAVLE;
- }
- if(HL_bYD)
- {
- HL_bYD = 0;
- HL_YD_VAVLE = ~HL_YD_VAVLE;
- }
-
- if(HL_bSJ)
- {
- HL_bSJ = 0;
- HL_SJ_VAVLE = ~HL_SJ_VAVLE;
- }
-
- if(HL_bHMYD)
- {
- HL_bHMYD = 0;
-
- if(HL_HM_VAVLE)
- {
- HL_HM_VAVLE = 0;
- }
- else
- {
- HL_HM_VAVLE = 1;
- }
- }
-
- if(HL_bDKUP)
- {
- HL_bDKUP = 0;
- if(HL_DK_UP_VAVLE)
- {
- HL_DK_UP_VAVLE = 0;
- HL_YD_VAVLE = 0;
- }
- else
- {
- HL_DK_UP_VAVLE = 1;
- }
- }
-
-
- if(HL_bCD)
- {
- HL_bCD = 0;
- HL_CD_MOTOR = ~HL_CD_MOTOR;
- }
- if(HL_bMotor)
- {
- SetEn(X_AXIS,HL_MOTOR_EN);
- if(!X_DRV)AxisContinueMove(X_AXIS,10,HL_DIR_P);
- }
- else
- {
- if(X_DRV)AxisDecStop(X_AXIS);
- }
- }
- }
- //合链动作
- void HL_Action(void)
- {
- HL_ManualAction();
- HL_StartStopAction();
- HL_Motor();
- HL_Step();
- HL_AutoRunStep();
- }
- //启动停止故障停止动作
- void HL_StartStopAction(void)
- {
- static unsigned long dwstop_cnt = 0;
- if((START_IN_UP || HL_bStart || HL_bSingStart || HL_bDW || HL_bZCX || HL_bHL) && !HL_bRunning && (HL_AutoStep ==0))
- {
- if(GetTotal(HL_TOTAL_ADDR) >= SET_TOTAL)HL_SetAlarmCode(HL_TOTAL_ALARM);
- else
- {
- SetAlarmCode(HL_ALARM_ADDR,HL_NO_ALARM);
- HL_bRunning = 1;
- dwZipCnt = 0;
- if(HL_bSingStart)
- {
- HL_bSingStart = 0;
- SingOneFlg = 1;
- }
-
- if(HL_bDW)
- {
- cDWflg = 1;
- dwZipCnt = 1;
- }
- if(HL_bZCX)cZCXflg = 1;
- if(HL_bHL)cHLflg = 1;
-
- if(HL_bZCX)HL_AutoStep = 4;
- else if(HL_bHL)HL_AutoStep = 1;
- else HL_AutoStep = 1;
-
- }
- HL_bDW = 0;
- HL_bZCX = 0;
- HL_bHL = 0;
- HL_bSingStart = 0;
- HL_bStart = 0;
- }
-
- if(!HL_bMotor && !X_DRV && !HL_bRunning && (HL_MotorStep==0))SetEn(X_AXIS,HL_MOTOR_DISEN);
-
- if(HL_bStop)
- {
- HL_bStop = 0;
- if(HL_bRunning)
- SingOneFlg = 1;
- else
- {
- HL_HM_VAVLE = 0;
- HL_TFK_VAVLE = 0;
- HL_BB_VAVLE = 0;
- HL_DK_UP_VAVLE = 0;
- HL_JD_VAVLE = 0;
- HL_CCX_VAVLE = 0;
- HL_YD_VAVLE = 0;
- HL_SJ_VAVLE = 0;
- HL_CD_MOTOR = 0;
- HL_ALARM_OUT = 0;
- HL_bRunning = 0;
- HL_AutoStep = 0;
- HL_MotorStep = 0;
- SingOneFlg = 0;
- HL_bMotor = 0;
- cDWflg = 0;
- cZCXflg = 0;
- cHLflg = 0;
- HL_ManDKStep = 0;
- AxisEgmStop(X_AXIS);
- SetAlarmCode(HL_ALARM_ADDR,HL_NO_ALARM);
- }
- }
-
- if(STOP_IN_UP)
- {
- HL_bStop = 0;
- if(HL_bRunning)
- {
- HL_TFK_VAVLE = 0;
- HL_DK_UP_VAVLE = 0;
- HL_JD_VAVLE = 0;
- HL_CCX_VAVLE = 0;
- HL_YD_VAVLE = 0;
- HL_SJ_VAVLE = 0;
- HL_CD_MOTOR = 0;
- HL_ALARM_OUT = 0;
- HL_bRunning = 0;
- HL_AutoStep = 0;
- HL_MotorStep = 0;
- HL_HLStep = 0;
- HL_ManDKStep = 0;
- SingOneFlg = 0;
- HL_bMotor = 0;
- cDWflg = 0;
- cZCXflg = 0;
- cHLflg = 0;
- SetAlarmCode(HL_ALARM_ADDR,HL_NO_ALARM);
- AxisEgmStop(X_AXIS);
- }
- else
- {
- HL_TFK_VAVLE = 0;
- HL_BB_VAVLE = 0;
- HL_HM_VAVLE = 0;
- HL_DK_UP_VAVLE = 0;
- HL_JD_VAVLE = 0;
- HL_CCX_VAVLE = 0;
- HL_YD_VAVLE = 0;
- HL_SJ_VAVLE = 0;
- HL_CD_MOTOR = 0;
- HL_bRunning = 0;
- HL_AutoStep = 0;
- HL_MotorStep = 0;
- HL_HLStep = 0;
- SingOneFlg = 0;
- cDWflg = 0;
- cZCXflg = 0;
- cHLflg = 0;
- HL_bMotor = 0;
- SetAlarmCode(HL_ALARM_ADDR,HL_NO_ALARM);
- AxisEgmStop(X_AXIS);
- }
- }
-
-
- if(HL_bAlarmStop)
- {
- HL_ALARM_OUT = 1;
- HL_bAlarmStop = 0;
- AxisEgmStop(X_AXIS);
- HL_AutoStep = 0;
- HL_ManDKStep = 0;
- HL_MotorStep = 0;
- HL_HLStep = 0;
- HL_bRunning = 0;
- SingOneFlg = 0;
- cDWflg = 0;
- cZCXflg = 0;
- cHLflg = 0;
- }
- }
- void HL_Step(void)
- {
- static long hm_save_buff;
- switch(HL_HLStep)
- {
- case 1:
- if(HL_GUO_LIAN_IN_UP)
- {
- hm_save_buff = dwRealPos;
- HL_HLStep = 2;
- }
- break;
- case 2:
- if((dwRealPos + HL_PARAM_DELAY_HM_BACK) <= hm_save_buff)
- {
- HL_HM_VAVLE = 0;
- HL_HLDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_HLStep = 3;
- }
- else if(!X_DRV)HL_SetAlarmCode(HL_HM_BACK_ALARM);
- break;
- case 3:
- if(!HL_SM_LIMIT_IN && !HL_XM_LIMIT_IN)
- {
- HL_HLStep = 4;
- HL_HLDelay = dwTickCount + HL_PARAM_DELAY_BB_BACK;
- }
- else if(dwTickCount >= HL_HLDelay)
- {
- if(HL_SM_LIMIT_IN)HL_SetAlarmCode(HL_SM_LIMIT_ALARM);
- else HL_SetAlarmCode(HL_XM_LIMIT_ALARM);
- }
- break;
- case 4:
- if(dwTickCount >= HL_HLDelay)
- {
- HL_HLStep = 5;
- HL_BB_VAVLE = 0;
- HL_HLDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- }
- break;
- case 5:
- if(!HL_BB_LIMIT_IN)
- {
- HL_HLStep = 0;
- if(SingOneFlg)
- {
- SingOneFlg = 0;
- HL_AutoStep = 0;
- HL_bRunning = 0;
- HL_MotorStep = 0;
- }
-
- HL_HLDelay = dwTickCount;
- }
- else if(dwTickCount >= HL_HLDelay)
- {
- HL_SetAlarmCode(HL_BB_LIMIT_ALARM);
- }
- break;
- }
- }
- //电机动作
- void HL_Motor(void) //
- {
- static long save_buff,hm_save_buff;
-
- DISPLAY_DATA0 = user_datas[100];
- DISPLAY_DATA1 = HL_AutoStep;
- DISPLAY_DATA2 = HL_MotorStep;
- DISPLAY_DATA3 = HL_HLStep;
- dwRealPos = GetPos(X_AXIS);
- switch(HL_MotorStep)
- {
- case 0:break;
- case 1:
- if(GetEn(X_AXIS) == 0)
- {
- SetEn(X_AXIS,HL_MOTOR_EN);
- HL_MotorDelay = dwTickCount + 100;
- }
- HL_MotorStep = 2;
- break;
- case 2:
- if(dwTickCount >= HL_MotorDelay)
- {
- HL_MotorDelay = dwTickCount + HL_PARAM_MOTOR_ALARM_TIME;
-
- if(!HL_GUO_LIAN_IN)
- {
- MoveAction_Const_AccDec(X_AXIS,HL_DIR_P,HL_PARAM_LOW_SPEED,1,5,1);
- HL_MotorDelay = dwTickCount + HL_PARAM_DELAY_CHECK_TIME;
- HL_MotorStep = 4;
- }
- else
- {
- if(dwZipCnt == 0)
- MoveAction_Const_AccDec(X_AXIS,HL_DIR_P,HL_PARAM_HIGH_SPEED/3,1,5,1);
- else
- MoveAction_Const_AccDec(X_AXIS,HL_DIR_P,HL_PARAM_HIGH_SPEED,1,5,1);
- HL_MotorStep = 3;
- }
-
- if(HL_HM_VAVLE)
- {
- *offset_length_buff = 0;
- if(HL_HLStep == 0)HL_HLStep = 1;
- }
- else
- {
- *offset_length_buff = 0;
- }
- }
- break;
- case 3:
- if(HL_GUO_LIAN_IN_DW)
- {
- AxisChangeSpeed(X_AXIS,HL_PARAM_LOW_SPEED);
- HL_MotorDelay = dwTickCount + HL_PARAM_DELAY_CHECK_TIME;
- HL_MotorStep = 4;
- }
- else if(dwTickCount >= HL_MotorDelay)
- HL_SetAlarmCode(HL_GUOLIAN_ALARM);
- break;
- case 4:
- if(dwTickCount >= HL_MotorDelay)
- {
- HL_MotorStep = 5;
- HL_MotorDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- }
- break;
- case 5:
- if(HL_GUO_LIAN_IN_UP)
- {
- save_buff = dwRealPos;
- HL_MotorStep = 6;
- }
- else if(dwTickCount >= HL_MotorDelay)
- HL_SetAlarmCode(HL_GUOLIAN_ALARM);
- break;
- case 6:
- if((dwRealPos + HL_PARAM_DELAY_STOP) <= save_buff)
- {
- AxisEgmStop(X_AXIS);
- HL_MotorStep = 7;
- }
- break;
- case 7:
- if(!X_DRV && (HL_HLStep == 0))
- {
- HL_MotorStep = 0;
- HL_MotorDelay = dwTickCount;
- }
- break;
- /* case 20:
- // if(!X_DRV)
- {
- HL_MotorStep = 21;
- HL_HM_VAVLE = 0;
- HL_MotorDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- }
- break;
- case 21:
- if(!HL_SM_LIMIT_IN && !HL_XM_LIMIT_IN)
- {
- HL_MotorStep = 22;
- HL_MotorDelay = dwTickCount + HL_PARAM_DELAY_BB_BACK;
- }
- else if(dwTickCount >= HL_MotorDelay)
- {
- if(HL_SM_LIMIT_IN)HL_SetAlarmCode(HL_SM_LIMIT_ALARM);
- else HL_SetAlarmCode(HL_XM_LIMIT_ALARM);
- }
- break;
- case 22:
- if(dwTickCount >= HL_MotorDelay)
- {
- if(cHLflg)
- HL_MotorStep = 0;
- else
- HL_MotorStep = 23;
- HL_BB_VAVLE = 0;
-
- if(SingOneFlg)
- {
- SingOneFlg = 0;
- HL_MotorStep = 0;
- HL_AutoStep = 0;
- HL_bRunning = 0;
- }
- HL_MotorDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- }
- break;
- case 23:
- if(!HL_BB_LIMIT_IN)
- {
- HL_MotorStep = 0;
- // if(!X_DRV)AxisMovePosAccDec(X_AXIS,HL_PARAM_LOW_SPEED,HL_PARAM_DELAY_STOP2,1,5,5);
- }
- else if(dwTickCount >= HL_MotorDelay)
- {
- HL_SetAlarmCode(HL_BB_LIMIT_ALARM);
- }
- break;
- case 24:
- if(!X_DRV)
- {
- HL_MotorStep = 0;
- HL_MotorDelay = dwTickCount;
- }
- break;*/
- }
- }
- //自动运行动作
- void HL_AutoRunStep(void)
- {
- if((dwTickCount >= HL_YCXDelay) && HL_YCX_VAVLE)HL_YCX_VAVLE = 0;
- if(HL_bRunning)
- {
- if(HL_AutoStep == 1)
- {
- HL_AutoStep = 2;
- }
- else if((HL_AutoStep == 2) && (dwTickCount >= HL_AutoDelay))
- {
- if(HL_MotorStep == 0)
- {
- HL_AutoStep = 3;
- HL_MotorStep = 1;
- HL_SJ_VAVLE = 0;
- }
- }
- else if(HL_AutoStep == 3)
- {
- if(HL_MotorStep == 0)
- {
- if(cDWflg | cHLflg)
- {
- cDWflg = 0;
- cHLflg = 0;
- HL_AutoStep = 0;
- HL_bRunning = 0;
- }
- else
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_TFK;
- HL_AutoStep = 4;
- }
- }
- }
- else if((HL_AutoStep == 4) && (dwTickCount >= HL_AutoDelay))
- {
- HL_TFK_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 5;
- }
- else if(HL_AutoStep == 5)
- {
- if(HL_TFK_LIMIT_IN)
- {
- HL_AutoStep = 6;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_HM;
- }
- else if(dwTickCount >= HL_AutoDelay)
- {
- HL_SetAlarmCode(HL_TFK_LIMIT_ALARM);
- }
- }
- else if((HL_AutoStep == 6) && (dwTickCount >= HL_AutoDelay))
- {
- HL_HM_VAVLE = 1;
- HL_DK_UP_VAVLE = 1;
- HL_SJ_VAVLE = 1;
- HL_YD_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 7;
- }
- else if(HL_AutoStep == 7)
- {
- if(HL_SM_LIMIT_IN && HL_XM_LIMIT_IN)
- {
- HL_AutoStep = 8;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_TFK_BACK;
- }
- else if(dwTickCount >= HL_AutoDelay)
- {
- if(!HL_SM_LIMIT_IN)
- HL_SetAlarmCode(HL_SM_LIMIT_ALARM);
- else
- HL_SetAlarmCode(HL_XM_LIMIT_ALARM);
- }
- }
- else if((HL_AutoStep == 8) && (dwTickCount >= HL_AutoDelay))
- {
- HL_AutoStep = 9;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_TFK_VAVLE = 0;
- }
- else if(HL_AutoStep == 9)
- {
- if(HL_TFK_ORIGIN_IN)
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_BB;
- HL_AutoStep = 10;
- }
- else if(dwTickCount >= HL_AutoDelay)
- HL_SetAlarmCode(HL_TFK_ORIGIN_ALARM);
- }
- else if((HL_AutoStep == 10) && (dwTickCount >= HL_AutoDelay))
- {
- HL_BB_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 12;
- }
- else if(HL_AutoStep == 12)
- {
- if(HL_BB_LIMIT_IN)
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_DK_UP;
- HL_AutoStep = 13;
- }
- else if(dwTickCount >= HL_AutoDelay)
- HL_SetAlarmCode(HL_BB_LIMIT_ALARM);
- }
- else if((HL_AutoStep == 13) && (dwTickCount >= HL_AutoDelay))
- {
- HL_DK_UP_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 14;
- }
- else if(HL_AutoStep == 14)
- {
- if(HL_DK_UP_LIMIT_IN)
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_JD;
- HL_YCX_VAVLE = 1;
- HL_YCXDelay = dwTickCount + HL_PARAM_YCX_TIME;
- HL_AutoStep = 15;
- }
- else if(dwTickCount >= HL_AutoDelay)
- HL_SetAlarmCode(HL_DK_UP_LIMIT_ALARM);
- }
- else if((HL_AutoStep == 15) && (dwTickCount >= HL_AutoDelay))
- {
- if(HL_PARAM_CCX_MODE)
- {
- if(!X_DRV)AxisMovePosAccDec(X_AXIS,HL_PARAM_CCX_SPEED,HL_PARAM_CCX_LENGTH,1,5,5);
- HL_AutoDelay = dwTickCount;
- HL_AutoStep = 16;
- }
- else
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_CCX;
- HL_JD_VAVLE = 1;
- HL_AutoStep = 16;
- }
- }
- else if((HL_AutoStep == 16) && (dwTickCount >= HL_AutoDelay) && !HL_YCX_VAVLE)
- {
- if(HL_PARAM_CCX_MODE)
- {
- if(!X_DRV)
- {
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_CheckDelay = dwTickCount + HL_PARAM_DELAY_CHECK_CCX;
- HL_AutoStep = 17;
- }
- }
- else
- {
- HL_CCX_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_CheckDelay = dwTickCount + HL_PARAM_DELAY_CHECK_CCX;
- HL_AutoStep = 17;
- }
- }
- else if((HL_AutoStep == 17) && (dwTickCount >= HL_CheckDelay))
- {
- if(HL_CCX_LIMIT_IN)
- {
- if(HL_PARAM_CCX_MODE)
- {
- HL_DK_UP_VAVLE = 0;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 18;
- }
- else
- {
- HL_DK_UP_VAVLE = 0;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_JD_BACK;
- HL_AutoStep = 50;
- }
- }
- else if(dwTickCount >= HL_AutoDelay)
- HL_SetAlarmCode(HL_CCX_LIMIT_ALARM);
- }
- else if((HL_AutoStep == 50) && (dwTickCount >= HL_AutoDelay))
- {
- HL_JD_VAVLE = 0;
- HL_AutoDelay = dwTickCount + 0;
- HL_AutoStep = 51;
- }
- else if((HL_AutoStep == 51) && (dwTickCount >= HL_AutoDelay))
- {
- if(!X_DRV)AxisMovePosAccDec(X_AXIS,HL_PARAM_LOW_SPEED,HL_PARAM_CCX_LENGTH,1,5,5);
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 18;
- }
- else if(HL_AutoStep == 18)
- {
- if(!HL_DK_UP_LIMIT_IN && !X_DRV)
- {
- HL_CCX_VAVLE = 0;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_BACK_DK_UP;
- HL_AutoStep = 19;
- }
- else if(dwTickCount >= HL_AutoDelay)
- {
- HL_SetAlarmCode(HL_DK_UP_LIMIT_ALARM);
- }
- }
- else if(HL_AutoStep == 19)
- {
- if(!HL_PARAM_CCX_TIMES)HL_YD_VAVLE = 0;
- HL_AutoDelay = dwTickCount + HL_VAVLE_ALARM_TIME;
- HL_AutoStep = 20;
- }
- else if(HL_AutoStep == 20)
- {
- if(HL_PARAM_CCX_MODE)
- {
- HL_AutoDelay = dwTickCount;
- HL_AutoStep = 25;
- }
- else
- {
- if(!HL_PARAM_CCX_TIMES)
- {
- HL_AutoDelay = dwTickCount;
- HL_AutoStep = 25;
- }
- else
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_JD;
- HL_AutoStep = 21;
- }
- }
- }
- else if((HL_AutoStep == 21) && (dwTickCount >= HL_AutoDelay))
- {
- HL_JD_VAVLE = 1;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_CCX;
- HL_AutoStep = 22;
- }
- else if((HL_AutoStep == 22) && (dwTickCount >= HL_AutoDelay))
- {
- HL_CCX_VAVLE = 1;
- HL_AutoStep = 23;
- }
- else if((HL_AutoStep == 23) && (dwTickCount >= HL_AutoDelay))
- {
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_JD_BACK;
- HL_AutoStep = 24;
- }
- else if((HL_AutoStep == 24) && (dwTickCount >= HL_AutoDelay))
- {
- HL_JD_VAVLE = 0;
- HL_AutoDelay = dwTickCount + HL_PARAM_DELAY_CCX;
- HL_AutoStep = 25;
- }
- else if((HL_AutoStep == 25) && (dwTickCount >= HL_AutoDelay))
- {
- HL_CCX_VAVLE = 0;
- HL_YD_VAVLE = 0;
- if(cZCXflg)
- {
- cZCXflg = 0;
- HL_AutoStep = 0;
- HL_bRunning = 0;
- }
- else
- {
- HL_AutoStep = 26;
- }
- }
- else if(HL_AutoStep == 26)
- {
- AddToTal(HL_TOTAL_ADDR);
- dwZipCnt++;
- if(GetTotal(HL_TOTAL_ADDR) >= HL_PARAM_SET_TOTAL)
- {
- HL_SetAlarmCode(HL_TOTAL_ALARM);
- }
- else
- {
- HL_AutoStep = 2;
- HL_AutoDelay = HL_PARAM_CYCLE_DELAY + dwTickCount;
- CalProSP(HL_PROSPEED_ADDR);
- }
- }
- }
- }
- #endif
|