diff graster/hacklab-engraver/hacklab-engraver3.hal @ 11:f952052e37b7

trying a fix.
author Robert McIntyre <rlm@mit.edu>
date Tue, 24 Aug 2010 19:06:45 -0400
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/graster/hacklab-engraver/hacklab-engraver3.hal	Tue Aug 24 19:06:45 2010 -0400
     1.3 @@ -0,0 +1,233 @@
     1.4 +# Generated by stepconf at Sun Mar  8 21:32:59 2009
     1.5 +# If you make changes to this file, they will be
     1.6 +# overwritten when you run stepconf again
     1.7 +
     1.8 +loadrt threads name1=mask-thread period1=100000
     1.9 +
    1.10 +loadrt trivkins
    1.11 +loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]SERVO_PERIOD key=[EMCMOT]SHMEM_KEY num_joints=[TRAJ]AXES
    1.12 +loadrt probe_parport
    1.13 +loadrt hal_parport cfg=0x378
    1.14 +setp parport.0.reset-time 100000
    1.15 +loadrt stepgen step_type=0,0,0,0
    1.16 +loadrt charge_pump
    1.17 +
    1.18 +
    1.19 +# Boring components that emc makes me load explicitly because it is a cunt
    1.20 +loadrt comp names=comp-mask-lte,comp-discrete-z
    1.21 +loadrt not names=not-mask-ffw,not-mask-not-empty
    1.22 +loadrt xor2 names=xor2-mask-test
    1.23 +loadrt and2 names=and2-mask-forward,and2-laser-mask,and2-laser-final
    1.24 +loadrt or2 names=or2-mask-command-done,or2-mask-not-ffw,or2-mask-read,or2-laser-gcode,or2-laser-fine
    1.25 +
    1.26 +
    1.27 +# Fast thread for generating signals
    1.28 +addf parport.0.read base-thread
    1.29 +addf stepgen.make-pulses base-thread
    1.30 +addf parport.0.write base-thread
    1.31 +addf parport.0.reset base-thread
    1.32 +addf charge-pump base-thread
    1.33 +
    1.34 +# Slow thread for logic (more logic components are added further down)
    1.35 +addf stepgen.capture-position     servo-thread
    1.36 +addf motion-command-handler       servo-thread
    1.37 +addf motion-controller            servo-thread
    1.38 +addf stepgen.update-freq          servo-thread
    1.39 +
    1.40 +
    1.41 +###################################################################################
    1.42 +# Raster Mask - stream in laser on/off commands behind AXIS's back
    1.43 +# Input stream format: reset beam xop xarg
    1.44 +#   reset:  0=mask command 1=reset (begin mask sequence with "1 0 0 0", every other command starts with 0)
    1.45 +#   beam:   0=off 1=on
    1.46 +#   xop:    X axis comparison operation 0=less-or-equal 1=greater
    1.47 +#   xarg:   X axis comparison operand
    1.48 +
    1.49 +loadrt streamer depth=256 cfg="bbbf"
    1.50 +net mask-reset     <= streamer.0.pin.0
    1.51 +net mask-beam      <= streamer.0.pin.1
    1.52 +net mask-xop       <= streamer.0.pin.2
    1.53 +net mask-xarg      <= streamer.0.pin.3
    1.54 +net mask-empty     <= streamer.0.empty
    1.55 +net mask-read => streamer.0.enable
    1.56 +
    1.57 +# hardware reported X axis position
    1.58 +net motion-xpos-fb <= axis.0.joint-pos-fb
    1.59 +
    1.60 +# mask-lte <= motion-xpos-fb < mask-xarg
    1.61 +addf comp-mask-lte mask-thread
    1.62 +net motion-xpos-fb => comp-mask-lte.in0
    1.63 +net mask-xarg => comp-mask-lte.in1
    1.64 +net mask-lte <= comp-mask-lte.out
    1.65 +
    1.66 +# mask-test <= mask-xop ^ mask-lte
    1.67 +addf xor2-mask-test mask-thread
    1.68 +net mask-xop => xor2-mask-test.in0
    1.69 +net mask-lte => xor2-mask-test.in1
    1.70 +net mask-test <= xor2-mask-test.out
    1.71 +
    1.72 +# if job is running, read only if test is true or reset
    1.73 +# if job is not running, read until reset
    1.74 +# mask-read <= (laser-coarse && (mask-test || mask-reset)) || !(laser-coarse || mask-reset)
    1.75 +
    1.76 +addf or2-mask-command-done mask-thread
    1.77 +net mask-test => or2-mask-command-done.in0
    1.78 +net mask-reset => or2-mask-command-done.in1
    1.79 +net mask-command-done <= or2-mask-command-done.out
    1.80 +
    1.81 +addf and2-mask-forward mask-thread
    1.82 +net laser-coarse => and2-mask-forward.in0
    1.83 +net mask-command-done => and2-mask-forward.in1
    1.84 +net mask-forward <= and2-mask-forward.out
    1.85 +
    1.86 +addf or2-mask-not-ffw mask-thread
    1.87 +net laser-coarse => or2-mask-not-ffw.in0
    1.88 +net mask-reset => or2-mask-not-ffw.in1
    1.89 +net mask-not-ffw <= or2-mask-not-ffw.out
    1.90 +
    1.91 +addf not-mask-ffw mask-thread
    1.92 +net mask-not-ffw => not-mask-ffw.in
    1.93 +net mask-ffw <= not-mask-ffw.out
    1.94 +
    1.95 +addf or2-mask-read mask-thread
    1.96 +net mask-forward => or2-mask-read.in0
    1.97 +net mask-ffw => or2-mask-read.in1
    1.98 +net mask-read <= or2-mask-read.out
    1.99 +
   1.100 +# laser-mask <=  mask-not-empty && mask-beam
   1.101 +addf not-mask-not-empty mask-thread
   1.102 +net mask-empty => not-mask-not-empty.in
   1.103 +net mask-not-empty <= not-mask-not-empty.out
   1.104 +
   1.105 +addf and2-laser-mask mask-thread
   1.106 +net mask-beam => and2-laser-mask.in0
   1.107 +net mask-not-empty => and2-laser-mask.in1
   1.108 +net laser-mask <= and2-laser-mask.out
   1.109 +
   1.110 +addf streamer.0 mask-thread
   1.111 +
   1.112 +# Raster Mask - end
   1.113 +#######################################################################
   1.114 +
   1.115 +# coarse laser control, wired to spindle on/off (M3/M5), not realtime
   1.116 +net laser-coarse <= motion.spindle-on
   1.117 +
   1.118 +# fine laser control, wired to digital output 0 (M62 P0/M63 P0), realtime
   1.119 +net laser-gate <= motion.digital-out-00
   1.120 +
   1.121 +# legacy laser control, wired to Z < 0, can be used instead of M62/M63
   1.122 +addf comp-discrete-z servo-thread
   1.123 +net motion-zpos-fb <= axis.2.joint-pos-fb
   1.124 +net motion-zpos-fb => comp-discrete-z.in0
   1.125 +setp comp-discrete-z.in1 0
   1.126 +net discrete-z <= comp-discrete-z.out
   1.127 +
   1.128 +# laser-final <= laser-coarse & (laser-gate | discrete-z | laser-mask)
   1.129 +addf or2-laser-gcode mask-thread
   1.130 +net laser-gate => or2-laser-gcode.in0
   1.131 +net discrete-z => or2-laser-gcode.in1
   1.132 +net laser-gcode <= or2-laser-gcode.out
   1.133 +
   1.134 +addf or2-laser-fine mask-thread
   1.135 +net laser-gcode => or2-laser-fine.in0
   1.136 +net laser-mask => or2-laser-fine.in1
   1.137 +net laser-fine <= or2-laser-fine.out
   1.138 +
   1.139 +addf and2-laser-final mask-thread
   1.140 +net laser-fine => and2-laser-final.in0
   1.141 +net laser-coarse => and2-laser-final.in1
   1.142 +net laser-final <= and2-laser-final.out
   1.143 +
   1.144 +# laser-final => hardware
   1.145 +net laser-final => parport.0.pin-01-out
   1.146 +
   1.147 +# make Z and W axes always homed
   1.148 +#setp axis.2.homed 1   # Z
   1.149 +#setp axis.8.homed 1   # W
   1.150 +
   1.151 +net xdir => parport.0.pin-02-out
   1.152 +net xstep => parport.0.pin-03-out
   1.153 +setp parport.0.pin-03-out-reset 1
   1.154 +net ydir => parport.0.pin-04-out
   1.155 +net ystep => parport.0.pin-05-out
   1.156 +setp parport.0.pin-05-out-reset 1
   1.157 +net wdir => parport.0.pin-06-out
   1.158 +net wstep => parport.0.pin-07-out
   1.159 +setp parport.0.pin-07-out-reset 1
   1.160 +
   1.161 +# invert ydir
   1.162 +#setp parport.0.pin-04-out-invert 1
   1.163 +
   1.164 +
   1.165 +net xenable => parport.0.pin-14-out
   1.166 +
   1.167 +net home-x <= parport.0.pin-10-in
   1.168 +net home-y <= parport.0.pin-12-in
   1.169 +net estop-ext <= parport.0.pin-15-in
   1.170 +
   1.171 +setp stepgen.0.position-scale [AXIS_0]SCALE
   1.172 +setp stepgen.0.steplen 15200
   1.173 +setp stepgen.0.stepspace 15200
   1.174 +setp stepgen.0.dirhold 15200
   1.175 +setp stepgen.0.dirsetup 15200
   1.176 +setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
   1.177 +net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
   1.178 +net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
   1.179 +net xstep <= stepgen.0.step
   1.180 +net xdir <= stepgen.0.dir
   1.181 +net xenable axis.0.amp-enable-out => stepgen.0.enable
   1.182 +net home-x => axis.0.home-sw-in
   1.183 +
   1.184 +setp stepgen.1.position-scale [AXIS_1]SCALE
   1.185 +setp stepgen.1.steplen 15200
   1.186 +setp stepgen.1.stepspace 15200
   1.187 +setp stepgen.1.dirhold 15200
   1.188 +setp stepgen.1.dirsetup 15200
   1.189 +setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
   1.190 +net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
   1.191 +net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
   1.192 +net ystep <= stepgen.1.step
   1.193 +net ydir <= stepgen.1.dir
   1.194 +net yenable axis.1.amp-enable-out => stepgen.1.enable
   1.195 +net home-y => axis.1.home-sw-in
   1.196 +
   1.197 +setp stepgen.2.position-scale [AXIS_2]SCALE
   1.198 +setp stepgen.2.steplen 1
   1.199 +setp stepgen.2.stepspace 0
   1.200 +setp stepgen.2.dirhold 15200
   1.201 +setp stepgen.2.dirsetup 15200
   1.202 +setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
   1.203 +net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
   1.204 +net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
   1.205 +net zstep <= stepgen.2.step
   1.206 +net zdir <= stepgen.2.dir
   1.207 +net zenable axis.2.amp-enable-out => stepgen.2.enable
   1.208 +net home-z => axis.2.home-sw-in
   1.209 +
   1.210 +setp stepgen.3.position-scale [AXIS_8]SCALE
   1.211 +setp stepgen.3.steplen 1
   1.212 +setp stepgen.3.stepspace 0
   1.213 +setp stepgen.3.dirhold 15200
   1.214 +setp stepgen.3.dirsetup 15200
   1.215 +setp stepgen.3.maxaccel [AXIS_8]STEPGEN_MAXACCEL
   1.216 +net wpos-cmd axis.8.motor-pos-cmd => stepgen.3.position-cmd
   1.217 +net wpos-fb stepgen.3.position-fb => axis.8.motor-pos-fb
   1.218 +net wstep <= stepgen.3.step
   1.219 +net wdir <= stepgen.3.dir
   1.220 +net wenable axis.8.amp-enable-out => stepgen.3.enable
   1.221 +net home-w => axis.8.home-sw-in
   1.222 +
   1.223 +net estop-out <= iocontrol.0.user-enable-out
   1.224 +net estop-ext => iocontrol.0.emc-enable-in
   1.225 +
   1.226 +loadusr -W hal_manualtoolchange
   1.227 +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
   1.228 +net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
   1.229 +net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
   1.230 +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
   1.231 +
   1.232 +# connect the charge pump signal to an output
   1.233 +net charge-pump <= charge-pump.out
   1.234 +setp parport.0.pin-17-out-reset 1
   1.235 +net charge-pump => parport.0.pin-17-out 
   1.236 +setp charge-pump.enable 1