Hi Gene!

Replying on a tiny note you made:

On 16.08.2014 16:55, Gene Heskett wrote:
> ...
> This causes the Mesa SpinX1 controlled fwd/reverse relays to switch, 
> throwing the full power of the controller into the motor trying to reverse 
> it.  The controller, a $185 Gemini, survived only 3 such events before it 
> punched the IRFP250N hexfet, a 200 volt 30 amp device.  So that is an 
> error condition that I'll use to defeat the 2 input and's setup in lut5's, 
> releasing the 3rd relay, which if energized, shorts out a 50 ohm 400 watt 
> resistor in series with the motor.  And I'll do it based on the man page 
> comment about leaving unused inputs open by feeding this true if dir is 
> missmatched from an abs.piddir module into in-2 of both the forward and 
> reverse path logic, which if the man page comment is true should cause a 
> false output.
> ...

Actually, it isn't a special feature of this component that an unused
input going true sets the output to false. This is just depending on
your function and assumes that you insert zeros in the unused fields of
your truth table.
If you take my other examples for inverter and nand2, then you will see
this behaviour only in the former:

setp inv-1.function 0x00000001    # Single inverter
setp nand-1.function 0xfffffff7   # Two-input NAND

For the inverter, if all inputs are zero, then you have state 0 for the
truth table, so you get out = 1 (as bit 0 in the function is 1). In any
other state, no matter if it is because in-0 is one or any other input,
you will hit one of the zeros in the function word and therefore get a
zero output.
But the NAND is different: When calculating the function parameter
value, I first thought how an AND with two inputs has to look. Well,
easy enough, the output should be one if in-0 and in-1 are one and zero
in all other cases. Thats state 3, so bit 3 must be 1 and the rest zero.
Makes 0x00000008. A NAND is simply the inverted version of the AND, so
all I did then was to invert the whole function value, giving
0xfffffff7. But this will obviously generate a one also if any of the
other inputs is one. You only get the advertised behaviour with a
function value of 0x00000007. If the NAND2 should function without
considering any of the other inputs, the word would be 0x77777777. I
hope that bit patterns are correct, have just put them together in my head.

So when checking if your code is actually fail-safe, you should consider
all truth tables completely and make sure that the output bits for your
unused states really generate a safe condition if the inputs are bogus.

Oh, just as a side note: The source of the lut5 component (in
src/hal/components/lut5.comp) is worth a look. That's 12 lines of
comp-related code, 126 lines of description and only 10 lines for the
actual functionality :)

Cheers,
Philipp

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to