參數(shù)資料
型號(hào): AN1218
廠商: 飛思卡爾半導(dǎo)體(中國(guó))有限公司
英文描述: HC05 to HC08 Optimization
中文描述: 以HC08的優(yōu)化HC05
文件頁(yè)數(shù): 55/56頁(yè)
文件大?。?/td> 417K
代理商: AN1218
Application Note
Appendix L — CPU08 BCD Example Code
AN1218 Rev. 2
55
Appendix L — CPU08 BCD Example Code
************************************************************
*
* File : BCD.ASM
* Description :
* This code demonstrates a BCD routine to
* be used on the CPU08.
* Two 16-bit BCD numbers are added together
* and the result is 16-bit BCD number
* BCD1 + BCD2 = BCDT
* Notes: Please consult the CPU08 Reference Manual
* for further details on these instructions
* Code is written for educational
* purposes only
*
************************************************************
ORG $50
BCD1_H RMB 1 ; high byte of bcd #1
BCD1_L RMB 1 ; low byte of bcd #1
BCD2_H RMB 1 ; high byte of bcd #2
BCD2_L RMB 1 ; low byte of bcd #2
BCDT_H RMB 1 ; high byte of bcd total
BCDT_L RMB 1 ; low byte of bcd total
ORG $200
* Predefine values for the example
* BCD1 = 150, BCD1_H = 01 & BCD1_L = 50
* BCD2 = 250, BCD2_H = 02 & BCD2_L = 50
* First, add the low bytes of the 16-bit BCD #s
START LDA BCD1_L ; A
(bcd #1 low byte)
ADD BCD2_L ; A
(A)+(bcd #2
; low byte)
DAA ; decimal adjust accumulator
STA
BCDT_L
; store away result to total low
* Second, add the high bytes of the 16-bit BCD #s
* Add the carry bit from the previous addition
LDA BCD1_H ; A
(bcd #1 high byte)
ADC BCD2_H ; A
(A)+(bcd #2
; high byte)+C
DAA ; decimal adjust accumulator
STA
BCDT_H
; store away result to total high
* Answer is in BCDT_H and BCDT_L
* BCDT_H = 04
* BCDT_L = 00
DONE NOP
BRA DONE
***** Initialize the reset vector
ORG $FFFE
DW START
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.
相關(guān)PDF資料
PDF描述
AN1746 Migrating from the MC68HC705K1 to the MC68HC705KJ1
AN2635 On-Chip FLASH Programming Routines
AN4009 ALARM IC SAMPLE APPLICATIONS
ARP2805D/SF 1-OUTPUT 150 W DC-DC REG PWR SUPPLY MODULE
AS1977-T nPower Single Comp. Open-Drain; Package Type: SOT23-5
相關(guān)代理商/技術(shù)參數(shù)
參數(shù)描述
AN122677 制造商:AN# - MILITARY 功能描述:
AN122683 制造商:AN# - MILITARY 功能描述:
AN122694 制造商:AN# - MILITARY 功能描述:
AN122717 制造商:AN# - MILITARY 功能描述:
AN122718 制造商:AN# - MILITARY 功能描述: