开发者

Why does "acall" instruction does not work in Atmel 89C2051 microcontroller?

I tried it with Keil-µVision and Asem-51 but they s开发者_开发技巧till plugging that it is an syntax error. Here is my code:

acall subroutine1
.
.
.

subroutine1:
.
.
.
ret


The AT89C2051 part definitely supports the ACALL instruction (so claims the data sheet and I've successfully used it myself).

What is the exact error that you are seeing in each assembler? Does the rest of your source compile OK?

Can you post the exact source that is giving an error (or make a small example that demonstrates the issue if the code itself is confidential)?


I just figured it out. The subroutine definition must go first before calling it:

   org 0
   sjmp start

subroutine1:
   .
   .
   .
   ret

start:
  .
  .
  .
  acall subroutine1

Thanks psmears for confirming that "acall" instruction really works for AT89C2051.

@All, you may vote up this answer if this helped you. Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜