Pages created and updated by 
Terry Sturtevant 
	 Date Posted: 
	 
	 May 12, 2017
	 
	 
Binary Coded Decimal (BCD) Arithmetic
e.g.   decimal 1,985 = h'19 85' in packed BCD
                     
            = 0001 1001 1000
  0101 (in binary)
e.g. 19 85      0001 1001 1000 0101
      +34 59      0011 0100
  0101 1001
        ------       ------------------------
        54 44      0100
  1101 1101 1110   >> the binary sum does not give the decimal result
  expected
                     
          0110 0110 0110   >> if
  a digit is >9 then add 6
                      
  ------------------------
                      0101
  0100 0100 0100   >> result is now in binary coded decimal
In the PIC, use add/addc followed with decimal adjust, daw/dawc.

 
	 
	 
 

Wilfrid Laurier University
© 2019 Wilfrid Laurier University