Using Data Handling Instructions
9–3
Convert to BCD (TOD)
Use this instruction to convert 16-bit integers into BCD values.
The source must be a word address. The destination parameter can be a word
address in a data file, or it can be the math register, S:13 and S:14.
If the integer value you enter is negative, the sign is ignored and the conversion
occurs as if the number was positive.
Updates to Arithmetic Status Bits
With this Bit: The Controller:
S:0/0 Carry (C) always resets.
S:0/1 Overflow (V)
sets if the BCD result is larger than 9999. On overflow, the
minor error flag is also set.
S:0/2 Zero (Z) sets if destination value is zero.
S:0/3 Sign (S) sets if the source word is negative; otherwise resets.
Changes to the Math Register
Contains the 5-digit BCD result of the conversion. This result is valid at overflow.
Note To
convert numbers lar
ger than 9999 decimal, the destination must be the Math
Register (S:13). Y
ou must r
eset the Minor Err
or Bit (S:5/0) to pr
event an err
or.
Programming
Execution Times
(µsec) when:
True False
49.64 6.78
TOD
TO BCD
Source
Dest
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive