AXIS: EMC2 Blog|
Blog
About AXIS Get EMC2 Documentation Translations ETCH CNC Developer Homepages: Chris Radek Jeff Epler Related sites: linuxcnc.org linuxcnc wiki | « Start of a classicladder 0.7 port to emc's HAL | Newest entries | Updating Configuration Files for the development version of EMC2 » Do you think in truth tables? "tt2comp" is a truth-table compiler for emc2. It produces a .comp file, which can be compiled into a realtime module. An example truth table looks like this: 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 [1]. 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 "|":
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:
|
| [æ] |