Multiple Axes Homing 1 Input

More
11 Nov 2012 15:01 #26450 by tjb1
Im having problems figuring out how to get my machine to home using 1 input, I did some research and found a similar post and JTs solution using xor2 and I did manage to get it to work...sort of but now it ignores limits completely. Anyone coming in that isnt sure what I am talking about, here is an example.

Start homing of Z axis for instance, machine travels to home Z, when switch is tripped it is seeing it not only as Z home input but also as X and Y limits and this is stopping the homing. HOME_IS_SHARED did nothing using both 0 and 1. I will post my HAL file below, the xor2 commands in question are at the very end. The problem I seem to have and not be able to fix is I had to rename certain ones, "limit-to-x and limit-to-z". I get an error if they are called "both-home-all". Im horrible at coding and anything to do with coding, horribly slow at learning it and dont retain much of it so I am going to use the forum instead of IRC for these "big" questions now.

I will also need this to work for axis 1, I just never got around to playing with that since I couldnt get 0 and 2 to work together properly.

# Generated by stepconf at Sat Nov 10 19:45:20 2012
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt xor2 count=2

loadrt hal_parport cfg="0x378 out "
setp parport.0.reset-time 1000
loadrt stepgen step_type=0,0,0
loadrt charge_pump
net estop-out charge-pump.enable iocontrol.0.user-enable-out
net charge-pump <= charge-pump.out

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf charge-pump base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd <= motion.spindle-speed-out
net spindle-cw <= motion.spindle-forward

net probe-in => motion.probe-input

net estop-out => parport.0.pin-01-out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net xstep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
setp parport.0.pin-09-out-invert 1
net xdir => parport.0.pin-09-out
net spindle-cw => parport.0.pin-14-out
net charge-pump => parport.0.pin-16-out
net xenable => parport.0.pin-17-out


net both-home-all <= parport.0.pin-10-in-not
net probe-in <= parport.0.pin-12-in-not


setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 15200
setp stepgen.0.dirsetup 15200
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net both-home-all => axis.0.home-sw-in
net limit-to-x => axis.0.neg-lim-sw-in
net limit-to-x => axis.0.pos-lim-sw-in


setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 15200
setp stepgen.1.dirsetup 15200
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable

setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 15200
setp stepgen.2.dirsetup 15200
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable
net both-home-all => axis.2.home-sw-in
net limit-to-z => axis.2.neg-lim-sw-in
net limit-to-z => axis.2.pos-lim-sw-in


net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared



net homing-x xor2.0.in0 <= axis.0.homing
net both-home-all xor2.0.in1
net limit-to-z xor2.0.out => axis.2.neg-lim-sw-in axis.2.pos-lim-sw-in
net both-home-all => axis.0.home-sw-in


net homing-z xor2.1.in0 <= axis.2.homing
net both-home-all xor2.1.in1
net limit-to-x xor2.1.out => axis.0.neg-lim-sw-in axis.0.pos-lim-sw-in
net both-home-all => axis.2.home-sw-in

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

More
12 Nov 2012 18:08 - 12 Nov 2012 18:11 #26476 by cncbasher
try this

loadrt lut5
addf lut5.0 servo-thread


net all-limit-home <= parport.0.pin-10-in

setp lut5.0.function 0x10000
net all-limit-home => lut5.0.in-4
net all-limit <= lut5.0.out
net homing-x <= axis.0.homing => lut5.0.in-0
net homing-y <= axis.1.homing => lut5.0.in-1
net homing-z <= axis.2.homing => lut5.0.in-2

and add for each axis .....
net all-limit-home => axis.0.home-sw-in
net all-limit => axis.0.neg-lim-sw-in
net all-limit => axis.0.pos-lim-sw-in





this takes one input for homing and limits ..
Last edit: 12 Nov 2012 18:11 by cncbasher.
The following user(s) said Thank You: tjb1

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

More
12 Nov 2012 22:21 #26486 by tjb1
Replied by tjb1 on topic Multiple Axes Homing 1 Input
Thanks, I will give that a shot when I get home Wednesday.

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

More
17 Nov 2012 10:43 #26696 by tjb1
Replied by tjb1 on topic Multiple Axes Homing 1 Input
I thought I already posted today...but this did not work for me. It homes fine but none of the limits work. It just blows by all limits and nothing happens.

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

More
17 Nov 2012 17:41 #26701 by cncbasher
how are your switches wired ... all in series between ground and pin , or in parallel ? are all contacts normaly closed etc

post your hal and ini file

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

More
06 Dec 2012 06:40 #27267 by tjb1
Replied by tjb1 on topic Multiple Axes Homing 1 Input
Sorry cncbasher, I haven't been ignoring you just really busy now. My switches are all NPN proximity sensors, all wired in parallel. They pull output to ground for the G540, they share ground with G540 psu and their own psu and everything else in the box. I'll post my HAL and INI file later today if I remember so others have the benefit of knowing how but I am not going to use homing anymore. I've figured it is a waste of time on my machine and I am just going to use the switches as limits and just touch off whenever I start, chances of running to the end of the axis are slim and I have safeguards in place to prevent most damage so I don't really need soft limits.

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

More
06 Dec 2012 09:44 #27280 by andypugh

I am not going to use homing anymore. I've figured it is a waste of time on my machine and I am just going to use the switches as limits and just touch off whenever I start

I really doubt that this is the best way to work. Homing is hardly onerous, and saves a lot of bother.
I don't want to cause offence, but if you have the switches and think that not homing to them is less trouble, then you don't understand some important stuff.

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

More
06 Dec 2012 20:54 #27301 by BigJohnT
I feel the same way as Andy about homing...

John

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

Time to create page: 0.306 seconds
Powered by Kunena Forum