YXTWOChuantou_HeLian.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. #if FJ_YING_XING_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. #define DIR_P 1
  7. #define DIR_N 0
  8. #define MOTOR_EN 0
  9. #define MOTOR_DISEN 1
  10. #define YX_CTHL_VAVLE_ERROR_TIME 3000
  11. #define YX_CTHL_MOTOR_ALARM_TIME 5000
  12. //故障代码列表
  13. #define YX_CTHL_NO_ALARM 0
  14. #define YX_CTHL_WLZDTJ_ALARM 1 //无拉链自动停机
  15. #define YX_CTHL_XKSC_Limit_ALARM 2 //X03斜口上止到位异常
  16. #define YX_CTHL_TLiao_Limit_ALARM 3 //X04推料到位异常
  17. #define YX_CTHL_COLOR_IN_ALARM 4 //色标感应异常
  18. #define YX_CTHL_HSLiao_Limit_ALARM 5 //X06横送料到位异常
  19. #define YX_CTHL_HSLiao_Origin_ALARM 6 //X07横送料原位异常
  20. #define YX_CTHL_JLiao_Origin_ALARM 7 //X10接料到原位异常
  21. #define YX_CTHL_CTM_Limit_ALARM 8 //X11穿头模到位异常
  22. #define YX_CTHL_CTM_Origin_ALARM 9 //X12穿头模原位异常
  23. #define YX_CTHL_FKDW_Limit_ALARM 10 //X13一次穿头原位异常
  24. #define YX_CTHL_LTou_Check_ALARM 11 //X14拉头缺料感应异常
  25. #define YX_CTHL_TQM_Limit_ALARM 12 //X15插稍上止感应异常
  26. #define YX_CTHL_CX_Limit_ALARM 13 //X16插稍到位感应异常
  27. #define YX_CTHL_XKTD_Origin_ALARM 14 //X17斜口原位感应异常
  28. #define YX_CTHL_XIAOCHA_ALARM 15 //X20插稍下移到位异常
  29. #define YX_CTHL_SF_ALR_ALARM 16 //X22伺服报警异常
  30. #define YX_CTHL_SF_Origin_ALARM 17 //X23伺服原位(穿链原位)异常
  31. #define YX_CTHL_ZLT_ALARM 18 //装拉头异常
  32. #define YX_CTHL_FKYC_ALARM 19 //无方块或检测异常
  33. #define YX_CTHL_AutoStep cStepMByte
  34. #define YX_CTHL_ZhuangLiaoStep cStepMByte1
  35. #define YX_CTHL_TLiaoStep cStepMByte2
  36. #define YX_CTHL_TD_MotorStep cStepMByte3 //拖带电机
  37. #define YX_CTHL_JiaLianStep cStepMByte4
  38. #define YX_CTHL_ZhenDongStep cStepMByte6
  39. #define YX_CTHL_SongLiaoStep cStepMByte7
  40. #define YX_CTHL_FZ_MotorStep cStepMByte8 //穿链
  41. #define YX_CTHL_AutoStep1 cStepMByte9
  42. #define YX_CTHL_ColorStep cStepMByte10
  43. #define YX_CTHL_ZhuangLiaoDelay cDelayTime2
  44. #define YX_CTHL_TLiao_Delay cDelayTime3
  45. #define YX_CTHL_TD_MotorDelay cDelayTime4
  46. #define YX_CTHL_AutoDelay cDelayTime5
  47. #define YX_CTHL_TestDelay cDelayTime6
  48. #define YX_CTHL_FZ_MotorDelay cDelayTime7
  49. #define YX_CTHL_TouchDelay cDelayTime8
  50. #define YX_CTHL_AutoDelay1 cDelayTime9
  51. #define YX_CTHL_ZDP_Delay cDelayTime10
  52. #define YX_CTHL_MOTORZ_Delay cDelayTime11
  53. #define YX_CTHL_bColor_Delay cDelayTime12
  54. //32位无符号变量
  55. #define YX_CTHL_LianLengthCheck cUDword32Buff1
  56. #define YX_CTHL_LianLengthAutoCheck cUDword32Buff2
  57. #define YX_CTHL_LianLengthCheckOld cUDword32Buff3
  58. #define YX_CTHL_LianLengthBuff cUDword32Buff4
  59. #define YX_CTHL_LianLengthAutoCheckERROR cUDword32Buff5
  60. #define YX_CTHL_LianLengthAutoCRCDcheck cUDword32Buff6
  61. #define YX_CTHL_LianLengthAutoFZcheck cUDword32Buff7
  62. #define YX_CTHL_LianLengthAutoSECONDcheck cUDword32Buff8
  63. #define YX_CTHL_LianLengthAutoSECONDONEcheck cUDword32Buff9
  64. #define YX_CTHL_LianLengthAutoTHREEcheck cUDword32Buff10
  65. #define YX_CTHL_LianLengthAutoTD_CHECK cUDword32Buff11
  66. //32位有符号变量
  67. #define YX_CTHL_XSavePosBuff cDword32Buff1
  68. #define YX_CTHL_X_CXPosBuff cDword32Buff2
  69. #define YX_CTHL_YSavePosBuff cDword32Buff3
  70. #define YX_CTHL_CheckInX02PosBuff cDword32Buff4
  71. #define YX_CTHL_YsaveCXDWPosBuff cDword32Buff5
  72. #define YX_CTHL_LENTH cDword32Buff6
  73. #define YX_CTHL_XSavePosBuff1 cDword32Buff7
  74. #define YX_CTHL_XSavePosBuff2 cDword32Buff8
  75. #define YX_CTHL_XSavePosBuff3 cDword32Buff9
  76. //16位变量
  77. #define YX_CTHL_RunStepSave cUShort16Buff1
  78. #define YX_CTHL_Test cUShort16Buff2
  79. //8位变量
  80. #define YX_CTHL_TryCnt cCharBuff1
  81. #define YX_CTHL_cZipCnt cCharBuff2
  82. #define YX_CTHL_stop cCharBuff3
  83. #define YX_CTHL_AUTO_start cCharBuff4
  84. #define YX_CTHL_MOTOR_MODE cCharBuff5
  85. #define YX_CTHL_wltzi cCharBuff6
  86. #define YX_CTHL_FKJC cCharBuff7
  87. #define YX_CTHL_cONERROR cCharBuff8
  88. //位标志位
  89. #define bTuiLaTouOkFlg bBitFlag0
  90. #define bZhuangLiaoOkFlg bBitFlag1
  91. #define bXiaMoENFlg bBitFlag2
  92. #define bHeLaTouOK bBitFlag3
  93. #define bCL_EN_FLG bBitFlag4
  94. #define bCL_OK_FLG bBitFlag5
  95. #define bCheckEN_FLG bBitFlag6
  96. #define bSingOneFlg bBitFlag7
  97. #define YX_CTHL_bFZ_LengthOK bBitFlag8
  98. #define YX_CTHL_bFirst_CheckOK bBitFlag9
  99. #define YX_CTHL_bQDinWeiOK bBitFlag10
  100. #define YX_CTHL_bHDinWeiOk bBitFlag11
  101. #define YX_CTHL_ZhouWanone bBitFlag12
  102. #define YX_CTHL_ZhouWantwo bBitFlag13
  103. #define YX_CTHL_TOTAL_ADDR 76
  104. #define YX_CTHL_SPEED_ADDR 78
  105. #define YX_CTHL_ALARM_ADDR 100
  106. #define YX_CTHL_TRUST_ALARM_ADDR 102
  107. #define YX_CTHL_TEST_ALARM_ADDR 106
  108. //104、105地址 作产量锁
  109. #define YX_CTHL_PARAM_TDCYCLE_PULSE user_datas[0]//0 转一圈脉冲数
  110. #define YX_CTHL_PARAM_TDCYCLE_LENGTH user_datas[1]//整数 转一圈拖带多长
  111. #define YX_CTHL_PARAM_FZCYCLE_LENGTH user_datas[2]//0 转一圈脉冲数
  112. #define YX_CTHL_PARAM_FZLDCYCLE_LENGTH user_datas[3]//整数 转一圈拖带多长
  113. #define YX_CTHL_PARAM_TD_RunSpeed user_datas[4]//整数 拖带电机拖带速度
  114. #define YX_CTHL_PARAM_FKDW_Speed user_datas[5]//整数 方块定位速度(低速度)
  115. #define YX_CTHL_PARAM_FZ_Speed user_datas[6]//整数 反转速度
  116. #define YX_CTHL_PARAM_first_CL_MAX_Length user_datas[7]//第一条拉链最长度
  117. #define YX_CTHL_PARAM_FKDW_Length user_datas[8]//0.01 方块定位长度
  118. #define YX_CTHL_PARAM_TXCYL_BACK_DELAY (10*user_datas[9])//0.01延时退小插压轮
  119. #define YX_CTHL_PARAM_TCXC_BACK_DELAY (10*user_datas[10])//0.01穿入小插后延时退插小插
  120. #define YX_CTHL_PARAM_HLT_SPEED_Speed user_datas[11]//合拉头速度
  121. #define YX_CTHL_PARAM_TLiao_BACKDELAY (10*user_datas[12])//0.01推拉头到位延时返回
  122. #define YX_CTHL_PARAM_MaGou_DELAY (10*user_datas[13])//0.01接料到位延时码勾
  123. #define YX_CTHL_PARAM_HSLiaoOff_DELAY (10*user_datas[14])//0.01码勾输出后退横送料
  124. #define YX_CTHL_PARAM_CheckLT_DELAY (10*user_datas[15])//0.01码勾输出后延时检测拉头
  125. #define YX_CTHL_PARAM_WLCDSHEZHI_LENTH user_datas[16] //拉带报警长度
  126. #define YX_CTHL_PARAM_GDQMTD_BACK_DELAY (10*user_datas[17])//0.01固定前码后延时拖带
  127. #define YX_CTHL_PARAM_XCDWTD_BACK_DELAY (10*user_datas[18])//0.01大插压轮退回来后延时小插定位
  128. #define YX_CTHL_PARAM_TQM_DELAY (10*user_datas[19]) //0.01 下模上来后延时推前码
  129. #define YX_CTHL_PARAM_FMOTOR_BILI (98/100)//(user_datas[20]/100) //0.01 副电机指数
  130. #define YX_CTHL_PARAM_TDCT_DELAY (10*user_datas[21]) //0.01 延时输出压轮
  131. #define YX_CTHL_PARAM_CXDW_Length user_datas[22] //插销定位长度
  132. #define YX_CTHL_PARAM_QMFZ_DELAY (10*user_datas[23]) //延时插小插
  133. #define YX_CTHL_PARAM_YSHL_DELAY (10*user_datas[24])//0.01延时合链
  134. #define YX_CTHL_PARAM_ZDP_Start_TIME (10*user_datas[25]) //0.01振动盘启动延时
  135. #define YX_CTHL_PARAM_ZDP_Stop_TIME (10*user_datas[26]) //0.01振动盘延时停止
  136. #define YX_CTHL_PARAM_THLJZ_Length user_datas[27] //插销定位长度
  137. #define YX_CTHL_PARAM_QM_MODE user_datas[28] //0斜码,1直码
  138. #define YX_CTHL_PARAM_FZYS_DELAY (10*user_datas[29]) //0.01延时反转
  139. #define YX_CTHL_PARAM_QMFZ_Length user_datas[30] //插前码定位反转长度
  140. #define YX_CTHL_PARAM_LTCD_MODE 1 //0短拉头模式,1长拉头模式
  141. #define YX_CTHL_PARAM_ZDP_AUTO user_datas[32] //0.01振动盘
  142. #define YX_CTHL_PARAM_TJSJ_TIME (10*user_datas[33]) //0.01退下模停机时间
  143. #define YX_CTHL_PARAM_GYH_DELAY (10*user_datas[34]) //0.01感应后延时固定方块
  144. #define YX_CTHL_PARAM_YAdai_lenth user_datas[35] //0.01提前距离输出压带
  145. #define YX_CTHL_AUTO_run_LENGTH user_datas[36] //0.01感应后再走长度
  146. #define YX_CTHL_PARAM_COLOR_CODE user_datas[37] //色标模式设置
  147. #define YX_CTHL_PARAM_BinLin_SPEED user_datas[38] //并链感应速度
  148. #define YX_CTHL_PARAM_DWFZ_LENGTH user_datas[39] //前码定位反转长度
  149. #define YX_CTHL_PARAM_CRSD_SPEED user_datas[60] //穿入速度
  150. #define YX_CTHL_PARAM_XKCR_LENGTH user_datas[61] //穿入长度
  151. //#define YX_CTHL_PARAM_QM_MODE user_datas[45] //公司简介
  152. //输入
  153. #define YX_CTHL_START_IN M0384 //X00 //启动
  154. #define YX_CTHL_START_IN_UP (M0384 && !OLDM384)//(X00 && !OLDX00)
  155. #define YX_CTHL_STOP_IN M0385 // X01 //停止
  156. #define YX_CTHL_STOP_IN_UP (M0385 && !OLDM385)//(X01 && !OLDX01)
  157. #define YX_CTHL_STOP_IN_DW (!M0385 && OLDM385)//(!X01 && OLDX01)
  158. #define YX_CTHL_FK_Check M0386 //X02方块感应定位
  159. #define YX_CTHL_FK_Check_UP (M0386 && !OLDM386)//(X02 && !OLDX02)
  160. #define YX_CTHL_FK_Check_DW (!M0386 && OLDM386)//(!X02 && OLDX02)
  161. #define YX_CTHL_TQM_Limit_IN M0387 //X03推前码到位
  162. #define YX_CTHL_HSLiao_Origin_IN M0388 //X04横送料原位
  163. #define YX_CTHL_HSLiao_Limit_IN M0389 //X05横送料到位
  164. #define YX_CTHL_JLiao_Limit_IN M0390 //X06接拉头到位
  165. #define YX_CTHL_LTou_Check M0391 //X07拉头缺料感应(码勾)
  166. #define YX_CTHL_CTM_Origin_IN M0392 //X10下模原位
  167. #define YX_CTHL_CTM_Limit_IN M0393 //X11下模到位
  168. #define YX_CTHL_FKDWE_IN M0394 //X12小插到位
  169. #define YX_CTHL_FKDWE_IN_UP (M0394 && !OLDM394)
  170. #define YX_CTHL_FKDWE_IN_DW (!M0394 && OLDM394)
  171. #define YX_CTHL_FKQL_IN M0395 //X13方块感应定位
  172. #define YX_CTHL_FKQL_IN_UP (M0395 && !OLDM395)
  173. #define YX_CTHL_FKQL_IN_DW (!M0395 && OLDM395)
  174. #define YX_CTHL_TLiao_Origin_IN M0396 //X14推料原位
  175. #define YX_CTHL_ZDP_IN M0397 //X15振动盘
  176. #define YX_CTHL_Colorcode_IN M0398 //X16色标感应
  177. #define YX_CTHL_Colorcode_IN_UP (M0398 && !OLDM398)
  178. #define YX_CTHL_XIAOCHA_IN M0400 //X20小插布带感应
  179. #define YX_CTHL_XIAOCHA_IN_UP (M0400 && !OLDM400)
  180. #define YX_CTHL_XIAOCHA_IN_DW (!M0400 && OLDM400)
  181. #define YX_CTHL_CHULIAOSHANG_IN M0401 //X21储带上感应
  182. #define YX_CTHL_CHULIAOSHANG_IN_UP (M0401 && !OLDM401)
  183. #define YX_CTHL_CHULIAOXIA_IN M0402 //X22储带下感应
  184. #define YX_CTHL_CHULIAOXIA_IN_UP (M0402 && !OLDM402)
  185. //输出
  186. #define YX_CTHL_TLiao_VAVLE M0304 //Y00推料
  187. #define YX_CTHL_HSLiao_VAVLE M0305 //Y01横送料
  188. #define YX_CTHL_JLTou_VAVLE M0306 //Y02接拉头
  189. #define YX_CTHL_MGuo_VAVLE M0307 //Y03码勾
  190. #define YX_CTHL_LYLun_VAVLE M0308 //Y04前压轮
  191. #define YX_CTHL_FKGD_VAVLE M0309 //Y05方块固定
  192. #define YX_CTHL_CXC_VAVLE M0310 //Y06 插小插
  193. #define YX_CTHL_GDQM_VAVLE M0311 //Y07 固定前码
  194. #define YX_CTHL_ZhenDongPian_OUT M0312 //Y10振动盘
  195. #define YX_CTHL_TQM_VAVLE M0313 //Y11推前码
  196. #define YX_CTHL_RYLun_VAVLE M0314 //Y12后压轮
  197. #define YX_CTHL_CTXM_VAVLE M0315 //Y13下模
  198. #define YX_CTHL_YADAI_VAVLE M0316 //Y14压带
  199. #define YX_CTHL_TestLED M0328 //Y30 测试状态灯
  200. //M0~M4全局固定使用
  201. /*
  202. #define bRunning M0000
  203. #define bStart M0001
  204. #define bStop M0002
  205. #define bAlarmStop M0003
  206. #define bClearTotal M0004
  207. */
  208. #define YX_CTHL_bHSL M0005 //手动横送料
  209. #define YX_CTHL_bTLiao M0006 //手动推料
  210. #define YX_CTHL_bJLT M0007 //接拉头
  211. #define YX_CTHL_bMG M0008 //码勾
  212. #define YX_CTHL_bLYLun M0009 //小插压轮
  213. #define YX_CTHL_bFKGD M0010 //固定方块
  214. #define YX_CTHL_bCXC M0011 //插小插
  215. #define YX_CTHL_bXCDWGYZ M0012 //小插到位感应针
  216. #define YX_CTHL_bFKGM M0013 //方块勾模
  217. #define YX_CTHL_bRYLun M0014 //大插压轮
  218. #define YX_CTHL_bCTXM M0015 //下模
  219. #define YX_CTHL_bYD M0016 //过链杆压带
  220. #define YX_CTHL_bSingOne M0017 //单循环
  221. #define YX_CTHL_bYJDW M0029 //一键定位
  222. #define YX_CTHL_bCLMotor_P M0025 //X轴电机测试
  223. #define YX_CTHL_bCLMotor_N M0026 //X轴电机测试
  224. #define YX_CTHL_bCLMotor_Z M0027 //Z轴电机测试
  225. #define YX_CTHL_bDanBu_MODE M0048 //调试单步
  226. #define YX_CTHL_bAutoZhuangLiao M0024 //自动装料
  227. #endif