All pastes #363699 Raw Edit

Miscellany

public text v1 · immutable
#363699 ·published 2007-02-19 17:00 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
linksp Xstep => parport.0.pin-02-out
linksp Xdir  => parport.0.pin-03-out
linksp Ystep => parport.0.pin-04-out
linksp Ydir  => parport.0.pin-05-out
linksp Zstep => parport.0.pin-06-out
linksp Zdir  => parport.0.pin-07-out

# create a signal for the estop loopback
# linkpp parport.0.pin-10-in iocontrol.0.emc-enable-in

# create signal for external estop
newsig ext-estop bit
linksp ext-estop parport.0.pin-10-in
linkpp parport.0.pin-10-in iocontrol.0.emc-enable-in

# create signals for tool loading loopback
linkpp iocontrol.0.tool-prepare iocontrol.0.tool-prepared
linkpp iocontrol.0.tool-change iocontrol.0.tool-changed

# create a signal for "spindle on"
# connect the controller to it
# connect it to a physical pin
#newsig spindle-on bit
#linkps motion.spindle-on => spindle-on
#linksp spindle-on => parport.0.pin-17-out

# spindle signals "spindle forw,rev"
# spindle status has not been resolved
# a simple loop through is set here
linkpp motion.spindle-forward  parport.0.pin-16-out 
linkpp motion.spindle-reverse  parport.0.pin-17-out

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

# linksp 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
###

# newsig Xhome bit
# linkps parport.0.pin-12-in-not => Xhome
# linksp Xhome => axis.0.home-sw-in

# newsig Yhome bit
# linkps parport.0.pin-12-in-not => Yhome
# linksp Yhome => axis.1.home-sw-in

# newsig Zhome bit
# linkps parport.0.pin-12-in-not => Zhome
# linksp Zhome => axis.2.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!
###

newsig homeswitches bit
linkps parport.0.pin-12-in-not => homeswitches
linksp homeswitches => axis.0.home-sw-in
linksp homeswitches => axis.1.home-sw-in
linksp homeswitches => axis.2.home-sw-in

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

# newsig X-neg-limit bit
# linkps parport.0.pin-15-in-not => X-neg-limit
# linksp X-neg-limit => axis.0.neg-lim-sw-in

# newsig Y-neg-limit bit
# linkps parport.0.pin-15-in-not => Y-neg-limit
# linksp Y-neg-limit => axis.1.neg-lim-sw-in

# newsig Z-neg-limit bit
# linkps parport.0.pin-15-in-not => Z-neg-limit
# linksp Z-neg-limit => axis.2.neg-lim-sw-in

# newsig X-pos-limit bit
# linkps parport.0.pin-15-in-not => X-pos-limit
# linksp X-pos-limit => axis.0.pos-lim-sw-in

# newsig Y-pos-limit bit
# linkps parport.0.pin-15-in-not => Y-pos-limit
# linksp Y-pos-limit => axis.1.pos-lim-sw-in

# newsig Z-pos-limit bit
# linkps parport.0.pin-15-in-not => Z-pos-limit
# linksp Z-pos-limit => axis.2.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.
###

# newsig Xlimits bit
# linkps parport.pin-15-in-not => Xlimits
# linksp Xlimits => axis.0.neg-lim-sw-in
# linksp Xlimits => axis.0.pos-lim-sw-in

newsig limit-reached bit                      # create a limit switch signal
linkps parport.0.pin-12-in-not limit-reached     # connect this signal to pin 15 on the parport
linksp limit-reached  axis.0.neg-lim-sw-in  
linksp limit-reached  axis.0.pos-lim-sw-in  
linksp limit-reached  axis.1.neg-lim-sw-in  
linksp limit-reached  axis.1.pos-lim-sw-in  
linksp limit-reached  axis.2.neg-lim-sw-in  
linksp limit-reached  axis.2.pos-lim-sw-in 

###
### you can also use the "net" syntax to accomplish the "newsig" and "link"
### operations all at once.  This command does the same thing as the above
### block.
###

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



# coolant signals
# note that these do NOT represent proper IO signals from iocontrol
# should separate command and status for production versions
# and run these through CL to test conditions
linkpp  iocontrol.0.coolant-flood  parport.0.pin-08-out 
# linkpp  iocontrol.0.coolant-mist  parport.0.pin-09-out

loadrt pwmgen output_type=1
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
setp pwmgen.0.scale 2000 # Change to your spindle’s top speed in RPM