12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565 |
- #include "global.h"
- #if XI_DONG_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
|