in_0 in_1 |out_0 out_1 - ^ |- 1 ^ - |1 - 0 0 |0 0When there is a rising edge on "in-0", "out-0" is set to 1. When there is a rising edge on "in-1", "out-1" is set to 1. When both "in-0" and "in-1" are zero, "out-0" and "out-1" are reset to zero. This is intended to implement the "wait until both axes move off the home switch" logic for gantry kinematics . Depending on the input values, this truth table takes about 120 to 200 CPU cycles to evaluate, or under 100ns.
A truth-table file consists of a title line followed by multiple rule lines. Each line is divided into a "left-hand side" and "right-hand side" by the vertical bar character "|". If a side contains whitespace, then it is broken into items separated by whitespace characters. Otherwise, each letter is an item.
On the title line, each item that appears on the right-hand side is an output pin, and each name that appears only on the left-hand side is an input pin. (If it appears on both sides, it is an output pin but its prior value can be used in a rule). All created pins are bits. When multi-letter names are used, "_" should be used in place of "-".
Each time the truth table is evaluated, all the prior values are latched. When an output value is set multiple times, the assignment in the last matching rule takes precedence, and the values resulting from intermediate matches are never seen on the HAL pin.
Supported letters on the left-hand side of the "|":
Pin's value is FALSE at the start of the evaluation
Pin's value is TRUE at the start of the evaluation
Falling or rising edge of pin, respectively
Any edge of the pin
Pin's new value is FALSE or TRUE, respectively
Pin's new value is the opposite of its old value
Pin's new value is the old value of pin 'name'
Pin's new value is the opposite of the old value of pin 'name'
As with most programs that debut here, this one is only minimally tested. The emc-developers mailing list is a good place to talk about the truth-table compiler.
Update: At SWPadnos' suggestion, I added support for pin names that were not single letters.
Files currently attached to this page:
(originally posted on the AXIS blog)
Entry first conceived on 17 November 2006, 16:00 UTC, last modified on 15 January 2012, 3:46 UTC
Website Copyright © 2004-2018 Jeff Epler