123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171 |
- #include "global.h"
- #if YU_WEN_XUAN_MACHINE == 1
- void GL_CTHL_SetAlarmCode(unsigned short alarm_code,unsigned short cStopFlag);
- void GL_CTHL_ManualAction(void);
- void GL_CTHL_AutoStepAction(void);
- void GL_CTHL_TableAction(void);
- void GL_CTHL_TD_Motor(void);
- void GL_CTHL_CL_Motor(void);
- void GL_CTHL_CheckStart(void);
- void GL_CTHL_TLiao_Step(void); //推料(推拉头)
- void GL_CTHL_AlarmProtect(void);
- void GL_CTHL_ZLT_Step(void);
- void GL_CTHL_ZhenDongAction(void);
- void GL_CTHL_bFKCXTDDWStep(void);
- void GL_CTHL_bCXCRStep(void);
- void GL_CTHL_bCLFirstStep(void);
- void GL_CTHL_HeMo(void);
- void ExtiAcitionX02_CTHeLian_OneMotor(void)
- {
- if(bCheckEN_FLG)
- {
- bCheckEN_FLG = 0;
- GL_CTHL_CheckInX02PosBuff = GetPos(X_AXIS);
- }
- }
- //故障报警
- void GL_CTHL_SetAlarmCode(unsigned short alarm_code,unsigned short cStopFlag)
- {
- SetAlarmCode(GL_CTHL_ALARM_ADDR,alarm_code);
- // bAlarmStop = 0;
- // if(cStopFlag)
- if(!cWULATOUCnt)
- {
- bAlarmStop = 1;
- }
- else
- {
- cWULATOUCnt=0;
- }
- }
- //初始化动作
- void GL_CTHL_InitAction(void)
- {
- float buff_pulse,buff_dist;
-
- buff_pulse = GL_CTHL_PARAM_CYCLE_PULSE;
- buff_dist = GL_CTHL_PARAM_CYCLE_LENGTH;
-
- XGearRatio = buff_pulse/buff_dist;
-
- buff_pulse = GL_CTHL_PARAM_YCYCLE_PULSE;
- buff_dist = GL_CTHL_PARAM_YCYCLE_LENGTH;
- YGearRatio = buff_pulse/buff_dist;
-
- GL_CTHL_bZDP= 1;
-
- bYFirstDingWeiFlg = 1;
- user_datas[121] = 0;
- user_datas[122] = 0;
- user_datas[123] = 0;
-
- SetEnReverse(X_AXIS, 0);
-
- if(GL_CTHL_PARAM_Y_ENSelect == 1)
- SetEnReverse(Y_AXIS, 0);
- else
- SetEnReverse(Y_AXIS, 1);
-
- SetEnReverse(Z_AXIS, 0);
-
- SetDirReverse(X_AXIS, 0);
- SetDirReverse(Y_AXIS, 0);
- SetDirReverse(Z_AXIS, 0);
-
- SetEn(X_AXIS, MOTOR_DISEN);
- SetEn(Y_AXIS, MOTOR_DISEN);
- SetEn(Z_AXIS, MOTOR_DISEN);
-
- SetAlarmCode(GL_CTHL_ALARM_ADDR,0); //警告要清除
-
- GL_CTHL_bSFBBAOJIN_Delay = dwTickCount + 2000;
-
- GL_CTHL_X_EN_FLG=0;
- GL_CTHL_Y_EN_FLG=0;
- }
- void GL_CTHL_Action(void)
- {
- // user_datas[121] = GL_CTHL_ZhuangLiaoStep;
- // user_datas[122] =GL_CTHL_bXCBackOK;
- // user_datas[123] = GL_CTHL_X_CXPosBuff;
- dwXRealPos = GetPos(X_AXIS);
- dwYRealPos = GetPos(Y_AXIS);
- dwZRealPos = GetPos(Z_AXIS);
- user_datas[124] = dwXRealPos;
- user_datas[125] = GL_CTHL_LianLengthCheck;//GL_CTHL_RunStepSave;//dwYRealPos;
-
- user_datas[126] = dwYRealPos;//GL_CTHL_CL_MotorStep;
- user_datas[127] = GL_CTHL_TLiaoStep;//GL_CTHL_TD_MotorStep;
- user_datas[128] =GL_CTHL_ZhuangLiaoStep;//GL_CTHL_AutoStep;
-
- GL_CTHL_ZhenDongAction();
- GL_CTHL_AlarmProtect();
- GL_CTHL_CheckStart();
- GL_CTHL_ZLT_Step();
- GL_CTHL_TLiao_Step();
- GL_CTHL_TD_Motor();
- GL_CTHL_CL_Motor();
- GL_CTHL_bFKCXTDDWStep();
- GL_CTHL_bCXCRStep();
- GL_CTHL_bCLFirstStep();
- GL_CTHL_HeMo();
- GL_CTHL_ManualAction();
- GL_CTHL_AutoStepAction();
-
-
- }
- void GL_CTHL_AlarmProtect(void)
- {
-
-
- }
- //自动动作
- void GL_CTHL_AutoStepAction(void)
- {
- if(bRunning && !bAlarmStop)
- {
- switch(GL_CTHL_AutoStep)
- {
- case 1:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- if(!GL_CTHL_XKSC_Limit_IN)
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- // GL_CTHL_FKJD_VAVLE = 1; //方块夹带气缸输出
-
- GL_CTHL_FKGD_VAVLE = 0; //方块固定关
- //if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
- //GL_CTHL_CXSX_VAVLE = 1; //插销上下
- //else
- //GL_CTHL_CXSX_VAVLE = 0; //插销顶出
- // GL_CTHL_XKDW_VAVLE = 1;
- GL_CTHL_AutoStep = 2;
- if(GL_CTHL_HLJJ_VAVLE)
- bCL_EN_FLG = 1;
- if(GL_CTHL_ZhuangLiaoStep == 0)
- {
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_TryCnt = 0;
- }
- }
- break;
- case 2:
- if((!GL_CTHL_XKTD_Origin_IN && GL_CTHL_XKTD_VAVLE) ||
- (!GL_CTHL_XKTD_VAVLE&& GL_CTHL_XKTD_Origin_IN)) //斜口推带原位离开
- {
- GL_CTHL_AutoStep = 3;
- if(GL_CTHL_cZipCnt== 0)
- {
- GL_CTHL_AutoDelay = dwTickCount + 180;
- }
- else
- GL_CTHL_AutoDelay = dwTickCount;
-
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 3://斜口定位
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_AutoStep = 4;
- GL_CTHL_XKDW_VAVLE = 1;
- if(GL_CTHL_cZipCnt== 0)
- GL_CTHL_AutoDelay = dwTickCount + 80;
- else
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_XKDW_TD_DELAY;
- }
- }
- break;
- case 4:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- if(!GL_CTHL_XKSC_Limit_IN)
- {
- // AxisContinueMoveAcc(X_AXIS,1000,DIR_P,800,600,10,10);//拖带电机
- SetPos(X_AXIS, 0); //启动位置设为0点
- dwXRealPos = 0;
-
- //AxisMovePosAccDecNotStop(X_AXIS,GL_CTHL_PARAM_XKDW_Speed,250,GL_CTHL_PARAM_XKDW_Speed,GL_CTHL_PARAM_XKDW_Speed,10,10,0);
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_XKDW_Speed,DIR_P,GL_CTHL_PARAM_XKDW_Speed/2,GL_CTHL_PARAM_XKDW_Speed/2,10,10);//拖带电机
- GL_CTHL_bDinweiOK = 0;
- }
-
- GL_CTHL_AutoStep = 5;
- GL_CTHL_XSavePosBuff = dwXRealPos;
- }
-
-
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 5:
- if((dwXRealPos >= GL_CTHL_PARAM_WLCDSHEZHI_LENTH) && GL_CTHL_PARAM_WLCDSHEZHI_LENTH)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning);
- //无拉链自动停机
- }
- if(dwXRealPos > GL_CTHL_LianLengthAutoCheck+2000 && GL_CTHL_LianLengthAutoCheck && GL_CTHL_cZipCnt>0)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning);
- //无拉链自动停机
- }
- if(dwXRealPos>= 190)
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带气缸关
- if((dwXRealPos >= 280) && bCL_EN_FLG)
- GL_CTHL_HLJJ_VAVLE = 1; //Y20 合链夹具电磁阀输出后,电机穿入
- if(GL_CTHL_XKSC_Limit_IN) //方块上止到位
- {
- if(bCL_EN_FLG)
- GL_CTHL_HLJJ_VAVLE = 1; //Y20 合链夹具电磁阀输出后,电机穿入
- //AxisEgmStop(X_AXIS);
- GL_CTHL_GDXM_VAVLE = 1; //固定斜码
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带气缸关
- GL_CTHL_bDinweiOK = 1;
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
- {
- // if(((GL_CTHL_bTiaoShiMode) && (!GL_CTHL_bTiaoShiStep)))
- // {
- // AxisEgmStop(X_AXIS);
- // }
- // else
- if(GL_CTHL_PARAM_SCDW_LENTH==0)
- {
- AxisEgmStop(X_AXIS);
- }
- else
- {
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_XKDW_Speed,GL_CTHL_PARAM_SCDW_LENTH,GL_CTHL_PARAM_XKDW_Speed,GL_CTHL_PARAM_XKDW_Speed,6,2,0); //
- }
- }
- else ////尼龙不用多走
- {
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_XKDW_Speed,-25,GL_CTHL_PARAM_XKDW_Speed,GL_CTHL_PARAM_XKDW_Speed,6,2,0);
- }
- //调试模式
- // if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
-
- GL_CTHL_AutoStep = 6;
- //GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸关闭
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_bLTCHECK_Delay = dwTickCount + 20;
- //电机穿入可以启动
- bCL_OK_FLG = 1; //不用穿合链的话认为已经完成
- if(bCL_EN_FLG)
- {
- bCL_OK_FLG = 0;
- GL_CTHL_HLJJ_VAVLE = 1; //Y20 合链夹具电磁阀输出后,电机穿入
-
- GL_CTHL_CL_MotorStep = 1;
- GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_HLJJ_CL_DELAY;
- }
- }
- }
- else if(dwXRealPos >= (GL_CTHL_XSavePosBuff + 850)) //750
- {
- AxisEgmStop(X_AXIS);
- GL_CTHL_SetAlarmCode(GL_CTHL_FKCXDW_ALARM,bRunning); //方块插销定位异常警告
-
- }
-
- break;
- case 6:
- // if(GL_CTHL_XKTD_Origin_IN) //斜口推带回到原位
- // {
-
- if(bZhuangLiaoOkFlg && (GL_CTHL_ZhuangLiaoStep == 0))
- {
- if(dwTickCount >= GL_CTHL_bLTCHECK_Delay)
- {
- //单一标志
- if(bSingOneFlg)
- {
- //次数到停止
- if(bSingOneCnt==0)
- {
- GL_CTHL_AutoStep = 0;
- bRunning = 0;
- }
- }
- if(!bSingOneFlg || (bSingOneFlg && bSingOneCnt))
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- if(!GL_CTHL_LTou_Check)
- {
- // GL_CTHL_CTXMSS_VAVLE = 1; //穿头下模上升
- if(!GL_CTHL_CTXMSS_VAVLE)
- GL_CTHL_HeMoStep = 1; //下模的上升和下降电磁阀要配合
- GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸关闭
- GL_CTHL_AutoStep = 7;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- if(!GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 1; //插销上下
-
- //单一标志有效,次数减去1
- if(bSingOneFlg)
- {
- if(bSingOneCnt>0)
- bSingOneCnt--;
- }
- }
- else
- {
- cWULATOUCnt=1;
- GL_CTHL_SetAlarmCode(GL_CTHL_ZLT_ALARM,bRunning); // 没有拉头
- }
- }
- }
- }
- }
- // }
- // else if(dwTickCount >= GL_CTHL_AutoDelay)
- // {
- // GL_CTHL_SetAlarmCode(GL_CTHL_XKTD_Origin_ALARM,bRunning); //斜口推带回到异常
- // }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 7:
- if(!GL_CTHL_CTM_Origin_IN)
- {
- GL_CTHL_JLTou_VAVLE = 0; //接拉头
- }
- if(GL_CTHL_CTM_Limit_IN)
- {
- GL_CTHL_JLTou_VAVLE = 0;
- GL_CTHL_AutoStep = 8;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_DXK_DELAY;
-
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1) || (GL_CTHL_PARAM_QianMaSelect == 1)) //尼龙的顶斜口不能输出
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- }
- else if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Limit_ALARM,bRunning); //穿头下模上升异常
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 8:
- if(dwTickCount >= GL_CTHL_AutoDelay) //延时顶斜口
- {
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1) || (GL_CTHL_PARAM_QianMaSelect == 1)) //尼龙的顶斜口不能输出
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0) && (GL_CTHL_PARAM_QianMaSelect == 0))
- GL_CTHL_DXK_VAVLE = 1; //延时顶斜口
-
- GL_CTHL_AutoStep = 9;
- if(GL_CTHL_cZipCnt==0)
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_DXK_XKDW_Off_DELAY+50;
- else
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_DXK_XKDW_Off_DELAY;
-
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
-
- case 9:
- if((dwTickCount >= GL_CTHL_AutoDelay)) //顶斜口延时退斜口上止定位
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
-
- GL_CTHL_XKDW_VAVLE = 0; //方块钩针
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带气缸关
- GL_CTHL_AutoStep = 10;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_XK_CR_DELAY;
-
- // if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1)
- // GL_CTHL_CXSX_VAVLE = 0; //插销顶出退
- }
- }
- break;
- case 10:
- if((dwTickCount >= GL_CTHL_AutoDelay) && !X_DRV && (bCL_OK_FLG))
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_TD_MotorStep = 10; //启动拖带穿入
- GL_CTHL_AutoStep = 11;
- GL_CTHL_bXCBackOK = 0;
- GL_CTHL_AutoDelay = dwTickCount + 60;
- }
- }
- break;
- case 11:
-
- if((GL_CTHL_TD_MotorStep == 0) && bCL_OK_FLG) //穿入定位完成
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_XKDW_VAVLE = 0; //方块钩针
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
-
- // if(GL_CTHL_PARAM_CR_MODE==0)
- GL_CTHL_CXSCDW_VAVLE = 1; //Y21 插销上止定位电磁阀
-
- if((GL_CTHL_CL_MotorStep == 0) && (GL_CTHL_SF_Origin_IN))
- {
- GL_CTHL_CXQJD_VAVLE = 1;
-
- //Y轴启动插销
- GL_CTHL_CL_MotorStep = 20; //插销定位
- GL_CTHL_BB_VAVLE=1;
-
- }
- GL_CTHL_AutoStep = 12;
- }
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 12:
- if(!GL_CTHL_bXCBackOK && (GL_CTHL_CL_MotorStep == 0) &&
- (GL_CTHL_SF_Origin_IN ))
- {
- GL_CTHL_CXQJD_VAVLE = 1; //插销前夹带
- GL_CTHL_CL_MotorStep = 20; //插销定位
- GL_CTHL_BB_VAVLE=1;
-
- }
- if(!GL_CTHL_XKTD_Origin_IN)//) //插销前夹带回到原位
- {
- GL_CTHL_AutoStep = 14;
-
- GL_CTHL_AutoDelay = dwTickCount + 0;
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 14:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 15;
- GL_CTHL_FKGD_VAVLE = 1; //方块固定
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // GL_CTHL_CXDWZ_VAVLE = 1; //插销定位针(到位)电磁阀
- GL_CTHL_XKDW_VAVLE = 1; //方块勾针输出
-
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 15:
- if(!GL_CTHL_bXCBackOK && (GL_CTHL_CL_MotorStep == 0) &&
- (GL_CTHL_SF_Origin_IN ))
- {
- GL_CTHL_CXQJD_VAVLE = 1;
- GL_CTHL_CL_MotorStep = 20; //插销定位
- GL_CTHL_BB_VAVLE=1;
- }
- if((GL_CTHL_CL_MotorStep == 0) && GL_CTHL_bXCBackOK) //插销定位完成
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- if(GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 1; //插销上下
- else
- GL_CTHL_CXSX_VAVLE = 0; //插销顶出
-
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_AutoStep = 16;
- GL_CTHL_CXDWZ_VAVLE = 1; //插销定位针(到位)电磁阀
- GL_CTHL_AutoDelay = dwTickCount +15;//2; //延时插销下移
-
- GL_CTHL_CXHJD_VAVLE = 1; //Y14 插销后夹带输出
-
- }
- }
- break;
- case 16:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_AutoStep = 17;
- GL_CTHL_CXHJD_VAVLE = 1; //Y14 插销后夹带输出
- //if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
-
- // else
- // GL_CTHL_CXSX_VAVLE = 1; //插销顶出
- // GL_CTHL_CXSX_VAVLE = 0; //Y06 插销下移电磁阀
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME; //插销下移异常时间
- }
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 17:
- if(GL_CTHL_CXXY_Limit_IN || GL_CTHL_PARAM_XCDW_MODE)
- {
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带电磁阀
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- //GL_CTHL_XKDW_VAVLE = 1; //方块勾针输出
- GL_CTHL_CXSCDW_VAVLE = 0; //Y21 插销上止定位关
- GL_CTHL_CXDWZ_VAVLE = 1; //插销定位针(到位)电磁阀
- GL_CTHL_AutoStep = 18;
- if(GL_CTHL_LENTH>0 )
- {
- if(!GL_CTHL_bReStart)
- GL_CTHL_LENCountBuff = GL_CTHL_PARAM_TDFZ_LENTH;
- // AxisMovePosAccDec(X_AXIS,6000,-GL_CTHL_PARAM_TDFZ_LENTH,800,600,6,8,0);
- else
- GL_CTHL_LENCountBuff = GL_CTHL_PARAM_TDFZ_LENTH/3;
- // AxisMovePosAccDec(X_AXIS,6000,-GL_CTHL_PARAM_TDFZ_LENTH/3,800,600,6,8,0);
- }
- else
- {
- if(!GL_CTHL_bReStart)
- GL_CTHL_LENCountBuff = GL_CTHL_PARAM_TDFZ_LENTH + 300;
- // AxisMovePosAccDec(X_AXIS,6000,-GL_CTHL_PARAM_TDFZ_LENTH-300,800,600,6,8,0);
- else
- GL_CTHL_LENCountBuff = GL_CTHL_PARAM_TDFZ_LENTH/3+ 300;
- // AxisMovePosAccDec(X_AXIS,6000,-GL_CTHL_PARAM_TDFZ_LENTH/3-300,800,600,6,8,0);
- }
- user_datas[123] = GL_CTHL_LENCountBuff;//
- AxisMovePosAccDec(X_AXIS,6000,-GL_CTHL_LENCountBuff,800,600,6,8,0);
- GL_CTHL_bReStart = 0;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_CXCR_DELAY;
- cXcxcrCnt = 0;
- }
- }
- else if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CXGL_Limit_ALARM,bRunning); //插销下移异常
-
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 18:
- // if(START_IN_UP)
- {
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 19;
-
- GL_CTHL_CXHDW_VAVLE = 1; //插销后定位(插销穿入)
- GL_CTHL_AutoDelay = dwTickCount + 500; //插销穿入到位异常时间
-
- GL_CTHL_CL_MotorStep = 50; //合链电机回原点
- }
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 19:
- if(GL_CTHL_CX_Limit_IN || (!GL_CTHL_CXDWZ_VAVLE && GL_CTHL_bTiaoShiMode))
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_CXSX_VAVLE = 0; //插销上下
- GL_CTHL_AutoStep = 20;
- GL_CTHL_BB_VAVLE=0;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_First_CL_DELAY/2;//延时一次穿入
-
-
- }
- // GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针(到位)电磁阀
- //if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1)
- //GL_CTHL_CXSX_VAVLE = 0; //插销顶出
- }
- else if((dwTickCount >= GL_CTHL_AutoDelay) && GL_CTHL_CXDWZ_VAVLE)
- {
- cXcxcrCnt++;
- if(cXcxcrCnt >= 3)
- GL_CTHL_SetAlarmCode(GL_CTHL_CX_Limit_ALARM ,bRunning);//插销穿入到位异常
- else
- {
- GL_CTHL_CXHJD_VAVLE=0;
- if(cXcxcrCnt== 1)
- GL_CTHL_AutoStep = 190;
- else
- GL_CTHL_AutoStep = 195;
- GL_CTHL_AutoDelay = dwTickCount + 100;
- }
-
- }
-
- break;
- //第二次
- case 190:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 191;
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位(插销穿入)
- GL_CTHL_AutoDelay = dwTickCount + 80;
- }
- break;
-
- case 191:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 18;
- GL_CTHL_CXHJD_VAVLE=1;
- GL_CTHL_AutoDelay = dwTickCount + 80;
- }
- break;
-
- //第三次
- case 195:
- GL_CTHL_CXQJD_VAVLE = 1; //插销前夹带
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 196;
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位(插销穿入)
- GL_CTHL_AutoDelay = dwTickCount + 500;
- GL_CTHL_FKGD_VAVLE = 0;
- AxisMovePosAccDec(Y_AXIS,1200,40,1200,500,6,6,20);
- AxisMovePosAccDec(X_AXIS,6000,-100,800,600,6,8,0);
- }
- break;
- case 196:
- if(!Y_DRV)
- {
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带
- }
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_FKGD_VAVLE = 1;
- GL_CTHL_CXHJD_VAVLE=1;
- if(!Y_DRV)
- {
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带
- GL_CTHL_AutoStep = 18;
- GL_CTHL_AutoDelay = dwTickCount + 120;
- }
- }
- break;
-
- case 20:
- if(GL_CTHL_FKGD_VAVLE)//方块固定退
- {
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
-
- GL_CTHL_FKGD_VAVLE = 0;
- GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针(到位)电磁阀
- GL_CTHL_AutoStep = 201;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_THJD_DELAY;
- }
- }
-
- break;
- case 201:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
-
- //GL_CTHL_CXHJD_VAVLE=0;
- GL_CTHL_FKJD_VAVLE = 0;
- GL_CTHL_AutoStep = 202;
- if(!GL_CTHL_PARAM_HDW_Select)
- GL_CTHL_CXHJD_VAVLE = 0; //插销后定位(插销穿入)关闭
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_First_CL_DELAY/2;//延时一次穿入
- }
- break;
- case 202:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 21;
- GL_CTHL_First_CT_VAVLE = 1; //一次穿入电磁阀输出
- // GL_CTHL_CXHJD_VAVLE = 1; //Y14 插销后夹带打开
-
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- break;
- case 21:
- if(!GL_CTHL_First_CT_Origin_IN) //原点离开后才开始时间
- {
- // GL_CTHL_LENCountBuff
- // AxisMovePosAccDec(X_AXIS,5000,GL_CTHL_PARAM_TDFZ_LENTH*4/5,1500,800,6,6,0);
-
- GL_CTHL_AutoStep = 22;
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_First_CL_Timer/2; //一次穿入时间
- }
- else if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_YCCRYWYC_ALARM,bRunning); //一次穿入原位异常
- }
- break;
- case 22:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 23;
- GL_CTHL_LENCountBuff = GL_CTHL_LENCountBuff * 2/5;
- // if(GL_CTHL_LENCountBuff > 150)
- AxisMovePosAccDec(X_AXIS,3500,GL_CTHL_LENCountBuff,800,800,6,6,0);
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_First_CL_Timer/2; //一次穿入时间
- }
- break;
- case 23:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_AutoStep = 24;
- GL_CTHL_MGuo_VAVLE = 0; //码勾退
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_PARAM_MGOff_XiaMo_DELAY;
- }
- }
- break;
- case 24:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 25;
- GL_CTHL_HeMoStep = 10; //下模的上升和下降电磁阀要配合
- GL_CTHL_CTXMSS_VAVLE = 0; //穿头下模退
- GL_CTHL_AutoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带气缸输出
-
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- GL_CTHL_FKGD_VAVLE = 0; //方块固定关
- GL_CTHL_CXHJD_VAVLE = 0; //Y14 插销后夹带打开
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- break;
- case 25:
- if(!GL_CTHL_CTM_Limit_IN)
- {
- GL_CTHL_CXHJD_VAVLE = 0; //Y14 插销后夹带打开
- GL_CTHL_AutoStep = 26;
- GL_CTHL_AutoDelay = dwTickCount + 35; //一次穿入延时返回
- }
- else if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,bRunning);//穿头下模下降异常
- }
- break;
- case 26:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- GL_CTHL_AutoStep = 27;
- GL_CTHL_AutoDelay = dwTickCount + 0;
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位(插销穿入)关闭
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带气缸输出
- //退下出错警告
- GL_CTHL_AutoDelay1 = dwTickCount + 65;
- GL_CTHL_AutoStep1 = 1;
- }
- break;
- case 27:
- if(dwTickCount >= GL_CTHL_AutoDelay)
- {
- //调试模式
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- GL_CTHL_FKGD_VAVLE = 0; //方块固定关
- GL_CTHL_AutoStep = 2;
- bCL_EN_FLG = 1;
- // cXcxcrCnt=0;
- AddToTal(GL_CTHL_TOTAL_ADDR);
- AddToTal(GL_CTHL_WORK_TOTAL_ADDR);
- AddToTal(GL_CTHL_CUR_TOTAL_ADDR);
- CalProSP(GL_CTHL_SPEED_ADDR);
- if(GL_CTHL_cZipCnt<3)
- GL_CTHL_cZipCnt++;
- }
- }
-
- break;
- }
- GL_CTHL_RunStepSave = GL_CTHL_AutoStep;
- }
- //退下模后启动送拉头
- switch(GL_CTHL_AutoStep1)
- {
- case 1:
- if(cStopMode==1)
- {
- cStopMode=2;
- bStop=1;
- }
- if(GL_CTHL_First_CT_VAVLE)
- {
- if(dwTickCount >= GL_CTHL_AutoDelay1)
- {
- GL_CTHL_First_CT_VAVLE = 0; //一次穿入电磁阀关
- GL_CTHL_AutoDelay1 = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- }
- else
- {
- if(GL_CTHL_CTM_Origin_IN && GL_CTHL_First_CT_Origin_IN)
- {
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_ZhuangLiaoDelay=dwTickCount+100;
- GL_CTHL_TryCnt = 0;
- GL_CTHL_AutoStep1 = 0;
- GL_CTHL_MGuo_VAVLE = 0;
- GL_CTHL_JLTou_VAVLE = 0;
- if(!bRunning) //在调机状态下先判断有没有料
- {
- GL_CTHL_MGuo_VAVLE = 1;
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 100;
- bZhuangLiaoOkFlg = 0;
- }
- }
- else if(dwTickCount >= GL_CTHL_AutoDelay1)
- {
- //穿头模和一次穿入回位异常
- if(!GL_CTHL_CTM_Origin_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,bRunning);
- else if(!GL_CTHL_First_CT_Origin_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_First_CT_Origin_ALARM,bRunning);
- }
- }
- break;
-
- }
-
- }
- void GL_CTHL_CheckStart(void)
- {
- /*
- if(cWULATOUCnt) // 无拉头警告后按
- {
- if(GL_CTHL_START_IN_UP)
- {
- if(!bRunning)
- {
- if(GL_CTHL_SafeDoor_IN)
- {
- bRunning=1;
- GL_CTHL_TryCnt=0;
- cWULATOUCnt=0;
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_AutoStep=6;
- bTuiLaTouOkFlg = 1;
- bZhuangLiaoOkFlg= 0;
- GL_CTHL_MGuo_VAVLE = 1; //判断是否已经有料
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 150;
-
- }
- else
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_SafeDoor_ALARM,0); // 安全门关上才能启动
- }
- }
- }
- }
- */
- //启动 自动启动 单一自动
- if(GL_CTHL_START_IN_UP || bStart || GL_CTHL_bOnceStart)
- {
- //单一启动
- if(GL_CTHL_bOnceStart)
- {
- GL_CTHL_bOnceStart=0;
- bSingOneFlg=1;//一次标志
- bSingOneCnt=1;//走完一条
- }
- else
- {
- bSingOneFlg=0;
- bSingOneCnt=0;
- }
- if(!bRunning)
- {
- if(GL_CTHL_SafeDoor_IN)
- {
- GL_CTHL_CXDW_Stop = 0;
- cStopMode=0;
- bRunning = 1;
- cWULATOUCnt=0;
-
- GL_CTHL_CL_MotorStep = 40;
- bZhuangLiaoOkFlg= 0;
- GL_CTHL_SongDai_Step=1;
- GL_CTHL_MGuo_VAVLE = 1; //判断是否已经有料
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 180;
- GL_CTHL_LianLengthCheck = 0;
- GL_CTHL_LianLengthAutoCheck = 0;
- GL_CTHL_cZipCnt = 0;
- bTuiLaTouOkFlg = 1;
- bCL_EN_FLG = 0;
- cStopInCnt = 0;
- GL_CTHL_CTXMXJ_VAVLE = 0;
- GL_CTHL_bReStart = 0;
- //装料启动一次,保证下模已在原位(下面)
- if((GL_CTHL_ZhuangLiaoStep == 0) && !GL_CTHL_CTXMSS_VAVLE && GL_CTHL_CTM_Origin_IN)
- {
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_TryCnt = 0;
- }
- //已经定位好,并且保持在原位
- if(GL_CTHL_bDinweiOK && GL_CTHL_XKSC_Limit_IN && GL_CTHL_XKDW_VAVLE
- && GetEn(X_AXIS) && (GL_CTHL_RunStepSave != 19))
- {
- SetPos(X_AXIS, 0);
- GL_CTHL_GDXM_VAVLE = 1;
- GL_CTHL_AutoStep = 5;
- GL_CTHL_XSavePosBuff = 0;
-
- } //穿插销不到位停止
- else if(((GL_CTHL_RunStepSave == 19) || (GL_CTHL_RunStepSave == 190) || (GL_CTHL_RunStepSave == 191))
- && GL_CTHL_CXHJD_VAVLE && GL_CTHL_CXHDW_VAVLE
- && GL_CTHL_CTXMSS_VAVLE && GL_CTHL_CXDWZ_VAVLE)
- {
- if(GL_CTHL_CX_Limit_IN)
- {
- GL_CTHL_AutoStep = 19;
- }
- else
- {
- GL_CTHL_AutoStep = 16;
- GL_CTHL_bReStart = 1;
- GL_CTHL_AutoDelay = dwTickCount + 100;
- GL_CTHL_CXHJD_VAVLE = 0;
- GL_CTHL_CXHDW_VAVLE = 0;
- }
- }
- else
- {
- GL_CTHL_AutoStep = 1;
- GL_CTHL_AutoDelay = dwTickCount + 180;
- }
- GL_CTHL_cZipCnt = 0;
-
- SetEn(X_AXIS, MOTOR_EN);
- SetEn(Y_AXIS, MOTOR_EN);
- SetAlarmCode(GL_CTHL_ALARM_ADDR,0);
-
- }
- else
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_SafeDoor_ALARM,0); // 安全门关上才能启动
- }
- }
- bStart = 0;
- }
- if(bStop)
- {
- bStop=0;
- bSingOneFlg=1;
- bSingOneCnt=0;
- }
-
- //停止
- if(GL_CTHL_STOP_IN_UP)
- {
- if(cStopMode < 2)
- cStopMode++;
- if(bRunning)
- {
- GL_CTHL_CXDW_Stop = 0;
- cStopMode=0;
- cXcxcrCnt=0;
- cWULATOUCnt=0;
- if(GL_CTHL_XKSC_Limit_IN)
- AxisEgmStop(X_AXIS);
- else
- AxisDecStop(X_AXIS);
- AxisEgmStop(Y_AXIS);
- GL_CTHL_AutoStep = 0;
-
- GL_CTHL_CL_MotorStep =0;
- GL_CTHL_SongDai_Step=0;
- GL_CTHL_HLJJ_VAVLE = 0;
- GL_CTHL_bCLFirst_Step=0;
- if(!GL_CTHL_bDinweiOK)
- GL_CTHL_XKDW_VAVLE =0;
- SetAlarmCode(GL_CTHL_ALARM_ADDR,0);
- bRunning=0;
- }
- else if(!bRunning)
- {
- bRunning=0;
- cXcxcrCnt=0;
- cStopMode=0;
- cWULATOUCnt=0;
- AxisEgmStop(X_AXIS);
- AxisEgmStop(Y_AXIS);
- SetEn(X_AXIS, MOTOR_DISEN);
- SetEn(Y_AXIS, MOTOR_DISEN);
- cStopMode=0;
- GL_CTHL_bDinweiOK = 0;
- if(GetAlarm(X_AXIS)==MOTOR_ALARM || GetAlarm(Y_AXIS)==MOTOR_ALARM )
- {
- SetClr(X_AXIS,ALARM_CLR);
- GL_CTHL_bSFBBAOJIN_Delay= dwTickCount + 200;
- }
- GL_CTHL_TLiao_VAVLE=0;
-
- if(!GL_CTHL_HSLiao_VAVLE || !GL_CTHL_MGuo_VAVLE)
- GL_CTHL_JLTou_VAVLE =0;
- GL_CTHL_HSLiao_VAVLE =0;
- GL_CTHL_XKTD_VAVLE =0;
- GL_CTHL_XKDW_VAVLE =0;
- GL_CTHL_DXK_VAVLE =0;
- GL_CTHL_GDXM_VAVLE = 0;
- GL_CTHL_CXSX_VAVLE =0;
-
- GL_CTHL_First_CT_VAVLE =0;
- GL_CTHL_FKGD_VAVLE =0;
- GL_CTHL_CXQJD_VAVLE =0;
- GL_CTHL_CXDWZ_VAVLE =0;
- GL_CTHL_CXHJD_VAVLE =0;
- GL_CTHL_CXHDW_VAVLE =0;
- GL_CTHL_FKJD_VAVLE =0;
- GL_CTHL_HLJJ_VAVLE =0;
- GL_CTHL_BB_VAVLE=0;
- //GL_CTHL_CXHT_VAVLE = 0;
- GL_CTHL_CXSCDW_VAVLE =0;
- if((GL_CTHL_CTXMSS_VAVLE) || (GL_CTHL_CTM_Origin_IN && !GL_CTHL_CTXMSS_VAVLE))
- GL_CTHL_MGuo_VAVLE =0;
- if(GL_CTHL_CTXMSS_VAVLE || !GL_CTHL_CTM_Origin_IN)
- {
- GL_CTHL_HeMoStep = 10;
- }
- else if(!GL_CTHL_CTXMSS_VAVLE && !GL_CTHL_CTM_Limit_IN)
- GL_CTHL_CTXMXJ_VAVLE = 1;
- GL_CTHL_CTXMSS_VAVLE =0;
- GL_CTHL_AutoStep = 0;
- GL_CTHL_ZhuangLiaoStep=0;
- GL_CTHL_TLiaoStep=0;
- GL_CTHL_TD_MotorStep=0;
- GL_CTHL_JiaLianStep =0;
- // GL_CTHL_ZhenDongStep =0;
- GL_CTHL_SongLiaoStep =0;
- GL_CTHL_CL_MotorStep =0;
- GL_CTHL_AutoStep1 =0;
- GL_CTHL_bFKCXTDDW_Step=0;
- GL_CTHL_bCXCR_Step=0;
- GL_CTHL_bCLFirst_Step=0;
- GL_CTHL_RunStepSave = 0;
- GL_CTHL_SongDai_Step=0;
- SetAlarmCode(GL_CTHL_ALARM_ADDR,0);
- SetPos(X_AXIS, 0);
- // if(cStopInCnt < 3)
- // cStopInCnt++;
- // if(bStop)
- // cStopInCnt = 0;
- GL_CTHL_TLiaoStep = 0;
- GL_CTHL_AutoStep = 0;
- GL_CTHL_CXDW_Stop = 0;
- //穿合链电机是往零点方向时可以停止
- // if((GetDir(Y_AXIS) == DIR_N) && GL_CTHL_SF_Origin_IN)
- // AxisEgmStop(Y_AXIS);
-
- // if(GL_CTHL_SF_ALR_IN || GL_CTHL_Y_SF_ALR_IN)
- // {
- // //SetEn(Z_AXIS, MOTOR_EN); //清伺服警告
- // GL_CTHL_ALARMCLR_VAVLE=1;
- // GL_CTHL_bSFBBAOJIN_Delay= dwTickCount + 200;
- // }
- /* if(cStopInCnt > 1)
- {
- GL_CTHL_CL_MotorStep = 0;
- AxisEgmStop(Y_AXIS);
- GL_CTHL_ZhuangLiaoStep = 0;
- }
- else
- {
- GL_CTHL_TD_MotorStep = 0;
- SetEn(X_AXIS, MOTOR_DISEN);
- SetEn(Y_AXIS, MOTOR_DISEN);
- GL_CTHL_bFKCXTDDW_Step = 0;
- GL_CTHL_bCXCR_Step = 0;
- GL_CTHL_bCLFirst_Step = 0;
- }*/
- }
- bStop=0;
- }
-
- if(bAlarmStop)
- {
- bRunning = 0;
- bAlarmStop=0;
- cStopMode=0;
- cXcxcrCnt=0;
- if(GetAlarmCode(GL_CTHL_ALARM_ADDR) == GL_CTHL_SF_ALR_ALARM)
- GL_CTHL_X_EN_FLG=0;
- if(GetAlarmCode(GL_CTHL_ALARM_ADDR) == GL_CTHL_Y_SF_ALR_ALARM)
- GL_CTHL_Y_EN_FLG=0;
- AxisDecStop(X_AXIS);
- AxisEgmStop(Y_AXIS);
- if(GL_CTHL_CXSC_Limit_IN)
- {
- AxisEgmStop(X_AXIS);
- }
- GL_CTHL_AutoStep = 0;
- GL_CTHL_CL_MotorStep =0;
- GL_CTHL_bCLFirst_Step=0;
- GL_CTHL_SongLiaoStep =0;
- GL_CTHL_ZhuangLiaoStep=0;
- GL_CTHL_SongDai_Step=0;
- }
- }
- //拖带电机控制动作 X轴
- void GL_CTHL_TD_Motor(void) //
- {
- #if 1
- switch(GL_CTHL_TD_MotorStep)
- {
- //1步开始,纯定位, 没有穿入
- case 1:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(dwTickCount >= GL_CTHL_TD_MotorDelay) //给锁轴时间
- {
- GL_CTHL_bTest = 0;
- bCheckEN_FLG = 1;
- GL_CTHL_CheckInX02PosBuff= 0;
- GL_CTHL_TD_MotorStep = 2;
- SetPos(X_AXIS, 0); //启动位置设为0点
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0) //尼龙
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,DIR_P,800,600,15,15);
- else
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,DIR_P,800,600,15,15);
- }
- break;
- case 2://检测到过链
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(dwXRealPos > GL_CTHL_PARAM_TuiDXM_Lenght)//200) //穿入2CM后退
- {
- GL_CTHL_DXK_VAVLE = 0; //顶斜口气缸关
- GL_CTHL_GDXM_VAVLE = 0;
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1) || (GL_CTHL_PARAM_QianMaSelect == 1))//尼龙
- GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸输出
- }
- if((dwXRealPos >= GL_CTHL_PARAM_WLCDSHEZHI_LENTH) && GL_CTHL_PARAM_WLCDSHEZHI_LENTH)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning); //无拉链自动停机
- }
- if((dwXRealPos > (GL_CTHL_LianLengthAutoCheck+2000)) && GL_CTHL_LianLengthAutoCheck && GL_CTHL_cZipCnt>1)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning);
- //无拉链自动停机
- }
- if(GL_CTHL_FK_Check)
- {
- // user_datas[122] = dwXRealPos;
- GL_CTHL_DXK_VAVLE = 0; //顶斜口气缸关
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1) || (GL_CTHL_PARAM_QianMaSelect == 1)) //尼龙
- GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸输出
- GL_CTHL_GDXM_VAVLE = 0;
- GL_CTHL_XSavePosBuff = dwXRealPos;
- GL_CTHL_TD_MotorStep = 3;
- if((dwXRealPos >= GL_CTHL_CheckInX02PosBuff) && GL_CTHL_CheckInX02PosBuff)
- {
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length - (dwXRealPos- GL_CTHL_CheckInX02PosBuff) - 160,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,20,40);
- }
- else
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length-120,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,20,40);
- }
- if(GL_CTHL_CXSC_Limit_IN_UP)
- {
- GL_CTHL_X_CXPosBuff = dwXRealPos;
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 3:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(GL_CTHL_CXSC_Limit_IN_UP && !GL_CTHL_bTest)
- {
- GL_CTHL_bTest = 1;
- GL_CTHL_X_CXPosBuff = dwXRealPos;
- user_datas[123] = GL_CTHL_X_CXPosBuff;
- }
- if(!X_DRV || (dwXRealPos >= (GL_CTHL_XSavePosBuff + GL_CTHL_PARAM_FKDW_Length)))
- {
- AxisEgmStop(X_AXIS);
- GL_CTHL_TD_MotorStep =4 ;
- GL_CTHL_LianLengthAutoCheckOLD = GL_CTHL_LianLengthAutoCheck;
- GL_CTHL_LianLengthAutoCheck = dwXRealPos;
- }
- break;
- case 4:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(GL_CTHL_PARAM_XCX_LENTH) //0的话不判断位置
- {
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // {
- if ((dwXRealPos - GL_CTHL_X_CXPosBuff) > (GL_CTHL_PARAM_XCX_LENTH + GL_CTHL_PARAM_XCXWC_LENTH))
- {
- //user_datas[121] = 1;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
-
- }
- else if((dwXRealPos - GL_CTHL_X_CXPosBuff) < (GL_CTHL_PARAM_XCX_LENTH - GL_CTHL_PARAM_XCXWC_LENTH))
- {
- //user_datas[121] = 2;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- else if(GL_CTHL_X_CXPosBuff == 0)
- {
- //user_datas[121] = 3;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- else
- {
- GL_CTHL_TD_MotorStep = 0;
- }
- // }
- // else
- // {
- // if(GL_CTHL_X_CXPosBuff == 0)
- // {
- // user_datas[121] = 3;
- // GL_CTHL_TD_MotorStep = 0;
- // GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- // }
- // else
- // {
- // GL_CTHL_TD_MotorStep = 0;
- // }
- // }
- }
- else
- {
- GL_CTHL_TD_MotorStep = 0;
- }
- break;
-
- //穿拉头定位
- case 10:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(dwTickCount >= GL_CTHL_TD_MotorDelay)
- {
- GL_CTHL_TD_MotorStep = 11;
- SetPos(X_AXIS, 0); //启动位置设为0点
- dwXRealPos = 0;
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_TDCR_LowSpeed,DIR_P,800,1200,18,5);
- GL_CTHL_CheckInX02PosBuff= 0;
- bCheckEN_FLG = 1;
- GL_CTHL_X_CXPosBuff = 0;
- GL_CTHL_bTest = 0;
- GL_CTHL_X_FKCheckPos = 0;
- user_datas[121] = 0;
- }
- break;
- case 11:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
- GL_CTHL_CountBuff = 180;
- else
- GL_CTHL_CountBuff = 450;
- if(dwXRealPos > GL_CTHL_CountBuff) //穿入4CM后退
- {
- if((GL_CTHL_cZipCnt < 2) || (GL_CTHL_LianLengthCheck < 350))
- {
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed,DIR_P,800,1200,18,5);
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
- AxisContinueMoveChangeSpeed(X_AXIS,6000,600,10,10);
- else
- AxisContinueMoveChangeSpeed(X_AXIS,6000,600,10,15); //GL_CTHL_PARAM_TD_RunSpeed*2/3
- }
- else ////两段速度移动距离
- {
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)//GL_CTHL_PARAM_TD_RunSpeed*2/3
- AxisMovePosAccDecNotStop(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed + GL_CTHL_PARAM_TD_RunSpeed/3,GL_CTHL_LianLengthCheck,3000,GL_CTHL_PARAM_TD_RunSpeed,20,55,650);
- else
- AxisMovePosAccDecNotStop(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed + GL_CTHL_PARAM_TD_RunSpeed/3,GL_CTHL_LianLengthCheck,3000,6500,20,20,800);
- } //GL_CTHL_PARAM_TD_RunSpeed*2/3
- GL_CTHL_TD_MotorStep = 12;
- }
-
- if(GL_CTHL_FK_Check)
- {
- ;
- GL_CTHL_LianLengthCheckReal=dwXRealPos;
-
- GL_CTHL_TD_MotorStep = 14;
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length+10,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,50,160);
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_FKDW_Length+10;
- }
- //方块还没有感应之前感应到插销的话,肯定错位
- if(GL_CTHL_CXSC_Limit_IN_UP)
- {
- //user_datas[121] = 4;
- GL_CTHL_X_CXPosBuff = dwXRealPos;
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
-
- }
- break;
- case 12:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT)
- {
- if(dwXRealPos > GL_CTHL_PARAM_TuiDXM_Lenght)
- {
- GL_CTHL_CheckInX02PosBuff= 0;
- GL_CTHL_GDXM_VAVLE = 0;
- GL_CTHL_TD_MotorStep = 13;
-
- }
- }
- else
- {
- if(dwXRealPos > GL_CTHL_PARAM_TuiDXM_Lenght)
- {
- GL_CTHL_CheckInX02PosBuff= 0;
- GL_CTHL_GDXM_VAVLE = 0;
- GL_CTHL_TD_MotorStep = 13;
-
- }
- }
- break;
- case 13://检测到过链
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(dwXRealPos > GL_CTHL_PARAM_TuiDXM_Lenght)//400)
- {
- GL_CTHL_DXK_VAVLE = 0; //顶斜口气缸关
- if((GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1) || (GL_CTHL_PARAM_QianMaSelect == 1)) //尼龙
- GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸输出
- }
- if((dwXRealPos >= GL_CTHL_PARAM_WLCDSHEZHI_LENTH) && GL_CTHL_PARAM_WLCDSHEZHI_LENTH)
- {
-
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning); //无拉链自动停机
- // AxisDecStop(X_AXIS);
- GL_CTHL_TD_MotorStep = 0;
- //user_datas[121] = 10;
- AxisMovePosAccDec(X_AXIS,2000,600,
- GL_CTHL_PARAM_FKDW_Speed,1000,10,50,20);
- }
- if((dwXRealPos > (GL_CTHL_LianLengthAutoCheck+7000)) && GL_CTHL_LianLengthAutoCheck && (GL_CTHL_cZipCnt>0))
- {
-
- GL_CTHL_SetAlarmCode(GL_CTHL_WLZDTJ_ALARM,bRunning);
- AxisDecStop(X_AXIS);
- GL_CTHL_TD_MotorStep = 0;
- //user_datas[121] = 11;
- AxisMovePosAccDec(X_AXIS,2000,600,
- GL_CTHL_PARAM_FKDW_Speed,1000,10,50,20);
- break;
- //无拉链自动停机
- }
- if(GL_CTHL_FK_Check)
- {
- user_datas[122] = axis_x->cur_speed;//GetCurSpeed(X_AXIS);//dwXRealPos;
- GL_CTHL_LianLengthCheckReal=dwXRealPos;
- if(GL_CTHL_cZipCnt == 1)
- GL_CTHL_LianLengthCheck = dwXRealPos;
-
- //break;
-
- GL_CTHL_TD_MotorStep = 14;
- // if(GetCurSpeed(X_AXIS) <= 10000)
- // user_datas[122] = GL_CTHL_PARAM_FKDW_Length - (dwXRealPos- GL_CTHL_CheckInX02PosBuff);
- if(GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 0)
- {
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_FKDW_Length;
- if(GL_CTHL_cZipCnt == 0) //第一条可能不对齐
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,50,40);
- else //变为低速
- {
- GL_CTHL_TD_MotorStep = 30;
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed*2,GL_CTHL_PARAM_FKDW_Speed*2,
- 6,6);
- }
- }
- else //尼龙
- {
- if(GL_CTHL_cZipCnt >1)
- {
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_FKDW_Length;
- //变为低速
- GL_CTHL_TD_MotorStep = 40;
- if(GL_CTHL_cZipCnt > 1)
- {
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed*2,GL_CTHL_PARAM_FKDW_Speed,
- 1,3);
- }
- else
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed*2,GL_CTHL_PARAM_FKDW_Speed,
- 1,5);
-
- // AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length-40,
- // GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed*2/3,10,30,160);
- }
- else
- {
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_FKDW_Length;
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_TD_RunSpeed*2/3,GL_CTHL_PARAM_FKDW_Length,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,10,50);
- }
- }
- }
- //方块还没有感应之前感应到插销的话,肯定错位
- if(GL_CTHL_CXSC_Limit_IN_UP)
- {
- //user_datas[121] = 4;
- GL_CTHL_X_CXPosBuff = dwXRealPos;
- // if(GL_CTHL_PARAM_CR_MODE==0)
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
-
- }
- break;
- case 14:
- GL_CTHL_TDMotorStepSave = GL_CTHL_TD_MotorStep;
- if(((dwXRealPos+200) >= GL_CTHL_X_FKCheckPos) && bRunning)
- {
- GL_CTHL_FKJD_VAVLE = 1;
- }
- if(GL_CTHL_CXSC_Limit_IN_UP && !GL_CTHL_bTest)
- {
- GL_CTHL_bTest = 1;
- GL_CTHL_X_CXPosBuff = dwXRealPos;
- user_datas[123] = GL_CTHL_X_CXPosBuff;
- //user_datas[121] = 128;
- }
- if((!X_DRV ) || (dwXRealPos >= (GL_CTHL_X_FKCheckPos)))
- {
- // user_datas[123] = dwXRealPos-GL_CTHL_CheckInX02PosBuff;
- AxisEgmStop(X_AXIS);
- GL_CTHL_TD_MotorStep = 15;
- GL_CTHL_LianLengthAutoCheckOLD = GL_CTHL_LianLengthAutoCheck;
- GL_CTHL_LianLengthAutoCheck = dwXRealPos;
- }
- break;
- case 15:
-
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // {
- #if 0
- if(((dwXRealPos - GL_CTHL_X_CXPosBuff) > (GL_CTHL_PARAM_XCX_LENTH + GL_CTHL_PARAM_XCXWC_LENTH)) && GL_CTHL_X_CXPosBuff)
- {
- //user_datas[121] += 5;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
-
- }
- else if(((dwXRealPos - GL_CTHL_X_CXPosBuff) < (GL_CTHL_PARAM_XCX_LENTH - GL_CTHL_PARAM_XCXWC_LENTH)) && GL_CTHL_X_CXPosBuff)
- {
- //user_datas[121] += 6;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- else if(GL_CTHL_X_CXPosBuff == 0)
- {
- //user_datas[121] += 7;
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- else
- {
- #endif
- GL_CTHL_TD_MotorStep = 16;
- // }
-
-
- // }
- // else
- // {
- // if(GL_CTHL_X_CXPosBuff == 0)
- // {
- // user_datas[121] += 7;
- // GL_CTHL_TD_MotorStep = 0;
- // GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- // }
- // else
- // {
- // GL_CTHL_TD_MotorStep = 0;
- // }
- // }
- break;
- case 16:
- if((!GL_CTHL_bTiaoShiMode) || GL_CTHL_bTiaoShiStep)
- {
- GL_CTHL_bTiaoShiStep = 0;
- GL_CTHL_TD_MotorStep = 0;
- }
- break;
- //树脂定位插销
- case 30:
- if(GL_CTHL_CXSC_Limit_IN_UP) //插销上止感应
- {
- if(GL_CTHL_cZipCnt > 1)
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,6,5);
- else
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,6,4);
- GL_CTHL_TD_MotorDelay = dwTickCount +5;
- GL_CTHL_TD_MotorStep = 31;
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 31:
- if(GL_CTHL_CXSC_Limit_IN)
- {
- if(dwTickCount >= GL_CTHL_TD_MotorDelay)
- {
- GL_CTHL_TD_MotorStep = 32;
- }
- }
- else
- {
- GL_CTHL_TD_MotorDelay = dwTickCount + 5;
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 32:
- if(GL_CTHL_CXSC_Limit_IN_DW)
- {
- GL_CTHL_TD_MotorStep = 33;
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_XCX_LENTH,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,10,5,10);
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_XCX_LENTH; //把小插再走的基准长度当作方块停止数据
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 33:
- if(((dwXRealPos+200) >= GL_CTHL_X_FKCheckPos) && bRunning)
- {
- GL_CTHL_FKJD_VAVLE = 1;
- }
- if((dwXRealPos >= GL_CTHL_X_FKCheckPos) || !X_DRV)
- {
- AxisEgmStop(X_AXIS);
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_LianLengthAutoCheckOLD = GL_CTHL_LianLengthAutoCheck;
- GL_CTHL_LianLengthAutoCheck = dwXRealPos;
- }
- break;
- //尼龙防水
- case 40:
- if(GL_CTHL_CXSC_Limit_IN_UP)
- {
- if(GL_CTHL_cZipCnt > 1)
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed/2,6,5);
- else
- AxisContinueMoveChangeSpeed(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed,6,4);
- GL_CTHL_TD_MotorDelay = dwTickCount +6;
- GL_CTHL_TD_MotorStep = 41;
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 41:
- if(GL_CTHL_CXSC_Limit_IN)
- {
- if(dwTickCount >= GL_CTHL_TD_MotorDelay)
- {
- GL_CTHL_TD_MotorStep = 42;
- }
- }
- else
- {
- GL_CTHL_TD_MotorDelay = dwTickCount +5;
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 42:
- if(GL_CTHL_CXSC_Limit_IN_DW)
- {
- GL_CTHL_TD_MotorStep = 43;
- AxisMovePosAccDec(X_AXIS,GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_XCX_LENTH,
- GL_CTHL_PARAM_FKDW_Speed,GL_CTHL_PARAM_FKDW_Speed*1/2,10,5,10);
- GL_CTHL_X_FKCheckPos = dwXRealPos + GL_CTHL_PARAM_XCX_LENTH; //把小插再走的基准长度当作方块停止数据
- }
- if(dwXRealPos >= GL_CTHL_X_FKCheckPos)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XCXXCYC_ALARM,bRunning); // 小插销行程异常
- }
- break;
- case 43:
- if(((dwXRealPos+200) >= GL_CTHL_X_FKCheckPos) && bRunning)
- {
- GL_CTHL_FKJD_VAVLE = 1;
- }
- if((dwXRealPos >= GL_CTHL_X_FKCheckPos) || !X_DRV)
- {
- AxisEgmStop(X_AXIS);
- GL_CTHL_TD_MotorStep = 0;
- GL_CTHL_LianLengthAutoCheckOLD = GL_CTHL_LianLengthAutoCheck;
- GL_CTHL_LianLengthAutoCheck = dwXRealPos;
- }
- break;
-
- }
- #endif
- }
- //穿入电机动作,Y轴
- void GL_CTHL_CL_Motor(void) //
- {
- #if 1
- //1步开始, 穿链长度开始
- //20步开始 插销定位开始
- //40步,回原点为
- switch(GL_CTHL_CL_MotorStep)
- {
- //穿入长度位置
- case 1:
-
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- // if(GL_CTHL_PARAM_CR_MODE != 0) //电机穿入
- // {
- /*
- //穿入长度要根据检测长度减动一次穿入的3CM,反转的2CM
- if((GL_CTHL_LianLengthAutoCheck < (GL_CTHL_PARAM_CL_Length + 700)) && (GL_CTHL_LianLengthAutoCheck>700))
- {
- GL_CTHL_Y_CL_Length=GL_CTHL_LianLengthAutoCheck-700;
-
- // if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_CL_MAX_Length)
- // GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_CL_MAX_Length-40;
- if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_Y_MAX_LENTH)
- GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_Y_MAX_LENTH-40;
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,GL_CTHL_Y_CL_Length,2000,2000,50,50,150);
- }
- else if(GL_CTHL_LianLengthAutoCheck>700)
- {
- GL_CTHL_Y_CL_Length=GL_CTHL_LianLengthAutoCheck-GL_CTHL_PARAM_CL_Length;
- //if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_CL_MAX_Length)
- // GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_CL_MAX_Length-40;
- if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_Y_MAX_LENTH)
- GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_Y_MAX_LENTH-40;
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,GL_CTHL_Y_CL_Length,2000,2000,50,50,100);
- }
- */
- // (公分节判断)
- if((GL_CTHL_LianLengthAutoCheck < (GL_CTHL_LianLengthAutoCheckOLD)) &&
- (GL_CTHL_LianLengthAutoCheck < GL_CTHL_PARAM_GFJ_Length)) //
- {
- GL_CTHL_cZipCnt = 0;
- GL_CTHL_Y_CL_Length=GL_CTHL_LianLengthAutoCheck-900;
-
- // if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_CL_MAX_Length)
- // GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_CL_MAX_Length-40;
- if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_Y_MAX_LENTH)
- GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_Y_MAX_LENTH-40;
- //正常穿入
- if(GL_CTHL_PARAM_GFJ_WorkMode == 0)
- {
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,GL_CTHL_Y_CL_Length,2000,2000,50,50,150);
- }
- //停止
- else if(GL_CTHL_PARAM_GFJ_WorkMode == 1)
- {
- GL_CTHL_CL_MotorStep = 0;
- GL_CTHL_HLJJ_VAVLE = 0;
- bCL_OK_FLG = 1;
- bSingOneFlg= 1;
- bSingOneCnt=0;
- break;
- }
- else if(GL_CTHL_PARAM_GFJ_WorkMode == 2)
- {
- GL_CTHL_CL_MotorStep = 0;
- GL_CTHL_HLJJ_VAVLE = 0;
- bCL_OK_FLG = 1;
- break;
- }
-
- }
- //穿入长度要根据检测长度减动一次穿入的3CM,反转的2CM
- else if(GL_CTHL_LianLengthAutoCheck>700)
- {
- GL_CTHL_Y_CL_Length=GL_CTHL_LianLengthAutoCheck-GL_CTHL_PARAM_CL_Length-200;
- //if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_CL_MAX_Length)
- // GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_CL_MAX_Length-40;
- if(GL_CTHL_Y_CL_Length >= GL_CTHL_PARAM_Y_MAX_LENTH)
- GL_CTHL_Y_CL_Length = GL_CTHL_PARAM_Y_MAX_LENTH-40;
- else if(GL_CTHL_Y_CL_Length < 100)
- GL_CTHL_Y_CL_Length = 100;
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,GL_CTHL_Y_CL_Length,2000,2000,50,50,100);
- }
- GL_CTHL_CL_MotorStep = 2;
- // }
- // else //气缸穿入
- // {
- // GL_CTHL_CL_MotorStep = 10;
- // GL_CTHL_HL_VAVLE = 1;
- //
- // GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_CLT_Time;
- //
- // if(((GL_CTHL_LianLengthAutoCheckOLD > (GL_CTHL_LianLengthAutoCheck + 1200)) &&
- // GL_CTHL_LianLengthAutoCheck) && (GL_CTHL_cZipCnt > 1))
- // {
- // GL_CTHL_CL_MotorStep = 0;
- // bCL_OK_FLG = 1;
- // GL_CTHL_HLJJ_VAVLE = 0;
- // GL_CTHL_HL_VAVLE = 0;
- // }
- //
- // }
- }
- break;
- case 2:
- if((dwYRealPos + 120) > GL_CTHL_Y_CL_Length)
- GL_CTHL_HLJJ_VAVLE = 0;
- if(!Y_DRV || dwYRealPos >= GL_CTHL_Y_CL_Length)
- {
- AxisEgmStop(Y_AXIS);
- GL_CTHL_HLJJ_VAVLE = 0;
- GL_CTHL_CL_MotorStep = 3;
- bCL_OK_FLG = 1;
- GL_CTHL_CL_MotorDelay = dwTickCount + 20; //延时数控回零点
- }
- break;
- case 3:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- GL_CTHL_CL_MotorStep = 50;
-
- }
- break;
- //气缸穿入
- case 10:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- GL_CTHL_CL_MotorStep = 11;
- bCL_OK_FLG = 1;
- GL_CTHL_HLJJ_VAVLE = 0;
- //GL_CTHL_HL_VAVLE = 0;
- GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_HL_BACK_Time; //合链返回时间到后才能重新前夹链
- }
- break;
- case 11:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
-
- GL_CTHL_CL_MotorStep = 0;
- }
- break;
- //夹带插销到穿入位置
- case 20: //此处最好算好定位长度相减
- // if(cXcxcrCnt > 0 || GL_CTHL_LianLengthCheck - GL_CTHL_LianLengthCheckReal > 350)
- // {
- // GL_CTHL_LENTH = GL_CTHL_PARAM_XCX_LENTH + GL_CTHL_PARAM_CXDW_Length - (dwXRealPos - GL_CTHL_X_CXPosBuff) + 45;
- // }
- // else
- // {
- // GL_CTHL_LENTH = GL_CTHL_PARAM_XCX_LENTH + GL_CTHL_PARAM_CXDW_Length - (dwXRealPos - GL_CTHL_X_CXPosBuff);
- // }
- GL_CTHL_LENTH = GL_CTHL_PARAM_CXDW_Length;
- user_datas[121] = GL_CTHL_LENTH;
- //user_datas[122] = GL_CTHL_X_CXPosBuff;
- if((GL_CTHL_LENTH > 0) )
- {
- GL_CTHL_CL_MotorStep = 21;
- }
- else
- {
- GL_CTHL_CL_MotorStep = 30;
- }
- GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_CXJZ_HT_DELAY;
- break;
- case 21:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- // if(GL_CTHL_PARAM_CR_MODE!= 0)
- // {
- GL_CTHL_Y_CL_PosBuff = dwYRealPos;
- AxisMovePosAccDec(Y_AXIS,8000,GL_CTHL_LENTH,800,500,6,6,20);
- // }
- // else
- // {
- // //GL_CTHL_CXHT_VAVLE = 1;
- // GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_XXHT_Time;
- // }
- GL_CTHL_CL_MotorStep = 22;
- }
- break;
- case 22:
- // if(GL_CTHL_PARAM_CR_MODE!= 0)
- // {
-
- if((dwYRealPos > GL_CTHL_Y_CL_PosBuff+GL_CTHL_LENTH-GL_CTHL_PARAM_CXDW_Length) && !GL_CTHL_CXDW_Stop)
-
- //GL_CTHL_CXSCDW_VAVLE = 1; //Y21 插销上止定位电磁阀
- if(!Y_DRV /*|| (dwYRealPos >= GL_CTHL_PARAM_CXDW_Length)*/) //插销定位已经结束
- {
- AxisEgmStop(Y_AXIS);
- GL_CTHL_YsaveCXDWPosBuff = 0;
- if(GL_CTHL_CXDW_Stop)
- {
- GL_CTHL_CL_MotorStep = 23;
- GL_CTHL_CL_MotorDelay = dwTickCount + 30;
- }
- else
- {
- GL_CTHL_CL_MotorStep = 0;
- GL_CTHL_bXCBackOK = 1;
- // GL_CTHL_CXQJD_VAVLE = 0;//YYQ
- //GL_CTHL_SongDai_VAVLE = 0; //松带
- }
-
-
- }
- // }
- // else if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- // {
- // GL_CTHL_CL_MotorStep = 23;
- // GL_CTHL_CL_MotorDelay = dwTickCount + 10;
- // GL_CTHL_CXQJD_VAVLE = 0;
- //
- // GL_CTHL_bXCBackOK = 1;
- // }
- break;
- case 23:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- //GL_CTHL_CXHT_VAVLE = 0;
- GL_CTHL_CL_MotorStep = 0;
- if(GL_CTHL_CXDW_Stop&& !bRunning)
- SetEn(Y_AXIS, MOTOR_DISEN);
- GL_CTHL_CXDW_Stop = 0;
- }
- break;
- case 30:
- GL_CTHL_YsaveCXDWPosBuff = 0;
- GL_CTHL_CL_MotorStep = 0;
- GL_CTHL_bXCBackOK = 1;
- GL_CTHL_CXQJD_VAVLE = 0;//YYQ
- break;
-
- //回原点开始
- case 40:
- // if(GL_CTHL_PARAM_CR_MODE == 0)
- // {
- // GL_CTHL_CL_MotorStep = 0;
- // GL_CTHL_CXQJD_VAVLE = 0;
- // //GL_CTHL_CXHT_VAVLE = 0;
- // GL_CTHL_HL_VAVLE = 0;
- // break;
- // }
- // else
- // {
- //要先离开
- if(GL_CTHL_SF_Origin_IN && (GetEn(Y_AXIS) == MOTOR_DISEN))
- {
- GL_CTHL_CL_MotorStep = 41;
- SetDir(Y_AXIS, DIR_P);
- }
- else
- {
- SetDir(Y_AXIS, DIR_N);
- GL_CTHL_CL_MotorStep = 46;
-
- }
- if(GetEn(Y_AXIS) == MOTOR_DISEN)
- {
- SetEn(Y_AXIS, MOTOR_EN);
- GL_CTHL_CL_MotorDelay = dwTickCount + 260; //锁轴时间
-
- }
- else //已经锁轴
- GL_CTHL_CL_MotorDelay = dwTickCount + 5;
- // }
- break;
- case 41:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- GL_CTHL_CL_MotorStep = 42;
- AxisContinueMoveAcc(Y_AXIS,5000,DIR_P,1000,800,15,15);
- }
- break;
- case 42:
- if(!GL_CTHL_SF_Origin_IN)
- {
- GL_CTHL_CL_MotorStep = 43;
- GL_CTHL_YSavePosBuff = dwYRealPos;
- }
- break;
- case 43:
- //离开原点5CM停止
- if((dwYRealPos - GL_CTHL_YSavePosBuff) >= 800)
- {
- AxisEgmStop(Y_AXIS);
- GL_CTHL_CL_MotorStep = 46; //留空几步备用
- GL_CTHL_CL_MotorDelay = dwTickCount + 50;
- }
- break;
- case 46:
- if(dwTickCount >= GL_CTHL_CL_MotorDelay)
- {
- GL_CTHL_CL_MotorStep = 47; //检测回到原位
- if(!GL_CTHL_SF_Origin_IN)
- AxisContinueMoveAcc(Y_AXIS,2000,DIR_N,1000,800,15,10);
- }
- break;
- case 47:
- if(GL_CTHL_SF_Origin_IN)
- {
- GL_CTHL_CL_MotorStep = 0;
- AxisEgmStop(Y_AXIS);
- SetPos(Y_AXIS, 0);
- }
- break;
- //数控回原位 (条件为自动工作,SON一直没有松开)
- case 50:
- // if(GL_CTHL_PARAM_CR_MODE == 0)
- // {
- // GL_CTHL_CL_MotorStep = 0;
- // GL_CTHL_HLJJ_VAVLE = 0;
- // GL_CTHL_HL_VAVLE = 0;
- // break;
- // }
- // else
- // {
- if(dwYRealPos > 150)
- { //回零速度
- SetDir(Y_AXIS, DIR_N);
- AxisMovePosAccDecNotStop(Y_AXIS,GL_CTHL_PARAM_CL_Back_O_Speed,-dwYRealPos + 150,5000,2000,25,25,50);
- }
- else
- AxisContinueMoveAcc(Y_AXIS,1000,DIR_N,1000,1000,15,15);
- GL_CTHL_CL_MotorStep = 51;
- // }
- break;
- case 51:
- if(GL_CTHL_SF_Origin_IN)
- {
- GL_CTHL_CL_MotorStep = 0;
- AxisEgmStop(Y_AXIS);
- SetPos(Y_AXIS, 0);
- }
- else
- {
- if(dwYRealPos < -65)
- {
- GL_CTHL_CL_MotorStep = 0;
- AxisEgmStop(Y_AXIS);
- SetPos(Y_AXIS, 0);
- GL_CTHL_SetAlarmCode(GL_CTHL_YAxis_Origin_ALARM,0);
- }
- }
- break;
- }
- #endif
- }
- void GL_CTHL_HeMo(void)
- {
- switch(GL_CTHL_HeMoStep)
- {
- case 1:
- GL_CTHL_HeMoStep = 2;
- GL_CTHL_CTXMXJ_VAVLE = 1;
- //GL_CTHL_JLTou_VAVLE = 0; //接拉头关
- GL_CTHL_HeMo_Time = dwTickCount + 10;
- //GL_CTHL_TimeBuff=dwTickCount;
-
- // GL_CTHL_HeMoStep = 4;
- // GL_CTHL_CTXMSS_VAVLE = 1;
- // GL_CTHL_HeMo_Time = dwTickCount + 1800;
- if(!GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 1; //插销上下
-
- break;
- case 2:
- if(dwTickCount >= GL_CTHL_HeMo_Time)
- {
- GL_CTHL_HeMoStep = 3;
- GL_CTHL_CTXMSS_VAVLE = 1;
- GL_CTHL_HeMo_Time = dwTickCount + 25;
- }
- break;
- case 3:
- if(dwTickCount >= GL_CTHL_HeMo_Time)
- {
- GL_CTHL_HeMoStep = 4;
- GL_CTHL_CTXMXJ_VAVLE = 0;
- GL_CTHL_HeMo_Time = dwTickCount + 1800;
- }
- break;
- case 4:
- if(!GL_CTHL_CTM_Origin_IN)
- GL_CTHL_JLTou_VAVLE = 0; //接拉头
- if(GL_CTHL_CTM_Limit_IN)
- {
- GL_CTHL_JLTou_VAVLE = 0; //接拉头
- GL_CTHL_HeMoStep = 0;
- //user_datas[127]=dwTickCount-GL_CTHL_TimeBuff;
- }
- else if((dwTickCount >= GL_CTHL_HeMo_Time)&& bRunning)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Limit_ALARM,bRunning); //穿头下模上升异常
- }
- break;
- case 10:
- GL_CTHL_HeMoStep = 11;
- GL_CTHL_CTXMXJ_VAVLE = 1;
- GL_CTHL_CTXMSS_VAVLE = 0;
-
- GL_CTHL_HeMo_Time = dwTickCount + GL_CTHL_PARAM_HSLYDTL_DELAY;
- //GL_CTHL_TimeBuff=dwTickCount;
- break;
- case 11:
- if(dwTickCount >= GL_CTHL_HeMo_Time)
- {
- //GL_CTHL_HeMoStep = 0;
- GL_CTHL_CTXMXJ_VAVLE = 0;
-
- }
- if(GL_CTHL_CTM_Origin_IN)
- {
- GL_CTHL_HeMoStep = 0;
- GL_CTHL_CTXMXJ_VAVLE = 0;
- //user_datas[127]=dwTickCount-GL_CTHL_TimeBuff;
- }
-
- break;
- }
- }
- //装拉头动作
- void GL_CTHL_ZLT_Step(void)
- {
- switch(GL_CTHL_ZhuangLiaoStep)
- {
- case 1:
-
- if(bZhuangLiaoOkFlg)
- {
- GL_CTHL_ZhuangLiaoStep = 0;
- }
-
-
- if(((GL_CTHL_MGuo_VAVLE && GL_CTHL_LTou_Check) || (!GL_CTHL_MGuo_VAVLE)) && !GL_CTHL_JLiao_Limit_IN )//说明没有拉头
- {
- //穿头模和一次穿入必须在原位,接料不能有输出
- if(GL_CTHL_CTM_Origin_IN && !GL_CTHL_CTXMSS_VAVLE)
- {
- GL_CTHL_First_CT_VAVLE = 0;
- GL_CTHL_JLTou_VAVLE = 0;
- GL_CTHL_MGuo_VAVLE = 0;
- if(GL_CTHL_TLiaoStep == 0)
- {
- GL_CTHL_TLiaoStep = 1;
- GL_CTHL_ZhuangLiaoStep = 2;
- }
- }
-
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay + 3000) //警告横送拉必须保证穿头模和一次穿入在原位,接料不能有输出
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,bRunning);
-
- }
- }
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay) //已经有拉头直接跳到结束
- {
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 40;
- GL_CTHL_ZhuangLiaoStep = 9;
- }
-
- break;
- case 2:
- if(GL_CTHL_TLiaoStep == 0) //推料已经完成
- {
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_JLTou_VAVLE = 0;
- GL_CTHL_MGuo_VAVLE = 0;
- if(!GL_CTHL_JLiao_Limit_IN && GL_CTHL_First_CT_Origin_IN)
- {
- GL_CTHL_ZhuangLiaoStep = 3;
- GL_CTHL_HSLiao_VAVLE = 1;
- }
- else
- {
- GL_CTHL_SetAlarmCode(YWX_CTHL_YCCRYWYC_ALARM,bRunning);
- }
- }
- break;
- case 3:
- //横送到位
- if(GL_CTHL_HSLiao_Limit_IN && !GL_CTHL_HSLiao_Origin_IN)
- {
- GL_CTHL_ZhuangLiaoStep = 4;
- // GL_CTHL_JLTou_VAVLE = 1; //接拉头输出,不需要时间
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 2;
- }
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_HSLiao_Limit_ALARM,bRunning);
- }
- break;
- case 4:
- if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay)
- {
- GL_CTHL_ZhuangLiaoStep = 5;
- GL_CTHL_JLTou_VAVLE = 1; //接拉头输出,不需要时间
- GL_CTHL_CTXMSS_VAVLE = 0; //Y20 穿头下模上升电磁阀
- GL_CTHL_CTXMXJ_VAVLE = 0; //Y21 穿头下模下降电磁阀
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- break;
- case 5:
- if(GL_CTHL_JLiao_Limit_IN)
- {
- GL_CTHL_ZhuangLiaoStep = 6;
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_PARAM_MaGou_DELAY;
- }
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay) //接拉头(接料)到们信号异常
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_JLiao_Limit_ALARM,bRunning);
- }
- break;
- case 6:
- if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay) //延时码勾
- {
- GL_CTHL_MGuo_VAVLE = 1; //码勾输出
- GL_CTHL_ZhuangLiaoStep = 7;
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_PARAM_HSLiaoOff_DELAY;
- bTuiLaTouOkFlg = 0; //认为拉头没法带出
- }
- break;
- case 7:
- if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay)
- {
- GL_CTHL_HSLiao_VAVLE = 0;
- GL_CTHL_ZhuangLiaoStep = 8;
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- break;
- case 8:
- if(!GL_CTHL_HSLiao_Limit_IN) //
- {
- GL_CTHL_ZhuangLiaoStep = 9;
- GL_CTHL_TLiaoStep = 1; //推拉头
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_PARAM_CheckLT_DELAY; //也是给下模能上升的时间
- }
- else if (GL_CTHL_LTou_Check) //时间内信号这说明没有拉头
- {
- //重送3次
- GL_CTHL_TryCnt++;
- GL_CTHL_JLTou_VAVLE = 0; //接拉头关
- // GL_CTHL_HeMoStep=10;
- GL_CTHL_MGuo_VAVLE = 0; //码勾打开
- if(GL_CTHL_TryCnt >= 3)
- {
- GL_CTHL_TryCnt = 0;
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_ZhuangLiaoStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_ZLT_ALARM,bRunning);
- cWULATOUCnt=1;
- }
- else
- {
- GL_CTHL_ZhuangLiaoStep = 20; //重新送3次
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- }
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_HSLiao_Limit_ALARM,bRunning);
- if(bRunning)
- {
- GL_CTHL_ZhuangLiaoStep = 0 ;
- }
- }
- break;
- case 9:
- if(GL_CTHL_LTou_Check) //时间内信号这说明没有拉头
- {
- GL_CTHL_TryCnt++;
- GL_CTHL_JLTou_VAVLE = 0; //接拉头关
- // GL_CTHL_HeMoStep=10;
- GL_CTHL_MGuo_VAVLE = 0; //码勾打开
- if(GL_CTHL_TryCnt >= 3)
- {
- GL_CTHL_TryCnt=0;
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_ZhuangLiaoStep = 0;
- GL_CTHL_SetAlarmCode(GL_CTHL_ZLT_ALARM,bRunning);
- cWULATOUCnt=1;
- }
- else
- {
- GL_CTHL_ZhuangLiaoStep = 20; //重新送3次
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- }
- else if((dwTickCount >= GL_CTHL_ZhuangLiaoDelay)) //|| GL_CTHL_HSLiao_Origin_IN)
- {
- bZhuangLiaoOkFlg = 1;
- GL_CTHL_ZhuangLiaoStep = 0;
- }
- break;
- //装拉头不成攻重新送拉头
- case 20:
- if(GL_CTHL_HSLiao_Origin_IN)
- {
- GL_CTHL_JLTou_VAVLE = 0; //接拉头关
- GL_CTHL_MGuo_VAVLE = 0; //码勾打开
- GL_CTHL_HeMoStep=10;
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 100;
- }
- else if(dwTickCount >= GL_CTHL_ZhuangLiaoDelay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_HSLiao_Origin_ALARM,bRunning);
- }
- break;
- }
- }
- void GL_CTHL_TLiao_Step(void)
- {
- switch(GL_CTHL_TLiaoStep)
- {
- case 1:
- if(bTuiLaTouOkFlg)
- {
- GL_CTHL_TLiaoStep = 0;
- }
- else
- {
- GL_CTHL_TLiao_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_TLiaoStep = 2;
- }
- break;
- case 2: //横送料在原位
- if(GL_CTHL_HSLiao_Origin_IN && !GL_CTHL_HSLiao_Limit_IN)// !GL_CTHL_HSLiao_VAVLE)
- {
- GL_CTHL_TLiao_VAVLE = 1; //推料(推拉头)输出
- GL_CTHL_TLiao_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_TLiaoStep = 3;
- }
- else if(dwTickCount >= GL_CTHL_TLiao_Delay)
- GL_CTHL_SetAlarmCode(GL_CTHL_HSLiao_Origin_ALARM,1);
- break;
- case 3: //推拉头到位
- if(GL_CTHL_TLiao_Limit_IN)
- {
- GL_CTHL_TLiao_Delay = dwTickCount + GL_CTHL_PARAM_TLiao_BACKDELAY;
- GL_CTHL_TLiaoStep = 4;
- }
- else if(dwTickCount >= GL_CTHL_TLiao_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_TLiao_Limit_ALARM,1);
- cWULATOUCnt=1;
- bSingOneFlg=1;
- bSingOneCnt=0;
- }
- break;
- case 4:
- if(dwTickCount >= GL_CTHL_TLiao_Delay)
- {
- GL_CTHL_TLiao_VAVLE = 0;
- GL_CTHL_TLiao_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_TLiaoStep = 5;
- }
- break;
- case 5:
- if(!GL_CTHL_TLiao_Limit_IN)
- {
- GL_CTHL_TLiaoStep = 0;
- GL_CTHL_TLiao_Delay = dwTickCount;
- bTuiLaTouOkFlg = 1;
- }
- else if(dwTickCount >= GL_CTHL_TLiao_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_TLiao_Limit_ALARM,0);
- cWULATOUCnt=1;
- bSingOneFlg=1;
- bSingOneCnt=0;
- }
- break;
- }
-
- }
- //振动盘控制
- void GL_CTHL_ZhenDongAction(void)
- {
-
- #if 1
- // if(bRunning)
- // {
- if(!GL_CTHL_PARAM_ZDP_AUTO)
- {
- if(GL_CTHL_ZhenDongPian_OUT == 1)
- {
- if(GL_CTHL_ZDP_IN)
- {
- if(dwTickCount >= GL_CTHL_ZDP_Delay)
- {
- GL_CTHL_ZhenDongPian_OUT = 0;
- GL_CTHL_ZDP_Delay = dwTickCount + GL_CTHL_PARAM_ZDP_Start_TIME;//GL_CTHL_PARAM_ZDP_Stop_TIME + 50;
- }
- }
- else
- {
- GL_CTHL_ZDP_Delay = dwTickCount + GL_CTHL_PARAM_ZDP_Stop_TIME;//GL_CTHL_PARAM_ZDP_Start_TIME;
- }
- }
- else
- {
- if(!GL_CTHL_ZDP_IN)
- {
- if(dwTickCount >= GL_CTHL_ZDP_Delay)
- {
- GL_CTHL_ZhenDongPian_OUT = 1;
- GL_CTHL_ZDP_Delay = dwTickCount + GL_CTHL_PARAM_ZDP_Stop_TIME ;//GL_CTHL_PARAM_ZDP_Start_TIME
- }
- }
- else
- GL_CTHL_ZDP_Delay = dwTickCount + GL_CTHL_PARAM_ZDP_Start_TIME ;//GL_CTHL_PARAM_ZDP_Stop_TIME+ 50;
- }
- }
- else if (GL_CTHL_PARAM_ZDP_AUTO ==1 )
- {
- GL_CTHL_ZhenDongPian_OUT=0;
- GL_CTHL_ZDP_Delay = dwTickCount + 0;
- }
- else if(GL_CTHL_PARAM_ZDP_AUTO == 2)
- {
- GL_CTHL_ZhenDongPian_OUT=1;
- GL_CTHL_ZDP_Delay = dwTickCount + 0;
-
- }
- //GL_CTHL_CuiQi_VAVLE = ~GL_CTHL_ZhenDongPian_OUT;
- #endif
- }
- void GL_CTHL_bFKCXTDDWStep(void)
- {
- switch(GL_CTHL_bFKCXTDDW_Step)
- {
- case 1:
-
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- GL_CTHL_FKGD_VAVLE = 0; //方块固定关
- GL_CTHL_bFKCXTDDW_Step = 2;
-
- break;
- case 2:
- if(!GL_CTHL_XKTD_Origin_IN) //斜口推带原位离开
- {
- GL_CTHL_bFKCXTDDW_Step = 3;
- GL_CTHL_bFKCXTDDW_Delay = dwTickCount + 20;
- }
- break;
- case 3://斜口定位
- if(dwTickCount >= GL_CTHL_bFKCXTDDW_Delay)
- {
- GL_CTHL_XKDW_VAVLE = 1;
- GL_CTHL_bFKCXTDDW_Step = 4;
- GL_CTHL_bFKCXTDDW_Delay = dwTickCount + GL_CTHL_PARAM_XKDW_TD_DELAY;
- }
- break;
- case 4:
- if(dwTickCount >= GL_CTHL_bFKCXTDDW_Delay)
- {
- AxisContinueMoveAcc(X_AXIS,GL_CTHL_PARAM_XKDW_Speed,DIR_P,GL_CTHL_PARAM_XKDW_Speed/2,GL_CTHL_PARAM_XKDW_Speed/2,10,10);//拖带电机
- GL_CTHL_bFKCXTDDW_Step = 5;
- GL_CTHL_XSavePosBuff = dwXRealPos;
- SetPos(X_AXIS, 0); //启动位置设为0点
- dwXRealPos = 0;
- }
- break;
- case 5:
- if(GL_CTHL_XKSC_Limit_IN) //方块到位
- {
- AxisEgmStop(X_AXIS);
- GL_CTHL_bFKCXTDDW_Step = 6;
- GL_CTHL_XKTD_VAVLE = 0; //斜口推带气缸关闭
-
- GL_CTHL_bFKCXTDDW_Delay = dwTickCount + 300;
-
- }
- else if(dwXRealPos >= (GL_CTHL_XSavePosBuff + 800))
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_FKCXDW_ALARM,bRunning);//方块插销定位异常警告
-
- }
- break;
- case 6:
- if(dwTickCount >= GL_CTHL_bFKCXTDDW_Delay)
- {
- GL_CTHL_GDXM_VAVLE=1;
- GL_CTHL_bFKCXTDDW_Step = 0;
- }
- break;
- }
- }
- //插销穿入动作
- void GL_CTHL_bCXCRStep(void)
- {
- switch(GL_CTHL_bCXCR_Step)
- {
- case 11:
- if(!GL_CTHL_CXDW_Stop)
- GL_CTHL_XKTD_VAVLE = 1; //斜口推带气缸输出
- GL_CTHL_FKGD_VAVLE = 0; //方块固定关
- GL_CTHL_bCXCR_Step = 12;
- break;
- case 12:
- if(!GL_CTHL_XKTD_Origin_IN || GL_CTHL_CXDW_Stop) //斜口推带原位离开
- {
- GL_CTHL_bCXCR_Step = 13;
- GL_CTHL_bCXCR_Delay = dwTickCount + 65;
- }
- break;
- case 13:
- // if(GL_CTHL_PARAM_CR_MODE == 1)
- // {
- if((GL_CTHL_CL_MotorStep == 0) && (GL_CTHL_SF_Origin_IN) && (dwTickCount >= GL_CTHL_bCXCR_Delay)) //插销前夹带回到原位
- {
- GL_CTHL_bCXCR_Step = 14;
- if(!GL_CTHL_CXDW_Stop)
- GL_CTHL_FKGD_VAVLE = 1; //方块固定关
- GL_CTHL_CXQJD_VAVLE = 1; //插销前夹带
- //GL_CTHL_SongDai_VAVLE = 1; //松带
- GL_CTHL_bCXCR_Delay = dwTickCount + 0;
- }
- // }//气缸穿入
- // else
- // {
- // GL_CTHL_bCXCR_Step = 14;
- // if(!GL_CTHL_CXDW_Stop)
- // GL_CTHL_FKGD_VAVLE = 1; //方块固定关
- // GL_CTHL_CXQJD_VAVLE = 1; //插销前夹带
- // //GL_CTHL_SongDai_VAVLE = 1; //松带
- // GL_CTHL_bCXCR_Delay = dwTickCount + 0;
- // }
- break;
- case 14:
- if(dwTickCount >= GL_CTHL_bCXCR_Delay)
- {
- GL_CTHL_bCXCR_Step = 15;
- if(!GL_CTHL_CXDW_Stop)
- GL_CTHL_FKGD_VAVLE = 1; //方块固定
- //Y轴启动插销
- GL_CTHL_CL_MotorStep = 20; //插销定位
- GL_CTHL_BB_VAVLE=1;
- }
- break;
- case 15:
- if(GL_CTHL_CL_MotorStep == 0) //插销定位完成
- {
- if(!GL_CTHL_CXDW_Stop)
- {
- GL_CTHL_bCXCR_Step = 16;
- GL_CTHL_CXDWZ_VAVLE = 1; //插销定位针(到位)电磁阀
- GL_CTHL_bCXCR_Delay = dwTickCount + 10; //延时插销下移
- }
- else
- {
- GL_CTHL_bCXCR_Step = 0;
- }
- GL_CTHL_CXDW_Stop = 0;
- }
- break;
- case 16:
- if(dwTickCount >= GL_CTHL_bCXCR_Delay)
- {
- GL_CTHL_bCXCR_Step = 17;
- if(!GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 0; //插销上下
- else
- GL_CTHL_CXSX_VAVLE = 1; //插销顶出
- GL_CTHL_bCXCR_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME; //插销下移异常时间
- }
- break;
- case 17:
- if(GL_CTHL_CXXY_Limit_IN)
- {
- // if(GL_CTHL_START_IN_UP)
-
-
- GL_CTHL_bCXCR_Step = 18;
- if( cXcxcrCnt==0 && !X_DRV) //拖带电机反转
- {
- // SetDir(X_AXIS, DIR_N);
- AxisMovePosAccDec(X_AXIS,10000,-GL_CTHL_PARAM_TDFZ_LENTH,800,600,6,6,0);
- }
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带电磁阀
- GL_CTHL_CXSCDW_VAVLE = 0; //Y21 插销上止定位关
- GL_CTHL_CXHJD_VAVLE = 1; //Y14 插销后夹带输出
- GL_CTHL_bCXCR_Delay = dwTickCount + GL_CTHL_PARAM_CXCR_DELAY;
- }
- else if(dwTickCount >= GL_CTHL_bCXCR_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CXGL_Limit_ALARM,bRunning);//插销下移异常
-
- }
- break;
- case 18:
- // if(START_IN_UP)
- {
- if(dwTickCount >= GL_CTHL_bCXCR_Delay)
- {
- GL_CTHL_bCXCR_Step = 19;
-
- GL_CTHL_CXHDW_VAVLE = 1; //插销后定位(插销穿入)
- GL_CTHL_bCXCR_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME +1000; //插销穿入到位异常时间
- //if(GL_CTHL_PARAM_CR_MODE == 1)
- GL_CTHL_CL_MotorStep = 50; //合链电机回原点
- }
- }
- break;
- case 19:
- // if( cXcxcrCnt > 1)
- {
- // GL_CTHL_SetAlarmCode(GL_CTHL_CX_Limit_ALARM,bRunning); //插销穿入到位异常
- }
-
- if( GL_CTHL_CX_Limit_IN )
- {
- cXcxcrCnt=0;
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_bCXCR_Step = 0;
- GL_CTHL_BB_VAVLE=0;
- // GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针(到位)电磁阀
-
- }
- else if (dwTickCount >= GL_CTHL_bCXCR_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CX_Limit_ALARM,bRunning); //插销穿入到
- GL_CTHL_bCXCR_Step = 0;
- /*
- cXcxcrCnt++;
-
- GL_CTHL_CXHJD_VAVLE=0;
- GL_CTHL_CXHDW_VAVLE=0;
- GL_CTHL_CXDWZ_VAVLE = 0;
- GL_CTHL_CXSX_VAVLE=1;
- GL_CTHL_bCXCR_Step = 11;
- */
- }
-
- break;
- }
- }
- void GL_CTHL_bCLFirstStep(void)
- {
- switch(GL_CTHL_bCLFirst_Step)
- {
- case 19:
- GL_CTHL_JLTou_VAVLE = 0; //接拉头
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_bCLFirst_Step = 20;
- GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针(到位)电磁阀
- GL_CTHL_bCLFirst_Delay = dwTickCount + GL_CTHL_PARAM_First_CL_DELAY;//延时一次穿入
- break;
- case 20:
- if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
- GL_CTHL_bCLFirst_Step = 21;
- GL_CTHL_First_CT_VAVLE = 1; //一次穿入电磁阀输出
- GL_CTHL_bCLFirst_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- break;
- case 21:
- if(!GL_CTHL_First_CT_Origin_IN) //原点离开后才开始时间
- {
- GL_CTHL_bCLFirst_Step = 22;
- GL_CTHL_bCLFirst_Delay = dwTickCount + GL_CTHL_PARAM_First_CL_Timer; //一次穿入时间
- }
- else if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_YCCRYWYC_ALARM,bRunning); //一次穿入原位异常
- }
- break;
- case 22:
- if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
- GL_CTHL_bCLFirst_Step = 23;
- GL_CTHL_MGuo_VAVLE = 0; //码勾退
- GL_CTHL_bCLFirst_Delay = dwTickCount + GL_CTHL_PARAM_MGOff_XiaMo_DELAY;
- GL_CTHL_FKGD_VAVLE = 0; //方块固定退
- GL_CTHL_CXHJD_VAVLE = 0; //Y14 插销后夹带打开
- if(GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 1; //插销上下
- else
- GL_CTHL_CXSX_VAVLE = 0; //插销顶出
- }
- break;
- case 23:
- if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
- GL_CTHL_bCLFirst_Step = 24;
- GL_CTHL_CTXMSS_VAVLE = 0; //穿头下模下降
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位(插销穿入)关闭
- GL_CTHL_bCLFirst_Delay = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- }
- break;
- case 24:
- if(!GL_CTHL_CTM_Limit_IN)
- {
- GL_CTHL_bCLFirst_Step= 25;
- GL_CTHL_bCLFirst_Delay = dwTickCount + 25; //一次穿入延时返回
- }
- else if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,bRunning); //穿头下模下降异常
- }
- break;
- case 25:
- if(dwTickCount >= GL_CTHL_bCLFirst_Delay)
- {
-
- GL_CTHL_bCLFirst_Step= 0;
- GL_CTHL_First_CT_VAVLE = 0; //一次穿入电磁阀关
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位(插销穿入)关闭
-
-
- //退下出错警告
- GL_CTHL_AutoDelay1 = dwTickCount + GL_CTHL_VAVLE_ERROR_TIME;
- GL_CTHL_AutoStep1 = 1;
- bTuiLaTouOkFlg = 1;
- }
- break;
- }
- }
- //手动动作
- void GL_CTHL_ManualAction(void)
- {
- if(bRunning) // 运行灯输出
- {
- GL_CTHL_Run_State=1;
- GL_CTHL_Stop_State=0;
- }
- else
- {
- GL_CTHL_Stop_State=1;
- GL_CTHL_Run_State=0;
- }
- if(GetEn(X_AXIS)==MOTOR_EN)
- GL_CTHL_X_EN_FLG=1;
- if(GetEn(Y_AXIS)==MOTOR_EN)
- GL_CTHL_Y_EN_FLG=1;
-
- if(dwTickCount>GL_CTHL_bSFBBAOJIN_Delay)
- {
- if((GetAlarm(X_AXIS)==MOTOR_ALARM) && GL_CTHL_X_EN_FLG) // 伺服报警
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_SF_ALR_ALARM,0);
- }
- if(GL_CTHL_PARAM_Y_ENSelect == 1)//步进
- {
- if((GetAlarm(Y_AXIS)==MOTOR_ALARM) && GL_CTHL_Y_EN_FLG) // 伺服报警
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_Y_SF_ALR_ALARM,0);
- }
- }
- else//伺服
- {
- if((GetAlarm(Y_AXIS)==MOTOR_NOALARM) && GL_CTHL_Y_EN_FLG) // 伺服报警
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_Y_SF_ALR_ALARM,0);
- }
- }
- SetClr(X_AXIS,ALARM_NOCLR);
- }
- if((dwYRealPos > (GL_CTHL_PARAM_Y_MAX_LENTH+20)) && Y_DRV && (GetDir(Y_AXIS)==DIR_P))
- {
- AxisEgmStop(Y_AXIS);
- // if(GL_CTHL_PARAM_CR_MODE != 0)
- // {
- GL_CTHL_SetAlarmCode(GL_CTHL_YAxis_Limit_ALARM,0);
- // }
- }
-
-
- if(bRunning == 0)
- {
- if(bClearTotal) //切断计数清零
- {
- bClearTotal = 0;
- ClrcToTal(QDCT_TOTAL_ADDR);
- }
- if(GL_CTHL_bTLiao ) //手动推料(推拉头)
- {
- GL_CTHL_bTLiao = 0;
- if(GL_CTHL_TLiao_VAVLE)
- GL_CTHL_TLiao_VAVLE = 0;//GL_CTHL_TLiao_VAVLE;
- else if(!GL_CTHL_HSLiao_VAVLE && GL_CTHL_HSLiao_Origin_IN)
- {
- GL_CTHL_TLiao_VAVLE = 1;
- }
- else//条件警告
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_HENSONGLIAO_ALARM,0); // 横送料不能输出
- }
- }
- if(GL_CTHL_bHSL) //手动横送料
- {
- GL_CTHL_bHSL= 0;
- if(!GL_CTHL_First_CT_VAVLE)
- {
- if(GL_CTHL_HSLiao_VAVLE)
- {
- GL_CTHL_HSLiao_VAVLE = 0;//~GL_CTHL_HSLiao_VAVLE;
- }
- else if(!GL_CTHL_TLiao_VAVLE && !GL_CTHL_TLiao_Limit_IN && GL_CTHL_CTM_Origin_IN && !GL_CTHL_JLiao_Limit_IN &&
- !GL_CTHL_JLTou_VAVLE && !GL_CTHL_CTXMSS_VAVLE && !GL_CTHL_CXDWZ_VAVLE && (!GL_CTHL_bMG || (GL_CTHL_bMG && GL_CTHL_LTou_Check)))
- {
- GL_CTHL_HSLiao_VAVLE = 1;
- }
- else //条件警告 最后一个括号条件为已经有拉头
- {
- if(GL_CTHL_TLiao_Limit_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_TLiao_Limit_ALARM,0);
- else if(!GL_CTHL_CTM_Origin_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,0);
- else if(GL_CTHL_JLiao_Limit_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_JLiao_Limit_ALARM,0);
- }
- }
- }
- if(GL_CTHL_bJLT) //接拉头
- {
- GL_CTHL_bJLT = 0;
- if(GL_CTHL_JLTou_VAVLE)
- GL_CTHL_JLTou_VAVLE = 0;
- else if(!GL_CTHL_First_CT_VAVLE && !GL_CTHL_CTXMSS_VAVLE && GL_CTHL_CTM_Origin_IN && GL_CTHL_First_CT_Origin_IN)
- {
- GL_CTHL_MGuo_VAVLE = 0;
- GL_CTHL_JLTou_VAVLE = 1;
- GL_CTHL_CTXMXJ_VAVLE = 0;
- }
- else//条件警告
- {
- if(!GL_CTHL_CTM_Origin_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_CTM_Origin_ALARM,0);
- else if(!GL_CTHL_First_CT_Origin_IN)
- GL_CTHL_SetAlarmCode(GL_CTHL_First_CT_Origin_ALARM,0);
- }
- }
- if(GL_CTHL_bMG) //码勾
- {
- GL_CTHL_bMG = 0;
- GL_CTHL_MGuo_VAVLE = !GL_CTHL_MGuo_VAVLE;
- }
- if(GL_CTHL_bFKJD) //方块夹带
- {
- GL_CTHL_bFKJD = 0;
- GL_CTHL_FKJD_VAVLE = !GL_CTHL_FKJD_VAVLE;
- }
- if(GL_CTHL_bXKTD) //斜口推带
- {
- GL_CTHL_bXKTD = 0;
- if(GL_CTHL_XKTD_VAVLE)
- GL_CTHL_XKTD_VAVLE = 0;
- else if(((!GL_CTHL_DXK_VAVLE && (!GL_CTHL_XKSC_Limit_IN || !GL_CTHL_CTXMSS_VAVLE)) || (GL_CTHL_PARAM_UP_DOWN_OUT_SELECT == 1)) || GL_CTHL_PARAM_QianMaSelect)
- GL_CTHL_XKTD_VAVLE = 1;
- else//条件警告
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_DXKCTXM_Origin_ALARM,0);
- }
- }
- if(GL_CTHL_bXKDW) //斜口定位
- {
- GL_CTHL_bXKDW = 0;
- GL_CTHL_XKDW_VAVLE = ~GL_CTHL_XKDW_VAVLE;
- }
- if(GL_CTHL_bCTXM) //穿头下模
- {
- GL_CTHL_bCTXM = 0;
- if(GL_CTHL_CTXMSS_VAVLE)
- {
- GL_CTHL_HeMoStep = 10;
-
- // GL_CTHL_JLTou_VAVLE = 0;
- // GL_CTHL_CTXMXJ_VAVLE = 0;
- GL_CTHL_CTXMSS_VAVLE = 0;
- }
- else if(!GL_CTHL_HSLiao_VAVLE && GL_CTHL_HSLiao_Origin_IN && (!GL_CTHL_XKSC_Limit_IN || !GL_CTHL_XKTD_VAVLE))
- {
- // GL_CTHL_MGuo_VAVLE = 1;
- GL_CTHL_HeMoStep = 1;
- // GL_CTHL_CTXMSS_VAVLE = 1;
- // GL_CTHL_CTXMXJ_VAVLE = 1;
- // GL_CTHL_XMXJ_Time = dwTickCount + 450;
- }
- }
- if(GL_CTHL_bDXK) //顶斜口
- {
- GL_CTHL_bDXK = 0;
- if(GL_CTHL_DXK_VAVLE)
- {
- GL_CTHL_DXK_VAVLE = 0;
- }
- else if(!GL_CTHL_XKTD_VAVLE)
- {
- GL_CTHL_DXK_VAVLE = 1;
- GL_CTHL_GDXM_VAVLE = 1;
- }
- else //条件警告
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_XKTD_ALARM,0);
- }
- }
- if(GL_CTHL_bXKGD) //固定斜码电磁阀
- {
- GL_CTHL_bXKGD = 0;
- GL_CTHL_GDXM_VAVLE = ~GL_CTHL_GDXM_VAVLE;
- }
- if(GL_CTHL_bFKGD) //方块固定
- {
- GL_CTHL_bFKGD = 0;
- GL_CTHL_FKGD_VAVLE = ~GL_CTHL_FKGD_VAVLE;
- }
- if(GL_CTHL_bCXQJD) //插销前夹带
- {
- GL_CTHL_bCXQJD = 0;
- GL_CTHL_CXQJD_VAVLE = ~GL_CTHL_CXQJD_VAVLE;
- }
- if(GL_CTHL_bCXSY) //插销下移电磁阀
- {
- GL_CTHL_bCXSY = 0;
- GL_CTHL_CXSX_VAVLE = !GL_CTHL_CXSX_VAVLE;
- }
- //
- if(GL_CTHL_bCXHT)
- {
- GL_CTHL_bCXHT = 0;
- //GL_CTHL_CXHT_VAVLE = ~GL_CTHL_CXHT_VAVLE;
- if(GL_CTHL_CL_MotorStep == 0)
- GL_CTHL_CL_MotorStep = 20;
- SetEn(Y_AXIS, MOTOR_EN);
- GL_CTHL_CXDW_Stop = 1;
- }
- if(GL_CTHL_bBB)
- {
- GL_CTHL_bBB = 0;
- GL_CTHL_BB_VAVLE = ~GL_CTHL_BB_VAVLE;
- }
-
- if(GL_CTHL_bCXDWZ) //Y14 插销定位针电磁阀
- {
- GL_CTHL_bCXDWZ = 0;
- if(GL_CTHL_CXDWZ_VAVLE)
- GL_CTHL_CXDWZ_VAVLE = 0;
- else if(GL_CTHL_HSLiao_Origin_IN)
- {
- GL_CTHL_CXDWZ_VAVLE = 1;
- }
- else //条件警告
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_HENSONGLIAO_ALARM,0);
- }
-
- }
- if(GL_CTHL_bCXHJD) //Y15 插销后夹带电磁阀
- {
- GL_CTHL_bCXHJD = 0;
- GL_CTHL_CXHJD_VAVLE =~GL_CTHL_CXHJD_VAVLE;
- }
- if(GL_CTHL_bCXHDW) //Y16 插销后定位电磁阀
- {
- GL_CTHL_bCXHDW = 0;
- if(GL_CTHL_CXHDW_VAVLE)
- GL_CTHL_CXHDW_VAVLE = 0;
- else if(!GL_CTHL_CXQJD_VAVLE)
- GL_CTHL_CXHDW_VAVLE = 1;
- else//条件警告
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_CXQJD_ALARM,0);
- }
- }
- if(GL_CTHL_bFirst_CT) //Y20 一次穿头电磁阀
- {
- GL_CTHL_bFirst_CT = 0;
- GL_CTHL_First_CT_VAVLE = ~GL_CTHL_First_CT_VAVLE;
- }
- if(GL_CTHL_bHLJJ) //Y21 合链夹具电磁阀
- {
- GL_CTHL_bHLJJ = 0;
- GL_CTHL_HLJJ_VAVLE = ~GL_CTHL_HLJJ_VAVLE;
- }
- if(GL_CTHL_bHL)
- {
- GL_CTHL_bHL = 0;
- }
-
- if(GL_CTHL_bCXSCDW) //Y23 插销上止定位电磁阀
- {
- GL_CTHL_bCXSCDW = 0;
- GL_CTHL_CXSCDW_VAVLE = ~GL_CTHL_CXSCDW_VAVLE;
- }
- //自动装料
- if(GL_CTHL_bAutoZhuangLiao)
- {
- GL_CTHL_bAutoZhuangLiao = 0;
- if(GL_CTHL_ZhuangLiaoStep == 0)
- {
- bTuiLaTouOkFlg = 1;
- bZhuangLiaoOkFlg = 0;
- GL_CTHL_ZhuangLiaoStep = 1;
- GL_CTHL_MGuo_VAVLE = 1; //判断是否已经有料
- GL_CTHL_ZhuangLiaoDelay = dwTickCount + 150;
- }
- }
- //测试电机
- if(GL_CTHL_bCLMotor_N)
- {
- SetEn(Y_AXIS, MOTOR_EN);
- if(!GL_CTHL_SF_Origin_IN)
- {
- if(!Y_DRV)
- // Y轴 运行速度 启动速度 加速度 减速度
- AxisContinueMoveAcc(Y_AXIS,2000,DIR_N,1000,1000,15,15);
- }
- else
- {
- GL_CTHL_bCLMotor_N = 0;
- }
-
- }
-
- if(GL_CTHL_bCLMotor_P) //后退限位已经取消
- {
- SetEn(Y_AXIS, MOTOR_EN);
- if(!Y_DRV)
- // Y轴 运行速度 启动速度 加速度 减速度
- AxisContinueMoveAcc(Y_AXIS,2000,DIR_P,1000,1000,15,15);
- }
-
-
-
- if(!GL_CTHL_bCLMotor_P && !GL_CTHL_bCLMotor_N && (GL_CTHL_TD_MotorStep == 0) && (GL_CTHL_bFKCXTDDW_Step==0)&& (GL_CTHL_CL_MotorStep == 0))
- {
- AxisEgmStop(Y_AXIS);//AxisDecStop(Y_AXIS);
- }
-
- /* if(GL_CTHL_bCLMotor_N)
- {
- GL_CTHL_bCLMotor_N=0;
- SetEn(Y_AXIS, MOTOR_EN);
-
- if(!Y_DRV)
- // Y轴 运行速度 启动速度 加速度 减速度
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,-GL_CTHL_PARAM_CL_Length,2000,2000,50,50,50);
- }
-
- if(GL_CTHL_bCLMotor_P) //后退限位已经取消
- {
- GL_CTHL_bCLMotor_P=0;
- SetEn(Y_AXIS, MOTOR_EN);
- if(!Y_DRV)
- // Y轴 运行速度 启动速度 加速度 减速度
- AxisMovePosAccDec(Y_AXIS,GL_CTHL_PARAM_CL_Speed,GL_CTHL_PARAM_CL_Length,2000,2000,50,50,50);
- }
- */
- //合链电机返回原点
- if(GL_CTHL_bCLMotor_O)
- {
- GL_CTHL_bCLMotor_O = 0;
- if(GL_CTHL_CL_MotorStep == 0)
- GL_CTHL_CL_MotorStep = 40;
- }
-
- //拖带方块定位 ,因这步为前拖带定位, 很多电磁阀要关掉
- if(GL_CTHL_bFKTDDW)
- {
- GL_CTHL_bFKTDDW = 0;
- if(GL_CTHL_TD_MotorStep == 0)
- {
- GL_CTHL_XKDW_VAVLE = 0; //斜口定位
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带
- //GL_CTHL_CXSX_VAVLE = 1; //插销下移
- GL_CTHL_CXHJD_VAVLE = 0; //插销后夹带
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位
- GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针
- GL_CTHL_bHLJJ = 0; //合链夹具
- GL_CTHL_FKJD_VAVLE = 0; //方块夹带
- if((GetEn(X_AXIS) == MOTOR_DISEN))
- {
- SetEn(X_AXIS, MOTOR_EN);
- GL_CTHL_TD_MotorDelay = dwTickCount + 200;
- }
- else
- GL_CTHL_TD_MotorDelay = dwTickCount + 50;
- GL_CTHL_TD_MotorStep = 1;
- GL_CTHL_cZipCnt = 0;
- }
- }
- //拖带方块插销定位(斜口推带,斜口定位,顶斜口)
- if(GL_CTHL_bFKCXTDDW)
- {
- GL_CTHL_bFKCXTDDW = 0;
- if((GL_CTHL_bFKCXTDDW_Step == 0) && (GL_CTHL_CL_MotorStep == 0) &&
- !GL_CTHL_CTXMSS_VAVLE)
- {
- GL_CTHL_bFKCXTDDW_Step = 1;
- SetEn(X_AXIS, MOTOR_EN);
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带
- //GL_CTHL_CXSX_VAVLE = 1; //插销上下
- GL_CTHL_CXHJD_VAVLE = 0; //插销后夹带
- GL_CTHL_CXHDW_VAVLE = 0; //插销后定位
- GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针
- GL_CTHL_HLJJ_VAVLE = 0; //合链夹具
- }
- }
- //插销穿入(包含电机前定位,插销下移,后夹,后定位)
- if(GL_CTHL_bCXCR)
- {
- GL_CTHL_bCXCR = 0;
- //拉头模在上面到们并且码勾输出,判断有拉头
- if(GL_CTHL_CTXMSS_VAVLE && GL_CTHL_MGuo_VAVLE && !GL_CTHL_CXQJD_VAVLE &&
- GL_CTHL_CTM_Limit_IN && !GL_CTHL_LTou_Check)
- {
- if(GL_CTHL_CL_MotorStep == 0)
- {
- GL_CTHL_bCXCR_Step = 11;
- if(GL_CTHL_PARAM_XCDW_MODE)
- GL_CTHL_CXSX_VAVLE = 1; //插销上下
- else
- GL_CTHL_CXSX_VAVLE = 0; //插销顶出
-
- GL_CTHL_CXHJD_VAVLE = 0; //插销后夹带
- GL_CTHL_CXHDW_VAVLE = 0;
- //GL_CTHL_HL_VAVLE = 0;
-
- // if(GL_CTHL_PARAM_CR_MODE==0)
- // GL_CTHL_CXSCDW_VAVLE = 1;
- // if(GL_CTHL_PARAM_CR_MODE == 1)
- // {
- SetEn(Y_AXIS, MOTOR_EN);
- if(!GL_CTHL_SF_Origin_IN)
- GL_CTHL_CL_MotorStep = 40;
- // }
- }
- }
- else //警告不能自动穿插销
- {
- GL_CTHL_SetAlarmCode(GL_CTHL_WFZIDONGCX_ALARM,0);
- }
- }
- //电机合链动作
- if(GL_CTHL_bMotorHL)
- {
- GL_CTHL_bMotorHL = 0;
- // if(GL_CTHL_PARAM_CR_MODE == 1)
- // {
- if(GL_CTHL_SF_Origin_IN)
- {
- if((GL_CTHL_CL_MotorStep == 0) && !GL_CTHL_CTXMSS_VAVLE && (!GL_CTHL_CTM_Limit_IN))
- {
- bCL_OK_FLG = 0;
- GL_CTHL_HLJJ_VAVLE = 1; //Y20 合链夹具电磁阀输出后,电机穿入
- GL_CTHL_CL_MotorStep = 1;
- GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_HLJJ_CL_DELAY + 130;
- if((GetEn(Y_AXIS) == MOTOR_DISEN))
- {
- SetEn(Y_AXIS, MOTOR_EN);
- GL_CTHL_CL_MotorDelay = dwTickCount + 250;
- }
- if((GL_CTHL_LianLengthAutoCheck ==0) || (GL_CTHL_PARAM_CL_Length == 0))
- {
- GL_CTHL_LianLengthAutoCheck = 1000;
- GL_CTHL_PARAM_CL_Length = 1000;
- }
- }
- // }
- else
- {
- GL_CTHL_bCLMotor_O = 1;
- }
- }
- else
- {
- GL_CTHL_HLJJ_VAVLE = 1; //Y20 合链夹具电磁阀输出后,电机穿入
- GL_CTHL_CL_MotorStep = 1;
- GL_CTHL_CL_MotorDelay = dwTickCount + GL_CTHL_PARAM_HLJJ_CL_DELAY;
- }
- }
- //一次穿链动作
- if(GL_CTHL_bCL_First)
- {
- GL_CTHL_bCL_First = 0;
- //拉头模在上面到们并且码勾输出,判断有拉头
- if(GL_CTHL_CTXMSS_VAVLE && GL_CTHL_MGuo_VAVLE && !GL_CTHL_CXQJD_VAVLE &&
- GL_CTHL_CTM_Limit_IN && !GL_CTHL_LTou_Check && (GL_CTHL_CL_MotorStep == 0))
- {
- GL_CTHL_bCLFirst_Step = 19;
- GL_CTHL_CXHJD_VAVLE = 1; //插销后夹带
- GL_CTHL_CXDWZ_VAVLE = 0; //插销定位针(到位)电磁阀
- GL_CTHL_CXQJD_VAVLE = 0; //插销前夹带
- }
- }
- }
- }
- #endif
|