Delta Electronics DOP-AS Series Network Card User Manual


 
Chapter 4 Macro Function|ScrEdit Software User Manual
Revision Apr. 30th, 2007, 2007PDD23000002 4-25
$4 = -10 (Signed)
$7 = W2D($4)(Signed)
B2W
Convert BYTE to WORD
Equation: V1 = B2W(V2, V3)
Convert BYTE data (number of byte is V3) from V2 to WORD value and store the result in V1.
The high byte will be filled with 0. As the unit of V2 is in WORD format, each word of V2 can be
converted into two words and stored in V1. Please note that the low and high byte of the
converted WORD will be exchanged.
Example:
$10 = AB12 H
$11 = 34CD H
$20 = B2W($10,4)
Read 2 WORDS, i.e. 4 BYTES from $10 and convert 4 BYTES to 4 WORD. Then, store the result in
$20 to $23. So, the result will be:
$20 = 12 H
$21 = AB H
$22 = CD H
$23 = 34 H
W2B
Convert WORD to BYTE
Equation: V1 = W2B(V2, V3)
Convert WORD data (number of word is V3) from low-byte of V2 to BYTE format (discard high-
byte of V2) and store the result in V1.
$10 = 1234 H
$11 = 5678 H
$12 = AB H
$13 = CD H
$20 = W2B($10,4)
Read 4 WORDS from $10 and convert it to 4 BYTES, i.e. 2 WORDS. Then, store the result in $20 to
$21. So, the result will be:
$20 = 7834 H
$21 = CDAB H