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