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

Local varible in same address

Hi All

I write a function like this

test.c
void a(U8 val)
{ U8 ch=0;

dev[ch].fun1(val); <--this is a function pointer , it will call the b function

dev[ch].fun2(val); <--Fail here
}

void b( U8 val)
{ U8 dummy = val *5;

writeReg[0x55AA]= dummy;
}

after run the " dev[ch].fun1(val)"

The ch varible will be change , so it will fail when run " dev[ch].fun2(val)"

I found the varible is in the same memory address, How can I avoid it??

and how can I know the memory map of all local varible ??

I found the m51 file , the data is map to 18h to 28h

DATA 0018H 0028H UNIT ?DT?TEST

why ch varible is map to 0x40 and same as dummy varible??

Thanks for you kindly help and sorry for my poor english

Parents Reply Children
  • Then you're going to have to keep researching & studying documentation until you do!

    There's a lot of other information - App Notes, knowledgebase articles, etc - I gave some links in the thread I mentioned earlier.

    Alternatively, perhaps you should take a hint that this is not something for which the 8051 is well-suited - and either restructure your application in a way that's more appropriate to the target, or choose a different target that's more appropriate to this kind of thing...