Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Include in your customized HAL
- # The commands in this file are run after the AXIS GUI (including PyVCP panel) starts
- #--------------
- # Gamepad
- #loadusr -W hal_input -KA gamepad
- loadrt and2 count=25
- loadrt conv_s32_float count=2
- loadrt mux4 count=2
- loadrt xor2 count=2
- loadrt or2 count=2
- loadrt scale count=2
- loadrt flipflop count=4
- loadrt wcomp count=2
- loadrt not count=5
- loadrt toggle count=2
- loadrt toggle2nist count=1
- #-- central buttons activate manual mode and restart the program
- addf and2.21 servo-thread
- addf and2.22 servo-thread
- addf and2.23 servo-thread
- addf and2.24 servo-thread
- addf or2.1 servo-thread
- addf toggle.1 servo-thread
- addf toggle2nist.0 servo-thread
- # External Program Pause/Resume and Run/Step Buttons
- # Pause/Resume Section
- net pause-resume-btn input.0.btn-base4
- # (this is your input)
- net pause-resume-btn and2.21.in0 and2.22.in0
- net pause-on toggle2nist.0.is-on and2.21.in1 and2.24.in1
- net pause-on halui.program.is-paused
- net run-on and2.22.in1 <= halui.program.is-running
- net pause-sig or2.1.in0 <= and2.21.out
- net resume-sig or2.1.in1 <= and2.22.out
- net toggle-ok toggle.1.in <= or2.1.out
- net togglesig toggle2nist.0.in <= toggle.1.out
- net toggleon halui.program.pause <= toggle2nist.0.on
- net toggleoff halui.program.resume <= toggle2nist.0.off
- # Run/Step Section
- net run-step-btn and2.23.in0 and2.24.in0
- net run-step-btn input.0.btn-base3
- #- (this is your input)
- net idle-on and2.23.in1 <= halui.program.is-idle
- # Pause/Resume Section
- net run-sig halui.mode.auto halui.program.run <= and2.23.out
- net step-sig halui.program.step <= and2.24.out
- #-- right rear buttons active estop
- addf and2.0 servo-thread
- net pgm-estop-0 input.0.btn-base2 and2.0.in0
- net pgm-estop-1 input.0.btn-pinkie and2.0.in1
- net pgm-estop and2.0.out halui.estop.activate
- #--
- #--
- #-- convert ini file unit/sec to unit/min and scale for slow jog
- #-- The ini file velocities are in units/second, so a scale block multiplies by 60 to get units/minute.
- #-- Another scale block multiplies by a factor, selected by the top left rear button to get slow-speed jogging.
- #- These values are a matter of taste: tune to your requirements.
- #-- Those two factors are fed to mux2 and selected by the counter which is clocked the top left rear button
- addf scale.0 servo-thread
- addf scale.1 servo-thread
- addf mux4.0 servo-thread
- addf mux4.1 servo-thread
- addf flipflop.0 servo-thread
- addf flipflop.1 servo-thread
- addf xor2.1 servo-thread
- addf not.0 servo-thread
- #-- rear left top button toggles jog speed
- net jog-per-sec halui.max-velocity.value scale.0.in
- setp scale.0.gain 60
- net jog-per-min scale.0.out scale.1.in
- setp mux4.0.in3 1
- setp mux4.0.in2 0.5
- setp mux4.0.in1 0.1
- setp mux4.0.in0 0.02
- net xyz-slowmode mux4.0.out scale.1.gain
- #- Increment mode step distance
- setp mux4.1.in3 1
- setp mux4.1.in2 0.5
- setp mux4.1.in1 0.1
- setp mux4.1.in0 0.025
- #- Two bit binary counter
- net ff-q1 flipflop.1.out
- net ff-q1 xor2.1.in0
- net ff-q0 flipflop.0.out not.0.in
- net ff-q0-not not.0.out flipflop.0.data
- net ff-q0 xor2.1.in1
- net ff1-data xor2.1.out flipflop.1.data
- net speed-button input.0.btn-top2
- net speed-button => flipflop.1.clk flipflop.0.clk
- net ff-q0 mux4.0.sel0 mux4.1.sel0
- net ff-q1 mux4.0.sel1 mux4.1.sel1
- net xyz-slowmode mux4.0.out scale.1.gain
- net axis-jog-speed scale.1.out halui.jog-speed
- #--
- addf and2.1 servo-thread
- addf and2.2 servo-thread
- addf and2.3 servo-thread
- addf and2.4 servo-thread
- addf and2.5 servo-thread
- addf and2.6 servo-thread
- addf and2.7 servo-thread
- addf and2.8 servo-thread
- addf and2.9 servo-thread
- addf and2.10 servo-thread
- addf and2.11 servo-thread
- addf and2.12 servo-thread
- addf and2.13 servo-thread
- addf and2.14 servo-thread
- addf and2.15 servo-thread
- addf and2.16 servo-thread
- addf and2.17 servo-thread
- addf and2.18 servo-thread
- addf and2.19 servo-thread
- addf and2.20 servo-thread
- addf conv-s32-float.0 servo-thread
- addf conv-s32-float.1 servo-thread
- addf xor2.0 servo-thread
- addf wcomp.0 servo-thread
- addf wcomp.1 servo-thread
- addf or2.0 servo-thread
- addf not.1 servo-thread
- addf not.2 servo-thread
- addf not.3 servo-thread
- addf not.4 servo-thread
- addf flipflop.2 servo-thread
- addf flipflop.3 servo-thread
- addf toggle.0 servo-thread
- #-- x y jog
- net x-jog-count-int input.0.abs-x-counts conv-s32-float.0.in
- net x-jog-count-raw conv-s32-float.0.out wcomp.0.in
- setp wcomp.0.min 126
- setp wcomp.0.max 128
- net x-jog-inactive wcomp.0.out flipflop.2.set
- net not_wcomp0 not.1.out or2.0.in0
- net y-jog-count-int input.0.abs-y-counts conv-s32-float.1.in
- net y-jog-count-raw conv-s32-float.1.out wcomp.1.in
- setp wcomp.1.min 126
- setp wcomp.1.max 128
- net y-jog-inactive wcomp.1.out flipflop.3.set
- net not-xyz-enable not.2.out or2.0.in1
- #- The X and Y switches do not initialise to 127 at switch on, but read zero. They need to be pressed to set to 127
- #- so would jog in the minus direction when the jog enable button was pressed. This is prevented by
- #- flopflops to inhibit the gamepad X Y until X or Y jog key pressed initialises them
- net not-y-set-enable not.3.in or2.0.out
- net y-set-enable not.3.out
- net y-set-enable and2.20.in1 and2.18.in1
- net gamepad-x-init flipflop.2.out and2.8.in0
- net gamepad-y-init flipflop.3.out not.1.in
- net x-over wcomp.0.over and2.7.in0
- net x-over and2.16.in0
- net x-under wcomp.0.under and2.6.in0
- net x-under and2.15.in0
- net y-under wcomp.1.under and2.5.in0
- net y-under and2.14.in0
- net y-over wcomp.1.over and2.4.in0
- net y-over and2.13.in0
- #-- no jog without jog enable button. lower left rear button
- net xyz-jog-enable input.0.btn-base and2.3.in0
- net xyz-jog-enable and2.8.in1 not.2.in
- net x-set-enable and2.8.out
- net x-set-enable and2.9.in1 and2.17.in1
- net x-/+enable and2.6.in1 and2.9.out
- net x-/+enable and2.7.in1
- net y-set-enable not.3.out
- net y-set-enable and2.20.in1 and2.18.in1
- net y-/+enable and2.20.out
- net y-/+enable and2.4.in1 and2.5.in1
- #-- Z jog
- net plus-z-button input.0.btn-joystick xor2.0.in0
- net plus-z-button and2.2.in1 and2.12.in1
- net minus-z-button input.0.btn-thumb2 xor2.0.in1
- net minus-z-button and2.1.in1 and2.11.in1
- net z-button xor2.0.out and2.3.in1
- net z-enable and2.3.out and2.10.in0
- net z-enable and2.19.in1
- net z-jog-enable and2.1.in0 and2.10.out
- net z-jog-enable and2.2.in0
- net jog-enable and2.10.in1 not.4.out
- net jog-enable and2.20.in0 and2.9.in0
- #- switch jog/increment logic
- net inc/jog input.0.btn-top toggle.0.in
- net enable-inc not.4.in toggle.0.out
- net enable-inc and2.17.in0 and2.18.in0
- net enable-inc and2.19.in0
- #-
- net x-/+inc-enable and2.16.in1 and2.17.out
- net x-/+inc-enable and2.15.in1
- net y-/+inc-enable and2.14.in1 and2.18.out
- net y-/+inc-enable and2.13.in1
- net z-/+inc-enable and2.12.in0 and2.19.out
- net z-/+inc-enable and2.11.in0
- net x-jog-plus and2.7.out halui.jog.0.plus
- net x-jog-minus and2.6.out halui.jog.0.minus
- net y-jog-plus and2.5.out halui.jog.1.plus
- net y-jog-minus and2.4.out halui.jog.1.minus
- net z-jog-plus and2.2.out halui.jog.2.plus
- net z-jog-minus and2.1.out halui.jog.2.minus
- #--
- net axis-inc halui.jog.0.increment mux4.1.out
- net axis-inc halui.jog.1.increment halui.jog.2.increment
- net x-inc-plus and2.16.out halui.jog.0.increment-plus
- net x-inc-minus and2.15.out halui.jog.0.increment-minus
- net y-inc-plus and2.14.out halui.jog.1.increment-plus
- net y-inc-minus and2.13.out halui.jog.1.increment-minus
- net z-inc-plus and2.12.out halui.jog.2.increment-plus
- net z-inc-minus and2.11.out halui.jog.2.increment-minus
- #- Selected speed is displayed as a bar in the virtual control panel
- #net axis-jog-speed pyvcp.jog-speed
- #net jog-enable pyvcp.jog
- #net axis-inc pyvcp.increment-size
- #net enable-inc pyvcp.increment
- #net home-x pyvcp.xhome
- #net home-y pyvcp.yhome
- #net home-z pyvcp.zhome
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement