Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadrt trivkins
- loadrt hostmot2
- loadrt hal_parport cfg="0x378 out"
- loadrt hm2_pci config="num_pwmgens=1 num_stepgens=3"
- loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
- addf motion-command-handler servo-thread
- addf motion-controller servo-thread
- loadrt edge count=3
- #Pulse edge detector 0 on both edges, the other two on rising edges.
- setp edge.0.both TRUE
- setp edge.1.in-edge FALSE
- setp edge.2.in-edge FALSE
- #Half second pulses
- setp edge.0.out-width-ns 2000000000
- setp edge.1.out-width-ns 2000000000
- setp edge.2.out-width-ns 2000000000
- #Connect motion module's speed out to pwmgen's speed in. PWM goes into a low pass filter to drive 0-10V input
- net spindle-cmd <= motion.spindle-speed-out => hm2_6i25.0.pwmgen.00.value
- #Connect motion.spindle-on to the "both edges" edge detector. This will drive pin 6 on the relay board
- net spindle-on <= motion.spindle-on => edge.0.in
- net spindle-on => hm2_6i25.0.pwmgen.00.enable
- #Connect forward to one detector and reverse to the other. Forward goes to 4, reverse to 5.
- net spindle-forward <= motion.spindle-forward => edge.1.in
- net spindle-reverse <= motion.spindle-reverse => edge.2.in
- #Connect the edge detectors to output pins
- net on-pulse <= edge.0.out => parport.0.pin-01-out
- net fw-pulse <= edge.1.out => parport.0.pin-02-out
- net rv-pulse <= edge.2.out => parport.0.pin-03-out
- #Set the scale of the spindle pwm input
- setp hm2_6i25.0.pwmgen.00.scale [SPINDLE]SCALE
- #Set the length of the step sequence table to 8. Also sets to table mode.
- setp hm2_6i25.0.stepgen.00.step_type 8
- setp hm2_6i25.0.stepgen.01.step_type 8
- setp hm2_6i25.0.stepgen.02.step_type 8
- #Set control-type for all three axes
- setp hm2_6i25.0.stepgen.00.control-type 0
- setp hm2_6i25.0.stepgen.01.control-type 0
- setp hm2_6i25.0.stepgen.02.control-type 0
- #Point the table data values to the table data in the .ini files
- setp hm2_6i25.0.stepgen.00.table-data-0 [STEP_DATA]DATA0
- setp hm2_6i25.0.stepgen.00.table-data-1 [STEP_DATA]DATA1
- setp hm2_6i25.0.stepgen.01.table-data-0 [STEP_DATA]DATA0
- setp hm2_6i25.0.stepgen.01.table-data-1 [STEP_DATA]DATA1
- setp hm2_6i25.0.stepgen.02.table-data-0 [STEP_DATA]DATA0
- setp hm2_6i25.0.stepgen.02.table-data-1 [STEP_DATA]DATA1
- #For each axis, set control-type to position mode, and point all the variables from the .ini file
- setp hm2_6i25.0.stepgen.00.position-scale [AXIS_0]SCALE
- setp hm2_6i25.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL
- setp hm2_6i25.0.stepgen.00.maxvel [AXIS_0]MAX_VELOCITY
- setp hm2_6i25.0.stepgen.01.position-scale [AXIS_1]SCALE
- setp hm2_6i25.0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL
- setp hm2_6i25.0.stepgen.01.maxvel [AXIS_1]MAX_VELOCITY
- setp hm2_6i25.0.stepgen.02.position-scale [AXIS_2]SCALE
- setp hm2_6i25.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL
- setp hm2_6i25.0.stepgen.02.maxvel [AXIS_2]MAX_VELOCITY
- #Connect motion position commands and feedbacks to stepgen position commands and feedbacks
- net xpos-cmd axis.0.motor-pos-cmd => hm2_6i25.0.stepgen.00.position-cmd
- net ypos-cmd axis.1.motor-pos-cmd => hm2_6i25.0.stepgen.01.position-cmd
- net zpos-cmd axis.2.motor-pos-cmd => hm2_6i25.0.stepgen.02.position-cmd
- net xpos-fb hm2_6i25.0.stepgen.00.position-fb => axis.0.motor-pos-fb
- net ypos-fb hm2_6i25.0.stepgen.01.position-fb => axis.1.motor-pos-fb
- net zpos-fb hm2_6i25.0.stepgen.02.position-fb => axis.2.motor-pos-fb
- #Connect the motion.enable pin to the enables of the stepgens
- net xenable axis.0.amp-enable-out => hm2_6i25.0.stepgen.00.enable
- net yenable axis.1.amp-enable-out => hm2_6i25.0.stepgen.01.enable
- net zenable axis.2.amp-enable-out => hm2_6i25.0.stepgen.02.enable
- #Copy paste code, unknown utility. Hoping it lets me undo the estop in axis gui.
- net estop-out <= iocontrol.0.user-enable-out
- net estop-out => iocontrol.0.emc-enable-in
- addf parport.0.read base-thread
- addf parport.0.write base-thread
- addf parport.0.reset base-thread
- addf hm2_6i25.0.read servo-thread
- addf hm2_6i25.0.write servo-thread
- addf hm2_6i25.0.pet_watchdog base-thread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement