GLHeLian.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #ifndef __GLHELIAN_H__
  2. #define __GLHELIAN_H__
  3. #if CHANG_SHENG_GEI_LI_MACHINE
  4. extern void HL_InitAction(void);
  5. extern void HL_ManualAction(void);
  6. extern void HL_Action(void);
  7. extern void HL_PWMAction(void);
  8. #define HL_MOTOR_DISEN 1
  9. #define HL_MOTOR_EN 0
  10. #define HL_DIR_P 0
  11. #define HL_DIR_N 1
  12. #define HL_ALARM_ADDR 100
  13. #define HL_TOTAL_ADDR 76
  14. #define HL_PROSPEED_ADDR 78
  15. #define HL_VAVLE_ALARM_TIME 3000
  16. //故障代码列表
  17. #define HL_NO_ALARM 0
  18. #define HL_TOTAL_ALARM 1
  19. #define HL_GUOLIAN_ALARM 2
  20. #define HL_SM_LIMIT_ALARM 3
  21. #define HL_XM_LIMIT_ALARM 4
  22. #define HL_BB_LIMIT_ALARM 5
  23. #define HL_DK_LIMIT_ALARM 6
  24. #define HL_DK_ORIGIN_ALARM 7
  25. #define HL_DK_UP_LIMIT_ALARM 8
  26. #define HL_CCX_LIMIT_ALARM 9
  27. #define HL_CCX_ORIGIN_ALARM 10
  28. #define HL_TFK_LIMIT_ALARM 11
  29. #define HL_TFK_ORIGIN_ALARM 12
  30. #define HL_MJ_LIMIT_ALARM 13
  31. #define HL_HM_BACK_ALARM 14
  32. #define HL_MotorStep cStepMByte
  33. #define HL_AutoStep cStepMByte1
  34. #define HL_HLStep cStepMByte2
  35. #define HL_ManDKStep cStepMByte3
  36. #define HL_AutoDelay cDelayTime1
  37. #define HL_MotorDelay cDelayTime2
  38. #define HL_CheckDelay cDelayTime3
  39. #define HL_HLDelay cDelayTime4
  40. #define HL_YCXDelay cDelayTime5
  41. #define HL_ManDKDelay cDelayTime6
  42. #define HL_Y14Delay cDelayTime7
  43. #define HL_Y15Delay cDelayTime8
  44. #define HL_PARAM_SET_TOTAL (user_datas[2] | user_datas[3] << 16)
  45. #define HL_PARAM_MOTOR_ALARM_TIME (user_datas[4] * 10)
  46. #define HL_PARAM_HIGH_SPEED user_datas[5] // 电机高速
  47. #define HL_PARAM_LOW_SPEED user_datas[6] // 空位速度
  48. #define HL_PARAM_DELAY_STOP user_datas[7] // 定位调节
  49. #define HL_PARAM_CYCLE_DELAY (user_datas[8] * 10) // 延时启动
  50. #define HL_PARAM_DELAY_HM (user_datas[9] * 10) // 延时合模
  51. #define HL_PARAM_DELAY_TFK (user_datas[10] * 10) // 延时推方块
  52. #define HL_PARAM_DELAY_JD (user_datas[11] * 10) // 延时夹带
  53. #define HL_PARAM_DELAY_CCX (user_datas[12] * 10) // 延时穿插销
  54. #define HL_PARAM_DELAY_CHECK_CCX (user_datas[13] * 10) // 延时检测穿插销到位
  55. #define HL_PARAM_DELAY_BACK_DK_UP (user_datas[14] * 10) // 延时复位上下挡块
  56. #define HL_PARAM_CCX_LENGTH user_datas[15] // 穿插销到位后拖带走多长
  57. #define HL_PARAM_DELAY_TFK_BACK (user_datas[16] * 10) // 延时复位推方块
  58. #define HL_PARAM_DELAY_DK_GO (user_datas[17] * 10) // 延时挡块前后
  59. //#define HL_PARAM_DELAY_STOP2 user_datas[18]
  60. #define HL_PARAM_DELAY_BB_BACK (user_datas[19] * 10) // 延时复位摆臂
  61. #define HL_PARAM_DELAY_BB (user_datas[20] * 10) // 延时摆臂
  62. #define HL_PARAM_DELAY_HM_BACK user_datas[21] // 延时复位合模
  63. //#define HL_PARAM_OFFSET_LENGTH user_datas[22]
  64. #define HL_PARAM_DELAY_JD_BACK (user_datas[23] * 10) // 夹带延时复位
  65. #define HL_PARAM_DELAY_CHECK_TIME user_datas[24] // 延时检测定位信号
  66. #define HL_PARAM_YCX_TIME (user_datas[25] * 10) // 压插销时间
  67. #define HL_PARAM_DELAY_DK_UP (user_datas[26] * 10) // 延时上挡块
  68. #define HL_PARAM_CCX_TIMES user_datas[27] //夹带穿插销次数0为1次 1为两次
  69. #define HL_PARAM_CCX_MODE user_datas[28] //穿插销模式 1为电机穿 0为夹带气缸穿
  70. #define HL_PARAM_CCX_SPEED user_datas[29]
  71. #define HL_PARAM_DELAY_YD_BACK user_datas[30] // 延时收压带
  72. #define HL_PARAM_DELAY_Y14_BACK user_datas[31] // 延时
  73. #define HL_PARAM_DELAY_CD (user_datas[32] * 10) //延时扯带
  74. #define HL_PARAM_CD_ENABLE user_datas[33]//扯带功能使能 1为带扯带功能
  75. #define HL_PARAM_BB_ENABLE user_datas[34]//0为摆臂晚放开1为摆臂提前放开
  76. #define HL_PARAM_CONNECT_MODE user_datas[35]//1为联机模式
  77. #define HL_PARAM_DELAY_START (user_datas[36] * 10)
  78. #define HL_PARAM_ERROR_DELAY_STOP user_datas[37]
  79. #define DISPLAY_DATA0 user_datas[121]
  80. #define DISPLAY_DATA1 user_datas[122]
  81. #define DISPLAY_DATA2 user_datas[123]
  82. #define DISPLAY_DATA3 user_datas[124]
  83. #define DISPLAY_DATA4 user_datas[125]
  84. #define DISPLAY_DATA5 user_datas[126]
  85. #define DISPLAY_DATA6 user_datas[127]
  86. #define DISPLAY_DATA7 user_datas[128]
  87. #define IO_Change 0
  88. #if !IO_Change
  89. #define HL_START_IN X00
  90. #define HL_START_IN_UP (X00 && !OLDX00)
  91. #define HL_STOP_IN X01
  92. #define HL_STOP_IN_UP (X01 && !OLDX01)
  93. #define HL_GUO_LIAN_IN X02 //过链感应
  94. #define HL_GUO_LIAN_IN_UP (X02 && !OLDX02)
  95. #define HL_GUO_LIAN_IN_DW (!X02 && OLDX02)
  96. #define HL_SM_LIMIT_IN X04 //上模到位
  97. #define HL_XM_LIMIT_IN X05 //下模到位
  98. #define HL_BB_LIMIT_IN X06 //摆臂到位
  99. #define HL_DK_ORIGIN_IN X07 //挡块前后原位
  100. #define HL_DK_LIMIT_IN X10 //挡块前后到位
  101. #define HL_DK_UP_LIMIT_IN X11 //挡块上下到位
  102. #define HL_CCX_LIMIT_IN X12 //穿插销到位
  103. #define HL_CCX_ORIGIN_IN X13 //穿插销原位
  104. #define HL_TFK_LIMIT_IN X14 //推方块到位
  105. #define HL_TFK_ORIGIN_IN X15 //推方块原位
  106. #define HL_LW_STOP_IN X16 //联网信号上
  107. #define HL_LW_STOP_IN_DW (!X16 && OLDX16) //联网信号上
  108. #define HL_LW_START_IN X17 //联网信号下
  109. #define HL_front_IN X20 //前机工作状态
  110. #define HL_front_IN_DW (!X20 && OLDX20) //
  111. #define HL_HM_VAVLE Y00 //合模
  112. #define HL_TFK_VAVLE Y01 //推方块
  113. #define HL_BB_VAVLE Y02 //摆臂
  114. #define HL_DK_UP_VAVLE Y03 //挡块上下
  115. #define HL_JD_VAVLE Y04 //夹带
  116. #define HL_CCX_VAVLE Y05 //穿插销
  117. #define HL_DK_GO_VAVLE Y06 //挡块前后
  118. #define HL_YD_VAVLE Y07 //压带
  119. #define HL_SJ_VAVLE Y10 //松紧气缸
  120. #define HL_CD_MOTOR Y11 //储带电机
  121. #define HL_ALARM_OUT Y12
  122. #define HL_YCX_VAVLE Y13 //压插销电磁阀
  123. #define HL_CD_VAVLE Y14 //扯带电磁阀
  124. #define HL_OVEROUt_VAVLE Y15 //工作完成输出
  125. #else
  126. #define HL_START_IN M0384//X00
  127. #define HL_START_IN_UP (M0384 && !OLDM384)//(X00 && !OLDX00)
  128. #define HL_STOP_IN M0385//X01
  129. #define HL_STOP_IN_UP (M0385 && !OLDM385)//(X01 && !OLDX01)
  130. #define HL_GUO_LIAN_IN M0386//X02 //过链感应
  131. #define HL_GUO_LIAN_IN_UP (M0386 && !OLDM386)//(X02 && !OLDX02)
  132. #define HL_GUO_LIAN_IN_DW (!M0386 && OLDM386)//(!X02 && OLDX02)
  133. #define HL_SM_LIMIT_IN M0388//X04 //上模到位
  134. #define HL_XM_LIMIT_IN M0389//X05 //下模到位
  135. #define HL_BB_LIMIT_IN M0390//X06 //摆臂到位
  136. #define HL_DK_ORIGIN_IN M0391//X07 //挡块前后原位
  137. #define HL_DK_LIMIT_IN M0392//X10 //挡块前后到位
  138. #define HL_DK_UP_LIMIT_IN M0393//X11 //挡块上下到位
  139. #define HL_CCX_LIMIT_IN M0394//X12 //穿插销到位
  140. #define HL_CCX_ORIGIN_IN M0395//X13 //穿插销原位
  141. #define HL_TFK_LIMIT_IN M0396//X14 //推方块到位
  142. #define HL_TFK_ORIGIN_IN M0397//X15 //推方块原位
  143. #define HL_LW_STOP_IN M0398//X16 //联网信号上
  144. #define HL_LW_STOP_IN_DW (M0398 && !OLDM398)//(!X16 && OLDX16) //联网信号上
  145. #define HL_LW_START_IN M0399//X17 //联网信号下
  146. #define HL_front_IN M0400//X20 //前机工作状态
  147. #define HL_front_IN_DW (M0400 && !OLDM400)//(!X20 && OLDX20) //
  148. #define HL_HM_VAVLE M0352//Y00 //合模
  149. #define HL_TFK_VAVLE M0353//Y01 //推方块
  150. #define HL_BB_VAVLE M0354//Y02 //摆臂
  151. #define HL_DK_UP_VAVLE M0355//Y03 //挡块上下
  152. #define HL_JD_VAVLE M0356//Y04 //夹带
  153. #define HL_CCX_VAVLE M0357//Y05 //穿插销
  154. #define HL_DK_GO_VAVLE M0358//Y06 //挡块前后
  155. #define HL_YD_VAVLE M0359//Y07 //压带
  156. #define HL_SJ_VAVLE M0360//Y10 //松紧气缸
  157. #define HL_CD_MOTOR M0361//Y11 //储带电机
  158. #define HL_ALARM_OUT M0362//Y12
  159. #define HL_YCX_VAVLE M0363//Y13 //压插销电磁阀
  160. #define HL_CD_VAVLE M0364//Y14 //扯带电磁阀
  161. #define HL_OVEROUt_VAVLE M0365//Y15 //工作完成输出
  162. #endif
  163. //M0~M4 Actioon.h全局使用
  164. #define HL_bHM M0005 //合模
  165. #define HL_bTFK M0006 //推方块
  166. #define HL_bBB M0007 //摆 臂
  167. #define HL_bDK_UP M0008 //上挡块
  168. #define HL_bJD M0009 //夹 带
  169. #define HL_bCCX M0010 //穿插销
  170. #define HL_bDK_GO M0011 //挡块前后
  171. #define HL_bYD M0012 //压 带
  172. #define HL_bSJ M0013 //松 紧
  173. #define HL_bCD M0014
  174. #define HL_bMotor M0015 //拖带电机
  175. #define HL_bStart M0016 //启动
  176. #define HL_bRunning M0017 //运行
  177. #define HL_bStop M0018 //停止
  178. #define HL_bAlarmStop M0019 //
  179. #define HL_bSingStart M0020 //单一自动
  180. #define HL_bAdd M0021 //定位数值加
  181. #define HL_bSetWorkData M0022
  182. #define HL_bDec M0023 //定位数值减
  183. #define HL_bDW M0024 //拖带定位
  184. #define HL_bZCX M0025 //装插销
  185. #define HL_bHL M0026 //合 链
  186. #define HL_bHMYD M0027 //合 模压带
  187. #define HL_bDKUP M0028 //上挡块
  188. #define HL_bYCX M0029 //压插销
  189. #define HL_bYCD M0030 // 扯带
  190. #endif
  191. #endif