[英]Using hex numbers in MSP430 assembler
I'm new to assembly (we are using it at school with an MSP430 controller) and I'm trying to do two things. 我是组装的新手(我们正在学校中将它与MSP430控制器一起使用),我正在尝试做两件事。
mov #FFFh, R5
(moving it into the fifth register) mov #FFFh, R5
(将其移动到第五个寄存器中) cmp #FFFh, #45
cmp #FFFh, #45
mov.b #0, R4 ; indice
mov.b #0, R5 ; contatore
bis.b #00000001b, P1DIR ; led rosso
bis.b #10000000b, P4DIR ; led verde
main_loop: cmp #19, R5
jz end
cmp #FFFFh, 2C00h(R4)
jnz nope
jmp yep
nope: inc.b R4
jmp main_loop
yep: inc.b R4
inc.b R5
jmp main_loop
end: cmp #5, R5
jge red_led
jmp green_led
red_led: bis.b #00000001b, P1OUT
green_led: bis.b #10000000b, P4OUT
The compiler log (we are using CCS, CodeComposer) says: 编译器日志(我们正在使用CCS,CodeComposer)表示:
"../main.asm", ERROR!
“ ../main.asm”,错误! at EOF: [E0300] The following symbols are undefined:
在EOF处:[E0300]以下符号未定义:
FFFFhFFFFh
How can I fix this? 我怎样才能解决这个问题?
A word starting with a digit ( 0
… 9
) is interpreted as a number. 以数字(
0
… 9
)开头的单词被解释为数字。
A word starting with a letter ( A
… Z
) is interpreted as a name (of a register or a variable or a label). 以字母(
A
… Z
)开头的单词被解释为名称(寄存器,变量或标签的名称)。
So when a hexadecimal number starts with a letter, you must add a zero: 因此,当十六进制数字以字母开头时,必须添加零:
cmp #0FFFFh, 2C00h(R4)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.