JHBKQueDuanJi.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. #ifndef __JHBKQUE_DUAN_JI_H__
  2. #define __JHBKQUE_DUAN_JI_H__
  3. #if JIN_HONG_MACHINE==1
  4. extern void BK_QueDuan_Action(void);
  5. extern void BK_QueDuan_InitAction(void);
  6. extern void BK_QueDuanEx_ExtiActionX31(void);
  7. extern void FastTimerAction(void);
  8. #define BKQD_DIR_P 1
  9. #define BKQD_DIR_N 0
  10. #define PP_NoStop 1
  11. #define PP_Stop 0
  12. #define BKQD_YDIR_P 1
  13. #define BKQD_YDIR_N 0
  14. #define BKQD_MOTOR_EN 1
  15. #define BKQD_MOTOR_DIS 0
  16. #define CT_WORKTOTAL_ADDR 102
  17. #define BKQD_TOTAL_ADDR 76
  18. #define BKQD_ALARM_ADDR 100
  19. #define BKQD_PROSPEED_ADDR 78
  20. #define BKQD_PARAM_ZIPPER_LENGTH_ADDR 1
  21. #define BKQD_BACK_INDUCTION_MODE 0 //后退纯感应方式
  22. #define BKQD_BACK_MEMORY_MODE 1 //后退记忆长度方式
  23. #define BKQD_BACK_INPUT_LENGTH_MODE 2 //后退手动输入长度方式
  24. #define BKQD_BACK_NOMAL_DEC_MODE 0 //后退感应减速方式
  25. #define BKQD_BACK_DIGITAL_MODE 1 //后退数控减速方式
  26. #define BKQD_SK_MODE 0 //1为双开
  27. #define BKQD_KB_MODE 1 //1为闭口 ,0开口(一字切)
  28. /*
  29. * 警告类型 警告编号
  30. */
  31. #define BKQD_NO_ALARM 0 /* 没警告*/
  32. #define BKQD_NO_ZIPPER_ALARM 1 /* 没拉链,自动停机*/
  33. #define BKQD_KA_DAI_ALARM 2 /* 卡带异常*/
  34. #define BKQD_SM_YUANWEI 3 /* 上模上限位*/ //
  35. #define BKQD_SM_DAOWEI 4 /* 上模到位异常(下限位)*/
  36. #define BKQD_XM_YUANWEI 5 /* 下模下限位*/
  37. #define BKQD_XM_DAOWEI 6 /* 下模到位异常(上限位)*/
  38. #define BKQD_BACK_ALARM 7
  39. #define BKQD_TOTAL_ALARM 8
  40. #define BKQD_TL_ALARM 9
  41. #define BKQD_GZ_ALARM 10 //勾针
  42. #define BKQD_JD_ORIGIN_ALARM 11
  43. #define BKQD_DEC_ALARM 12
  44. #define BKQD_QIAN_LIMIT_ALARM 13 //前限位出错
  45. #define BKQD_BL_ALARM 17
  46. #define BKQD_SM_ALARM 18
  47. #define BKQD_LENGTH_LONG_ALARM 19
  48. #define BKQD_LENGTH_SHORT_ALARM 20
  49. #define BKQD_PARAM_RUN_LENGTH_ALARM 21 //超出轨道运行长度
  50. #define VAVLE_ALARM_TIME 3000
  51. #define MOTOR_ALARM_TIME 5000
  52. #define BKQD_PARAM_TL_LENGTH 150
  53. #define BKQD_PARAM_FIRST_SPEED 5000
  54. #define BKQD_PARAM_GZ_DELAY (user_datas[0]*10)
  55. #define BKQD_PARAM_ZIPPER_LENGTH (user_datas[1] | (user_datas[2] >> 16))
  56. #define BKQD_PARAM_TL_DELAY 20//(user_datas[3]*10)
  57. #define BKQD_PARAM_YD_DELAY 0//(user_datas[4]*10)
  58. #define BKQD_PARAM_BACK_LOW_SPEED_LENGTH user_datas[6] //后拉慢速长度
  59. #define BKQD_PARAM_CUT_DELAY (user_datas[7]*10) //延时切断
  60. #define BKQD_PARAM_CUT_BACK_DELAY (user_datas[8]) //切断后延时后拉
  61. #define BKQD_PARAM_KAIBEE_SELECT user_datas[9] //开闭口选择(0 开口,1 闭口)
  62. #define BKQD_PARAM_CS_COLD_TIME (user_datas[10] * 10) //固化时间
  63. #define BKQD_PARAM_ZS_STOP_TIME (user_datas[11] * 10) //扎数到停止时间
  64. #define BKQD_PARAM_DELAY_BACK (user_datas[12]*10) //延时后拉
  65. #define BKQD_PARAM_CYCLE_DELAY (user_datas[14]*10) //延时下一条
  66. #define BKQD_PARAM_GO_HIGH_SPEED user_datas[15] //前进最高速
  67. #define BKQD_PARAM_GO_LOW_SPEED_LENGTH user_datas[16] //前进低速长度
  68. #define BKQD_PARAM_GO_LOW_SPEED user_datas[17] //前进最低速度
  69. #define BKQD_PARAM_BACK_SPEED user_datas[18] //后拉速度
  70. #define BKQD_PARAM_BACK_LENGTH user_datas[19] ////松夹子长度后走的长度
  71. #define BKQD_PARAM_DELAY_CS (user_datas[20] * 10) //延时超声
  72. #define BKQD_PARAM_CS_TIME (user_datas[21] * 10) //超声时间
  73. #define BKQD_PARAM_FZ_LENGTH user_datas[22] //闭口反转长度
  74. #define BKQD_PARAM_TB_TIME (user_datas[23]*10) //台面时间
  75. #define BKQD_PARAM_OFFSET_LENGTH user_datas[24] //修正长度
  76. #define BKQD_PARAM_CUT_BACK_SPEED user_datas[26] //切断后拉带速度
  77. #define BKQD_PARAM_SJZ_LENGTH user_datas[27] //松夹子长度
  78. #define BKQD_PARAM_MOTOR_SELECT user_datas[28] //电机选择 (0 步进 , 1 伺服)(主要是松轴使能不一样)
  79. #define BKQD_PARAM_BACK_MODE user_datas[30] //后退方式 1为记忆长度,0为感应方式(暂时不用)
  80. #define BKQD_PARAM_HL_ENABLE user_datas[33] //护链()
  81. #define BKQD_PARAM_XM_ENABLE user_datas[35] //0下模动 1下模不动
  82. #define BKQD_PARAM_CS_MODE user_datas[36] //0为气切1为超声切
  83. #define BKQD_PARAM_CYCLE_LENGTH user_datas[38] //电机周长
  84. #define BKQD_PARAM_CYCLE_PULSE user_datas[39] //电机细分
  85. #define BKQD_PARAM_TABLE_NUM user_datas[40] //台面动作条数
  86. #define BKQD_PARAM_MOTOR_DELAY_LENGTH ((unsigned long)user_datas[41] * user_datas[39]/user_datas[38]) //算出脉冲值
  87. #define BKQD_PARAM_TFK_DELAY (user_datas[44]*10) //延时推方块
  88. #define BKQD_PARAM_START_SPEED user_datas[45] //启动速度
  89. #define BKQD_PARAM_ACC user_datas[46] //加速度
  90. #define BKQD_PARAM_DCC user_datas[47] //减速度
  91. #define BKQD_PARAM_CHECK_BACK_HSPEED user_datas[48] //后拉走链最高速度
  92. #define BKQD_PARAM_CHECK_BACK_LSPEED user_datas[49] //后拉走链空位速度
  93. #define BKQD_PARAM_DELAY_CHECK 100//user_datas[50] //
  94. #define BKQD_PARAM_YALIAN_LENGTH user_datas[53] //提前压并链长度 (双开用)
  95. #define BKQD_PARAM_GOUZHEN_LENGTH user_datas[54] //提前上勾针长度
  96. #define BKQD_PARAM_TIAOSHI_MODE user_datas[55] //调试模式(暂不用)
  97. #define BKQD_PARAM_DELAY_HL_LENGTH user_datas[56] //合链动作长度
  98. #define BKQD_PARAM_BL_ENABLE user_datas[57] //并链就是合链
  99. #define BKQD_PARAM_DELAY_XM (user_datas[58]*10)
  100. #define BKQD_PARAM_DELAY_XM_LENGTH user_datas[59]
  101. #define BKQD_PARAM_BACK_LOW_SPEED user_datas[60]
  102. #define BKQD_PARAM_DEC_MODE 1//user_datas[61]//0为使用感应减速 1后退使用数控降速
  103. #define BKQD_PARAM_LT_ENABLE user_datas[62]
  104. #define BKQD_PARAM_NO_LT_DELAY_CHECK user_datas[63]
  105. #define BKQD_PARAM_ERROR_LENGTH user_datas[64] //长度允许误差
  106. #define BKQD_PARAM_DELAYBACK_SM (user_datas[65])
  107. //#define BKQD_PARAM_TC_LENGTH user_datas[67]
  108. //#define BKQD_PARAM_FIRST_GO_HIGHSPEED user_datas[69]
  109. #define BKQD_PARAM_LENGTH_MODE 1//user_datas[70] //实则不用
  110. //#define BKQD_PARAM_FIRST_BACK_LOWSPEED user_datas[71] //不用
  111. #define BKQD_PARAM_SET_TOTAL 0//(user_datas[74] | (user_datas[75] >> 16))
  112. #define BKQD_PARAM_CS_ENABLE 1//user_datas[80]
  113. #define BKQD_PARAM_TD_DELAY (user_datas[81]*10)
  114. #define BKQD_PARAM_TD_TIME (user_datas[82]*10)
  115. #define BKQD_PARAM_DELAY_CHECK_GZ (user_datas[83])
  116. #define BKQD_PARAM_NOW_CNT user_datas[84]
  117. #define BKQD_PARAM_ZHA_SHU user_datas[85]
  118. #define BKQD_PARAM_HL_DELAY_BACK user_datas[86] //合链延时退
  119. #define BKQD_PARAM_RUN_LENGTH (user_datas[87]) //轨道运行长度
  120. #define BKQD_PARAM_TFK_NUMBER user_datas[88] // 推方块次数
  121. #define BKQD_PARAM_WC_LENGTH user_datas[89] // 拉链误差长度
  122. #define BKQD_PARAM_GYMODE_DEALY (user_datas[90]*10) // 感应模式延时下勾针
  123. #define BKQD_PARAM_GO_DW_LENGTH user_datas[109] //前进定位位置(感应到原点为再走的长度,不用调整感应器)
  124. #define BKQD_PARAM_TL_MODE 0
  125. #define BKQD_PARAM_ON_BACK_LENGTH 3000
  126. #define BKQD_AutoDelay cDelayTime1
  127. #define BKQD_MotorDelay cDelayTime2
  128. #define BKQD_XiaQieDelay cDelayTime3
  129. #define BKQD_KaDaiDelay cDelayTime4
  130. #define BKQD_CSDelay cDelayTime5
  131. #define BKQD_TBDelay cDelayTime6
  132. #define BKQD_TFKDelay cDelayTime7
  133. #define BKQD_TLDelay cDelayTime8
  134. #define BKQD_TuiDaiDelay cDelayTime9
  135. #define BKQD_AlarmDelay cDelayTime10
  136. #define BKQD_SJDelay cDelayTime11
  137. #define BKQD_STOPINDelay cDelayTime12
  138. #define BKQD_StopCodeDelay cDelayTime13
  139. #define BKQD_CheckTime cDelayTime16
  140. #define BKQD_AutoStep cStepMByte
  141. #define BKQD_MotorStep cStepMByte1
  142. #define BKQD_XiaQieStep cStepMByte2
  143. #define BKQD_YuanDianStep cStepMByte3
  144. #define BKQD_TuiLianStep cStepMByte4
  145. #define BKQD_CheckLengthStep cStepMByte5
  146. #define BKQD_BinLianStep cStepMByte6
  147. #define BKQD_TuiDaiStep cStepMByte7
  148. #define BKQD_StopStep cStepMByte9
  149. //32位变量
  150. #define BK_cZipCnt cUDword32Buff1
  151. #define BK_cTableCnt cUDword32Buff2
  152. #define BK_cTuiFangKuaiCnt cUDword32Buff3
  153. #define BK_save_limit_pos cUDword32Buff4
  154. #define BK_cRealPos cUDword32Buff5
  155. #define BK_dwSaveLength cUDword32Buff6
  156. //8位变量
  157. #define BK_cCheckLianFlg cCharBuff1
  158. #define BK_cGoLimitEn cCharBuff2
  159. #define BK_QDSingOneFlg cCharBuff3
  160. #define BK_DCC_TIME_BL cCharBuff4
  161. #define BK_XiaQueOver cCharBuff5
  162. //超声花边切,开口,开闭口二合一输入输出
  163. #define BKQD_START_IN M0384 //X00 启动
  164. #define BKQD_START_IN_UP (M0384 && !OLDM384)
  165. #define BKQD_STOP_IN M0385 // X01 // X01 急停
  166. #define BKQD_STOP_IN_UP (M0385 && !OLDM385)
  167. //#define BKQD_ANQUANMEN_LIMIT_IN M0387//X03 //安全门开关
  168. #define BKQD_GOUZHEN_IN M0388 //X04 //勾针到位
  169. #define BKQD_QIAN_LIMIT_IN M0389 // X05 //前限位
  170. #define BKQD_QIAN_LIMIT_IN_UP (M0389 && !OLDM389)
  171. #define BKQD_QIAN_LIMIT_IN_DW (!M0389 && OLDM389)
  172. #define BKQD_SHANG_MU_ORIGIN M0393 // X11 //上模上限(原位)
  173. #define BKQD_SHANG_MU_ORIGIN_DW (!M0393 && OLDM393) // X11 //上模上限(原位)
  174. #define BKQD_SHANG_MU_LIMIT_IN M0394 //X12 //上模下限位(到位)
  175. #define BKQD_SHANG_MU_LIMIT_IN_UP (M0394 && !OLDM394) //X12 //上模下限位(到位)
  176. #define BKQD_GUO_LIAN_IN M0395// X13过链感应
  177. #define BKQD_GUO_LIAN_IN_UP (M0395 && !OLDM395)
  178. #define BKQD_GUO_LIAN_IN_DW (!M0395 && OLDM395)
  179. #define BKQD_KAIKUO_XIAMO_LIMIT_IN M0400 // X20 //开口下模到位
  180. #define BKQD_KAIKUO_XIAMO_ORIGIN M0400 // X20 //开口下模原位
  181. #define BKQD_XIA_MU_LIMIT_IN M0387 //X03 //闭口下模到位BEEKUO_
  182. //输出
  183. #define BKQD_GZ_VAVLE M0352//Y00 //钩针
  184. #define BKQD_YD_VAVLE M0353//Y01 //压带
  185. #define BKQD_JD_VAVLE M0354//Y02 //夹带
  186. #define BKQD_TFK_VAVLE M0355//Y03 //推方块
  187. #define BKQD_SM_VAVLE M0356//Y04 // 上模
  188. #define BKQD_TL_VAVLE M0357//Y05 //推链就是送链 //与闭口下模共用IO口
  189. #define BKQD_XM_VAVLE M0358//Y06 //开口下模
  190. #define BKQD_SZ_OUT M0359//Y07 //使能
  191. #define BKQD_BL_VAVLE M0361//Y11 //合链(并链)
  192. #define BKQD_TABLE_VAVLE M0363//Y13 //台面电机
  193. #define BKQD_CS_OUT M0362//Y12 //超声波
  194. //空输出
  195. #define BKQD_DGLG_VAVLE user_datas[128] //顶过链杆
  196. #define BKQD_CUIQI_OUT user_datas[128] //吹气
  197. #define BKQD_ALARE_OUT user_datas[128] //警告
  198. //#define BKQD_XM_VAVLE user_datas[128] // 闭口下模
  199. #define BKQD_SAFE_IN 0
  200. #define BKQD_bSM M0006 //上模
  201. #define BKQD_bXM M0007 //下模
  202. #define BKQD_bClearTotal M0008 //产量清零
  203. #define BKQD_bXiaQie M0009 //下切
  204. #define BKQD_bQianDianDW M0010 //前点定位
  205. #define BKQD_bChaoSheng M0011 //超声
  206. #define BKQD_bJiaDai M0012 //夹带
  207. #define BKQD_bGoMotor M0013 //电机前进
  208. #define BKQD_bBackMotor M0014 //电机后退
  209. #define BKQD_bTL M0015 //推链(送链)
  210. #define BKQD_bYD M0016 //压带
  211. #define BKQD_bGZ M0017 //勾针
  212. #define BKQD_bJD M0018 //夹带
  213. #define BKQD_bHL M0019 //护链
  214. #define BKQD_bYuanDianDW M0020 //不用
  215. #define BKQD_bTestCS M0021 //超声测试
  216. #define BKQD_bSingle M0022
  217. #define BKQD_bTFK M0023 //推方块
  218. #define BKQD_bTB M0024 //台面
  219. #define BKQD_bYBD M0025
  220. #define BKQD_bClearNowTotal M0026 //产量清零
  221. #define BKQD_bTS M0027
  222. #define BKQD_bBL M0028 //并链(合链)
  223. #define BKQD_bYX M0029
  224. #endif
  225. #endif