mesa 7i77 m code relay wiring

More
08 Jun 2013 17:03 #35447 by edscrane1
I have linuxcnc set up with the encoders and servo motors working, but am new to writing in HAL.

These have been set by altering a preconfigured 5i25 7i77 file to set the limits and tune the servos, as PncConf will not load the firmware for the 5i25 board, even after loading the files in to hm2.

Is there an easily understandable way to learn how to set up the output pins on the 7i77 board to activate a 24volt relay when m3 is programmed, then stop when m5 is entered.

This should teach me how to then add further functions.

Thanks again for any help.

Please Log in or Create an account to join the conversation.

More
08 Jun 2013 17:19 - 08 Jun 2013 17:21 #35448 by cncbasher
as M3 and M5 start and stop the spindle then find the following line and add link for spindle-on signal to your relay pin

find:
net spindle-on motion-spindle-on

and add the relay pin as follows to the end :

net spindle-on motion-spindle-on => hm2-5i25.0.7i77.0.0.output-00 ( presuming pin 0 on 7i77 i.e -00 )

or you could add
as a separate line
net spindle-on =>hm2-5i25.0.7i77.0.0.output-00
Last edit: 08 Jun 2013 17:21 by cncbasher.
The following user(s) said Thank You: edscrane1

Please Log in or Create an account to join the conversation.

More
08 Jun 2013 18:18 #35451 by BigJohnT

I have linuxcnc set up with the encoders and servo motors working, but am new to writing in HAL.


To get a grasp of HAL I wrote a short tutorial for the manual.

HAL programming is rather simple and is executed line by line in the order that you enter them.

JT
The following user(s) said Thank You: edscrane1

Please Log in or Create an account to join the conversation.

More
09 Jun 2013 21:47 #35459 by edscrane1
Thank you for the replies.

I am nearly there but cannot get this right.

Tried writing net spindle-on motion-spindle-on => hm2-5i25.0.7i77.0.0.output-00
and
net spindle-on =>hm2-5i25.0.7i77.0.0.output-00

as a line in hm2-servo7i77.hal

The line was written between tool change and homing, but this causes linuxcnc to open with an error.

I have opened the Hal configuration file from linuxcnc and watched the spindle forward and spindle on pins.

These change to yellow when the mdi command s1000 m3 is entered , then back to red when m5 is entered.

Am I writing the net command in the wrong file, wrong place, or the wrong way

Please Log in or Create an account to join the conversation.

More
09 Jun 2013 22:40 #35460 by edscrane1
Do I need to create a motion spindle on thread first?

Please Log in or Create an account to join the conversation.

More
09 Jun 2013 22:54 #35461 by ArcEye
Hi

The line was written between tool change and homing, but this causes linuxcnc to open with an error.


The error message will tell you what is wrong, if you don't understand it, post it .

Easiest way is to open a terminal and type linuxcnc and select your config, then all the errors will be printed to the terminal

regards

Please Log in or Create an account to join the conversation.

More
10 Jun 2013 00:24 - 10 Jun 2013 00:25 #35466 by cncbasher
post your hal and ini files , let have a look
can you also give details of the error
Last edit: 10 Jun 2013 00:25 by cncbasher.

Please Log in or Create an account to join the conversation.

More
10 Jun 2013 01:35 #35467 by edscrane1
Error message

Machine configuration file is '5i25-7i77.ini'
Starting LinuxCNC...
emc/iotask/ioControl.cc 752: can't load tool table.
hm2-servo7i77.hal:221: 'net' requires at least one pin, none given
Shutting down and cleaning up LinuxCNC...
Cleanup done
LinuxCNC terminated with an error. You can find more information in the log:
/home/edward/linuxcnc_debug.txt
and
/home/edward/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
edward@edward-desktop:~$

HAL FILE
#######################################
#
# HAL file for HostMot2 with 3 smart serial analog servos
#
# 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:
# <www.linuxcnc.org/docs/devel/html/man/man...ml#config%20modparam>
# and 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

# standard components
loadrt pid num_chan=3


# hostmot2 driver
# if you have any firmware trouble, enable the debug flags here and see what's going on in the syslog
loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 debug_pin_descriptors=1 debug_modules=1
#loadrt hostmot2

# load low-level driver
loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)


setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000


# ################################################
# THREADS
# ################################################

addf hm2_[HOSTMOT2](BOARD).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_[HOSTMOT2](BOARD).0.write servo-thread
addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog 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 => pid.0.enable
net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogena
net emcmot.00.enable <= axis.0.amp-enable-out

# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0

setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).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_OUTPUT

# position command signals

# setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout0-scalemax [AXIS_0]OUTPUT_SCALE

net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout0


# ################
# 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 <= axis.1.amp-enable-out

# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0

setp hm2_[HOSTMOT2](BOARD).0.encoder.01.scale [AXIS_1]INPUT_SCALE
net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).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_OUTPUT

# position command signals

# setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout1-scalemax [AXIS_1]OUTPUT_SCALE

net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout1


# ################
# 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 <= axis.2.amp-enable-out

# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask-invert 0

setp hm2_[HOSTMOT2](BOARD).0.encoder.02.scale [AXIS_2]INPUT_SCALE
net motor.02.pos-fb hm2_[HOSTMOT2](BOARD).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_OUTPUT

# position command signals

# setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout2-scalemax [AXIS_3]OUTPUT_SCALE

net motor.02.command pid.2.output => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout2
net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command



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




#
# homing
#


net home-switch <= hm2_[HOSTMOT2](BOARD).0.7i77.0.0.input-00
net home-switch => axis.0.home-sw-in
net home-switch => axis.1.home-sw-in
net home-switch => axis.2.home-sw-in

# only the Y servo has an index, X and Z home without using the index
net y-index-enable hm2_[HOSTMOT2](BOARD).0.encoder.01.index-enable <=> axis.1.index-enable

net spindle-on =>hm2-5i25.0.7i77.0.0.output-01

INI FILE


[HOSTMOT2]
DRIVER=hm2_pci
BOARD=5i25
CONFIG="num_encoders=6 sserial_port_0=000xxx"




[EMC]

# Name of machine, for use with display, etc.
MACHINE = HM2-Servo

# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#DEBUG = 0x00000003
#DEBUG = 0x00000007
DEBUG = 0x0



[DISPLAY]

# Name of display program, e.g., 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

# Prefix to be used
PROGRAM_PREFIX = ../../nc_files/

# Introductory graphic
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 5


[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python


[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




[RS274NGC]

# File containing interpreter variables
PARAMETER_FILE = hm2-servo.var




[EMCMOT]

EMCMOT = motmod

# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0

# Interval between tries to emcmot, in seconds
COMM_WAIT = 0.010

# Servo task period, in nanoseconds
SERVO_PERIOD = 1000000




[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 = hm2-servo7i77.hal

# list of halcmd commands to execute
# commands are executed in the order in which they appear
#HALCMD = save neta




[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




[AXIS_0]

TYPE = LINEAR
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 4.0
BACKLASH = 0.000
FERROR = 1.000
MIN_FERROR = 1.000

INPUT_SCALE = 2000

OUTPUT_SCALE = -1.000
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 10

MIN_LIMIT = -9.0
MAX_LIMIT = 10.0
HOME = 0.000
HOME_OFFSET = 0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
# the X axis servo's encoder does not have an index channel, so we have to home without index
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES

# PID tuning params
DEADBAND = 0.002
P = 10
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0




[AXIS_1]

TYPE = LINEAR
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 4.0
BACKLASH = 0.000
FERROR = 1.000
MIN_FERROR = 1.000

INPUT_SCALE = -2000

OUTPUT_SCALE = 1.000
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 10

MIN_LIMIT = -3.0
MAX_LIMIT = 10.0
HOME = 0.000
HOME_OFFSET = 0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
# the Y axis servo's encoder has an index channel, so we use it to improve the home accuracy
HOME_USE_INDEX = YES
HOME_IGNORE_LIMITS = YES

# PID tuning params
DEADBAND = 0.002
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0




[AXIS_2]

TYPE = LINEAR
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 4.0
BACKLASH = 0.000
FERROR = 0.50
MIN_FERROR = 0.50

INPUT_SCALE = 2000

OUTPUT_SCALE = -1.000
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 10

MIN_LIMIT = -5.0
MAX_LIMIT = 0.7
HOME = 0.0
HOME_OFFSET = 0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
# the Z axis servo's encoder does not have an index channel, so we have to home without index
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES

# PID tuning params
DEADBAND = 0.002
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0




[EMCIO]

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

# cycle time, in seconds
CYCLE_TIME = 0.100

# tool table file
TOOL_TABLE = tool.tbl

Please Log in or Create an account to join the conversation.

More
10 Jun 2013 01:46 - 10 Jun 2013 01:50 #35469 by cncbasher
i see at least 2 problems ...

emc/iotask/ioControl.cc 752: can't load tool table.
hm2-servo7i77.hal:221: 'net' requires at least one pin, none given

I also do not see any pins relating to spindle speed or pwm control etc , can you let me know what type of spindle control you need etc ,
is it a vfd or just a dc motor etc ,

and i'll try and put together some corrected files
are you using 2.5.2 from the live cd or some other version ? ,

do you indeed have a file called tool.tbl in your configuration folder ?
Last edit: 10 Jun 2013 01:50 by cncbasher.

Please Log in or Create an account to join the conversation.

More
10 Jun 2013 06:06 #35477 by edscrane1
The spindle motor is a three phase motor with manual hi / low and manual variable speed, so the original 24volt relay will be used to switch the contactor.

The machine is a Beaver NC5 that had the anilam GXM control before conversion to Linux.

I can open the tool table if the net spindle motion line is removed, but have not got as far as filling it in yet.

The version is 2.5.2 from the live cd

Please Log in or Create an account to join the conversation.

Time to create page: 0.096 seconds
Powered by Kunena Forum