beautypg.com

Micromod MOD: 1800P - MOD 30ML Identity Module (Version 2) Algorithms, Tables and Sequential Logic Functions User Manual

Page 15

background image

Logic Functions - Book 2

EXPRESSION BLOCK

8-7

The INTEGER operator removes the decimal portion of a number, leaving only the integer
portion. It does not round the number. For example, INT(12.678) = 12 and INT(_746.21) =
_746.

The Conditional Operators
The conditional operators (IF, THEN, and ELSE) let you specify when operations are
evaluated. The IF expression (between the IF and THEN conditionals) is evaluated first.
This expression may be enclosed in parentheses. When the calculated value of the IF
expression is TRUE (non-zero), the THEN expression is evaluated. When it is FALSE (zero),
the ELSE expression is evaluated. The ELSE expression is optional. When the IF
expression evaluates to FALSE and there is no ELSE, the result is not updated. Brackets ({})
should be used for nesting conditionals. If brackets are not present, an ELSE expression is
paired with the last unpaired IF. Notice how the brackets change the pairing of the IF and
ELSE expressions in the following example.

Using Expression Blocks as Recipes
Expression block inputs can be used as a recipe. Any number of local or remote
inputs to the block can be configured without using them in the expression, and for
this purpose only, HEX and ASCII inputs are allowed.

Syntax Errors
When there is a syntax error in the expression or a stack overflow during evaluation (can only
happen with a very deeply nested expression), the expression error diagnostic will be
reported, the results will not be updated and output qualities will be set bad.

Momentary Discrete Local Input
The value of a MOMENTARY DISCRETE local input is changed back to FALSE whenever a
TRUE is found so that it is detected in only one evaluation of an expression. The momentary
discrete feature allows a user to embed a ‘push-button’ in an expression. MOMENTARY
DISCRETE is a unique data type which can only be used as a local input to an expression
block. Another block pointed at this input will see a DISCRETE data type. Setting the local
data to HIGH or LOW configures a local input of this type.