Hi all i want to read RTC time parameters. RTC is treated as one of memory location,it gets enabled when parameters are refered. following where the codes:
struct tm{ unsigned char xdata second _at_(0xe000); unsigned char xdata minute _at_(0xe002); unsigned char xdata hour _at_(0xe004); }; void main() { struct tm time; printf("seconds %x",time.second) ... }
struct tm{ unsigned char second _at_(0xe000); }
xdata unsigned char second _at_(0xe000); xdata unsigned char minute _at_(0xe002); xdata unsigned char hour _at_(0xe004); void main() { printf("\nseconds %x",second); printf("\nminutes %x",minutes); printf("\nhours %x",hour); }
struct tm{ unsigned char xdata second _at_(0xe000); unsigned char xdata minute _at_(0xe002); unsigned char xdata hour _at_(0xe004); }; void main() { struct tm time1,time2; ......
Thanks for reply. with following code:
struct tm { unsigned char second; unsigned char res1; unsigned char minute; unsigned char res2; unsigned char hour; }; struct tm xdata time _at_ 0xe000; // time starts at 0xe000 !! void main() { }
struct tm xdata time1 _at_ 0xe000; struct tm xdata time2 _at_ 0xe000;
"will compiler assign following addrress for struct elements?" I think you need to go back to your 'C' textbook and read-up on the way structures work. what if i define:struct tm xdata time1 _at_ 0xe000; struct tm xdata time2 _at_ 0xe000; You have declared two different variables at the same memory address - this will probably give you a Linker error! Why would you want to do this?