beautypg.com

Convert to bcd (tod), Programming, Updates to arithmetic status bits – Rockwell Automation 1761 MicroLogix 1000 Programmable Controllers User Manual

Page 151: Changes to the math register

background image

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 larger than 9999 decimal, the destination must be the Math
Register (S:13). You must reset the Minor Error Bit (S:5/0) to prevent an error.

Programming

Execution Times

(

µ

sec) when:

True

False

49.64

6.78

TOD

TO BCD
Source

Dest