JXKKQueDuanJi.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. #ifndef __JXKKQUE_DUAN_JI_H__
  2. #define __JXKKQUE_DUAN_JI_H__
  3. #if JU_XING_MACHINE==1
  4. extern void KK_QueDuan_Action(void);
  5. extern void KK_QueDuan_InitAction(void);
  6. extern void QueDuanEx_ExtiActionX31(void);
  7. extern void FastTimerAction(void);
  8. #define KKQD_DIR_P 1
  9. #define KKQD_DIR_N 0
  10. #define PP_NoStop 1
  11. #define PP_Stop 0
  12. #define KKQD_YDIR_P 1
  13. #define KKQD_YDIR_N 0
  14. #define CT_WORKTOTAL_ADDR 102
  15. #define KKQD_TOTAL_ADDR 76
  16. #define KKQD_ALARM_ADDR 100
  17. #define KKQD_PROSPEED_ADDR 78
  18. #define KKQD_PARAM_ZIPPER_LENGTH_ADDR 1
  19. #define KKQD_BACK_INDUCTION_MODE 0 //后退纯感应方式
  20. #define KKQD_BACK_MEMORY_MODE 1 //后退记忆长度方式
  21. #define KKQD_BACK_INPUT_LENGTH_MODE 2 //后退手动输入长度方式
  22. #define KKQD_BACK_NOMAL_DEC_MODE 0 //后退感应减速方式
  23. #define KKQD_BACK_DIGITAL_MODE 1 //后退数控减速方式
  24. #define KKQD_SK_MODE 0 //1为双开
  25. #define KKQD_KB_MODE 0//1为闭口 ,0开口(一字切)
  26. /*
  27. * 警告类型 警告编号
  28. */
  29. #define KKQD_NO_ALARM 0 /* 没警告*/
  30. #define KKQD_NO_ZIPPER_ALARM 1 /* 没拉链,自动停机*/
  31. #define KKQD_KA_DAI_ALARM 2 /* 卡带异常*/
  32. #define KKQD_SM_YUANWEI 3 /* 上模上限位*/ //
  33. #define KKQD_SM_DAOWEI 4 /* 上模下限位*/
  34. #define KKQD_XM_YUANWEI 5 /* 下模上限位*/
  35. #define KKQD_XM_DAOWEI 6 /* 下模下限位*/
  36. #define KKQD_BACK_ALARM 7
  37. #define KKQD_TOTAL_ALARM 8
  38. #define KKQD_TL_ALARM 9
  39. #define KKQD_GZ_ALARM 10 //勾针
  40. #define KKQD_JD_ORIGIN_ALARM 11
  41. #define KKQD_DEC_ALARM 12
  42. #define KKQD_QIAN_LIMIT_ALARM 13 //前限位出错
  43. #define KKQD_BL_ALARM 17
  44. #define KKQD_SM_ALARM 18
  45. #define KKQD_LENGTH_LONG_ALARM 19
  46. #define KKQD_LENGTH_SHORT_ALARM 20
  47. #define KKQD_PARAM_RUN_LENGTH_ALARM 21 //超出轨道运行长度
  48. #define KKQD_PARAM_ANQUANMEN_ALARM 22
  49. #define VAVLE_ALARM_TIME 3000
  50. #define MOTOR_ALARM_TIME 5000
  51. #define KKQD_PARAM_GZ_DELAY (user_datas[0]*10)
  52. #define KKQD_PARAM_ZIPPER_LENGTH (user_datas[1] | (user_datas[2] >> 16))
  53. #define KKQD_PARAM_TL_DELAY 20//(user_datas[3]*10)
  54. #define KKQD_PARAM_YD_DELAY 20//0//(user_datas[4]*10)
  55. #define KKQD_PARAM_BACK_LOW_SPEED_LENGTH user_datas[6] //后拉慢速长度
  56. #define KKQD_PARAM_CUT_DELAY (user_datas[7]*10)
  57. #define KKQD_PARAM_CUT_BACK_DELAY (user_datas[8])
  58. #define KKQD_PARAM_FIRST_SPEED user_datas[9]
  59. #define KKQD_PARAM_CS_COLD_TIME (user_datas[10] * 10) //固化时间
  60. #define KKQD_PARAM_ZS_STOP_TIME (user_datas[11] * 10)
  61. #define KKQD_PARAM_DELAY_BACK (user_datas[12]*10)
  62. #define KKQD_PARAM_CYCLE_DELAY (user_datas[14]*10)
  63. #define KKQD_PARAM_GO_HIGH_SPEED user_datas[15]
  64. #define KKQD_PARAM_GO_LOW_SPEED_LENGTH user_datas[16]
  65. #define KKQD_PARAM_GO_LOW_SPEED user_datas[17]
  66. #define KKQD_PARAM_BACK_SPEED user_datas[18] //后拉速度
  67. #define KKQD_PARAM_BACK_LENGTH user_datas[19] ////松夹子长度后走的长度
  68. #define KKQD_PARAM_DELAY_CS (user_datas[20] * 10) //延时超声
  69. #define KKQD_PARAM_CS_TIME (user_datas[21] * 10) //超声时间
  70. #define KKQD_PARAM_FZ_LENGTH user_datas[22] //反转长度
  71. #define KKQD_PARAM_TB_TIME (user_datas[23]*10)
  72. #define KKQD_PARAM_OFFSET_LENGTH user_datas[24] //修正长度
  73. #define KKQD_PARAM_CUT_BACK_SPEED user_datas[26] //切断后拉带速度
  74. #define KKQD_PARAM_SJZ_LENGTH user_datas[27] //松夹子长度
  75. #define KKQD_PARAM_BACK_MODE user_datas[30] //后退方式 1为记忆长度,0为感应方式
  76. #define KKQD_PARAM_HL_ENABLE user_datas[33] //护链()
  77. #define KKQD_PARAM_CS_MODE user_datas[36] //0为气切1为超声切
  78. #define KKQD_PARAM_CYCLE_LENGTH user_datas[38] //电机周长
  79. #define KKQD_PARAM_CYCLE_PULSE user_datas[39] //电机细分
  80. #define KKQD_PARAM_TABLE_NUM user_datas[40] //台面动作条数
  81. #define KKQD_PARAM_MOTOR_DELAY_LENGTH ((unsigned long)user_datas[41] * user_datas[39]/user_datas[38]) //算出脉冲值
  82. #define KKQD_PARAM_TFK_DELAY (user_datas[44]*10) //延时推方块
  83. #define KKQD_PARAM_START_SPEED user_datas[45]
  84. #define KKQD_PARAM_ACC user_datas[46]
  85. #define KKQD_PARAM_DCC user_datas[47]
  86. #define KKQD_PARAM_CHECK_BACK_HSPEED user_datas[48]
  87. #define KKQD_PARAM_CHECK_BACK_LSPEED user_datas[49]
  88. #define KKQD_PARAM_DELAY_CHECK 100//user_datas[50] //
  89. #define KKQD_PARAM_YALIAN_LENGTH user_datas[53] //提前压并链长度 (双开用)
  90. #define KKQD_PARAM_GOUZHEN_LENGTH user_datas[54] //提前上勾针长度
  91. #define KKQD_PARAM_TIAOSHI_MODE user_datas[55]
  92. #define KKQD_PARAM_DELAY_HL_LENGTH user_datas[56]
  93. #define KKQD_PARAM_BL_ENABLE user_datas[57] //并链就是合链
  94. #define KKQD_PARAM_DELAY_XM (user_datas[58]*10)
  95. #define KKQD_PARAM_DELAY_XM_LENGTH user_datas[59]
  96. #define KKQD_PARAM_BACK_LOW_SPEED user_datas[60]
  97. #define KKQD_PARAM_DEC_MODE 1//user_datas[61]//0为使用感应减速 1后退使用数控降速
  98. #define KKQD_PARAM_LT_ENABLE user_datas[62]
  99. #define KKQD_PARAM_NO_LT_DELAY_CHECK user_datas[63]
  100. #define KKQD_PARAM_ERROR_LENGTH user_datas[64] //长度允许误差
  101. #define KKQD_PARAM_DELAYBACK_SM (user_datas[65])
  102. //#define KKQD_PARAM_TC_LENGTH user_datas[67]
  103. //#define KKQD_PARAM_FIRST_GO_HIGHSPEED user_datas[69]
  104. #define KKQD_PARAM_LENGTH_MODE 1//user_datas[70] //实则不用
  105. //#define KKQD_PARAM_FIRST_BACK_LOWSPEED user_datas[71] //不用
  106. #define KKQD_PARAM_SET_TOTAL 0//(user_datas[74] | (user_datas[75] >> 16))
  107. #define KKQD_PARAM_CS_ENABLE 1//user_datas[80]
  108. #define KKQD_PARAM_TD_DELAY (user_datas[81]*10)
  109. #define KKQD_PARAM_TD_TIME (user_datas[82]*10)
  110. #define KKQD_PARAM_DELAY_CHECK_GZ (user_datas[83])
  111. #define KKQD_PARAM_NOW_CNT user_datas[84]
  112. #define KKQD_PARAM_ZHA_SHU user_datas[85]
  113. #define KKQD_PARAM_HL_DELAY_BACK user_datas[86] //合链延时退
  114. #define KKQD_PARAM_RUN_LENGTH (user_datas[87]) //轨道运行长度
  115. #define KKQD_PARAM_TFK_NUMBER user_datas[88] // 推方块次数
  116. #define KKQD_PARAM_STOP_TIME user_datas[89] //停机时间
  117. #define KKQD_PARAM_TDYS_DELAY user_datas[90]*10
  118. #define KKQD_PARAM_ChuiQi_TIME (user_datas[91]*10) //吹气时间
  119. #define KKQD_PARAM_TTFK_TIME (user_datas[92]*10) //退推方块时间
  120. #define KKQD_PARAM_SHUANGDAO_MODE user_datas[93] //二次切模式
  121. #define KKQD_PARAM_SHUANGDAO_LENGTH user_datas[94] //二次切模式拉出长度
  122. #define KKQD_PARAM_TL_MODE 0
  123. #define KKQD_PARAM_ON_BACK_LENGTH 3000
  124. #define KKQD_AutoDelay cDelayTime1
  125. #define KKQD_MotorDelay cDelayTime2
  126. #define KKQD_XiaQieDelay cDelayTime3
  127. #define KKQD_KaDaiDelay cDelayTime4
  128. #define KKQD_CSDelay cDelayTime5
  129. #define KKQD_TBDelay cDelayTime6
  130. #define KKQD_TFKDelay cDelayTime7
  131. #define KKQD_TLDelay cDelayTime8
  132. #define KKQD_TuiDaiDelay cDelayTime9
  133. #define KKQD_AlarmDelay cDelayTime10
  134. #define KKQD_SJDelay cDelayTime11
  135. #define KKQD_TableDelay cDelayTime12
  136. #define KKQD_StopCodeDelay cDelayTime13
  137. #define KKQD_ChuiQiDelay cDelayTime14
  138. #define KKQD_AutoStep cStepMByte
  139. #define KKQD_MotorStep cStepMByte1
  140. #define KKQD_XiaQieStep cStepMByte2
  141. #define KKQD_YuanDianStep cStepMByte3
  142. #define KKQD_TuiLianStep cStepMByte4
  143. #define KKQD_CheckLengthStep cStepMByte5
  144. #define KKQD_BinLianStep cStepMByte6
  145. #define KKQD_TuiDaiStep cStepMByte7
  146. #define KKQD_StopStep cStepMByte8
  147. #define KKQD_CHUIQIStep cStepMByte9
  148. //8位变量
  149. #define KK_cCheckLianFlg cCharBuff1
  150. #define KK_cCheckLianFlgEN cCharBuff2
  151. #define KK_cGoLimitEn cCharBuff3
  152. #define KK_cTABLETOTAL cCharBuff4
  153. #define KK_cTABLETIME cCharBuff5
  154. #define KK_cDLJ_ATUO cCharBuff6
  155. #define KK_cSTOPONE cCharBuff7
  156. #define KK_cStopMode cCharBuff8
  157. #define KK_cZhouWanone cCharBuff9
  158. #define KK_BKQD_RMONE cCharBuff10
  159. #define KK_DCC_TIME_BL cCharBuff11
  160. #define KK_cZipCnt cCharBuff12
  161. #define KK_cTableCnt cCharBuff13
  162. #define KK_cTuiFangKuaiCnt cCharBuff14
  163. #define KK_cECQ_STOP cCharBuff15
  164. #define KK_cDiErLaChu cCharBuff16
  165. #define KK_cShuangDao cCharBuff17
  166. #define KKQD_RMONE cCharBuff18
  167. //32位无符号变量
  168. #define KK_save_limit_pos cUDword32Buff1
  169. #define KK_cRealPos cUDword32Buff2
  170. #define KK_dwSaveLength cUDword32Buff3
  171. //超声花边切输入输出
  172. #define KKQD_START_IN M0384
  173. #define KKQD_START_IN_UP (M0384 && !OLDM384)
  174. #define KKQD_STOP_IN M0385
  175. #define KKQD_STOP_IN_UP (M0385 && !OLDM385)
  176. //#if KKQD_SK_MODE // 1 //1为双开
  177. // #define KKQD_GOUZHEN_IN X04 //光电开关
  178. //#else
  179. #define KKQD_GOUZHEN_IN M0388
  180. #define KKQD_GOUZHEN_IN_UP (M0388 && !OLDM388)
  181. //#endif
  182. #define KKQD_QIAN_LIMIT_IN M0389
  183. #define KKQD_QIAN_LIMIT_IN_UP (M0389 && !OLDM389)
  184. #define KKQD_QIAN_LIMIT_IN_DW (!M0389 && OLDM389)
  185. #define KKQD_QIAN_STOP_Auto M0410
  186. #define KKQD_QIAN_START_Auto M0410
  187. #define KKQD_ANQUANMEN_LIMIT_IN M0390//X06 //安全门
  188. #define KKQD_ANQUANMEN_LIMIT_IN_UP (M0390 && !OLDM390)//X06 //安全门
  189. #define KKQD_STOP_ANNIU_IN M0396//X14 //急停按钮
  190. #define KKQD_STOP_ANNIU_IN_UP (M0396 && !OLDM396)
  191. #define KKQD_SAFE_IN 0
  192. #if KKQD_KB_MODE //闭口
  193. #define KKQD_GUO_LIAN_IN M0391
  194. #define KKQD_GUO_LIAN_IN_UP (M0391 && !OLDM391)
  195. #define KKQD_GUO_LIAN_IN_DW (!M0391 && OLDM391)
  196. #define KKQD_PARAM_XM_ENABLE user_datas[35] //0下模动 1下模不动
  197. #define KKQD_SHANG_MU_LIMIT_IN M0387
  198. #define KKQD_SHANG_MU_ORIGIN_IN M0386
  199. #define KKQD_XIA_MU_LIMIT_IN M0395 //X13
  200. #define KKQD_CQ_VAVLE M0361 //Y11吹气
  201. #define KKQD_JZ_DIR M0353 //电机方向 io_outputs[1].bits.b2
  202. #define KKQD_SZ_OUT M0354 //电机使能
  203. #define KKQD_GZ_VAVLE M0355 //勾针
  204. #define KKQD_JD_VAVLE M0356 //夹子气缸
  205. #define KKQD_SM_VAVLE M0357 //上模
  206. #define KKQD_TL_VAVLE M0358 //送链
  207. #define KKQD_TABLE_VAVLE M0359 //台面电机
  208. #define KKQD_YD_VAVLE M0360 //压带
  209. #define KKQD_BL_VAVLE M0361 //合链(并链)
  210. // #define KKQD_TL_VAVLE M0362 //推链就是送链
  211. #define KKQD_XM_VAVLE M0362
  212. #define KKQD_YY_OUT M0352 //液压
  213. #define KKQD_CS_OUT M0365 //超声波
  214. #define KKQD_WARMMING_LED M0364 //警告
  215. //下面为程序编译用,空输出输入
  216. #define KKQD_HL_VAVLE M0383 //护链
  217. #define KKQD_YX_VAVLE M0383 //压带
  218. #define KKQD_TFK_VAVLE M0383 //
  219. #define KKQD_DGLG_VAVLE M0383
  220. #else //开口
  221. #define KKQD_GUO_LIAN_IN M0386
  222. #define KKQD_GUO_LIAN_IN_UP (M0386 && !OLDM386)
  223. #define KKQD_GUO_LIAN_IN_DW (!M0386 && OLDM386)
  224. #define KKQD_PARAM_XM_ENABLE user_datas[35] //0下模动 1下模不动
  225. #define KKQD_SHANG_MU_ORIGIN_IN M0393
  226. #define KKQD_SHANG_MU_LIMIT_IN M0394
  227. #define KKQD_XIA_MU_LIMIT_IN M0395
  228. #define KKQD_DGLG_VAVLE M0380 //顶过链杆
  229. // #define KKQD_JZ_DIR M0353 //电机方向
  230. #define KKQD_SZ_OUT M0354 //电机使能
  231. #define KKQD_GZ_VAVLE M0355 //勾针
  232. #define KKQD_TFK_VAVLE M0356 //推方块
  233. #define KKQD_JD_VAVLE M0357 //夹子气缸
  234. #define KKQD_SM_VAVLE M0358 //上模
  235. #define KKQD_YD_VAVLE M0359 //压带
  236. #define KKQD_TL_VAVLE M0360 //送链(和下模共用)
  237. #define KKQD_BL_VAVLE M0361 //合链(并链)
  238. #define KKQD_TABLE_VAVLE M0362 //台面电机
  239. #define KKQD_XM_VAVLE M0360 // 下模
  240. #define KKQD_CQ_VAVLE M0361
  241. #define KKQD_CS_OUT M0365 //超声波
  242. #define KKQD_WARMMING_LED M0364 //警告
  243. //下面为程序编译用,空输出输入
  244. #define KKQD_HL_VAVLE M0383 //护链
  245. #define KKQD_YX_VAVLE M0383 //压带
  246. #endif
  247. //M0~M4全局固定使用
  248. /*
  249. #define bRunning M0000
  250. #define bStart M0001
  251. #define bStop M0002
  252. #define bAlarmStop M0003
  253. #define bClearTotal M0004
  254. */
  255. #define KKQD_bSM M0006 //上模
  256. #define KKQD_bXM M0007 //下模
  257. #define KKQD_bClearTotal M0008 //产量清零
  258. #define KKQD_bXiaQie M0009 //下切
  259. #define KKQD_bQianDianDW M0010 //前点定位
  260. #define KKQD_bChaoSheng M0011 //超声
  261. #define KKQD_bJiaDai M0012 //夹带
  262. #define KKQD_bGoMotor M0013 //电机前进
  263. #define KKQD_bBackMotor M0014 //电机后退
  264. #define KKQD_bTL M0015 //推链(送链)
  265. #define KKQD_bYD M0016 //压带
  266. #define KKQD_bGZ M0017 //勾针
  267. #define KKQD_bJD M0018 //夹带
  268. #define KKQD_bHL M0019 //护链
  269. #define KKQD_bYuanDianDW M0020 //不用
  270. #define KKQD_bTestCS M0021 //超声测试
  271. #define KKQD_bSingle M0022
  272. #define KKQD_bTFK M0023 //推方块
  273. #define KKQD_bTB M0024 //台面
  274. #define KKQD_bYBD M0025
  275. #define KKQD_bClearNowTotal M0026 //产量清零
  276. #define KKQD_bTS M0027
  277. #define KKQD_bBL M0028 //并链(合链)
  278. #define KKQD_bYX M0029
  279. #define KKQD_bECQ M0030 //二次切手动
  280. #endif
  281. #endif