堆栈指针设置正确但致电不工作

发布于 2025-01-26 05:45:01 字数 861 浏览 4 评论 0原文

我正在为MSP430F1232使用Ti Code Composer Studio。 从汇编器中的模板开始,对例程的调用行不通,但是当我将例程直接放入代码中时,它可以正常工作。为什么电话不起作用?

;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'm using TI Code Composer Studio for the MSP430F1232.
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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜无邪 2025-02-02 05:45:01

我用类似的微型(MSP430FR2433)重现了问题。
事实证明,寻址模式是错误的。
对于其他微处理器类型,我们用于

call MySubroutine
...
MySubroutine:

MSP430,我们应该使用

call #MySubroutine
...
MySubroutine

I reproduced the problem with a similar micro (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

call #MySubroutine
...
MySubroutine
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文