Gentlemen, This works!!!!! I have had it running for the past week, but I was hoping to have time to get the rest of the limit/home switches installed before I posted this.
<hal> # Generated by stepconf at Thu Apr 9 23:04:57 2009 # 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 traj_period_nsec=[EMCMOT]SERVO_PERIOD key=[EMCMOT]SHMEM_KEY num_joints=[TRAJ]AXES loadrt probe_parport loadrt hal_parport cfg=0x378 setp parport.0.reset-time 5000 loadrt stepgen step_type=0,0,0 loadrt and2 count=3 loadrt or2 count=3 loadrt not count=1 addf and2.0 base-thread addf and2.1 base-thread addf and2.2 base-thread addf or2.0 base-thread addf or2.1 base-thread addf or2.2 base-thread addf not.0 base-thread addf parport.0.read base-thread addf stepgen.make-pulses 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 setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 35000 setp stepgen.0.dirsetup 35000 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 setp stepgen.1.position-scale [AXIS_1]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 35000 setp stepgen.1.dirsetup 35000 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 35000 setp stepgen.2.dirsetup 35000 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 setp parport.0.pin-02-out-reset 1 setp parport.0.pin-03-out-invert 1 setp parport.0.pin-04-out-reset 1 setp parport.0.pin-06-out-reset 1 setp parport.0.pin-08-out-reset 1 setp parport.0.pin-09-out-invert 1 net home-y1 <= parport.0.pin-15-in net home-y2 <= parport.0.pin-10-in net home-y1 and2.0.in0 net home-y2 and2.0.in1 net home-y and2.0.out net home-y => axis.1.home-sw-in net home-y1-inv <= parport.0.pin-15-in-not net home-y2-inv <= parport.0.pin-10-in-not net ydir not.0.in net ydir-not not.0.out net ydir-not or2.0.in0 net home-y1-inv or2.0.in1 net doh1 or2.0.out net ydir-not or2.1.in1 net home-y2-inv or2.1.in0 net doh2 or2.1.out net ystep and2.1.in0 net doh1 and2.1.in1 net ystep1 and2.1.out net ystep and2.2.in0 net doh2 and2.2.in1 net ystep2 and2.2.out net xstep => parport.0.pin-04-out net xdir => parport.0.pin-05-out net ystep1 => parport.0.pin-02-out net ystep2 => parport.0.pin-08-out net ydir => parport.0.pin-03-out net ydir => parport.0.pin-09-out net zstep => parport.0.pin-06-out net zdir => parport.0.pin-07-out net home-y1 or2.2.in0 net home-y1 or2.2.in1 net neg-limit-y or2.2.out net neg-limit-y => axis.1.neg-lim-sw-in #net home-y1 => axis.1.pos-lim-sw-in #net home-y2 => axis.1.pos-lim-sw-in net estop-ext <= parport.0.pin-13-in-not #net estop-out <= iocontrol.0.user-enable-out #net estop-out => iocontrol.0.emc-enable-in net estop-out <= iocontrol.0.user-enable-out net estop-ext => 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 </hal> After taking the time to actually study the HAL manual, I have to say that HAL ROCKS! I had to add an extra "OR" to the logic you guys suggested because my machine runs in the negative direction with a positive direction signal on the tandem axis. It's really neat to see it in action with an intentionally skewed gantry. I'd like to give back by contributing this to the wiki. Can someone do that, or can I get access to do that? Thanks guys for your help. >Len -----Original Message----- From: John Thornton [mailto:jet1...@semo.net] Sent: Sunday, April 12, 2009 6:35 AM To: Enhanced Machine Controller EEMC" Subject: Re: [Emc-users] syncing two motors to one axis On 11 Apr 2009 at 5:45, Len Shelton wrote: > > I am unsure of some of the syntax, and this is untested. I will be > back in > the shop in a few hours and will be able to try it out. When I'm testing I do a bit at a time if possible... > > Do you see anything blatantly wrong with any of my code? > > Do I have to name every signal, particularly the ones to the inputs > of the > logic gates? In other words is: Yes each signal needs a unique name. > > net home1 parport.0.pin-10-in and2.0.in0 > > the same as: > > net parport.0.pin-10-in and2.0.in0 > > ? > > >Len > > > > > -----Original Message----- > From: Stephen Wille Padnos [mailto:spad...@sover.net] > Sent: Friday, April 10, 2009 10:32 AM > To: Enhanced Machine Controller (EMC) > Subject: Re: [Emc-users] syncing two motors to one axis > > Len Shelton wrote: > > >Jon and Rob, > > > >You guys obviously know a lot more about the inner working of HAL > than I. I > >am still no closer to understanding what lines of code I need to > put into > my > >HAL file. > > > >Can you please translate this simple boolean text notation... > > > > home_en1 = dir OR NOT home1 > > home_en2 = dir OR NOT home2 > > step_1 = step AND home_en1 > > step_2 = step AND home_en2 > > home = ( ( home1 AND home2 ) AND NOT dir ) OR ( ( home 1 OR > home2 ) > > AND dir ) > > > >...to actual HAL syntax. > > > > > Well, I'll point you in the right direction anyway :) > > First off, the manual sections on HAL are quite good - you should > (re) > read them. > > I'm not sure your logic is correct. I don't believe that the home > signal should depend on the DIR signal. I'm pretty sure that home > should just be (home1 AND home2). If both switches are closed, then > you're home regardless of which way the DIR line is pointing. > > Looking at your logic description, these things are apparent: > 1) there are four occurrences of the word "OR" > 2) there are five occurrences of the word "AND" > 3) there are three occurrences of the word "NOT". Luckily, all of > the > signals that get inverted come from I/O (if you're using my HOME > equation), which provides both a normal and inverted output to HAL, > so > you don't actually need any NOT functions > 4) all of the logical operations are operating on exactly two items > (ie, > there is no "a OR b OR c") > 5) This is for only one axis (phew!) > 6) Changing the home equation to home=(home1 AND home2) reduces the > number of gates to 2x OR, 3x AND, and zero NOT (since you can use > the > inverted home1 and home2 inputs) > > Here's how to get 3 AND "gates": > loadrt and2 count=3 > > This will give you 3 two-input AND gates. Each one has a function > which > needs to be added to your base thread, before the motion controller > runs. This will be a little tricky to get right, since you want to > read > inputs before doing the logic operations, and you want results to > propagate through the logic caluclations correctly, you have to > think > about which "inputs" get connected to which logic elements, and the > order in which they are evaluated. I'd suggest drawing this out on > paper, using a grid. Start with the inputs on the left, run them > towards the right, using columns with only one gate in each logic > path. > When you add functions to the HAL thread, start at the top left and > add > the first column of functions from top to bottom. Then move over > one > column to the right and add those functions from top to bottom. > > This is the logic I would use, which may make the order the > functions > need to run mode obvious: > step1 = step AND (dir OR home1-invert) > step2 = step AND (dir OR home2-invert) > home = (home1 AND home2) > > Sorry for the long-winded and not very specific post. Hope it > helps. > - Steve > > > -------------------------------------------------------------------- > -------- > -- > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > > > -------------------------------------------------------------------- > ---------- > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > ---------------------------------------------------------------------------- -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users