rej05b0164_m16cap| Application Note

rej05b0164_m16cap PDF

rej05b0164_m16cap| Application Note


APPLICATION NOTE

M16C/60 Series and M16C/20 Series
General-purpose Program for Adding BCD
1. Abstract

This program adds 8 digits of BCD data together by using registers. This program adds 8 digits of BCD data together between memory locations.

2.

Introduction

This program adds 8 digits of BCD data between registers by using a decimal add instruction (DADD). Set the augend in R2 and R0 and the addend in R3 and R1 beginning with the upper half, respectively. The addition result is output to R2 and R0 beginning with the upper half. The carry information is output to the C flag. This program adds 8 digits of BCD data between memory locations by using a decimal add instruction (DADD). Set the least significant memory address of the augend and that of the addend in the address registers. The addition result is output to the augend's memory location. The carry information is output to the C flag.

C 0 1 Without carry With carry

Meaning

(1) BCD addition (register) Subroutine name : BCD_ADDITION8 Interrupt during execution : Accepted Register/memory R0 Input Lower half of augend ROM capacity : 13 bytes Number of stacks used : None Output Lower half of addition result R1 R2 Lower half of addend Upper half of augend Does not change Upper half of addition result R3 A0 A1 C flag Upper half of addend Does not change Carry information Unused Unused Usage condition

Usage precautions

The augend is destroyed as a result of program execution.

REJ05B0164-0100Z/Rev.1.00

July 2002

Page 1 of 6


rej05b0164_m16cap Application Note renesas Download PDF

Add this permalink to your bookmarks for future download of rej05b0164_m16cap ApplicationNote

Permalink: http://application.emcelettronica.com/renesas/rej05b0164_m16cap

PDF rej05b0164_m16cap APPLICATION NOTE