Hi,
How to use 24 bit addressing in keil for DP 8051.
We want it in C language.
What do you mean by "REG8 is an 8 bit register"?
REG8 is the name of a define - it has no actual meaning in itself.
The value returned when using the REG8 macro is an unsigned long.
#define REG8 (*((volatile unsigned long int xdata *)(x))
If in this case I take data type as char instead of long int it will be of 8 bit.
i.e.#define REG8 (*((volatile unsigned data xdata *)(x))
In previous case it is taken as long int it returns the 32bit value.
This ia an example.
If you intend to access 8 bits of unsigned data, you should write "unsigned char". If you just write "unsigned", it will return an unsigned integer which is 16 bits.
For size of data types, see: http://www.keil.com/support/man/docs/c51/c51_ap_datastorage.htm
And once more, do be careful about naming conventions. Your original definition of REG8 returned unisgned long, which for the C51 compiler is 32 bits.
If you have hardware memory-mapped into the far data space, then yes, a declaration similar to this will work. (The comments already made about data types are well put.)
Your hardware external to the 8051 will of course have to decode the 24-bit address bus and select whatever device it is that has these registers. The details will be in the data sheet for your particular 8051 variant.