HHQueDuanJi.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. #ifndef __JXQUE_DUAN_JI_H__
  2. #define __JXQUE_DUAN_JI_H__
  3. #if HAI_HUA_MACHINE==1
  4. extern void QueDuan_Action(void);
  5. extern void QueDuan_InitAction(void);
  6. extern void QueDuanEx_ExtiActionX31(void);
  7. extern void FastTimerAction(void);
  8. #define QD_DIR_P 1
  9. #define QD_DIR_N 0
  10. #define PP_NoStop 1
  11. #define PP_Stop 0
  12. #define QD_YDIR_P 1
  13. #define QD_YDIR_N 0
  14. #define CT_WORKTOTAL_ADDR 102
  15. #define QD_TOTAL_ADDR 76
  16. #define QD_ALARM_ADDR 100
  17. #define QD_PROSPEED_ADDR 78
  18. #define QD_PARAM_ZIPPER_LENGTH_ADDR 1
  19. #define QD_BACK_INDUCTION_MODE 0 //后退纯感应方式
  20. #define QD_BACK_MEMORY_MODE 1 //后退记忆长度方式
  21. #define QD_BACK_INPUT_LENGTH_MODE 2 //后退手动输入长度方式
  22. #define QD_BACK_NOMAL_DEC_MODE 0 //后退感应减速方式
  23. #define QD_BACK_DIGITAL_MODE 1 //后退数控减速方式
  24. #define QD_SK_MODE 0 //1为双开
  25. #define QD_KB_MODE 1 //1为闭口 ,0开口(一字切)
  26. /*
  27. * 警告类型 警告编号
  28. */
  29. #define QD_NO_ALARM 0 /* 没警告*/
  30. #define QD_NO_ZIPPER_ALARM 1 /* 没拉链,自动停机*/
  31. #define QD_KA_DAI_ALARM 2 /* 卡带异常*/
  32. #define QD_SM_YUANWEI 3 /* 上模上限位*/ //
  33. #define QD_SM_DAOWEI 4 /* 上模下限位*/
  34. #define QD_XM_YUANWEI 5 /* 下模上限位*/
  35. #define QD_XM_DAOWEI 6 /* 下模下限位*/
  36. #define QD_BACK_ALARM 7
  37. #define QD_TOTAL_ALARM 8
  38. #define QD_TL_ALARM 9
  39. #define QD_GZ_ALARM 10 //勾针
  40. #define QD_JD_ORIGIN_ALARM 11
  41. #define QD_DEC_ALARM 12
  42. #define QD_QIAN_LIMIT_ALARM 13 //前限位出错
  43. #define QD_BL_ALARM 17
  44. #define QD_SM_ALARM 18
  45. #define QD_LENGTH_LONG_ALARM 19
  46. #define QD_LENGTH_SHORT_ALARM 20
  47. #define QD_PARAM_RUN_LENGTH_ALARM 21 //超出轨道运行长度
  48. #define VAVLE_ALARM_TIME 3000
  49. #define MOTOR_ALARM_TIME 5000
  50. #define QD_PARAM_GZ_DELAY (user_datas[0]*10)
  51. #define QD_PARAM_ZIPPER_LENGTH (user_datas[1] | (user_datas[2] >> 16))
  52. #define QD_PARAM_TL_DELAY 20//(user_datas[3]*10)
  53. #define QD_PARAM_YD_DELAY 0//(user_datas[4]*10)
  54. #define QD_PARAM_BACK_LOW_SPEED_LENGTH user_datas[6] //后拉慢速长度
  55. #define QD_PARAM_CUT_DELAY (user_datas[7]*10)
  56. #define QD_PARAM_CUT_BACK_DELAY (user_datas[8])
  57. #define QD_PARAM_FIRST_SPEED user_datas[9]
  58. #define QD_PARAM_CS_COLD_TIME (user_datas[10] * 10) //固化时间
  59. #define QD_PARAM_ZS_STOP_TIME (user_datas[11] * 10)
  60. #define QD_PARAM_DELAY_BACK (user_datas[12]*10)
  61. #define QD_PARAM_CYCLE_DELAY (user_datas[14]*10)
  62. #define QD_PARAM_GO_HIGH_SPEED user_datas[15]
  63. #define QD_PARAM_GO_LOW_SPEED_LENGTH user_datas[16]
  64. #define QD_PARAM_GO_LOW_SPEED user_datas[17]
  65. #define QD_PARAM_BACK_SPEED user_datas[18] //后拉速度
  66. #define QD_PARAM_BACK_LENGTH user_datas[19] ////松夹子长度后走的长度
  67. #define QD_PARAM_DELAY_CS (user_datas[20] * 10) //延时超声
  68. #define QD_PARAM_CS_TIME (user_datas[21] * 10) //超声时间
  69. #define QD_PARAM_FZ_LENGTH user_datas[22] //反转长度
  70. #define QD_PARAM_TB_TIME (user_datas[23]*10)
  71. #define QD_PARAM_OFFSET_LENGTH user_datas[24] //修正长度
  72. #define QD_PARAM_CUT_BACK_SPEED user_datas[26] //切断后拉带速度
  73. #define QD_PARAM_SJZ_LENGTH user_datas[27] //松夹子长度
  74. #define QD_PARAM_BACK_MODE user_datas[30] //后退方式 1为记忆长度,0为感应方式
  75. #define QD_PARAM_HL_ENABLE user_datas[33] //护链()
  76. #define QD_PARAM_CS_MODE user_datas[36] //0为气切1为超声切
  77. #define QD_PARAM_CYCLE_LENGTH user_datas[38] //电机周长
  78. #define QD_PARAM_CYCLE_PULSE user_datas[39] //电机细分
  79. #define QD_PARAM_TABLE_NUM user_datas[40] //台面动作条数
  80. #define QD_PARAM_MOTOR_DELAY_LENGTH ((unsigned long)user_datas[41] * user_datas[39]/user_datas[38]) //算出脉冲值
  81. #define QD_PARAM_TFK_DELAY (user_datas[44]*10) //延时推方块
  82. #define QD_PARAM_START_SPEED user_datas[45]
  83. #define QD_PARAM_ACC user_datas[46]
  84. #define QD_PARAM_DCC user_datas[47]
  85. #define QD_PARAM_CHECK_BACK_HSPEED user_datas[48]
  86. #define QD_PARAM_CHECK_BACK_LSPEED user_datas[49]
  87. #define QD_PARAM_DELAY_CHECK 100//user_datas[50] //
  88. #define QD_PARAM_YALIAN_LENGTH user_datas[53] //提前压并链长度 (双开用)
  89. #define QD_PARAM_GOUZHEN_LENGTH user_datas[54] //提前上勾针长度
  90. #define QD_PARAM_TIAOSHI_MODE user_datas[55]
  91. #define QD_PARAM_DELAY_HL_LENGTH user_datas[56]
  92. #define QD_PARAM_BL_ENABLE user_datas[57] //并链就是合链
  93. #define QD_PARAM_DELAY_XM (user_datas[58]*10)
  94. #define QD_PARAM_DELAY_XM_LENGTH user_datas[59]
  95. #define QD_PARAM_BACK_LOW_SPEED user_datas[60]
  96. #define QD_PARAM_DEC_MODE 1//user_datas[61]//0为使用感应减速 1后退使用数控降速
  97. #define QD_PARAM_LT_ENABLE user_datas[62]
  98. #define QD_PARAM_NO_LT_DELAY_CHECK user_datas[63]
  99. #define QD_PARAM_ERROR_LENGTH user_datas[64] //长度允许误差
  100. #define QD_PARAM_DELAYBACK_SM (user_datas[65])
  101. //#define QD_PARAM_TC_LENGTH user_datas[67]
  102. //#define QD_PARAM_FIRST_GO_HIGHSPEED user_datas[69]
  103. #define QD_PARAM_LENGTH_MODE 1//user_datas[70] //实则不用
  104. //#define QD_PARAM_FIRST_BACK_LOWSPEED user_datas[71] //不用
  105. #define QD_PARAM_SET_TOTAL 0//(user_datas[74] | (user_datas[75] >> 16))
  106. #define QD_PARAM_CS_ENABLE 1//user_datas[80]
  107. #define QD_PARAM_TD_DELAY (user_datas[81]*10)
  108. #define QD_PARAM_TD_TIME (user_datas[82]*10)
  109. #define QD_PARAM_DELAY_CHECK_GZ (user_datas[83])
  110. #define QD_PARAM_NOW_CNT user_datas[84]
  111. #define QD_PARAM_ZHA_SHU user_datas[85]
  112. #define QD_PARAM_HL_DELAY_BACK user_datas[86] //合链延时退
  113. #define QD_PARAM_RUN_LENGTH (user_datas[87]) //轨道运行长度
  114. #define QD_PARAM_TFK_NUMBER user_datas[88] // 推方块次数
  115. #define QD_PARAM_TL_MODE 0
  116. #define QD_PARAM_ON_BACK_LENGTH 3000
  117. #define QD_AutoDelay cDelayTime1
  118. #define QD_MotorDelay cDelayTime2
  119. #define QD_XiaQieDelay cDelayTime3
  120. #define QD_KaDaiDelay cDelayTime4
  121. #define QD_CSDelay cDelayTime5
  122. #define QD_TBDelay cDelayTime6
  123. #define QD_TFKDelay cDelayTime7
  124. #define QD_TLDelay cDelayTime8
  125. #define QD_TuiDaiDelay cDelayTime9
  126. #define QD_AlarmDelay cDelayTime10
  127. #define QD_SJDelay cDelayTime11
  128. #define QD_AutoStep cStepMByte
  129. #define QD_MotorStep cStepMByte1
  130. #define QD_XiaQieStep cStepMByte2
  131. #define QD_YuanDianStep cStepMByte3
  132. #define QD_TuiLianStep cStepMByte4
  133. #define QD_CheckLengthStep cStepMByte5
  134. #define QD_BinLianStep cStepMByte6
  135. #define QD_TuiDaiStep cStepMByte7
  136. //超声花边切输入输出
  137. #define START_IN X00
  138. #define START_IN_UP (X00 && !OLDX00)
  139. #define STOP_IN X01
  140. #define STOP_IN_UP (X01 && !OLDX01)
  141. #define QD_GUO_LIAN_IN X02
  142. #define QD_GUO_LIAN_IN_UP (X02 && !OLDX02)
  143. #define QD_GUO_LIAN_IN_DW (!X02 && OLDX02)
  144. //#if QD_SK_MODE // 1 //1为双开
  145. // #define QD_GOUZHEN_IN X04 //光电开关
  146. //#else
  147. #define QD_GOUZHEN_IN X04
  148. //#endif
  149. #define QD_QIAN_LIMIT_IN X05
  150. #define QD_QIAN_LIMIT_IN_UP (X05 && !OLDX05)
  151. #define QD_QIAN_LIMIT_IN_DW (!X05 && OLDX05)
  152. #define QD_SAFE_IN 0
  153. #if QD_KB_MODE //闭口
  154. #define QD_PARAM_XM_ENABLE 1//user_datas[35] //0下模动 1下模不动
  155. //#define QD_QIAN_DEC_IN 0
  156. //#define QD_QIAN_DEC_IN_UP 0
  157. //#define QD_BACK_LIMIT_IN X07
  158. //#define QD_BACK_LIMIT_IN_UP (X07 && !OLDX07)
  159. //#define QD_JD_ORIGIN_IN X10
  160. //#define QD_SHANG_MU_ORIGIN_IN X11
  161. #define QD_SHANG_MU_LIMIT_IN X03
  162. #define QD_JZ_DIR Y01 //电机方向 io_outputs[1].bits.b2
  163. #define QD_SZ_OUT Y02 //电机使能
  164. #define QD_GZ_VAVLE Y03 //勾针
  165. #define QD_JD_VAVLE Y04 //夹子气缸
  166. #define QD_SM_VAVLE Y05 //上模
  167. #define QD_SL_VAVLE Y06 //送链
  168. #define QD_TABLE_VAVLE Y07 //台面电机
  169. #define QD_YD_VAVLE Y10 //压带
  170. #define QD_BL_VAVLE Y11 //合链(并链)
  171. #define QD_TL_VAVLE Y06 //推链就是送链
  172. #define QD_YY_OUT Y00 //液压
  173. #define QD_CS_OUT Y15 //超声波
  174. #define QD_WARMMING_LED Y14 //警告
  175. //下面为程序编译用,空输出输入
  176. #define QD_XIA_MU_LIMIT_IN 1 //X13
  177. #define QD_XM_VAVLE Y30
  178. #define QD_HL_VAVLE Y31 //护链
  179. #define QD_YX_VAVLE Y32 //压带
  180. #define QD_TFK_VAVLE Y33 //
  181. #define QD_DGLG_VAVLE Y34
  182. #else //开口
  183. #define QD_PARAM_XM_ENABLE user_datas[35] //0下模动 1下模不动
  184. #define QD_SHANG_MU_LIMIT_IN X12
  185. #define QD_XIA_MU_LIMIT_IN X13
  186. #define QD_DGLG_VAVLE Y00 //顶过链杆
  187. #define QD_JZ_DIR Y01 //电机方向
  188. #define QD_SZ_OUT Y02 //电机使能
  189. #define QD_GZ_VAVLE Y03 //勾针
  190. #define QD_TFK_VAVLE Y04 //推方块
  191. #define QD_JD_VAVLE Y05 //夹子气缸
  192. #define QD_SM_VAVLE Y06 //上模
  193. #define QD_YD_VAVLE Y07 //压带
  194. #define QD_TL_VAVLE Y10 //送链(和下模共用)
  195. #define QD_BL_VAVLE Y11 //合链(并链)
  196. #define QD_TABLE_VAVLE Y12 //台面电机
  197. #define QD_XM_VAVLE Y10 // 下模
  198. #define QD_CS_OUT Y15 //超声波
  199. #define QD_WARMMING_LED Y14 //警告
  200. //下面为程序编译用,空输出输入
  201. #define QD_HL_VAVLE Y31 //护链
  202. #define QD_YX_VAVLE Y32 //压带
  203. #endif
  204. /*
  205. //双开
  206. #define QD_GZ_UP_IN X16 //勾针上到位
  207. #define QD_HL_VAVLE Y12 //护链
  208. #define QD_YX_VAVLE Y14 //压布带
  209. //推方块气切新增输入输出
  210. //没有下模以及下模上限X17 Y06
  211. //没有超声输出Y10 没有压带Y01
  212. //
  213. #define QD_TFK_VAVEL Y03
  214. #define QD_TL_VAVLE Y05
  215. #define QD_YBD_VAVLE Y14
  216. #define QD_JZ_DIR Y12
  217. #define QD_BL_VAVLE Y11 //并链
  218. */
  219. //M0~M4全局固定使用
  220. /*
  221. #define bRunning M0000
  222. #define bStart M0001
  223. #define bStop M0002
  224. #define bAlarmStop M0003
  225. #define bClearTotal M0004
  226. */
  227. #define QD_bSM M0006 //上模
  228. #define QD_bXM M0007 //下模
  229. #define QD_bClearTotal M0008 //产量清零
  230. #define QD_bXiaQie M0009 //下切
  231. #define QD_bQianDianDW M0010 //前点定位
  232. #define QD_bChaoSheng M0011 //超声
  233. #define QD_bJiaDai M0012 //夹带
  234. #define QD_bGoMotor M0013 //电机前进
  235. #define QD_bBackMotor M0014 //电机后退
  236. #define QD_bTL M0015 //推链(送链)
  237. #define QD_bYD M0016 //压带
  238. #define QD_bGZ M0017 //勾针
  239. #define QD_bJD M0018 //夹带
  240. #define QD_bHL M0019 //护链
  241. #define QD_bYuanDianDW M0020 //不用
  242. #define QD_bTestCS M0021 //超声测试
  243. #define QD_bSingle M0022
  244. #define QD_bTFK M0023 //推方块
  245. #define QD_bTB M0024 //台面
  246. #define QD_bYBD M0025
  247. #define QD_bClearNowTotal M0026 //产量清零
  248. #define QD_bTS M0027
  249. #define QD_bBL M0028 //并链(合链)
  250. #define QD_bYX M0029
  251. #endif
  252. #endif