Hi,
how can I identify a memory type of any generic pointer in C51 code?
Thanks.
A generic pointer's encoding is described in the manual.
http://www.keil.com/support/man/docs/c51/c51_ap_genericptr.htm
Ok, thank you, but... what should I write instead of "???" in the sample below to detect the memory type of the generic pointer (function parameter)?
void mem_type_detector (char *generic_ptr) { switch (???) { case 0x00: // DATA //... break; case 0x01: // XDATA //... break; //... } }
switch (*(unsigned char*)&generic_ptr)
Oh, and your function should really be:
void mem_type_detector (void *generic_ptr)
I'd also create an enum (or at least series of #defines) for the constant values of the type tags.
View all questions in Keil forum