Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #######################################
- #
- # HAL file for HostMot2 with 3 steppers
- #
- # Derived from Ted Hyde's original hm2-servo config
- #
- # Based up work and discussion with Seb & Peter & Jeff
- # GNU license references - insert here. www.linuxcnc.org
- #
- #
- # ########################################
- # Firmware files are in /lib/firmware/hm2/7i43/
- # Must symlink the hostmot2 firmware directory of sanbox to
- # /lib/firmware before running EMC2...
- # sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
- #
- # See also:
- # <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
- # and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
- #
- # #####################################################################
- # ###################################
- # Core EMC/HAL Loads
- # ###################################
- # kinematics
- loadrt trivkins
- # motion controller, get name and thread periods from ini file
- loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
- # only the 7i43 needs this, but it doesnt hurt the others
- #loadrt probe_parport
- # hostmot2 driver
- loadrt hostmot2
- # load low-level driver
- loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
- setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000
- # Load Classic ladder module that runs in real time
- loadrt classicladder_rt numPhysInputs=32 numPhysOutputs=20 numS32in=10 numS32out=10 numFloatIn=10 numFloatOut=10
- loadrt not count=1
- # ################################################
- # THREADS
- # ################################################
- addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
- addf motion-command-handler servo-thread
- addf motion-controller servo-thread
- # revel in the free time here from not having to run PID
- addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
- addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
- addf not.0 servo-thread
- addf classicladder.0.refresh servo-thread
- # ######################################################
- # Axis-of-motion Specific Configs (not the GUI)
- # ######################################################
- # ################
- # X [0] Axis
- # ################
- # axis enable chain
- newsig emcmot.00.enable bit
- sets emcmot.00.enable FALSE
- net emcmot.00.enable <= axis.0.amp-enable-out
- net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable
- # position command and feedback
- net emcmot.00.pos-cmd <= axis.0.motor-pos-cmd
- net emcmot.00.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd
- net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb
- net motor.00.pos-fb => axis.0.motor-pos-fb
- # timing parameters
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold [AXIS_0]DIRHOLD
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen [AXIS_0]STEPLEN
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace [AXIS_0]STEPSPACE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale [AXIS_0]SCALE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0
- # ################
- # Y [1] Axis
- # ################
- # axis enable chain
- newsig emcmot.01.enable bit
- sets emcmot.01.enable FALSE
- net emcmot.01.enable <= axis.1.amp-enable-out
- net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable
- # position command and feedback
- net emcmot.01.pos-cmd <= axis.1.motor-pos-cmd
- net emcmot.01.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-cmd
- net motor.01.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-fb
- net motor.01.pos-fb => axis.1.motor-pos-fb
- # timing parameters
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirsetup [AXIS_1]DIRSETUP
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirhold [AXIS_1]DIRHOLD
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.steplen [AXIS_1]STEPLEN
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.stepspace [AXIS_1]STEPSPACE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-scale [AXIS_1]SCALE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxvel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxaccel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0
- # ################
- # Z [2] Axis
- # ################
- # axis enable chain
- newsig emcmot.02.enable bit
- sets emcmot.02.enable FALSE
- net emcmot.02.enable <= axis.2.amp-enable-out
- net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.02.enable
- # position command and feedback
- net emcmot.02.pos-cmd <= axis.2.motor-pos-cmd
- net emcmot.02.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-cmd
- net motor.02.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-fb
- net motor.02.pos-fb => axis.2.motor-pos-fb
- # timing parameters
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirsetup [AXIS_2]DIRSETUP
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirhold [AXIS_2]DIRHOLD
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.steplen [AXIS_2]STEPLEN
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.stepspace [AXIS_2]STEPSPACE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-scale [AXIS_2]SCALE
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxvel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxaccel 0
- setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.step_type 0
- #
- # The Mesa AnyIO output pins can be in open-drain mode (drive low, float
- # high) or push/pull mode (drive low, drive high).
- #
- # When a logical output is 1 in open-drain mode, the FPGA lets the pin
- # float and it gets pulled high to +5V via a 10K resistor.
- #
- # When a logical output is 1 in push/pull mode, the FPGA pushes the pin
- # high but only to +3.3V. This is problematic on some kinds of inputs.
- #
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_opendrain 1
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_opendrain 1
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_opendrain 1
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_opendrain 1
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.060.is_opendrain 1
- #setp hm2_[HOSTMOT2](BOARD).0.gpio.061.is_opendrain 1
- # hm2 pins 40-47 are outputs
- # hm2 pin 24-39 are inputs
- # external output signals
- # --- DOUT-00 --- Slitter knife down
- setp hm2_5i20.0.gpio.040.is_output true
- net dout-00 <= motion.digital-out-00
- net dout-00 => hm2_5i20.0.gpio.040.out
- # --- DOUT-01 --- Cutter knife down
- setp hm2_5i20.0.gpio.041.is_output true
- net dout-01 <= motion.digital-out-01
- net dout-01 => hm2_5i20.0.gpio.041.out => classicladder.0.in-03
- # net dout-01
- # --- DOUT-02 --- In cycle light (auto mode?)
- setp hm2_5i20.0.gpio.042.is_output true
- net dout-02 => hm2_5i20.0.gpio.042.out
- # --- DOUT-03 --- System ready ??
- setp hm2_5i20.0.gpio.043.is_output true
- net dout-03 => hm2_5i20.0.gpio.043.out
- # --- DOUT-04 ---
- setp hm2_5i20.0.gpio.044.is_output true
- net dout-04 => hm2_5i20.0.gpio.044.out
- # --- DOUT-05 ---
- setp hm2_5i20.0.gpio.045.is_output true
- net dout-05 => hm2_5i20.0.gpio.045.out
- # --- DOUT-06 ---
- setp hm2_5i20.0.gpio.046.is_output true
- net dout-06 => hm2_5i20.0.gpio.046.out
- # ----DOUT-07---
- setp hm2_5i20.0.gpio.047.is_output true
- net enable => hm2_5i20.0.gpio.047.out
- # **** Setup for external estop ladder program -START ****
- net estop-out <= iocontrol.0.user-enable-out
- net estop-out => classicladder.0.in-00
- net estop-ext hm2_5i20.0.gpio.024.in => classicladder.0.in-01
- # When the operator clicks on the Estop button when the system is in Estop, the user-request-enable bit flashes on
- net estop-strobe classicladder.0.in-02 <= iocontrol.0.user-request-enable
- net estop-outcl classicladder.0.out-00 => iocontrol.0.emc-enable-in
- # **** Setup for external estop ladder program -END ****
- # --- DIN-01 --- Cutter knife down switch
- net din-01 <= hm2_5i20.0.gpio.025.in
- net din-01 => motion.digital-in-00
- # => classicladder.0.in-03
- # --- DIN-02 --- Cutter knife up switch
- net din-02 <= hm2_5i20.0.gpio.026.in
- #net din-02 => motion.digital-in-01 => classicladder.0.in-04
- # --- DIN-03 --- Slitter knife down switch
- net din-03 <= hm2_5i20.0.gpio.027.in
- net din-03 => classicladder.0.in-05
- # --- DIN-04 --- Sliter knife up switch
- net din-04 <= hm2_5i20.0.gpio.028.in
- net din-04 => classicladder.0.in-06
- # --- DIN-05 ---
- # --- JOG-X-POS ---
- net jog-x-pos <= hm2_5i20.0.gpio.029.in
- net jog-x-pos => halui.jog.0.plus
- # --- DIN-06 ---
- # --- JOG-X-NEG ---
- net jog-x-neg <= hm2_5i20.0.gpio.030.in
- net jog-x-neg halui.jog.0.minus
- # --- DIN-07 ---
- # --- JOG-Y-POS ---
- net jog-y-pos <= hm2_5i20.0.gpio.031.in
- net jog-y-pos halui.jog.1.plus
- # --- DIN-08 ---
- # --- JOG-Y-NEG ---
- net jog-y-neg <= hm2_5i20.0.gpio.032.in
- net jog-y-neg halui.jog.1.minus
- # --- DIN-09 ---
- # --- JOG-Z-POS ---
- net jog-z-pos <= hm2_5i20.0.gpio.033.in
- net jog-z-pos halui.jog.2.plus
- # --- DIN-10 ---
- # --- JOG-Z-NEG ---
- net jog-z-neg <= hm2_5i20.0.gpio.034.in
- net jog-z-neg halui.jog.2.minus
- # --- DIN-11 ---
- # --- DIN-12 ---
- # --- DIN-13 ---
- # --- DIN-14 ---
- net din-14 <= hm2_5i20.0.gpio.038.in
- net din-14 => motion.digital-in-02
- # --- DIN-15 ---
- net din-15 <= hm2_5i20.0.gpio.039.in
- net din-15 => motion.digital-in-03
- # COUNTER RESET BIT FROM GCODE TO LADDER COUNTER
- net count_rst motion.digital-out-02 => classicladder.0.in-07
- net enable => motion.motion-enabled
- # 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
- ### Added with Classic ladder interface
- # Load Classicladder without GUI (can reload LADDER GUI in AXIS GUI
- # without classic ladder gui
- #loadusr classicladder --nogui custom.clp
- # with classic ladder gui
- loadusr classicladder custom.clp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement