We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I use #pragma asm/#pragma endasm to embed Assembler Code in C Function.
My question is:
How can I accessing a variable in Assembler Code,which define by C code.
Just like this:
I need height speed to accessing XDATA from Addr 0x0000.
void Func() {
unsigned char Var_C,i=0;
#pragma asm
mov DPTR,#0x0000
#pragma endasm
while(i++ < 0x10)
{
Var_C = ReadOneByte();
if(Var_C == 0xff)
Var_C = 0;
}
MOV A,Var_C /* This line is not work */
MOVX @DPTR,A
INC DPTR
Build target 'Target 1'
compiling main.c...
main.src(181): error A45: UNDEFINED SYMBOL (PASS-2)
Thanks!!!
By the way,I guess your source code style would well make criticisms unhappy like Erik,Andy...
"I guess your source code style would well make criticisms"
It's not the style of the source itself - it's the inability to follow the simple instructions that are clearly given in the Notes right above the Message window when you make your post!
If you can't sope with such obvious stuff, how are you going to work out the intricacies of interfacing 'C' to assembler...?