Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to variable which exists outside the asm place in Keil?

Status
Not open for further replies.

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,045
Keil and Assembly

Hi,

How can i call a variable which exist outside the asm place ?

For example this doesn't work. Count is undiffiend symbol.

void main ()
{
unsgined char count;

.
.
#pragma asm
Mov Count,10
.
.

#pragma endasm

}

SphinX
 

Asnake

Newbie level 6
Joined
Dec 31, 2003
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
128
ke*il and Assembly

variable IS different in ke*il, you can find a pdf file named "c51.pdf" in you install dir. Read it , find your solution!
 

MyRDS

Newbie level 6
Joined
Jan 14, 2004
Messages
14
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
125
Re: Keil and Assembly

Try placing a '_' character in front of your variable
 

ntfreak

Full Member level 3
Joined
Feb 22, 2002
Messages
152
Helped
6
Reputation
12
Reaction score
0
Trophy points
1,296
Location
UK
Activity points
1,249
Re: Keil and Assembly

I have tried many times to come up with a good solution to this problem, most compilers will accept _ before the variable name, but not keil.

The problem is keil will rename a local variable, eg. char temp will become temp?046 and so you do not know the name of the variable to use in the inline asm.
You can look in the src file produced but this variable name can change.

You also have to use the #pragma src directive (at the top of your file), aswell as #pragma asm/endasm.

Hope this sort of helps, has anyone come up with a solution ?
NTFreak
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top