㈠ 单片机mcs51 CLR 和CPL指令疑问
CLR是对位取反的,这里的27H并非字节寻址地址,而是位寻址地址。也就是从20H(51核的位寻址区起始字节地址)的bit0开始的第27H个位,因此就是24H.7。
具体你可以翻阅书籍或51单片机手册,好好看一看位寻址相关的章节。这也是51核不多的优点之一了……
CPL 08H
与上一个相同。看来你都是卡在位寻址的认知缺失上面了。
简单来说,如果位地址小于80H,那么计算方法就是除以8,商是字节地址,余数是位偏移。
例如27H÷08H = 04H……7H,因此对应的位就是24H.7。
㈡ 单片机编译时出现错误
A51中$可以调用一些指定的控制指令,例如文件的调用$include (c8051f040.inc)
$NOMOD51;使A51汇编器预定义的SFR无效等
当$后面跟的指令错误或无效时。就会出现这种错误提示。
下面是所有的$调用的控制指令
CASE Primary Enables case-sensitive symbol names.
COND General Includes (in the listing file) conditional source lines skipped by the preprocessor.
DATE Primary Specifies the date to use in the listing file header.
DEBUG Primary Includes debugging information in the object file.
DEFINE Primary Defines C preprocessor symbols on the command line.
ECRM Primary Allow expansion of generic CALL instruction to ECALL for the NXP 80C51MX devices.
EJECT1 General Inserts a form feed character into the listing file.
ELSE General Assemble block if the condition of a previous IF is false.
ELSEIF General Assemble block if condition is true and a previous IF or ELSEIF is false.
ENDIF General Ends an IF block.
ERRORPRINT Primary Specifies the file name for error messages.
GEN General Includes all macro expansions in the listing file.
IF General Assemble block if condition is true.
INCDIR Primary Sets additional include file paths.
INCLUDE2 General Includes the contents of another file.
LIST General Includes the assembly source text in the listing file.
MACRO Primary Enables preprocessor expansion of standard macros.
MOD_CONT Primary Enables 24-bit contiguous addressing for Dallas Semiconctor devices.
MOD_MX51 Primary Enables instruction set extensions for the NXP 80C51MX architecture.
MOD51 Primary Enables code generation and defines SFRs for classic 8051 devices.
MPL Primary Enables preprocessor expansion of MPL macros.
NOAMAKE Primary Excludes build information from the object file.
NOCASE Primary Disables case-sensitive symbol names. All symbols are converted to uppercase.
NOCOND Primary Excludes (from the listing file) conditional source lines skipped by the preprocessor.
NODEBUG Primary Excludes debugging information from the object file.
NOERRORPRINT Primary Disables error messages output to the screen.
NOGEN General Excludes macro expansions from the listing file.
NOLINES Primary Excludes line number information from the generated object mole.
NOLIST General Excludes the assembly source text from the listing file.
NOMACRO Primary Disables preprocessor expansion of standard and MPL macros.
NOMOD51 Primary Suppresses SFRs definitions for classic 8051 devices
NOMPL Primary Disables preprocessor expansion of MPL macros.
NOOBJECT Primary Disables object file generation.
NOPRINT Primary Disables listing file generation.
NOREGISTERBANK Primary Disables memory space reservation for register banks.
NOSYMBOLS Primary Excludes the symbol table from the listing file.
NOSYMLIST General Excludes subsequently defined symbols from the symbol table.
NOXREF Primary Excludes the cross-reference table from the listing file.
OBJECT Primary Specifies the name for the object file.
PAGELENGTH Primary Specifies the number of lines on a page in the listing file.
PAGEWIDTH Primary Specifies the number of characters on a line in the listing file.
PRINT Primary Specifies the name for the listing file.
REGISTERBANK Primary Reserves memory space for register banks.
REGUSE General Specifies registers modified by the specified function.
RESET General Sets symbols, which may be tested by IF or ELSEIF, to false.
RESTORE1 General Restores settings for the LIST and GEN directives.
SAVE1 General Saves settings for the LIST and GEN directives.
SET General Sets symbols, which may be tested by IF or ELSEIF, to true or a specified value.
SYMBOLS Primary Includes the symbol table in the listing file.
SYMLIST General Includes subsequently defined symbols in the symbol table.
TITLE Primary Specifies the page header title in the listing file.
XREF Primary Includes the cross-reference table in the listing file.
㈢ 单片机指令判断正误
1、CLR A 对
2、MUL R0,R1 错,只有MUL A,B
3、MOV DPTR,1050H 错,猜测该题意图应该是MOV DPTR,#1050H,并且DPTR除了立即数赋值外只能用MOVX @DPTR,A来为其赋值
4、 MOV A,@R7 错,只有R0与R1可以间址
5、 ADD 30H,20H 错,ADD后面只能跟A,也就是ADD A,direct
6、 MOV R1,C 错,C是位,位与字节不能这样传输
7、 JMP @RO+DPTR 错,该指令只能用JMP @A+DPTR
8、 MOV A,#3000H 错,A是8位的,不能将16位立即数赋值给A
9、 MOVC @A+DPTR,A 错,该指令应该为 MOVC A,@A+DPTR
10、 MOVX A,@A+DPTR
㈣ 这两条单片机的指令为什么是错的
第一条:MOV 50H,#0FC3DH,后面的立即数显然超出的50H地址的位数,一般单片机有8位、12位、16位、32位等
第二条:MOV R0,#FEH ,在单片机编写程序中不允许地址和数值以字母开头的,想这个数应写成MOV R0,#0FEH 就好
㈤ 请问单片机MOV R7,@R1指令为什么是错的
单片机指令,有MOV
A,@R1,
没有MOⅤ
R7,@R1
这条指令,如寄存器是0区.可以用MOⅤ
07H,@R1(这条指令是合法指令,0区R7等于07H),其实使用汇编语言编译指令错误可以查一下指令表,用合法指令去替换就可以了。