PIC17CXX Instruction Set


DAW


Syntax : DAW f,d

Description : DAW adjusts the eight bit value in the W register resulting
              from the earlier addition of two variables (each in packed BCD format)
              and produces a correct packed BCD result. 
              If 'd' is 0 the result is stored in W register and memory location 'f'.
              If 'd' is 1 the result is stored back only in register 'f'.
							
              The Decimal Adjust Algorhythm is as follows:
							
              Step 1 : If the lower nibble of W is greater than nine, or if
                       the DC flag is set from previous ops, the 06h is added to W.
											 
              Step 2 : If upper nibble is greater than nine, or if Carry flag
                       is set following Step 1, 60h is added to W.
											 
              The Carry flag may be set as a result of Step 1 or Step2.

Function   :  if [W<3:0> > 9] .OR. [DC=1]
              then W<3:0> + 6 → f<3:0>,d<3:0>,
if [W<7:4> > 9] .OR. [C=1] then W<7:4> + 6 → f<7:4>,d<7:4>
Hex code : 0Eff

Bit field:
0010 111d ffff ffff

Words : 1

Cycles : 1

Affected flags : Carry

See also :   ---
Previous    Upper level    Next