Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2012
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.74 KB | None | 0 0
  1. # #######################################
  2. #
  3. # HAL file for HostMot2 with 3 servos
  4. #
  5. # Derived from Ted Hyde's original hm2-servo config
  6. #
  7. # Based up work and discussion with Seb & Peter & Jeff
  8. # GNU license references - insert here. www.linuxcnc.org
  9. #
  10. #
  11. # ########################################
  12. # Firmware files are in /lib/firmware/hm2/7i43/
  13. # Must symlink the hostmot2 firmware directory of sanbox to
  14. # /lib/firmware before running EMC2...
  15. # sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
  16. #
  17. # See also:
  18. # <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
  19. # and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
  20. #
  21. # #####################################################################
  22.  
  23.  
  24. # ###################################
  25. # Core EMC/HAL Loads
  26. # ###################################
  27.  
  28. # kinematics
  29. loadrt trivkins
  30.  
  31. # motion controller, get name and thread periods from ini file
  32. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  33.  
  34. # standard components
  35. loadrt pid num_chan=4 debug=1
  36. loadrt abs
  37.  
  38. # only the 7i43 needs this, but it doesnt hurt the others
  39. loadrt probe_parport
  40.  
  41. # hostmot2 driver
  42. # if you have any firmware trouble, enable the debug flags here and see what's going on in the syslog
  43. #loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 debug_pin_descriptors=1 debug_modules=1
  44. loadrt hostmot2
  45.  
  46. # load low-level driver
  47. loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
  48.  
  49. #gearshift module
  50. loadrt gearshift16
  51.  
  52.  
  53.  
  54. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.pwm_frequency 40000
  55.  
  56. setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000
  57.  
  58. setp hm2_[HOSTMOT2](BOARD).1.pwmgen.pwm_frequency 24000
  59.  
  60. setp hm2_[HOSTMOT2](BOARD).1.watchdog.timeout_ns 10000000
  61.  
  62.  
  63.  
  64.  
  65.  
  66. # This configuration uses classicladder for machine logic
  67. # (load the realtime portion)
  68. # these classicladder parameters need to be optimized after ladder completion
  69. loadrt classicladder_rt numRungs=24 numBits=30 numWords=4 numTimers=5 numMonostables=10 numPhysInputs=50 numPhysOutputs=30 numArithmExpr=30 numSections=10
  70. # We kick ladder into a thread at the slower servo rate rather than base rate
  71. addf classicladder.0.refresh servo-thread 1
  72.  
  73. # invoke the user part of CL to silently load the program
  74. # later we will need to add the clp file mentioned below
  75. # to the ini file so that we do not need to hardcode it here.
  76. loadusr -w classicladder --nogui demo_step_cl.clp
  77. # load the GUI aswell
  78. # loadusr classicladder
  79.  
  80.  
  81.  
  82. # ################################################
  83. # THREADS
  84. # ################################################
  85.  
  86. addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
  87. addf hm2_[HOSTMOT2](BOARD).1.read servo-thread
  88.  
  89. addf motion-command-handler servo-thread
  90. addf motion-controller servo-thread
  91.  
  92. addf pid.0.do-pid-calcs servo-thread
  93. addf pid.1.do-pid-calcs servo-thread
  94. addf pid.2.do-pid-calcs servo-thread
  95. addf pid.3.do-pid-calcs servo-thread
  96.  
  97. addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
  98. addf hm2_[HOSTMOT2](BOARD).1.write servo-thread
  99. addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
  100. addf hm2_[HOSTMOT2](BOARD).1.pet_watchdog servo-thread
  101. addf abs.0 servo-thread
  102. addf gearshift16.0 servo-thread
  103.  
  104. # ######################################################
  105. # Axis-of-motion Specific Configs (not the GUI)
  106. # ######################################################
  107.  
  108.  
  109. # ################
  110. # X [0] Axis
  111. # ################
  112.  
  113. # axis enable chain
  114. newsig emcmot.00.enable bit
  115. sets emcmot.00.enable FALSE
  116. net emcmot.00.enable => pid.0.enable
  117.  
  118. # remove when tuning loop today
  119. net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable
  120. # setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable true
  121.  
  122. net emcmot.00.enable <= axis.0.amp-enable-out
  123.  
  124. # encoder feedback
  125. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
  126. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
  127. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
  128. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
  129. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0
  130.  
  131.  
  132.  
  133. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
  134. net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position => pid.0.feedback
  135. net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI
  136.  
  137. # set PID loop gains from inifile
  138. setp pid.0.Pgain [AXIS_0]P
  139. setp pid.0.Igain [AXIS_0]I
  140. setp pid.0.Dgain [AXIS_0]D
  141. setp pid.0.bias [AXIS_0]BIAS
  142. setp pid.0.FF0 [AXIS_0]FF0
  143. setp pid.0.FF1 [AXIS_0]FF1
  144. setp pid.0.FF2 [AXIS_0]FF2
  145. setp pid.0.deadband [AXIS_0]DEADBAND
  146. setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
  147.  
  148. # position command signals
  149. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.output-type 1 #pwm on pin1, dir on pin2
  150. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
  151.  
  152. net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
  153.  
  154. # remove when tuning servo today
  155. net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value
  156.  
  157.  
  158. # ################
  159. # Y [1] Axis
  160. # ################
  161.  
  162. # axis enable chain
  163. newsig emcmot.01.enable bit
  164. sets emcmot.01.enable FALSE
  165. net emcmot.01.enable => pid.1.enable
  166.  
  167. #today1
  168. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable true
  169. net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
  170. net emcmot.01.enable hm2_[HOSTMOT2](BOARD).1.gpio.058.out
  171. net emcmot.01.enable <= axis.1.amp-enable-out
  172.  
  173.  
  174. # encoder feedback
  175. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
  176. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
  177. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
  178. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 0
  179. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0
  180.  
  181. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.scale [AXIS_1]INPUT_SCALE
  182.  
  183. #today1
  184. net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.position => pid.1.feedback
  185. net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI
  186.  
  187. # set PID loop gains from inifile
  188. setp pid.1.Pgain [AXIS_1]P
  189. setp pid.1.Igain [AXIS_1]I
  190. setp pid.1.Dgain [AXIS_1]D
  191. setp pid.1.bias [AXIS_1]BIAS
  192. setp pid.1.FF0 [AXIS_1]FF0
  193. setp pid.1.FF1 [AXIS_1]FF1
  194. setp pid.1.FF2 [AXIS_1]FF2
  195. setp pid.1.deadband [AXIS_1]DEADBAND
  196. setp pid.1.maxoutput [AXIS_1]MAX_OUTPUT
  197.  
  198. # position command signals
  199. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.output-type 1 #pwm on pin1, dir on pin2
  200. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
  201.  
  202. net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
  203.  
  204. # today1
  205. net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value
  206.  
  207.  
  208. # ################
  209. # Z [2] Axis
  210. # ################
  211.  
  212. # axis enable chain
  213. newsig emcmot.02.enable bit
  214. sets emcmot.02.enable FALSE
  215. net emcmot.02.enable => pid.2.enable
  216. # again
  217. net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable
  218. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable true
  219.  
  220.  
  221.  
  222. net emcmot.02.enable <= axis.2.amp-enable-out
  223.  
  224. # encoder feedback
  225. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.counter-mode 0
  226. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.filter 1
  227. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-invert 0
  228. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask 0
  229. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask-invert 0
  230.  
  231. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.scale [AXIS_2]INPUT_SCALE
  232. net motor.02.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.02.position => pid.2.feedback
  233. net motor.02.pos-fb => axis.2.motor-pos-fb #push copy back to Axis GUI
  234.  
  235. # set PID loop gains from inifile
  236. setp pid.2.Pgain [AXIS_2]P
  237. setp pid.2.Igain [AXIS_2]I
  238. setp pid.2.Dgain [AXIS_2]D
  239. setp pid.2.bias [AXIS_2]BIAS
  240. setp pid.2.FF0 [AXIS_2]FF0
  241. setp pid.2.FF1 [AXIS_2]FF1
  242. setp pid.2.FF2 [AXIS_2]FF2
  243. setp pid.2.deadband [AXIS_2]DEADBAND
  244. setp pid.2.maxoutput [AXIS_2]MAX_OUTPUT
  245.  
  246. # position command signals
  247. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.output-type 1 #pwm on pin1, dir on pin2
  248. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.scale [AXIS_2]OUTPUT_SCALE
  249.  
  250. net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command
  251. # again
  252. net motor.02.command pid.2.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.value
  253.  
  254.  
  255.  
  256. # ################
  257. # B [4] Axis
  258. # ################
  259.  
  260. # axis enable chain
  261. newsig emcmot.04.enable bit
  262. sets emcmot.04.enable FALSE
  263. net emcmot.04.enable => pid.3.enable
  264. # again
  265. net emcmot.04.enable => hm2_[HOSTMOT2](BOARD).1.pwmgen.00.enable
  266.  
  267.  
  268.  
  269.  
  270. net emcmot.04.enable <= axis.4.amp-enable-out
  271.  
  272. # encoder feedback
  273. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.counter-mode 0
  274. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.filter 1
  275. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.index-invert 0
  276. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.index-mask 0
  277. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.index-mask-invert 0
  278.  
  279. setp hm2_[HOSTMOT2](BOARD).1.encoder.00.scale [AXIS_4]INPUT_SCALE
  280. net motor.04.pos-fb hm2_[HOSTMOT2](BOARD).1.encoder.00.position => pid.3.feedback
  281. net motor.04.pos-fb => axis.4.motor-pos-fb #push copy back to Axis GUI
  282.  
  283. # set PID loop gains from inifile
  284. setp pid.3.Pgain [AXIS_4]P
  285. setp pid.3.Igain [AXIS_4]I
  286. setp pid.3.Dgain [AXIS_4]D
  287. setp pid.3.bias [AXIS_4]BIAS
  288. setp pid.3.FF0 [AXIS_4]FF0
  289. setp pid.3.FF1 [AXIS_4]FF1
  290. setp pid.3.FF2 [AXIS_4]FF2
  291. setp pid.3.deadband [AXIS_4]DEADBAND
  292. setp pid.3.maxoutput [AXIS_4]MAX_OUTPUT
  293.  
  294. # position command signals
  295. setp hm2_[HOSTMOT2](BOARD).1.pwmgen.00.output-type 2 #pwm on pin1, pwm on pin2
  296. setp hm2_[HOSTMOT2](BOARD).1.pwmgen.00.scale [AXIS_4]OUTPUT_SCALE
  297.  
  298. net emcmot.04.pos-cmd axis.4.motor-pos-cmd => pid.3.command
  299. # again
  300. net motor.04.command pid.3.output => hm2_[HOSTMOT2](BOARD).1.pwmgen.00.value
  301.  
  302. # velocity feedback for pid
  303. net bvel pid.3.feedback-deriv hm2_5i20.1.encoder.00.velocity
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310. # ##################################################
  311. # Standard I/O Block - EStop, Etc
  312. # ##################################################
  313.  
  314. # create a signal for the estop loopback
  315. # net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  316.  
  317.  
  318.  
  319. # setp hm2_[HOSTMOT2](BOARD).1.gpio.060.is_output true
  320. # setp hm2_[HOSTMOT2](BOARD).1.gpio.060.is_opendrain true
  321. # setp hm2_[HOSTMOT2](BOARD).1.gpio.060.invert_output true
  322. # net estop-loop hm2_[HOSTMOT2](BOARD).1.gpio.060.out
  323.  
  324. setp hm2_[HOSTMOT2](BOARD).1.gpio.060.is_output true
  325. setp hm2_[HOSTMOT2](BOARD).1.gpio.060.is_opendrain true
  326. setp hm2_[HOSTMOT2](BOARD).1.gpio.060.invert_output true
  327. net estop-loop-out hm2_[HOSTMOT2](BOARD).1.gpio.060.out iocontrol.0.user-enable-out classicladder.0.in-02
  328.  
  329. net ext-loop-in hm2_[HOSTMOT2](BOARD).1.gpio.061.in_not classicladder.0.in-00
  330. net estop-enable iocontrol.0.emc-enable-in classicladder.0.out-00
  331. net Reset-estop iocontrol.0.user-request-enable classicladder.0.in-01
  332.  
  333. # maybe engage some motor start relays at estop enable.
  334.  
  335.  
  336. #400psi pump
  337. setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_output true
  338. setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_opendrain true
  339. setp hm2_[HOSTMOT2](BOARD).0.gpio.048.invert_output true
  340.  
  341. #1200psi pump
  342. setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_output true
  343. setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_opendrain true
  344. setp hm2_[HOSTMOT2](BOARD).0.gpio.049.invert_output true
  345.  
  346.  
  347. # servo drive transformer
  348. setp hm2_[HOSTMOT2](BOARD).0.gpio.050.is_output true
  349. setp hm2_[HOSTMOT2](BOARD).0.gpio.050.is_opendrain true
  350. setp hm2_[HOSTMOT2](BOARD).0.gpio.050.invert_output true
  351.  
  352. #sump pump
  353. setp hm2_[HOSTMOT2](BOARD).0.gpio.051.is_output true
  354. setp hm2_[HOSTMOT2](BOARD).0.gpio.051.is_opendrain true
  355. setp hm2_[HOSTMOT2](BOARD).0.gpio.051.invert_output true
  356.  
  357. #spindle vfd
  358. setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_output true
  359. setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_opendrain true
  360. setp hm2_[HOSTMOT2](BOARD).0.gpio.054.invert_output true
  361.  
  362. #y servo brake output
  363. setp hm2_[HOSTMOT2](BOARD).1.gpio.058.is_output true
  364. setp hm2_[HOSTMOT2](BOARD).1.gpio.058.is_opendrain true
  365. setp hm2_[HOSTMOT2](BOARD).1.gpio.058.invert_output true
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372. net estop-enable hm2_[HOSTMOT2](BOARD).0.gpio.048.out hm2_[HOSTMOT2](BOARD).0.gpio.049.out hm2_[HOSTMOT2](BOARD).0.gpio.051.out hm2_[HOSTMOT2](BOARD).0.gpio.050.out hm2_[HOSTMOT2](BOARD).0.gpio.054.out
  373. #today1
  374. #net estop-enable hm2_[HOSTMOT2](BOARD).1.gpio.058.out
  375.  
  376. # net estop-activate-halui halui.estop.activate classicladder.0.out-00
  377. # net estop-loop-in classicladder.0.in-00
  378.  
  379.  
  380.  
  381.  
  382. #
  383. # homing
  384. #
  385.  
  386. #
  387. # In this example, each of the three axes have their own home switch. All
  388. # home switches are connected to GPIO 25, though hostmot2 boards generally
  389. # have enough GPIO pins to put each axis' home switch on its own pin.
  390. #
  391. # Each switch is normally open, momentarily closed. When the switch is open,
  392. # GPIO 25 floats high (because that is the hostmot2 way). When the switch is
  393. # closed, it shorts GPIO 25 to ground.
  394. #
  395. # EMC expects the value on the .home-sw-in HAL pin to be active high, ie
  396. # True when the switch is closed and False when the switch is open.
  397. # We get this behavior by linking the GPIO .in_not pin instead of the .in
  398. # pin.
  399. #
  400.  
  401. # x axis home switch hookup
  402. net xhome-switch axis.0.home-sw-in hm2_[HOSTMOT2](BOARD).1.gpio.069.in_not
  403. net x-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.00.index-enable <=> axis.0.index-enable
  404.  
  405.  
  406. # only the Y servo has an index, X and Z home without using the index
  407. net yhome-switch axis.1.home-sw-in hm2_[HOSTMOT2](BOARD).0.gpio.030.in_not
  408. net y-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.01.index-enable <=> axis.1.index-enable
  409.  
  410.  
  411. # z axis homing switch hookup
  412. net zhome-switch axis.2.home-sw-in hm2_[HOSTMOT2](BOARD).1.gpio.028.in_not
  413. net z-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.02.index-enable <=> axis.2.index-enable
  414.  
  415. #baxis home setup
  416.  
  417. net b-index-enable hm2_[HOSTMOT2](BOARD).1.encoder.00.index-enable <=> axis.4.index-enable pid.3.index-enable
  418.  
  419.  
  420.  
  421.  
  422. # here is the TRP solinoid enable....
  423.  
  424.  
  425. setp hm2_[HOSTMOT2](BOARD).0.gpio.063.is_output true
  426. setp hm2_[HOSTMOT2](BOARD).0.gpio.063.is_opendrain true
  427. setp hm2_[HOSTMOT2](BOARD).0.gpio.063.invert_output true
  428.  
  429. net emcmot.00.enable hm2_[HOSTMOT2](BOARD).0.gpio.063.out
  430.  
  431.  
  432. #tool changer
  433.  
  434. #clamp/unclamp
  435. setp hm2_[HOSTMOT2](BOARD).0.gpio.069.is_output true
  436. setp hm2_[HOSTMOT2](BOARD).0.gpio.069.is_opendrain true
  437. setp hm2_[HOSTMOT2](BOARD).0.gpio.069.invert_output true
  438. net chain-unclamp hm2_[HOSTMOT2](BOARD).0.gpio.069.out classicladder.0.out-01
  439.  
  440. #chain Advance
  441.  
  442. setp hm2_[HOSTMOT2](BOARD).0.gpio.071.is_output true
  443. setp hm2_[HOSTMOT2](BOARD).0.gpio.071.is_opendrain true
  444. setp hm2_[HOSTMOT2](BOARD).0.gpio.071.invert_output true
  445. net chain-advance hm2_[HOSTMOT2](BOARD).0.gpio.071.out classicladder.0.out-02
  446.  
  447. #chain creep
  448. setp hm2_[HOSTMOT2](BOARD).0.gpio.070.is_output true
  449. setp hm2_[HOSTMOT2](BOARD).0.gpio.070.is_opendrain true
  450. setp hm2_[HOSTMOT2](BOARD).0.gpio.070.invert_output true
  451. net chain-creep hm2_[HOSTMOT2](BOARD).0.gpio.070.out classicladder.0.out-03
  452.  
  453.  
  454. # create signals for tool loading loopback
  455. # net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  456. # net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
  457. net Tool-prepare iocontrol.0.tool-prepare classicladder.0.in-03
  458. net Tool-prepared iocontrol.0.tool-prepared classicladder.0.out-04
  459.  
  460. # tool unclamped switch
  461. net chain-unclamped hm2_5i20.0.gpio.029.in_not classicladder.0.in-04
  462. net chain-clamped hm2_5i20.0.gpio.028.in_not classicladder.0.in-05
  463.  
  464. net toolchain-strobe hm2_5i20.1.gpio.047.in classicladder.0.in-06
  465. net tool-prep-number iocontrol.0.tool-prep-number classicladder.0.s32in-00
  466.  
  467.  
  468. net tool-bit0 hm2_5i20.1.gpio.046.in_not classicladder.0.in-07
  469. net tool-bit1 hm2_5i20.1.gpio.045.in_not classicladder.0.in-08
  470. net tool-bit2 hm2_5i20.1.gpio.044.in_not classicladder.0.in-09
  471. net tool-bit3 hm2_5i20.1.gpio.043.in_not classicladder.0.in-10
  472. net tool-bit4 hm2_5i20.1.gpio.042.in_not classicladder.0.in-11
  473. net tool-bit5 hm2_5i20.1.gpio.041.in_not classicladder.0.in-12
  474. net tool-bit6 hm2_5i20.1.gpio.040.in_not classicladder.0.in-13
  475. net tool-bit7 hm2_5i20.1.gpio.039.in_not classicladder.0.in-14
  476. net tool-bit8 hm2_5i20.1.gpio.038.in_not classicladder.0.in-15
  477. net tool-bit9 hm2_5i20.1.gpio.037.in_not classicladder.0.in-16
  478. net tool-bit10 hm2_5i20.1.gpio.036.in_not classicladder.0.in-17
  479. net tool-bit11 hm2_5i20.1.gpio.035.in_not classicladder.0.in-18
  480. net tool-bit12 hm2_5i20.1.gpio.034.in_not classicladder.0.in-19
  481. net tool-bit13 hm2_5i20.1.gpio.033.in_not classicladder.0.in-20
  482. net tool-bit14 hm2_5i20.1.gpio.032.in_not classicladder.0.in-21
  483.  
  484. #tool arm in/out
  485. setp hm2_[HOSTMOT2](BOARD).0.gpio.068.is_output true
  486. setp hm2_[HOSTMOT2](BOARD).0.gpio.068.is_opendrain true
  487. setp hm2_[HOSTMOT2](BOARD).0.gpio.068.invert_output true
  488. net toolarmout hm2_[HOSTMOT2](BOARD).0.gpio.068.out classicladder.0.out-05
  489.  
  490. #tool arm ccw
  491. setp hm2_[HOSTMOT2](BOARD).0.gpio.066.is_output true
  492. setp hm2_[HOSTMOT2](BOARD).0.gpio.066.is_opendrain true
  493. setp hm2_[HOSTMOT2](BOARD).0.gpio.066.invert_output true
  494. net toolarmccw hm2_[HOSTMOT2](BOARD).0.gpio.066.out classicladder.0.out-07
  495.  
  496. #tool arm cw
  497. setp hm2_[HOSTMOT2](BOARD).0.gpio.065.is_output true
  498. setp hm2_[HOSTMOT2](BOARD).0.gpio.065.is_opendrain true
  499. setp hm2_[HOSTMOT2](BOARD).0.gpio.065.invert_output true
  500. net toolarmcw hm2_[HOSTMOT2](BOARD).0.gpio.065.out classicladder.0.out-06
  501.  
  502. #changer rotate pressure reduction
  503. setp hm2_[HOSTMOT2](BOARD).0.gpio.067.is_output true
  504. setp hm2_[HOSTMOT2](BOARD).0.gpio.067.is_opendrain true
  505. setp hm2_[HOSTMOT2](BOARD).0.gpio.067.invert_output true
  506. net toolarmlowerpress hm2_[HOSTMOT2](BOARD).0.gpio.067.out classicladder.0.out-08
  507.  
  508. #changer loopback through gearshift comp
  509. net toolchange iocontrol.0.tool-change gearshift16.0.spindlelock
  510. net toolchangelocked classicladder.0.in-26 gearshift16.0.spindlelocked
  511.  
  512.  
  513. net toolchanged iocontrol.0.tool-changed classicladder.0.out-09
  514.  
  515.  
  516. #tool arm vertical limit switch
  517. net armvert hm2_5i20.0.gpio.026.in_not classicladder.0.in-22
  518.  
  519. #tool arm horizontal limit switch
  520. net armhoriz hm2_5i20.0.gpio.025.in_not classicladder.0.in-23
  521.  
  522. #tool arm in limit
  523. net armin hm2_5i20.0.gpio.024.in_not classicladder.0.in-25
  524.  
  525. #tool arem out limit
  526. net armout hm2_5i20.0.gpio.027.in_not classicladder.0.in-24
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534. # spindle
  535. # Forward
  536. setp hm2_[HOSTMOT2](BOARD).1.gpio.062.is_output true
  537. setp hm2_[HOSTMOT2](BOARD).1.gpio.062.is_opendrain true
  538. setp hm2_[HOSTMOT2](BOARD).1.gpio.062.invert_output false
  539.  
  540. # reverse
  541. setp hm2_[HOSTMOT2](BOARD).1.gpio.063.is_output true
  542. setp hm2_[HOSTMOT2](BOARD).1.gpio.063.is_opendrain true
  543. setp hm2_[HOSTMOT2](BOARD).1.gpio.063.invert_output true
  544.  
  545. # Enable vfd and pwm3 keep
  546. setp hm2_[HOSTMOT2](BOARD).1.gpio.064.is_output true
  547. setp hm2_[HOSTMOT2](BOARD).1.gpio.064.is_opendrain true
  548. setp hm2_[HOSTMOT2](BOARD).1.gpio.064.invert_output true
  549. net emcmot.00.enable hm2_[HOSTMOT2](BOARD).1.gpio.064.out hm2_[HOSTMOT2](BOARD).0.pwmgen.03.enable
  550.  
  551. #scale vfd pwm3
  552. setp hm2_5i20.0.pwmgen.03.scale -4000
  553.  
  554. # hook up pins
  555. net spindledir hm2_[HOSTMOT2](BOARD).1.gpio.062.out abs.0.sign hm2_[HOSTMOT2](BOARD).1.gpio.063.out
  556. # net spindlerev hm2_[HOSTMOT2](BOARD).1.gpio.063.out motion.spindle-reverse
  557.  
  558.  
  559. net actualspin abs.0.in gearshift16.0.spnmotorspeed
  560. net outtovfd abs.0.out hm2_5i20.0.pwmgen.03.value
  561.  
  562. #shift rails/enables
  563.  
  564. #Keylock
  565. setp hm2_[HOSTMOT2](BOARD).1.gpio.053.is_output true
  566. setp hm2_[HOSTMOT2](BOARD).1.gpio.053.is_opendrain true
  567. setp hm2_[HOSTMOT2](BOARD).1.gpio.053.invert_output true
  568. net keylock hm2_[HOSTMOT2](BOARD).1.gpio.053.out gearshift16.0.ksol
  569.  
  570. #shiftrail pressure enable
  571. setp hm2_[HOSTMOT2](BOARD).1.gpio.048.is_output true
  572. setp hm2_[HOSTMOT2](BOARD).1.gpio.048.is_opendrain true
  573. setp hm2_[HOSTMOT2](BOARD).1.gpio.048.invert_output true
  574. net emcmot.00.enable hm2_[HOSTMOT2](BOARD).1.gpio.048.out
  575.  
  576.  
  577.  
  578. #shiftrail sssol
  579. setp hm2_[HOSTMOT2](BOARD).1.gpio.052.is_output true
  580. setp hm2_[HOSTMOT2](BOARD).1.gpio.052.is_opendrain true
  581. setp hm2_[HOSTMOT2](BOARD).1.gpio.052.invert_output true
  582. net sssolsig hm2_[HOSTMOT2](BOARD).1.gpio.052.out gearshift16.0.sssol
  583.  
  584. #shiftrail SC2sol
  585. setp hm2_[HOSTMOT2](BOARD).1.gpio.051.is_output true
  586. setp hm2_[HOSTMOT2](BOARD).1.gpio.051.is_opendrain true
  587. setp hm2_[HOSTMOT2](BOARD).1.gpio.051.invert_output true
  588. net sc2solsig hm2_[HOSTMOT2](BOARD).1.gpio.051.out gearshift16.0.sc2sol
  589.  
  590. #shiftrail SC1sol
  591. setp hm2_[HOSTMOT2](BOARD).1.gpio.049.is_output true
  592. setp hm2_[HOSTMOT2](BOARD).1.gpio.049.is_opendrain true
  593. setp hm2_[HOSTMOT2](BOARD).1.gpio.049.invert_output true
  594. net sc1solsig hm2_[HOSTMOT2](BOARD).1.gpio.049.out gearshift16.0.sc1sol
  595.  
  596. #shiftrail SAsol
  597. setp hm2_[HOSTMOT2](BOARD).1.gpio.050.is_output true
  598. setp hm2_[HOSTMOT2](BOARD).1.gpio.050.is_opendrain true
  599. setp hm2_[HOSTMOT2](BOARD).1.gpio.050.invert_output true
  600. net sasolsig hm2_[HOSTMOT2](BOARD).1.gpio.050.out gearshift16.0.sasol
  601.  
  602. # collet clamp/unclamp
  603. setp hm2_[HOSTMOT2](BOARD).0.gpio.064.is_output true
  604. setp hm2_[HOSTMOT2](BOARD).0.gpio.064.is_opendrain true
  605. setp hm2_[HOSTMOT2](BOARD).0.gpio.064.invert_output true
  606.  
  607. net collet classicladder.0.out-10 hm2_[HOSTMOT2](BOARD).0.gpio.064.out
  608.  
  609.  
  610. # encoder feedback
  611. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.counter-mode 0
  612. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.filter 1
  613. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-invert 0
  614. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-mask 0
  615. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-mask-invert 0
  616.  
  617. setp hm2_[HOSTMOT2](BOARD).0.encoder.03.scale 66.666666667
  618.  
  619. #shiftrail pressure sensor
  620. net oneps gearshift16.0.oneps hm2_5i20.0.gpio.031.in_not
  621. #encoder hookup
  622.  
  623.  
  624.  
  625. #setup
  626. setp gearshift16.0.shiftrpm -300
  627. setp gearshift16.0.shiftencodercounts -10000
  628. setp gearshift16.0.atspeedwindow 150
  629.  
  630. #velocity feedback to comp
  631. net spindlespfb gearshift16.0.spnmotorspeedfb hm2_[HOSTMOT2](BOARD).0.encoder.03.velocity
  632.  
  633. #commanded from emc
  634. net spindlespeed motion.spindle-speed-cmd-rps gearshift16.0.cmdspnspeed
  635.  
  636. #enable gearshift comp
  637. net emcmot.00.enable gearshift16.0.enable
  638.  
  639. #spindle on
  640. net spindleon motion.spindle-on gearshift16.0.spnon
  641.  
  642. #encoder count feedback
  643. net spindleenccnt hm2_[HOSTMOT2](BOARD).0.encoder.03.count gearshift16.0.rawcountsin
  644.  
  645. #spindlebrake
  646. net spindlebrake gearshift16.0.spnbrake motion.spindle-brake
  647.  
  648. #override
  649. net spindleoverride motion.spindle-speed-out gearshift16.0.cmdspnwithoverride
  650.  
  651. #connect halui spindle stop to spindle
  652. net spindlestop gearshift16.0.spindlestop halui.spindle.stop
  653.  
  654. #connect halui spindle is on
  655. net spindleison gearshift16.0.spindleison halui.spindle.is-on
  656.  
  657. #connect spindle reverse so that ccw button apears in axis
  658. net spindlerev motion.spindle-reverse
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. #table b axis lift and unlock sensors.
  668.  
  669. setp hm2_[HOSTMOT2](BOARD).0.gpio.061.is_output true
  670. setp hm2_[HOSTMOT2](BOARD).0.gpio.061.is_opendrain true
  671. setp hm2_[HOSTMOT2](BOARD).0.gpio.061.invert_output true
  672.  
  673. net baxisup hm2_[HOSTMOT2](BOARD).0.gpio.061.out axis.4.unlock
  674. net couplingunclamped hm2_5i20.1.gpio.024.in_not classicladder.0.in-36
  675. net couplinguncdelay classicladder.0.out-15 axis.4.is-unlocked
  676.  
  677.  
  678.  
  679.  
  680. #pallet stuff..
  681.  
  682. #pallet unclamp
  683. setp hm2_[HOSTMOT2](BOARD).0.gpio.062.is_output true
  684. setp hm2_[HOSTMOT2](BOARD).0.gpio.062.is_opendrain true
  685. setp hm2_[HOSTMOT2](BOARD).0.gpio.062.invert_output true
  686. net palletunclamp hm2_[HOSTMOT2](BOARD).0.gpio.062.out classicladder.0.out-11
  687.  
  688. # pallet unclamed sensor
  689. net palletunclamped hm2_5i20.1.gpio.025.in classicladder.0.in-32
  690. net palletclamped hm2_5i20.1.gpio.026.in classicladder.0.in-33
  691. #right pallet
  692.  
  693. #right cylinder rotate
  694. setp hm2_[HOSTMOT2](BOARD).0.gpio.058.is_output true
  695. setp hm2_[HOSTMOT2](BOARD).0.gpio.058.is_opendrain true
  696. setp hm2_[HOSTMOT2](BOARD).0.gpio.058.invert_output true
  697. net rpalletcylrot hm2_[HOSTMOT2](BOARD).0.gpio.058.out classicladder.0.out-17
  698.  
  699. #right cylinder out
  700. setp hm2_[HOSTMOT2](BOARD).0.gpio.059.is_output true
  701. setp hm2_[HOSTMOT2](BOARD).0.gpio.059.is_opendrain true
  702. setp hm2_[HOSTMOT2](BOARD).0.gpio.059.invert_output true
  703. net rpalletcylout hm2_[HOSTMOT2](BOARD).0.gpio.059.out classicladder.0.out-18
  704.  
  705. net rcyldown hm2_5i20.0.gpio.046.in_not classicladder.0.in-37
  706. net rcylup hm2_5i20.0.gpio.047.in_not classicladder.0.in-38
  707. net rcylin hm2_5i20.0.gpio.044.in_not classicladder.0.in-40
  708. net rcylout hm2_5i20.0.gpio.045.in_not classicladder.0.in-39
  709. net rpalletonall classicladder.0.in-42 hm2_5i20.0.gpio.042.in_not
  710.  
  711.  
  712.  
  713.  
  714. #left pallet
  715.  
  716. #left cylinder rotate
  717. setp hm2_[HOSTMOT2](BOARD).0.gpio.056.is_output true
  718. setp hm2_[HOSTMOT2](BOARD).0.gpio.056.is_opendrain true
  719. setp hm2_[HOSTMOT2](BOARD).0.gpio.056.invert_output true
  720. net lpalletcylrot hm2_[HOSTMOT2](BOARD).0.gpio.056.out classicladder.0.out-12
  721.  
  722. #left cylinder out
  723. setp hm2_[HOSTMOT2](BOARD).0.gpio.057.is_output true
  724. setp hm2_[HOSTMOT2](BOARD).0.gpio.057.is_opendrain true
  725. setp hm2_[HOSTMOT2](BOARD).0.gpio.057.invert_output true
  726. net lpalletcylout hm2_[HOSTMOT2](BOARD).0.gpio.057.out classicladder.0.out-13
  727.  
  728. net lcyldown hm2_5i20.0.gpio.038.in_not classicladder.0.in-27
  729. net lcylup hm2_5i20.0.gpio.039.in_not classicladder.0.in-28
  730. net lcylin hm2_5i20.0.gpio.040.in_not classicladder.0.in-29
  731. net lcylout hm2_5i20.0.gpio.041.in_not classicladder.0.in-30
  732. net lpalletonall classicladder.0.in-34 hm2_5i20.0.gpio.036.in_not
  733.  
  734.  
  735. #oiler
  736. setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_output true
  737. setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_opendrain true
  738. setp hm2_[HOSTMOT2](BOARD).0.gpio.055.invert_output true
  739. net oilways hm2_[HOSTMOT2](BOARD).0.gpio.055.out classicladder.0.out-14
  740.  
  741.  
  742.  
  743.  
  744.  
  745. #jog wheel try
  746. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.counter-mode 0
  747. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.filter 1
  748. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.index-invert 0
  749. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.index-mask 0
  750. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.index-mask-invert 0
  751. setp hm2_[HOSTMOT2](BOARD).1.encoder.01.scale 1600
  752.  
  753. setp axis.0.jog-vel-mode 1
  754. setp axis.1.jog-vel-mode 1
  755. setp axis.2.jog-vel-mode 1
  756.  
  757. net pend-counts axis.0.jog-counts <= hm2_[HOSTMOT2](BOARD).1.encoder.01.count
  758. net pend-counts axis.1.jog-counts
  759. net pend-counts axis.2.jog-counts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement