I have the following structure:
struct fence_struct { unsigned char mode; char sitename[13]; unsigned char sector_nr; unsigned char sector_tot; unsigned int start; unsigned int feeder_offset; unsigned int len; unsigned int line_len; unsigned char begin_far; unsigned int res_norm; unsigned int res_min; unsigned int res_max; unsigned char wire_amount; unsigned char wire_name[12]; }; xdata struct fence_struct fence;
strcpy(fence.sitename, "SITENAME");
;strcpy(fence.sitename, "SITENAME"); ;SOURCE LINE # 1535 MOV R0,#LOW (fence+01H) MOV R4,#HIGH (fence+01H) MOV R5,A MOV R3,#0FFH MOV R2,#HIGH (?SC_403) MOV R1,#LOW (?SC_403) LCALL ?C?STRCPY
;strcpy(fence.sitename, "SITENAME"); ;SOURCE LINE # 4306 MOV R0,#LOW (fence+01H) MOV R4,#HIGH (fence+01H) MOV R5,#01H MOV R3,#0FFH MOV R2,#HIGH (?SC_403) MOV R1,#LOW (?SC_403) LCALL ?C?STRCPY
I've checked that I don't write to the MCON register anywhere in my code. I only write to it after the hex file has been loaded into pgm mem while the MCU is still in Pgm mode. Yes, I specify in Keil that the Code mem is from 0x0000-0x6FFF and the Xdata mem is from 0x7000-0x7FFF. I've also noticed that a second reset (after the 1st which took it out of pgm mode) has the same effect as a cold start.