
rej05b0168_m16cap| Application Note
APPLICATION NOTE
M16C/60 Series and M16C/20 Series
General-purpose Program for Converting from 1-byte HEX Code to BCD Code
1. Abstract
This program converts 1-byte HEX code into 2-byte BCD code.
2.
Introduction
This program converts 1-byte HEX code into 2-byte BCD code. Set the HEX code in R1L. The BCD code is output to R0. In this program, the HEX code is doubled by decimal calculation sequentially beginning with the most significant bit and the results are added. This operation is repeated by a specified number of bits as the HEX code is converted into BCD code.
Subroutine name : HEXtoBCD_1byte Interrupt during execution : Accepted Register/memory R0 R1H R1L R2 R3 A0 A1 Input HEX code -
ROM capacity : 19 bytes Number of stacks used : None Output BCD code 0016 Indeterminate Indeterminate Usage condition Loop count Used to save data Unused Unused Unused
Usage precautions
HEX code is destroyed as a result of program execution.
REJ05B0168-0100Z/Rev.1.00
July 2002
Page 1 of 6
rej05b0168_m16cap Application Note renesas Download PDF
Add this permalink to your bookmarks for future download of rej05b0168_m16cap ApplicationNote
Permalink: http://application.emcelettronica.com/renesas/rej05b0168_m16cap