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 trying to understand startup files, here an example start_mx.a51
;----------------------------------------------------; START_MX.A51: This code is executed after processor reset. ; You may add this file to a uVision2 project.
according to this defintion, always after reset this codes will execute
here is an another part:
PDATASTART EQU 0H ; the absolute start-address of PDATA memory PDATALEN EQU 0H ; the length of PDATA memory in bytes.
for example if i determine program data memory 100H PDATALEN EQU 100H ;
IF PDATALEN <> 0 MOV R0,#PDATASTART MOV R7,#LOW (PDATALEN) CLR A PDATALOOP: MOVX @R0,A INC R0 DJNZ R7,PDATALOOP ENDIF
according to this code all the program memory will clear after reset. why this codes necessary? why the programmers wants clear their program memory, if i clears program memory , program dosent work. is it true?
thank you very much for your helps, may be i can use similar this;
main(){ xdata unsigned char initilize_flag _at_ 0x0AFF /*also located at nvram*/ if (initilize_flag != 253){ initilize_nvram_variables(); initilize_flag = 253; } //others parts.. }
it is only a little possible that there is 253 value in nvram(0x0AFF) at the beginning