A neater solution might be this comp I just knocked up, which you can install using comp -install as described here: http://linuxcnc.org/docs/html/hal_comp.html The comp can be used to combine two alternate sets of input bits to one output, or in set of inputs to either of two outputs.
You would need to add swap.0 to the base thread and then connect step/dir from one stepgen to inA0 and inA1 and the other to inB0 and inB1, then connect the digital output to the swap pin. component swap """Takes two sets of inputs A and B (the number is set by "personality" and defaults to 2) and swaps A for B when the "swap" pin is high"""; pin in bit inA#[32 : personality] "Input A"; pin in bit inB#[32 : personality] "Input B"; pin out bit outA#[32 : personality] "Output A"; pin out bit outB#[32 : personality] "Output B"; pin in bit swap "Control input"; function _; license "GPL"; author "Andy Pugh"; option extra_setup; ;; FUNCTION(_) { int i; if (swap) { for (i = 0; i < personality ; i++){ outA(i) = inB(i); outB(i) = inA(i); } } else { for (i = 0; i < personality ; i++){ outA(i) = inA(i); outB(i) = inB(i); } } } EXTRA_SETUP(){ if (personality == 0) personality = 2; return 0; } -- atp "Torque wrenches are for the obedience of fools and the guidance of wise men" ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers