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.
I would like to know if I can use "_at_" to locate struct members to absolute memory locations. For instance, I have a struct variable defined as following,
xdata struct { unsigned char member1; unsigned char member2; . . unsigned char member5; unsigned char member6; } myStruct;
Hi, Alan, you could easily test your case yourself and it would take less time than just typing your question. :-) Regards, M.
Mikhail, I certainly tried in my code and it did not work. I was only hoping there might be a trick somewhere somehow I can pull. My goal is to re-write a large piece of 8051 assembly code with C51 and it is preferable to keep the memory map intact if possible. If what is said is true about violating C principles, then I guess I just have to give up this idea entirely. Thanks to you all. p.s. Typing is nothing as long as I don't chicken-dance on the keyboard. ^__^
If you describe your problem in detail maybe we could think of something. Probably I shouldn't have said what I said about violating priciples. But if you think of it, imagine that a structure has a member located at an absolute memory location. What would sizeof(structure) mean? What would happen if there were two variables of that type? Or an array? Re-writing assembly code in C is no easy task. In some cases it can be easier to figure out how the program works and re-write it from scratch. If you wish to preserve some of the original structure of the program, maybe it's better to use macros to emulate features that are not present in C. Best luck! - Mike