Chapter 5: Intelligent Box (IBox) Instructions
Math - Binary (MATHBIN) (IB-501)
1
Math - Binary Format lets you enter
complex mathematical expressions like you
230
would in Visual Basic, Excel, or C++ to do
2
complex calculations, nesting parentheses up
240
to 4 levels deep. In addition to + - * /, you
250-1
3
can do Modulo (% aka Remainder), Shift
260
Right (>>) and Shift Left (<<), Bit-wise And
(&) Or (|) Xor (^), and some binary
4
DS5 Used
functions - Convert to BCD (BCD),
N/A
HPP
Convert to Binary (BIN), Decode Bits
5
(DECO), Encode Bits (ENCO), Invert Bits
(INV), HEX to Seven Segment Display
(SEG), and Sum Bits (SUM).
6
Example: ((V2000 + V2001) / (V2003 - K10)) * SUM(V3000 & K001F)
7
Every V-memory reference MUST be to a single-word binary formatted value. Intermediate
results can go up to 32-bit values, but as long as the final result fits in a 16-bit binary word,
the calculation is valid. Typical example of this is scaling using multiply then divide, (V2000 *
8
K1000) / K4095. The multiply term most likely will exceed 65535 but fits within 32 bits.
The divide operation will divide 4095 into the 32-bit accumulator, yielding a result that will
9
always fit in 16 bits.
You can reference BCD V-memory values by using the BIN conversion function on a V-
10
memory location but NOT an expression. That is, BIN(V2000) is okay and will convert
V2000 from BCD to Binary, but BIN(V2000 + V3000) will add V2000 as Binary, to V3000
as Binary, then interpret the result as BCD and convert it to Binary - NOT GOOD.
11
Also, the final result is a 16-bit binary number and so you could do BCD around the entire
operation to store the result as BCD.
12
MATHBIN Parameters
13
• Result (WORD): specifies the location where the binary result of the mathematical expression will
be placed (result must fit into 16-bit single V-memory location)
14
• Expression: specifies the mathematical expression to be executed and the result is stored in specified
Result (WORD). Each V-memory location used in the expression must be in binary format.
A
B
WORD Result . . . . . . . . . . . . . . . . . . . . . . . . . . V
Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C
D
5–260
DL205 User Manual, 4th Edition, Rev. B
Parameter
DL205 Range
See DL205 V-memory map - Data Words
Text
Need help?
Do you have a question about the DirectLOGIC DL205 Series and is the answer not in the manual?