单片机汇编语言

ORG 2000H
DW 1246H,7BH,10
汇编后
(2000H)=
(2001H)=
(2002H)=
(2003H)=
(2004H)=
(2005H)=
他们等于什么?我两本书上看到不同答案,请高人解释

(2000h)=12h,(2001h)=46h,(2002h)=00h,(2003h)=7bh,(2004h)=00h,(2005h)=10h
绝对正确,看看我得唱歌程序就知道了
;T0中断次数计数寄存器20H;音调长度寄存器30H;音调寄存器31H
SPEAKER BIT P2.0
ORG 0000H
LJMP START
ORG 000BH
INC 20H
MOV TH0,#0D8H
MOV TL0,#0EFH
RETI

ORG 0030H
START:
MOV SP,#60H
MOV TMOD,#01H
MOV TH0,#0D8H
MOV TL0,#0EFH
MOV IE,#82H

MAIN:
LCALL START_MUSIC
LJMP $

START_MUSIC:
CLR A
MOV 20H,#00H
MOV DPTR,#DAT_TYGK
MOVC A,@A+DPTR
MOV 31H,A
CLR A
INC DPTR
MOVC A,@A+DPTR
MOV 30H,A

MUSIC:
SETB TR0
MUSI:
CPL SPEAKER
LCALL DELAY
MOV A,30H
CJNE A,20H,MUSI
CLR TR0

NEXT_YD: ;修改音调,音调长度等。。。
MOV 20H,#00H
INC DPTR
CLR A
MOVC A,@A+DPTR
JZ OVER
CJNE A,#0FFH,LP
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV 32H,A ;休止时间寄存器32H
LJMP WEIT
LP:
MOV 31H,A
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV 30H,A
LJMP MUSIC

OVER:
SETB SPEAKER
CLR TR0
MOV 20H,#00H
CLR A
RET

WEIT:
SETB TR0
MOV A,32H
CJNE A,20H,$
CLR TR0
CLR A
LJMP NEXT_YD

DELAY:
NOP
MOV R7,31H
DL:
MOV R6,#03H
DJNZ R6,$
DJNZ R7,DL
RET

DAT_TZDN: ;同桌的你
DW 3920H,0FF02H,3920H,0FF02H,3920H,0FF02H,3920H,4420H
DW 4020H,3960H,2D60H,3320H,0FF02H,3320H,0FF02H,3320H
DW 0FF02H,3320H,4020H,3320H,39C0H,0FF02H,3920H,0FF02H
DW 3920H,0FF02H,3920H,0FF02H,3920H,2D20H,3320H,3940H
DW 4040H,0FF02H,4040H,0FF02H,4020H,0FF02H,4020H,0FF02H
DW 4020H,0FF02H,4020H,4420H,4C20H,56C0H,2B20H,0FF02H
DW 2B20H,0FF02H,2B20H,0FF02H,2B20H,3920H,3320H,2B40H
DW 0FF02H,2B20H,2260H,2620H,0FF02H,2620H,0FF02H,2620H
DW 0FF02H,2620H,2B20H,2D20H,33C0H,2D20H,0FF02H,2D20H
DW 0FF02H,2D20H,0FF02H,2D20H,2D20H,2B20H,2660H,3960H
DW 2D20H,0FF02H,2D20H,2B20H,2620H,2B20H,2D20H,2BC0H
DW 2B40H,0FF02H,2B20H,0FF02H,2B20H,3920H,3320H,2B60H
DW 2260H,2640H,0FF02H,2620H,0FF02H,2620H,2B20H,2D20H
DW 33C0H,2D40H,0FF02H,2D20H,0FF02H,2D20H,0FF02H,2D20H
DW 2B20H,2660H,3960H,2D20H,0FF02H,2D20H,2B20H,2620H
DW 2B20H,2D20H,2BC0H
DB 00H

DAT_WSQSZSQ: ;万水千山总是情
DW 4436H,4036H,3951H,0FF02H,391BH,3336H,3936H,44A2H
DW 4C36H,5651H,441BH,4C36H,5636H,66A2H,0FF02H,6636H
DW 726CH,5636H,4C36H,4436H,3936H,3336H,4436H,4CA2H
DW 4436H,4036H,3951H,0FF02H,391BH,3336H,3936H,44A2H
DW 4C36H,5651H,441BH,4C36H,5636H,66A2H,0FF02H,6636H
DW 726CH,5651H,441BH,4C6CH,5636H,6636H,56A2H,4436H
DW 3936H,33A2H,2B36H,3336H,4036H,3936H,3336H,4436H
DW 396CH,4436H,396CH,4436H,3936H,33A2H,2B36H,0FF02H
DW 2B36H,3336H,3936H,4436H,4CA2H,4436H,4036H,3951H
DW 0FF02H,391BH,3336H,3936H,44A2H,4C36H,5651H,441BH
DW 4C36H,5636H,66A2H,0FF02H,6636H,726CH,5636H,4436H
DW 4C51H,561BH,6636H,5636H,0FF02H,56A2H,6636H,726CH
DW 5636H,4436H,4C51H,561BH,6636H,5636H,0FF02H,56A2H
DB 00H

DAT_XSFYZ: ;相思风雨中
DW 6640H,4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H
DW 4020H,5B20H,6680H,0FF02H,6640H,3320H,3920H,3340H
DW 4C40H,4430H,4C10H,4020H,4C20H,4480H,2B40H,2D20H
DW 3320H,2D40H,4440H,3320H,0FF02H,3320H,3920H,4020H
DW 3940H,5640H,4C30H,0FF02H,4C10H,0FF02H,4C20H,0FF02H
DW 4C20H,0FF02H,4C20H,0FF02H,4C20H,5B20H,4C20H,44E0H
DW 6640H,4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H
DW 4020H,5B20H,6680H,0FF02H,6640H,0FF02H,6620H,7220H
DW 3340H,4C40H,4430H,4C10H,4020H,4C20H,4480H,2B40H
DW 2D20H,3320H,2D40H,4440H,0FF02H,4420H,0FF02H,4420H
DW 3320H,4420H,0FF02H,4440H,4C40H,5B60H,0FF02H,5B20H
DW 0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66C0H,2B20H
DW 2D20H,2B40H,3320H,2D20H,0FF02H,2D20H,3320H
DW 3920H,33C0H,3920H,4020H,3940H,4420H,4020H
DW 0FF02H,4020H,4420H,4C20H,44C0H,2B20H,2D20H,2B60H
DW 3320H,2D20H,0FF02H,2D20H,3320H,2D20H,2B30H,2D10H
DW 3320H,3920H,4440H,6620H,5620H,4C60H,0FF02H,4C20H
DW 0FF02H,4C20H,0FF02H,4C20H,3920H,4020H,44E0H,6640H
DW 4420H,4C20H,4440H,6640H,4C30H,0FF02H,4C10H,5620H
DW 5B20H,3380H,0FF02H,6640H,3320H,3920H,3340H,4C40H
DW 4420H,4C20H,5620H,4C20H,4480H,2B40H,2D20H,3320H
DW 2D40H,4440H,0FF02H,4420H,0FF02H,4420H,3320H,4420H
DW 0FF02H,4440H,4C40H,5B40H,0FF02H,5B20H,0FF02H,5B20H
DW 0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66E0H,3320H
DW 2D20H,2B40H,2D20H,3320H,2D40H,4440H,0FF02H,4420H
DW 0FF02H,4420H,3320H,4420H,0FF02H,4440H,4C40H,5B60H
DW 0FF02H,5B20H,0FF02H,5B20H,0FF02H,5B20H,4C20H,5620H,66E0H
DB 00H

DAT_YLDBWDX: ;月亮代表我的心
DW 7220H,5660H,4420H,3960H,5620H,5B60H,4420H,3960H
DW 0FF02H,3920H,3360H,2D20H,2B60H,3320H,39A0H,4420H
DW 4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4420H,4C20H
DW 5660H,0FF02H,5620H,0FF02H,5640H,4C20H,4420H,4C60H
DW 5620H,6640H,4440H,4CC0H
DW 7220H,5660H,4420H,3960H,5620H,5B60H,4420H,3960H
DW 0FF02H,3920H,3360H,2D20H,2B60H,3320H,39A0H,4420H
DW 4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4420H,4C20H
DW 5660H,0FF02H,5620H,0FF02H,5640H,4C20H,4420H,4C60H
DW 6620H,5B40H,4C40H,56C0H,4420H,3920H,4460H,4C20H
DW 5640H,3940H,5BC0H,6620H,5B20H,5660H,0FF02H,5620H
DW 0FF02H,5640H,4C20H,4420H,4CC0H,7220H,5660H,4420H
DW 3960H,5620H,5B60H,4420H,3960H,0FF02H,3920H,3360H
DW 2D20H,2B60H,3340H,39A0H,4420H,4C20H,5660H,0FF02H
DW 5620H,0FF02H,5640H,4420H,4C20H,5660H,0FF02H,5620H
DW 0FF02H,5640H,4C20H,4420H,4C60H,6620H,5B40H,4C40H
DW 56C0H,4420H,4C20H,5660H,0FF02H,5620H,0FF02H,5640H
DW 4420H,4C20H,5660H,0FF02H,5620H,0FF02H,5640H,4C20H
DW 4420H,4C60H,6620H,5B40H,4C40H,56C0H
DB 00H

DAT_TYGK:
DW 3320H,0FF02H,3320H,2220H,0FF02H,2220H,2B20H,2D20H
DW 3340H,3920H,4410H,3910H,3320H,0FF02H,3320H,4480H,0FF02H
DW 4420H,3320H,0FF02H,3320H,4420H,0FF02H,4420H,2D20H
DW 0FF02H,2D20H,4420H,0FF02H,4420H,2B20H,0FF02H,2B20H
DW 0FF02H,2B20H,2D80H
DW 3320H,2620H,0FF02H,2620H,3320H,0FF02H,3320H,2020H,0FF02H
DW 2020H,2620H,2220H,0FF02H,2220H,2020H,0FF02H,2020H,2280H
DW 2B20H,0FF02H,2B20H,0FF02H,2B20H,2D20H,0FF02H,2B20H
DW 2220H,0FF02H,2220H,2B20H,2D20H,3320H,2B20H,2D40H,2B20H
DW 2D20H,3340H,4020H,4420H,3320H,2D20H,2B20H,0FF02H
DW 2220H,2B20H,0FF02H,2B40H,2D10H,2B10H,2D20H,33C0H
DW 4020H,0FF02H,4020H,0FF02H,4020H,0FF02H,4020H,3320H
DW 3920H,4020H,4420H,4C20H,4020H,3320H,4480H,3320H,0FF02H
DW 3320H,0FF02H,3340H,0FF02H,2D20H,3320H,2D20H,2B10H,2210H
DW 2610H,2B10H,2220H,2020H,2280H,2030H,2210H,2020H,1920H
DW 2010H,2210H,2620H,0FF02H,2640H,2220H,2B20H,3320H,2B20H
DW 2D80H,2B30H,2D10H,2B20H,2220H,2B10H,2D10H,3320H,0FF02H
DW 3340H,2D20H,3320H,4020H,3320H,4440H,0FF02H,4440H,3360H
DW 2D20H,2B40H,2240H,2020H,2220H,2B20H,2D10H,2B10H,2240H
DW 0FF02H,2240H,2B60H,2220H,2D80H,33F0H
DB 00H

END
不信可以试验追问

和楼下的答案不一样,这也就是俩本书的不同的地方

追答

放心,我得绝对正确,把我得程序烧进芯片或者仿真就知道了

温馨提示:内容为网友见解,仅供参考
第1个回答  2012-06-05
字节内容按照由低到高排列,每个字写成4位应该是
DW 1246H,007BH,000AH,得到结果分别是46H,12H,7BH,00H,0AH,00H.追问

和楼上的答案不一样,这也是俩本书的不同答案啊

追答

楼上回答正确,我用keil验证了

本回答被提问者采纳
第2个回答  2012-06-06
DW 1246H,007BH,000AH, ; 正确编译 结果如下,否则这本书 肯定是盗版书。
编译一下 不就出来了 看。
2000H: 12H,46H,00H,7BH,00H,0AH
第3个回答  2012-06-06
得到结果分别是46H,12H,7BH,00H,0AH,00H.

为什么大学单片机都讲汇编语言
单片机领域中,汇编语言因其诸多优点而备受推崇。首先,汇编语言执行效率极高,其性能优于C语言,这为程序的高效运行提供了有力保障。其次,学习并运用汇编语言能够显著提升编码能力。通过直接用机器指令编写程序,开发者能以最优化的方式实现功能,实现更高效、更精准的代码编写。更重要的是,掌握汇编语言有...

为什么大学单片机都讲汇编语言
1. 汇编语言的执行效率高,比C语言的执行效率都高。2.用汇编语言可以锻炼以机器指令编码的能力,可以以最优化的方式编写代码。3.使用汇编语言能够更深入的了解单片机,了解单片机的内部框架结构,能够更好的理解机器代码在单片机内部是怎么运行的。4.汇编语言的时序性很强,可以精确严格按既定时序控制流程。...

单片机汇编和c有什么区别吗
单片机开发时选择使用C语言还是汇编语言,各有其优缺点。C语言编写出的代码具有较高的可读性,使得后续开发者能够较为容易地理解代码逻辑并进行扩展工作,这在团队协作中显得尤为重要。相比之下,汇编语言则因其高度依赖硬件架构,使得理解和维护代码变得更加困难,通常需要较长时间才能深入理解原作者的意图和...

单片机开发是用C语言好还是汇编语言好
C语言的库函数丰富,运算速度快,编译效率高,且具有良好的移植性,使其成为单片机开发的主流选择。它支持结构化编程,有助于大型软件的开发。使用C语言可以缩短开发周期,提高软件的可读性和可扩展性。对于资源受限的单片机,汇编语言能够精确控制每个机器指令,便于调试和优化程序的内存占用。因此,在某些对...

单片机三大编程语言
近年来,随着单片机硬件性能的提升和软件开发工具的进步,C51语言逐渐成为主流。C51是一种结合了C语言和汇编语言特性的编程语言,它既能够利用C语言的简洁和高效,又能够实现对单片机硬件的直接控制。C51语言的出现,使得单片机开发变得更加容易,开发效率大大提高。近年来,Python语言也开始被应用于单片机编程...

单片机汇编指令和汇编语言有什么区别啊?
一、作用不同:JBC指令判断该位为1则转移,同时将该位置0。JC指令判断有借位则转移,也就是说两数相减为负转移。二、含义不同:JBC指令相当与JB和CLR (位) 二条指命的组合,它可在转移的同时清除被判位;JC指令只能对CY进位位进行判断为高后转移,并不能清除它,二条指令都当被测位为高进时...

单片机的汇编语言和C语言有什么区别?
1、针对存储器不同。MOVX和MOVC是针对两种不同的存储器而言,一个是片外数据存储器,另一个却是程序存储器。2、传递数据的对象不同。MOV:单片机内部的寄存器或者存储器之间相互传递数据(内部RAM);MOVX:单片机内部的A累加器与片外的数据存储器(片外RAM)传送数据。MOVC:单片机内部的A累加器向ROM(...

什么是汇编语言和汇编程序?怎样才能将汇编程序转变为单片机可执行文件...
1. 编写汇编程序:使用汇编语言编写程序源代码,这些源代码包含了各种操作指令和必要的数据定义。2. 汇编过程:利用汇编器(Assembler)将汇编源代码转换为目标文件。目标文件通常包含机器码,这些机器码是单片机可以直接执行的指令。汇编器在这个过程中还会生成一些其他的辅助信息,如符号表等。3. 链接过程(...

单片机用什么语言编程
单片机可以使用多种编程语言进行编程,但最常见的是汇编语言和C语言。汇编语言是直接与单片机的硬件指令集相对应的语言,它使用助记符来表示机器指令,程序员需要了解单片机的指令集和硬件架构。汇编语言编写的程序具有直接控制硬件的能力,可以实现高效的程序执行和内存管理。然而,汇编语言编写程序相对繁琐,且...

单片机能够直接识别的语言是哪一个呢?
汇编语言、C语言。1、汇编语言:这是一种低级语言,直接对应单片机的指令集;使用汇编语言编写的程序可以直接被单片机执行,是单片机能够直接识别的语言之一。2、C语言:是一种高级语言,通过编译器转换成单片机可以执行的机器码,使用C语言编写的程序也可以被单片机直接识别执行。

相似回答