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.
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.
"It is necessary for my application. " This is a non-answer. There are some VERY experienced programmers here. If you explained WHY you think it is necessary, you could well get a response which makes your life much simpler!
Because we are using specific register or data buffer mapping 51's external memory. Thanks your advice.
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.