YWXChuantou_HeLian.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. #if YU_WEN_XUAN_MACHINE==1
  2. extern void YWXChuanTou_HeLian_InitAction(void);
  3. extern void YWXChuanTou_HeLian_Action(void);
  4. extern void YWXChuanTou_HeLian_SetAlarmCode(unsigned alarm_code);
  5. extern void ExtiAcitionX02(void);
  6. extern void ExtiAcitionX02_CTHeLian_TwoMotor(void);
  7. #define DIR_P 1
  8. #define DIR_N 0
  9. #define MOTOR_EN 0
  10. #define MOTOR_DISEN 1
  11. #define YWX_CTHL_VAVLE_ERROR_TIME 3000
  12. #define YWX_CTHL_MOTOR_ALARM_TIME 5000
  13. //故障代码列表
  14. #define YWX_CTHL_NO_ALARM 0
  15. #define YWX_CTHL_WLZDTJ_ALARM 1 //无拉链自动停机
  16. #define YWX_CTHL_XKSC_Limit_ALARM 2 //X03斜口上止到位异常
  17. #define YWX_CTHL_TLiao_Limit_ALARM 3 //X04推料到位异常
  18. #define YWX_CTHL_HSLiao_Limit_ALARM 5 //X06横送料到位异常
  19. #define YWX_CTHL_HSLiao_Origin_ALARM 6 //X07横送料原位异常
  20. #define YWX_CTHL_JLiao_Limit_ALARM 7 //X10接料到位异常
  21. #define YWX_CTHL_CTM_Limit_ALARM 8 //X11穿头模到位异常
  22. #define YWX_CTHL_CTM_Origin_ALARM 9 //X12穿头模原位异常
  23. #define YWX_CTHL_First_CT_Origin_ALARM 10 //X13一次穿头原位异常
  24. #define YWX_CTHL_LTou_Check_ALARM 11 //X14拉头缺料感应异常
  25. #define YWX_CTHL_CXSC_Limit_ALARM 12 //X15插稍上止感应异常
  26. #define YWX_CTHL_CX_Limit_ALARM 13 //X16插稍到位感应异常
  27. #define YWX_CTHL_XKTD_Origin_ALARM 14 //X17斜口原位感应异常
  28. #define YWX_CTHL_CXXY_Limit_ALARM 15 //X20插稍下移到位异常
  29. #define YWX_CTHL_SF_ALR_ALARM 16 //X22伺服报警异常
  30. #define YWX_CTHL_SF_Origin_ALARM 17 //X23伺服原位(穿链原位)异常
  31. #define YWX_CTHL_ZLT_ALARM 18 //装拉头异常
  32. #define YWX_CTHL_FK_Check_ALARM 19 //X02方块检测
  33. #define YWX_CTHL_FKCXDW_ALARM 20 //方块插销定位异常警告
  34. #define YWX_CTHL_YCCRYWYC_ALARM 21 //一次穿入原位异常
  35. #define YWX_CTHL_XCXXCYC_ALARM 22 //小插销行程异常
  36. #define YWX_CTHL_HENSONGLIAO_ALARM 23 //横送料不能输出
  37. #define YWX_CTHL_YCCT_ALARM 24 //一次穿头不能输出
  38. #define YWX_CTHL_YCXM_Origin_ALARM 25 //一次穿头和下模不能输出
  39. #define YWX_CTHL_DXKCTXM_Origin_ALARM 26 //顶斜口和穿头下模不能输出
  40. #define YWX_CTHL_XKTD_ALARM 27 //斜口推带不能有输出
  41. #define YWX_CTHL_CXQJD_ALARM 28 //插销前夹带不能有输出
  42. #define YWX_CTHL_WFZIDONGCX_ALARM 29 //无法自动插销
  43. #define YWX_CTHL_SafeDoor_ALARM 30 //安全门关上才能启动
  44. #define YWX_CTHL_XCFW_DW_ALARM 31 //X20插销穿入异常
  45. #define YWX_CTHL_FKSC_DW_ALARM 32 //X23方块上止到位异常
  46. #define YWX_CTHL_FKSC_TDW_ALARM 33 //X21方块上止到位异常
  47. #define YWX_CTHL_GQ_IN_ALARM 34 //光纤检测
  48. #define YWX_CTHL_AutoStep cStepMByte
  49. #define YWX_CTHL_ZhuangLiaoStep cStepMByte1
  50. #define YWX_CTHL_TLiaoStep cStepMByte2
  51. #define YWX_CTHL_TD_MotorStep cStepMByte3 //拖带电机
  52. #define YWX_CTHL_JiaLianStep cStepMByte4
  53. #define YWX_CTHL_ZhenDongStep cStepMByte6
  54. #define YWX_CTHL_SongLiaoStep cStepMByte7
  55. #define YWX_CTHL_FZ_MotorStep cStepMByte8 //穿链
  56. #define YWX_CTHL_AutoStep1 cStepMByte9
  57. #define YWX_CTHL_bFKCXTDDW_Step cStepMByte10
  58. #define YWX_CTHL_bCXCR_Step cStepMByte11
  59. #define YWX_CTHL_bCLFirst_Step cStepMByte12
  60. #define YWX_CTHL_ZhuangLiaoDelay cDelayTime2
  61. #define YWX_CTHL_TLiao_Delay cDelayTime3
  62. #define YWX_CTHL_TD_MotorDelay cDelayTime4
  63. #define YWX_CTHL_AutoDelay cDelayTime5
  64. #define YWX_CTHL_TestDelay cDelayTime6
  65. #define YWX_CTHL_FZ_MotorDelay cDelayTime7
  66. #define YWX_CTHL_TouchDelay cDelayTime8
  67. #define YWX_CTHL_AutoDelay1 cDelayTime9
  68. #define YWX_CTHL_ZDP_Delay cDelayTime10
  69. #define YWX_CTHL_bCXCR_Delay cDelayTime11
  70. #define YWX_CTHL_bFKCXTDDW_Delay cDelayTime12
  71. #define YWX_CTHL_bFKCheck_Time cDelayTime13
  72. #define YWX_CTHL_bLTCHECK_Delay cDelayTime14
  73. #define YWX_CTHL_bSFBBAOJIN_Delay cDelayTime15
  74. //32位无符号变量
  75. #define YWX_CTHL_LianLengthCheck cUDword32Buff1
  76. #define YWX_CTHL_LianLengthAutoCheck cUDword32Buff2
  77. #define YWX_CTHL_LianLengthCheckOld cUDword32Buff3
  78. #define YWX_CTHL_LianLengthBuff cUDword32Buff4
  79. //32位有符号变量
  80. #define YWX_CTHL_XSavePosBuff cDword32Buff1
  81. #define YWX_CTHL_X_CXPosBuff cDword32Buff2
  82. #define YWX_CTHL_YSavePosBuff cDword32Buff3
  83. #define YWX_CTHL_CheckInX02PosBuff cDword32Buff4
  84. #define YWX_CTHL_YsaveCXDWPosBuff cDword32Buff5
  85. #define YWX_CTHL_LENTH cDword32Buff6
  86. #define YWX_CTHL_XSavePosBuff1 cDword32Buff7
  87. //16位变量
  88. #define YWX_CTHL_RunStepSave cUShort16Buff1
  89. #define YWX_CTHL_Test cUShort16Buff2
  90. #define YWX_CTHL_DataBuff cUShort16Buff3
  91. //8位变量
  92. #define YWX_CTHL_TryCnt cCharBuff1
  93. #define YWX_CTHL_cZipCnt cCharBuff2
  94. #define cStopInCnt cCharBuff3
  95. #define cStopMode cCharBuff4
  96. #define cXcxcrCnt cCharBuff5
  97. #define cWULATOUCnt cCharBuff6
  98. #define cFKCheckCnt cCharBuff7
  99. #define cDinWeiStep cCharBuff8
  100. //位标志位
  101. #define bTuiLaTouOkFlg bBitFlag0
  102. #define bZhuangLiaoOkFlg bBitFlag1
  103. #define bXiaMoENFlg bBitFlag2
  104. #define bHeLaTouOK bBitFlag3
  105. #define bCL_EN_FLG bBitFlag4
  106. #define bCL_OK_FLG bBitFlag5
  107. #define bCheckEN_FLG bBitFlag6
  108. #define bSingOneFlg bBitFlag7
  109. #define YWX_CTHL_bFZ_LengthOK bBitFlag8
  110. #define YWX_CTHL_bFirst_CheckOK bBitFlag9
  111. #define YWX_CTHL_bQDinWeiOK bBitFlag10
  112. #define YWX_CTHL_bHDinWeiOk bBitFlag11
  113. #define YWX_CTHL_bFirstFKOK bBitFlag12
  114. #define YWX_CTHL_TOTAL_ADDR 76
  115. #define YWX_CTHL_WORK_TOTAL_ADDR 102
  116. #define YWX_CTHL_SPEED_ADDR 78
  117. #define YWX_CTHL_ALARM_ADDR 100
  118. #define YWX_CTHL_PARAM_TDCYCLE_PULSE user_datas[0]//0 转一圈脉冲数
  119. #define YWX_CTHL_PARAM_TDCYCLE_LENGTH user_datas[1]//整数 转一圈拖带多长
  120. #define YWX_CTHL_PARAM_FZCYCLE_PULSE user_datas[2]//0 转一圈脉冲数
  121. #define YWX_CTHL_PARAM_FZCYCLE_LENGTH user_datas[3]//整数 转一圈拖带多长
  122. #define YWX_CTHL_PARAM_TD_RunSpeed user_datas[4]//整数 拖带电机拖带速度
  123. #define YWX_CTHL_PARAM_FKDW_Speed user_datas[5]//整数 方块定位速度(低速度)
  124. #define YWX_CTHL_PARAM_FZ_Speed user_datas[6]//整数 反转速度
  125. #define YWX_CTHL_PARAM_FKSCDW_Speed user_datas[7]//整数 方块上止定位速度
  126. #define YWX_CTHL_PARAM_FKDW_Length user_datas[8]//0.01 方块定位长度
  127. #define YWX_CTHL_PARAM_CXDW_Length user_datas[9]//0.01 插销定位长度
  128. #define YWX_CTHL_PARAM_CL_Length user_datas[10]//0.01 合链长度
  129. #define YWX_CTHL_PARAM_CL_MAX_Length user_datas[11]//0.01 穿链最长限制
  130. #define YWX_CTHL_PARAM_TLiao_BACKDELAY (10*user_datas[12])//0.01推拉头到位延时返回
  131. #define YWX_CTHL_PARAM_MaGou_DELAY (10*user_datas[13])//0.01接料到位延时码勾
  132. #define YWX_CTHL_PARAM_HSLiaoOff_DELAY (10*user_datas[14])//0.01码勾输出后退横送料
  133. #define YWX_CTHL_PARAM_CheckLT_DELAY (10*user_datas[15])//0.01码勾输出后延时检测拉头
  134. #define YWX_CTHL_PARAM_FKSC_DW_DELAY (user_datas[16]) //0.01方块上止反转定位长度
  135. #define YWX_CTHL_PARAM_FZCR_DELAY (10*user_datas[17]) //0.01退上止定位延时穿入
  136. #define YWX_CTHL_PARAM_MGOff_XiaMo_DELAY (10*user_datas[18]) //0.01松码勾后延时退下模
  137. #define YWX_CTHL_PARAM_CXCR_DELAY (10*user_datas[19]) //0.01插销延时穿插销
  138. #define YWX_CTHL_PARAM_DXK_DELAY (10*user_datas[20]) //0.01延时顶斜口
  139. #define YWX_CTHL_PARAM_XK_CR_DELAY (10*user_datas[21]) //0.01斜口延时穿拉头
  140. #define YWX_CTHL_PARAM_GDFK_DELAY (10*user_datas[22]) //0.01延时固定方块
  141. #define YWX_CTHL_PARAM_DWCX_DELAY (10*user_datas[23]) //0.01延时插销定位
  142. #define YWX_CTHL_PARAM_BAIBI_TUI_YALUN_DELAY (10*user_datas[24]) //0.01摆臂后延时退压轮
  143. #define YWX_CTHL_PARAM_ZDP_Start_TIME (10*user_datas[25]) //0.01振动盘启动延时
  144. #define YWX_CTHL_PARAM_ZDP_Stop_TIME (10*user_datas[26]) //0.01振动盘延时停止
  145. #define YWX_CTHL_PARAM_CXCR_O_Time (10*user_datas[27]) //0.01 小插穿入辅助时间
  146. #define YWX_CTHL_PARAM_XXCR_LENTH user_datas[28] //0.01 插销穿入长度
  147. #define YWX_CTHL_PARAM_WLCDSHEZHI_LENTH (user_datas[29]) //0.1无拉链情况再走长度设置
  148. #define YWX_CTHL_PARAM_DWXM_DELAY (10*user_datas[30]) //0.01延时定位斜码
  149. #define YWX_CTHL_PARAM_NL_JY_SELECT (user_datas[31]) //尼龙胶牙选择
  150. #define YWX_CTHL_PARAM_SDXZ (user_datas[32]) //反转时速度修正,倒退轮的速度和长度修正
  151. //输入
  152. #define YWX_CTHL_START_IN M0384 //X00 //启动
  153. #define YWX_CTHL_START_IN_UP (M0384 && !OLDM384)//(X00 && !OLDX00)
  154. #define YWX_CTHL_STOP_IN M0385 // X01 //停止
  155. #define YWX_CTHL_STOP_IN_UP (M0385 && !OLDM385)//(X01 && !OLDX01)
  156. #define YWX_CTHL_STOP_IN_DW (!M0385 && OLDM385)//(!X01 && OLDX01)
  157. #define YWX_CTHL_FK_Check M0386 //X02方块检测
  158. #define YWX_CTHL_FK_Check_UP (M0386 && !OLDM386)//(X02 && !OLDX02)
  159. #define YWX_CTHL_FK_Check_DW (!M0386 && OLDM386)//(!X02 && OLDX02)
  160. #define YWX_CTHL_FKDW_IN M0387 //X03方块感应定位
  161. #define YWX_CTHL_FKDW_IN_UP (M0387 && !OLDM387)
  162. #define YWX_CTHL_FKDW_IN_DW (!M0387 && OLDM387)
  163. #define YWX_CTHL_XKTDW M0388 //X04斜口(上止)推到位
  164. #define YWX_CTHL_CX_Check M0389 //X05插销检测
  165. #define YWX_CTHL_LL_KaDai M0390 //X06拉链卡带(拉链接头)
  166. #define YWX_CTHL_GQ_IN M0391 //X07光纤感应
  167. #define YWX_CTHL_TLiao_Limit_IN M0392 //X10推料到位
  168. #define YWX_CTHL_HSLiao_Origin_IN M0393 //X11横送料原位
  169. #define YWX_CTHL_HSLiao_Limit_IN M0394 //X12横送料到位
  170. #define YWX_CTHL_LTou_Check M0395 //X13拉头缺料感应(码勾)
  171. #define YWX_CTHL_CTM_Origin_IN M0396 //X14穿头模原位
  172. #define YWX_CTHL_CTM_Limit_IN M0397 //X15穿头模到位
  173. #define YWX_CTHL_JLiao_Limit_IN M0398 //X16接拉头到位
  174. #define YWX_CTHL_ZDP_IN M0399 //X17振动盘
  175. #define YWX_CTHL_XCFW_DW_IN M0400 //X20插销复位到位
  176. #define YWX_CTHL_FKSC_TDW_IN M0401 //X21方块上止后退到位
  177. #define YWX_CTHL_FKGD_DW_IN M0402 //X22方块固定到位
  178. #define YWX_CTHL_FKSC_DW_IN M0403 //X23方块上止到位
  179. //输出
  180. #define YWX_CTHL_FKGD_VAVLE M0304 //Y00方块固定
  181. #define YWX_CTHL_DXK_VAVLE M0305 //Y01顶斜口电磁阀
  182. #define YWX_CTHL_XKDW_VAVLE M0306 //Y02斜口定位(定位上止)
  183. #define YWX_CTHL_FWCX_VAVLE M0307 //Y03复位插销
  184. #define YWX_CTHL_BAIBI_VAVLE M0308 //Y04摆臂
  185. #define YWX_CTHL_HELT_VAVLE M0309 //Y05合拉头
  186. #define YWX_CTHL_YADAI_VAVLE M0310 //Y06压带
  187. #define YWX_CTHL_TLiao_VAVLE M0311 //Y07推料
  188. #define YWX_CTHL_HSLiao_VAVLE M0312 //Y10横送料
  189. #define YWX_CTHL_JLTou_VAVLE M0313 //Y11接拉头
  190. #define YWX_CTHL_MGuo_VAVLE M0314 //Y12码勾
  191. #define YWX_CTHL_CTXM_VAVLE M0315 //Y13穿头下模
  192. #define YWX_CTHL_ZhenDongPian_OUT M0316 //Y14振动盘
  193. #define YWX_CTHL_LYLun_VAVLE M0317 //Y15方块压轮
  194. #define YWX_CTHL_RYLun_VAVLE M0318 //Y16插销压轮
  195. #define YWX_CTHL_SF_ALR_CLR M0324 //Y24 伺服警告清除
  196. #define YWX_CTHL_Run_State M0325 //Y25 运行灯
  197. #define YWX_CTHL_Stop_State M0326 //Y26 停止灯
  198. #define YWX_CTHL_TestLED M0328 //Y30 测试状态灯
  199. //M0~M4全局固定使用
  200. /*
  201. #define bRunning M0000
  202. #define bStart M0001
  203. #define bStop M0002
  204. #define bAlarmStop M0003
  205. #define bClearTotal M0004
  206. */
  207. #define YWX_CTHL_bFKGD M0005 //方块固定
  208. #define YWX_CTHL_bDXK M0006 //顶斜口(推上止)
  209. #define YWX_CTHL_bXKDW M0007 //斜口定位(定位上止)
  210. #define YWX_CTHL_bFWCX M0008 //复位插销
  211. #define YWX_CTHL_bBB M0009 //摆臂
  212. //退插销
  213. //夹带
  214. #define YWX_CTHL_bTLiao M0012 //手动推料
  215. #define YWX_CTHL_bHSL M0013 //手动横送料
  216. #define YWX_CTHL_bJLT M0014 //接拉头
  217. #define YWX_CTHL_bMG M0015 //码勾
  218. #define YWX_CTHL_bCTXM M0016 //穿头下模
  219. #define YWX_CTHL_bLYLun M0017 //左压轮
  220. #define YWX_CTHL_bRYLun M0018 //右压轮
  221. #define YWX_CTHL_bHeLT M0019 //合拉头
  222. #define YWX_CTHL_bYD M0020 //压带
  223. #define YWX_CTHL_bZDP M0021 //振动盘
  224. #define YWX_CTHL_bTiaoShiMode M0040 //调试模式
  225. #define YWX_CTHL_bTiaoShiStep M0041 //调试单步
  226. /*
  227. #define YWX_CTHL_bFKJD M0009 //方块夹带
  228. #define YWX_CTHL_bXKTD M0010 //
  229. #define YWX_CTHL_bCXSY M0016 //插销上移电磁阀
  230. #define YWX_CTHL_bCXDWZ M0017 //Y14 插销定位针电磁阀
  231. #define YWX_CTHL_bCXHJD M0018 //Y15 插销后夹带电磁阀
  232. #define YWX_CTHL_bCXHDW M0019 //Y16 插销后定位电磁阀
  233. //#define YWX_CTHL_bCXDWCheck M0020 //Y17 插销到位电磁阀
  234. #define YWX_CTHL_bFirst_CT M0021 //Y20 一次穿头电磁阀
  235. #define YWX_CTHL_bHLJJ M0022 //Y21 合链夹具电磁阀
  236. #define YWX_CTHL_bCXSCDW M0023 //Y23 插销上止定位电磁阀
  237. */
  238. #define YWX_CTHL_bCLMotor_P M0026 //穿链电机正转
  239. #define YWX_CTHL_bCLMotor_N M0025 //穿链电机反转
  240. //下面为动作组合按键
  241. #define YWX_CTHL_bAutoZhuangLiao M0024 //自动装料
  242. #define YWX_CTHL_bCLMotor_O M0027 //穿链电机定位原点
  243. #define YWX_CTHL_bCL_First M0028 //一次穿链动作
  244. #define YWX_CTHL_bFKTDDW M0029 //拖带方块定位
  245. #define YWX_CTHL_bFKCXTDDW M0030 //拖带方块插销定位
  246. #define YWX_CTHL_bCXMotorDW M0031 //插销电机前定位
  247. #define YWX_CTHL_bCXCR M0032 //插销穿入(包含电机前定位,插销下移,后夹,后定位)
  248. #define YWX_CTHL_bMotorHL M0033 //电机合链操作
  249. #endif