JXTieBuJi.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. #ifndef __GLTIEBUJI_H__
  2. #define __GLTIEBUJI_H__
  3. #if JU_XING_MACHINE == 1
  4. extern void TBJ_InitAction(void);
  5. extern void TBJ_ManualAction(void);
  6. extern void TBJ_Action(void);
  7. extern void TBJ_DelayAction(void);
  8. #define TBJ_ALARM_ADDR 100
  9. #define TBJ_TOTAL_ADDR 76
  10. #define TBJ_NOWTOTAL_ADDR 80
  11. #define TBJ_SPEED_ADDR 83
  12. #define TBJ_PROSPEED_ADDR 78
  13. #define ERRORTIME 2000
  14. #define VAVLE_ALARM_TIME 3000
  15. #define GUO_LIAN_OVER_TIME 10000
  16. //故障代码列表
  17. #define TBJ_NO_ALARM 0
  18. #define TBJ_KADAI_ALARM 2
  19. #define TBJ_XIACHONG_ARRIVE_ALARM 3
  20. #define TBJ_HM_LIMIT_ALARM 4
  21. #define TBJ_SM_LIMIT_ALARM 5
  22. #define TBJ_GUOLIAN_ALARM 6
  23. #define TBJ_Auto_Step cStepMByte //自动操作步骤
  24. #define TBJ_Motor_Step cStepMByte1 //电机拖带步骤
  25. #define TBJ_HMCS_Step cStepMByte2 //合模超声步骤
  26. #define TBJ_SJ_FJ_Step cStepMByte3 //送胶分胶步骤
  27. #define TBJ_STOP_Step cStepMByte4 //停机动作步骤
  28. #define TBJ_TEST_TIME cDelayTime1 //测试跳过条件时间
  29. #define TBJ_Auto_Delay cDelayTime2 //自动步骤延迟时间
  30. #define TBJ_FJ_Delay cDelayTime3 //延时分胶
  31. #define TBJ_SJ_Delay cDelayTime4 //延时送胶
  32. #define TBJ_CS_Delay cDelayTime5 //延时超声
  33. #define TBJ_Motor_Delay cDelayTime6 //延时电机
  34. #define TBJ_GZ_Delay cDelayTime7 //延时钩针
  35. #define TBJ_SM_ErrorTime cDelayTime8 //上模容错时间
  36. #define TBJ_SJ_ErrorTime cDelayTime9 //送胶容错时间
  37. #define TBJ_DJ_ErrorTime cDelayTime10 //电机容错时间
  38. #define TBJ_CQ_Delay cDelayTime11 //吹气延时
  39. #define TBJ_STOP_Delay cDelayTime12 //暂停延时
  40. #define TBJ_DIR_P 1
  41. #define TBJ_DIR_N 0
  42. #define TBJ_MOTOR_EN 1
  43. #define TBJ_MOTOR_DISEN 0
  44. #define TBJ_NO_ALARM 0
  45. #define FRIST_LL_LENGTH cDword32Buff1 //第一条拉链长度
  46. #define TBJ_SAVE_POS cDword32Buff2 //保存当前位置信息,用于计算
  47. #define TBJ_OneTimes cCharBuff3 //完成一次标志位
  48. #define TEST1 cCharBuff2 //判断是否为第一条拉链
  49. #define TBJ_Hand_Hemo_flag cCharBuff4 //手动合模完成标志位,做吹气用
  50. #define TBJ_bSingleone cCharBuff5 //单循环记忆参数
  51. #define TBJ_PARAM_CS_DELAY (user_datas[0] * 10) //超声延时时间
  52. #define TBJ_PARAM_GZ_DELAY user_datas[1] //延时上钩针
  53. #define TBJ_PARAM_JJ_TIME (user_datas[3] * 10) //压带夹胶时间
  54. #define TBJ_PARAM_FJ_DELAY (user_datas[4] * 10) //分胶延时输出
  55. #define TNJ_PARAM_TD_LENGTH user_datas[5] //过链由空位到上升沿时,电机拖带距离
  56. #define TBJ_PARAM_BJ_CS_TIME (user_datas[6] * 10) //布胶超声时间
  57. #define TBJ_PARAM_BJ_GH_TIME (user_datas[7] * 10) //布胶固化时间
  58. #define TBJ_PARAM_ChuiQi_TIME (user_datas[8] * 10) //吹气时间
  59. #define TBJ_PARAM_SJ_TIME (user_datas[9] * 10) //送胶时间
  60. #define TBJ_PARAM_MOTOR_START_SPEED user_datas[10] //电机启动速度
  61. #define TBJ_PARAM_MOTOR_ADD user_datas[11] //电机加速速度
  62. #define TBJ_PARAM_HIGH_SPEED user_datas[12] //电机高位速度
  63. #define TBJ_PARAM_NULL_SPEED user_datas[13] //电机空位速度
  64. #define TBJ_PARAM_SongJiaoMode user_datas[14] //送胶方式 0气缸 1滚轮
  65. #define TBJ_PARAM_XiaMo_Mode user_datas[15] //下模方式 0下模活动,1下模不动(下模活动,超声需要考虑烧坏焊头)
  66. #define TBJ_PARAM_TuiGouZhen_Mode user_datas[16] //0 先超声后下勾针,1 先下勾针后超声
  67. #define TBJ_PARAM_SGZSelect user_datas[17] //钩针方式选择 0为双钩针 1为单钩针
  68. #define TBJ_PARAM_TWOTD_SELECT user_datas[18] //二次拖带选择 0 为普通拖带 1为二次拖带
  69. #define TBJ_PARAM_GUNLUN_SIGN user_datas[19] //滚轮送胶时到位是否有信号 0 有前限位 1没前限位
  70. #define TBJ_PARAM_DJ_FANZHUAN user_datas[20] //电机是否反转 0不反转 1反转
  71. #define TBJ_PARAM_FenJiaoSelect user_datas[21] //是否有分胶阀,1为没有,0为有
  72. #define TBJ_PARAM_DJ_AUTO_STOP_TIME (user_datas[24] * 100) //拖带自动停机时间(防止压坏轮胶)
  73. #define TBJ_PARAM_TWOTD_DELAY (user_datas[25] * 10) //延时二次拖带
  74. #define TBJ_PARAM_TWOTD_LENGTH user_datas[26] //二次拖带 过链由空位到上升沿时,电机拖带距离
  75. #define TBJ_TUILIAN_LENGTH user_datas[27] //退链长度
  76. #define TBJ_PARAM_WENDU_TIME (user_datas[28] * 10) //温度到达,超声时减少的时间
  77. #define TBJ_PARAM_LL_PRETECT_LENGTH (user_datas[29]) //自动测长度时自动允许拉带长度偏差
  78. #define TBJ_PARAM_KAIMO_TD_DELAY (user_datas[31] * 10) //开模后延时拖带时间
  79. #define TBJ_PARAM_CS_MODE user_datas[32] //超声模式选择 0为透明胶 1为布胶
  80. #define TBJ_PARAM_TMJ_CS_TIME (user_datas[33] * 10) //透明胶超声时间
  81. #define TBJ_PARAM_TMJ_GH_TIME (user_datas[34] * 10) //透明胶固化时间
  82. #define TBJ_FJBACKMode user_datas[35] //1 为二次拖带后 退分胶
  83. #define TBJ_PARAM_HONGWAI_GanYin user_datas[36] //是否有红外(模拟)(0为没有感应器,1为有感应器)
  84. #define TBJ_Frist_SetDefa user_datas[71] //写入程序后,第一次上电恢复默认出厂参数
  85. #define TBJ_CHENGXU_UPDATE user_datas[74] //便于屏幕判断程序有无更新
  86. #define TBJ_SET_TOTAL user_datas[75] //设定产量
  87. #define TBJ_TOTAL_DISPLAY user_datas[76] //显示产量
  88. #define TBJ_PARAM_SHENGJIAO user_datas[79] //是否开启节省布胶
  89. #define TBJ_PARAM_CYCLE_PULSE user_datas[84] //转一圈脉冲数
  90. #define TBJ_PARAM_CYCLE_LENGTH user_datas[85] //转一圈拖带多长
  91. #define TBJ_PARAM_DEC_MODE user_datas[86] //减速模式 0感应 1数控
  92. #define TBJ_PARAM_DEC_LEN user_datas[87] //数控减速距离
  93. #define TBJ_PARAM_AOKO_MODE user_datas[88] //凹口普通切换
  94. #define TBJ_TEST_MODE (user_datas[90] == 55) //55为测试模式
  95. #define DISPLAY_DATA0 user_datas[121]
  96. #define DISPLAY_DATA1 user_datas[122]
  97. #define DISPLAY_DATA2 user_datas[123]
  98. #define DISPLAY_DATA3 user_datas[124]
  99. #define DISPLAY_DATA4 user_datas[125]
  100. #define DISPLAY_DATA5 user_datas[126]
  101. #define DISPLAY_DATA6 user_datas[127]
  102. #define DISPLAY_DATA7 user_datas[128]
  103. #define TBJ_START_IN M0384 //X00启动
  104. #define TBJ_START_IN_UP (M0384 && !OLDM384) //X00启动上升沿
  105. #define TBJ_STOP_IN M0385 //X01停止
  106. #define TBJ_STOP_IN_UP (M0385 && !OLDM385) //X01停止上升沿
  107. #define TBJ_HAND_GOUZHEN M0386 //X02手动钩针
  108. #define TBJ_HAND_GOUZHEN_UP (M0386 && !OLDM386) //X02手动钩针上升沿
  109. #define TBJ_HAND_FENJIAO M0387 //X03手动分胶
  110. #define TBJ_HAND_FENJIAO_UP (M0387 && !OLDM387) //X03手动分胶上升沿
  111. #define TBJ_HAND_FENJIAO_DW (!M0387 && OLDM387) //X03手动分胶下降沿
  112. #define TBJ_HAND_HEMO M0388 //X04手动合模
  113. #define TBJ_HAND_HEMO_UP (M0388 && !OLDM388) //X04手动合模上升沿
  114. #define TBJ_HAND_HEMO_DW (!M0388 && OLDM388) //X04手动合模下降沿
  115. #define TBJ_HAND_SONGJIAO M0389 //X05手动送胶
  116. #define TBJ_HAND_SONGJIAO_UP (M0389 && !OLDM389) //X05手动送胶上升沿
  117. #define TBJ_HAND_SONGJIAO_DW (!M0389 && OLDM389) //X05手动送胶下降沿
  118. #define TBJ_HAND_CHAOSHENG M0390 //X06手动超声
  119. #define TBJ_HAND_CHAOSHENG_UP (M0390 && !OLDM390) //X06手动超声上升沿
  120. #define TBJ_HAND_CHAOSHENG_DW (!M0390 && OLDM390) //X06手动超声下降沿
  121. #define TBJ_NOJIAO_IN M0391 //X07切换自动位 目前空置
  122. #define TBJ_SHANGCHAO_IN M0392 //X10上超
  123. #define TBJ_SHANGCHAO_IN_UP (M0392 && !OLDM392) //X10上超上升沿
  124. #define TBJ_SHANGCHAO_IN_DW (!M0392 && OLDM392) //X10上超下降沿
  125. #define TBJ_GUO_LIAN_IN M0393 //X11过链接近开关 有链为 1 无链(空位)为 0
  126. #define TBJ_GUO_LIAN_IN_UP (M0393 && !OLDM393) //X11过链接近开关上升沿
  127. #define TBJ_GUO_LIAN_IN_DOWN (!M0393 && OLDM393) //X11过链接近开关下降沿
  128. #define TBJ_FJ_LIMIT_IN M0394 //X12分胶阀到位感应
  129. #define TBJ_FJ_ORIGIN_IN M0395 //X13分胶阀原位感应
  130. #define TBJ_SM_LIMIT_IN M0396 //X14上模下冲到位感应
  131. #define TBJ_SM_LIMIT_IN_UP (M0396 && !OLDM396) //X14上模下冲到位感应上升沿
  132. #define TBJ_GZ_ORIGIN_IN M0397 //X15钩针复位原位感应
  133. #define TBJ_SJ_LIMIT_IN M0398 //X16送胶到位感应
  134. #define TBJ_SJ_LIMIT_IN_UP (M0398 && !OLDM398) //X16送胶到位感应上升沿
  135. #define TBJ_SJ_ORIGIN_IN M0399 //X17送胶复位感应
  136. #define TBJ_TD_LIMIT_IN M0400 //X20拖带到位感应(双钩针才有)
  137. #define TBJ_AUTO_IN M0401 //X21缺胶信号
  138. #define TBJ_XM_LIMIT_IN M0402 //X22下模到位感应
  139. #define TBJ_CLUTH_VAVLE M0352 //Y00离合器(步进方向)
  140. #define TBJ_GZ_VAVLE M0353 //Y01钩针
  141. #define TBJ_FJ_VAVLE M0354 //Y02分胶
  142. #define TBJ_SM_VAVLE M0355 //Y03上模(下冲)
  143. #define TBJ_SJ_VAVLE M0356 //Y04送胶电磁阀
  144. #define TBJ_YD_VAVLE M0357 //Y05压带
  145. #define TBJ_CQ_VAVLE M0358 //Y06吹气
  146. //#define //Y07夹胶
  147. #define TBJ_MOTOR_OUT M0361 //Y11
  148. #define TBJ_XM_VAVLE M0362 //Y12下模
  149. #define TBJ_CS_OUT M0365 //Y15超声
  150. //Y15电机松轴
  151. //Y12运行
  152. //Y13停止
  153. //Y14警告
  154. //M0~M4 Actioon.h全局使用
  155. #define TBJ_bYD M0005 //压带 老版屏幕为M0003
  156. #define TBJ_bGZ M0006 //钩针 老版屏幕为M0004
  157. #define TBJ_bSJ M0007 //送胶
  158. #define TBJ_bHM M0008 //合模
  159. #define TBJ_bCS M0009 //超声
  160. #define TBJ_bCS_FLAG M0010 //超声标志
  161. #define TBJ_bSC M0011 //上超
  162. #define TBJ_bSC_FLAG M0012 //上超标志
  163. #define TBJ_bFJ M0013 //分胶
  164. #define TBJ_bRESET_TOTAL M0014 //产量清零
  165. #define TBJ_bRunning M0020
  166. #define TBJ_bStart M0021
  167. #define TBJ_bStop M0022
  168. #define TBJ_bAlarmStop M0023
  169. #define TBJ_bClearTotal M0024
  170. #define TBJ_bSingle M0025
  171. #define TBJ_bTiaoShi_MODE M0040
  172. #define DJ_NoZip_W 1 //E01 没拉链警告 请检查 X11 过链接近开关
  173. #define DJ_TuiGZ_W 2 //E02 退勾针不到位或 X15 钩针复位感应异常,当前程序处于电机第七步
  174. #define QD_GZDaoWei_W 3 //E03 钩针未退位或 X20 钩针到位感应异常警告,无法启动
  175. #define SJ_SongJiao_W 4 //E04 送胶不到位或 X16送胶前感应异常
  176. #define SJ_TuiJiao_W 5 //E05 退胶不到位警告 或 X16、X17送胶前后感应异常
  177. #define SJ_TuiFenJiao_W 6 //E06 退分胶不到位警告或 X12分胶后感应异常
  178. #define SJ_NoJiao_W 7 //E07 胶已用完,请补充胶
  179. #define ZipperLengPRO_W 8 //E08 拉链长度异常,超过拉链保护长度
  180. #define QD_Hemo_DaoWei_W 9 //E09 下冲气缸未上升或 X14 合模感应异常,无法启动
  181. #define SJ_FenJiao_DaoWei_W 10 //E10 分胶未到位,无法送胶或 X12分胶前感应异常
  182. #define QD_SongJiaoFa_W 11 //E11 送胶阀未退回,无法启动
  183. #define QD_FenJiaoFa_W 12 //E12 分胶阀未退回,无法启动
  184. #define QD_FenJiaoQian_W 13 //E13 分胶阀未退位或 X12 分胶前感应异常,无法启动
  185. #define QD_FenJiaoHou_W 14 //E14 X13 分胶后感应异常,无法启动
  186. #define QD_TuiJiaoHou_W 15 //E15 X17 送胶后感应异常,无法启动
  187. #define TBJ_TOTAL_ALARM 16 //E16 已达设定产量,请清空产量或重新设定产量
  188. #define QD_GZOut_W 18 //E18 钩针阀未退回,无法启动
  189. #define QD_GZreset_W 19 //E19 X15 钩针复位感应异常,无法启动
  190. #define QD_XiaChong_W 20 //E20 下冲气缸输出中,无法启动
  191. #define FenJiao_BuDaoWei_W 21 //E21 分胶阀不到位或 X12 分胶前感应异常
  192. #define SongJiao_BuDaoWei 22 //E22 送胶不到位 或 X16送胶前感应异常
  193. #define Hemo_BuDaoWei_W 23 //E23 合模不到位警告或 X14 合模到位感应异常
  194. #define DJ_ZipperTimePRO_W 24 //E24 拉拉链时间过长,可能由以下原因:①超出保护时间,请检查保护时间是否设置过短②电机是否启动,速度是否过慢③拉链过紧,电机没拉动
  195. #define DJ_GZWeiDaoWei_W 25 //E25 钩针未到位或 X20钩针到位感应异常警告,电机停止
  196. #define CS_Hemo_DaoWei_W 26 //E26 超声停止,合模不到位或X14下冲到位感应异常
  197. #define CS_GZ_DaoWei_W 27 //E27 超声停止,钩针不到位或 X15钩针复位感应异常
  198. #define ZD_FenJiaoFa_W 28 //E28 自动停止,分胶阀输出停止异常
  199. #define ZD_FenJiaoQian_W 29 //E29 自动停止,分胶未退位或分胶前感应异常
  200. #define ZD_FenJiaoHou_W 30 //E30 自动停止,分胶未退位或分胶后感应异常
  201. #define ZD_SongJiaoFa_W 31 //E31 自动停止,送胶阀退位异常
  202. #define ZD_SongJiaoQian_W 32 //E32 自动停止,送胶未退位或送胶前感应异常
  203. #define ZD_SongJiaoHou_W 33 //E33 自动停止,送胶未退位或送胶后感应异常
  204. #define SDFJ_ModeAction_W 34 //E34 手动分胶停止,原因可能如下①夹胶非单独气缸,压胶阀未关闭;②单钩针模式下,钩针退位了;③双钩针模式下,钩针未退位;
  205. #define SDFJ_XiaChongFa_W 35 //E35 手动分胶停止,下冲气缸未退位
  206. #define SDFJ_XiaChong_DaoWei_W 36 //E36 手动分胶停止,下冲气缸未退位或X14下冲到位感应异常
  207. #define SDFJ_CS_W 37 //E37 手动分胶停止,超声未关闭
  208. #define SDFJ_SongJiaoDaoWei_W 38 //E38 手动分胶停止,送胶阀未退回,或X16送胶到位感应异常
  209. #define SDFJ_TuiJiaoDaoWei_W 39 //E39 手动分胶停止,送胶阀未退回,或X17退胶到位感应异常
  210. #define SDSJ_ModeAction_W 40 //E40 手动送胶停止,原因可能如下①夹胶非单独气缸,压胶阀未关闭;②单钩针模式下,钩针退位;③双钩针模式下,钩针未退位;
  211. #define SDSJ_FenJiaoFa_W 41 //E41 手动送胶停止,分胶阀处于异常状态,X12X13前后感应灯同亮或同灭
  212. #define SDSJ_TuiJiao_DaoWei_W 42 //E42 手动送胶停止,送胶阀未输出,送胶后感应亮
  213. #define SDSJ_XiaChongFa_W 43 //E43 手动送胶停止,下冲气缸输出中
  214. #define SDSJ_XiaChong_DaoWei_W 44 //E44 手动送胶停止,下冲气缸未退回,或X14 下冲到位感应异常
  215. #define SDSJ_CS_W 45 //E45 手动送胶停止,超声未关闭
  216. #define SDHM_FenJiaoHou_W 46 //E46 手动合模停止,分胶阀未退位,或 X13分胶后感应异常
  217. #define SDHM_FenJiaoQian_W 47 //E47 手动合模停止,分胶阀未退位,或 X12分胶前感应异常
  218. #define SDHM_SongJiao_DaoWei_W 48 //E48 手动合模停止,送胶阀未退位,或 X16送胶前感应异常
  219. #define SDHM_SongJiao_TuiWei_W 49 //E49 手动合模停止,送胶阀未退位,或 X17分胶后感应异常
  220. #define SDHM_CS_W 50 //E50 手动合模停止,超声未关闭
  221. #define SDCS_FenJiaoFa_W 51 //E51 手动超声停止,分胶阀未退回
  222. #define SDCS_SongJiaoFa_W 52 //E52 手动超声停止,送胶阀未退回
  223. #define SDCS_FenJiaoQian_W 53 //E53 手动超声停止,分胶阀未退回,或X12分胶前感应异常
  224. #define SDCS_FenJiaoHou_W 54 //E54 手动超声停止,分胶阀未退回,或X13分胶后感应异常
  225. #define SDCS_SongJiao_DaoWei_W 55 //E55 手动超声停止,送胶阀未退回,或X16送胶到位感应异常
  226. #define SDCS_TuiJiao_DaoWei_W 56 //E56 手动超声停止,送胶阀未退回,或X17退胶到位感应异常
  227. #define SDSC_FenJiaoFa_W 57 //E57 手动上超停止,分胶阀未退回
  228. #define SDSC_FenJiaoQian_W 58 //E58 手动上超停止,分胶阀未退回,或X12分胶前感应异常
  229. #define SDSC_FenJiaoHou_W 59 //E59 手动上超停止,分胶阀未退回,或X13分胶后感应异常
  230. #define SDSC_SongJiaoFa_W 60 //E60 手动上超停止,送胶阀未退回
  231. #define SDSC_SongJiao_DaoWei_W 61 //E61 手动上超停止,送胶阀未退回,或X16送胶到位感应异常
  232. #define SDSC_TuiJiao_DaoWei_W 62 //E62 手动上超停止,送胶阀未退回,或X17退胶到位感应异常
  233. #endif
  234. #endif