FYChuantou_HeLian.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. #if FIE_YUE_MACHINE==1
  2. extern void CCChuanTou_HeLian_InitAction(void);
  3. extern void CCChuanTou_HeLian_Action(void);
  4. extern void CCChuanTou_HeLian_SetAlarmCode(unsigned alarm_code);
  5. extern void ExtiAcitionX02(void);
  6. #define DIR_P 1
  7. #define DIR_N 0
  8. #define MOTOR_EN 0
  9. #define MOTOR_DISEN 1
  10. #define MOTOR_ALARM 0
  11. #define MOTOR_NOALARM 1
  12. #define CTHL_VAVLE_ERROR_TIME 3000
  13. #define CTHL_MOTOR_ALARM_TIME 5000
  14. //故障代码列表
  15. #define CTHL_NO_ALARM 0
  16. #define CTHL_WLZDTJ_ALARM 1 //无拉链自动停机
  17. #define CTHL_XKSC_Limit_ALARM 2 //X03斜口上止到位异常
  18. #define CTHL_TLiao_Limit_ALARM 3 //X04推料到位异常
  19. #define CTHL_XMKH_Origin_ALARM 4 //X04推料到位异常
  20. #define CTHL_HSLiao_Limit_ALARM 5 //X06横送料到位异常
  21. #define CTHL_HSLiao_Origin_ALARM 6 //X07横送料原位异常
  22. #define CTHL_JLiao_Limit_ALARM 7 //X10接料到位异常
  23. #define CTHL_CTM_Limit_ALARM 8 //X11穿头模到位异常
  24. #define CTHL_CTM_Origin_ALARM 9 //X12穿头模原位异常
  25. #define CTHL_First_CT_Origin_ALARM 10 //X13一次穿头原位异常
  26. #define CTHL_LTou_Check_ALARM 11 //X14拉头缺料感应异常
  27. #define CTHL_DK_ERROR_ALARM 12 //没有检测到方块
  28. #define CTHL_CX_Limit_ALARM 13 //X16插稍到位感应异常
  29. #define CTHL_XKTD_Origin_ALARM 14 //X17斜口原位感应异常
  30. #define CTHL_CXLimit_ALARM 15 //X20插稍下移到位异常
  31. #define CTHL_SF_ALR_ALARM 16 //X22伺服报警异常
  32. #define CTHL_SF_Origin_ALARM 17 //X23伺服原位(穿链原位)异常
  33. #define CTHL_ZLT_ALARM 18 //装拉头异常
  34. #define CTHL_FK_Check_ALARM 19 //X02方块检测
  35. #define CTHL_FKCXDW_ALARM 20 //方块插销定位异常警告
  36. #define CTHL_YCCRYWYC_ALARM 21 //一次穿入原位异常
  37. #define CTHL_XCXXCYC_ALARM 22 //小插销行程异常
  38. #define CTHL_HENSONGLIAO_ALARM 23 //横送料不能输出
  39. #define CTHL_YCCT_ALARM 24 //一次穿头不能输出
  40. #define CTHL_YCXM_Origin_ALARM 25 //一次穿头和下模不能输出
  41. #define CTHL_DXKCTXM_Origin_ALARM 26 //顶斜口和穿头下模不能输出
  42. #define CTHL_XKTD_ALARM 27 //斜口推带不能有输出
  43. #define CTHL_CXQJD_ALARM 28 //插销前夹带不能有输出
  44. #define CTHL_WFZIDONGCX_ALARM 29 //无法自动插销
  45. #define CTHL_SafeDoor_ALARM 30 //安全门关上才能启动
  46. #define CTHL_AutoStep cStepMByte
  47. #define CTHL_ZhuangLiaoStep cStepMByte1
  48. #define CTHL_TLiaoStep cStepMByte2
  49. #define CTHL_TD_MotorStep cStepMByte3 //拖带电机
  50. #define CTHL_JiaLianStep cStepMByte4
  51. #define CTHL_ZhenDongStep cStepMByte6
  52. #define CTHL_SongLiaoStep cStepMByte7
  53. #define CTHL_CL_MotorStep cStepMByte8 //穿链
  54. #define CTHL_AutoStep1 cStepMByte9
  55. #define CTHL_bFKCXTDDW_Step cStepMByte10
  56. #define CTHL_bCXCR_Step cStepMByte11
  57. #define CTHL_bCLFirst_Step cStepMByte12
  58. #define CTHL_ZhuangLiaoDelay cDelayTime2
  59. #define CTHL_TLiao_Delay cDelayTime3
  60. #define CTHL_TD_MotorDelay cDelayTime4
  61. #define CTHL_AutoDelay cDelayTime5
  62. #define CTHL_DLP_Delay cDelayTime6 //打拉片
  63. #define CTHL_CL_MotorDelay cDelayTime7
  64. #define CTHL_TouchDelay cDelayTime8
  65. #define CTHL_AutoDelay1 cDelayTime9
  66. #define CTHL_ZDP_Delay cDelayTime10
  67. #define CTHL_bCXCR_Delay cDelayTime11
  68. #define CTHL_bFKCXTDDW_Delay cDelayTime12
  69. #define CTHL_bCLFirst_Delay cDelayTime13
  70. #define CTHL_bLTCHECK_Delay cDelayTime14
  71. #define CTHL_bSFBBAOJIN_Delay cDelayTime15
  72. //32位无符号变量
  73. #define CTHL_LianLengthCheck cUDword32Buff1
  74. #define CTHL_LianLengthAutoCheck cUDword32Buff2
  75. #define CTHL_LianLengthReal cUDword32Buff3
  76. #define CTHL_LianLengSave cUDword32Buff4
  77. #define CTHL_LianLengthAutoCheckERROR cUDword32Buff5
  78. #define CTHL_LianLengthCheckOLD cUDword32Buff6
  79. #define CTHL_LianLengthNEWCheck cUDword32Buff7
  80. #define CTHL_Data_Buff cUDword32Buff8
  81. //32位有符号变量
  82. #define CTHL_XSavePosBuff cDword32Buff1
  83. #define CTHL_X_CXPosBuff cDword32Buff2
  84. #define CTHL_YSavePosBuff cDword32Buff3
  85. #define CTHL_CheckInX02PosBuff cDword32Buff4
  86. #define CTHL_YsaveCXDWPosBuff cDword32Buff5
  87. #define CTHL_LENTH cDword32Buff6
  88. #define CTHL_Y_CL_Length cDword32Buff7
  89. #define CTHL_Y_CL_PosBuff cDword32Buff8
  90. //8位变量
  91. #define CTHL_TryCnt cCharBuff1
  92. #define cZipCnt cCharBuff2
  93. #define cStopInCnt cCharBuff3
  94. #define cStopMode cCharBuff4
  95. #define cXcxcrCnt cCharBuff5
  96. #define cWULATOUCnt cCharBuff6
  97. #define cQDXK_DXK cCharBuff7
  98. #define cZDP_Auto cCharBuff8
  99. #define cXCXQXQD cCharBuff9
  100. #define cXiaoChaCNT cCharBuff10
  101. #define cBAOHUCNT cCharBuff11
  102. #define cCHULIANBAOJIN cCharBuff12
  103. #define cHeLian cCharBuff13
  104. #define bSingOneFlg cCharBuff14
  105. //位标志位
  106. #define bTuiLaTouOkFlg bBitFlag0
  107. #define bZhuangLiaoOkFlg bBitFlag1
  108. #define bXiaMoENFlg bBitFlag2
  109. #define bYFirstDingWeiFlg bBitFlag3
  110. #define bCL_EN_FLG bBitFlag4
  111. #define bCL_OK_FLG bBitFlag5
  112. #define bCheckEN_FLG bBitFlag6
  113. #define bSingOneFlg bBitFlag7
  114. #define CTHL_TOTAL_ADDR 76
  115. #define CTHL_SPEED_ADDR 78
  116. #define CTHL_ALARM_ADDR 100
  117. #define CTHL_TRUST_ALARM_ADDR 102
  118. #define CTHL_TEST_ALARM_ADDR 106
  119. #define CTHL_PARAM_CYCLE_PULSE user_datas[0]//0 转一圈脉冲数
  120. #define CTHL_PARAM_CYCLE_LENGTH user_datas[1]//整数 转一圈拖带多长
  121. #define CTHL_PARAM_TD_RunSpeed user_datas[2]//整数 拖带电机拖带速度
  122. #define CTHL_PARAM_FKDW_Speed user_datas[3]//整数 方块定位速度(低速度)
  123. #define CTHL_PARAM_CL_Speed user_datas[4]//整数 合链速度
  124. #define CTHL_PARAM_CL_Back_O_Speed user_datas[5]//整数 合链电机回零速度
  125. #define CTHL_PARAM_FKDW_Length user_datas[6]//0.01 方块定位长度
  126. #define CTHL_PARAM_CXDW_Length user_datas[7]//0.01 插销定位长度
  127. #define CTHL_PARAM_CL_Length user_datas[8]//0.01 合链长度
  128. #define CTHL_PARAM_CL_MAX_Length user_datas[9]//0.01 穿链最长限制
  129. #define CTHL_PARAM_TLiao_BACKDELAY (10*user_datas[10])//0.01推拉头到位延时返回
  130. #define CTHL_PARAM_MaGou_DELAY (10*user_datas[11])//0.01接料到位延时码勾
  131. #define CTHL_PARAM_HSLiaoOff_DELAY (10*user_datas[12])//0.01码勾输出后退横送料
  132. #define CTHL_PARAM_CheckLT_DELAY (10*user_datas[13])//0.01码勾输出后延时检测拉头
  133. #define CTHL_PARAM_SCDWOff_CXDW_DELAY (10*user_datas[14])//0.01退上止定位延时穿插销
  134. #define CTHL_PARAM_First_CL_Timer (10*user_datas[15]) //0.01一次穿入时间
  135. #define CTHL_PARAM_MGOff_XiaMo_DELAY (10*user_datas[16]) //0.01松码勾后延时退下模
  136. #define CTHL_PARAM_CXCR_DELAY (10*user_datas[17]) //0.01插销延时穿入
  137. #define CTHL_PARAM_XKDW_TD_DELAY (10*user_datas[18]) //0.01斜口定位后延时拖带
  138. #define CTHL_PARAM_XK_CR_DELAY (10*user_datas[19]) //0.01斜口延时穿拉头
  139. #define CTHL_PARAM_DXK_XKDW_Off_DELAY (10*user_datas[20]) //0.01顶斜口后延时退斜口定位
  140. #define CTHL_PARAM_XCQJD_XCDW_DELAY (10*user_datas[21]) //0.01插销前夹带后延时插销定位
  141. #define CTHL_PARAM_First_CL_DELAY (10*user_datas[22]) //0.01延时一次穿入
  142. #define CTHL_PARAM_HLJJ_CL_DELAY (10*user_datas[23]) //0.01合链夹具延时穿入
  143. #define CTHL_PARAM_ZDP_Start_TIME (10*user_datas[24]) //0.01振动盘启动延时
  144. #define CTHL_PARAM_ZDP_Stop_TIME (10*user_datas[25]) //0.01振动盘延时停止
  145. #define CTHL_PARAM_XCX_LENTH user_datas[26] //0.01 小插销感应后再走标准长度
  146. #define CTHL_PARAM_XCXWC_LENTH user_datas[27] //0.01 小插销标准长度过长的误差值
  147. #define CTHL_PARAM_TDFZ_LENTH user_datas[28] //0.01拖带电机反转长度
  148. #define CTHL_PARAM_WLCDSHEZHI_LENTH (10* user_datas[29]) //0.1无拉链情况再走长度设置
  149. #define CTHL_PARAM_DXKFZ_LENTH user_datas[30] //顶斜口反转长度
  150. #define CTHL_PARAM_DXKYS_DELAY (user_datas[31]*10) //前顶斜口后延时顶斜口
  151. #define CTHL_PARAM_ZDP_AUTO user_datas[32] //振动盘
  152. #define CTHL_PARAM_TDCR_LowSpeed user_datas[33] //拖带穿入慢速
  153. #define CTHL_PARAM_TDCR_LowSpeedLength user_datas[34] //拖带穿入慢速距离
  154. #define CTHL_PARAM_FKJD_DELAY (user_datas[35]*10) //定位延时方块夹带
  155. #define CTHL_PARAM_FKGD_DELAY (user_datas[36]*10) //延时退方块固定
  156. #define CTHL_PARAM_AUTO_MODE user_datas[37] //手动/自动合链
  157. #define CTHL_PARAM_NLSL_MODE user_datas[39] //尼龙塑料切换 0塑料/1尼龙
  158. #define CTHL_PARAM_HLTSY_LENTH user_datas[40] //合拉头剩余长度
  159. #define CTHL_PARAM_CXMODE user_datas[41] //下移/直插
  160. #define CTHL_PARAM_FKJDSECONG_DEALY (user_datas[42]*10) //拖带时候延时方块夹带
  161. #define CTHL_PARAM_WUCD_LENTH user_datas[43]//拖带时候延时方块夹带
  162. #define CTHL_PARAM_DB_MODE 0//user_datas[44] //伺服报警 0为DB ,1为IO
  163. #define CTHL_PARAM_MATOR_MODE user_datas[45] //伺服报警 0为DB ,1为IO
  164. #define CTHL_PARAM_LaPian_EN user_datas[49] //打拉片开关,0关 1开
  165. #define CTHL_PARAM_DaLaPian (user_datas[46]*10) //打拉片时间
  166. #define CTHL_PARAM_LTJJ_MODE user_datas[47] //拉头夹具
  167. #define CTHL_PARAM_SLT_NUMBER user_datas[48] //送拉头次数
  168. //输入
  169. #define CTHL_START_IN M0384 //X00 //启动
  170. #define CTHL_START_IN_UP (M0384 && !OLDM384)//(X00 && !OLDX00)
  171. #define CTHL_STOP_IN M0385 // X01 //停止
  172. #define CTHL_STOP_IN_UP (M0385 && !OLDM385)//(X01 && !OLDX01)
  173. #define CTHL_STOP_IN_DW (!M0385 && OLDM385)//(!X01 && OLDX01)
  174. #define CTHL_FK_Check M0386 //X02方块检测
  175. #define CTHL_FK_Check_UP (M0386 && !OLDM386)
  176. #define CTHL_FK_Check_DW (!M0386 && OLDM386)
  177. #define CTHL_XKSC_Limit_IN M0387 //X03斜口上止到位
  178. #define CTHL_TLiao_Limit_IN M0388 //X04推料到位
  179. #define CTHL_SafeDoor_IN M0389 //X05安全门
  180. #define CTHL_HSLiao_Limit_IN M0390 //X06横送料到位
  181. #define CTHL_HSLiao_Origin_IN M0391 //X07横送料原位
  182. #define CTHL_JLiao_Limit_IN M0392 //X10接料到位
  183. #define CTHL_CTM_Limit_IN M0393 //X11穿头模到位
  184. #define CTHL_CTM_Origin_IN M0394 //X12穿头模原位
  185. #define CTHL_First_CT_Origin_IN M0395 //X13一次穿头原位
  186. #define CTHL_LTou_Check M0396 //X14拉头缺料感应
  187. #define CTHL_CXSC_Limit_IN M0397 //X15插稍上止感应
  188. #define CTHL_CXSC_Limit_IN_UP (M0397 && !OLDM397)
  189. #define CTHL_CXSC_Limit_IN_DW (!M0397 && OLDM397)
  190. #define CTHL_CX_Limit_IN M0398 //X16插稍到位感应
  191. #define CTHL_XKTD_Origin_IN M0399 //X17斜口推带原位感应
  192. #define CTHL_CXLimit_IN M0400 //X20插稍下移到位
  193. #define CTHL_STOP_INJT M0401 // X21 //急停按钮
  194. #define CTHL_STOP_INJT_UP (M0401 && !OLDM401)//X251
  195. #define CTHL_LTJJ_Origin_IN M0402 //X22 拉头夹具原位
  196. //#define CTHL_SF_ALR_IN M0402 //X22伺服报警
  197. #define CTHL_SF_Origin_IN M0403 //X23伺服原位(穿链原位)
  198. //X24 伺服报警
  199. #define CTHL_ZDP_IN M0404 //X24振动盘
  200. //#define CTHL_SF_ALR_IN M0406 //X26固定方块原位
  201. //输出
  202. /*
  203. #define CTHL_XKDW_VAVLE M0304 //Y00 斜口定位电磁阀
  204. #define CTHL_XKTD_VAVLE M0305 //Y01斜口推带电磁阀
  205. #define CTHL_DXK_VAVLE M0306 //Y02 顶斜口电磁阀
  206. #define CTHL_QDXK_VAVLE M0307 // Y03 前顶斜口电磁阀
  207. #define CTHL_FKGD_VAVLE M0308 //Y04 方块固定电磁阀
  208. #define CTHL_CXSCDW_VAVLE M0309 //Y05 插销上止定位电磁阀
  209. #define CTHL_CXVAVLE M0310 //Y06 插销下移电磁阀
  210. #define CTHL_CXQJD_VAVLE M0311 //Y07 插销前夹带电磁阀
  211. #define CTHL_HLJJ_VAVLE M0313 //Y11合链夹具电磁阀
  212. #define CTHL_CXHDW_VAVLE M0314 //Y12 插销后定位电磁阀
  213. #define CTHL_CXHJD_VAVLE M0315 //Y13 插销后夹带电磁阀
  214. #define CTHL_FKJD_VAVLE M0316 //Y14 方块夹带电磁阀
  215. #define CTHL_TLiao_VAVLE M0317 //Y15 推料电磁阀
  216. #define CTHL_HSLiao_VAVLE M0318 //Y16 横送料电磁阀
  217. #define CTHL_JLTou_VAVLE M0319 //Y17 接拉头电磁阀
  218. #define CTHL_CTXM_VAVLE M0320 //Y20 穿头下模电磁阀
  219. #define CTHL_ZhenDongPian_OUT M0321 //Y21振动盘启动吹气电磁阀
  220. #define CTHL_First_CT_VAVLE M0323 //Y23一次穿头电磁阀
  221. #define CTHL_MGuo_VAVLE M0324 //Y24 码勾电磁阀
  222. #define CTHL_CXDWZ_VAVLE M0326 //Y26插销定位针(到位)电磁阀
  223. */
  224. #define CTHL_LTJJ_VAVLE M0338 //Y10 拉头夹具电磁阀
  225. #define CTHL_DaLaPian_OUT M0338 //Y25 打拉片
  226. #define CTHL_TLiao_VAVLE M0304 //Y00 推料电磁阀
  227. #define CTHL_HSLiao_VAVLE M0305 //Y01 横送料电磁阀
  228. #define CTHL_JLTou_VAVLE M0306 //Y02 接拉头电磁阀
  229. #define CTHL_XKTD_VAVLE M0307 //Y03 斜口推带电磁阀
  230. #define CTHL_XKDW_VAVLE M0308 //Y04 斜口定位电磁阀
  231. #define CTHL_DXK_VAVLE M0309 //Y05 顶斜口电磁阀
  232. #define CTHL_CXVAVLE M0310 //Y06 插销下移电磁阀
  233. #define CTHL_CTXM_VAVLE M0311 //Y07 穿头下模电磁阀
  234. #define CTHL_First_CT_VAVLE M0312 //Y10 一次穿头电磁阀
  235. #define CTHL_FKGD_VAVLE M0313 //Y11 方块固定电磁阀
  236. #define CTHL_CXQJD_VAVLE M0314 //Y12 插销前夹带电磁阀
  237. #define CTHL_CXDWZ_VAVLE M0315 //Y13 插销定位针(到位)电磁阀
  238. #define CTHL_CXHJD_VAVLE M0316 //Y14 插销后夹带电磁阀
  239. #define CTHL_CXHDW_VAVLE M0317 //Y15 插销后定位电磁阀
  240. #define CTHL_FKJD_VAVLE M0318 //Y16 方块夹带电磁阀
  241. #define CTHL_ZhenDongPian_OUT M0319 //Y17 振动盘启动吹气电磁阀
  242. #define CTHL_HLJJ_VAVLE M0320 //Y20 合链夹具电磁阀
  243. #define CTHL_CXSCDW_VAVLE M0321 //Y21 插销上止定位电磁阀
  244. #define CTHL_MGuo_VAVLE M0323 //Y23 码勾电磁阀
  245. #define CTHL_QDXK_VAVLE M0327 // Y27 前顶斜口电磁阀
  246. #define CTHL_Run_State M0329 //Y27 运行灯
  247. #define CTHL_Stop_State M0329 //Y30 停止灯
  248. #define CTHL_SF_ALR_CLR M0329 //Y24 伺服警告清除
  249. //M0~M4全局固定使用
  250. /*
  251. #define bRunning M0000
  252. #define bStart M0001
  253. #define bStop M0002
  254. #define bAlarmStop M0003
  255. #define bClearTotal M0004
  256. */
  257. #define CTHL_bTLiao M0005 //手动推料
  258. #define CTHL_bHSL M0006 //手动横送料
  259. #define CTHL_bJLT M0007 //接拉头
  260. #define CTHL_bMG M0008 //码勾
  261. #define CTHL_bFKJD M0009 //方块夹带
  262. #define CTHL_bXKTD M0010 //斜口推带
  263. #define CTHL_bXKDW M0011 //斜口定位
  264. #define CTHL_bCTXM M0012 //穿头下模
  265. #define CTHL_bDXK M0013 //顶斜口
  266. #define CTHL_bFKGD M0014 //方块固定
  267. #define CTHL_bCXQJD M0015 //插销前夹带
  268. #define CTHL_bCXSY M0016 //插销上移电磁阀
  269. #define CTHL_bCXDWZ M0017 //Y14 插销定位针电磁阀
  270. #define CTHL_bCXHJD M0018 //Y15 插销后夹带电磁阀
  271. #define CTHL_bCXHDW M0019 //Y16 插销后定位电磁阀
  272. //#define CTHL_bCXDWCheck M0020 //Y17 插销到位电磁阀
  273. #define CTHL_bFirst_CT M0021 //Y20 一次穿头电磁阀
  274. #define CTHL_bHLJJ M0022 //Y21 合链夹具电磁阀
  275. #define CTHL_bCXSCDW M0023 //Y23 插销上止定位电磁阀
  276. #define CTHL_bCLMotor_P M0026 //穿链电机正转
  277. #define CTHL_bCLMotor_N M0025 //穿链电机反转
  278. //下面为动作组合按键
  279. #define CTHL_bAutoZhuangLiao M0024 //自动装料
  280. #define CTHL_bCLMotor_O M0027 //穿链电机定位原点
  281. #define CTHL_bCL_First M0028 //一次穿链动作
  282. #define CTHL_bFKTDDW M0029 //拖带方块定位
  283. #define CTHL_bFKCXTDDW M0030 //拖带方块插销定位
  284. #define CTHL_bCXMotorDW M0031 //插销电机前定位
  285. #define CTHL_bCXCR M0032 //插销穿入(包含电机前定位,插销下移,后夹,后定位)
  286. #define CTHL_bMotorHL M0033 //电机合链操作
  287. #define CTHL_bQianDXK M0034 //Y27 前顶斜口电磁阀
  288. #define CTHL_bTDMotor_N M0035 //拖带电机正转
  289. #define CTHL_bTDMotor_P M0036 //拖带电机反转
  290. #define CTHL_bLTJJ M0037 //拉头夹具
  291. #define CTHL_bSingleone M0038 //单循环
  292. #define CTHL_DANBU_MODE M0048 //单步动作
  293. //#define CTHL_bCloseAuto M0036 //关闭自动振动盘
  294. #endif