Sebastian

I should have said the encoders are working when I turn the motors by hand. I 
don't have the amps plugged into the backplane. I have the X and Y motors 
disconnected from the ball screws. 

I haved used the halmeter. I can't seam to get the limit inputs either. They 
are 5 volt prox switches that have a seperate set on Opto couplers that feed to 
the servo amps. 

Now were do I set ".is_output " to true at?

I pasted the Hal file and ini file

Donnie

hal file

# #######################################

#

# Combination Hal file for m5i23 - TESTING

# Rev 1.0

# 20 Oct 2008

# T.Hyde - CasaFrog

#

# Based up work and discussion with Seb & Peter & Jeff

# GNU license references - insert here. www.linuxcnc.org

#

#

# ########################################

# Firmware files are in /lib/firmware/hm2/5i23/

# 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 base_period_nsec=[EMCMOT]BASE_PERIOD 
servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD 
key=[EMCMOT]SHMEM_KEY num_joints=[TRAJ]AXES

# standard components

loadrt pid num_chan=3 

# only the 7i43 needs this, but it doesnt hurt the others

loadrt probe_parport

# hostmot2 driver

loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 
debug_pin_descriptors=1 debug_modules=1

# 5i23 driver and firmware load from sandbox

loadrt hm2_pci config="firmware=hm2/5i23/SVST4_8.BIT num_encoders=3 
num_pwmgens=3 num_stepgens=1"

# 5i23 PWMGen base frequency

setp hm2_5i23.0.pwmgen.pwm_frequency 40000

# 5i23 watchdog, enable only if loaded firmware supports it

#setp hm2_5i23.0.watchdog.timeout_ns 10000000



# ################################################

# THREADS

# ################################################

# hook functions to servo thread

addf hm2_5i23.0.read servo-thread

addf motion-command-handler servo-thread

addf motion-controller servo-thread

addf pid.0.do-pid-calcs servo-thread

addf pid.1.do-pid-calcs servo-thread

addf pid.2.do-pid-calcs servo-thread

addf hm2_5i23.0.write servo-thread

#addf hm2_5i23.0.pet_watchdog servo-thread #enable if fw supported


# ######################################################

# 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 => pid.0.enable

net emcmot.00.enable => hm2_5i23.0.pwmgen.00.enable

net emcmot.00.enable <= axis.0.amp-enable-out 

# encoder feedback

setp hm2_5i23.0.encoder.00.counter-mode 0

setp hm2_5i23.0.encoder.00.filter 1

setp hm2_5i23.0.encoder.00.index-invert 0

setp hm2_5i23.0.encoder.00.index-mask 0

setp hm2_5i23.0.encoder.00.index-mask-invert 0

setp hm2_5i23.0.encoder.00.scale 20000

net motor.00.pos-fb hm2_5i23.0.encoder.00.position => pid.0.feedback

net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI

# set PID loop gains from inifile

setp pid.0.Pgain [AXIS_0]P

setp pid.0.Igain [AXIS_0]I

setp pid.0.Dgain [AXIS_0]D

setp pid.0.bias [AXIS_0]BIAS

setp pid.0.FF0 [AXIS_0]FF0

setp pid.0.FF1 [AXIS_0]FF1

setp pid.0.FF2 [AXIS_0]FF2

setp pid.0.deadband [AXIS_0]DEADBAND

setp pid.0.maxoutput [AXIS_0]MAX_VELOCITY

# position command signals

setp hm2_5i23.0.pwmgen.00.output-type 1 #pwm on pin1, dir on pin2

setp hm2_5i23.0.pwmgen.00.scale 1.0

net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command

net motor.00.command pid.0.output => hm2_5i23.0.pwmgen.00.value

# Connect limit/home switch outputs to motion controller.

newsig Xminlim bit

newsig Xmaxlim bit

#newsig Xhome bit

#net axis.0.neg-lim-sw-in hm2_5i23.0.gpio.P3.024.in 

linksp Xminlim => axis.0.neg-lim-sw-in

linksp Xminlim <= hm2_5i23.0.gpio.P3.034.in

#net axis.0.neg-lim-sw-in hm2_5i23.0.gpio.P3.025.in 

linksp Xmaxlim => axis.0.pos-lim-sw-in

linksp Xmaxlim <= hm2_5i23.0.gpio.P3.035.in

#linksp Xhome <= hm2_5i23.0.in-02 

#linksp Xhome => axis.0.home-sw-in

# Connect amp faults to motion controller.

#newsig Xfault bit

#linksp Xfault <= hm2_5i23.0.in-03-not

#linksp Xfault => axis.0.amp-fault-in

# ################

# Y [1] Axis

# ################

# axis enable chain

newsig emcmot.01.enable bit

sets emcmot.01.enable FALSE

net emcmot.01.enable => pid.1.enable

net emcmot.01.enable => hm2_5i23.0.pwmgen.01.enable

net emcmot.01.enable <= axis.1.amp-enable-out 

# encoder feedback

setp hm2_5i23.0.encoder.01.counter-mode 0

setp hm2_5i23.0.encoder.01.filter 1

setp hm2_5i23.0.encoder.01.index-invert 0

setp hm2_5i23.0.encoder.01.index-mask 0

setp hm2_5i23.0.encoder.01.index-mask-invert 0

setp hm2_5i23.0.encoder.01.scale 20000

net motor.01.pos-fb hm2_5i23.0.encoder.01.position => pid.1.feedback

net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI

# set PID loop gains from inifile

setp pid.1.Pgain [AXIS_1]P

setp pid.1.Igain [AXIS_1]I

setp pid.1.Dgain [AXIS_1]D

setp pid.1.bias [AXIS_1]BIAS

setp pid.1.FF0 [AXIS_1]FF0

setp pid.1.FF1 [AXIS_1]FF1

setp pid.1.FF2 [AXIS_1]FF2

setp pid.1.deadband [AXIS_1]DEADBAND

setp pid.1.maxoutput [AXIS_1]MAX_VELOCITY

# position command signals

setp hm2_5i23.0.pwmgen.01.output-type 1 #pwmaxis.0.home-sw-in on pin1, dir on 
pin2

setp hm2_5i23.0.pwmgen.01.scale 1.0

net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command

net motor.01.command pid.1.output => hm2_5i23.0.pwmgen.01.value

# Connect limit/home linksp Xmaxlim =>switch outputs to motion controller.

newsig Yminlim bit

newsig Ymaxlim bit

#newsig Yhome bit

#net axis.1.neg-lim-sw-in hm2_5i23.0.gpio.P3.026.in

#net axis.1.pos-lim-sw-in hm2_5i23.0.gpio.P3.037.in









linksp Yminlim <= hm2_5i23.0.gpio.P3.036.in

linksp Yminlim => axis.1.neg-lim-sw-in

linksp Ymaxlim <= hm2_5i23.0.gpio.P3.037.in

linksp Ymaxlim => axis.1.pos-lim-sw-in



#linksp Yhome <= hm2_5i23.0.in-06

#linksp Yhome => axis.1.home-sw-in



# Connect amp faults to motion controller.

#newsig Yfault bit

#linksp Yfault <= hm2_5i23.0.in-07-not

#linksp Yfault => axis.1.amp-fault-in

# ################

# Z [2] Axis

# ################

# axis enable chain

newsig emcmot.02.enable bit

sets emcmot.02.enable FALSE

net emcmot.02.enable => pid.2.enable

net emcmot.02.enable => hm2_5i23.0.pwmgen.02.enable

net emcmot.02.enable <= axis.2.amp-enable-out 

# encoder feedback

setp hm2_5i23.0.encoder.02.counter-mode 0

setp hm2_5i23.0.encoder.02.filter 1

setp hm2_5i23.0.encoder.02.index-invert 0

setp hm2_5i23.0.encoder.02.index-mask 0

setp hm2_5i23.0.encoder.02.index-mask-invert 0

setp hm2_5i23.0.encoder.02.scale 20000

net motor.02.pos-fb hm2_5i23.0.encoder.02.position => pid.2.feedback

net motor.02.pos-fb => axis.2.motor-pos-fb #push copy back to Axis GUI

# set PID loop gains from inifile

setp pid.2.Pgain [AXIS_2]P

setp pid.2.Igain [AXIS_2]I

setp pid.2.Dgain [AXIS_2]D

setp pid.2.bias [AXIS_2]BIAS

setp pid.2.FF0 [AXIS_2]FF0

setp pid.2.FF1 [AXIS_2]FF1

setp pid.2.FF2 [AXIS_2]FF2

setp pid.2.deadband [AXIS_2]DEADBAND

setp pid.2.maxoutput [AXIS_2]MAX_VELOCITY

# position command signals

setp hm2_5i23.0.pwmgen.02.output-type 1 #pwm on pin1, dir on pin2

setp hm2_5i23.0.pwmgen.02.scale 1.0

net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command

net motor.02.command pid.2.output => hm2_5i23.0.pwmgen.02.value

# Connect limit/home switch outputs to motion controller.

newsig Zminlim bit

newsig Zmaxlim bit

#newsig Zhome bit

#net axis.2.neg-lim-sw-in hm2_5i23.0.gpio.P3.028.in

#net axis.2.pos-lim-sw-in hm2_5i23.0.gpio.P3.029.in

linksp Zminlim <= hm2_5i23.0.gpio.P3.038.in

linksp Zminlim => axis.2.neg-lim-sw-in

linksp Zmaxlim <= hm2_5i23.0.gpio.P3.039.in

linksp Zmaxlim => axis.2.pos-lim-sw-in

#linksp Zhome <= hm2_5i23.0.in-10

#linksp Zhome => axis.2.home-sw-in

# Connect amp faults to motion controller.

#newsig Zfault bit

#linksp Zfault <= hm2_5i23.0.in-11-not

#linksp Zfault => axis.2.amp-fault-in



# ##################################################

# Standard I/O Block - EStop, Etc

# ##################################################

# 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

net spindle-fwd motion.spindle-forward

net spindle-rev motion.spindle-reverse

net spindle-speed motion.spindle-speed-out

newsig EstopSense bit

newsig EstopWrite bit

# create a signal for the estop loopback -- remove for external

net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in

# use this if you have an external estop switch

# linksp EstopSense <= hm2_5i23.0.estop-in-not

# linksp EstopSense <= hm2_5i23.0.in-15

# linksp EstopSense => iocontrol.0.emc-enable-in

# linksp EstopWrite => hm2_5i23.0.out-07

# linksp EstopWrite <= iocontrol.0.user-enable-out

# Connect spindle fwd/rev to I/O controller.

#newsig SpindleFwd bit

#newsig SpindleRev bit

#linksp SpindleFwd => hm2_5i23.0.out-00

#linksp SpindleFwd <= motion.spindle-forward

#linksp SpindleRev => hm2_5i23.0.out-01

#linksp SpindleRev <= motion.spindle-reverse

# Connect spindle brake to I/O controller.

#

newsig SpindleBrakeOn bit

linksp SpindleBrakeOn <= motion.spindle-brake

linksp SpindleBrakeOn => hm2_5i23.0.gpio.P3.042.out







#net motion.spindle-brake hm2_5i23.0.gpio.P3.042.out

# Connect mist/flood coolant to I/O controller.

newsig MistOn bit

#newsig FloodOn bit

linksp MistOn <= iocontrol.0.coolant-mist

linksp MistOn => hm2_5i23.0.gpio.P3.041.out

#net iocontrol.0.coolant-mist hm2_5i23.0.gpio.P3.041.out

#linksp FloodOn => hm2_5i23.0.out-06

#linksp FloodOn <= iocontrol.0.coolant-flood





Ini file



# EMC controller parameters for generic controller. Make these what you need

# for your system.

# General note: Comments can either be preceded with a # or ; - either is

# acceptable, although # is in keeping with most linux config files.

# General section -------------------------------------------------------------

[EMC]

# Version of this INI file

VERSION = $Revision: 1.1.4.1 $

# Name of machine, for use with display, etc.

MACHINE = EMC-MESA-5i23

# Name of NML file to use, default is emc.nml

NML_FILE = emc.nml

# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others

#DEBUG = 0x00000003

#DEBUG = 0x00000007

DEBUG = 0

# Sections for display options ------------------------------------------------

[DISPLAY]

# Name of display program, e.g., tkemc

#DISPLAY = tkemc

DISPLAY = axis

# Cycle time, in seconds, that display will sleep between polls

CYCLE_TIME = 0.0500

# Path to help file

HELP_FILE = tkemc.txt

# Initial display setting for position, RELATIVE or MACHINE

POSITION_OFFSET = RELATIVE

# Initial display setting for position, COMMANDED or ACTUAL

POSITION_FEEDBACK = ACTUAL

# Highest value that will be allowed for feed override, 1.0 = 100%

MAX_FEED_OVERRIDE = 1.5

MAX_SPINDLE_OVERRIDE = 1.0

# Prefix to be used

PROGRAM_PREFIX = /home/donnie/emc2/nc_files

# Introductory graphic

INTRO_GRAPHIC = emc2.gif

INTRO_TIME = 5

# Task controller section -----------------------------------------------------

[TASK]

# Name of task controller program, e.g., milltask

TASK = milltask

# Cycle time, in seconds, that task controller will sleep between polls

CYCLE_TIME = 0.010

# Part program interpreter section --------------------------------------------

[RS274NGC]

# File containing interpreter variables

PARAMETER_FILE = m5i23.var

# Motion control section ------------------------------------------------------

[EMCMOT]

EMCMOT = motmod

# Key for real OS shared memory, e.g., for simulated motion

SHMEM_KEY = 101

# Timeout for comm to emcmot, in seconds

COMM_TIMEOUT = 1.0

# Interval between tries to emcmot, in seconds

COMM_WAIT = 0.010

# Base task period, in nanoseconds - this is the fastest thread in the machine

BASE_PERIOD = 500000

# Servo task period, in nanoseconds - will be rounded to an integer multiple

# of BASE_PERIOD

SERVO_PERIOD = 1000000

# Trajectory Planner task period, in nanoseconds - will be rounded to an

# integer multiple of SERVO_PERIOD

TRAJ_PERIOD = 10000000

# Hardware Abstraction Layer section 
--------------------------------------------------

[HAL]

# The run script first uses halcmd to execute any HALFILE

# files, and then to execute any individual HALCMD commands.

# list of hal config files to run through halcmd

# files are executed in the order in which they appear

HALFILE = m5i23.hal

# list of halcmd commands to execute

# commands are executed in the order in which they appear

#HALCMD = save neta

# Trajectory planner section --------------------------------------------------

[TRAJ]

AXES = 3

# COORDINATES = X Y Z R P W

COORDINATES = X Y Z

HOME = 0 0 0 0

LINEAR_UNITS = inch

ANGULAR_UNITS = degree

CYCLE_TIME = 0.010

DEFAULT_VELOCITY = 3.0

MAX_VELOCITY = 4.0

DEFAULT_ACCELERATION = 6.0

MAX_ACCELERATION = 7.0

# Axes sections ---------------------------------------------------------------

# First axis

[AXIS_0]

TYPE = LINEAR

HOME = 0.000

MAX_VELOCITY = 1.0

MAX_ACCELERATION = 4.0

BACKLASH = 0.000

INPUT_SCALE = 81920

OUTPUT_SCALE = 1.000

OUTPUT_OFFSET = 0.0

MIN_LIMIT = -32.0

MAX_LIMIT = 0.0

FERROR = 1.000

MIN_FERROR = 0.002

HOME_OFFSET = 0.10

HOME_SEARCH_VEL = 0.10

HOME_LATCH_VEL = -0.01

HOME_USE_INDEX = YES

HOME_IGNORE_LIMITS = YES

MAX_OUTPUT = 1.0

# PID tuning params

DEADBAND = 0.000015

P = 100.0

I = 0.000

D = 0.000

FF0 = 0.000

FF1 = 1.000

FF2 = 0.0

BIAS = 0.000

# Second axis

[AXIS_1]

TYPE = LINEAR

HOME = 0.000

MAX_VELOCITY = 1.0

MAX_ACCELERATION = 4.0

BACKLASH = 0.000

INPUT_SCALE = -81920

OUTPUT_SCALE = 1.000

OUTPUT_OFFSET = 0.0

MIN_LIMIT = -14.0

MAX_LIMIT = 0.0

FERROR = 0.020

MIN_FERROR = 0.001

HOME_OFFSET = 0.10

HOME_SEARCH_VEL = 0.10

HOME_LATCH_VEL = -0.01

HOME_USE_INDEX = YES

HOME_IGNORE_LIMITS = YES

MAX_OUTPUT = 1.0

# PID tuning params

DEADBAND = 0.000015

P = 100.0

I = 0.000

D = 0.000

FF0 = 0.000

FF1 = 1.000

FF2 = 0.0

BIAS = 0.000

# Third axis

[AXIS_2]

TYPE = LINEAR

HOME = 0.0

MAX_VELOCITY = 1.0

MAX_ACCELERATION = 4.0

BACKLASH = 0.000

INPUT_SCALE = 81920

OUTPUT_SCALE = 1.000

OUTPUT_OFFSET = 0.0

MIN_LIMIT = -6.0

MAX_LIMIT = 0.0

FERROR = 0.020

MIN_FERROR = 0.001

HOME_OFFSET = 0.10

HOME_SEARCH_VEL = 0.10

HOME_LATCH_VEL = -0.01

HOME_USE_INDEX = YES

HOME_IGNORE_LIMITS = YES

MAX_OUTPUT = 1.0

# PID tuning params

DEADBAND = 0.000015

P = 100.0

I = 0.000

D = 0.000

FF0 = 0.000

FF1 = 1.000

FF2 = 0.0

BIAS = 0.000

# section for main IO controller parameters -----------------------------------

[EMCIO]

# Name of IO controller program, e.g., io

EMCIO = io

# cycle time, in seconds

CYCLE_TIME = 0.100

# tool table file

TOOL_TABLE = m5i23.tbl

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to