Advertisement
Guest User

xk7130 basic hal file

a guest
May 11th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.99 KB | None | 0 0
  1. # Generated by PNCconf at Fri May 11 20:33:20 2018
  2. # If you make changes to this file, they will be
  3. # overwritten when you run PNCconf again
  4.  
  5. loadrt trivkins
  6. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  7. loadrt hostmot2
  8. loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=6 num_pwmgens=0 num_stepgens=5 sserial_port_0=00000x"
  9. setp hm2_7i92.0.watchdog.timeout_ns 5000000
  10. loadrt pid names=pid.x,pid.y,pid.z,pid.s
  11.  
  12. addf hm2_7i92.0.read servo-thread
  13. addf motion-command-handler servo-thread
  14. addf motion-controller servo-thread
  15. addf pid.x.do-pid-calcs servo-thread
  16. addf pid.y.do-pid-calcs servo-thread
  17. addf pid.z.do-pid-calcs servo-thread
  18. addf pid.s.do-pid-calcs servo-thread
  19. addf hm2_7i92.0.write servo-thread
  20.  
  21. # external output signals
  22.  
  23. # --- COOLANT-FLOOD ---
  24. net coolant-flood hm2_7i92.0.7i76.0.3.output-04
  25.  
  26. # --- X-ENABLE ---
  27. net x-enable hm2_7i92.0.7i76.0.3.output-12
  28.  
  29. # --- Y-ENABLE ---
  30. net y-enable hm2_7i92.0.7i76.0.3.output-13
  31.  
  32. # --- Z-ENABLE ---
  33. net z-enable hm2_7i92.0.7i76.0.3.output-14
  34.  
  35. # external input signals
  36.  
  37.  
  38. # --- ESTOP-EXT ---
  39. net estop-ext <= hm2_7i92.0.7i76.0.3.input-21
  40.  
  41. #*******************
  42. # AXIS X
  43. #*******************
  44.  
  45. setp pid.x.Pgain [AXIS_0]P
  46. setp pid.x.Igain [AXIS_0]I
  47. setp pid.x.Dgain [AXIS_0]D
  48. setp pid.x.bias [AXIS_0]BIAS
  49. setp pid.x.FF0 [AXIS_0]FF0
  50. setp pid.x.FF1 [AXIS_0]FF1
  51. setp pid.x.FF2 [AXIS_0]FF2
  52. setp pid.x.deadband [AXIS_0]DEADBAND
  53. setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT
  54. setp pid.x.error-previous-target true
  55. setp pid.x.maxerror .0005
  56.  
  57. net x-index-enable <=> pid.x.index-enable
  58. net x-enable => pid.x.enable
  59. net x-pos-cmd => pid.x.command
  60. net x-vel-cmd => pid.x.command-deriv
  61. net x-pos-fb => pid.x.feedback
  62. net x-output => pid.x.output
  63.  
  64. # Step Gen signals/setup
  65.  
  66. setp hm2_7i92.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
  67. setp hm2_7i92.0.stepgen.00.dirhold [AXIS_0]DIRHOLD
  68. setp hm2_7i92.0.stepgen.00.steplen [AXIS_0]STEPLEN
  69. setp hm2_7i92.0.stepgen.00.stepspace [AXIS_0]STEPSPACE
  70. setp hm2_7i92.0.stepgen.00.position-scale [AXIS_0]STEP_SCALE
  71. setp hm2_7i92.0.stepgen.00.step_type 0
  72. setp hm2_7i92.0.stepgen.00.control-type 1
  73. setp hm2_7i92.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL
  74. setp hm2_7i92.0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAXVEL
  75.  
  76. # ---closedloop stepper signals---
  77.  
  78. net x-pos-cmd <= axis.0.motor-pos-cmd
  79. net x-vel-cmd <= axis.0.joint-vel-cmd
  80. net x-output <= hm2_7i92.0.stepgen.00.velocity-cmd
  81. net x-pos-fb <= hm2_7i92.0.stepgen.00.position-fb
  82. net x-pos-fb => axis.0.motor-pos-fb
  83. net x-enable <= axis.0.amp-enable-out
  84. net x-enable => hm2_7i92.0.stepgen.00.enable
  85.  
  86. # ---Encoder feedback signals/setup---
  87.  
  88. setp hm2_7i92.0.encoder.01.counter-mode 0
  89. setp hm2_7i92.0.encoder.01.filter 1
  90. setp hm2_7i92.0.encoder.01.index-invert 0
  91. setp hm2_7i92.0.encoder.01.index-mask 0
  92. setp hm2_7i92.0.encoder.01.index-mask-invert 0
  93. setp hm2_7i92.0.encoder.01.scale [AXIS_0]ENCODER_SCALE
  94.  
  95. net x-pos-fb <= hm2_7i92.0.encoder.01.position
  96. net x-vel-fb <= hm2_7i92.0.encoder.01.velocity
  97. net x-pos-fb => axis.0.motor-pos-fb
  98. net x-index-enable axis.0.index-enable <=> hm2_7i92.0.encoder.01.index-enable
  99. net x-pos-rawcounts <= hm2_7i92.0.encoder.01.rawcounts
  100.  
  101. # ---setup home / limit switch signals---
  102.  
  103. net x-home-sw => axis.0.home-sw-in
  104. net x-neg-limit => axis.0.neg-lim-sw-in
  105. net x-pos-limit => axis.0.pos-lim-sw-in
  106.  
  107. #*******************
  108. # AXIS Y
  109. #*******************
  110.  
  111. setp pid.y.Pgain [AXIS_1]P
  112. setp pid.y.Igain [AXIS_1]I
  113. setp pid.y.Dgain [AXIS_1]D
  114. setp pid.y.bias [AXIS_1]BIAS
  115. setp pid.y.FF0 [AXIS_1]FF0
  116. setp pid.y.FF1 [AXIS_1]FF1
  117. setp pid.y.FF2 [AXIS_1]FF2
  118. setp pid.y.deadband [AXIS_1]DEADBAND
  119. setp pid.y.maxoutput [AXIS_1]MAX_OUTPUT
  120. setp pid.y.error-previous-target true
  121. setp pid.y.maxerror .0005
  122.  
  123. net y-index-enable <=> pid.y.index-enable
  124. net y-enable => pid.y.enable
  125. net y-pos-cmd => pid.y.command
  126. net y-vel-cmd => pid.y.command-deriv
  127. net y-pos-fb => pid.y.feedback
  128. net y-output => pid.y.output
  129.  
  130. # Step Gen signals/setup
  131.  
  132. setp hm2_7i92.0.stepgen.01.dirsetup [AXIS_1]DIRSETUP
  133. setp hm2_7i92.0.stepgen.01.dirhold [AXIS_1]DIRHOLD
  134. setp hm2_7i92.0.stepgen.01.steplen [AXIS_1]STEPLEN
  135. setp hm2_7i92.0.stepgen.01.stepspace [AXIS_1]STEPSPACE
  136. setp hm2_7i92.0.stepgen.01.position-scale [AXIS_1]STEP_SCALE
  137. setp hm2_7i92.0.stepgen.01.step_type 0
  138. setp hm2_7i92.0.stepgen.01.control-type 1
  139. setp hm2_7i92.0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL
  140. setp hm2_7i92.0.stepgen.01.maxvel [AXIS_1]STEPGEN_MAXVEL
  141.  
  142. # ---closedloop stepper signals---
  143.  
  144. net y-pos-cmd <= axis.1.motor-pos-cmd
  145. net y-vel-cmd <= axis.1.joint-vel-cmd
  146. net y-output <= hm2_7i92.0.stepgen.01.velocity-cmd
  147. net y-pos-fb <= hm2_7i92.0.stepgen.01.position-fb
  148. net y-pos-fb => axis.1.motor-pos-fb
  149. net y-enable <= axis.1.amp-enable-out
  150. net y-enable => hm2_7i92.0.stepgen.01.enable
  151.  
  152. # ---Encoder feedback signals/setup---
  153.  
  154. setp hm2_7i92.0.encoder.02.counter-mode 0
  155. setp hm2_7i92.0.encoder.02.filter 1
  156. setp hm2_7i92.0.encoder.02.index-invert 0
  157. setp hm2_7i92.0.encoder.02.index-mask 0
  158. setp hm2_7i92.0.encoder.02.index-mask-invert 0
  159. setp hm2_7i92.0.encoder.02.scale [AXIS_1]ENCODER_SCALE
  160.  
  161. net y-pos-fb <= hm2_7i92.0.encoder.02.position
  162. net y-vel-fb <= hm2_7i92.0.encoder.02.velocity
  163. net y-pos-fb => axis.1.motor-pos-fb
  164. net y-index-enable axis.1.index-enable <=> hm2_7i92.0.encoder.02.index-enable
  165. net y-pos-rawcounts <= hm2_7i92.0.encoder.02.rawcounts
  166.  
  167. # ---setup home / limit switch signals---
  168.  
  169. net y-home-sw => axis.1.home-sw-in
  170. net y-neg-limit => axis.1.neg-lim-sw-in
  171. net y-pos-limit => axis.1.pos-lim-sw-in
  172.  
  173. #*******************
  174. # AXIS Z
  175. #*******************
  176.  
  177. setp pid.z.Pgain [AXIS_2]P
  178. setp pid.z.Igain [AXIS_2]I
  179. setp pid.z.Dgain [AXIS_2]D
  180. setp pid.z.bias [AXIS_2]BIAS
  181. setp pid.z.FF0 [AXIS_2]FF0
  182. setp pid.z.FF1 [AXIS_2]FF1
  183. setp pid.z.FF2 [AXIS_2]FF2
  184. setp pid.z.deadband [AXIS_2]DEADBAND
  185. setp pid.z.maxoutput [AXIS_2]MAX_OUTPUT
  186. setp pid.z.error-previous-target true
  187. setp pid.z.maxerror .0005
  188.  
  189. net z-index-enable <=> pid.z.index-enable
  190. net z-enable => pid.z.enable
  191. net z-pos-cmd => pid.z.command
  192. net z-vel-cmd => pid.z.command-deriv
  193. net z-pos-fb => pid.z.feedback
  194. net z-output => pid.z.output
  195.  
  196. # Step Gen signals/setup
  197.  
  198. setp hm2_7i92.0.stepgen.02.dirsetup [AXIS_2]DIRSETUP
  199. setp hm2_7i92.0.stepgen.02.dirhold [AXIS_2]DIRHOLD
  200. setp hm2_7i92.0.stepgen.02.steplen [AXIS_2]STEPLEN
  201. setp hm2_7i92.0.stepgen.02.stepspace [AXIS_2]STEPSPACE
  202. setp hm2_7i92.0.stepgen.02.position-scale [AXIS_2]STEP_SCALE
  203. setp hm2_7i92.0.stepgen.02.step_type 0
  204. setp hm2_7i92.0.stepgen.02.control-type 1
  205. setp hm2_7i92.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL
  206. setp hm2_7i92.0.stepgen.02.maxvel [AXIS_2]STEPGEN_MAXVEL
  207.  
  208. # ---closedloop stepper signals---
  209.  
  210. net z-pos-cmd <= axis.2.motor-pos-cmd
  211. net z-vel-cmd <= axis.2.joint-vel-cmd
  212. net z-output <= hm2_7i92.0.stepgen.02.velocity-cmd
  213. net z-pos-fb <= hm2_7i92.0.stepgen.02.position-fb
  214. net z-pos-fb => axis.2.motor-pos-fb
  215. net z-enable <= axis.2.amp-enable-out
  216. net z-enable => hm2_7i92.0.stepgen.02.enable
  217.  
  218. # ---Encoder feedback signals/setup---
  219.  
  220. setp hm2_7i92.0.encoder.03.counter-mode 0
  221. setp hm2_7i92.0.encoder.03.filter 1
  222. setp hm2_7i92.0.encoder.03.index-invert 0
  223. setp hm2_7i92.0.encoder.03.index-mask 0
  224. setp hm2_7i92.0.encoder.03.index-mask-invert 0
  225. setp hm2_7i92.0.encoder.03.scale [AXIS_2]ENCODER_SCALE
  226.  
  227. net z-pos-fb <= hm2_7i92.0.encoder.03.position
  228. net z-vel-fb <= hm2_7i92.0.encoder.03.velocity
  229. net z-pos-fb => axis.2.motor-pos-fb
  230. net z-index-enable axis.2.index-enable <=> hm2_7i92.0.encoder.03.index-enable
  231. net z-pos-rawcounts <= hm2_7i92.0.encoder.03.rawcounts
  232.  
  233. # ---setup home / limit switch signals---
  234.  
  235. net z-home-sw => axis.2.home-sw-in
  236. net z-neg-limit => axis.2.neg-lim-sw-in
  237. net z-pos-limit => axis.2.pos-lim-sw-in
  238.  
  239. #*******************
  240. # SPINDLE S
  241. #*******************
  242.  
  243. setp pid.s.Pgain [SPINDLE_9]P
  244. setp pid.s.Igain [SPINDLE_9]I
  245. setp pid.s.Dgain [SPINDLE_9]D
  246. setp pid.s.bias [SPINDLE_9]BIAS
  247. setp pid.s.FF0 [SPINDLE_9]FF0
  248. setp pid.s.FF1 [SPINDLE_9]FF1
  249. setp pid.s.FF2 [SPINDLE_9]FF2
  250. setp pid.s.deadband [SPINDLE_9]DEADBAND
  251. setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
  252. setp pid.s.error-previous-target true
  253.  
  254. net spindle-index-enable <=> pid.s.index-enable
  255. net spindle-enable => pid.s.enable
  256. net spindle-vel-cmd-rpm => pid.s.command
  257. net spindle-vel-fb-rpm => pid.s.feedback
  258. net spindle-output <= pid.s.output
  259.  
  260. # ---PWM Generator signals/setup---
  261.  
  262. setp hm2_7i92.0.7i77.0.1.analogout0-scalemax [SPINDLE_9]OUTPUT_SCALE
  263. setp hm2_7i92.0.7i77.0.1.analogout0-minlim [SPINDLE_9]OUTPUT_MIN_LIMIT
  264. setp hm2_7i92.0.7i77.0.1.analogout0-maxlim [SPINDLE_9]OUTPUT_MAX_LIMIT
  265.  
  266. net spindle-output => hm2_7i92.0.7i77.0.1.analogout0
  267.  
  268. # ---Encoder feedback signals/setup---
  269.  
  270. setp hm2_7i92.0.encoder.00.counter-mode 0
  271. setp hm2_7i92.0.encoder.00.filter 1
  272. setp hm2_7i92.0.encoder.00.index-invert 0
  273. setp hm2_7i92.0.encoder.00.index-mask 0
  274. setp hm2_7i92.0.encoder.00.index-mask-invert 0
  275. setp hm2_7i92.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE
  276.  
  277. net spindle-revs <= hm2_7i92.0.encoder.00.position
  278. net spindle-vel-fb-rps <= hm2_7i92.0.encoder.00.velocity
  279. net spindle-index-enable <=> hm2_7i92.0.encoder.00.index-enable
  280.  
  281. # ---setup spindle control signals---
  282.  
  283. net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
  284. net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
  285. net spindle-vel-cmd-rpm <= motion.spindle-speed-out
  286. net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
  287. net spindle-enable <= motion.spindle-on
  288. net spindle-cw <= motion.spindle-forward
  289. net spindle-ccw <= motion.spindle-reverse
  290. net spindle-brake <= motion.spindle-brake
  291. net spindle-revs => motion.spindle-revs
  292. net spindle-at-speed => motion.spindle-at-speed
  293. net spindle-vel-fb-rps => motion.spindle-speed-in
  294. net spindle-index-enable <=> motion.spindle-index-enable
  295.  
  296. # ---Setup spindle at speed signals---
  297.  
  298. sets spindle-at-speed true
  299.  
  300.  
  301. #******************************
  302. # connect miscellaneous signals
  303. #******************************
  304.  
  305. # ---HALUI signals---
  306.  
  307. net joint-select-a halui.joint.0.select
  308. net x-is-homed halui.joint.0.is-homed
  309. net jog-x-pos halui.jog.0.plus
  310. net jog-x-neg halui.jog.0.minus
  311. net jog-x-analog halui.jog.0.analog
  312. net joint-select-b halui.joint.1.select
  313. net y-is-homed halui.joint.1.is-homed
  314. net jog-y-pos halui.jog.1.plus
  315. net jog-y-neg halui.jog.1.minus
  316. net jog-y-analog halui.jog.1.analog
  317. net joint-select-c halui.joint.2.select
  318. net z-is-homed halui.joint.2.is-homed
  319. net jog-z-pos halui.jog.2.plus
  320. net jog-z-neg halui.jog.2.minus
  321. net jog-z-analog halui.jog.2.analog
  322. net jog-selected-pos halui.jog.selected.plus
  323. net jog-selected-neg halui.jog.selected.minus
  324. net spindle-manual-cw halui.spindle.forward
  325. net spindle-manual-ccw halui.spindle.reverse
  326. net spindle-manual-stop halui.spindle.stop
  327. net machine-is-on halui.machine.is-on
  328. net jog-speed halui.jog-speed
  329. net MDI-mode halui.mode.is-mdi
  330.  
  331. # ---coolant signals---
  332.  
  333. net coolant-mist <= iocontrol.0.coolant-mist
  334. net coolant-flood <= iocontrol.0.coolant-flood
  335.  
  336. # ---probe signal---
  337.  
  338. net probe-in => motion.probe-input
  339.  
  340. # ---motion control signals---
  341.  
  342. net in-position <= motion.in-position
  343. net machine-is-enabled <= motion.motion-enabled
  344.  
  345. # ---digital in / out signals---
  346.  
  347. # ---estop signals---
  348.  
  349. net estop-out <= iocontrol.0.user-enable-out
  350. net estop-ext => iocontrol.0.emc-enable-in
  351.  
  352. # ---manual tool change signals---
  353.  
  354. loadusr -W hal_manualtoolchange
  355. net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change
  356. net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
  357. net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
  358. net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement