I also noticed some other signals that may be useful?

axis.N.homing OUT bit     
        #TRUE if the joint is currently homing
axis.N.home-sw-in IN bit  
        #Should be driven TRUE if the home switch for this joint is closed
axis.N.home-state
        #Reflects the step of homing currently taking place
axis.N.homed
        #TRUE if the joint has been homed

I wonder what the possible values of home-state are and how they could be
used.

>Len

-----Original Message-----
From: Len Shelton [mailto:l...@probotix.com] 
Sent: Saturday, April 11, 2009 5:46 AM
To: 'Enhanced Machine Controller (EMC)'
Subject: Re: [Emc-users] syncing two motors to one axis

Thanks for the help so far. I did some studying of the manual last night and
this is what I have come up with based upon your logic:

loadrt and2 count=3 
loadrt or2 count=2 

addf and2.0 base-thread 
addf or2.0 base-thread 

net home1       parport.0.pin-10-in     and2.0.in0
net home2       parport.0.pin-11-in     and2.0.in1

net home1inv      <= parport.0.pin-10-in-invert
net home2inv      <= parport.0.pin-11-in-invert

net home        and2.0.out
net home        => axis.1.home-sw-in

net doh1a       Ydir        or2.0.in0
net doh1b       home1inv    or2.0.in1
net doh1        or2.0.out

net doh2a       Ydir            or2.1.in0
net doh2b       home2inv        or2.1.in1
net doh2        or2.1.out       

net ystep1a       Ystep      and2.1.in0
net ystep1b       doh1       and2.1.in1
net ystep1        and2.1.out

net ystep2a       Ystep      and2.2.in0
net ystep2b       doh2       and2.2.in1
net ystep2        and2.2.out

net Xstep       => parport.0.pin-03-out
net Xdir        => parport.0.pin-02-out
net ystep1      => parport.0.pin-05-out 
net ystep2      => parport.0.pin-07-out
net ydir        => parport.0.pin-04-out parport.0.pin-06-out
net Zstep       => parport.0.pin-09-out
net Zdir        => parport.0.pin-08-out

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.

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:

   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

Reply via email to