Advertisement
Guest User

Untitled

a guest
Jul 18th, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.53 KB | None | 0 0
  1. # ###################################
  2. # Core EMC/HAL Loads
  3. # ###################################
  4.  
  5. loadrt gentrivkins coordinates=XYZY
  6.  
  7. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  8. loadrt hostmot2
  9. loadrt hm2_pci config="num_stepgens=5 num_encoders=2 num_pwmgens=1"
  10. #loadrt thcud
  11. loadrt thc
  12. loadrt debounce cfg=5
  13.  
  14.  
  15.  
  16. # ################################################
  17. # THREADS
  18. # ################################################
  19.  
  20. addf hm2_5i25.0.read servo-thread
  21. addf motion-command-handler servo-thread
  22. addf motion-controller servo-thread
  23. # revel in the free time here from not having to run PID
  24. addf hm2_5i25.0.write servo-thread
  25. addf hm2_5i25.0.pet_watchdog servo-thread
  26. #addf thcud servo-thread
  27. addf thc servo-thread
  28. addf debounce.0 servo-thread
  29.  
  30.  
  31. #####################
  32. # THC pinouts
  33. #####################
  34.  
  35. net arc-ok <= hm2_5i25.0.gpio.029.in_not # P3-11
  36.  
  37. setp hm2_5i25.0.gpio.000.is_output TRUE
  38.  
  39. # thcad encoder is 13, 14, 15
  40.  
  41. #net arc-ok => thcud.arc-ok
  42. #net thc-up => thcud.torch-up
  43. #net thc-down => thcud.torch-down
  44.  
  45. net torch-on <= motion.spindle-on
  46.  
  47. net torch-on => hm2_5i25.0.gpio.033.out # P3-17
  48. setp hm2_5i25.0.gpio.033.is_output TRUE
  49. setp hm2_5i25.0.gpio.033.invert_output TRUE
  50. net torch-on => thc.torch-on
  51. net arc-ok => thc.arc-ok
  52.  
  53. net thc-cur-vel thc.current-vel <= motion.current-vel
  54. net thc-req-vel thc.requested-vel <= motion.requested-vel
  55.  
  56. # I can interact with arc-ok signal using M66 P0
  57. net arc-ok => motion.digital-in-00
  58.  
  59. net torch-probe-in debounce.0.4.in <= hm2_5i25.0.gpio.023.in_not
  60. net torch-probe-out debounce.0.4.out => motion.probe-input
  61.  
  62. # thcad velocity 119k at 0V
  63. # 5V 540k
  64. # 421k per 5V = 84.2k/V
  65. setp hm2_5i25.0.encoder.01.counter-mode 1
  66. setp thc.scale-offset 119000
  67. setp thc.vel-scale 0.00059382425
  68. setp thc.correction-vel 0.00005
  69. net thc-vel-in hm2_5i25.0.encoder.01.velocity => thc.encoder-vel
  70.  
  71. # ######################################################
  72. # Axis-of-motion Specific Configs (not the GUI)
  73. # ######################################################
  74.  
  75.  
  76.  
  77. setp debounce.0.delay 4
  78.  
  79. # ################
  80. # X [0] Axis
  81. # ################
  82.  
  83. # axis enable chain
  84. newsig emcmot.00.enable bit
  85. sets emcmot.00.enable FALSE
  86.  
  87. net x-home-dbin debounce.0.0.in <= hm2_5i25.0.gpio.017.in
  88. net x-home-dbout debounce.0.0.out => joint.0.home-sw-in
  89. #net x-lim joint.0.neg-lim-sw-in <= hm2_5i25.0.gpio.032.in
  90. #net x-lim joint.0.pos-lim-sw-in <= hm2_5i25.0.gpio.032.in
  91.  
  92. net emcmot.00.enable <= joint.0.amp-enable-out
  93. net emcmot.00.enable => hm2_5i25.0.stepgen.00.enable
  94.  
  95.  
  96. # position command and feedback
  97. net emcmot.00.pos-cmd <= joint.0.motor-pos-cmd
  98. net emcmot.00.pos-cmd => hm2_5i25.0.stepgen.00.position-cmd
  99.  
  100. net motor.00.pos-fb <= hm2_5i25.0.stepgen.00.position-fb
  101. net motor.00.pos-fb => joint.0.motor-pos-fb
  102.  
  103.  
  104. # timing parameters
  105. setp hm2_5i25.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
  106. setp hm2_5i25.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
  107. setp hm2_5i25.0.stepgen.00.steplen [JOINT_0]STEPLEN
  108. setp hm2_5i25.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
  109.  
  110. setp hm2_5i25.0.stepgen.00.position-scale [JOINT_0]SCALE
  111. setp hm2_5i25.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAX_VEL
  112. setp hm2_5i25.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAX_ACC
  113. setp hm2_5i25.0.stepgen.00.step_type 0
  114.  
  115.  
  116. # ################
  117. # Y [1] Axis
  118. # ################
  119.  
  120. # axis enable chain
  121. newsig emcmot.01.enable bit
  122. sets emcmot.01.enable FALSE
  123.  
  124. net emcmot.01.enable <= joint.1.amp-enable-out
  125. net emcmot.01.enable => hm2_5i25.0.stepgen.01.enable
  126.  
  127. #net y1-max-limit debounce.1.1.in <= hm2_5i25.0.gpio.
  128. net y1-home-dbin debounce.0.1.in <= hm2_5i25.0.gpio.018.in
  129. net y1-home-dbout debounce.0.1.out => joint.1.home-sw-in
  130.  
  131. # position command and feedback
  132. net emcmot.01.pos-cmd <= joint.1.motor-pos-cmd
  133. net emcmot.01.pos-cmd => hm2_5i25.0.stepgen.01.position-cmd
  134.  
  135. net motor.01.pos-fb <= hm2_5i25.0.stepgen.01.position-fb
  136. net motor.01.pos-fb => joint.1.motor-pos-fb
  137.  
  138.  
  139. # Y axis timing parameters
  140. setp hm2_5i25.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
  141. setp hm2_5i25.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
  142. setp hm2_5i25.0.stepgen.01.steplen [JOINT_1]STEPLEN
  143. setp hm2_5i25.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
  144.  
  145. setp hm2_5i25.0.stepgen.01.position-scale [JOINT_1]SCALE
  146. setp hm2_5i25.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAX_VEL
  147. setp hm2_5i25.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAX_ACC
  148. setp hm2_5i25.0.stepgen.01.step_type 0
  149.  
  150. # ################
  151. # Y [3] Axis
  152. # ################
  153.  
  154. # axis enable chain
  155. newsig emcmot.03.enable bit
  156. sets emcmot.03.enable FALSE
  157.  
  158. net emcmot.03.enable <= joint.3.amp-enable-out
  159. net emcmot.03.enable => hm2_5i25.0.stepgen.03.enable
  160.  
  161. net y2-max-limit hm2_5i25.0.gpio.027.in
  162. net y2-home-dbin debounce.0.3.in <= hm2_5i25.0.gpio.025.in
  163. net y2-home-dbout debounce.0.3.out => joint.3.home-sw-in
  164.  
  165. # position command and feedback
  166. net emcmot.03.pos-cmd <= joint.3.motor-pos-cmd
  167. net emcmot.03.pos-cmd => hm2_5i25.0.stepgen.03.position-cmd
  168.  
  169. net motor.03.pos-fb <= hm2_5i25.0.stepgen.03.position-fb
  170. net motor.03.pos-fb => joint.3.motor-pos-fb
  171.  
  172.  
  173. # Y axis timing parameters
  174. setp hm2_5i25.0.stepgen.03.dirsetup [JOINT_3]DIRSETUP
  175. setp hm2_5i25.0.stepgen.03.dirhold [JOINT_3]DIRHOLD
  176. setp hm2_5i25.0.stepgen.03.steplen [JOINT_3]STEPLEN
  177. setp hm2_5i25.0.stepgen.03.stepspace [JOINT_3]STEPSPACE
  178.  
  179. setp hm2_5i25.0.stepgen.03.position-scale [JOINT_3]SCALE
  180. setp hm2_5i25.0.stepgen.03.maxvel [JOINT_3]STEPGEN_MAX_VEL
  181. setp hm2_5i25.0.stepgen.03.maxaccel [JOINT_3]STEPGEN_MAX_ACC
  182. setp hm2_5i25.0.stepgen.03.step_type 0
  183.  
  184. # ################
  185. # Z [2] Axis
  186. # ################
  187.  
  188. # axis enable chain
  189. newsig emcmot.02.enable bit
  190. sets emcmot.02.enable FALSE
  191.  
  192. net emcmot.02.enable <= joint.2.amp-enable-out
  193. net emcmot.02.enable => hm2_5i25.0.stepgen.02.enable
  194.  
  195. net z-home-dbin debounce.0.2.in <= hm2_5i25.0.gpio.019.in
  196. net z-home-dbout debounce.0.2.out => joint.2.home-sw-in
  197. #net z-max-lim joint.2.pos-lim-sw-in <= hm2_5i25.0.gpio.032.in
  198.  
  199.  
  200. # position command and feedback
  201. #net zpos-cmd thcud.z-pos-in <= joint.2.motor-pos-cmd
  202. #net thc-zpos-cmd hm2_5i25.0.stepgen.02.position-cmd <= thcud.z-pos-out
  203. #net thc-zpos-cmd hm2_5i25.0.stepgen.02.position-cmd <= joint.2.motor-pos-cmd
  204.  
  205. net emcmot.02.pos-cmd thc.z-pos-in <= joint.2.motor-pos-cmd
  206. net thc-pos-cmd thc.z-pos-out => hm2_5i25.0.stepgen.02.position-cmd
  207. net motor.02.pos-fb joint.2.motor-pos-fb <= thc.z-fb-out
  208.  
  209. #net thcud-cur-vel motion.current-vel => thcud.current-vel
  210. ##net thcud-req-vel motion.requested-vel => thcud.requested-vel
  211.  
  212. #setp thcud.velocity-tol 0.05
  213. #setp thcud.correction-vel 0.0001
  214. #setp thcud.requested-vel 40
  215.  
  216. # timing parameters
  217. setp hm2_5i25.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP
  218. setp hm2_5i25.0.stepgen.02.dirhold [JOINT_2]DIRHOLD
  219. setp hm2_5i25.0.stepgen.02.steplen [JOINT_2]STEPLEN
  220. setp hm2_5i25.0.stepgen.02.stepspace [JOINT_2]STEPSPACE
  221.  
  222. setp hm2_5i25.0.stepgen.02.position-scale [JOINT_2]SCALE
  223. setp hm2_5i25.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAX_VEL
  224. setp hm2_5i25.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAX_ACC
  225. setp hm2_5i25.0.stepgen.02.step_type 0
  226.  
  227.  
  228.  
  229. # ################
  230. # G540 Charge pump
  231. # ################
  232.  
  233. setp hm2_5i25.0.stepgen.04.dirsetup 100
  234. setp hm2_5i25.0.stepgen.04.dirhold 100
  235. setp hm2_5i25.0.stepgen.04.steplen 100
  236. setp hm2_5i25.0.stepgen.04.stepspace 100
  237. setp hm2_5i25.0.stepgen.04.position-scale 10000
  238. setp hm2_5i25.0.stepgen.04.maxvel 0
  239. setp hm2_5i25.0.stepgen.04.maxaccel 0
  240.  
  241. # quadrature step mode for square wave out
  242. setp hm2_5i25.0.stepgen.04.step_type 2
  243. # velocity mode
  244. setp hm2_5i25.0.stepgen.04.control-type 1
  245. # velocity command of 0.25 is 10KHz when scale is 10000 in quadrature mode
  246. setp hm2_5i25.0.stepgen.04.velocity-cmd 0.25
  247. # enable charge pump with emcmot.00.enable
  248. net emcmot.00.enable => hm2_5i25.0.stepgen.04.enable
  249.  
  250.  
  251. # ##################################################
  252. # Standard I/O Block - EStop, Etc
  253. # ##################################################
  254.  
  255. # create a signal for the estop loopback
  256. net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  257.  
  258. # create signals for tool loading loopback
  259. net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  260. net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement