OPENNET CONTROLLER USER’S MANUAL 14-1
14: DATA CONVERSION INSTRUCTIONS
Introduction
Data conversion instructions are used to convert data format among binary, BCD, and ASCII.
Data divide and data combine instructions are used for conversion between byte data and word data.
HTOB (Hex to BCD)
Valid Operands
For the valid operand number range, see page 6-2.
▲ Internal relays M0 through M2557 can be designated as D1. Special internal relays cannot be designated as D1.
When T (timer) or C (counter) is used as S1, the timer/counter current value is read out. When T (timer) or C (counter) is
used as D1, the data is written in as a preset value which can be 0 through 65535.
Valid values for the source operand are 0 through 9999 (270Fh) for the word data type, and 0 through 9999 9999 (5F5
E0FFh) for the double-word data type. Make sure that the source designated by S1 is within the valid value range. If the
source data is out of the valid range, a user program execution error will result, turning on special internal relay M8004
and the ERROR LED.
Since the HTOB instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction
should be used as required.
Valid Data Types
When a bit operand such as I (input), Q (output), M (internal relay), or R (shift register) is designated as the source or des-
tination, 16 points (word data type) or 32 points (double-word data type) are used.
When a word operand such as T (timer), C (counter), D (data register), or L (link register) is designated as the source or
destination, 1 point (word data type) or 2 points (double-word data type) are used.
Operand Function I Q M R T C D L Constant Repeat
S1 (Source 1) Binary data to convert XXXXXXXX X —
D1 (Destination 1) Destination to store conversion results — X ▲ XXXXX ——
W (word) I (integer) D (double word) L (long)
X — X —
S1 → D1
When input is on, the 16- or 32-bit data designated by S1 is converted into BCD
and stored to the destination designated by operand D1.
Valid values for the source operand are 0 through 9999 for the word data type,
and 0 through 9999 9999 for the double-word data type.
HTOB(*) S1
*****
D1
*****
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com