GLAction.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. #include "global.h"
  2. #include "Action.h"
  3. #if CHANG_SHENG_GEI_LI_MACHINE == 1
  4. extern unsigned char AllRunFlg;
  5. //初始化动作
  6. void GL_Mechine_InitAction(void)
  7. {
  8. switch (cMachineType)
  9. {
  10. case JIAO_YA_DIN_CUN:
  11. break;
  12. case CHU_CHI_JI:
  13. break;
  14. case JIAO_YA_CHU_CHI:
  15. {
  16. JYDC_InitAction();
  17. CCJ_InitAction();
  18. }
  19. break;
  20. case QIE_DUAN_JI:
  21. break;
  22. case CHUAN_TOU_QIE_DUAN_JI: //双头切断穿头
  23. //QDCT_InitAction();
  24. break;
  25. case MXC_NILONG: //免修齿
  26. MXC_InitAction();
  27. break;
  28. case JIN_SHU_DIN_CUN:
  29. break;
  30. case CHUAN_TOU_JI:
  31. break;
  32. case JIN_SHU_KLSZ_JI:
  33. break;
  34. case HE_LIAN_JI:
  35. break;
  36. case TIE_BU_JI: //贴布机
  37. //TBJ_InitAction();
  38. break;
  39. case FANG_KUAI_CHA_XIAO_JI:
  40. break;
  41. case GONG_ZHI_MA:
  42. break;
  43. case QIE_DUAN_NEWSTR:
  44. //QueDuan_NewStr_InitAction();
  45. break;
  46. case CHUAN_TOU_QIE_DUAN_JI_DAN://单头切断机
  47. //QDCTD_InitAction();
  48. break;
  49. default:
  50. break;
  51. }
  52. }
  53. void GL_Mechine_Action(void)
  54. {
  55. switch (cMachineType)
  56. {
  57. case CHUAN_TOU_QIE_DUAN_JI: //穿头切断机
  58. QDCT_Action();
  59. break;
  60. case MXC_NILONG: //免修齿
  61. //MXC_NiLongXiuCiJiAction();
  62. break;
  63. case QIE_DUAN_NEWSTR:
  64. //QueDuan_NewStr_Action();
  65. break;
  66. case TIE_BU_JI: //贴布机
  67. //TBJ_Action();
  68. break;
  69. case JIAO_YA_CHU_CHI:
  70. {
  71. JYDC_Action();
  72. CCJ_Action();
  73. }
  74. break;
  75. case CHUAN_TOU_QIE_DUAN_JI_DAN://单头切断机
  76. //QDCTD_Action();
  77. break;
  78. default:
  79. break;
  80. }
  81. }
  82. void GL_Mechine_Config(void)
  83. {
  84. switch (cMachineType)
  85. {
  86. case CHUAN_TOU_QIE_DUAN_JI: //穿头切断机
  87. //外部中断相关配置
  88. USE_ENCODE = 0;
  89. USE_X30_EXTI = 0;
  90. USE_X31_EXTI = 1;
  91. USE_X20_EXTI = 0;
  92. USE_TIMER_X30_EXTI = 0;
  93. USE_TIMER_X31_EXTI = 0;
  94. EXTI_TIMER_FREQ = 40000;
  95. FILTER_P = 2;
  96. FILTER_N = 2;
  97. X30EXTI_DIR = 0;
  98. X31EXTI_DIR = 0;
  99. X20EXTI_DIR = 0;
  100. //是否使用扩展
  101. USE_EXTEND_INOUTPUT = 1;
  102. USE_EXTEND_ALARM = 0;
  103. //脉冲配置
  104. SET_PULSE_TYPE = X_AXIS_PULSE_Y_DIR;
  105. SET_XDIR_TYPE = PULSE_OUTPUT_TYPE;
  106. SET_XDIR_CH = 99; //设置方向类型为“不使用”时,方向通道设置不起作用
  107. SET_YDIR_TYPE = NO_USE_TYPE;
  108. SET_YDIR_CH = 99;
  109. break;
  110. case CHUAN_TOU_QIE_DUAN_JI_DAN:
  111. //外部中断相关配置
  112. USE_ENCODE = 0;
  113. USE_X30_EXTI = 0;
  114. USE_X31_EXTI = 1;
  115. USE_X20_EXTI = 0;
  116. USE_TIMER_X30_EXTI = 0;
  117. USE_TIMER_X31_EXTI = 0;
  118. EXTI_TIMER_FREQ = 40000;
  119. FILTER_P = 2;
  120. FILTER_N = 2;
  121. X30EXTI_DIR = 0;
  122. X31EXTI_DIR = 0;
  123. X20EXTI_DIR = 0;
  124. //是否使用扩展
  125. USE_EXTEND_INOUTPUT = 0;
  126. USE_EXTEND_ALARM = 0;
  127. //脉冲配置
  128. SET_PULSE_TYPE = X_AXIS_PULSE_Y_DIR;
  129. SET_XDIR_TYPE = PULSE_OUTPUT_TYPE;
  130. SET_XDIR_CH = 99; //设置方向类型为“不使用”时,方向通道设置不起作用
  131. SET_YDIR_TYPE = NO_USE_TYPE;
  132. SET_YDIR_CH = 99;
  133. break;
  134. case MXC_NILONG: //免修齿
  135. //外部中断相关配置
  136. USE_ENCODE = 0;
  137. USE_X30_EXTI = 0;
  138. USE_X31_EXTI = 1;
  139. USE_X20_EXTI = 0;
  140. USE_TIMER_X30_EXTI = 0;
  141. USE_TIMER_X31_EXTI = 0;
  142. EXTI_TIMER_FREQ = 40000;
  143. FILTER_P = 10;
  144. FILTER_N = 5;
  145. X30EXTI_DIR = 0;
  146. X31EXTI_DIR = 0;
  147. X20EXTI_DIR = 0;
  148. //是否使用扩展
  149. USE_EXTEND_INOUTPUT = 0;
  150. USE_EXTEND_ALARM = 0;
  151. //脉冲配置
  152. SET_PULSE_TYPE = XY_AXIS_PULSE;
  153. SET_XDIR_TYPE = NO_USE_TYPE;
  154. SET_XDIR_CH = 99; //设置方向类型为“不使用”时,方向通道设置不起作用
  155. SET_YDIR_TYPE = Y_OUTPUT_TYPE;
  156. SET_YDIR_CH = 13; //Y13作为方向
  157. break;
  158. case QIE_DUAN_NEWSTR: //切断机开闭一体
  159. USE_ENCODE = 0;
  160. USE_X30_EXTI = 0;
  161. USE_X31_EXTI = 0;
  162. USE_X20_EXTI = 0;
  163. USE_TIMER_X30_EXTI = 0;
  164. USE_TIMER_X31_EXTI = 0;
  165. EXTI_TIMER_FREQ = 40000;
  166. FILTER_P = 10;
  167. FILTER_N = 5;
  168. X30EXTI_DIR = 0;
  169. X31EXTI_DIR = 0;
  170. X20EXTI_DIR = 0;
  171. USE_EXTEND_INOUTPUT = 0;
  172. USE_EXTEND_ALARM = 0;
  173. SET_PULSE_TYPE = X_AXIS_PULSE_Y_DIR;
  174. SET_XDIR_TYPE = PULSE_OUTPUT_TYPE;
  175. SET_XDIR_CH = 99; //设置方向类型为“不使用”时,方向通道设置不起作用
  176. SET_YDIR_TYPE = NO_USE_TYPE;
  177. SET_YDIR_CH = 99;
  178. break;
  179. case TIE_BU_JI: //贴布机
  180. //外部中断相关配置
  181. USE_ENCODE = 0;
  182. USE_X30_EXTI = 0;
  183. USE_X31_EXTI = 0;
  184. USE_X20_EXTI = 0;
  185. USE_TIMER_X30_EXTI = 0;
  186. USE_TIMER_X31_EXTI = 0;
  187. EXTI_TIMER_FREQ = 40000;
  188. FILTER_P = 10;
  189. FILTER_N = 5;
  190. X30EXTI_DIR = 0;
  191. X31EXTI_DIR = 0;
  192. X20EXTI_DIR = 0;
  193. //是否使用扩展
  194. USE_EXTEND_INOUTPUT = 0;
  195. USE_EXTEND_ALARM = 0;
  196. //脉冲配置
  197. SET_PULSE_TYPE = X_AXIS_PULSE_Y_ON; //X轴脉冲,Y轴当使能
  198. SET_XDIR_TYPE = Y_OUTPUT_TYPE; //Y0当方向通道
  199. SET_XDIR_CH = 0; //Y0当方向通道
  200. SET_YDIR_TYPE = NO_USE_TYPE; //无Y轴电机,故不使用Y轴方向通道
  201. SET_YDIR_CH = 99; //Y13作为方向
  202. break;
  203. case JIAO_YA_CHU_CHI: //贴布机
  204. //外部中断相关配置
  205. USE_ENCODE = 0;
  206. USE_X30_EXTI = 1;
  207. USE_X31_EXTI = 0;
  208. USE_X20_EXTI = 1;
  209. USE_TIMER_X30_EXTI = 0;
  210. USE_TIMER_X31_EXTI = 0;
  211. EXTI_TIMER_FREQ = 40000;
  212. FILTER_P = 10;
  213. FILTER_N = 5;
  214. X30EXTI_DIR = 0;
  215. X31EXTI_DIR = 0;
  216. X20EXTI_DIR = 0;
  217. //是否使用扩展
  218. USE_EXTEND_INOUTPUT = 0;
  219. USE_EXTEND_ALARM = 0;
  220. //脉冲配置
  221. SET_PULSE_TYPE = XY_AXIS_PULSE; //X轴脉冲,Y轴当使能
  222. SET_XDIR_TYPE = NO_USE_TYPE; //Y0当方向通道
  223. SET_XDIR_CH = 99; //Y0当方向通道
  224. SET_YDIR_TYPE = NO_USE_TYPE; //无Y轴电机,故不使用Y轴方向通道
  225. SET_YDIR_CH = 99; //Y13作为方向
  226. break;
  227. default:
  228. SET_PULSE_TYPE = XY_AXIS_PULSE;
  229. break;
  230. }
  231. }
  232. #endif