參數(shù)資料
型號: AN1218
廠商: 飛思卡爾半導(dǎo)體(中國)有限公司
英文描述: HC05 to HC08 Optimization
中文描述: 以HC08的優(yōu)化HC05
文件頁數(shù): 54/56頁
文件大?。?/td> 417K
代理商: AN1218
Application Note
AN1218 Rev. 2
54
Appendix K — CPU08 Averaging Code
************************************************************
* File : AVERAGE.ASM
* Description :
* This code demonstrates an average routine
* showing the use of the CPU08's DIV inst.
* 8-bit values are read from a table in
* memory and the average of those numbers
* is computed.
* Notes: Please consult the CPU08 Reference Manual
* for further details on these instructions
* Code is written for educational
* purposes only
************************************************************
TBL_STR EQU $400 ; starting address of
; table in memory
ORG $50
LENGTH RMB 1 ; length of table
TOT_H RMB 1 ; high byte of total
TOT_L RMB 1 ; low byte of total
ORG $200
* The length of this table is predefined as 3 for
* this example
* The values in the table start at $401
* $401 = 50
* $402 = 60
* $403 = 70
START CLR TOT_H ; clear TOT_H in mem
CLR TOT_L ; clear TOT_L in mem
LDX LENGTH ; X
length of table
NEXT LDA TBL_STR,X ; A
(X+TBL_STR)
ADD TOT_L ; A
(A)+(TOT_L)
STA TOT_L ; TOT_L
(A)
BCS CS ; if carry bit is set,
; branch to CS
BRA NEXT2 ; branch to next table entry
CS INC TOT_H ; inc the high byte of total
NEXT2 DBNZX NEXT ; dec X, if X not 0, then
; branch to next table entry
LDHX TOT_H ; H
high byte of dividend
TXA ; A
low byte of dividend
LDX LENGTH ; X
load divisor
DIV ; H:A / X
; answer in A with H rem
* Answer can be found in A, remainder in H
* Answer is equal to $60 with no remainder
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 功能描述: