[英]Stack pointer set correctly but call not working
I'm using TI Code Composer Studio for the MSP430F1232.我正在为 MSP430F1232 使用 TI Code Composer Studio。 Starting from a template in assembler, a call to a routine doesn't work but when I put the routine directly in the code,it works.
从汇编程序中的模板开始,对例程的调用不起作用,但是当我将例程直接放入代码中时,它起作用了。 Why does the call won't work?
为什么电话打不通?
;generated code, the watchdog is stopped and the stack pointer is set correctly
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------
mov.b #0FFh,P1DIR
mov.b #0,P1OUT
$1
call delay
xor.b #001h,P1OUT
jmp $1
.newblock ;reuse local labels
delay push r14
mov #1000,r14
$1
dec r14
jne $1
pop r14
ret
I reproduced the problem with a similar micro (MSP430FR2433).我用类似的微型 (MSP430FR2433) 重现了这个问题。 It turned out that the addressing mode was wrong.
原来是寻址方式不对。 With other microprocessor types, we use
对于其他类型的微处理器,我们使用
call MySubroutine
...
MySubroutine:
For the MSP430 and similar, we should use对于 MSP430 和类似的,我们应该使用
call #MySubroutine
...
MySubroutine
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.