FJQueduanChuantou.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457
  1. #include "global.h"
  2. #if FU_JIAN_MACHINE
  3. /*
  4. 机械手式切断机
  5. 切断穿头机动作函数
  6. ** 输入输出说明:
  7. X00 起动(全自动)
  8. X01 停止
  9. X02 没链感应
  10. X03
  11. X04 卡带
  12. X05 拉带前进限位感应开关
  13. X06 拉带前进减速感应开关
  14. X07 拉带后退限位感应开关
  15. X10 拉头触针感应
  16. X11 给料前(推拉头前)
  17. X12 给料后(推拉头后)
  18. X13 送料前
  19. X14 送料后
  20. X15 上切原位
  21. X16
  22. X17 下切到位
  23. X20 下切原位
  24. X21 下模到位
  25. X22 下模原位
  26. X23 振动盘
  27. X24 夹子左
  28. X25 夹子右
  29. //输出
  30. Y17
  31. Y16
  32. Y15
  33. Y14
  34. Y13 振动盘
  35. Y12 开链
  36. Y11
  37. Y10
  38. Y07
  39. Y06 机械手夹
  40. Y05 给料
  41. Y04 送料
  42. Y03 夹拉头
  43. Y02 上模
  44. Y01 下切
  45. Y00 上切
  46. D76 累计产量
  47. D77 累计产量
  48. D78 一分钟产量
  49. D80 音波自动
  50. D84 切断计数
  51. D85 打包数量设定(不是触摸屏时设为0)
  52. */
  53. #define _YZQ_W_NO_WARNING 0 //没警告
  54. #define __YZQ_W_NO_ZIP 1 //没拉链,自动停机
  55. #define __YZQ_GUOZH_DAOWEI 2 //钩针到位开关异常
  56. #define __YZQ_JIADAI 5 //夹带感应开关异常
  57. #define __YZQ_MOTOR_FORWARDRETARD 6 //拉带前进减速感应开关异常
  58. #define __YZQ_XIAQUE_DAOWEI 4 //下切到位感应开关异常
  59. #define __YZQ_XIAQUE_ORIGIN 3 //下切退到位感应开关异常
  60. #define __YZQ_FORWARD_LIMIT 7 //拉带前进限位感应开关异常
  61. #define __YZQ_BACK_LIMIT 8 //拉带后退限位感应开关异常
  62. #define __YZQ_SONGDAI_DAOWEI 9 //送带到位感应开关异常
  63. #define __YZQ_RETARD_SIGNAL 10 //减速感应开关异常
  64. #define __YZQ_SafeDoor_SIGNAL 11 //安全门
  65. #define __YZQ_LaLianLend_Change 12 //拉链长度变化
  66. #define __YZQ_ZIPPER_LONG 14 //拉链变长
  67. #define __YZQ_ZIPPER_SHORT 15 //拉链变短
  68. #define __YZQ_XIAMO_DAOWEI 16 //下模到位感应开关异常
  69. #define __YZQ_TOTAL 17
  70. void QueDuan_NewStr_StepCheckStart(void);
  71. void QianDianDWStep(void);
  72. void QueDuan_NewStr_Motor(void);
  73. void QueDuan_NewStr_XiaQue(void);
  74. void Stop_Dec(void);
  75. void SongDai(void);
  76. void GeiLiao_CT_QD_GL(void);
  77. void HeMo_CT_QD_GL(void);
  78. void ZhuangLiao_CT_QD_GL(void);
  79. void ManualActionYJ(void);
  80. void AutoStep(void);
  81. //void TaiMianMotorStep(void);
  82. void KaiLianStep(void);
  83. void ChuanLTStep(void);
  84. void ZhenDongStep(void);
  85. void JiaLianStep(void);
  86. SystemParam_str *SystemParam;
  87. TestData_str *TestData;
  88. unsigned short cTaiMiamMotor;
  89. unsigned long cSlowPusle;
  90. unsigned short cXiaQieStep;
  91. unsigned short cXiaQieDelay;
  92. unsigned short cZhuangLiaoStep;
  93. unsigned short cZhuangLiaoDelay;
  94. unsigned short cGeiLiaoStep;
  95. unsigned short cGeiLiaoDelay;
  96. unsigned short cMotorStep;
  97. unsigned short cMotorDelay;
  98. unsigned short cHeMoStep;
  99. unsigned short cHeMoDelay;
  100. unsigned short cAutoStep;
  101. unsigned short cAutoDelay;
  102. unsigned short cKaiLianStep;
  103. unsigned short cKaiLianDelay;
  104. unsigned short cTaiMianMotorStep;
  105. unsigned short cTaiMianMotorDelay;
  106. unsigned long cTaiMianCnt;
  107. unsigned short cQianDianDWStep;
  108. unsigned short cQianDianDWDelay;
  109. unsigned short cChuanLTStep;
  110. unsigned short cChuanLTDelay;
  111. unsigned short cZhenDongStep;
  112. unsigned short cZhenDongDelay;
  113. unsigned short cJiaLianStep;
  114. unsigned short cJiaLianDelay;
  115. unsigned char bDecEn;
  116. unsigned char bStartOnceTime;
  117. unsigned short cWorkCnt;
  118. unsigned char TryCnt = 0;
  119. unsigned char FirstGeiLiaoFlg = 0;
  120. unsigned char ZhuangLiaoOkFlg = 0;
  121. void DelayYJ(void)
  122. {
  123. if(cXiaQieDelay)cXiaQieDelay--;
  124. if(cZhuangLiaoDelay)cZhuangLiaoDelay--;
  125. if(cMotorDelay)cMotorDelay--;
  126. if(cGeiLiaoDelay)cGeiLiaoDelay--;
  127. if(cHeMoDelay)cHeMoDelay--;
  128. if(cAutoDelay)cAutoDelay--;
  129. if(cKaiLianDelay)cKaiLianDelay--;
  130. if(cTaiMianMotorDelay)cTaiMianMotorDelay--;
  131. if(cQianDianDWDelay)cQianDianDWDelay--;
  132. if(cChuanLTDelay)cChuanLTDelay--;
  133. if(cZhenDongDelay)cZhenDongDelay--;
  134. if(cJiaLianDelay)cJiaLianDelay--;
  135. }
  136. //故障报警
  137. void SetAlarmYJ(unsigned short alarm_num)
  138. {
  139. if(bWorkMode)
  140. {
  141. bAlarmStop = 1;
  142. if(alarm_num != 0)SystemParam->AlarmCode = alarm_num;
  143. }
  144. }
  145. //初始化动作
  146. void InitActionYJ(void)
  147. {
  148. float buff_pulse,buff_dist;
  149. SystemParam = (SystemParam_str *)&cDataArea[0];
  150. TestData = (TestData_str *)&cDataArea[121];
  151. buff_pulse = SystemParam->XCyclePulse;
  152. buff_dist = SystemParam->XCycleDist;
  153. XGearRatio = buff_pulse/buff_dist;
  154. X_SON = 0;
  155. }
  156. //X05减速感应外部中断动作(上升沿)
  157. void ExIneruptActionYJ(void)
  158. {
  159. if(bDecEn)
  160. {
  161. bDecEn = 0;
  162. if(SystemParam->MachineMode)
  163. MoveDecPulse(X_AXIS,SystemParam->DecLength); //反穿中间要停
  164. else
  165. MoveDecPulse(X_AXIS,(SystemParam->DecLength + SystemParam->SecondMoveLength)); //正穿中间不停所以要加上二次前进长度
  166. }
  167. }
  168. //告警动作
  169. void AlarmProtectYJ(void)
  170. {
  171. if(X_DRV)
  172. {
  173. if(bXDirction)
  174. {
  175. /* if(TUODAI_QIANJIN_LIMIT_IN)
  176. {
  177. SetAlarmYJ(7);
  178. MV_Limit_Stop(X_AXIS);
  179. }*/
  180. }
  181. else
  182. {
  183. if(TUODAI_HOUTUI_LIMIT_IN)
  184. {
  185. SetAlarmYJ(8);
  186. MV_Limit_Stop(X_AXIS);
  187. }
  188. }
  189. }
  190. if(bRunning)
  191. {
  192. if(!NO_ZIPPER_CHECK_IN)SetAlarmYJ(1);
  193. }
  194. }
  195. void StopAction(void)
  196. {
  197. cXiaQieStep = 0;
  198. cZhuangLiaoStep = 0;
  199. cGeiLiaoStep = 0;
  200. cMotorStep = 0;
  201. cAutoStep = 0;
  202. cKaiLianStep = 0;
  203. cQianDianDWStep = 0;
  204. cChuanLTStep = 0;
  205. cZhenDongStep = 0;
  206. cJiaLianStep = 0;
  207. FirstGeiLiaoFlg = 0;
  208. SystemParam->Speed = 0;
  209. bSaveWorkState = 1;
  210. }
  211. void QueDuan_ChuanTou_ActionYJ(void)
  212. {
  213. TestData->DispLay[0] = cAutoStep;
  214. TestData->DispLay[1] = cQianDianDWStep;
  215. TestData->DispLay[2] = cGeiLiaoStep;
  216. TestData->DispLay[3] = cZhuangLiaoStep;
  217. TestData->DispLay[4] = cMotorStep;
  218. TestData->DispLay[5] = cXiaQieStep;
  219. TestData->DispLay[6] = cChuanLTStep;
  220. TestData->DispLay[7] = cXiaQieStep;
  221. TestData->DispLay[8] = cKaiLianStep;
  222. AlarmProtectYJ();
  223. QueDuan_NewStr_StepCheckStart(); // 调用脚踏开关检测程序
  224. QueDuan_NewStr_Motor();
  225. QianDianDWStep();
  226. QueDuan_NewStr_XiaQue();
  227. GeiLiao_CT_QD_GL();
  228. ChuanLTStep();
  229. ZhuangLiao_CT_QD_GL();
  230. ZhenDongStep();
  231. JiaLianStep();
  232. // TaiMianMotorStep();
  233. ManualActionYJ();
  234. AutoStep();
  235. }
  236. void JiaLianStep(void)
  237. {
  238. if(cJiaLianStep == 1)
  239. {
  240. cJiaLianDelay = SystemParam->DelayJD * 10;
  241. cJiaLianStep = 2;
  242. }
  243. else if((cJiaLianStep == 2) && (cJiaLianDelay == 0))
  244. {
  245. JZ_OUT = 1;
  246. cJiaLianDelay = JIA_DAI_ERROR_TIME;
  247. cJiaLianStep = 3;
  248. }
  249. else if(cJiaLianStep == 3)
  250. {
  251. if(JZ_LEFT_IN && JZ_RIGHT_IN)
  252. {
  253. cJiaLianStep = 4;
  254. }
  255. else if(cJiaLianDelay == 0)
  256. {
  257. if(!JZ_LEFT_IN)SetAlarmYJ(24);
  258. else if(!JZ_RIGHT_IN)SetAlarmYJ(25);
  259. }
  260. }
  261. else if(cJiaLianStep == 4)
  262. {
  263. if(SystemParam->KaiLianTime)
  264. {
  265. cJiaLianDelay = SystemParam->DelayKL * 10;
  266. cJiaLianStep = 5;
  267. }
  268. else
  269. {
  270. cJiaLianStep = 7;
  271. }
  272. }
  273. else if((cJiaLianStep == 5) && (cJiaLianDelay == 0))
  274. {
  275. KL_OUT = 1;
  276. cJiaLianStep = 6;
  277. cJiaLianDelay = SystemParam->KaiLianTime * 10;
  278. }
  279. else if((cJiaLianStep == 6) && (cJiaLianDelay == 0))
  280. {
  281. KL_OUT = 0;
  282. cJiaLianStep = 7;
  283. // cJiaLianDelay = SystemParam->KaiLianTime * 10;
  284. }
  285. else if((cJiaLianStep == 7))
  286. {
  287. cJiaLianStep = 0;
  288. }
  289. }
  290. //自动动作
  291. void AutoStep(void)
  292. {
  293. if(bRunning)
  294. {
  295. if(cAutoStep == 1)
  296. {
  297. cAutoStep = 2;
  298. cZhenDongStep = 1;
  299. }
  300. else if((cAutoStep == 2) && (cAutoDelay == 0))
  301. {
  302. if(cGeiLiaoStep == 0)
  303. {
  304. cGeiLiaoStep = 1;
  305. cAutoStep = 3;
  306. }
  307. }
  308. else if(cAutoStep == 3)
  309. {
  310. if(cQianDianDWStep == 0)
  311. {
  312. cQianDianDWStep = 1;
  313. ZhuangLiaoOkFlg = 0;
  314. cAutoStep = 4;
  315. }
  316. }
  317. else if(cAutoStep == 4)
  318. {
  319. if(cGeiLiaoStep == 0)
  320. {
  321. cAutoStep = 5;
  322. }
  323. }
  324. else if(cAutoStep == 5)
  325. {
  326. if(cZhuangLiaoStep == 0)
  327. {
  328. cZhuangLiaoStep = 1;
  329. cAutoStep = 6;
  330. }
  331. }
  332. else if(cAutoStep == 6)
  333. {
  334. if(cZhuangLiaoStep == 0)
  335. {
  336. cAutoStep = 7;
  337. }
  338. }
  339. else if(cAutoStep == 7)
  340. {
  341. cAutoStep = 8;
  342. }
  343. else if(cAutoStep == 8)
  344. {
  345. cAutoStep = 9;
  346. }
  347. else if(cAutoStep == 9)
  348. {
  349. if(cQianDianDWStep == 0)
  350. {
  351. cAutoStep = 10;
  352. }
  353. }
  354. else if(cAutoStep == 10)
  355. {
  356. cAutoStep = 11;
  357. }
  358. else if(cAutoStep == 11)
  359. {
  360. if(cChuanLTStep == 0)
  361. {
  362. cChuanLTStep = 1;
  363. cAutoStep = 12;
  364. }
  365. }
  366. else if(cAutoStep == 12)
  367. {
  368. if(cChuanLTStep == 0)
  369. {
  370. cAutoStep = 13;
  371. }
  372. }
  373. else if(cAutoStep == 13)
  374. {
  375. cAutoStep = 14;
  376. }
  377. else if(cAutoStep == 14)
  378. {
  379. if(cXiaQieStep == 0)
  380. {
  381. cXiaQieStep = 1;
  382. cAutoStep = 15;
  383. }
  384. }
  385. else if(cAutoStep == 15)
  386. {
  387. if(cXiaQieStep == 0)
  388. {
  389. cAutoStep = 16;
  390. }
  391. }
  392. else if(cAutoStep == 16)
  393. {
  394. CalProSP(); //计算生产速度
  395. AddToTal(8); //生产总量加1并保存
  396. AddToTal(10); //生产总量加1并保存
  397. cWorkCnt++;
  398. if(SystemParam->NowTotal >= SystemParam->SetTotal)
  399. {
  400. SystemParam->NowTotal = 0;
  401. Save32BitDate(0,10);
  402. bStartOnceTime = 0;
  403. SetAlarmYJ(16);
  404. }
  405. else
  406. {
  407. if(bStartOnceTime)
  408. {
  409. bStartOnceTime = 0;
  410. cAutoStep = 0;
  411. bRunning = 0;
  412. }
  413. else
  414. cAutoStep = 17;
  415. }
  416. }
  417. else if(cAutoStep == 17)
  418. {
  419. if(!LATOU_CHUZHEN_IN)
  420. {
  421. cAutoStep = 2;
  422. // cAutoDelay = SystemParam->CycleDelay * 10;
  423. }
  424. else
  425. {
  426. SetAlarmYJ(2);
  427. }
  428. }
  429. }
  430. }
  431. //振动盘控制
  432. void ZhenDongStep(void)
  433. {
  434. if(cZhenDongStep == 1)
  435. {
  436. cZhenDongStep = 2;
  437. }
  438. else if(cZhenDongStep == 2)
  439. {
  440. if(LATOU_IN)
  441. {
  442. }
  443. else
  444. {
  445. ZDP_OUT = 1;
  446. cZhenDongStep = 3;
  447. }
  448. }
  449. else if(cZhenDongStep == 3)
  450. {
  451. if(!SystemParam->ZhenDongMode)
  452. {
  453. cZhenDongStep = 0;
  454. }
  455. else
  456. {
  457. cZhenDongStep = 4;
  458. cZhenDongDelay = SystemParam->ZDWorkDelay * 10;
  459. }
  460. }
  461. else if((cZhenDongStep == 4) && (cZhenDongDelay == 0))
  462. {
  463. ZDP_OUT = 0;
  464. cZhenDongStep = 2;
  465. }
  466. else if(cZhenDongStep == 6)
  467. {
  468. cZhenDongStep = 0;
  469. }
  470. }
  471. //台面电机动作
  472. /*
  473. void TaiMianMotorStep(void)
  474. {
  475. if(cTaiMianMotorStep == 1)
  476. {
  477. // TABLE_MOTOR_OUT = 1;
  478. cTaiMianMotorDelay = SystemParam->TableMotorWorkTime * 10;
  479. cTaiMianMotorStep = 2;
  480. }
  481. else if((cTaiMianMotorStep == 2) && (cTaiMianMotorDelay == 0))
  482. {
  483. // TABLE_MOTOR_OUT = 0;
  484. cTaiMianMotorStep = 0;
  485. }
  486. }*/
  487. void QueDuan_NewStr_StepCheckStart(void)
  488. {
  489. //启动 自动启动 单一自动
  490. if(START_IN_UP || bStart || bOnceStart)
  491. {
  492. if(bOnceStart)
  493. {
  494. bOnceStart = 0;
  495. bStartOnceTime = 1;
  496. }
  497. bStart = 0;
  498. if(!NO_ZIPPER_CHECK_IN)SetAlarmYJ(30);
  499. else if(JLT_IN)SetAlarmYJ(31);
  500. else if(LATOU_CHUZHEN_IN)SetAlarmYJ(32);
  501. else if(!GL_ORIGIN_IN)SetAlarmYJ(33);
  502. else if(SL_ARRIVE_IN)SetAlarmYJ(34);
  503. else if(!SQ_ORIGIN_IN)SetAlarmYJ(35);
  504. else if(!XQ_ORIGIN_IN)SetAlarmYJ(36);
  505. else if(!SM_ORIGIN_IN)SetAlarmYJ(37);
  506. else
  507. {
  508. if(!bRunning && (cAutoStep == 0) && (SystemParam->AlarmCode == 0))
  509. {
  510. bRunning = 1;
  511. cAutoStep = 1;
  512. cWorkCnt = 0;
  513. TryCnt = 0;
  514. }
  515. }
  516. }
  517. //停止
  518. if(STOP_IN_UP|| bStop)
  519. {
  520. StopAction();
  521. MV_Dec_Stop(X_AXIS);
  522. bRunning = 0;
  523. bOnceStart = 0;
  524. bStop = 0;
  525. X_SON = 0;
  526. bStartOnceTime = 0;
  527. SQ_OUT = 0;
  528. XQ_OUT = 0;
  529. SM_OUT = 0;
  530. JZ_OUT = 0;
  531. SL_OUT = 0;
  532. JLT_OUT= 0;
  533. GL_OUT = 0;
  534. KL_OUT = 0;
  535. ZDP_OUT= 0;
  536. SLT_OUT= 0;
  537. if(SystemParam->AlarmCode)SystemParam->AlarmCode = 0;
  538. }
  539. if(bAlarmStop)
  540. {
  541. StopAction();
  542. bOnceStart = 0;
  543. bAlarmStop = 0;
  544. bStartOnceTime = 0;
  545. ZDP_OUT = 0;
  546. MV_Dec_Stop(X_AXIS);
  547. M48 = 0;
  548. M49 = 0;
  549. }
  550. }
  551. //电机控制动作
  552. void QueDuan_NewStr_Motor(void) //
  553. {
  554. static long save_jz_dist;
  555. if(cMotorStep == 1) //第一条不知道夹子位置直接走慢速
  556. {
  557. if(!X_SON)
  558. {
  559. X_SON = 1;
  560. cMotorDelay = 150;
  561. }
  562. cMotorStep = 2;
  563. }
  564. else if((cMotorStep == 2) && (cMotorDelay == 0))
  565. {
  566. bDecEn = 1;
  567. MV_Const_Move(X_AXIS,SystemParam->LowSpeed,0);
  568. cMotorStep = 3;
  569. }
  570. else if((cMotorStep == 3) && !X_DRV)
  571. {
  572. cMotorStep = 0;
  573. }
  574. else if(cMotorStep == 10) //第二条开始走高速,到慢速长度后降到慢速保证过减速感应的时候都是同一个速度
  575. {
  576. if(!X_SON)
  577. {
  578. X_SON = 1;
  579. cMotorDelay = 150;
  580. }
  581. cMotorStep = 11;
  582. }
  583. else if((cMotorStep == 11) && (cMotorDelay == 0))
  584. {
  585. bDecEn = 1;
  586. save_jz_dist = SystemParam->XRealPos;
  587. MV_Const_Move(X_AXIS,SystemParam->JJGoSpeed,0);
  588. cMotorStep = 12;
  589. }
  590. else if((cMotorStep == 12))
  591. {
  592. if(SystemParam->XRealPos <= (save_jz_dist - SystemParam->CutBackLength - SystemParam->ZipperLength + SystemParam->LowSpeedLength + SystemParam->FZLength))
  593. {
  594. MV_Const_Move_Change_Speed(X_AXIS,SystemParam->LowSpeed);
  595. cMotorStep = 13;
  596. }
  597. }
  598. else if((cMotorStep == 13) && !X_DRV)
  599. {
  600. cMotorStep = 0;
  601. }
  602. else if(cMotorStep == 20) //穿拉带先高速再低速然后再高速
  603. {
  604. if(!X_SON)
  605. {
  606. X_SON = 1;
  607. cMotorDelay = 150;
  608. }
  609. cMotorStep = 21;
  610. }
  611. else if((cMotorStep == 21) && (cMotorDelay == 0))
  612. {
  613. MoveControl(X_AXIS,SystemParam->ZipperLength,SystemParam->HighSpeedLength,SystemParam->BackLowSpeedLength,SystemParam->LDBackSpeed,SystemParam->LDBackLowSpeed,1);
  614. cMotorStep = 22;
  615. }
  616. else if((cMotorStep == 22) && !X_DRV)
  617. {
  618. cMotorStep = 0;
  619. }
  620. else if(cMotorStep == 30)
  621. {
  622. if(!X_SON)
  623. {
  624. X_SON = 1;
  625. cMotorDelay = 150;
  626. }
  627. cMotorStep = 31;
  628. }
  629. else if((cMotorStep == 31) && (cMotorDelay == 0)) //反转
  630. {
  631. MoveAction_Dist(X_AXIS,SystemParam->FZLength,SystemParam->FZSpeed,0);
  632. cMotorStep = 32;
  633. }
  634. else if((cMotorStep == 32) && !X_DRV)
  635. {
  636. cMotorStep = 0;
  637. }
  638. else if(cMotorStep == 40)
  639. {
  640. if(!X_SON)
  641. {
  642. X_SON = 1;
  643. cMotorDelay = 150;
  644. }
  645. cMotorStep = 41;
  646. }
  647. else if((cMotorStep == 41) && (cMotorDelay == 0)) //切断之后后退长度
  648. {
  649. MoveAction_Dist(X_AXIS,SystemParam->CutBackLength,SystemParam->CutBackSpeed,1);
  650. cMotorStep = 42;
  651. }
  652. else if((cMotorStep == 42) && !X_DRV)
  653. {
  654. cMotorStep = 0;
  655. }
  656. else if(cMotorStep == 60)
  657. {
  658. if(!X_SON)
  659. {
  660. X_SON = 1;
  661. cMotorDelay = 150;
  662. }
  663. cMotorStep = 61;
  664. }
  665. else if((cMotorStep == 61) && (cMotorDelay == 0)) //手动拖带后退
  666. {
  667. MV_Const_Move(X_AXIS,20,1);
  668. cMotorStep = 62;
  669. }
  670. else if((cMotorStep == 62) && !X_DRV)
  671. {
  672. X_SON = 0;
  673. cMotorStep = 0;
  674. }
  675. else if(cMotorStep == 80)
  676. {
  677. if(!X_SON)
  678. {
  679. X_SON = 1;
  680. cMotorDelay = 150;
  681. }
  682. cMotorStep = 81;
  683. }
  684. else if((cMotorStep == 81) && (cMotorDelay == 0)) //手动拖带前进
  685. {
  686. MV_Const_Move(X_AXIS,20,0);
  687. cMotorStep = 82;
  688. }
  689. else if((cMotorStep == 82) && !X_DRV)
  690. {
  691. X_SON = 0;
  692. cMotorStep = 0;
  693. }
  694. else if(cMotorStep == 100)
  695. {
  696. if(!X_SON)
  697. {
  698. X_SON = 1;
  699. cMotorDelay = 150;
  700. }
  701. cMotorStep = 101;
  702. }
  703. else if((cMotorStep == 101) && (cMotorDelay == 0)) //二次前进长度
  704. {
  705. MoveAction_Dist(X_AXIS,SystemParam->SecondMoveLength,SystemParam->JJGoSpeed,0);
  706. cMotorStep = 102;
  707. }
  708. else if((cMotorStep == 102) && !X_DRV)
  709. {
  710. cMotorStep = 0;
  711. }
  712. else if(cMotorStep == 120)
  713. {
  714. if(!X_SON)
  715. {
  716. X_SON = 1;
  717. cMotorDelay = 150;
  718. }
  719. cMotorStep = 121;
  720. }
  721. else if((cMotorStep == 121) && (cMotorDelay == 0))
  722. {
  723. MoveAction_Dist(X_AXIS,SystemParam->FirstBackLength,SystemParam->CutBackSpeed,1); //一开始如果压着感应直接先后退
  724. cMotorStep = 122;
  725. }
  726. else if((cMotorStep == 122) && !X_DRV)
  727. {
  728. cMotorStep = 0;
  729. }
  730. }
  731. //前点定位
  732. void QianDianDWStep(void)
  733. {
  734. if(cQianDianDWStep == 1)
  735. {
  736. JZ_OUT = 0;
  737. cQianDianDWDelay = JIA_DAI_ERROR_TIME;
  738. cQianDianDWStep = 2;
  739. }
  740. else if(cQianDianDWStep == 2)
  741. {
  742. if((cWorkCnt == 0) && (TUODAI_QIANJIN_LIMIT_IN || TUODAI_QIANJIN_DEC_IN)) //第一条启动的时候压着感应就要先后退
  743. {
  744. cMotorStep = 120;
  745. cQianDianDWStep = 3;
  746. }
  747. else
  748. cQianDianDWStep = 4;
  749. }
  750. else if(cQianDianDWStep == 3)
  751. {
  752. if(cMotorStep == 0)
  753. {
  754. cQianDianDWStep = 4;
  755. }
  756. }
  757. else if(cQianDianDWStep == 4)
  758. {
  759. if(!JZ_LEFT_IN && !JZ_RIGHT_IN)
  760. {
  761. if(cWorkCnt >= 1) //第一条走慢速
  762. cMotorStep = 10;
  763. else
  764. cMotorStep = 1;
  765. cQianDianDWStep = 5;
  766. cQianDianDWDelay = 0;
  767. }
  768. else if(cQianDianDWDelay == 0)
  769. {
  770. if(JZ_LEFT_IN)SetAlarmYJ(24);
  771. else if(JZ_RIGHT_IN)SetAlarmYJ(25);
  772. }
  773. }
  774. else if(cQianDianDWStep == 5)
  775. {
  776. if(cMotorStep == 0)
  777. {
  778. if(!SystemParam->MachineMode) cJiaLianStep = 1;//正穿的话直接电机停了就要夹链和开链
  779. cQianDianDWStep = 6;
  780. }
  781. }
  782. else if((cQianDianDWStep == 6) && (bWorkMode || bNext))
  783. {
  784. if((cZhuangLiaoStep == 0) && (ZhuangLiaoOkFlg == 1))
  785. {
  786. cQianDianDWStep = 7;
  787. ZhuangLiaoOkFlg = 0;
  788. }
  789. }
  790. else if((cQianDianDWStep == 7) && (bWorkMode || bNext))
  791. {
  792. if(SystemParam->MachineMode) //反穿才需要在夹链前停止进行二次前进,正穿不需要直接到位后夹拉链
  793. cMotorStep = 100;
  794. else
  795. cMotorStep = 0;
  796. cQianDianDWStep = 8;
  797. }
  798. else if(cQianDianDWStep == 8)
  799. {
  800. if(cMotorStep == 0)
  801. {
  802. cQianDianDWStep = 9;
  803. }
  804. }
  805. else if((cQianDianDWStep == 9) && (bWorkMode || bNext))
  806. {
  807. if(SystemParam->MachineMode)cJiaLianStep = 1; //反穿夹带要等装完料才夹正穿之前就要夹直接跳过
  808. cQianDianDWStep = 10;
  809. }
  810. else if(cQianDianDWStep == 10)
  811. {
  812. if(cJiaLianStep == 0)
  813. {
  814. cQianDianDWStep = 11;
  815. }
  816. }
  817. else if((cQianDianDWStep == 11))
  818. {
  819. cQianDianDWStep = 12;
  820. }
  821. else if((cQianDianDWStep == 12))
  822. {
  823. cQianDianDWStep = 13;
  824. }
  825. else if((cQianDianDWStep == 13))
  826. {
  827. cQianDianDWStep = 0;
  828. }
  829. }
  830. //穿拉头动作
  831. void ChuanLTStep(void)
  832. {
  833. static long save_xm_dist;
  834. if(cChuanLTStep == 1)
  835. {
  836. cChuanLTStep = 2;
  837. save_xm_dist = SystemParam->XRealPos;
  838. }
  839. else if(cChuanLTStep == 2)
  840. {
  841. cMotorStep = 20;
  842. cChuanLTStep = 3;
  843. }
  844. else if(cChuanLTStep == 3)
  845. {
  846. if(SystemParam->XRealPos >= (save_xm_dist + SystemParam->PutInLength + SystemParam->HighSpeedLength))
  847. {
  848. cChuanLTStep = 4;
  849. SM_OUT = 0;
  850. JLT_OUT = 0;
  851. }
  852. else if(SLT_OUT)
  853. {
  854. if(SystemParam->XRealPos >= (save_xm_dist + SystemParam->PutInLength + SystemParam->HighSpeedLength - SystemParam->UnLockDist)) SLT_OUT = 0;
  855. }
  856. }
  857. else if(cChuanLTStep == 4)
  858. {
  859. if(cMotorStep == 0)cChuanLTStep = 5;
  860. }
  861. else if(cChuanLTStep == 5)
  862. {
  863. cChuanLTDelay = SystemParam->FZDelay * 10;
  864. cChuanLTStep = 6;
  865. }
  866. else if((cChuanLTStep == 6) && (cChuanLTDelay == 0))
  867. {
  868. cMotorStep = 30;
  869. cChuanLTStep = 7;
  870. }
  871. else if(cChuanLTStep == 7)
  872. {
  873. if(cMotorStep == 0)cChuanLTStep = 8;
  874. }
  875. else if(cChuanLTStep == 8)
  876. {
  877. cChuanLTDelay = XIA_MO_DW_ERROR_TIME;
  878. cChuanLTStep = 9;
  879. }
  880. else if(cChuanLTStep == 9)
  881. {
  882. if(SM_ORIGIN_IN)
  883. {
  884. cChuanLTStep = 10;
  885. }
  886. else if(cChuanLTDelay == 0)
  887. {
  888. SetAlarmYJ(17);
  889. }
  890. }
  891. else if(cChuanLTStep == 10)
  892. {
  893. cChuanLTStep = 0;
  894. }
  895. }
  896. //切断动作
  897. void QueDuan_NewStr_XiaQue(void)
  898. {
  899. static long save_jiazi_dist;
  900. if((cXiaQieStep == 1) && (bWorkMode || bNext))
  901. {
  902. cXiaQieStep = 2;
  903. cXiaQieDelay = XIA_QIE_ERROR_TIME;
  904. XQ_OUT = 1;
  905. }
  906. else if(cXiaQieStep == 2)
  907. {
  908. if(XQ_ARRIVE_IN)
  909. {
  910. cXiaQieStep = 3;
  911. }
  912. else if(cXiaQieDelay == 0)
  913. {
  914. SetAlarmYJ(14);
  915. }
  916. }
  917. else if((cXiaQieStep == 3) && (bWorkMode || bNext))
  918. {
  919. SQ_OUT = 1;
  920. cXiaQieDelay = SystemParam->CutBackDelay * 10;
  921. cXiaQieStep = 4;
  922. }
  923. else if((cXiaQieStep == 4) && (cXiaQieDelay == 0) && (bWorkMode || bNext))
  924. {
  925. SQ_OUT = 0;
  926. XQ_OUT = 0;
  927. cXiaQieDelay = XIA_QIE_ERROR_TIME;
  928. cXiaQieStep = 5;
  929. }
  930. else if(cXiaQieStep == 5)
  931. {
  932. if(SQ_ORIGIN_IN && XQ_ORIGIN_IN)
  933. {
  934. if(bRunning)
  935. cXiaQieStep = 6;
  936. else
  937. cXiaQieStep = 0;
  938. }
  939. else if(cXiaQieDelay == 0)
  940. {
  941. if(!SQ_ORIGIN_IN) SetAlarmYJ(19);
  942. else if(!XQ_ORIGIN_IN)SetAlarmYJ(18);
  943. }
  944. }
  945. else if(cXiaQieStep == 6)
  946. {
  947. cMotorStep = 40;
  948. save_jiazi_dist = SystemParam->XRealPos;
  949. cXiaQieStep = 7;
  950. }
  951. else if(cXiaQieStep == 7)
  952. {
  953. if(SystemParam->XRealPos >= (save_jiazi_dist + SystemParam->SJZdist))
  954. {
  955. JZ_OUT = 0;
  956. }
  957. if(cMotorStep == 0)
  958. {
  959. cXiaQieStep = 8;
  960. }
  961. }
  962. else if(cXiaQieStep == 8)
  963. {
  964. cXiaQieStep = 0;
  965. }
  966. }
  967. //装拉头动作
  968. void ZhuangLiao_CT_QD_GL(void)
  969. {
  970. if(cZhuangLiaoStep == 1)
  971. {
  972. cZhuangLiaoStep = 2;
  973. }
  974. else if((cZhuangLiaoStep == 2) && (bWorkMode || bNext))
  975. {
  976. JLT_OUT = 1;
  977. cZhuangLiaoDelay = ZLT_ERROR_TIME;
  978. cZhuangLiaoStep = 3;
  979. }
  980. else if(cZhuangLiaoStep == 3)
  981. {
  982. if(JLT_IN)
  983. {
  984. cZhuangLiaoStep = 4;
  985. }
  986. else if(cZhuangLiaoDelay == 0)
  987. {
  988. SetAlarmYJ(26);
  989. }
  990. }
  991. else if((cZhuangLiaoStep == 4) && (bWorkMode || bNext))
  992. {
  993. GL_OUT = 0;
  994. cZhuangLiaoStep = 5;
  995. }
  996. else if((cZhuangLiaoStep == 5))
  997. {
  998. cZhuangLiaoDelay = ZLT_ERROR_TIME;
  999. cZhuangLiaoStep = 6;
  1000. }
  1001. else if(cZhuangLiaoStep == 6)
  1002. {
  1003. if(GL_ORIGIN_IN)
  1004. {
  1005. cZhuangLiaoStep = 7;
  1006. }
  1007. else if(cZhuangLiaoDelay == 0)
  1008. {
  1009. SetAlarmYJ(21);
  1010. }
  1011. }
  1012. else if((cZhuangLiaoStep == 7) && (bWorkMode || bNext))
  1013. {
  1014. SM_OUT = 1;
  1015. cZhuangLiaoDelay = ZLT_ERROR_TIME;
  1016. cZhuangLiaoStep = 8;
  1017. }
  1018. else if((cZhuangLiaoStep == 8) && (bWorkMode || bNext))
  1019. {
  1020. if(SM_ARRIVE_IN)
  1021. {
  1022. cZhuangLiaoStep = 9;
  1023. cZhuangLiaoDelay = SystemParam->CZDelayCheck * 10;
  1024. }
  1025. else if(cZhuangLiaoDelay == 0)
  1026. {
  1027. SetAlarmYJ(13);
  1028. }
  1029. }
  1030. else if((cZhuangLiaoStep == 9) && (cZhuangLiaoDelay == 0) && (bWorkMode || bNext))
  1031. {
  1032. if(LATOU_CHUZHEN_IN)
  1033. {
  1034. if(SystemParam->LockZipperTime)
  1035. {
  1036. cZhuangLiaoDelay = SystemParam->LockZipperTime*10;
  1037. SLT_OUT = 1;
  1038. cZhuangLiaoStep = 20;
  1039. }
  1040. else
  1041. {
  1042. cZhuangLiaoStep = 0;
  1043. ZhuangLiaoOkFlg = 1;
  1044. }
  1045. TryCnt = 0;
  1046. }
  1047. else
  1048. {
  1049. TryCnt++;
  1050. if(TryCnt > 4)
  1051. {
  1052. SetAlarmYJ(27);
  1053. }
  1054. else
  1055. {
  1056. cZhuangLiaoStep = 10;
  1057. }
  1058. }
  1059. }
  1060. else if((cZhuangLiaoStep == 10) && (bWorkMode || bNext)) //装拉头失败重复装几次拉头
  1061. {
  1062. SM_OUT = 0;
  1063. JLT_OUT = 0;
  1064. cZhuangLiaoDelay = XIA_MO_DW_ERROR_TIME;
  1065. cZhuangLiaoStep = 11;
  1066. }
  1067. else if(cZhuangLiaoStep == 11)
  1068. {
  1069. if(SM_ORIGIN_IN)
  1070. {
  1071. cZhuangLiaoStep = 12;
  1072. }
  1073. else if(cZhuangLiaoDelay == 0)
  1074. {
  1075. SetAlarmYJ(17);
  1076. }
  1077. }
  1078. else if(cZhuangLiaoStep == 12)
  1079. {
  1080. cGeiLiaoStep = 1;
  1081. cZhuangLiaoStep = 13;
  1082. }
  1083. else if(cZhuangLiaoStep == 13)
  1084. {
  1085. if(cGeiLiaoStep == 0)
  1086. {
  1087. cZhuangLiaoStep = 14;
  1088. }
  1089. }
  1090. else if(cZhuangLiaoStep == 14)
  1091. {
  1092. cZhuangLiaoStep = 1;
  1093. }
  1094. else if((cZhuangLiaoStep == 20) && (cZhuangLiaoDelay == 0))
  1095. {
  1096. cZhuangLiaoStep = 0;
  1097. ZhuangLiaoOkFlg = 1;
  1098. }
  1099. }
  1100. //给料动作
  1101. void GeiLiao_CT_QD_GL(void)
  1102. {
  1103. if(cGeiLiaoStep == 1)
  1104. {
  1105. if(FirstGeiLiaoFlg == 0)
  1106. {
  1107. cGeiLiaoStep = 6;
  1108. FirstGeiLiaoFlg = 1;
  1109. }
  1110. else
  1111. {
  1112. cGeiLiaoStep = 2;
  1113. }
  1114. }
  1115. else if(cGeiLiaoStep == 2)
  1116. {
  1117. SL_OUT = 1;
  1118. cGeiLiaoStep = 3;
  1119. cGeiLiaoDelay = SONG_LIAO_ERROR_TIME;
  1120. }
  1121. else if(cGeiLiaoStep == 3)
  1122. {
  1123. if(SL_ARRIVE_IN)
  1124. {
  1125. cGeiLiaoStep = 4;
  1126. }
  1127. else if(cGeiLiaoDelay == 0)
  1128. {
  1129. SetAlarmYJ(20);
  1130. }
  1131. }
  1132. else if((cGeiLiaoStep == 4) && (bWorkMode || bNext))
  1133. {
  1134. cGeiLiaoDelay = SONG_LIAO_ERROR_TIME;
  1135. SL_OUT = 0;
  1136. cGeiLiaoStep = 6;
  1137. }
  1138. else if(cGeiLiaoStep == 5)
  1139. {
  1140. /* if(SL_ORIGIN_IN)
  1141. {
  1142. cGeiLiaoStep = 6;
  1143. }
  1144. else if(cGeiLiaoDelay == 0)
  1145. {
  1146. SetAlarmYJ(21);
  1147. } */
  1148. }
  1149. else if((cGeiLiaoStep == 6) && (bWorkMode || bNext))
  1150. {
  1151. cGeiLiaoDelay = SONG_LIAO_ERROR_TIME;
  1152. GL_OUT = 1;
  1153. cGeiLiaoStep = 7;
  1154. }
  1155. else if(cGeiLiaoStep == 7)
  1156. {
  1157. if(GL_ARRIVE_IN)
  1158. {
  1159. cGeiLiaoStep = 10;
  1160. }
  1161. else if(cGeiLiaoDelay == 0)
  1162. {
  1163. SetAlarmYJ(22);
  1164. }
  1165. }
  1166. else if((cGeiLiaoStep == 8) && (bWorkMode || bNext))
  1167. {
  1168. cGeiLiaoDelay = SONG_LIAO_ERROR_TIME;
  1169. GL_OUT = 0;
  1170. cGeiLiaoStep = 9;
  1171. }
  1172. else if(cGeiLiaoStep == 9)
  1173. {
  1174. if(GL_ORIGIN_IN)
  1175. {
  1176. cGeiLiaoStep = 10;
  1177. }
  1178. else if(cGeiLiaoDelay == 0)
  1179. {
  1180. SetAlarmYJ(23);
  1181. }
  1182. }
  1183. else if(cGeiLiaoStep == 10)
  1184. {
  1185. cGeiLiaoStep = 0;
  1186. }
  1187. }
  1188. //手动动作
  1189. void ManualActionYJ(void)
  1190. {
  1191. static unsigned char manual_flag = 0;
  1192. // TestData->DispLay[0] = tXAxisStepper.cCurSpeed;
  1193. // TestData->DispLay[1] = tXAxisStepper.cAutoControlState;
  1194. if(!bRunning)
  1195. {
  1196. if(bQianDianDW)
  1197. {
  1198. bQianDianDW = 0;
  1199. if(cQianDianDWStep == 0)cQianDianDWStep = 1;
  1200. }
  1201. if(bGeiLT)
  1202. {
  1203. bGeiLT = 0;
  1204. if(cGeiLiaoStep == 0)cGeiLiaoStep = 1;
  1205. }
  1206. if(bZhuangLiao)
  1207. {
  1208. bZhuangLiao = 0;
  1209. if(cZhuangLiaoStep == 0)cZhuangLiaoStep = 1;
  1210. }
  1211. if(bChuanLT)
  1212. {
  1213. bChuanLT = 0;
  1214. if(cChuanLTStep == 0)cChuanLTStep = 1;
  1215. }
  1216. if(bQieDuan)
  1217. {
  1218. bQieDuan = 0;
  1219. if(cXiaQieStep == 0)cXiaQieStep = 1;
  1220. }
  1221. if(bClearTotal) //切断计数清零
  1222. {
  1223. bClearTotal = 0;
  1224. SystemParam->Total = 0;
  1225. Save32BitDate(0,8);
  1226. }
  1227. if(bClerNowTotal)
  1228. {
  1229. bClerNowTotal = 0;
  1230. SystemParam->NowTotal = 0;
  1231. Save32BitDate(0,10);
  1232. }
  1233. if(M48)
  1234. {
  1235. if(cMotorStep == 0)cMotorStep = 60;
  1236. }
  1237. else
  1238. {
  1239. if((cMotorStep == 62) && !M49)
  1240. {
  1241. MV_Dec_Stop(X_AXIS);
  1242. }
  1243. }
  1244. if(M49)
  1245. {
  1246. if(cMotorStep == 0)cMotorStep = 80;
  1247. }
  1248. else
  1249. {
  1250. if((cMotorStep == 82) && !M48)
  1251. {
  1252. MV_Dec_Stop(X_AXIS);
  1253. }
  1254. }
  1255. if (M50)
  1256. {
  1257. M50 = 0;
  1258. Y00 = ~Y00;
  1259. }
  1260. if (M51)
  1261. {
  1262. M51 = 0;
  1263. Y01 = ~Y01;
  1264. }
  1265. if (M52)
  1266. {
  1267. M52 = 0;
  1268. if(Y02)
  1269. {
  1270. Y02 = 0;
  1271. }
  1272. else if(GL_ORIGIN_IN)
  1273. {
  1274. Y02 = 1;
  1275. }
  1276. else
  1277. {
  1278. SetAlarmYJ(23);
  1279. }
  1280. }
  1281. if (M53)
  1282. {
  1283. Y03 = ~Y03;
  1284. M53 = 0;
  1285. }
  1286. if (M54)
  1287. {
  1288. Y04 = ~Y04;
  1289. M54 = 0;
  1290. }
  1291. if (M55)
  1292. {
  1293. M55 = 0;
  1294. Y05 = ~Y05;
  1295. }
  1296. if (M56)
  1297. {
  1298. M56 = 0;
  1299. if(Y06)
  1300. {
  1301. Y06 = 0;
  1302. }
  1303. else if(SM_ORIGIN_IN)
  1304. {
  1305. Y06 = 1;
  1306. }
  1307. else
  1308. {
  1309. SetAlarmYJ(17);
  1310. }
  1311. }
  1312. if (M57)
  1313. {
  1314. M57 = 0;
  1315. Y07 = ~Y07;
  1316. }
  1317. if (M58)
  1318. {
  1319. M58 = 0;
  1320. Y10 = ~Y10;
  1321. }
  1322. if (M59)
  1323. {
  1324. M59 = 0;
  1325. Y11 = ~Y11;
  1326. }
  1327. if (M60)
  1328. {
  1329. Y12 = ~Y12;
  1330. M60 = 0;
  1331. }
  1332. if (M61)
  1333. {
  1334. Y13 = ~Y13;
  1335. M61 = 0;
  1336. }
  1337. if (M62)
  1338. {
  1339. M62 = 0;
  1340. Y14 = ~Y14;
  1341. }
  1342. if (M63)
  1343. {
  1344. M63 = 0;
  1345. Y15 = ~Y15;
  1346. }
  1347. if (M64)
  1348. {
  1349. M64 = 0;
  1350. Y16 = ~Y16;
  1351. }
  1352. if (M65)
  1353. {
  1354. M65 = 0;
  1355. Y17 = ~Y17;
  1356. }
  1357. }
  1358. }
  1359. #endif