This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to access global variables of C into Assembly

Hi Forum Members,
I am using Keil uVision2 for P89C51RD2HBP.
I want to access the "global variables defined in C" in assembly routine. The format of my program is as below:

#include <stdio.h>

unsigned char Var1;

void Func1 (void)
{
...
...
#pragma asm
  mov  a,Var1
#pragma endasm
...
...
}
When I compile this program it says
"error A45: UNDEFINED SYMBOL (PASS-2)"

How do I solve this problem ?

Thanking you in advance,
Mr. Kiran V. Sutar

Parents
  • To Forum Members,
    Thanks for your replies.
    After Long hours of reading the manuals and references applications, I got the solution to my problems.

    To Mr. Andy Neil,
    I am the same guy, who wrote the two queries. Because, After sending the first query, I realized, this problem will rise again later, when I write the interrupt routine, hence I posted 2 different messages. If that has caused some problem with the forum members, then I am sorry for the trouble.

    As for the solution to the following problem:

    "When I compile this program it says
    'error A45: UNDEFINED SYMBOL (PASS-2)'"

    It also tells you which symbol is undefined.


    The solution is to name the symbol with proper format as ?DT?SymbolName?Module.

    I had sent this query on this forum, so that I can get a quick solution; rather than going through tons of documentation and app.notes. And I (and almost everybody) am always working against time.

    I am using Avocet C-Compiler for the last 10 years, and am very much used to it. Only thing is I did not know the method for mixed coding in Keil.
    Well Reading the manuals has solved my problems. There are still some more problems but I think, I would rather read the manuals and get them to work, rather than wasting the valuable time of the forum members (and mine) in solving my queries on the forum.

    Well Thanks again to all of you.

    From Kiran V. Sutar.

Reply
  • To Forum Members,
    Thanks for your replies.
    After Long hours of reading the manuals and references applications, I got the solution to my problems.

    To Mr. Andy Neil,
    I am the same guy, who wrote the two queries. Because, After sending the first query, I realized, this problem will rise again later, when I write the interrupt routine, hence I posted 2 different messages. If that has caused some problem with the forum members, then I am sorry for the trouble.

    As for the solution to the following problem:

    "When I compile this program it says
    'error A45: UNDEFINED SYMBOL (PASS-2)'"

    It also tells you which symbol is undefined.


    The solution is to name the symbol with proper format as ?DT?SymbolName?Module.

    I had sent this query on this forum, so that I can get a quick solution; rather than going through tons of documentation and app.notes. And I (and almost everybody) am always working against time.

    I am using Avocet C-Compiler for the last 10 years, and am very much used to it. Only thing is I did not know the method for mixed coding in Keil.
    Well Reading the manuals has solved my problems. There are still some more problems but I think, I would rather read the manuals and get them to work, rather than wasting the valuable time of the forum members (and mine) in solving my queries on the forum.

    Well Thanks again to all of you.

    From Kiran V. Sutar.

Children
No data