unsigned int Begin; ... Begin=*(U16 CODE *)Begin; ... ;---- Variable 'Begin' assigned to Register 'DPTR' ---- 002C 8F82 MOV DPL,R7 002E F583 MOV DPH,A ; SOURCE LINE # 82 0030 E4 CLR A 0031 93 MOVC A,@A+DPTR 0032 F583 MOV DPH,A <--- Error: This line change the DPTR value. 0034 7401 MOV A,#01H 0036 93 MOVC A,@A+DPTR <--- Error: Wrong address. 0037 F582 MOV DPL,A
What are the U8 and U16 types? Also, why not try this with the latest C51 release? There have been 9 releases since 7.01. Jon
Thanks a lot for all your kindly reply! I know my code looks weird, such as
Begin=*(U16 CODE *)Begin;//U16 means unsigned short
void CopyRomData (U8 XDATA *Des,U8 Index) { U8 CODE *pbSrc; unsigned int Begin;//Keil 2B, Win32 4B. SysSetRomPage(ROM_PAGE1);//Change Bank, it means the following "MOVC" will retrieve data from specify bank. Begin=(unsigned int)&((BankH1 CODE *)0)->OffsetData[Index];//Data offsets are located on begginning of each bank. WinWork(winGetRomAddr(&Begin));//For simulator. Begin=*(U16 CODE *)Begin; WinWork(Begin=U16X(Begin));//Hi-Lo exchange, little-Endian for PC. WinWork(winGetRomAddr(&Begin));//For simulator. pbSrc=(U8 CODE *)Begin;//Both Target and PC could get the right address. strcpy(Des,pbSrc);//I just want to copy string, but keil's library seems refer to 'MOVC' internal(It will access to wrong bank), That's why I wrote a loop myself(see pre post). SysSetRomPage(ROM_PAGE0); }
My CA51-v7.0 product is out of date (1 year/Bought on Sep2002). Can I still download the most update version? You should be able to download 7.07 or 7.07a. Jon
Jon, Thank you! Kenny