05-13-2010 07:42 PM
How do I evaluate a 4-bit input and output an integer value that I am need to map to a different value? Say that I'm evaluating the following inputs (4 in, 1 out):
(((IN(0) AND IN(1)) AND (IN(2) AND IN(3)) = 13) <= We know that 1111b is 15decimal, but I need to translate the value to 13 so that it represents the index of a worksheet that I'll be selecting with the Sequencer.
I am OR'ing each possible combination of the 4 inputs, and each combination needs to output a "special" value that I need to output to represent the index I need.
Solved! Go to Solution.
05-14-2010 08:20 AM
The result of a logical operation or comparison (OR, AND, =, <>, etc) is 0 (False, zero) or 1 (True, One).
Change the formula to
(IN(0) AND IN(1) AND IN(2) AND IN(3) ) * 13
In my limited testing, any non-zero value of the inputs will test TRUE, if any one is zero, then the output is zero, otherwise, the output is 13.
07-01-2010 06:41 AM
Hello WilliamX,
You can solve this application more flexible and very compact also with Addon Module "VBScript", sale via PREMEGA GmbH -> link under http://www.premega.de/de-02/software_dasylab_vbscript_de.php
Some screen shots for mainpoints from application:
VB Script give you the chance to detect any useful bit combination and put out an value what you needs for this situation.
Best regards,
MHa