1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564 |
- #include "global.h"
- #if TONG_YONG_MACHINE
- unsigned char FKCX_cGeiLiaoNum,FKCX_bStopOver,FKCX_bStopXiao,FKCX_bStopFang,FKCX_bStopXiaCong = 0,FKCX_bXiaCong;
- unsigned short cCountOutTime;
- /**************************************
- ** 函数名称:void ChaXiaoJi(void)
- ** 函数功能:方块插稍机动作函数
- ** 输入输出说明:
- 输入:
- X0 插销启动
- X1 停止开关
- X2 方块启动
- X3 手动钩针
- X4 手动压带
- X5 方块.插销选择
- X6 手动给料
- X7 手动夹料
- X10 手动送料
- X11 手动下冲
- X12 过链接近开关
- X13 下冲感应接近开关
- X14 夹插销光电开关
- X15 夹方块光电开关
- X16 送插销到位磁感
- X17 退送插销到位磁感
- X20 送方块到位磁感
- X21 退送方块到位磁感
- X22 压带磁感
- X23 给插销磁感
- X24 给方块磁感
- X25 冲针选择
- X26 冲针保护
- X27 打单边
- 输出:
- Y0 离合器
- Y1 计数
- Y2 插销运行指示 (触摸屏时为振动盘)
- Y3 方块运行指示 (触摸屏时为警告蜂鸣器)
- Y4 方块垫块电磁阀
- Y5 压带电磁阀
- Y6 下冲电磁阀
- Y7 插销垫块电磁阀
- Y10 给插销电磁阀
- Y11 夹插销电磁阀
- Y12 送插销电磁阀
- Y13 送方块电磁阀
- Y14 夹方块电磁阀
- Y15 给方块电磁阀
- Y16 勾针电磁阀
- Y017 冲子选择电磁阀
- D0 给插销(方块)到位后延时退回
- D1 送插捎(方块)到位夹打开延时退回
- D2 下冲输出时间
- D3 给料次数
- D4 给料故障后下一次给料时间
- D5 给料到前点的最长时间
- D6 延时停离合
- D7 延时上勾针
- D8 普通方块插销设置(2.55)
- 上下拉方块插销设置(0.55)
- D9 加速时间
- D10 起动速度
- D11 最高速度
- D12 下冲感应方式(0 老方式 1 新常亮方式)
- ***************************************/
- unsigned char FKCX_cReady,FKCX_cHalfRun,FKCX_cYaDai,FKCX_cSelectXiaChong,FKCX_YaDaiError,FKCX_cXiaChongStep = 0,FKCX_bRunning,FKCX_bStop;
- unsigned long FKCX_cErrorTime,FKCX_cErrorTime1,FKCX_cStartKeyDelay,FKCX_cTotal,FKCX_cTestNum,FKCX_cErrorTime2;
- unsigned long FKCX_JiaXiao(unsigned long En_Dis);
- unsigned long FKCX_SongXiao(unsigned long En_Dis);
- unsigned long FKCX_Motor(unsigned long En_Dis);
- unsigned long FKCX_JiaFang(unsigned long En_Dis);
- unsigned long FKCX_SongFang(unsigned long En_Dis);
- void FKCX_XiaChongStep(void);
- //故障报警
- void FKCX_SetAlarmCode(unsigned alarm_code)
- {
- SetAlarmCode(FKCX_ALARM_ADDR,alarm_code);
- FKCX_bStop = 1;
- }
- void FKCX_InitAction(void)
- {
- XGearRatio = 1;
- YGearRatio = 1;
- }
- void FKCX_XiaChongStep(void)
- {
- static unsigned long dwXiaChongDelay;
- unsigned short ch,i;
- switch(FKCX_cXiaChongStep)
- {
- case 1:
- {
- if(FKCX_XC_ENABLE)
- {
- AxisMoveTwoPos(Y_AXIS,FKCX_XC_SPEED,2000,1,9999999,0);
- SETY006();
- }
- else
- FKCX_cXiaChongStep = 0;
- }
- break;
- case 2:
- {
- if(X13_UP)
- {
- dwXiaChongDelay = dwTickCount + user_datas[17]*10;
- FKCX_cXiaChongStep = 3;
- }
- else if(dwTickCount >= dwXiaChongDelay)
- {
- FKCX_SetAlarmCode(16);
- }
- }
- break;
- case 3:
- {
- if(dwTickCount >= dwXiaChongDelay)
- {
- AxisEgmStop(Y_AXIS);
- CLRY006();
- FKCX_cXiaChongStep = 4;
- }
- }
- break;
- case 4:
- {
- if(!Y_DRV) FKCX_cXiaChongStep = 0;
- }
- break;
- case 10:
- {
- AxisMoveTwoPos(Y_AXIS,FKCX_XC_SPEED,2000,1,0,0);
- SETY006();
- dwXiaChongDelay = dwTickCount + 50;
- FKCX_cXiaChongStep = 11;
- }
- break;
- case 11:
- {
- if(dwTickCount >= dwXiaChongDelay)
- {
- AxisEgmStop(Y_AXIS);
- CLRY006();
- FKCX_cXiaChongStep = 0;
- }
- }
- break;
- case 20:
- {
- AxisContinueMove(Y_AXIS,FKCX_XC_SPEED,FKCX_DIR_P);
- FKCX_cXiaChongStep = 21;
- SETY006();
- }
- break;
- default:;
- }
-
- }
- void FKCX_Action(void)
- {
- unsigned long i,j;
- static unsigned long c10msDelay = 0;
- if(FKCX_bRunning)
- {
- if(FKCX_cHalfRun == 0)
- {
- M00 = 0;
- M01 = 0;
- M03 = 0;
- M04 = 0;
- M05 = 0;
- M06 = 0;
- M07 = 0;
- M08 = 0;
- M09 = 0;
- M10 = 0;
- M11 = 0;
- M12 = 0;
- M13 = 0;
- M14 = 0;
- }
- }
- else
- {
- if(M12 == 0)SETDR();
- }
-
- if(dwTickCount >= c10msDelay)
- {
- c10msDelay = dwTickCount+10;
- if(cCountOutTime > 0)
- {
- cCountOutTime--;
- if(cCountOutTime == 0)CLRY001();
- }
- }
-
- if(!FKCX_bRunning)
- {
- if(M25)
- {
- M25 = 0; //M25
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep = 10;
- }
-
- if(M12)
- {
- if((cStepMByte2==0)&& !X_DRV)
- {
- MoveAction_Const_AccDec(X_AXIS, FKCX_DIR_P, user_datas[11],user_datas[10],user_datas[9],10);
- }
- }
- else
- {
- if((cStepMByte2==0) && X_DRV)
- {
- AxisEgmStop(X_AXIS);
- }
- }
-
- if(M27)
- {
- M27 = 0; //M27
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep = 20;
- }
- }
- if(M15) //M15 故障确定
- {
- M15 = 0;
- user_datas[100] = 0;
- cDelayTime7 = dwTickCount + 1010;
- CLRY003();
- }
- if(M09) //清产量
- {
- if(dwTickCount >= cDelayTime8)
- {
- M09 = 0;
- ClrcToTal(76);
- }
- }
- else
- {
- cDelayTime8 = dwTickCount + 200*10;
- }
-
-
- if(user_datas[71])
- SETY02();
- else
- CLRY02();
-
- //手动模式
- //手条件
- if((!X01 || Y04 || Y07) && !FKCX_bRunning)
- {
- if(!M10)
- {
- //变为插稍方式
- if(Y010) //插稍给料
- {
- M19 = 1;
- }
- if(Y011) //插稍夹料
- {
- M20 = 1;
- }
- if(Y012) //插稍夹料
- {
- M21 = 1;
- }
- }
- else
- {
- //变为方块方式
- if(Y015) //方块给料
- {
- M19 = 1;
- }
- if(Y014) //方块夹料
- {
- M20 = 1;
- }
- if(Y013) //方块夹料
- {
- M21 = 1;
- }
- }
- //手动下冲
- if(X11_UP || M08)
- {
- M08 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 10*10;
- // 送插销 送方块 退送插销到位 退送方块到位
- if((Y012 == 0) && (Y013 == 0) && (X017 != 0) && (X021 != 0)
- //勾针电磁阀 压带磁感 手动下冲 上升延
- &&(Y016 == 0) && (X022 != 0) && ((user_datas[12] == 0) || X013) )
- {
- //方块\插销选择
- if(X005 || (M10 == 0))//插销
- {
- SETY007();
- CLRY004();
- }
- else //方块
- {
- SETY004();
- CLRY007();
- }
- SETY006(); //下冲电磁阀
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- cDelayTime1 = dwTickCount + user_datas[2]*10;
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- M14 = 1; //M14
- }
- else //下冲条件不满足警告
- {
- SETY003();
- if(Y005 == 0)FKCX_SetAlarmCode(ERY05);
- else if(Y012 != 0)FKCX_SetAlarmCode(ERY12);
- else if(Y013 != 0)FKCX_SetAlarmCode(ERY13);
- else if(Y016 != 0)FKCX_SetAlarmCode(ERY16);
- else if(X017 == 0)FKCX_SetAlarmCode(ERX17);
- else if(X021 == 0)FKCX_SetAlarmCode(ERX21);
- else if(X013 == 0)FKCX_SetAlarmCode(ERX13);
- else FKCX_SetAlarmCode(ERX22);
- }
- }
- }
- if((Y006 != 0))
- {
- if(X13_DW || ((user_datas[12] == 0) && (dwTickCount >= cDelayTime1)))
- {
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- cDelayTime1 = dwTickCount + 50;
- }
- }
- if((X013 != 0) && ((user_datas[12] == 0) || ((dwTickCount >= cDelayTime1) && !Y006)))
- {
- CLRY004(); //方块垫片
- CLRY007(); //方块垫片
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- M16 = 0; //M16
- M14 = 0;
- }
- else if(M14 && (dwTickCount >= FKCX_cErrorTime) && (FKCX_XC_ENABLE==0)) //下冲故障警告
- {
- M14 = 0;
- FKCX_SetAlarmCode(12);
- SETY003();
- CLRY004(); //方块垫片
- CLRY007(); //方块垫片
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- }
- //手动勾针
- if(X003 || (M3))
- {
- M3 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 60;
- if(Y016)CLRY016();
- // 方块垫片 插稍垫片 下冲
- else if((Y004 == 0) && (Y007 == 0) && (Y006 == 0) &&
- // 送插稍 送方块 送插稍到位 送方块到位
- (Y012 == 0) && (Y013 == 0) && (X016 == 0) && (X020 == 0))
- {
- SETY016();
- }
- else //勾针条件不满足警告
- {
- SETY003();
- if(Y004 != 0)FKCX_SetAlarmCode(ERY04);
- else if(Y006 != 0)FKCX_SetAlarmCode(ERY06);
- else if(Y007 != 0)FKCX_SetAlarmCode(ERY07);
- else if(Y012 != 0)FKCX_SetAlarmCode(ERY12);
- else if(Y013 != 0)FKCX_SetAlarmCode(ERY13);
- else if(X016 != 0)FKCX_SetAlarmCode(ERX16);
- else FKCX_SetAlarmCode(ERX20);
- }
- }
- }
- //手动勾针完成
- //手动压带
- if(X004 || M4)
- {
- M4 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 8*10;
- if(Y005)CLRY005();
- else
- {
- SETY005();
- FKCX_cErrorTime1 = dwTickCount + FKCX_ERRORTIME;
- FKCX_YaDaiError = 1;
- }
- }
- if(Y005) //压带
- FKCX_cYaDai = 1;
- else
- FKCX_cYaDai = 0;
- }
- if(X022)
- {
- FKCX_YaDaiError = 0;
- }
- if(FKCX_YaDaiError && Y005 && (!X022) && (dwTickCount >= FKCX_cErrorTime1))
- {
- SETY003();
- FKCX_SetAlarmCode(13);
- FKCX_YaDaiError = 0;
- }
- //手动压带完成
- //手动送料
- // 手动送料
- if(FKCX_SongXiao(FKCX_TRUE) == FKCX_TRUE)cStepMByte5 = 0;
- if(FKCX_SongFang(FKCX_TRUE) == FKCX_TRUE)cStepMByte6 = 0;
-
- if(X010 || M7)
- {
- SETDR();
- M7 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 10*10;
- if(X005 || (M10 == 0)) //手动送插销
- {
- CLRY013();
- if(Y012)
- {
- cStepMByte5 = 3;
- cDelayTime5 = dwTickCount + 5;
- }
- // 方块有料 勾针阀 插销垫片 方块垫片 下冲阀 给料电磁阀 给料前点
- else if((X015 != 0) && (Y016 == 0) && (Y007 == 0) && (Y004 == 0) && (Y006 == 0) && (Y010 == 0) && (X023 == 0))
- {
- SETY012();
- }
- else //送料不满足条件
- {
- SETY003();
- if(Y004 != 0)FKCX_SetAlarmCode(ERY04);
- else if(Y006 != 0)FKCX_SetAlarmCode(ERY06);
- else if(Y007 != 0)FKCX_SetAlarmCode(ERY07);
- else if(Y010 != 0)FKCX_SetAlarmCode(ERY10);
- else if(Y016 != 0)FKCX_SetAlarmCode(ERY16);
- else if(X015 == 0)FKCX_SetAlarmCode(ERX15);
- else if(X023 != 0)FKCX_SetAlarmCode(ERX23);
-
- }
- }
- else //手动送方块
- {
- CLRY012();
- if(Y13)
- {
- cStepMByte6 = 3;
- cDelayTime6 = dwTickCount + 5;
- }
- // 勾针阀 插销垫片 方块垫片 下冲阀 给料电磁阀 给料前点
- else if((Y016 == 0) && (Y007 == 0) && (Y004 == 0) && (Y006 == 0) && (Y015 == 0) && (X024 == 0))
- {
- SETY013();
- }
- else //送料不满足条件
- {
- SETY003();
- if(Y004 != 0)FKCX_SetAlarmCode(ERY04);
- else if(Y006 != 0)FKCX_SetAlarmCode(ERY06);
- else if(Y007 != 0)FKCX_SetAlarmCode(ERY07);
- else if(Y015 != 0)FKCX_SetAlarmCode(ERY15);
- else if(Y016 != 0)FKCX_SetAlarmCode(ERY16);
- else if(X024 != 0)FKCX_SetAlarmCode(ERX24);
- }
- }
- }
- }
- //手动送料完成
- //手动给料
- if(FKCX_JiaXiao(FKCX_TRUE) == FKCX_TRUE)cStepMByte3 = 0;
- if(FKCX_JiaFang(FKCX_TRUE) == FKCX_TRUE)cStepMByte4 = 0;
-
- if(X006 || M5)
- {
- M5 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 10*10;
- if(X005 || (M10 == 0)) //给插销
- {
- CLRY014();
- CLRY015();
- if(Y010)
- {
- CLRY011(); //夹插稍
- cStepMByte3 = 3;
- cDelayTime5 = dwTickCount + 50;
- }
- //送料在原点 在夹紧情况下无料 或夹张开 送料
- else if((X017 != 0) && (((Y011 == 0) && (X014 != 0)) || Y011) && (Y012 == 0)
- && (Y015 == 0) && (X021 != 0))
- {
- SETY010(); //给插稍
- SETY011(); //夹插稍
- }
- else //不满足给料
- {
- CLRY010();
- SETY003();
- if(((Y011 == 0) && (X014 == 0))) FKCX_SetAlarmCode(ERX14);
- else if(Y012 != 0) FKCX_SetAlarmCode(ERY12);
- else if(X017 == 0) FKCX_SetAlarmCode(ERX17);
- else FKCX_SetAlarmCode(ERX21);
- }
- }
- else //给方块
- {
- CLRY010();
- CLRY011();
- if((Y015))
- {
- CLRY014(); //夹方块
- cStepMByte4 = 3;
- cDelayTime6 = dwTickCount + 50;
- }
- //送料在原点 在夹紧情况下无料 或夹张开 送料
- else if((X021 != 0) && (((Y014 == 0) && (X015 != 0)) || Y014) && (Y013 == 0) &&(X017 != 0))
- {
- SETY015(); //给方块
- SETY014(); //夹方块
- }
- else //不满足给料
- {
- CLRY015();
- SETY003();
- if(((Y014 == 0) && (X015 == 0)))FKCX_SetAlarmCode(ERX15);
- else if(Y013 != 0) FKCX_SetAlarmCode(ERY13);
- else if(X021 == 0) FKCX_SetAlarmCode(ERX21);
- else FKCX_SetAlarmCode(ERX17);
- }
- }
- }
- }
-
- //手动给料完成
- //手动夹料
- if(X007 || M6)
- {
- M6 = 0;
- if(dwTickCount >= cDelayTime7)
- {
- cDelayTime7 = dwTickCount + 10*10;
- if(X005 || (M10 == 0) ) //给插销
- {
- CLRY014();
- if(Y011)
- CLRY011();
- else
- SETY011();
-
- }
- else //给方块
- {
- CLRY011();
- if(Y014)
- CLRY014();
- else
- SETY014();
- }
- }
- }
-
- //手动夹料完成
- }
- //互锁保护
- if((Y004 != 0) || (Y007 != 0))
- {
- CLRY012();
- CLRY013();
- }
- if((Y012 != 0) || (Y013 != 0))
- {
- CLRY004();
- CLRY007();
- }
- //新功能选择(冲针选择)
- if(X25_UP && (X27 == 0))
- {
- if(FKCX_cSelectXiaChong == 0)
- {
- FKCX_cSelectXiaChong = 1;
- if(Y007) //由垫片判断插稍还是方块
- {
- SETY017(); //插稍
- user_datas[88] = 1;
- }
- else
- {
- CLRY017();
- user_datas[88] = 0;
- }
- }
- else
- FKCX_cSelectXiaChong = 0;
- }
- else if(X027)
- {
- CLRY017(); //插稍
- }
- //手动下冲完成
- //自动
- //
- // 手动钩针 钩针输出 手动下冲 下冲输出
- if((FKCX_bRunning == 0) && (X003 == 0) && (Y016 == 0) && (X011 == 0) && (Y006 == 0) &&
- //手动给料 插稍给料 方块给料 手动夹料
- (X006 == 0) && (Y010 == 0) && (Y015 == 0) && (X007 == 0) &&
- //插稍夹料 方块夹料 手动送料 插稍送料 方块送料
- (Y011 == 0) && (Y014 == 0) && (X010 == 0) && (Y012 == 0) && (Y013 == 0) &&
- //方块选择 插稍送料原点 方块送料原点
- (X017 != 0) && (X021 != 0))
- {
- FKCX_cReady = 1;
- }
- else
- FKCX_cReady = 0;
-
- FKCX_XiaChongStep();
- //停止 故障停机 按停止键
- if((FKCX_bStop) || M2 || ((X01_UP) && (FKCX_cStartKeyDelay == 0)))
- {
- if(M2 || (X01_UP))
- CLRY003();
- FKCX_cStartKeyDelay = 8;
- FKCX_cHalfRun = 0;
- FKCX_bRunning = 0;
-
- AxisEgmStop(X_AXIS);
-
- if(FKCX_cXiaChongStep == 21)
- {
- AxisEgmStop(Y_AXIS);
- CLRY006();
- FKCX_cXiaChongStep = 0;
- }
- SETDR(); //电机放松
- M2 = 0;
- if(FKCX_bStopOver < 2)
- {
- FKCX_bStopOver++;
- }
- else
- FKCX_bStopOver = 0;
- FKCX_bStop = 0;
- //完全停止
- if((X022 == 0) || (FKCX_bStopOver == 0) || (X04_DW))
- {
- cStepMByte = 0;
- cStepMByte1 = 0;
- cStepMByte2 = 0;
- cStepMByte3 = 0;
- cStepMByte4 = 0;
- cStepMByte5 = 0;
- cStepMByte6 = 0;
- FKCX_bStopOver = 2;
- FKCX_bStopXiao = 0;
- FKCX_bStopFang = 0;
- FKCX_bStopXiaCong = 0;
- AxisEgmStop(X_AXIS);
- Y00 = 0;
- Y01 = 0;
- Y05 = 0;
- Y10 = 0;
- Y11 = 0;
- Y12 = 0;
- Y13 = 0;
- Y14 = 0;
- Y15 = 0;
- Y16 = 0;
- if((X004 != 0) || FKCX_cYaDai)
- {
- SETY005();
- }
- else if(Y017)
- {
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- SETY006(); //下冲电磁阀
- cDelayTime1 = dwTickCount + user_datas[2]*10;
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- }
- }
- else //故障停止
- {
- cStepMByte = 0;
- cStepMByte1 = 0;
- cStepMByte2 = 0;
- cStepMByte3 = 0;
- cStepMByte4 = 0;
- cStepMByte5 = 0;
- cStepMByte6 = 0;
- FKCX_bStopOver = 2;
- FKCX_bStopXiao = 0;
- FKCX_bStopFang = 0;
- FKCX_bStopXiaCong = 0;
- AxisEgmStop(X_AXIS);
- Y00 = 0;
- Y01 = 0;
- Y05 = 0;
- Y10 = 0;
- Y11 = 0;
- Y12 = 0;
- Y13 = 0;
- Y14 = 0;
- Y15 = 0;
- Y16 = 0;
- SETY005();
- }
- }
- //下冲时判断是否出错
-
- // 压带磁感
- //按插销起动 急停 方块工作指示
- if((X00_UP || M0 || (M11 && (M10 == 0))) && (FKCX_cReady != 0) && (X001 == 0)
- && ((FKCX_bStopFang) == 0) && ((X015 != 0) || FKCX_bStopXiaCong) && (FKCX_bRunning == 0))
- {
- SetAlarmCode(FKCX_ALARM_ADDR,0);
- if(M11)FKCX_cHalfRun = 1;
- M0 = 0;
- M11 = 0;
- FKCX_bStopXiao = 0;
- FKCX_bStopOver = 0;
- FKCX_bRunning = 1;
- cStepMByte2 = 0;
- cStepMByte3 = 0;
- FKCX_cGeiLiaoNum = 0;
- if(FKCX_bStopXiaCong != 0)
- {
- cStepMByte = 4;
- if(X015 != 0)
- cStepMByte4 = 1; //给方块开始
- else
- cStepMByte4 = 10;
- if(user_datas[8] != 55)
- {
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- SETY006(); //下冲
- SETY007(); //垫片
- cDelayTime1 = dwTickCount + user_datas[2]*10;
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- M14 = 1;
- }
- FKCX_bStopXiao = 0;
- }
- else
- cStepMByte = 1; //从插销开始
- }
- //按方块起动指示
- if(((X02_UP) || M1 || (M11 && M10 && X022 && Y005)) && (FKCX_cReady != 0) && (X001 == 0)
- && (FKCX_bRunning == 0) && (FKCX_bStopXiao == 0) && ((FKCX_bStopFang) != 0))
- {
- SetAlarmCode(FKCX_ALARM_ADDR,0);
- if(M11)FKCX_cHalfRun = 1;
- M1 = 0;
- M11 = 0;
- FKCX_bStopOver = 0;
- FKCX_bRunning = 1;
- cStepMByte3 = 0;
- cStepMByte2 = 0;
- FKCX_cGeiLiaoNum = 0;
- FKCX_bStopFang = 1;
- //之前已经送好料 直接下冲
- if((FKCX_bStopXiaCong) != 0)
- {
- cStepMByte4 = 0;
- cStepMByte = 7;
- SETY006(); //下冲
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- SETY004(); //方块垫片
- cDelayTime1 = dwTickCount + user_datas[2]*10;
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- M14 = 1;
- }
- else
- {
- cStepMByte = 5; //从方块开始
- if((X015 != 0))
- cStepMByte4 = 1;
- else
- cStepMByte4 = 10; //已经有料
- }
- }
- else
- {
- M1 = 0;
- if(M10)M11 = 0;
- }
- //从插销步开始工作
- if((cStepMByte == 1))
- {
- //电机开始
- if((Y005) && (X022 != 0)) //先压带
- {
- cStepMByte2 = 10;
- }
- else
- cStepMByte2 = 1;
- //给销开始
- cStepMByte3 = 1;
- FKCX_cGeiLiaoNum = 0;
- //转下一步
- cStepMByte = 2;
- FKCX_bStopXiaCong = 0;
- if(X014 == 0)cStepMByte3 = 10;
- }
- //等待给料,电机拖带
- if((cStepMByte == 2))
- {
- i = FKCX_Motor(FKCX_TRUE);
- FKCX_bStopXiao = 1;
- //没料
- j = FKCX_JiaXiao(FKCX_TRUE);
- //拖带和给料已完成
- if((i == FKCX_TRUE) && (j == FKCX_TRUE))
- {
- cStepMByte = 3;
- cStepMByte5 = 1; //送梢启动
- }
- }
- //送插销
- if((cStepMByte == 3))
- {
- if((user_datas[12] == 0) || X013)
- i = FKCX_SongXiao(FKCX_TRUE);
- //送料完毕(销)
- if(i == FKCX_TRUE)
- {
- cStepMByte = 4;
- if((FKCX_cHalfRun == 0) && (Y007 == 0)) //半
- {
- if((X015 != 0) && (X027 == 0)) //打单边
- cStepMByte4 = 1;
- else
- cStepMByte4 = 10; //已经有料
- FKCX_cGeiLiaoNum = 0;
- }
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- if(user_datas[8] != 55)
- {
- if(Y007)
- {
- if(dwTickCount >= cDelayTime1)
- {
- cStepMByte = 4;
- SETY006(); //下冲
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- cDelayTime1= dwTickCount + user_datas[2]*10;
- }
- }
- else
- {
- cStepMByte = 3;
- SETY007(); //垫片
- cDelayTime1= dwTickCount + user_datas[13]*10;
- }
- M14 = 1;
- }
- }
- }
- //下冲动作
- if((cStepMByte == 4))
- {
- if(Y006 != 0)
- {
- if(X13_DW || ((user_datas[12] == 0) && (dwTickCount >= cDelayTime1)))
- {
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- if(X027 == 0)
- FKCX_bStopFang = 1;
- FKCX_bStopXiao = 0;
- FKCX_bStopXiaCong = 0;
- cDelayTime1 = dwTickCount + 40;
-
- }
- }
- //下冲感应开关
- if((((X013 != 0)&&(FKCX_cXiaChongStep==0)) && ((user_datas[12] == 0) || ((dwTickCount >= cDelayTime1) && !Y006)))
- || (user_datas[8] == 55))
- {
- M14 = 0;
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- CLRY007(); //插销垫片
- cDelayTime1 = dwTickCount + 60;
- if(X027 == 0)
- {
- FKCX_bStopFang = 1;
- cStepMByte = 5;
- }
- else
- cStepMByte = 8;
- FKCX_bStopXiao = 0;
- FKCX_bStopXiaCong = 0;
- if(FKCX_cHalfRun) //半
- {
- cStepMByte = 0;
- FKCX_bRunning = 0;
- FKCX_cHalfRun = 0;
- CLRY002();
- }
- }
- if(dwTickCount >= FKCX_cErrorTime)
- {
- SETY003();
- SetAlarmCode(FKCX_ALARM_ADDR,16);
- CLRY007(); //插销垫片
- if(!FKCX_XC_ENABLE)CLRY006();
- }
- //给方块开始
- j = FKCX_JiaFang(FKCX_TRUE);
- }
- if((cStepMByte == 5))
- {
- j = FKCX_JiaFang(FKCX_TRUE);
- if(j == FKCX_TRUE) //给方块已经完成
- {
- cStepMByte = 6;
- cStepMByte6 = 1; //送方块开始
- }
- }
- if((cStepMByte == 6))
- {
- j = FKCX_SongFang(FKCX_TRUE);
- //送料完毕(销)
- if(j == FKCX_TRUE)
- {
- cStepMByte4 = 0;
- if(Y004)
- {
- if(dwTickCount >= cDelayTime1)
- {
- cStepMByte = 7;
- SETY006(); //下冲
- if(FKCX_cXiaChongStep==0)FKCX_cXiaChongStep=1;
- cDelayTime1 = dwTickCount + user_datas[2]*10;
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- }
- }
- else
- {
- SETY004(); //方块垫片
- cDelayTime1 = dwTickCount + user_datas[13]*10;
- }
- M14 = 1;
- }
- else if((user_datas[12] == 1) && !X013) //证明没法卡住
- {
-
- SETY003();
- SetAlarmCode(FKCX_ALARM_ADDR,16);
- CLRY007(); //插销垫片
- CLRY013();
- }
- }
- //下冲动作
- if((cStepMByte == 7))
- {
- if(Y006 != 0)
- {
- if(X13_DW || ((user_datas[12] == 0) && (dwTickCount >= cDelayTime1)))
- {
- if(!FKCX_XC_ENABLE)CLRY006(); //下冲
- cDelayTime1 = dwTickCount + 40;
- }
- }
- //下冲感应开关
- if((X013 != 0) && ((user_datas[12] == 0) || ((dwTickCount >= cDelayTime1) && !Y006)))
- {
- CLRY004(); //方块垫片
- cStepMByte = 8;
- FKCX_bStopFang = 0;
- FKCX_bStopXiaCong = 0;
- FKCX_bStopFang = 0;
- M14 = 0;
- }
- if(dwTickCount >= FKCX_cErrorTime)
- {
- SETY003();
- CLRY004(); //方块垫片
- SetAlarmCode(FKCX_ALARM_ADDR,16);
- if(!FKCX_XC_ENABLE)CLRY006();
- }
- }
- //一个周期完成 方块没插在拉链上带出来
- if(((cStepMByte == 8)))
- {
- cStepMByte3 = 0;
- cStepMByte4 = 0;
- cStepMByte5 = 0;
- cStepMByte6 = 0;
- //计数器
- if(FKCX_cHalfRun == 0) //半循环不用计数
- {
- cCountOutTime = 8;
- SETY001();
- }
- //在先手动压带情况下
- if(FKCX_cYaDai || FKCX_cHalfRun)
- {
- CLRY002();
- FKCX_bRunning = 0;
- FKCX_cHalfRun = 0;
- cStepMByte = 0;
- }
- //在其它启动情况下,启动下一周期
- else
- {
- SETY002();
- CLRY005(); //松压带
- cStepMByte = 9;
- }
- }
- if(((cStepMByte == 9)))
- {
- if(X022 == 0)
- {
- cStepMByte = 1; //开始
- cStepMByte4 = 0;
- cStepMByte3 = 0;
- cStepMByte5 = 0;
- cStepMByte6 = 0;
- cStepMByte1 = 0;
- cStepMByte2 = 0;
- FKCX_cTotal++;
- SetData32bits(76,FKCX_cTotal);
- CalProSP(78); //计算生产速度
- }
- }
- }
- //电机控制
- unsigned long FKCX_Motor(unsigned long En_Dis)
- {
- if(En_Dis == 0)
- {
- CLRY000();
- AxisEgmStop(X_AXIS);
- SETDR(); //电机放松
- return FKCX_TRUE;
- }
- switch(cStepMByte2)
- {
- case 1: //离合器起动
- cStepMByte2 = 2;
- SETY000(); //离合器输出
- if(user_datas[90] == 55)cDelayTime3 = dwTickCount + 300;
- //步进启动
- CLRDR();
- MoveAction_Const_AccDec(X_AXIS, FKCX_DIR_P, user_datas[11],user_datas[10],user_datas[9],1);
- break;
- case 2: //过链接近下降沿
- if((X12_DW) || ((user_datas[90] == 55) && (dwTickCount >= cDelayTime3)))
- {
- cStepMByte2 = 3;
- cDelayTime3 = dwTickCount + 7;
- cDelayTime4 = dwTickCount + user_datas[7]; // 延时上勾针
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- MoveChangSpeed(X_AXIS,user_datas[10]);
- }
- break;
- case 3: //要加延时上勾针
- if(dwTickCount >= cDelayTime4)SETY016(); //上勾针
- //过链接近上升沿 //拖带到
- if(((X12_UP) || (user_datas[90] == 55)) && (dwTickCount >= cDelayTime3))
- {
- SETY016(); //上勾针
- cStepMByte2 = 4;
- cDelayTime3 = dwTickCount + 250;
- }
- if(dwTickCount >= FKCX_cErrorTime) //拖带警告
- {
- SETY003();
- FKCX_SetAlarmCode(1);
- }
- break;
- case 4:
- if(X026)
- {
- cStepMByte2 = 5;
- cDelayTime3 = dwTickCount + user_datas[6]*5;
- }
- else if(dwTickCount >= cDelayTime3)
- {
- FKCX_SetAlarmCode(9);
- SETY003();
- }
- break;
- case 5:
- if(dwTickCount >= cDelayTime3)
- {
- cStepMByte2 = 6;
- CLRY000(); //离合停
- SETY005();
- FKCX_cErrorTime = dwTickCount + FKCX_ERRORTIME;
- AxisEgmStop(X_AXIS); //步进电机停
- }
- break;
- case 6: //压带到
- if(X022 != 0)
- {
- cStepMByte2 = 7; //拖带完成
- cDelayTime3 = dwTickCount + 30;
- }
- else if(dwTickCount >= FKCX_cErrorTime) //压带警告
- {
- SETY003();
- FKCX_SetAlarmCode(2);
- }
- break;
- case 7:
- if(dwTickCount >= cDelayTime3)
- {
- CLRY016(); //下勾针
- cStepMByte2 = 10; //拖带完成
- }
- break;
- case 10:
- return FKCX_TRUE;
- }
-
- return FKCX_FALSE;
- }
- //夹销.给销动作
- unsigned long FKCX_JiaXiao(unsigned long En_Dis)
- {
- //
- if(En_Dis == 0)
- return FKCX_TRUE;
- switch(cStepMByte3) //离合器起动
- {
- case 0:
- break;
- case 1:
- if(X017 != 0) //退送插销到位磁感
- {
- cStepMByte3 = 2;
- SETY010(); //给插销打开
- SETY011(); //夹插销打开
- FKCX_cErrorTime1 = dwTickCount + user_datas[5]*10;
- cDelayTime5 = dwTickCount + 1200;
- }
- else
- CLRY010();
- CLRY012();
- break;
- case 2: //给销到位
- if(X023 != 0) //给销到位
- {
- if(X23_UP)
- cDelayTime5 = dwTickCount + 25;
- if(dwTickCount >= cDelayTime5)
- {
- CLRY011(); //夹插销夹
- cStepMByte3 = 6;
- cDelayTime5 = dwTickCount + 50;
- }
- }
- else if(dwTickCount >= FKCX_cErrorTime1)
- {
- CLRY011(); //夹方块夹
- cStepMByte3 = 0;
- FKCX_cGeiLiaoNum++;
- if(FKCX_cGeiLiaoNum >= user_datas[3]) //给料次数到卡料警告
- {
-
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(3);
- cStepMByte3 = 0;
- }
- else
- {
- cStepMByte3 = 4;
- CLRY010(); //给插稍退回
- }
- }
- break;
- case 3: //给料到位成功
- if(dwTickCount >= cDelayTime5)
- {
- cStepMByte3 = 0; //不用料自动运行
- if((X014 != 0) && (user_datas[90] != 55) && (FKCX_bRunning != 0)) //没料
- {
-
- FKCX_cGeiLiaoNum++;
- if(FKCX_cGeiLiaoNum >= user_datas[3]) //送三次没料
- {
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(5);
- }
- else
- {
- cStepMByte3 = 4;
- }
- }
- else
- {
- cStepMByte3 = 10;
- FKCX_cGeiLiaoNum = 0;
- CLRY010(); //给插销退回
- }
- }
- break;
- case 4: //给料不成功
- if(X023 == 0)
- {
- cStepMByte3 = 5;
- cDelayTime5 = dwTickCount + user_datas[4]*10;
- }
- break;
- case 5:
- if((dwTickCount >= cDelayTime5))
- {
- if(X014 != 0)
- {
- cStepMByte3 = 2;
- SETY010(); //给插销打开
- SETY011(); //夹插销打开
- FKCX_cErrorTime1 = dwTickCount + user_datas[5]*10;
- cDelayTime5 = dwTickCount + 1200;
- }
- else
- {
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(3);
- }
- }
- break;
- case 6:
- if(dwTickCount >= cDelayTime5)
- {
- CLRY010(); //给插销退回
- CLRY011(); //夹插销夹
- cStepMByte3 = 3;
- cDelayTime5 = dwTickCount + user_datas[0]*10 + 30;
- }
- break;
- case 10:
- return FKCX_TRUE;
- }
- return FKCX_FALSE;
- }
- //送销动作
- unsigned long FKCX_SongXiao(unsigned long En_Dis)
- {
- //
- if(En_Dis == 0)
- return FKCX_TRUE;
- switch(cStepMByte5)
- {
- case 0:
- break;
- case 1:
- cStepMByte5 = 2;
- FKCX_cErrorTime1 = dwTickCount + 10*FKCX_ERRORTIME;
- if((X014 == 0) || (user_datas[90] == 55) || (FKCX_bRunning == 0)) //方块
- SETY012(); //送销打开
- else
- break;
- case 2: //送销到位
- if((X016 != 0) && (X017 == 0))
- {
- cStepMByte5 = 3;
- cDelayTime5 = dwTickCount + 20;
- }
- else if((dwTickCount >= FKCX_cErrorTime1) && (FKCX_cHalfRun == 0)) //送销不到位故障
- {
- cStepMByte5 = 0;
- SETY003();
- FKCX_SetAlarmCode(7);
- }
- break;
- case 3:
- if(dwTickCount >= cDelayTime5)
- {
- cStepMByte5 = 4;
- SETY011(); //夹插销打开
- cDelayTime5 = dwTickCount + user_datas[1]*10;
- }
- break;
- case 4:
- if(dwTickCount >= cDelayTime5)
- {
- cStepMByte5 = 5;
- CLRY012(); //退送插销
- if(FKCX_bRunning != 0)FKCX_bStopXiaCong = 1;
- FKCX_cErrorTime1 = dwTickCount + FKCX_ERRORTIME;
- }
- break;
- case 5:
- if((X017 != 0) && (X016 == 0))
- {
- cStepMByte5 = 6;
- CLRY011(); //夹插销关
- cDelayTime5 = dwTickCount + 500;
- }
- else if(dwTickCount >= FKCX_cErrorTime1) //退送出错警告
- {
- SETY003();
- FKCX_SetAlarmCode(7);
- }
- break;
- case 6:
- if(X014 != 0)
- {
- cStepMByte5 = 7;
- if(FKCX_bRunning != 0)FKCX_bStopXiaCong = 1;
- }
- else if(dwTickCount >= cDelayTime5) //带料出来警告
- {
- cStepMByte5 = 0;
- FKCX_cTestNum = 35;
- FKCX_bStopXiaCong = 0;
- SETY003();
- FKCX_SetAlarmCode(11);
- }
- break;
- case 7:
- return FKCX_TRUE;
- }
- return FKCX_FALSE;
- }
- //夹方块.给方块动作
- unsigned long FKCX_JiaFang(unsigned long En_Dis)
- {
- //
- if(En_Dis == 0)
- return FKCX_TRUE;
- switch(cStepMByte4)
- {
- case 0:
- break;
- case 1:
- if(X021 != 0)
- {
- cStepMByte4 = 2;
- SETY015(); //给方块打开
- SETY014(); //夹方块打开
- FKCX_cErrorTime2 = dwTickCount + user_datas[5]*10;
- cDelayTime6 = dwTickCount + 1200;
- }
- else
- CLRY015();
- CLRY013();
- break;
- case 2: //给方块到位
- if(X024 != 0)
- {
- if(X24_UP)
- {
- cDelayTime6 = dwTickCount + 20;
- }
- if(dwTickCount >= cDelayTime6)
- {
- CLRY014(); //夹方块夹
- cStepMByte4 = 6;
- cDelayTime6 = dwTickCount + 50;
- }
- }
- else if(dwTickCount >= FKCX_cErrorTime2)
- {
- CLRY014(); //夹方块夹
-
- cStepMByte4 = 0;
- FKCX_cGeiLiaoNum++;
- if(FKCX_cGeiLiaoNum >= user_datas[3]) //给料三次错误
- {
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(4);
- }
- else
- {
- cStepMByte4 = 4;
- CLRY015(); //给方块退回
- }
- }
- break;
- case 3: //已给料到前面
- if(dwTickCount >= cDelayTime6)
- { //没带空打
- if((X015 != 0) && (user_datas[90] != 55) && (FKCX_bRunning != 0)) //没料
- {
- cStepMByte4 = 0;
- FKCX_cGeiLiaoNum++;
- if(FKCX_cGeiLiaoNum >= user_datas[3]) //没料三次警告
- {
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(6);
- }
- else
- {
- cStepMByte4 = 4;
- }
- }
- else
- {
- cStepMByte4 = 10; //完成
- FKCX_cGeiLiaoNum = 0;
- CLRY015(); //给方块退回
- }
- }
- break;
- case 4://出错退回
- if(X024 == 0)
- {
- cStepMByte4 = 5;
- cDelayTime6 = dwTickCount + user_datas[4]*10;
- }
- break;
- case 5:
- if((dwTickCount >= cDelayTime6))
- {
- if(X015 != 0)
- {
- cStepMByte4 = 2;
- SETY014(); //给插销打开
- SETY015(); //夹插销打开
- FKCX_cErrorTime2 = dwTickCount + user_datas[5]*10;
- cDelayTime6 = dwTickCount + 1200;
- }
- else
- {
- FKCX_cGeiLiaoNum = 0;
- SETY003();
- FKCX_SetAlarmCode(4);
- }
- }
- break;
- case 6:
- if(dwTickCount >= cDelayTime6)
- {
- CLRY015(); //给方块退回
- cStepMByte4 = 3;
- cDelayTime6 = dwTickCount + user_datas[0]*10 + 30;
- }
- break;
- case 10:
- return FKCX_TRUE;
- }
- return FKCX_FALSE;
- }
- //送方块动作
- unsigned long FKCX_SongFang(unsigned long En_Dis)
- {
- //
- if(En_Dis == 0)return FKCX_TRUE;
-
- switch(cStepMByte6)
- {
- case 0:
- break;
- case 1:
- if((X015 == 0) || (user_datas[90] == 55) || (FKCX_bRunning == 0))
- {
- cStepMByte6 = 2;
- SETY013(); //送方块打开
- FKCX_cErrorTime2 = dwTickCount + 10*FKCX_ERRORTIME;
- }
- break;
- case 2: //送销到位
- if((X020 != 0) && (X021 == 0))
- {
- cStepMByte6 = 3;
- cDelayTime6 = dwTickCount + 20;
- }
- else if((dwTickCount >= FKCX_cErrorTime2) && (FKCX_cHalfRun == 0)) //送销不到位故障
- {
- cStepMByte6 = 0;
- FKCX_SetAlarmCode(6);
- SETY003();
- }
- break;
- case 3:
- if(dwTickCount >= cDelayTime6)
- {
- cStepMByte6 = 4;
- SETY014(); //夹方块打开
- cDelayTime6 = dwTickCount + user_datas[1]*10;
- }
- break;
- case 4:
- if(dwTickCount >= cDelayTime6)
- {
- cStepMByte6 = 5;
- CLRY013(); //退送方块
- if(FKCX_bRunning != 0)FKCX_bStopXiaCong = 1;
- FKCX_cErrorTime2 = dwTickCount + FKCX_ERRORTIME;
- }
- break;
- case 5:
- if((X021 != 0) && (X020 == 0))
- {
- cStepMByte6 = 6;
- CLRY014(); //夹方块关
- cDelayTime6 = dwTickCount + 500;
- }
- else if(dwTickCount >= FKCX_cErrorTime2) //退送方块出错警告
- {
- SETY003();
- FKCX_SetAlarmCode(8);
- }
- break;
- case 6:
- if(X015 != 0)
- {
- cStepMByte6 = 7;
- if(FKCX_bRunning != 0)
- FKCX_bStopXiaCong = 1;
- }
- else if(dwTickCount >= cDelayTime6) //带料出来警告
- {
- cStepMByte6 = 0;
- FKCX_bStopXiaCong = 0;
- SETY003();
- FKCX_SetAlarmCode(11);
- }
- break;
- case 7:
- return FKCX_TRUE;
- }
- return FKCX_FALSE;
- }
- #endif
|