1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650 |
- #include "global.h"
- #if JIA_CHENG_WEI_YE_MACHINE
- void QueDuan_AlarmProtect(void);
- void QueDuan_ManualAction(void);
- void QueDuan_AutoAction(void);
- void QueDuan_StepCheckStart(void);
- void QueDuan_XiaQue(void);
- void QueDuan_Motor(void);
- void QueDuan_YuanDianAction(void);
- void QueDuan_TuiLianAction(void);
- void QueDuan_TuiFangKuai(void);
- void QueDuan_ExtiActionX31(void);
- void QueDuan_BingLian(void);
- static unsigned long cZipCnt = 0,cTableCnt = 0,cTuiFangKuaiCnt = 0;
- static long save_limit_pos,cRealPos,dwZipper_length;
- static long dwSaveLength;
- unsigned char cCheckLianFlg = 0;
- unsigned char cCheckLianFlgEN = 0;
- unsigned char cGoLimitEn = 0;
- unsigned char cCheckLengthEn = 0;
- long TestDisplay;
- void QueDuan_ExtiActionX31(void)
- {
- cCheckLianFlg = 1;
- }
- void QD_SetAlarmCode(unsigned alarm_code)
- {
- SetAlarmCode(QD_ALARM_ADDR,alarm_code);
- bAlarmStop = 1;
- }
- void QueDuan_InitAction(void)
- {
- float length_buff,pulse_buff;
- save_limit_pos = QD_SAVE_POS;
- axis_x->speed_unit = 500;
- SetAccTime(X_AXIS,10);
- SetDecTime(X_AXIS,10);
-
- length_buff = QD_PARAM_CYCLE_LENGTH;
- pulse_buff = QD_PARAM_CYCLE_PULSE;
- XGearRatio = pulse_buff/length_buff;
-
- axis_y->speed_unit = 300;
- SetAccTime(Y_AXIS,3);
- SetDecTime(Y_AXIS,3);
-
- length_buff = QD_PARAM_TL_CYCLE_LENGTH;
- pulse_buff = QD_PARAM_TL_CYCLE_PULSE;
- YGearRatio = pulse_buff/length_buff;
-
- CalFreqTab_X_Free(15);
- QD_SZ_OUT = 1;
- }
- void QueDuan_Action(void)
- {
- QueDuan_AlarmProtect();
- QueDuan_TuiFangKuai();
- QueDuan_Motor();
- QueDuan_XiaQue();
- QueDuan_ManualAction();
- QueDuan_YuanDianAction();
- QueDuan_TuiLianAction();
- QueDuan_BingLian();
- QueDuan_AutoAction();
- QueDuan_StepCheckStart(); // 调用脚踏开关检测程序
- }
- //手动动作
- void QueDuan_ManualAction(void)
- {
- if(bRunning == 0)
- {
- if(QD_bClearTotal) //切断计数清零
- {
- QD_bClearTotal = 0;
- ClrcToTal(QD_TOTAL_ADDR);
- }
-
- if(QD_bClearNowTotal)
- {
- QD_bClearNowTotal = 0;
- QD_PARAM_NOW_CNT = 0;
- }
-
- if(QD_bXiaQie)
- {
- QD_bXiaQie = 0;
- if(QD_XiaQieStep == 0)QD_XiaQieStep = 1;
- }
-
- if(QD_bQianDianDW)
- {
- QD_bQianDianDW = 0;
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 61;
- cZipCnt = 0;
- }
- }
-
- if(QD_bTL)
- {
- if(QD_PARAM_TL_MODE)
- {
- if(!Y_DRV)AxisMovePos(Y_AXIS,QD_PARAM_TL_SPEED,QD_PARAM_TL_LENGTH);
- }
- else
- {
- QD_bTL = 0;
- QD_TL_VAVLE = ~QD_TL_VAVLE;
- }
- }
-
- if(!Y_DRV)QD_bTL = 0;
-
- if(QD_bYD)
- {
- QD_bYD = 0;
- QD_YD_VAVLE = ~QD_YD_VAVLE;
- }
-
- if(QD_bGZ)
- {
- QD_bGZ = 0;
- QD_GZ_VAVLE = ~QD_GZ_VAVLE;
- }
-
- if(QD_bJD)
- {
- QD_bJD = 0;
- QD_JD_VAVEL = ~QD_JD_VAVEL;
- }
-
- if(QD_bXM)
- {
- QD_bXM = 0;
- QD_XM_VAVLE = ~QD_XM_VAVLE;
- }
-
- if(QD_bSM)
- {
- QD_bSM = 0;
- QD_SM_VAVLE = ~QD_SM_VAVLE;
- }
-
- if(QD_bTFK)
- {
- QD_bTFK = 0;
- QD_TFK_VAVEL = ~QD_TFK_VAVEL;
- }
-
- if(QD_bTB)
- {
- QD_bTB = 0;
- QD_TABLE_VAVLE = ~QD_TABLE_VAVLE;
- }
-
- if(QD_bYBD)
- {
- QD_bYBD = 0;
- QD_YBD_VAVLE = ~QD_YBD_VAVLE;
- }
-
- if(QD_bTestCS)
- {
- QD_bTestCS = 0;
- QD_CS_OUT = 1;
- QD_CSDelay = dwTickCount + QD_PARAM_CS_TIME;
- }
-
- if(QD_bBL)
- {
- QD_bBL = 0;
- QD_BL_VAVLE = ~QD_BL_VAVLE;
- }
-
- if(QD_XiaQieStep == 0)
- {
- if(dwTickCount >= QD_CSDelay)QD_CS_OUT = 0;
- }
-
- if(QD_bYuanDianDW)
- {
- QD_bYuanDianDW = 0;
- if(QD_YuanDianStep == 0)QD_YuanDianStep = 1;
- }
-
- //电机控制
- if(QD_bGoMotor && !QD_QIAN_LIMIT_IN)
- {
- QD_SZ_OUT = 0;
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_N;
- if(!X_DRV)AxisContinueMove(X_AXIS,10,QD_DIR_N);
- }
-
- if(QD_bBackMotor && !QD_BACK_LIMIT_IN)
- {
- QD_SZ_OUT = 0;
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- if(!X_DRV)AxisContinueMove(X_AXIS,10,QD_DIR_P);
- }
-
- if(!QD_bGoMotor && !QD_bBackMotor && (QD_MotorStep == 0))
- {
- if(X_DRV)AxisDecStop(X_AXIS);
- }
-
- if(QD_QIAN_LIMIT_IN && (QD_MotorStep == 0) && !QD_bBackMotor &&(QD_AutoStep == 0))
- {
- if(X_DRV)AxisEgmStop(X_AXIS);
- }
-
- }
- }
- void QueDuan_YuanDianAction(void)
- {
- switch(QD_YuanDianStep)
- {
- case 0:break;
- case 1:
- if(QD_MotorStep == 0)QD_MotorStep = 61;
- QD_YuanDianStep = 2;
- break;
- case 2:
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 30;
- QD_YuanDianStep = 3;
- QD_JD_VAVEL = 1;
- }
- break;
- case 3:
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 0;
- QD_YuanDianStep = 0;
- }
- break;
- }
- }
- void QueDuan_AlarmProtect(void)
- {
- cRealPos = GetPos(X_AXIS);
- if(QD_PARAM_BACK_ALARM_MODE)
- { //感应后限模式
- if(!bRunning)
- {
- if(QD_BACK_LIMIT_IN_UP)
- {
- if((QD_MotorStep == 0) && X_DRV && QD_bBackMotor) //到后限不能再后退但可以点前进
- {
- QD_bBackMotor = 0;
-
- AxisDecStop(X_AXIS);
- QD_JD_VAVEL = 0;
- QD_SetAlarmCode(QD_BACK_ALARM);
-
- }
- }
- }
- else
- {
- if(QD_BACK_LIMIT_IN_UP)
- {
- AxisDecStop(X_AXIS);
-
- QD_JD_VAVEL = 0;
- QD_SetAlarmCode(QD_BACK_ALARM);
- }
- }
- }
- else
- {
-
- if(QD_QIAN_LIMIT_IN_UP) //数控后限模式
- {
- save_limit_pos = cRealPos;
- SetData32bits(200,save_limit_pos);
- }
-
- if(QD_PARAM_MAX_BACK_LENGTH < (cRealPos - save_limit_pos))
- {
- if(!bRunning)
- {
- if((QD_MotorStep == 0) && X_DRV && QD_bBackMotor) //到后限不能再后退但可以点前进
- {
- QD_bBackMotor = 0;
- AxisDecStop(X_AXIS);
- QD_JD_VAVEL = 0;
- QD_SetAlarmCode(QD_BACK_ALARM);
-
- }
- }
- else
- {
- AxisDecStop(X_AXIS);
- QD_JD_VAVEL = 0;
- QD_SetAlarmCode(QD_BACK_ALARM);
- }
- }
-
- }
-
- // if(!QD_KADAI_IN)QD_KaDaiDelay = dwTickCount + 3000;
-
- /* if(bRunning)
- {
- if(dwTickCount >= QD_KaDaiDelay)QD_SetAlarmCode(QD_KA_DAI_ALARM);
- }*/
- }
- void QueDuan_AutoAction(void)
- {
- if(bRunning)
- {
- if(dwTickCount >= QD_TBDelay)QD_TABLE_VAVLE = 0;
- switch(QD_AutoStep)
- {
- case 1:
- if(dwTickCount >= QD_AutoDelay)
- {
- QD_AutoStep = 2;
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 61; //前点定位
- }
- }
- break;
- case 2:
- if(QD_MotorStep == 0)
- {
- if(QD_PARAM_DC_MODE == 0)
- QD_MotorStep = 20; //后退到位
- else
- QD_MotorStep = 30;
- QD_AutoStep = 3;
- }
- break;
- case 3:
- if(QD_MotorStep == 0)
- {
- if(QD_XiaQieStep == 0)
- {
- QD_XiaQieStep = 1;
- QD_AutoStep = 4;
- }
- }
- break;
- case 4:
- if(QD_MACHINE_TYPE == QD_QQ_TUIFANGKUAI)
- {
- if(((QD_XiaQieStep == 0) || (QD_XiaQieStep >= 4)) && !QD_SHANG_MU_LIMIT_IN)
- {
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 40; //切完后退
- QD_MotorDelay = dwTickCount + QD_PARAM_CUT_BACK_DELAY;
- }
- QD_AutoStep = 5;
- }
- }
- else if(QD_MACHINE_TYPE == QD_NO_GL_TUIFANGKUAI)
- {
-
- if(((QD_XiaQieStep == 0) || (QD_XiaQieStep == 13)) && !QD_SHANG_MU_LIMIT_IN && !QD_XIA_MU_LIMIT_IN)
- {
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 40; //切完后退
- QD_MotorDelay = dwTickCount + QD_PARAM_CUT_BACK_DELAY;
- }
- QD_AutoStep = 5;
- }
- }
- else
- {
- if(((QD_XiaQieStep == 0) || (QD_XiaQieStep == 13)) && !QD_SHANG_MU_LIMIT_IN && !QD_XIA_MU_LIMIT_IN)
- {
- if(QD_MotorStep == 0)
- {
- QD_MotorStep = 40; //切完后退
- // QD_MotorDelay = dwTickCount + QD_PARAM_CUT_BACK_DELAY;
- }
- QD_AutoStep = 5;
- }
- }
- break;
- case 5:
- if(QD_MotorStep == 0)
- {
- cZipCnt++;
- QD_PARAM_NOW_CNT++;
- cTableCnt++;
- AddToTal(QD_TOTAL_ADDR);
- CalProSP(QD_PROSPEED_ADDR);
-
- if(cTableCnt >= QD_PARAM_TABLE_NUM)
- {
- cTableCnt = 0;
- QD_TABLE_VAVLE = 1;
- QD_TBDelay = dwTickCount + QD_PARAM_TB_TIME;
- }
-
- if((GetTotal(QD_TOTAL_ADDR) >= QD_PARAM_SET_TOTAL) || SingOneFlg)
- {
- bRunning = 0;
- QD_AutoStep = 0;
- SingOneFlg = 0;
-
- if(GetTotal(QD_TOTAL_ADDR) >= QD_PARAM_SET_TOTAL) QD_SetAlarmCode(QD_TOTAL_ALARM);
- }
- else
- {
- QD_AutoStep = 1;
-
- if(QD_PARAM_NOW_CNT >= QD_PARAM_ZHA_SHU)
- {
- QD_AutoDelay = dwTickCount + QD_PARAM_ZS_STOP_TIME + 50;
- QD_PARAM_NOW_CNT = 0;
- }
- else
- QD_AutoDelay = dwTickCount + QD_PARAM_CYCLE_DELAY;
- }
- }
- break;
- }
- }
- }
- void QueDuan_StepCheckStart(void)
- {
- // 启动
- if((START_IN_UP) || bStart || QD_bSingle)
- {
- bStart = 0;
-
- if(!bRunning && (QD_AutoStep == 0))
- {
- if(!QD_SHANG_MU_ORIGIN_IN)QD_SetAlarmCode(QD_SM_YUANWEI);
- else if(QD_XIA_MU_LIMIT_IN)QD_SetAlarmCode(QD_XM_DAOWEI);
- else if(GetAlarmCode(QD_ALARM_ADDR) != 0);
- else if(GetTotal(QD_TOTAL_ADDR) >= QD_PARAM_SET_TOTAL) QD_SetAlarmCode(QD_TOTAL_ALARM);
- else if(QD_BL_VAVLE)QD_SetAlarmCode(QD_BL_ALARM);
- else if(QD_SM_VAVLE)QD_SetAlarmCode(QD_SM_ALARM);
- else
- {
- bRunning = 1;
- QD_AutoStep = 1;
- if(QD_bSingle) SingOneFlg= 1;
- cZipCnt = 0;
- cTuiFangKuaiCnt = 0;
- if(QD_PARAM_TL_MODE)
- {
- if(QD_TuiLianStep == 0)QD_TuiLianStep = 1;
- }
- }
- }
- QD_bSingle = 0;
- }
- //停止
- if(STOP_IN_UP || bStop)
- {
- bStop = 0;
- user_datas[127] = 0;
- /* if(bRunning)
- {
- if(SingOneFlg)
- {
- bRunning = 0;
- QD_XiaQieStep = 0;
- QD_AutoStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_YuanDianStep = 0;
- QD_BinLianStep = 0;
- SingOneFlg = 0;
- QD_JD_VAVEL = 0;
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_YD_VAVLE = 0;
- QD_XHG_VAVLE = 0;
- // QD_CS_OUT = 0;
- QD_TL_VAVLE = 0;
- QD_SZ_OUT = 1;
- QD_GZ_VAVLE = 0;
- QD_YBD_VAVLE = 0;
- QD_TFK_VAVEL = 0;
- QD_TABLE_VAVLE = 0;
- QD_BL_VAVLE = 0;
- QD_AutoDelay = dwTickCount;
- QD_MotorDelay = dwTickCount;
- QD_XiaQieDelay = dwTickCount;
- QD_KaDaiDelay = dwTickCount;
- QD_CSDelay = dwTickCount;
- QD_TBDelay = dwTickCount;
- QD_TFKDelay = dwTickCount;
- QD_TLDelay = dwTickCount;
- QD_CheckDelay = dwTickCount;
-
- AxisDecStop(X_AXIS);
- if(GetAlarmCode(QD_ALARM_ADDR) != 0)SetAlarmCode(QD_ALARM_ADDR,0);
- }
- else
- {
- SingOneFlg = 1;
- }
- }
- else
- {
- bRunning = 0;
- QD_XiaQieStep = 0;
- QD_AutoStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_YuanDianStep = 0;
- QD_AutoDelay = dwTickCount;
- QD_MotorDelay = dwTickCount;
- QD_XiaQieDelay = dwTickCount;
- QD_KaDaiDelay = dwTickCount;
- QD_CSDelay = dwTickCount;
- QD_TBDelay = dwTickCount;
- QD_TFKDelay = dwTickCount;
- QD_TLDelay = dwTickCount;
- QD_CheckDelay = dwTickCount;
- SingOneFlg = 0;
- QD_JD_VAVEL = 0;
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_YD_VAVLE = 0;
- QD_TFK_VAVEL= 0;
- QD_TL_VAVLE = 0;
- QD_YBD_VAVLE = 0;
- //QD_CS_OUT = 0;
- QD_XiaQieStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_SZ_OUT = 1;
- QD_GZ_VAVLE = 0;
- QD_TABLE_VAVLE = 0;
- QD_XHG_VAVLE = 0;
- AxisDecStop(X_AXIS);
- QD_YuanDianStep = 0;
- QD_BinLianStep = 0;
- QD_BL_VAVLE = 0;
- if(GetAlarmCode(QD_ALARM_ADDR) != 0)SetAlarmCode(QD_ALARM_ADDR,0);
- }*/
-
- if(bRunning)
- {
- bRunning = 0;
- QD_XiaQieStep = 0;
- QD_AutoStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_YuanDianStep = 0;
- QD_AutoDelay = dwTickCount;
- QD_MotorDelay = dwTickCount;
- QD_XiaQieDelay = dwTickCount;
- QD_KaDaiDelay = dwTickCount;
- QD_CSDelay = dwTickCount;
- QD_TBDelay = dwTickCount;
- QD_TFKDelay = dwTickCount;
- QD_TLDelay = dwTickCount;
- QD_CheckDelay = dwTickCount;
- dwTickCount = QD_TBDelay;
- SingOneFlg = 0;
- QD_JD_VAVEL = 0;
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_YD_VAVLE = 0;
- QD_TFK_VAVEL= 0;
- QD_TL_VAVLE = 0;
- QD_YBD_VAVLE = 0;
- QD_CS_OUT = 0;
- QD_XiaQieStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- //QD_SZ_OUT = 1;
- QD_GZ_VAVLE = 0;
- QD_TABLE_VAVLE = 0;
- QD_XHG_VAVLE = 0;
- AxisDecStop(X_AXIS);
- QD_YuanDianStep = 0;
- QD_BinLianStep = 0;
- QD_BL_VAVLE = 0;
- user_datas[121] = 0;
- user_datas[122] = 0;
- if(GetAlarmCode(QD_ALARM_ADDR) != 0)SetAlarmCode(QD_ALARM_ADDR,0);
- QD_CheckLengthStep = 0;
- }
- else
- {
- bRunning = 0;
- QD_XiaQieStep = 0;
- QD_AutoStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_YuanDianStep = 0;
- QD_AutoDelay = dwTickCount;
- QD_MotorDelay = dwTickCount;
- QD_XiaQieDelay = dwTickCount;
- QD_KaDaiDelay = dwTickCount;
- QD_CSDelay = dwTickCount;
- QD_TBDelay = dwTickCount;
- QD_TFKDelay = dwTickCount;
- QD_TLDelay = dwTickCount;
- QD_CheckDelay = dwTickCount;
- dwTickCount = QD_TBDelay;
- SingOneFlg = 0;
- QD_JD_VAVEL = 0;
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_YD_VAVLE = 0;
- QD_TFK_VAVEL= 0;
- QD_TL_VAVLE = 0;
- QD_YBD_VAVLE = 0;
- QD_CS_OUT = 0;
- QD_XiaQieStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_SZ_OUT = 1;
- QD_GZ_VAVLE = 0;
- QD_TABLE_VAVLE = 0;
- QD_XHG_VAVLE = 0;
- AxisDecStop(X_AXIS);
- QD_YuanDianStep = 0;
- QD_BinLianStep = 0;
- QD_BL_VAVLE = 0;
- user_datas[121] = 0;
- user_datas[122] = 0;
- if(GetAlarmCode(QD_ALARM_ADDR) != 0)SetAlarmCode(QD_ALARM_ADDR,0);
- QD_CheckLengthStep = 0;
- }
- }
-
- if(bAlarmStop)
- {
- bAlarmStop = 0;
- QD_XiaQieStep = 0;
- QD_AutoStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_YuanDianStep = 0;
- QD_XiaQieStep = 0;
- QD_MotorStep = 0;
- QD_TuiLianStep = 0;
- QD_TuiFangKuaiStep = 0;
- QD_AutoDelay = dwTickCount;
- QD_MotorDelay = dwTickCount;
- QD_XiaQieDelay = dwTickCount;
- QD_KaDaiDelay = dwTickCount;
- QD_CSDelay = dwTickCount;
- QD_TBDelay = dwTickCount;
- QD_TFKDelay = dwTickCount;
- QD_TLDelay = dwTickCount;
- QD_CheckDelay = dwTickCount;
- SingOneFlg = 0;
- bRunning = 0;
- AxisDecStop(X_AXIS);
- dwTickCount = QD_TBDelay;
- QD_TABLE_VAVLE = 0;
- QD_CheckLengthStep = 0;
- }
-
- }
- void QueDuan_CheckLength(long zip_length)
- {
- static long start_dist,checkdelay_buff;
- switch(QD_CheckLengthStep)
- {
- case 0:break;
- case 1:
- start_dist = cRealPos;
- QD_CheckLengthStep = 2;
- dwSaveLength = 0;
- break;
- case 2:
- if(QD_GUO_LIAN_IN_UP)
- {
- QD_CheckLengthStep = 3;
- checkdelay_buff = cRealPos;
- }
- break;
- case 3:
- if((((cRealPos - checkdelay_buff) >= QD_PARAM_DELAY_CHECK) && QD_PARAM_LT_ENABLE) || (((cRealPos - checkdelay_buff) >= QD_PARAM_NO_LT_DELAY_CHECK) && (QD_PARAM_LT_ENABLE == 0)))
- {
- if(QD_GUO_LIAN_IN_UP)
- {
- dwSaveLength = cRealPos - start_dist;
- // QD_CheckLengthStep = 0;
- }
- if(QD_GUO_LIAN_IN_DW)
- {
- dwSaveLength = cRealPos - start_dist;
- // QD_CheckLengthStep = 0;
- }
- }
- break;
- }
- }
- void QueDuan_Motor_CS(void)
- {
- static long save_buff,length_buff,gou_zhen_buff,checkdelay_buff,dandao_buff,back_buff,gouzhen_buff,go_buff,go_length_buff,jz_buff;
- user_datas[124]= QD_MotorStep;
- user_datas[125]= dwSaveLength;
- user_datas[123] = length_buff;
- user_datas[127] = cRealPos - save_buff;
- // user_datas[126] = go_buff - cRealPos;
- // user_datas[121] = QD_XiaQieStep;
-
- /* if(cCheckLengthEn)
- {
- if(QD_GUO_LIAN_IN_DW)
- {
- if((cRealPos - back_buff) >= (length_buff+QD_PARAM_ERROR_LENGTH-QD_PARAM_MOTOR_DELAY_LENGTH))QD_SetAlarmCode(QD_LENGTH_LONG_ALARM);
- if((cRealPos - back_buff) <= (length_buff-QD_PARAM_ERROR_LENGTH-QD_PARAM_MOTOR_DELAY_LENGTH))QD_SetAlarmCode(QD_LENGTH_LONG_ALARM);
- cCheckLengthEn = 0;
- }
- } */
- QueDuan_CheckLength(length_buff);
- switch(QD_MotorStep)
- {
- case 0:
- break;
- case 1: // 前点定位数控模式
- if(QD_SZ_OUT)
- {
- QD_SZ_OUT = 0;
- QD_MotorDelay = dwTickCount + 50;
- }
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- if((QD_TuiLianStep == 0) && !QD_TL_VAVLE && !QD_PARAM_TL_MODE)QD_TuiLianStep = 1;
- QD_MotorStep = 2;
- break;
- case 2:
- if(dwTickCount >= QD_MotorDelay)
- {
- if(QD_QIAN_LIMIT_IN)
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_P;
- MV_Set_Acc_CPU(X_AXIS, 10);
- AxisMovePos(X_AXIS,QD_PARAM_GO_HIGH_SPEED,QD_PARAM_ON_BACK_LENGTH);
- QD_MotorDelay = dwTickCount + 1000;
- }
- QD_MotorStep = 3;
- QD_JD_VAVEL = 0;
- }
- break;
- case 3:
- if(!X_DRV && !QD_QIAN_LIMIT_IN && (dwTickCount >= QD_MotorDelay))
- {
- if(cZipCnt == 0)
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisContinueMove(X_AXIS,QD_PARAM_FIRST_SPEED,QD_DIR_P); //第一条走低速
- }
- else
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisMoveTwoPos(X_AXIS,QD_PARAM_GO_HIGH_SPEED,(length_buff - QD_PARAM_Go_LOW_SPEED_LENGTH + QD_PARAM_BACK_LENGTH +QD_PARAM_SJZ_LENGTH),QD_PARAM_GO_LOW_SPEED,0xFFFFFF,QD_DIR_P);//第二条开始走两段速
- }
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 4;
- }
- break;
- case 4:
- if(QD_QIAN_LIMIT_IN_UP)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 5;
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- else if(QD_JD_ORIGIN_IN)QD_SetAlarmCode(QD_JD_ORIGIN_ALARM);
-
- break;
- case 5:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 6;
- }
- break;
- case 6:
- if((dwTickCount >= QD_MotorDelay) && (QD_TuiLianStep == 0))
- {
- if(bRunning)
- {
- QD_JD_VAVEL = 1;
- }
- QD_MotorStep = 7;
- QD_MotorDelay = dwTickCount + 100;
- }
- break;
- case 7:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_YBD_VAVLE = 0;
- QD_TL_VAVLE = 0;
- QD_MotorStep = 0;
- }
- break;
- case 20:// 后退使用电机定长
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- QD_MotorStep = 21;
- break;
- case 21:
- if(dwTickCount >= QD_MotorDelay)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisMovePos(X_AXIS,QD_PARAM_BACK_SPEED,-QD_PARAM_ZIPPER_LENGTH);
- QD_MotorStep = 22;
- }
- break;
- case 22:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_FZ;
- QD_MotorStep = 23;
- }
- break;
- case 23:
- if(dwTickCount >= QD_MotorDelay)
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_P;
- AxisMovePos(X_AXIS,QD_PARAM_GO_LOW_SPEED,QD_PARAM_FZ_LENGTH);
- QD_MotorStep = 24;
- }
- break;
- case 24:
- if(!X_DRV)
- {
- QD_MotorStep = 0;
- QD_MotorDelay = dwTickCount;
- }
- break;
- case 30:
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- QD_MotorStep = 31;
-
- if(QD_PARAM_BL_ENABLE)QD_BinLianStep = 1;
- break;
- case 31: // 后退使用钩针定长
- if(dwTickCount >= QD_MotorDelay)
- {
- save_buff = cRealPos;
- back_buff = cRealPos;
-
- if(QD_PARAM_DEC_MODE == 0)
- {
- if(QD_PARAM_BACK_MODE)
- {
- if(cZipCnt < 2)
- {
- AxisContinueMove(X_AXIS,QD_PARAM_FIRST_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- else
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- }
- else
- {
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- }
- else
- {
- if(cZipCnt < 2)
- {
- MoveAction_Const_AccDec(X_AXIS,QD_DIR_P,QD_PARAM_FIRST_SPEED,1,10,20);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- else
- {
- gouzhen_buff = cRealPos;
- MV_Set_Acc_CPU(X_AXIS, 10);
- AxisMovePosAccDec(X_AXIS,QD_PARAM_BACK_SPEED,-length_buff,1,10,20);
- // AxisMovePos(X_AXIS,QD_PARAM_BACK_SPEED,-length_buff);
- MoveChangSpeedPos(X_AXIS, QD_PARAM_BACK_LOW_SPEED,(PosToPulse(X_AXIS,QD_PARAM_Back_LOW_SPEED_LENGTH) + MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10)));
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 33;
- QD_CheckLengthStep = 1;
- }
- }
- }
- break;
- case 32:
- if(QD_PARAM_DEC_MODE)
- {
- if(cZipCnt < 2)
- {
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep = 33;
- QD_MotorDelay = dwTickCount = + QD_PARAM_GZ_DELAY;
- QD_XMDelay = dwTickCount = + QD_PARAM_DELAY_XM;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- else
- {
- dwTickCount = QD_MotorDelay;
- QD_MotorStep = 34;
- }
- }
- else
- {
- if(QD_PARAM_BACK_MODE)
- {
- if(cZipCnt < 2)
- {
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- QD_MotorDelay = dwTickCount;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- else
- {
- if((cRealPos - back_buff) > (length_buff - (QD_PARAM_Back_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10)))))
- {
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- }
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- QD_MotorDelay = dwTickCount;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- }
- else
- {
-
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- }
- break;
- case 33:
- if((cZipCnt < 2) || (QD_PARAM_DEC_MODE == 0))
- {
- if(QD_PARAM_XM_ENABLE)
- {
- if(dwTickCount >= QD_XMDelay)QD_XM_VAVLE = 1;
- }
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_GZ_VAVLE = 1;
- if(QD_PARAM_XM_ENABLE)QD_XM_VAVLE = 1;
- QD_MotorStep = 34;
- }
- }
- else
- {
- if((cRealPos - back_buff) > (length_buff - QD_PARAM_Back_LOW_SPEED_LENGTH))
- {
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep = 34;
- }
- }
- break;
- case 34:
- if((cZipCnt < 2) || (QD_PARAM_DEC_MODE == 0))
- {
- if((((cRealPos - checkdelay_buff) >= QD_PARAM_DELAY_CHECK) && QD_PARAM_LT_ENABLE) || (((cRealPos - checkdelay_buff) >= QD_PARAM_NO_LT_DELAY_CHECK) && (QD_PARAM_LT_ENABLE == 0)))
- {
- if(QD_GUO_LIAN_IN_DW)
- {
- gou_zhen_buff = cRealPos;
- QD_MotorStep = 35;
- }
- }
- }
- else
- {
- if(QD_PARAM_XM_ENABLE)
- {
- if((cRealPos - gouzhen_buff) >= (length_buff - (QD_PARAM_DELAY_XM_LENGTH)))QD_XM_VAVLE = 1;
- }
- if(QD_PARAM_GOUZHEN_LENGTH != 0)
- {
- // if((cRealPos - gouzhen_buff) >= (length_buff - (QD_PARAM_DELAY_XM_LENGTH)))QD_XM_VAVLE = 1;
- if((cRealPos - gouzhen_buff) >= (length_buff - QD_PARAM_GOUZHEN_LENGTH))
- {
- if(QD_PARAM_XM_ENABLE) QD_XM_VAVLE = 1;
- QD_GZ_VAVLE = 1;
- QD_MotorStep = 36;
- }
- }
- else
- {
- if((cRealPos - gouzhen_buff) >= (length_buff - (QD_PARAM_DELAY_XM_LENGTH)))
- {
- if(QD_PARAM_XM_ENABLE) QD_XM_VAVLE = 1;
- QD_MotorStep = 36;
- }
- }
- }
- user_datas[121] = gouzhen_buff;
- user_datas[126] = QD_PARAM_DELAY_XM_LENGTH;
- break;
- case 35:
-
- if(QD_GUO_LIAN_IN_DW)
- {
- gou_zhen_buff = cRealPos;
- }
-
- if(QD_GUO_LIAN_IN_UP)
- {
- gou_zhen_buff = cRealPos;
- }
-
- if((cRealPos - gou_zhen_buff) >= QD_PARAM_MOTOR_DELAY_LENGTH)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_MotorStep = 36;
- }
- break;
- case 36:
- if(!X_DRV && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)))
- {
- if(QD_PARAM_GOUZHEN_LENGTH == 0)QD_GZ_VAVLE = 1;
- QD_MotorDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_MotorStep = 37;
- }
- break;
- case 37:
- // if(QD_XIA_MU_LIMIT_IN)
- {
- QD_MotorStep = 38;
- QD_MotorDelay = dwTickCount + QD_PARAM_TFK_DELAY;
- }
- // else if(dwTickCount >= QD_MotorDelay) QD_SetAlarmCode(QD_XM_DAOWEI);
- break;
- case 38:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_TFK_VAVEL = 1;
- QD_MotorStep = 39;
- }
- break;
- case 39:
- if(!X_DRV && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)))
- {
- if(cZipCnt == 1)
- {
- length_buff = cRealPos - save_buff;
- SetData32bits(1,length_buff + QD_PARAM_OFFSET_LENGTH);
- }
- if(cZipCnt == 0)
- {
- go_length_buff = cRealPos - save_buff;
- }
-
- if(QD_PARAM_DEC_MODE)
- {
- if(((dwSaveLength > (length_buff-QD_PARAM_MOTOR_DELAY_LENGTH+QD_PARAM_ERROR_LENGTH+20)) || (dwSaveLength < (length_buff-QD_PARAM_MOTOR_DELAY_LENGTH-QD_PARAM_ERROR_LENGTH-20))) && (QD_PARAM_BACK_MODE == 1) && (cZipCnt >= 2))
- QD_SetAlarmCode(QD_LENGTH_LONG_ALARM);
- else
- QD_MotorStep = 0;
- }
- else
- {
- if((((cRealPos - save_buff) > (length_buff+QD_PARAM_ERROR_LENGTH+20)) || ((cRealPos - save_buff) < (length_buff-QD_PARAM_ERROR_LENGTH-20))) && (QD_PARAM_BACK_MODE == 1) && (cZipCnt >= 2))
- QD_SetAlarmCode(QD_LENGTH_LONG_ALARM);
- else
- QD_MotorStep = 0;
- }
- }
- break;
- case 40:
- QD_MotorDelay = dwTickCount + QD_PARAM_CUT_BACK_DELAY;
- QD_MotorStep = 41;
- break;
- case 41:
- if(dwTickCount >= QD_MotorDelay)
- {
- jz_buff = cRealPos;
- if(QD_PARAM_SJZ_LENGTH == 0)
- {
- QD_JD_VAVEL = 0;
- }
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_SJ_TIME;
- QD_MotorStep = 45;
-
- }
- break;
-
- case 45: if((dwTickCount >= QD_MotorDelay) || (QD_JD_VAVEL == 1))
- {
- AxisMovePos(X_AXIS,QD_PARAM_CUT_BACK_SPEED,-(QD_PARAM_SJZ_LENGTH+QD_PARAM_BACK_LENGTH));
- QD_MotorStep = 43;
- }
- break;
- case 43:
- // 切断完成后拉电机动作
- if(dwTickCount >= QD_MotorDelay)
- {
- if(((QD_PARAM_SJZ_LENGTH) <= (cRealPos - jz_buff)))
- {
- user_datas[126] = cRealPos - jz_buff;
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- else if(!X_DRV)
- {
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- }
- break;
- case 44: // 切断完成后拉电机动作
- if(!X_DRV)
- {
- QD_MotorStep = 0;
- QD_MotorDelay = dwTickCount;
- }
-
- break;
-
- case 61: // 前点定位数控模式
- if(QD_SZ_OUT)
- {
- QD_SZ_OUT = 0;
- QD_MotorDelay = dwTickCount + 50;
- }
-
- if(QD_PARAM_TL_MODE)
- {
- }
- else
- {
- if((QD_TuiLianStep == 0) && !QD_TL_VAVLE)QD_TuiLianStep = 1;
- }
- QD_MotorStep = 62;
- break;
- case 62:
- if(dwTickCount >= QD_MotorDelay)
- {
- if(QD_QIAN_LIMIT_IN)
- {
- MV_Set_Acc_CPU(X_AXIS, 10);
-
- AxisMovePos(X_AXIS,QD_PARAM_FIRST_SPEED,-QD_PARAM_ON_BACK_LENGTH);
- QD_MotorDelay = dwTickCount + 1000;
- }
- QD_MotorStep = 63;
- QD_JD_VAVEL = 0;
- }
- break;
- case 63:
- if(!X_DRV && !QD_QIAN_LIMIT_IN && (dwTickCount >= QD_MotorDelay))
- {
- go_buff = cRealPos;
- if(cZipCnt > 0)
- {
- MoveAction_Const_Stop_AccDec(X_AXIS, QD_DIR_N,QD_PARAM_GO_HIGH_SPEED,1,10,20);
- }
- else
- {
- MoveAction_Const_Stop_AccDec(X_AXIS, QD_DIR_N,QD_PARAM_FIRST_GO_HIGHSPEED,1,10,20);
- }
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 64;
- }
- break;
- case 64:
- if(QD_PARAM_GO_MODE)
- {
- if(cZipCnt > 0)
- {
- if(((go_buff - cRealPos) > (go_length_buff - (QD_PARAM_Go_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10))) + QD_PARAM_BACK_LENGTH + QD_PARAM_SJZ_LENGTH)) || (QD_QIAN_DEC_IN_UP))
- {
-
- MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- }
- else
- {
- if(QD_QIAN_DEC_IN_UP)
- {
- MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- }
- }
- else
- {
- QD_MotorStep =65;
- }
- break;
- case 65:
- if(QD_QIAN_LIMIT_IN_UP)
- {
- if(QD_PARAM_DAO_MODE)
- {
- dandao_buff = cRealPos;
- QD_MotorStep = 70;
- }
- else
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 66;
- }
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- else if(QD_JD_ORIGIN_IN)QD_SetAlarmCode(QD_JD_ORIGIN_ALARM);
- break;
- case 70:
- if((dandao_buff - cRealPos) >= QD_PARAM_DANDAO_MODE_LENGTH)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 66;
- }
- break;
- case 66:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 67;
- }
- break;
- case 67:
- if((dwTickCount >= QD_MotorDelay) && (QD_TuiLianStep == 0) && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)) )
- {
- if(bRunning)
- {
- QD_JD_VAVEL = 1;
- }
- QD_MotorStep = 68;
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- }
- break;
- case 68:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_YD_VAVLE = 0;
- QD_MotorStep = 0;
- }
- break;
-
- }
- }
- //推方块动作
- void QueDuan_TuiFangKuai(void)
- {
-
- }
- void QueDuan_BingLian(void)
- {
- static long bl_pos_buff;
-
- switch(QD_BinLianStep)
- {
- case 0:break;
- case 1:
- bl_pos_buff = cRealPos;
- QD_BinLianStep = 2;
- break;
- case 2:
- if((cRealPos - bl_pos_buff) >= QD_PARAM_DELAY_HL_LENGTH)
- {
- QD_BL_VAVLE = 1;
- QD_BinLianStep = 3;
- }
-
- break;
- case 3:
- if(QD_SM_VAVLE)QD_BL_VAVLE = 0;
- break;
- default:;
- }
-
- }
- void QueDuan_Motor_QD(void)
- {
- static long save_buff,length_buff,gou_zhen_buff,checkdelay_buff,dandao_buff,back_buff,gouzhen_buff,go_buff,go_length_buff,jz_buff;
- user_datas[124]= QD_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] = dwSaveLength;
- if(QD_GUO_LIAN_IN_DW)user_datas[122]++;
- switch(QD_MotorStep)
- {
- case 0:
- break;
- case 1: // 前点定位数控模式
- if(QD_SZ_OUT)
- {
- QD_SZ_OUT = 0;
- QD_MotorDelay = dwTickCount + 50;
- }
- // if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- if((QD_TuiLianStep == 0) && !QD_TL_VAVLE && !QD_PARAM_TL_MODE)QD_TuiLianStep = 1;
- QD_MotorStep = 2;
- break;
- case 2:
- if(dwTickCount >= QD_MotorDelay)
- {
- if(QD_QIAN_LIMIT_IN)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_P;
- MV_Set_Acc_CPU(X_AXIS, 10);
- AxisMovePos(X_AXIS,QD_PARAM_GO_HIGH_SPEED,QD_PARAM_ON_BACK_LENGTH);
- QD_MotorDelay = dwTickCount + 1000;
- }
- QD_MotorStep = 3;
- QD_JD_VAVEL = 0;
- }
- break;
- case 3:
- if(!X_DRV && !QD_QIAN_LIMIT_IN && (dwTickCount >= QD_MotorDelay))
- {
- if(cZipCnt == 0)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisContinueMove(X_AXIS,QD_PARAM_FIRST_SPEED,QD_DIR_P); //第一条走低速
- }
- else
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisMoveTwoPos(X_AXIS,QD_PARAM_GO_HIGH_SPEED,(length_buff - QD_PARAM_Go_LOW_SPEED_LENGTH + QD_PARAM_BACK_LENGTH +QD_PARAM_SJZ_LENGTH),QD_PARAM_GO_LOW_SPEED,0xFFFFFF,QD_DIR_P);//第二条开始走两段速
- }
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 4;
- }
- break;
- case 4:
- if(QD_QIAN_LIMIT_IN_UP)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 5;
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- else if(QD_JD_ORIGIN_IN)QD_SetAlarmCode(QD_JD_ORIGIN_ALARM);
-
- break;
- case 5:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 6;
- }
- break;
- case 6:
- if((dwTickCount >= QD_MotorDelay) && (QD_TuiLianStep == 0))
- {
- if(bRunning)
- {
- QD_JD_VAVEL = 1;
- }
- QD_MotorStep = 7;
- QD_MotorDelay = dwTickCount + 100;
- }
- break;
- case 7:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_YBD_VAVLE = 0;
- QD_TL_VAVLE = 0;
- QD_MotorStep = 0;
- }
- break;
- case 20:// 后退使用电机定长
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- QD_MotorStep = 21;
- break;
- case 21:
- if(dwTickCount >= QD_MotorDelay)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_N;
- AxisMovePos(X_AXIS,QD_PARAM_BACK_SPEED,-QD_PARAM_ZIPPER_LENGTH);
- QD_MotorStep = 22;
- }
- break;
- case 22:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_FZ;
- QD_MotorStep = 23;
- }
- break;
- case 23:
- if(dwTickCount >= QD_MotorDelay)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_DIR_P;
- AxisMovePos(X_AXIS,QD_PARAM_GO_LOW_SPEED,QD_PARAM_FZ_LENGTH);
- QD_MotorStep = 24;
- }
- break;
- case 24:
- if(!X_DRV)
- {
- QD_MotorStep = 0;
- QD_MotorDelay = dwTickCount;
- }
- break;
- case 30:
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- QD_MotorStep = 31;
-
- if(QD_PARAM_BL_ENABLE)QD_BinLianStep = 1;
- break;
- case 31: // 后退使用钩针定长
- if(dwTickCount >= QD_MotorDelay)
- {
- save_buff = cRealPos;
- back_buff = cRealPos;
- SetAccTime(X_AXIS,5);
- SetDecTime(X_AXIS,5);
-
-
- if(QD_PARAM_DEC_MODE == 0)
- {
- if(QD_PARAM_BACK_MODE)
- {
- if(cZipCnt < 2)
- {
- AxisContinueMove(X_AXIS,QD_PARAM_FIRST_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- else
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- }
- else
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- }
- else
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- if(cZipCnt < 2)
- {
- QD_XHG_VAVLE = 0;
- AxisContinueMove(X_AXIS,QD_PARAM_FIRST_SPEED,QD_DIR_P);
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 32;
- }
- else
- {
- gouzhen_buff = cRealPos;
- QD_XHG_VAVLE = 1;
- //AxisMoveTwoPos(X_AXIS,QD_PARAM_BACK_SPEED,(length_buff - QD_PARAM_Back_LOW_SPEED_LENGTH),QD_PARAM_GO_LOW_SPEED,QD_PARAM_Back_LOW_SPEED_LENGTH,QD_DIR_N);
- MV_Set_Acc_CPU(X_AXIS, 10);
- AxisMovePos(X_AXIS,QD_PARAM_BACK_SPEED,-length_buff);
- MoveChangSpeedPos(X_AXIS, QD_PARAM_BACK_LOW_SPEED,(PosToPulse(X_AXIS,QD_PARAM_Back_LOW_SPEED_LENGTH) + MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10)));
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 33;
- }
-
- // AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_N);
- }
- }
- break;
- case 32:
- if(QD_PARAM_DEC_MODE)
- {
- if(cZipCnt < 2)
- {
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- QD_MotorDelay = dwTickCount;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- else
- {
- QD_MotorStep = 36;
- }
- }
- else
- {
- if(QD_PARAM_BACK_MODE)
- {
- if(cZipCnt < 2)
- {
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- QD_MotorDelay = dwTickCount;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- else
- {
- if((cRealPos - back_buff) > (length_buff - (QD_PARAM_Back_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10)))))
- {
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- }
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- QD_MotorDelay = dwTickCount;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- }
- else
- {
-
- if(QD_GUO_LIAN_IN_UP)
- {
- checkdelay_buff = cRealPos;
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- }
- }
- }
- break;
- case 33:
- if((cZipCnt < 2) || (QD_PARAM_DEC_MODE == 0))
- {
- if((((cRealPos - checkdelay_buff) >= QD_PARAM_DELAY_CHECK) && QD_PARAM_LT_ENABLE) || (((cRealPos - checkdelay_buff) >= QD_PARAM_NO_LT_DELAY_CHECK) && (QD_PARAM_LT_ENABLE == 0)))
- {
- if(QD_PARAM_GOUZHEN_LENGTH != 0)QD_GZ_VAVLE = 1;
- QD_MotorStep = 34;
- }
- }
- else
- {
- if((cRealPos - back_buff) > (length_buff - QD_PARAM_Back_LOW_SPEED_LENGTH))
- {
-
- if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- QD_MotorStep = 34;
- }
- }
- break;
- case 34:
- if((cZipCnt < 2) || (QD_PARAM_DEC_MODE == 0))
- {
- if(QD_GUO_LIAN_IN_DW)
- {
- gou_zhen_buff = cRealPos;
- QD_MotorStep = 35;
- }
- }
- else
- {
- if(QD_PARAM_GOUZHEN_LENGTH != 0)
- {
- if((cRealPos - gouzhen_buff) >= (length_buff - QD_PARAM_GOUZHEN_LENGTH))
- {
- if(QD_PARAM_GOUZHEN_LENGTH != 0)QD_GZ_VAVLE = 1;
- QD_MotorStep = 36;
- }
- }
- else
- {
- QD_MotorStep = 36;
- }
- }
- break;
- case 35:
-
- if(QD_GUO_LIAN_IN_DW)
- {
- gou_zhen_buff = cRealPos;
- }
-
- if(QD_GUO_LIAN_IN_UP)
- {
- gou_zhen_buff = cRealPos;
- }
- if((cRealPos - gou_zhen_buff) >= QD_PARAM_MOTOR_DELAY_LENGTH)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_MotorStep = 36;
- }
- break;
- case 36:
- if(!X_DRV && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)))
- {
- if(QD_PARAM_GOUZHEN_LENGTH == 0)QD_GZ_VAVLE = 1;
- if(QD_PARAM_DEC_MODE == 0)QD_GZ_VAVLE = 1;
- if(!QD_PARAM_TL_MODE)QD_YBD_VAVLE = 1;
- QD_MotorDelay = dwTickCount + QD_PARAM_TFK_DELAY;
- QD_MotorStep = 37;
- }
- break;
- case 37:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_TFK_VAVEL = 1;
- QD_MotorDelay = dwTickCount + 1000;
- QD_MotorStep = 38;
- }
- break;
- case 38:
- if(QD_GOUZHEN_IN && !X_DRV && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)))
- {
- if(QD_PARAM_TL_MODE)QD_YBD_VAVLE = 1;
-
- if(cZipCnt == 1)
- {
- length_buff = cRealPos - save_buff - QD_PARAM_OFFSET_LENGTH;
- }
- if(cZipCnt == 0)
- {
- go_length_buff = cRealPos - save_buff;
- }
- cTuiFangKuaiCnt = 0;
- QD_MotorStep = 0;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- if(cTuiFangKuaiCnt == 0)
- {
- QD_MotorStep = 100;
- QD_TFK_VAVEL = 0;
- cTuiFangKuaiCnt++;
- QD_MotorDelay = dwTickCount + 1000;
- }
- else
- QD_SetAlarmCode(QD_GZ_ALARM);
- }
- break;
- case 100:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_MotorStep = 37;
- }
- break;
- case 40:
- if(dwTickCount >= QD_MotorDelay)
- {
- jz_buff = cRealPos;
-
- if(QD_PARAM_SJZ_LENGTH == 0)
- {
- QD_JD_VAVEL = 0;
- }
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_SJ_TIME;
- QD_MotorStep = 45;
-
- }
- break;
-
- case 45: if((dwTickCount >= QD_MotorDelay) || (QD_JD_VAVEL == 1))
- {
- AxisMovePos(X_AXIS,QD_PARAM_CUT_BACK_SPEED,-(QD_PARAM_SJZ_LENGTH+QD_PARAM_BACK_LENGTH));
- QD_MotorStep = 43;
- }
- break;
- case 41:
-
- if(!X_DRV)
- {
- QD_JD_VAVEL = 0;
-
- QD_MotorDelay = dwTickCount + 20;
- QD_MotorStep = 42;
- }
- break;
- case 42:
- if(dwTickCount >= QD_MotorDelay)
- {
-
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- AxisMovePos(X_AXIS,QD_PARAM_CUT_BACK_SPEED,-(QD_PARAM_BACK_LENGTH));
- QD_MotorStep = 44;
- }
-
- break;
-
- case 43:
- // 切断完成后拉电机动作
- if(dwTickCount >= QD_MotorDelay)
- {
- if(((QD_PARAM_SJZ_LENGTH) <= (cRealPos - jz_buff)))
- {
- user_datas[126] = cRealPos - jz_buff;
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- else if(!X_DRV)
- {
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- }
- break;
- case 44: // 切断完成后拉电机动作
- if(!X_DRV)
- {
- QD_MotorStep = 0;
- QD_MotorDelay = dwTickCount;
- }
-
- break;
- case 61: // 前点定位数控模式
- if(QD_SZ_OUT)
- {
- QD_SZ_OUT = 0;
- QD_MotorDelay = dwTickCount + 50;
- }
-
-
- if(QD_PARAM_TL_MODE)
- {
- // if(QD_TuiLianStep == 0)QD_TuiLianStep = 1;
- }
- else
- {
- if((QD_TuiLianStep == 0) && !QD_TL_VAVLE)QD_TuiLianStep = 1;
- }
- QD_MotorStep = 62;
- break;
- case 62:
- if(dwTickCount >= QD_MotorDelay)
- {
- if(QD_QIAN_LIMIT_IN)
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_P;
- MV_Set_Acc_CPU(X_AXIS, 10);
- AxisMovePos(X_AXIS,QD_PARAM_FIRST_SPEED,-QD_PARAM_ON_BACK_LENGTH);
- QD_MotorDelay = dwTickCount + 1000;
- }
- QD_MotorStep = 63;
- QD_JD_VAVEL = 0;
- }
- break;
- case 63:
- if(!X_DRV && !QD_QIAN_LIMIT_IN && (dwTickCount >= QD_MotorDelay))
- {
- //if(QD_PARAM_TL_MODE)QD_JZ_DIR = QD_YDIR_N;
- go_buff = cRealPos;
- if(cZipCnt > 0)
- {
- MoveAction_Const_Stop(X_AXIS, QD_DIR_N,QD_PARAM_GO_HIGH_SPEED);//
- }
- else
- {
- MoveAction_Const_Stop(X_AXIS, QD_DIR_N,QD_PARAM_GO_LOW_SPEED);
- }
- // MoveAction_Const_Stop(X_AXIS, QD_DIR_P,QD_PARAM_GO_HIGH_SPEED);//
- // AxisContinueMove(X_AXIS,QD_PARAM_GO_HIGH_SPEED,QD_DIR_P); //第一条走低速
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep =64;
- }
- break;
- case 64:
- if(QD_PARAM_GO_MODE)
- {
- if(cZipCnt > 0)
- {
-
- if(((go_buff - cRealPos) > (go_length_buff - (QD_PARAM_Go_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_GO_HIGH_SPEED,QD_PARAM_GO_LOW_SPEED,30))) + QD_PARAM_BACK_LENGTH + QD_PARAM_SJZ_LENGTH)) || QD_QIAN_DEC_IN_UP)
- {
-
- MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- }
- else
- {
- // if(QD_QIAN_DEC_IN)
- {
- // if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);//AxisChangeSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- }
- }
- else
- {
- // if(QD_QIAN_DEC_IN)
- {
- // if(X_DRV)MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);//AxisChangeSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- }
- break;
- case 65:
- if(QD_QIAN_LIMIT_IN_UP)
- {
- if(QD_PARAM_DAO_MODE)
- {
- dandao_buff = cRealPos;
- QD_MotorStep = 70;
- }
- else
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 66;
- }
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- else if(QD_JD_ORIGIN_IN)QD_SetAlarmCode(QD_JD_ORIGIN_ALARM);
- break;
- case 70:
- if((dandao_buff - cRealPos) >= QD_PARAM_DANDAO_MODE_LENGTH)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 66;
- }
- break;
- case 66:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 67;
- }
- break;
- case 67:
- if((dwTickCount >= QD_MotorDelay) && (QD_TuiLianStep == 0) && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)) )
- {
- if(bRunning)
- {
- QD_JD_VAVEL = 1;
- }
- QD_MotorStep = 68;
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- }
- break;
- case 68:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_YBD_VAVLE = 0;
- QD_TL_VAVLE = 0;
- QD_MotorStep = 0;
- }
- break;
-
- }
- }
- //不带过链感应长度输入电机长度
- void QueDuan_Motor_NoGL(void)
- {
- static long save_buff,length_buff,gou_zhen_buff,checkdelay_buff,dandao_buff,back_buff,gouzhen_buff,go_buff,go_length_buff,jz_buff;
- user_datas[124]= QD_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] = QD_PARAM_GOUZHEN_LENGTH;
- if(QD_GUO_LIAN_IN_DW)user_datas[122]++;
- switch(QD_MotorStep)
- {
- case 30:
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- QD_MotorStep = 31;
-
- if(QD_PARAM_BL_ENABLE)QD_BinLianStep = 1;
- break;
- case 31:
- if(dwTickCount >= QD_MotorDelay)
- {
- back_buff = cRealPos;
- gou_zhen_buff = cRealPos;
- save_buff = cRealPos;
- // AxisContinueMove(X_AXIS,QD_PARAM_BACK_SPEED,QD_DIR_P);
- MoveAction_Const_Back(X_AXIS,QD_DIR_P,QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,PosToPulse(X_AXIS,((QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH) - (QD_PARAM_Back_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,30))))));
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep = 33;
- }
- break;
- case 32:
- if(((cRealPos - gou_zhen_buff) > ((QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH) - QD_PARAM_GOUZHEN_LENGTH)) && !QD_GZ_VAVLE)
- {
- save_buff = cRealPos;
- QD_GZ_VAVLE = 1;
- }
- if((cRealPos - back_buff) > ((QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH) - (QD_PARAM_Back_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_BACK_SPEED,QD_PARAM_BACK_LOW_SPEED,10)))))
- {
- if(X_DRV)
- {
- MoveChangSpeed(X_AXIS,QD_PARAM_BACK_LOW_SPEED);
- }
-
- QD_MotorStep = 33;
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_GZ_ALARM);
- }
- break;
- case 33:
- if(((cRealPos - gou_zhen_buff) > ((QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH) - QD_PARAM_GOUZHEN_LENGTH)) && !QD_GZ_VAVLE)
- {
- QD_GZ_VAVLE = 1;
- }
-
-
- if(QD_GOUZHEN_IN)
- {
- // AxisEgmStop(X_AXIS);
- QD_YD_VAVLE = 1;
- QD_MotorDelay = dwTickCount + 5;
- QD_MotorStep = 34;
- }
- else if(((cRealPos - save_buff) >= (QD_PARAM_ERROR_LENGTH + QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH)) && QD_GZ_VAVLE)
- {
- QD_SetAlarmCode(QD_LENGTH_LONG_ALARM);
- }
- else if(dwTickCount >= QD_MotorDelay)
- {
- QD_SetAlarmCode(QD_GZ_ALARM);
- }
- break;
- case 34:
- if(!X_DRV && (dwTickCount >= QD_MotorDelay))
- {
- AxisMovePos(X_AXIS,QD_PARAM_BACK_LOW_SPEED,QD_PARAM_FZ_LENGTH);
- QD_MotorStep = 35;
- }
- break;
- case 35:
- if(!X_DRV)
- {
- QD_MotorStep = 36;
- }
- break;
- case 36:
- QD_MotorStep = 0;
- break;
- case 40:
- if(dwTickCount >= QD_MotorDelay)
- {
- jz_buff = cRealPos;
-
- if(QD_PARAM_SJZ_LENGTH == 0)
- {
- QD_JD_VAVEL = 0;
- }
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_SJ_TIME;
- QD_MotorStep = 45;
-
- }
- break;
-
- case 45: if((dwTickCount >= QD_MotorDelay) || (QD_JD_VAVEL == 1))
- {
- AxisMovePos(X_AXIS,QD_PARAM_CUT_BACK_SPEED,-(QD_PARAM_SJZ_LENGTH+QD_PARAM_BACK_LENGTH));
- QD_MotorStep = 43;
- }
- break;
- case 43:
- // 切断完成后拉电机动作
- if(dwTickCount >= QD_MotorDelay)
- {
- if(((QD_PARAM_SJZ_LENGTH) <= (cRealPos - jz_buff)))
- {
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- else if(!X_DRV)
- {
- QD_JD_VAVEL = 0;
- QD_MotorStep = 44;
- }
- }
- break;
- case 44: // 切断完成后拉电机动作
- if(!X_DRV)
- {
- QD_MotorStep = 0;
- QD_MotorDelay = dwTickCount;
- }
-
- break;
- case 61: // 前点定位数控模式
- if(QD_SZ_OUT)
- {
- QD_SZ_OUT = 0;
- QD_MotorDelay = dwTickCount + 50;
- }
-
- if(!QD_TL_VAVLE)
- {
- if(!QD_SHANG_MU_LIMIT_IN && (QD_TuiLianStep == 0))
- {
- QD_TuiLianStep = 1;
- QD_MotorStep = 62;
- }
- }
- else
- QD_MotorStep = 62;
- break;
- case 62:
- if(dwTickCount >= QD_MotorDelay)
- {
- if(QD_QIAN_LIMIT_IN)
- {
- AxisMovePos(X_AXIS,QD_PARAM_FIRST_SPEED,-QD_PARAM_ON_BACK_LENGTH);
- QD_MotorDelay = dwTickCount + 1000;
- }
- QD_MotorStep = 63;
- QD_JD_VAVEL = 0;
- }
- break;
- case 63:
- if(!X_DRV && !QD_QIAN_LIMIT_IN && (dwTickCount >= QD_MotorDelay) && !QD_SHANG_MU_LIMIT_IN)
- {
- go_buff = cRealPos;
- if(cZipCnt > 0)
- {
- MoveAction_Const_Stop(X_AXIS, QD_DIR_N,QD_PARAM_GO_HIGH_SPEED);//
- }
- else
- {
- MoveAction_Const_Stop(X_AXIS, QD_DIR_N,QD_PARAM_GO_LOW_SPEED);
- }
-
- QD_MotorDelay = dwTickCount + MOTOR_ALARM_TIME;
- QD_MotorStep =64;
- }
- break;
- case 64:
- if(((go_buff - cRealPos) > ((QD_PARAM_ZIPPER_LENGTH - QD_PARAM_TC_LENGTH - QD_PARAM_FZ_LENGTH) - (QD_PARAM_Go_LOW_SPEED_LENGTH + PulseToPos(X_AXIS,MV_Cal_Dec_pulse(QD_PARAM_GO_HIGH_SPEED,QD_PARAM_GO_LOW_SPEED,30))) + QD_PARAM_BACK_LENGTH + QD_PARAM_SJZ_LENGTH)) || QD_QIAN_DEC_IN_UP)
- {
- MoveChangSpeed(X_AXIS,QD_PARAM_GO_LOW_SPEED);
- QD_MotorStep =65;
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- break;
- case 65:
- if(QD_QIAN_LIMIT_IN_UP)
- {
- AxisEgmStop(X_AXIS);
- QD_MotorStep = 66;
- }
- else if(dwTickCount >= QD_MotorDelay)QD_SetAlarmCode(QD_NO_ZIPPER_ALARM);
- else if(QD_JD_ORIGIN_IN)QD_SetAlarmCode(QD_JD_ORIGIN_ALARM);
- break;
- case 66:
- if(!X_DRV)
- {
- QD_MotorDelay = dwTickCount;
- QD_MotorStep = 67;
- }
- break;
- case 67:
- if((dwTickCount >= QD_MotorDelay) && (QD_TuiLianStep == 0) && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)) )
- {
- if(bRunning)
- {
- QD_JD_VAVEL = 1;
- }
- QD_MotorStep = 68;
- QD_MotorDelay = dwTickCount + QD_PARAM_DELAY_BACK;
- }
- break;
- case 68:
- if(dwTickCount >= QD_MotorDelay)
- {
- QD_YD_VAVLE = 0;
- QD_TL_VAVLE = 0;
- QD_MotorStep = 0;
- }
- break;
-
- }
- }
- //电机动作
- void QueDuan_Motor(void) //
- {
- switch(QD_MACHINE_TYPE)
- {
- case QD_CS_TUIFANGKUAI:
- {
- QueDuan_Motor_CS();
- }break;
- case QD_NO_CS_TUIFANGKUAI: QueDuan_Motor_CS();break;
- case QD_QQ_TUIFANGKUAI: QueDuan_Motor_QD();break;
- case QD_NO_GL_TUIFANGKUAI:QueDuan_Motor_NoGL();break;
- default:;
- }
- }
- //超声方式下切
- void QueDuan_XiaQue_CS(void)
- {
- switch(QD_XiaQieStep)
- {
- case 0:
- break;
- case 1:
- if(bRunning)
- {
- QD_XiaQieStep = 6;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME;
- }
- else
- QD_XiaQieStep = 2;
- break;
- case 2:
- if(QD_PARAM_XM_ENABLE) QD_XM_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_XiaQieStep = 3;
- break;
- case 3:
- if(QD_PARAM_XM_ENABLE)
- {
- if(QD_XIA_MU_LIMIT_IN)
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_GZ_DELAY;
- QD_XiaQieStep = 4;
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_XM_DAOWEI);
- }
- }
- else
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_GZ_DELAY;
- QD_XiaQieStep = 4;
- }
- break;
- case 4:
- QD_GZ_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_TFK_DELAY;
- QD_XiaQieStep = 5;
-
- break;
- case 5:
- QD_TFK_VAVEL = 1;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_XiaQieStep = 6;
- break;
- case 6:
- if(QD_PARAM_XM_ENABLE)
- {
- if(QD_XIA_MU_LIMIT_IN)
- {
- QD_XiaQieStep = 7;
- QD_XiaQieDelay = dwTickCount + 1000;
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_XM_DAOWEI);
- }
- }
- else
- {
- QD_XiaQieStep = 7;
- QD_XiaQieDelay = dwTickCount + 1000;
- }
- break;
- case 7:
- if(QD_GOUZHEN_IN)
- {
- QD_YD_VAVLE = 1;
- cTuiFangKuaiCnt = 0;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CUT_DELAY;
- QD_XiaQieStep = 8;
- }
- else if((dwTickCount >= QD_XiaQieDelay))
- {
- if(cTuiFangKuaiCnt == 0)
- {
- QD_TFK_VAVEL = 0;
- cTuiFangKuaiCnt++;
- QD_XiaQieDelay = dwTickCount + 1000;
- QD_XiaQieStep = 100;
- }
- else
- QD_SetAlarmCode(QD_GZ_ALARM);
- }
- break;
- case 100:
- if((dwTickCount >= QD_XiaQieDelay))
- {
- QD_XiaQieStep = 5;
- }
- break;
- case 8:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_XM_VAVLE = 1;
- QD_SM_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_XiaQieStep = 9;
- }
- break;
- case 9:
- if(QD_SHANG_MU_LIMIT_IN && QD_XIA_MU_LIMIT_IN && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)) )
- {
- if(QD_MACHINE_TYPE == QD_NO_CS_TUIFANGKUAI)
- {
- QD_XiaQieDelay = QD_PARAM_DELAY_CS; //
- QD_XiaQieStep = 12;
- }
- else
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_DELAY_CS; //
- QD_XiaQieStep = 10;
- }
- }
- else if(dwTickCount >= QD_XiaQieDelay)QD_SetAlarmCode(QD_SM_DAOWEI);
- break;
- case 10:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- if(QD_PARAM_CS_ENABLE)QD_CS_OUT = 1;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CS_TIME; //
- QD_XiaQieStep = 11;
- }
- break;
- case 11:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_CS_OUT = 0;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CS_COLD_TIME; //
- QD_XiaQieStep = 12;
- }
- break;
- case 12:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_TFK_VAVEL = 0;
- QD_GZ_VAVLE = 0;
- if(!bRunning)QD_JD_VAVEL = 0;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME;
- QD_XiaQieStep = 13;
- }//
- break;
- case 13:
- if(QD_SHANG_MU_ORIGIN_IN && !QD_XIA_MU_LIMIT_IN)
- {
- QD_XiaQieStep = 0;
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_SM_YUANWEI);
- }
- break;
- }
- }
- void QueDuan_TuiLianNormal(void)
- {
- switch(QD_TuiLianStep)
- {
- case 0:
- break;
- case 1:
- QD_TuiLianStep = 2;
- break;
- case 2:
- QD_YBD_VAVLE = 1;
- QD_TLDelay = dwTickCount + QD_PARAM_YD_DELAY;
- QD_TuiLianStep = 3;
- break;
- case 3:
- if(dwTickCount >= QD_TLDelay)
- {
- if(QD_PARAM_TL_MODE)
- {
- QD_TuiLianStep = 10;
- }
- else
- {
- QD_TL_VAVLE = 1;
- if(!bRunning)QD_TFK_VAVEL = 0;
- QD_TLDelay = dwTickCount + QD_PARAM_TL_DELAY;
- QD_TuiLianStep = 4;
- }
- }
- break;
- case 4:
- if(dwTickCount >= QD_TLDelay)
- {
- // QD_TL_VAVLE = 0;
- QD_TuiLianStep = 0;
- }
- break;
- case 10:
- if(bRunning && QD_PARAM_TL_MODE)AxisMovePos(Y_AXIS,QD_PARAM_TL_SPEED,QD_PARAM_TL_LENGTH);
- QD_TuiLianStep = 11;
- break;
- case 11:
- if(!Y_DRV)
- {
- {
- QD_TuiLianStep = 0;
- }
- }
- break;
- }
- }
- void QueDuan_TuiLianNoGL(void)
- {
- switch(QD_TuiLianStep)
- {
- case 0:
- break;
- case 1:
- QD_TuiLianStep = 2;
- break;
- case 2:
- if(!QD_YD_VAVLE)QD_TLDelay = dwTickCount + QD_PARAM_YD_DELAY;
- QD_YD_VAVLE = 1;
- QD_TuiLianStep = 3;
- break;
- case 3:
- if(dwTickCount >= QD_TLDelay)
- {
- QD_TL_VAVLE = 1;
- QD_TLDelay = dwTickCount + QD_PARAM_TL_DELAY;
- QD_TuiLianStep = 4;
- }
- break;
- case 4:
- if(dwTickCount >= QD_TLDelay)
- {
- QD_TuiLianStep = 0;
- }
- break;
- }
- }
- void QueDuan_TuiLianAction(void)
- {
- switch(QD_MACHINE_TYPE)
- {
- case QD_NO_GL_TUIFANGKUAI: QueDuan_TuiLianNoGL();break;
- default:QueDuan_TuiLianNormal();
- }
- }
- //气动推方块方式下切
- void QueDuan_XiaQue_QD(void)
- {
- switch(QD_XiaQieStep)
- {
- case 0:
- break;
- case 1:
- if(!bRunning)
- {
- QD_XiaQieDelay = dwTickCount + 50;
- QD_GZ_VAVLE = 1;
- QD_XiaQieStep = 20;
- }
- else
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CUT_DELAY;
- QD_XiaQieStep = 2;
- }
- break;
- case 20:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_XiaQieDelay = dwTickCount + 1000;
- QD_YBD_VAVLE = 1;
- QD_TFK_VAVEL = 1;
- QD_XiaQieStep = 21;
- }
- break;
- case 21:
- if(QD_GOUZHEN_IN)
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CUT_DELAY;
- cTuiFangKuaiCnt = 0;
- QD_XiaQieStep = 2;
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_GZ_ALARM);
- }
- break;
- case 22:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_XiaQieStep = 20;
- }
- break;
- case 2:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SM_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME; //
- QD_XiaQieStep = 3;
- }
- break;
- case 3:
- if(QD_SHANG_MU_LIMIT_IN && ((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0)) )
- {
- QD_XiaQieStep = 4;
- QD_XiaQieDelay = dwTickCount + 100;
- }
- else if(dwTickCount >= QD_XiaQieDelay)QD_SetAlarmCode(QD_SM_DAOWEI);
- break;
- case 4:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SM_VAVLE = 0;
- if(bRunning)QD_TFK_VAVEL = 0;
- QD_GZ_VAVLE = 0;
-
- if(!QD_PARAM_TL_MODE)
- {
- if(QD_TuiLianStep == 0)QD_TuiLianStep = 1;
- }
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME; //
- QD_XiaQieStep = 5;
- }
- break;
- case 5:
- if(QD_SHANG_MU_ORIGIN_IN && (QD_TuiLianStep == 0))
- {
- if(QD_PARAM_TL_MODE)
- {
- if(QD_TuiLianStep == 0)QD_TuiLianStep = 1;
- }
- QD_XiaQieStep = 0;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_TL_DELAY;
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_SM_YUANWEI);
- }
- break;
- }
- }
- void QueDuan_XiaQue_NO_GL(void)
- {
- switch(QD_XiaQieStep)
- {
- case 0:
- break;
- case 1:
- QD_YD_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CUT_DELAY;
- QD_XiaQieStep = 2;
- break;
- case 2:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_XiaQieStep = 3;
- }
- break;
- case 3:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- if((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0))
- {
- QD_SM_VAVLE = 1;
- QD_XM_VAVLE = 1;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME; //
- QD_XiaQieStep = 4;
- }
- }
- break;
- case 4:
- if(QD_SHANG_MU_LIMIT_IN && QD_XIA_MU_LIMIT_IN)
- {
- QD_XiaQieStep = 5;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_DELAYBACK_SM; //
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- if(!QD_SHANG_MU_LIMIT_IN)
- QD_SetAlarmCode(QD_SM_DAOWEI);
- else
- QD_SetAlarmCode(QD_XM_DAOWEI);
- }
- break;
- case 5:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- if((QD_PARAM_TIAOSHI_MODE && QD_bTS) || (QD_PARAM_TIAOSHI_MODE == 0))
- {
- QD_XiaQieDelay = dwTickCount + QD_PARAM_DELAY_CS; //
- QD_XiaQieStep = 6;
- }
- }
- break;
- case 6:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- if(QD_PARAM_CS_ENABLE)QD_CS_OUT = 1;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CS_TIME; //
- QD_XiaQieStep = 7;
- }
- break;
- case 7:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_CS_OUT = 0;
- QD_XiaQieDelay = dwTickCount + QD_PARAM_CS_COLD_TIME; //
- QD_XiaQieStep = 8;
- }
- break;
- case 8:
- if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_GZ_VAVLE = 0;
- QD_SM_VAVLE = 0;
- QD_XM_VAVLE = 0;
- QD_XiaQieDelay = dwTickCount + VAVLE_ALARM_TIME; //
- QD_XiaQieStep = 9;
- }
- break;
- case 9:
- if(QD_SHANG_MU_ORIGIN_IN && !QD_SHANG_MU_LIMIT_IN && !QD_XIA_MU_LIMIT_IN)
- {
- if(QD_TuiLianStep == 0)QD_TuiLianStep = 1;
- if(!bRunning)QD_JD_VAVEL = 0;
- QD_XiaQieStep = 0;
-
- }
- else if(dwTickCount >= QD_XiaQieDelay)
- {
- QD_SetAlarmCode(QD_SM_YUANWEI);
- }
-
- break;
- }
- }
- //切断动作
- void QueDuan_XiaQue(void)
- {
- switch(QD_MACHINE_TYPE)
- {
- case QD_CS_TUIFANGKUAI:QueDuan_XiaQue_CS();break;
- case QD_NO_CS_TUIFANGKUAI:QueDuan_XiaQue_CS();break;
- case QD_QQ_TUIFANGKUAI:QueDuan_XiaQue_QD();break;
- case QD_NO_GL_TUIFANGKUAI:QueDuan_XiaQue_NO_GL();break;
- default:;
- }
- }
- #endif
|