㈠ 單片機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),其實使用匯編語言編譯指令錯誤可以查一下指令表,用合法指令去替換就可以了。