From: Ed <ed....@po...> - 2007-03-09 18:44:06
|
> provides the ability to trigger on them I -think- this would work, but it assumes the position-cmd signal is correct... which may not be the case. Set up a g-code routine to G0 between Z=0 and Z=0.1, loop 10 times (or all afternoon, when it seems appropriate). Run stepgen.2.position through a d/dt block, say ddt.9.in. The output is > 0 when the position is increasing, showing that Z is going up. Feed ddt.9.out and a constant 0.0 to comp.0, so comp.0.out is True if the d/dt > 0, so Z is going up. If HAL has an XOR... Feed stepgen.2.dir and comp.0 to xor.0. If xor.0.out goes high, then the direction points one way and the change in position points the other way. HAL seems to lack an XOR, so... Feed stepgen.2.dir and comp.0.out to sum2.0; they're both boolean, so the sum will be 0, 1, 2 or 3. (I think, anyway). Feed sum2.0.out and stepgen.2.dir to wcomp.0, set wcomp.0.min = 0.5 and wcomp.0.max = 2.5. If wcomp.0.out goes high, then stepgen.2.dir and position-cmd point differently. Now, I can write that in English, but a bit of fumbling convinces me I can't write it in HAL. If you'll cook it up for me, I'll run it to see if it fails here -and- learn how to write this stuff; I can tweak it if you'll get me started. The critical assumption here is that the commanded position doesn't glitch backwards when the direction signal does, which seems entirely unfounded. However, I can test that by applying the output to my mill. If the HAL code doesn't trigger when the mill chokes, then we've learned something useful. -- Ed |