JHMXC_NiLong_StepJi.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. #if JIN_HONG_MACHINE==1
  2. extern void MXC_InitAction(void);
  3. extern void MXC_Action(void);
  4. extern void MXC_ExtiAcitionX20(void);
  5. extern void MXC_SBCHECK_PROC(void);
  6. #define MXC_ALARM_ADDR 100
  7. #define MXC_ZIPPER_LENGTH_ADDR 17
  8. #define MXC_DC_TOTAL_ADDR 76
  9. #define MXC_DC_PROSPEED_ADDR 78
  10. #define MXC_XC_TOTAL_ADDR 106
  11. #define MXC_XC_PROSPEED_ADDR 108
  12. #define MXC_XC_ZIPPER_LENGTH_ADDR 34
  13. #define XC_MOTOR_EN 1
  14. #define XC_MOTOR_DISEN 0
  15. #define DC_Motor_EN 0
  16. #define DC_Motor_DISEN 1
  17. #define XZ_Motor_EN 0
  18. #define XZ_Motor_DISEN 1
  19. #define MXC_DC_Reverse_EN 0
  20. #define MXC_XC_DIR_P 1
  21. #define MXC_DC_DIR_P 1
  22. #define MXC_DC_DIR_N 0
  23. #define MXC_DC_GZ_MODE 0
  24. #define MXC_DC_SF_MODE 1
  25. #define MXC_DC_SB_MODE 2
  26. #define MXC_DC_MOTOR_BMQ_MODE 1
  27. #define MXC_DC_MOTOR_SF_MODE 2
  28. #define MXC_NO_ALARM 0
  29. #define MXC_TOTAL_ALARM 1 //定寸生产到达预设数量
  30. #define MXC_XIA_CHONG_ALARM 2 // 下冲异常
  31. #define MXC_KA_DAI_ALARM 3 //卡带感应异常
  32. #define MXC_XC_ALARM 4 //下冲感应异常
  33. #define MXC_NO_ZIPPER_ALARM 5 //无拉带
  34. #define MXC_XUANCHI_IN_ALARM 6
  35. #define MXC_NO_GOUZHEN_ALARM 7 //勾针
  36. #define MXC_LFZ_ORIGIN_ALARM 8
  37. #define MXC_LFZ_LIMIT_ALARM 9
  38. #define MXC_RFZ_ORIGIN_ALARM 10
  39. #define MXC_RFZ_LIMIT_ALARM 11
  40. #define MXC_LONG_TIME_NO_ZIPPER_ALARM 12 //长时间没有感应到拉链
  41. #define MXC_START_RFZ_ORIGIN_ALARM 13//右分针原位警告,无法启动
  42. #define MXC_DC_SONGDAI_ALARM 14//送带过多异常,已关闭送带开关,请重新打开
  43. #define MXC_NO_SEBIAO_ALARM 15//长时间检测不到色标
  44. #define MXC_ZIPPER_LENGTH_ALARM 16//拉链长度设置小于钩针最短距离
  45. #define MXC_ZIPPER_SB_LENGTH_ALARM 17//拉链长度设置小于色标定位位置
  46. #define MXC_MOTOR_ALALRM_TIME 20000
  47. #define MXC_ERRORTIME 3000 //出错时间
  48. #define MXC_XIACHONG_EEROR_TIME 3000
  49. #define MXC_FENZHEN_EEROR_TIME 1000
  50. #define MXC_MXC_PARAM_DAILUN_LENGTH user_datas[1] //定寸带轮转一圈周长
  51. #define MXC_MXC_PARAM_CYCLE_PULSE user_datas[2] //定寸带轮转一圈脉冲
  52. #define MXC_BM_LENGTH user_datas[3] //编码器转一圈周长
  53. #define MXC_BM_CYCLE_PULSE user_datas[4] //编码器转一圈脉冲
  54. #define MXC_PARAM_BUDAI_ALARM_TIME (user_datas[7]*10)//缺布带最大容错时间
  55. #define MXC_DC_PARAM_MUL_SPEED user_datas[8] //定寸手动最高速度
  56. #define MXC_DC_PARAM_SET_SPEED user_datas[9] //定寸最高速度
  57. #define MXC_DC_PARAM_START_SPEED user_datas[10] //定寸开始速度
  58. #define MXC_DC_PARAM_LOW_SPEED user_datas[11] //定寸慢速度
  59. //#define MXC_DC_PARAM_ACC_SPEED user_datas[12] //定寸加速时间
  60. //#define MXC_DC_PARAM_DEC_SPEED user_datas[13] //定寸减速时间
  61. #define MXC_DC_PARAM_LOWSPEED_LENGTH user_datas[14] //定寸慢速长度
  62. #define MXC_DC_PARAM_SB_OFFSET_SPEED user_datas[15] //色标慢速度
  63. #define MXC_DC_PARAM_SEBIAO_DW_LENGTH user_datas[16] //色标定位长度
  64. #define MXC_SET_REVISE_ZIPPER_LENGTH user_datas[17] //定寸拉链修正长度
  65. #define MXC_DEC_MODE 1//user_datas[18] //钩针减速模式
  66. #define MXC_PARAM_AUTO_CHECK_MODE user_datas[19] //测长模式
  67. #define MXC_PARAM_FIRST_SPEED user_datas[20] //钩针第一条速度
  68. #define MXC_PARAM_GZ_DELAY (user_datas[21]*10) //延时上钩针
  69. #define MXC_PARAM_GZ_RESET_MODE user_datas[22] //钩针复位方式 0 自动 1数控
  70. #define MXC_PARAM_GZ_LENGTH user_datas[23] //数控提前上钩针
  71. #define MXC_DC_KongWei_Length user_datas[24] //定寸空位长度
  72. #define MXC_PARAM_SB_HIGH_SPEED user_datas[25] //色标最高速度
  73. #define MXC_PARAM_SEBIAO_TQ_LENGTH user_datas[26] //提前开启色标长度
  74. #define MXC_PARAM_SEBIAO_ERROR_LENGTH user_datas[27] //色标容错长度
  75. #define MXC_DC_MODE user_datas[28] //定寸模式 0钩针定寸 1伺服定寸 2色标
  76. #define MXC_PARAM_SEBIAO_LOWSPEED_LENGTH user_datas[29] //色标慢速长度
  77. #define MXC_PARAM_DELAY_CHUIQI_TIME (user_datas[31]*10) //延时吹气
  78. #define MXC_PARAM_CHUIQI_TIME (user_datas[32]*10) //吹气时间
  79. #define MXC_PARAM_DDBH_delay (user_datas[33]*10) //顶刀保护延时
  80. #define MXC_SET_ZIPPER_LENGTH (user_datas[34] | user_datas[35] << 16) //定寸拉链长度
  81. #define MXC_PARAM_DAOKOU_LENGTH user_datas[36] //定寸刀口长度
  82. //#define MXC_PARAM_GOUZHEN_MIN_LEN user_datas[37] //钩针定寸最短长度
  83. #define MXC_PARAM_DELAY_XC (user_datas[41]*10)
  84. #define MXC_XC_Stop_Delay (user_datas[42]*10)
  85. #define MXC_PARAM_ShaChe_Delay (user_datas[43]*10)
  86. #define MXC_PARAM_ShaChe_TIME (user_datas[44]*10)
  87. #define MXC_RightFZ_Delay (user_datas[45]*10)
  88. #define MXC_LeftFZ_Delay (user_datas[46]*10)
  89. #define MXC_SET_TOTAL (user_datas[47] | (user_datas[48] << 16))
  90. #define MXC_DDBH_TIME (user_datas[49]*10)
  91. #define MXC_PARAM_SongDai_Delay (user_datas[50]*10)
  92. #define MXC_PARAM_SD_Pretect_TIME (user_datas[52]*10)
  93. #define MXC_DC_RightFZ_AGAIN_TIME (user_datas[56]*10)
  94. #define MXC_DC_LeftFZ_AGAIN_TIME (user_datas[57]*10)
  95. #define MXC_DC_XC_MOTOR_HIGH_SPEED user_datas[61]
  96. #define MXC_DC_XC_MOTOR_LOW_SPEED user_datas[62]
  97. #define MXC_DC_XC_MOTOR_GO_LENGTH user_datas[65]//感应再走距离(脉冲)
  98. #define MXC_DC_XC_MOTOR_LOW_LENGTH user_datas[66]
  99. #define MXC_DC_XC_MODE user_datas[67]
  100. #define MXC_DC_XC_MOTOR_LENTH user_datas[68] //下冲电机一圈长度
  101. #define MXC_DC_XC_MOTOR_CYCLE_PULSE user_datas[69] //下冲电机一圈脉冲
  102. #define MXC_DC_XC_CHUIQI_PULSE user_datas[70]//转至多少脉冲时吹气
  103. #define MXC_DC_XC_DINDAO_PULSE user_datas[71]//转至多少脉冲时顶刀
  104. //#define MXC_PARAM_SBDW_LOW_SPEED user_datas[72] //感应模式定寸最高速度
  105. //#define MXC_PARAM_SBDW_LOW_LENGTH user_datas[73] //感应模式定寸慢速度
  106. #define MXC_PARAM_SB_LOW_SPEED user_datas[74] //色标慢速度
  107. #define MXC_PARAM_CYCLE_TIME user_datas[80] //色标慢速度
  108. #define MXC_PARAM_LENGTH_CMP 0;//user_datas[81] //长度修正补偿
  109. #define MXC_PARAM_First_CMP user_datas[82] //第一条修正补偿
  110. #define MXC_PARAM_SK_HIGH_SPEED user_datas[83] //数控高速
  111. #define MXC_PARAM_SK_SLOW_SPEED user_datas[84] //数控低速
  112. #define MXC_PARAM_SK_SLOW_LENGTH user_datas[85] //数控低速长度
  113. #define DISPLAY_DATA0 user_datas[121]
  114. #define DISPLAY_DATA1 user_datas[122]
  115. #define DISPLAY_DATA2 user_datas[123]
  116. #define DISPLAY_DATA3 user_datas[124]
  117. #define DISPLAY_DATA4 user_datas[125]
  118. #define DISPLAY_DATA5 user_datas[126]
  119. #define DISPLAY_DATA6 user_datas[127]
  120. #define DISPLAY_DATA7 user_datas[128]
  121. //步骤
  122. #define MXC_DC_cAutoStep cStepMByte
  123. #define MXC_DC_cMotorStep cStepMByte2
  124. #define MXC_cXiaChongStep cStepMByte4
  125. #define MXC_cRightFZStep cStepMByte5
  126. #define MXC_cLeftFZStep cStepMByte6
  127. #define MXC_cChuiQiStep cStepMByte7
  128. #define MXC_cShaCheStep cStepMByte8
  129. #define MXC_cDDBH_Step cStepMByte10
  130. #define MXC_cBUJIN_XC_Step cStepMByte11
  131. #define MXC_cJiaoDaoStep cStepMByte12
  132. #define MXC_DC_cAutoDelay cDelayTime1
  133. #define MXC_cChuiQiDelay cDelayTime2
  134. #define MXC_cBudaiCheckDelay cDelayTime3
  135. #define MXC_cFenZhenLeftDelay cDelayTime4
  136. #define MXC_cKaDaiDelay cDelayTime5
  137. #define MXC_cXiaChongDelay cDelayTime6
  138. #define MXC_DC_cMotorDelay cDelayTime7
  139. #define MXC_cShaCheDelay cDelayTime8
  140. #define MXC_cRightFZ_Delay cDelayTime9
  141. #define MXC_cLeftFZ_Delay cDelayTime10
  142. #define MXC_cDDBHDelay cDelayTime11
  143. #define MXC_cSongDaiDelay cDelayTime12
  144. #define MXC_SongDai_LongTime cDelayTime13
  145. #define MXC_BUJIN_XC_Delay cDelayTime14
  146. #define MXC_cGouZhenTime cDelayTime15
  147. #define MXC_cJiaoDaoDelay cDelayTime16
  148. //参数定义
  149. //8位变量
  150. #define MXC_DC_SingOneFlag cCharBuff1
  151. #define MXC_XZ_SingOneFlag cCharBuff2
  152. #define MXC_STOP_IN_FLAG cCharBuff3
  153. #define MXC_STOP_IN_FLAG_OLD cCharBuff4
  154. #define MXC_STOP_FILTER cCharBuff5
  155. #define MXC_cLFengTimer cCharBuff6
  156. #define MXC_cRFengTimer cCharBuff7
  157. #define MXC_DC_Single_Stop cCharBuff8 //周期停止按钮置一,做完该条停止
  158. #define MXC_XZ_Single_Stop cCharBuff9
  159. #define MXC_Zipper_cnt cCharBuff10
  160. #define cCheckLengthOk cCharBuff11
  161. #define cSeBiaoOk cCharBuff12
  162. #define cSeBiaoEn cCharBuff13
  163. //16位变量
  164. #define MXC_DC_SongDai_Delay cUShort16Buff1
  165. #define MXC_MOTOR_DATA_Num cUShort16Buff2
  166. #define MXC_ENCODE_DATA_Num cUShort16Buff3
  167. #define MXC_ENCODE_FENZHEN_Lenth cUShort16Buff4
  168. #define MXC_DC_cycle_time cUShort16Buff5
  169. #define MXC_XZ_cycle_time cUShort16Buff6
  170. #define MXC_DC_Encode_fz_change cUShort16Buff7
  171. //32位无符号变量
  172. #define MXC_CRUKONGWEILENGTH cUDword32Buff1
  173. #define MXC_SaveLength cUDword32Buff2
  174. #define MXC_ENcode_Cul cUDword32Buff3
  175. #define MXC_DC_Encode_fz_cal cUDword32Buff4
  176. #define zipper_length_buff cUDword32Buff5
  177. #define MXC_SB_SaveLength cUDword32Buff6
  178. #define MXC_SB_ENCODE_MIN cUDword32Buff7
  179. #define MCX_SB_ENCODE_END cUDword32Buff8
  180. //32位有符号变量
  181. #define dwEnRealPos cDword32Buff1
  182. #define MCX_XPOS_BUFF cDword32Buff2
  183. #define MCX_SB_EN_LENGTH1 cDword32Buff3
  184. #define MCX_SB_EN_LENGTH2 cDword32Buff4
  185. //输入
  186. #define MXC_START_IN M0384//X01 启动
  187. #define MXC_START_IN_UP (M0384 && !OLDM384)
  188. #define MXC_STOP_IN M0385//X02 停止
  189. #define MXC_STOP_IN_UP (M0385 && !OLDM385)
  190. #define MXC_ManXiaChong_UP (M0386 && !OLDM386)// (X02 && !OLDX02)手动下冲
  191. #define MXC_GouZhen_IN M0387//X03 钩针到位感应
  192. #define MXC_GouZhen_IN_UP (M0387 && !OLDM387)
  193. #define MXC_JianSu_IN M0388//X04 减速信号
  194. #define MXC_JianSu_IN_DW (!M0388 && OLDM388)
  195. #define MXC_KaDai_IN M0389//X05 卡带信号
  196. #define MXC_KaDai_IN_UP (M0389 && !OLDM389)
  197. #define MXC_LeftFenZhen_Origin_IN M0390//X06 左分针原位
  198. #define MXC_LeftFenZhen_IN M0391 //X07 左分针到位
  199. #define MXC_XiaChong_IN M0392//X10 下冲原位
  200. #define MXC_XiaChong_IN_UP (M0392 && !OLDM392)//(X5 && !OLDX5)
  201. #define MXC_XiaChong_IN_DW (!M0392 && OLDM392)//(X5 && !OLDX5)
  202. #define MXC_RightFenZhen_Origin_IN M0393//X11 右分针原位
  203. #define MXC_RighttFenZhen_IN M0394//X12 右分针到位
  204. #define MXC_SongDai_IN M0395//X13 送带到位感应
  205. #define MXC_Zipper_IN M0396//X14 有链信号
  206. #define MXC_SeBiao_IN M0400//X20
  207. //输出IO
  208. #define MXC_GouZhen_VAVLE M0304//Y00 钩针
  209. #define MXC_XiaChong_MOTOR M0305//Y01 下冲电机
  210. #define MXC_DingDao_BaoHu_VAVLE M0306//Y02 顶刀保护
  211. #define MXC_ChuiQi_VAVLE M0307//Y03 定寸吹气
  212. #define MXC_LeftFenZhen_VAVLE M0308//Y04 左分针阀
  213. #define MXC_ALARM_OUT M0309//Y05 报警
  214. #define MXC_SongDai_MOTOR M0310//Y06 送带
  215. #define MXC_RightFenZhen_VAVLE M0311//Y07 右分针
  216. #define MXC_XC_ShaChe M0312//Y10 下冲电机刹车
  217. #define MXC_SeBiao_JiaoDao M0313//Y11 色标教导
  218. #define MXC_Clear_Servo_Pos M0314//Y12 伺服位置偏差
  219. #define MXC_DC_bStart M0001
  220. #define MXC_bClear M0003
  221. #define MXC_bStop M0002
  222. #define MXC_DC_bStart_Single M0005 //单次
  223. #define MXC_bDingDao_Baohu M0006 //顶刀保护
  224. #define MXC_bChuiQi M0007 //吹气
  225. #define MXC_bDCTD_P M0008 //定寸拖带电机正转
  226. #define MXC_bLeftFenZhen M0009 //左分针
  227. #define MXC_bRightFenZhen M0010 //右分针
  228. #define MXC_bChangeLength M0011 //长度改变
  229. #define MXC_bDotXiaChong M0012 //点动下冲
  230. #define MXC_bAddLength M0013 //加尺寸
  231. #define MXC_bDecLength M0014 //减尺寸
  232. #define MXC_DC_bAlarmStop M0015 //警告停止
  233. #define MXC_DC_bRunning M0016 //运行标志位
  234. #define MXC_bSongDai M0017 //送带
  235. #define MXC_PARAM_SongDai_Switch M0018 //送带开关
  236. #define MXC_bLowLenChange M0019 //慢速长度变化
  237. #define MXC_DATA_Clean M0020 //定寸数据清空
  238. #define MXC_bSetDCMode M0021 //设置定寸模式
  239. #define MXC_bSeBiaoJiaoDao M0022 //色标教导
  240. #define MXC_bXiaChong M0023 //下冲
  241. #define MXC_bGouZhen M0024 //钩针
  242. #define MXC_bXCDJ_P M0025 //下冲电机正转(调整)
  243. #define MXC_bSeBiao_Check M0026 //第一条色标确认窗口
  244. #define MXC_bSeBiao_CheckOK M0027 //第一条色标确认正常
  245. #define MXC_bSeBiao_CheckStop M0028 //第一条色标确认不正常
  246. #endif