- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
 - 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
 - 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
 - 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
 - 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
 - 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
 - 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
 
                        查看更多
                        
                    
                16位二进制转换为bcd码的c51汇编程序(16 bit binary converted to BCD code C51 assembler)
                    16位二进制转换为bcd码的c51汇编程序(16 bit binary converted to BCD code C51 assembler)
Algorithm 16 bit binary code to BCD and 51 assembly:
N=b15~b0
N=[b15~b8]*256+[b7~b0]
=[b15~b12]*4096+[b11~b0]
Four, the high [b15~b12] value range is 0~15, represents the number 4096
N=[b15~b12]*4000+{[b15~b12]* (100-4) +[b11~b0]}
X [b15~b12], a:
N=x*4000+{x* (100-4) +[b11~b0]
Namely: n=4*x (1000) +x (100) +[b11~b0]-4*x
Back on the site: [b11~b0]-4*x, if less than 356, is directly converted into BCD code, if
Larger, take 11~7 as the number 128 y, plus y at 100, ten plus 3*y, and in
[b6~b0] minus 2*y
There:
N=n=4*x (1000) + (x+y) (100) +3*y (ten) +[b6~b0]-2*y
Thus, it can be defined by the high 9 bits each numerical [b15~b7] transform out decimal places, may be greater than 9, to the end to tidy up.
The rest of the low 7 bits into BCD code is very simple.
This is someone elses ideas, easy to understand, but the assembly is not too good to expect someone to write, write, here is an algorithm of my classmates:
Eight minus one, eighth and 256, (stored in compressed BCD code three bytes 100 2, ten and 5 members, plus 6)
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP INT0
ORG 0100H
MAIN: MOV SP, #60H
MOV R4, #30
MOV TMOD, #01H
MOV TH0, #00H
MOV TL0, #00H
MOV IE, #81H
SETB TR0
SETB IT0
LOOP: LCALL BCD
LCALL UBCD
LOOP1: LCALL XIANSHI
LCALL DELAY
DJNZ R4, LOOP1
AJMP LOOP
BCD: MOV A, #00H
MOV 38H, 41H
MOV 37H, 40H
MOV 34H, A
MOV 35H, A
MOV 36H, A
MOV A, 37H
MOV B, #100
DIV AB
MOV 35H, A
MOV A, B
MOV B, #10
DIV AB
SWAP A
ADD A, B
MOV 36H, A
MOV R3,38H
CJNE R3, #0, JIA
AJMP RETURN
JIA: CLR C
MOV A, 36H
ADDC A, #56H
DA A
MOV 36H, A
MOV A, 35H
ADDC A, #02H
DA A
MOV 35H, A
MOV A, 34H
ADDC A, #0
MOV 34H, A
DJNZ R3, JIA
RETURN:RET
UBCD: MOV A, 34H
CJNE A, #00H, WUWEI
MOV R1, #35H
MOV R0, #36H
MOV A, #00H
XCHD A, @R0
MOV 30H, A
MOV A, @R0
SWAP A
MOV 31H, A
MOV A, #00H
XCHD A, @R1
MOV 32H, A
MOV A, @R1
SWAP A
ADD A, #10
MOV 33H, A
RET
WUWEI: MOV R1, #34H
MOV R0, #35H
MOV A, #00H
XCHD A, @R0
MOV 31H,
一
MOV A,R0
交换
添加,# 10
MOV
                您可能关注的文档
- 03级给水排水(03 stage water supply and drainage).doc
 - 013 i++和++i的效率差别(013 efficiency difference between i++ and ++i).doc
 - 04-05年下学期七年级单元同步测试地理巴西a卷(附答案)(04-05 next semester, unit seven, simultaneous testing, geography Brazil a (with answers)).doc
 - 04养生论(04 health preserving theory).doc
 - 04技术分析精要(Analysis of 04 key technology).doc
 - 05-2-2黑桥牌也开始卖德国香肠了(05-2-2 black bridge also began to sell German sausage).doc
 - 05月-qcc持续改善活动推进(05, -qcc continuous improvement activities to promote).doc
 - 0607【头脑风暴】关键词分析法(0607 brainstorm keyword analysis).doc
 - 05月-研发项目管理与敏捷化开发(05 months - R & D project management and agile development).doc
 - 06章 压合作业—pcb电路板术语与线路板简字词典(The 06 chapter pressing operation PCB circuit board and the circuit board mnemonic dictionary terms).doc
 
- 16mn钢板焊接(16Mn steel plate welding).doc
 - 16各类民用建筑设计规范(16 specifications for the design of civil buildings).doc
 - 16姥姥的剪纸导学案(16, grandma's paper cutting guidance case).doc
 - 18个月宝宝益智游戏(18 months baby puzzle game).doc
 - 18位身份证号码校验位规则(18 bit number check digit rule).doc
 - 18安塞腰鼓(18 Ansai drum).doc
 - 17.2 科学的转折光的粒子性(17.2. The turning point of Science the particle of light).doc
 - 18建筑物无障碍设计和老年人建筑设计规范(18 building barrier free design and building design specification for older persons).doc
 - 150例老年急性脑卒中血糖值与近期预后的关系(Relationship between blood glucose value and short-term prognosis in 150 elderly patients with acute cerebral apoplexy).doc
 - 17建筑物无障碍设计和老年人建筑设计规范(17 building barrier free design and building design specification for older persons).doc
 
最近下载
- 第二单元-第1课-《因地制宜》课件-2025-2026学年人教版(2024)初中美术八年级上册.pptx VIP
 - 句式转换、扩缩句、仿写、关联词二年级语文上册期末复习知识点附练习答案 部编版.pdf VIP
 - 雅思阅读配对题1.ppt VIP
 - 2025造价师工程师(一级)-工程计价总版讲义-在线版.pdf VIP
 - 海利普HLP-A系列说明书(中文) 2013-02版.pdf
 - C249126【强化】2024年湖南大学085400电子信息《866数据结构之数据结构》考研强化模考.pdf VIP
 - 3D工程图学(华中科大)中国大学MOOC慕课 章节测验 客观题答案.docx VIP
 - 2024年国企招聘考试(建筑类综合基础知识)经典试题及答案汇总.docx VIP
 - 部编小学语文省级作业设计大赛获奖作品(75).docx VIP
 - 2023广东省广州市天河区中考一模语文试题(含答案).pdf VIP
 
原创力文档
                        
                                    

文档评论(0)