Advertisement
nickparker

Untitled

Apr 13th, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. loadrt trivkins
  2. loadrt hostmot2
  3. loadrt hal_parport cfg="0x378 out"
  4. loadrt hm2_pci config="num_pwmgens=1 num_stepgens=3"
  5. loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  6.  
  7. addf motion-command-handler servo-thread
  8. addf motion-controller servo-thread
  9.  
  10. loadrt edge count=3
  11. #Pulse edge detector 0 on both edges, the other two on rising edges.
  12. setp edge.0.both TRUE
  13. setp edge.1.in-edge FALSE
  14. setp edge.2.in-edge FALSE
  15.  
  16. #Half second pulses
  17. setp edge.0.out-width-ns 2000000000
  18. setp edge.1.out-width-ns 2000000000
  19. setp edge.2.out-width-ns 2000000000
  20.  
  21. #Connect motion module's speed out to pwmgen's speed in. PWM goes into a low pass filter to drive 0-10V input
  22. net spindle-cmd <= motion.spindle-speed-out => hm2_6i25.0.pwmgen.00.value
  23.  
  24. #Connect motion.spindle-on to the "both edges" edge detector. This will drive pin 6 on the relay board
  25. net spindle-on <= motion.spindle-on => edge.0.in
  26. net spindle-on => hm2_6i25.0.pwmgen.00.enable
  27.  
  28. #Connect forward to one detector and reverse to the other. Forward goes to 4, reverse to 5.
  29. net spindle-forward <= motion.spindle-forward => edge.1.in
  30. net spindle-reverse <= motion.spindle-reverse => edge.2.in
  31.  
  32. #Connect the edge detectors to output pins
  33. net on-pulse <= edge.0.out => parport.0.pin-01-out
  34. net fw-pulse <= edge.1.out => parport.0.pin-02-out
  35. net rv-pulse <= edge.2.out => parport.0.pin-03-out
  36.  
  37. #Set the scale of the spindle pwm input
  38. setp hm2_6i25.0.pwmgen.00.scale [SPINDLE]SCALE
  39.  
  40. #Set the length of the step sequence table to 8. Also sets to table mode.
  41. setp hm2_6i25.0.stepgen.00.step_type 8
  42. setp hm2_6i25.0.stepgen.01.step_type 8
  43. setp hm2_6i25.0.stepgen.02.step_type 8
  44.  
  45. #Set control-type for all three axes
  46. setp hm2_6i25.0.stepgen.00.control-type 0
  47. setp hm2_6i25.0.stepgen.01.control-type 0
  48. setp hm2_6i25.0.stepgen.02.control-type 0
  49.  
  50. #Point the table data values to the table data in the .ini files
  51. setp hm2_6i25.0.stepgen.00.table-data-0 [STEP_DATA]DATA0
  52. setp hm2_6i25.0.stepgen.00.table-data-1 [STEP_DATA]DATA1
  53. setp hm2_6i25.0.stepgen.01.table-data-0 [STEP_DATA]DATA0
  54. setp hm2_6i25.0.stepgen.01.table-data-1 [STEP_DATA]DATA1
  55. setp hm2_6i25.0.stepgen.02.table-data-0 [STEP_DATA]DATA0
  56. setp hm2_6i25.0.stepgen.02.table-data-1 [STEP_DATA]DATA1
  57.  
  58. #For each axis, set control-type to position mode, and point all the variables from the .ini file
  59. setp hm2_6i25.0.stepgen.00.position-scale [AXIS_0]SCALE
  60. setp hm2_6i25.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL
  61. setp hm2_6i25.0.stepgen.00.maxvel [AXIS_0]MAX_VELOCITY
  62.  
  63. setp hm2_6i25.0.stepgen.01.position-scale [AXIS_1]SCALE
  64. setp hm2_6i25.0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL
  65. setp hm2_6i25.0.stepgen.01.maxvel [AXIS_1]MAX_VELOCITY
  66.  
  67. setp hm2_6i25.0.stepgen.02.position-scale [AXIS_2]SCALE
  68. setp hm2_6i25.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL
  69. setp hm2_6i25.0.stepgen.02.maxvel [AXIS_2]MAX_VELOCITY
  70.  
  71. #Connect motion position commands and feedbacks to stepgen position commands and feedbacks
  72. net xpos-cmd axis.0.motor-pos-cmd => hm2_6i25.0.stepgen.00.position-cmd
  73. net ypos-cmd axis.1.motor-pos-cmd => hm2_6i25.0.stepgen.01.position-cmd
  74. net zpos-cmd axis.2.motor-pos-cmd => hm2_6i25.0.stepgen.02.position-cmd
  75. net xpos-fb hm2_6i25.0.stepgen.00.position-fb => axis.0.motor-pos-fb
  76. net ypos-fb hm2_6i25.0.stepgen.01.position-fb => axis.1.motor-pos-fb
  77. net zpos-fb hm2_6i25.0.stepgen.02.position-fb => axis.2.motor-pos-fb
  78.  
  79. #Connect the motion.enable pin to the enables of the stepgens
  80. net xenable axis.0.amp-enable-out => hm2_6i25.0.stepgen.00.enable
  81. net yenable axis.1.amp-enable-out => hm2_6i25.0.stepgen.01.enable
  82. net zenable axis.2.amp-enable-out => hm2_6i25.0.stepgen.02.enable
  83.  
  84. #Copy paste code, unknown utility. Hoping it lets me undo the estop in axis gui.
  85. net estop-out <= iocontrol.0.user-enable-out
  86. net estop-out => iocontrol.0.emc-enable-in
  87.  
  88. addf parport.0.read base-thread
  89. addf parport.0.write base-thread
  90. addf parport.0.reset base-thread
  91.  
  92. addf hm2_6i25.0.read servo-thread
  93. addf hm2_6i25.0.write servo-thread
  94. addf hm2_6i25.0.pet_watchdog base-thread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement