Hi,All I try to define the start_address type, //------------------------------------- unsigned char xdata Start_Address _at_ 0x2000; //------------------------------------- and also need to access 0x2001,0x2002,...... my solution is repeat define the address, but it is poor efficiency. Is there are any function like (Start_Address+1),(Start_Address+2)...... can implementation ? or any suggestion. Thanks.
If you have mapped some peripheral (with a set of registers) to XRAM area, it's a good practice to declare a structure that describes your peripheral and then locate that structure to the absolute address of your peripheral... for example: struct { unsigned char status_reg; unsigned char command_reg; unsigned char address_reg; }MY_HARDWARE _at_ 0xF000; Later you can access the registers like: MY_HARDWARE.command_reg=0x55; if (MY_HARDWARE.status_reg&0x80) { ... } regards Dejan
good practice to declare a structure that describes your peripheral One reason for doing this instead of pointer offsets or an array is to help your source-level symbolic debugger become able to display the registers of the peripheral with nice human-readable names.