All pastes #888189 Raw Copy code Copy link Edit

hal file fr EMC2 mit 3d-Step End

public unlisted text v1 · immutable
#888189 ·published 2008-02-01 22:48 UTC
rendered paste body
# standard pinout config file for 3-axis steppers
# using a parport for I/O
#
# first load the parport driver
loadrt hal_parport cfg="0x0378"
#
# next connect the parport functions to threads
# read inputs first
addf parport.0.read base-thread 1
# write outputs last
addf parport.0.write base-thread -1
#
# finally connect physical pins to the signals
net Xstep => parport.0.pin-03-out
net Xdir  => parport.0.pin-02-out
net Ystep => parport.0.pin-05-out
net Ydir  => parport.0.pin-04-out
net Zstep => parport.0.pin-07-out
net Zdir  => parport.0.pin-06-out

# create a signal for the estop loopback
#net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in

# 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

# connect "spindle on" motion controller pin to a physical pin
net spindle-on motion.spindle-on => parport.0.pin-01-out

###
### You might use something like this to enable chopper drives when machine ON
### the Xen signal is defined in core_stepper.hal
###

# net Xen => parport.0.pin-01-out

###
### If you want active low for this pin, invert it like this:
###

# setp parport.0.pin-01-out-invert 1

###
### A sample home switch on the X axis (axis 0).  make a signal,
### link the incoming parport pin to the signal, then link the signal
### to EMC's axis 0 home switch input pin
###

# net Xhome parport.0.pin-10-in => axis.0.home-sw-in

###
### Shared home switches all on one parallel port pin?
### that's ok, hook the same signal to all the axes, but be sure to 
### set HOME_IS_SHARED and HOME_SEQUENCE in the ini file.  See the
### user manual!
###

# net homeswitches <= parport.0.pin-10-in
# net homeswitches => axis.0.home-sw-in
# net homeswitches => axis.1.home-sw-in
# net homeswitches => axis.2.home-sw-in

###
### Sample separate limit switches on the X axis (axis 0)
###

# net X-neg-limit parport.0.pin-11-in => axis.0.neg-lim-sw-in
# net X-pos-limit parport.0.pin-12-in => axis.0.pos-lim-sw-in

###
### Just like the shared home switches example, you can wire together
### limit switches.  Beware if you hit one, EMC will stop but can't tell
### you which switch/axis has faulted.  Use caution when recovering from this.
###

net Xlimits parport.0.pin-13-in => axis.0.neg-lim-sw-in axis.0.pos-lim-sw-in
net Ylimits parport.0.pin-12-in => axis.1.neg-lim-sw-in axis.1.pos-lim-sw-in
net Zlimits parport.0.pin-10-in => axis.2.neg-lim-sw-in axis.2.pos-lim-sw-in

#Not-Aus
linkpp parport.0.pin-11-in-not iocontrol.0.emc-enable-in

#Khlung (von mir als Spneabsaugung verwendet)
linkpp iocontrol.0.coolant-flood parport.0.pin-14-out

# Sleep funktion
linkpp motion.motion-inpos parport.0.pin-17-out

#Boost funktion
loadrt ddt count=6
loadrt hypot count=2
loadrt wcomp count=1

addf ddt.0 servo-thread
addf ddt.1 servo-thread
addf ddt.2 servo-thread
addf ddt.3 servo-thread
addf hypot.0 servo-thread
addf hypot.1 servo-thread
addf wcomp.0 servo-thread

# BOOST Signal erstellen
newsig boost bit
linksp boost => parport.0.pin-16-out

newsig Xvel float
linksp Xpos-cmd => ddt.0.in
linkps ddt.0.out => Xvel
newsig Yvel float
linksp Ypos-cmd => ddt.1.in
linkps ddt.1.out => Yvel
newsig Zvel float
linksp Zpos-cmd => ddt.2.in
linkps ddt.2.out => Zvel

newsig XYvel float #Signal X+Y
linksp Xvel => hypot.0.in0
linksp Yvel => hypot.0.in1
linksp XYvel <= hypot.0.out

newsig XYZvel float #Signal X+Y+Z
linksp Zvel => hypot.1.in0
linksp XYvel => hypot.1.in1
linksp XYZvel <= hypot.1.out

linksp XYZvel => wcomp.0.in
linksp boost <= wcomp.0.out

setp wcomp.0.min 0.1 #Boost from Steppacceleration
setp wcomp.0.max 3 #Boost to Steppacceleration

#manueller werkzeugwechsel
loadusr -W hal_manualtoolchange
unlinkp iocontrol.0.tool-change
unlinkp iocontrol.0.tool-changed
linkpp hal_manualtoolchange.change iocontrol.0.tool-change
linkpp hal_manualtoolchange.changed iocontrol.0.tool-changed
linkpp hal_manualtoolchange.number iocontrol.0.tool-prep-number