############################## # REAL TIME COMPONENTS # ###################################################################################################################################### # LOAD REAL TIME MODULES FOR ETHERCAT, PID, PARAPORT CARD FOR ENCODER INPUT, ETC loadrt threads name1=master period1=50000 loadusr -W lcec_conf /home/robert/linuxcnc/configs/ethercat-conf.xml loadrt lcec loadrt trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt hal_parport cfg="e010 in" loadrt encoder num_chan=3 loadrt pid num_chan=3 loadrt pwmgen output_type=0 ################################################# # COMPONENT THREADS - MUST BE IN ORDER # ###################################################################################################################################### # ADD FUNCTIONS TO REALTIME THREAD, DEFINE THE ORDER OF EXECUTION OF RT CODE addf lcec.read-all master addf parport.0.read master addf encoder.update-counters master addf pwmgen.make-pulses master addf parport.0.write master addf lcec.write-all master addf encoder.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.0.do-pid-calcs servo-thread addf pid.1.do-pid-calcs servo-thread addf pid.2.do-pid-calcs servo-thread addf pwmgen.update servo-thread ################################ # ETHERCAT SLAVE BUS # ###################################################################################################################################### net ec-slaves-responding <= lcec.slaves-responding net ec-link-up <= lcec.link-up net ec-all-op <= lcec.all-op ################################ # E-STOP/MACHINE POWER # ###################################################################################################################################### net voltage-on iocontrol.0.emc-enable-in lcec.0.D2.din-6 #net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in ################################ # LIMIT/PROXIMITY SWITCHES # ###################################################################################################################################### # connect limit/home switch outputs to motion controller net Xminlim => axis.0.neg-lim-sw-in <= lcec.0.D18.din-1-not net Xmaxlim => axis.0.pos-lim-sw-in <= lcec.0.D18.din-0-not net Yminlim => axis.1.neg-lim-sw-in <= lcec.0.D19.din-1-not net Ymaxlim => axis.1.pos-lim-sw-in <= lcec.0.D19.din-0-not net Zminlim => axis.2.neg-lim-sw-in <= lcec.0.D18.din-3-not net Zmaxlim => axis.2.pos-lim-sw-in <= lcec.0.D18.din-2-not ######################################################## # HOME SWITCHES - WILL DEAL WITH CORRECT SETUP LATER # ###################################################################################################################################### #net Xhome => axis.0.home-sw-in <= lcec.0.D4.din-0 #net Yhome => axis.1.home-sw-in <= lcec.0.D4.din-1 #net Zhome => axis.2.home-sw-in <= lcec.0.D4.din-2 ################################################## # SPINDLE & COOLANT CONTROL # ###################################################################################################################################### #SPINDLE CONTROL net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs net spindle-vel-cmd <= motion.spindle-speed-out lcec.0.D11.aout-0-value pwmgen.0.value net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs net spindle-on <= motion.spindle-on lcec.0.D6.dout-2 lcec.0.D11.aout-0-enable pwmgen.0.enable net spindle-cw <= motion.spindle-forward lcec.0.D6.dout-1 lcec.0.D7.dout-2 lcec.0.D9.dout-2 net spindle-ccw <= motion.spindle-reverse lcec.0.D6.dout-3 lcec.0.D9.dout-3 net spindle-brake <= motion.spindle-brake lcec.0.D6.dout-0 net spindle-revs => motion.spindle-revs net spindle-at-speed => motion.spindle-at-speed net spindle-vel-fb => motion.spindle-speed-in net spindle-index-enable <=> motion.spindle-index-enable #SET SPINDLE TOP SPEED IN RPM setp pwmgen.0.scale 4000 setp lcec.0.D11.aout-0-scale 4000 # COOOLANT net coolant-on iocontrol.0.coolant-flood lcec.0.D8.dout-3 # create signals for tool loading loopback net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed ################## # Halui Signals # ###################################################################################################################################### net joint-select-a halui.joint.0.select net x-is-homed halui.joint.0.is-homed #net jog-x-pos halui.jog.0.plus lcec.0.D*.din-0 #net jog-x-neg halui.jog.0.minus lcec.0.D*.din-1 net jog-x-analog halui.jog.0.analog net joint-select-b halui.joint.1.select net y-is-homed halui.joint.1.is-homed #net jog-y-pos halui.jog.1.plus lcec.0.D*.din-2 #net jog-y-neg halui.jog.1.minus lcec.0.D*.din-3 net jog-y-analog halui.jog.1.analog net joint-select-c halui.joint.2.select net z-is-homed halui.joint.2.is-homed net jog-z-pos halui.jog.2.plus net jog-z-neg halui.jog.2.minus net jog-z-analog halui.jog.2.analog net jog-selected-pos halui.jog.selected.plus net jog-selected-neg halui.jog.selected.minus net spindle-manual-cw halui.spindle.forward lcec.0.D2.din-2 net spindle-manual-ccw halui.spindle.reverse lcec.0.D2.din-4 net spindle-manual-stop halui.spindle.stop lcec.0.D6.dout-7 lcec.0.D2.din-1 net spindle-manual-increase halui.spindle.increase lcec.0.D3.din-0 net spindle-manual-decrease halui.spindle.decrease lcec.0.D3.din-1 #net spindle-brake halui.spindle.brake-on lcec.0.D2.din-3 net machine-is-on halui.machine.is-on lcec.0.D6.dout-5 lcec.0.D7.dout-0 lcec.0.D7.dout-1 lcec.0.D9.dout-0 lcec.0.D9.dout-1 net machine-on halui.machine.on lcec.0.D2.din-0 net machine-off halui.machine.off lcec.0.D6.dout-4 lcec.0.D2.din-5 #net jog-speed halui.jog-speed #net MDI-mode halui.mode.is-mdi