Advertisement
Guest User

danimal

a guest
Jul 29th, 2011
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.82 KB | None | 0 0
  1. # #######################################
  2.  
  3. #
  4.  
  5. # HAL file for HostMot2 with 3 steppers
  6.  
  7. #
  8.  
  9. # Derived from Ted Hyde's original hm2-servo config
  10.  
  11. #
  12.  
  13. # Based up work and discussion with Seb & Peter & Jeff
  14.  
  15. # GNU license references - insert here. www.linuxcnc.org
  16.  
  17. #
  18.  
  19. #
  20.  
  21. # ########################################
  22.  
  23. # Firmware files are in /lib/firmware/hm2/5i20/
  24.  
  25. # Must symlink the hostmot2 firmware directory of sanbox to
  26.  
  27. # /lib/firmware before running EMC2...
  28.  
  29. # sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
  30.  
  31. #
  32.  
  33. # See also:
  34.  
  35. # <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
  36.  
  37. # and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
  38.  
  39. #
  40.  
  41. # #####################################################################
  42.  
  43.  
  44.  
  45.  
  46.  
  47. # ###################################
  48.  
  49. # Core EMC/HAL Loads
  50.  
  51. # ###################################
  52.  
  53.  
  54.  
  55. # kinematics
  56.  
  57. loadrt trivkins
  58.  
  59. # motion controller, get name and thread periods from ini file
  60.  
  61. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  62.  
  63. loadrt pid num_chan=3
  64.  
  65. loadrt threads name1=classicladder-thread period1=2000000
  66.  
  67.  
  68.  
  69. loadrt classicladder_rt numS32in=3 numS32out=8 numRungs=60 numBits=90 numWords=55 numTimers=27 numCounters=15 numPhysInputs=50 numPhysOutputs=50 numArithmExpr=25 numSections=6 numSymbols=220 numS32in=3 numS32out=9
  70.  
  71.  
  72.  
  73. loadusr -w classicladder --nogui shizuoka.clp
  74.  
  75.  
  76.  
  77. # only the 7i43 needs this, but it doesnt hurt the others
  78.  
  79. loadrt probe_parport
  80.  
  81.  
  82.  
  83. loadrt modmath mod_dir=1
  84.  
  85.  
  86.  
  87. loadrt not
  88.  
  89. # hostmot2 driver
  90.  
  91. loadrt hostmot2
  92.  
  93. loadrt toggle count=1
  94.  
  95. # load low-level driver
  96.  
  97. loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
  98.  
  99. show all
  100.  
  101. loadrt mux4 count=1
  102.  
  103. loadrt encoder num_chan=1
  104.  
  105.  
  106.  
  107.  
  108.  
  109. setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000
  110.  
  111.  
  112.  
  113.  
  114.  
  115. # ################################################
  116.  
  117. # THREADS
  118.  
  119. # ################################################
  120.  
  121.  
  122.  
  123. addf classicladder.0.refresh classicladder-thread
  124.  
  125. addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
  126.  
  127. addf motion-command-handler servo-thread
  128.  
  129. addf motion-controller servo-thread
  130.  
  131. # revel in the free time here from not having to run PID
  132.  
  133. addf pid.0.do-pid-calcs servo-thread
  134.  
  135. addf pid.1.do-pid-calcs servo-thread
  136.  
  137. addf pid.2.do-pid-calcs servo-thread
  138.  
  139.  
  140.  
  141. addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
  142.  
  143. addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
  144.  
  145. addf mod-dir.0 servo-thread
  146.  
  147. addf toggle.0 servo-thread
  148.  
  149. addf not.0 servo-thread
  150.  
  151. addf encoder.capture-position servo-thread
  152.  
  153. addf encoder.update-counters servo-thread
  154.  
  155. addf mux4.0 servo-thread
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163. # ######################################################
  164.  
  165. # Axis-of-motion Specific Configs (not the GUI)
  166.  
  167. # ######################################################
  168.  
  169.  
  170.  
  171.  
  172.  
  173. # ################
  174.  
  175. # X [0] Axis
  176.  
  177. # ################
  178.  
  179.  
  180.  
  181. # axis enable chain
  182.  
  183. newsig emcmot.00.enable bit
  184.  
  185. sets emcmot.00.enable FALSE
  186.  
  187. net emcmot.00.enable => pid.0.enable
  188.  
  189.  
  190.  
  191. net emcmot.00.enable <= axis.0.amp-enable-out
  192.  
  193.  
  194.  
  195. # encoder feedback
  196.  
  197. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
  198.  
  199. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
  200.  
  201. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
  202.  
  203. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
  204.  
  205. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0
  206.  
  207.  
  208.  
  209. setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
  210.  
  211. net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position => pid.0.feedback
  212.  
  213. net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI
  214.  
  215.  
  216.  
  217. # set PID loop gains from inifile
  218.  
  219. setp pid.0.Pgain [AXIS_0]P
  220.  
  221. setp pid.0.Igain [AXIS_0]I
  222.  
  223. setp pid.0.Dgain [AXIS_0]D
  224.  
  225. setp pid.0.bias [AXIS_0]BIAS
  226.  
  227. setp pid.0.FF0 [AXIS_0]FF0
  228.  
  229. setp pid.0.FF1 [AXIS_0]FF1
  230.  
  231. setp pid.0.FF2 [AXIS_0]FF2
  232.  
  233. setp pid.0.deadband [AXIS_0]DEADBAND
  234.  
  235. setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
  236.  
  237.  
  238.  
  239. # position command signals
  240. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.pwm_frequency 24000
  241.  
  242. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.output-type 2 #pwm on pin1, dir on pin2
  243.  
  244. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
  245.  
  246.  
  247.  
  248. net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
  249.  
  250. net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value
  251.  
  252. net x-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.00.index-enable <=> axis.0.index-enable
  253.  
  254. net x-velocity-to-pid hm2_5i20.0.encoder.00.velocity pid.0.feedback-deriv
  255.  
  256.  
  257.  
  258.  
  259.  
  260. # ################
  261.  
  262. # Y [1] Axis
  263.  
  264. # ################
  265.  
  266.  
  267.  
  268. # axis enable chain
  269.  
  270. newsig emcmot.01.enable bit
  271.  
  272. sets emcmot.01.enable FALSE
  273.  
  274. net emcmot.01.enable => pid.1.enable
  275.  
  276. #net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
  277.  
  278. net emcmot.01.enable <= axis.1.amp-enable-out
  279.  
  280.  
  281.  
  282. # encoder feedback
  283.  
  284. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
  285.  
  286. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
  287.  
  288. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
  289.  
  290. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 0
  291.  
  292. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0
  293.  
  294.  
  295.  
  296. setp hm2_[HOSTMOT2](BOARD).0.encoder.01.scale [AXIS_1]INPUT_SCALE
  297.  
  298. net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.position => pid.1.feedback
  299.  
  300. net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI
  301.  
  302.  
  303.  
  304. # set PID loop gains from inifile
  305.  
  306. setp pid.1.Pgain [AXIS_1]P
  307.  
  308. setp pid.1.Igain [AXIS_1]I
  309.  
  310. setp pid.1.Dgain [AXIS_1]D
  311.  
  312. setp pid.1.bias [AXIS_1]BIAS
  313.  
  314. setp pid.1.FF0 [AXIS_1]FF0
  315.  
  316. setp pid.1.FF1 [AXIS_1]FF1
  317.  
  318. setp pid.1.FF2 [AXIS_1]FF2
  319.  
  320. setp pid.1.deadband [AXIS_1]DEADBAND
  321.  
  322. setp pid.1.maxoutput [AXIS_1]MAX_OUTPUT
  323.  
  324.  
  325.  
  326. # position command signals
  327. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.pwm_frequency 24000
  328.  
  329. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.output-type 2 #pwm on pin1, dir on pin2
  330.  
  331. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
  332.  
  333.  
  334.  
  335. net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
  336.  
  337. net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value
  338.  
  339. net y-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.01.index-enable <=> axis.1.index-enable pid.1.index-enable
  340.  
  341. net y-velocity-to-pid hm2_5i20.0.encoder.01.velocity pid.1.feedback-deriv
  342.  
  343.  
  344.  
  345. # ################
  346.  
  347. # Z [2] Axis
  348.  
  349. # ################
  350.  
  351.  
  352.  
  353. # axis enable chain
  354.  
  355. newsig emcmot.02.enable bit
  356.  
  357. sets emcmot.02.enable FALSE
  358.  
  359. net emcmot.02.enable => pid.2.enable
  360.  
  361. #net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable
  362.  
  363. net emcmot.02.enable <= axis.2.amp-enable-out
  364.  
  365.  
  366.  
  367. # encoder feedback
  368.  
  369. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.counter-mode 0
  370.  
  371. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.filter 1
  372.  
  373. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-invert 0
  374.  
  375. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask 0
  376.  
  377. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask-invert 0
  378.  
  379.  
  380.  
  381. setp hm2_[HOSTMOT2](BOARD).0.encoder.02.scale [AXIS_2]INPUT_SCALE
  382.  
  383. net motor.02.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.02.position => pid.2.feedback
  384.  
  385. net motor.02.pos-fb => axis.2.motor-pos-fb #push copy back to Axis GUI
  386.  
  387.  
  388.  
  389. # set PID loop gains from inifile
  390.  
  391. setp pid.2.Pgain [AXIS_2]P
  392.  
  393. setp pid.2.Igain [AXIS_2]I
  394.  
  395. setp pid.2.Dgain [AXIS_2]D
  396.  
  397. setp pid.2.bias [AXIS_2]BIAS
  398.  
  399. setp pid.2.FF0 [AXIS_2]FF0
  400.  
  401. setp pid.2.FF1 [AXIS_2]FF1
  402.  
  403. setp pid.2.FF2 [AXIS_2]FF2
  404.  
  405. setp pid.2.deadband [AXIS_2]DEADBAND
  406.  
  407. setp pid.2.maxoutput [AXIS_2]MAX_OUTPUT
  408.  
  409.  
  410.  
  411. # position command signals
  412. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.pwm_frequency 24000
  413.  
  414. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.output-type 2 #pwm on pin1, dir on pin2
  415.  
  416. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.scale [AXIS_2]OUTPUT_SCALE
  417.  
  418.  
  419.  
  420. net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command
  421.  
  422. net motor.02.command pid.2.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.02.value
  423.  
  424. net z-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.02.index-enable <=> axis.2.index-enable
  425.  
  426. net z-velocity-to-pid hm2_5i20.0.encoder.02.velocity pid.2.feedback-deriv
  427.  
  428.  
  429.  
  430.  
  431.  
  432. #setp hm2_[HOSTMOT2](BOARD).0.write_address 13312 # (0x3400)
  433.  
  434. #setp hm2_[HOSTMOT2](BOARD).0.write_data 8
  435.  
  436. #setp hm2_[HOSTMOT2](BOARD).0.write_strobe TRUE
  437.  
  438.  
  439.  
  440. ## ##################################################
  441.  
  442. # Standard I/O Block - EStop, Etc
  443.  
  444. # ##################################################
  445.  
  446. setp hm2_[HOSTMOT2](BOARD).0.gpio.052.is_output 0
  447.  
  448. setp hm2_[HOSTMOT2](BOARD).0.gpio.025.is_output 0
  449.  
  450. setp hm2_[HOSTMOT2](BOARD).0.gpio.029.is_output 0
  451.  
  452. setp hm2_[HOSTMOT2](BOARD).0.gpio.030.is_output 0
  453.  
  454. setp hm2_[HOSTMOT2](BOARD).0.gpio.031.is_output 0
  455.  
  456. setp hm2_[HOSTMOT2](BOARD).0.gpio.032.is_output 0
  457.  
  458. setp hm2_[HOSTMOT2](BOARD).0.gpio.033.is_output 0
  459.  
  460. setp hm2_[HOSTMOT2](BOARD).0.gpio.034.is_output 0
  461.  
  462. setp hm2_[HOSTMOT2](BOARD).0.gpio.035.is_output 0
  463.  
  464. setp hm2_[HOSTMOT2](BOARD).0.gpio.037.is_output 0
  465.  
  466. setp hm2_[HOSTMOT2](BOARD).0.gpio.026.is_output 0
  467.  
  468. setp hm2_[HOSTMOT2](BOARD).0.gpio.027.is_output 0
  469.  
  470. setp hm2_[HOSTMOT2](BOARD).0.gpio.028.is_output 0
  471.  
  472. setp hm2_[HOSTMOT2](BOARD).0.gpio.056.is_output 0
  473.  
  474. setp hm2_[HOSTMOT2](BOARD).0.gpio.057.is_output 0
  475.  
  476. setp hm2_[HOSTMOT2](BOARD).0.gpio.059.is_output 0
  477.  
  478. setp hm2_[HOSTMOT2](BOARD).0.gpio.065.is_output 0
  479.  
  480. setp hm2_[HOSTMOT2](BOARD).0.gpio.067.is_output 0
  481.  
  482. setp hm2_[HOSTMOT2](BOARD).0.gpio.069.is_output 0
  483.  
  484. setp hm2_[HOSTMOT2](BOARD).0.gpio.053.is_output 0
  485.  
  486. setp hm2_[HOSTMOT2](BOARD).0.gpio.058.is_output 0
  487.  
  488. setp hm2_[HOSTMOT2](BOARD).0.gpio.063.is_output 0
  489.  
  490. setp hm2_[HOSTMOT2](BOARD).0.gpio.066.is_output 0
  491.  
  492. setp hm2_[HOSTMOT2](BOARD).0.gpio.068.is_output 0
  493.  
  494. setp hm2_[HOSTMOT2](BOARD).0.gpio.039.is_output 0
  495.  
  496. setp hm2_[HOSTMOT2](BOARD).0.gpio.040.is_output 1
  497.  
  498. setp hm2_[HOSTMOT2](BOARD).0.gpio.040.invert_output true
  499.  
  500. setp hm2_[HOSTMOT2](BOARD).0.gpio.041.is_output 1
  501.  
  502. setp hm2_[HOSTMOT2](BOARD).0.gpio.041.invert_output true
  503.  
  504. setp hm2_[HOSTMOT2](BOARD).0.gpio.042.is_output 1
  505.  
  506. setp hm2_[HOSTMOT2](BOARD).0.gpio.042.invert_output true
  507.  
  508. setp hm2_[HOSTMOT2](BOARD).0.gpio.043.is_output 1
  509.  
  510. setp hm2_[HOSTMOT2](BOARD).0.gpio.043.invert_output true
  511.  
  512. setp hm2_[HOSTMOT2](BOARD).0.gpio.044.is_output 1
  513.  
  514. setp hm2_[HOSTMOT2](BOARD).0.gpio.044.invert_output true
  515.  
  516. setp hm2_[HOSTMOT2](BOARD).0.gpio.045.is_output 1
  517.  
  518. setp hm2_[HOSTMOT2](BOARD).0.gpio.045.invert_output true
  519.  
  520. setp hm2_[HOSTMOT2](BOARD).0.gpio.046.is_output 1
  521.  
  522. setp hm2_[HOSTMOT2](BOARD).0.gpio.046.invert_output true
  523.  
  524. setp hm2_[HOSTMOT2](BOARD).0.gpio.047.is_output 1
  525.  
  526. setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_output 1
  527.  
  528. setp hm2_[HOSTMOT2](BOARD).0.gpio.047.invert_output true
  529.  
  530. #setp hm2_[HOSTMOT2](BOARD).0.gpio.068.invert_output true
  531.  
  532. setp hm2_[HOSTMOT2](BOARD).0.gpio.058.invert_output true
  533.  
  534. setp hm2_[HOSTMOT2](BOARD).0.gpio.063.invert_output true
  535.  
  536. setp hm2_[HOSTMOT2](BOARD).0.gpio.053.invert_output true
  537.  
  538. setp hm2_[HOSTMOT2](BOARD).0.gpio.062.invert_output true
  539.  
  540. setp hm2_[HOSTMOT2](BOARD).0.gpio.065.invert_output true
  541.  
  542. setp hm2_[HOSTMOT2](BOARD).0.gpio.067.invert_output true
  543.  
  544. setp hm2_[HOSTMOT2](BOARD).0.gpio.059.invert_output true
  545.  
  546. setp hm2_[HOSTMOT2](BOARD).0.gpio.062.is_output 0
  547.  
  548. setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_opendrain 0
  549.  
  550. #setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_opendrain 0
  551.  
  552. setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_opendrain 0
  553.  
  554. #setp hm2_[HOSTMOT2](BOARD).0.gpio.060.is_opendrain 0
  555.  
  556. #setp hm2_[HOSTMOT2](BOARD).0.gpio.064.is_opendrain 0
  557.  
  558. setp hm2_[HOSTMOT2](BOARD).0.gpio.060.is_output 1
  559.  
  560. setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_output 1
  561.  
  562. setp hm2_[HOSTMOT2](BOARD).0.gpio.064.is_output 1
  563.  
  564. setp hm2_[HOSTMOT2](BOARD).0.gpio.050.is_output 1
  565.  
  566. setp hm2_[HOSTMOT2](BOARD).0.gpio.051.is_output 1
  567.  
  568. setp hm2_[HOSTMOT2](BOARD).0.gpio.071.is_output 1
  569.  
  570. setp hm2_[HOSTMOT2](BOARD).0.gpio.070.is_output 0
  571.  
  572. setp hm2_[HOSTMOT2](BOARD).0.gpio.049.invert_output true
  573.  
  574. #setp hm2_[HOSTMOT2](BOARD).0.gpio.054.invert_output true
  575.  
  576. setp hm2_[HOSTMOT2](BOARD).0.gpio.055.invert_output true
  577.  
  578. #setp hm2_[HOSTMOT2](BOARD).0.gpio.060.invert_output true
  579.  
  580. #setp hm2_[HOSTMOT2](BOARD).0.gpio.064.invert_output true
  581.  
  582. net Spindlefwd motion.spindle-forward => hm2_[HOSTMOT2](BOARD).0.gpio.040.out
  583.  
  584. net Spindlerev motion.spindle-reverse => hm2_[HOSTMOT2](BOARD).0.gpio.042.out
  585.  
  586. #setp hm2_[HOSTMOT2](BOARD).0.pwmgen.03.pwm_frequency 50000
  587.  
  588. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.03.scale 5915
  589.  
  590. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.03.output-type 1
  591.  
  592. net Spindle-rpm-cmd motion.spindle-speed-out => hm2_[HOSTMOT2](BOARD).0.pwmgen.03.value
  593.  
  594. linksp Spindlefwd => hm2_[HOSTMOT2](BOARD).0.pwmgen.03.enable
  595.  
  596. #setp hm2_[HOSTMOT2](BOARD).0.raw.write_address 13312 # (0x3400)
  597.  
  598. #setp hm2_[HOSTMOT2](BOARD).0.raw.write_data 8
  599.  
  600. #setp hm2_[HOSTMOT2](BOARD).0.raw.write_strobe TRUE
  601.  
  602.  
  603.  
  604.  
  605.  
  606. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.03.pwm_frequency 24000
  607.  
  608. setp hm2_[HOSTMOT2](BOARD).0.pwmgen.03.output-type 2 #pwm on pin1, dir on pin2
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616. # create a signal for the estop loopback
  617.  
  618. #net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  619.  
  620. net estop-loop hm2_[HOSTMOT2](BOARD).0.gpio.066.in iocontrol.0.emc-enable-in
  621.  
  622. net Spindlefwdbutton hm2_[HOSTMOT2](BOARD).0.gpio.058.in_not halui.spindle.forward
  623.  
  624. net Spindlervsbutton hm2_[HOSTMOT2](BOARD).0.gpio.056.in_not halui.spindle.reverse
  625.  
  626. net Spindlestopbutton hm2_[HOSTMOT2](BOARD).0.gpio.052.in_not halui.spindle.stop
  627.  
  628. net feed-hold hm2_[HOSTMOT2](BOARD).0.gpio.062.in_not motion.feed-hold
  629.  
  630. net mode-auto hm2_[HOSTMOT2](BOARD).0.gpio.053.in_not halui.mode.auto
  631.  
  632. net mode-manual hm2_[HOSTMOT2](BOARD).0.gpio.063.in_not halui.mode.manual
  633.  
  634. net mode-mdi hm2_[HOSTMOT2](BOARD).0.gpio.059.in_not halui.mode.mdi
  635.  
  636. net program-resume hm2_[HOSTMOT2](BOARD).0.gpio.070.in_not halui.program.resume
  637.  
  638. # connect pin 10 to X home and min limit
  639.  
  640. net X-home hm2_[HOSTMOT2](BOARD).0.gpio.069.in_not => axis.0.home-sw-in
  641.  
  642.  
  643.  
  644. # connect pin 11 to Y home and min limit
  645.  
  646. net Y-home hm2_[HOSTMOT2](BOARD).0.gpio.067.in_not => axis.1.home-sw-in
  647.  
  648.  
  649.  
  650. # connect pin 12 to Z home and min limit
  651.  
  652. net Z-home hm2_[HOSTMOT2](BOARD).0.gpio.065.in_not => axis.2.home-sw-in
  653.  
  654. net emcmot.02.enable hm2_[HOSTMOT2](BOARD).0.gpio.054.out
  655.  
  656.  
  657.  
  658. # Flood button
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666. #setp toggle.0.debounce 10
  667.  
  668.  
  669.  
  670. #net flood-contol hm2_[HOSTMOT2](BOARD).0.gpio.068.in_not => toggle.0.in
  671.  
  672. #net floodOn toggle.0.out => halui.flood.on
  673.  
  674. #net floodOn toggle.0.out => not.0.in
  675.  
  676. #net floodOff not.0.out => halui.flood.off
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684. # create signals for tool loading loopback
  685.  
  686. net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  687.  
  688. #net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704. #in
  705.  
  706. net magazine-fwd-req-fetch mod-dir.0.up classicladder.0.in-03
  707.  
  708. net magazine-rev-req-fetch mod-dir.0.down classicladder.0.in-04
  709.  
  710. net tool-change iocontrol.0.tool-change classicladder.0.in-02
  711.  
  712. #net tool-prep classicladder.0.in-26 <= iocontrol.0.tool-prepare
  713.  
  714. net tool-requested-number classicladder.0.s32in-01 <= iocontrol.0.tool-prep-number
  715.  
  716. net tool-requested-match mod-dir.0.on-target classicladder.0.in-05
  717.  
  718. net reset classicladder.0.in-01 <= hm2_[HOSTMOT2](BOARD).0.gpio.039.in_not
  719.  
  720. net program-running halui.program.is-running classicladder.0.in-07
  721.  
  722. net program-is-auto halui.mode.is-auto classicladder.0.in-08
  723.  
  724. net flood-coolant-out classicladder.0.out-07 hm2_[HOSTMOT2](BOARD).0.gpio.060.out
  725.  
  726. net flood-coolant-io iocontrol.0.coolant-flood classicladder.0.in-09
  727.  
  728. net flood-coolant-button hm2_[HOSTMOT2](BOARD).0.gpio.068.in classicladder.0.in-10
  729.  
  730. net arm-out-switch hm2_[HOSTMOT2](BOARD).0.gpio.024.in classicladder.0.in-11
  731.  
  732. net arm-in-switch hm2_[HOSTMOT2](BOARD).0.gpio.025.in classicladder.0.in-12
  733.  
  734. net home-switch hm2_[HOSTMOT2](BOARD).0.gpio.026.in classicladder.0.in-13
  735.  
  736. net turret-switch hm2_[HOSTMOT2](BOARD).0.gpio.027.in classicladder.0.in-14
  737.  
  738. net drawbar-switch hm2_[HOSTMOT2](BOARD).0.gpio.028.in classicladder.0.in-15
  739.  
  740. net emcmot.01.enable classicladder.0.in-17
  741.  
  742. #out
  743.  
  744. net magazine-forward classicladder.0.out-04 hm2_[HOSTMOT2](BOARD).0.gpio.046.out
  745.  
  746. net magazine-reverse classicladder.0.out-05 hm2_[HOSTMOT2](BOARD).0.gpio.047.out
  747.  
  748. net tool-load classicladder.0.out-03 hm2_[HOSTMOT2](BOARD).0.gpio.043.out
  749.  
  750. net tool-unload classicladder.0.out-02 hm2_[HOSTMOT2](BOARD).0.gpio.045.out
  751.  
  752. net arm-in classicladder.0.out-09 <= hm2_[HOSTMOT2](BOARD).0.gpio.071.out
  753.  
  754. net arm-out classicladder.0.out-10 <= hm2_[HOSTMOT2](BOARD).0.gpio.041.out
  755.  
  756. net claw-open classicladder.0.out-11 <= hm2_[HOSTMOT2](BOARD).0.gpio.050.out
  757.  
  758. net claw-close classicladder.0.out-12 <= hm2_[HOSTMOT2](BOARD).0.gpio.051.out
  759.  
  760. #net tool-prepared iocontrol.0.tool-prepared classicladder.0.out-20
  761.  
  762. net tool-changed iocontrol.0.tool-changed classicladder.0.out-06
  763.  
  764. net magazine-position classicladder.0.s32out-01 mod-dir.0.actual
  765.  
  766. net mod-desired-position classicladder.0.s32out-02 mod-dir.0.desired
  767.  
  768.  
  769.  
  770. net servo0-power-on classicladder.0.out-15 hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable
  771.  
  772. net servo1-power-on classicladder.0.out-16 hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
  773.  
  774. net servo2-power-on classicladder.0.out-17 hm2_[HOSTMOT2](BOARD).0.pwmgen.02.enable
  775.  
  776.  
  777.  
  778.  
  779.  
  780. # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge.
  781.  
  782. # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on.
  783.  
  784. setp encoder.0.x4-mode 0
  785.  
  786. #setp axis.0.jog-vel-mode 1
  787.  
  788. #setp axis.1.jog-vel-mode 1
  789.  
  790. #setp axis.2.jog-vel-mode 1
  791.  
  792.  
  793.  
  794.  
  795.  
  796. setp mux4.0.in0 0.0001
  797.  
  798. setp mux4.0.in1 0.001
  799.  
  800. setp mux4.0.in2 0.01
  801.  
  802.  
  803.  
  804. net scale1 mux4.0.sel0 <= hm2_[HOSTMOT2](BOARD).0.gpio.034.in_not
  805.  
  806. net scale2 mux4.0.sel1 <= hm2_[HOSTMOT2](BOARD).0.gpio.032.in_not
  807.  
  808. #net scale2 mux4.0.sel2 <= hm2_[HOSTMOT2](BOARD).0.gpio.034.in_not
  809.  
  810.  
  811.  
  812.  
  813.  
  814. net pend-scale axis.0.jog-scale <= mux4.0.out
  815.  
  816. net pend-scale axis.1.jog-scale
  817.  
  818. net pend-scale axis.2.jog-scale
  819.  
  820.  
  821.  
  822. net mpg-a encoder.0.phase-A <= hm2_[HOSTMOT2](BOARD).0.gpio.029.in
  823.  
  824. net mpg-b encoder.0.phase-B <= hm2_[HOSTMOT2](BOARD).0.gpio.031.in
  825.  
  826.  
  827.  
  828. net mpg-x axis.0.jog-enable <= hm2_[HOSTMOT2](BOARD).0.gpio.033.in_not
  829.  
  830. net mpg-y axis.1.jog-enable <= hm2_[HOSTMOT2](BOARD).0.gpio.035.in_not
  831.  
  832. net mpg-z axis.2.jog-enable <= hm2_[HOSTMOT2](BOARD).0.gpio.037.in_not
  833.  
  834.  
  835.  
  836. net pend-counts axis.0.jog-counts <= encoder.0.counts
  837.  
  838. net pend-counts axis.1.jog-counts
  839.  
  840. net pend-counts axis.2.jog-counts
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850. setp mod-dir.0.max-num [EMCIO]TOOL_TURRET_MAX
  851.  
  852. setp mod-dir.0.wrap [EMCIO]TOOL_TURRET_WRAP
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860. # set encoder latch enable TRUE so encoder count "wraps" during toolchanges
  861.  
  862. # and resets under motion controller command for rigid tapping
  863.  
  864. #linksp sp-index-enable motenc.3.enc-03-index-enable
  865.  
  866. #linksp sp-index-enable tristate-bit.0.out
  867.  
  868. #setp tristate-bit.0.in 1
  869.  
  870. #linksp tool-change tristate-bit.0.enable
  871.  
  872. #linksp sp-index-enable motion.spindle-index-enable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement