Hello all,

I need to store data in the D-Flash Memory portion (0xF000 - OxFFFF) in the XC878. I am using the the Flash program subroutine located in the address 0xDFF6.

The datasheet states that we must setup DPTR0 with the start address of the flash programming location, DPTR1 with the XRAM start address containing Flash data to be programmed, R1 with Number of bytes to be programmed and EA=0.
So, I have came up with the following solution. But it's not working. (copying 0x20 bytes).

Code:
#define 	RESERVED_DFLASH_PAGES		        9

#define 	RESERVED_FLASH					288


code const ubyte dflash[RESERVED_FLASH] _at_ 0xF000;

xdata volatile ubyte flashBuffer[RESERVED_FLASH];

EA = 0;

		#pragma asm 
		mov			r1, #20H
		mov			EO, #00H
		mov DPTR, #dflash
		MOV      MEX2, #0x02
		mov			EO, #01H
		mov 		DPTR, #flashBuffer		
		#pragma endasm
		
		((void(code *)(void))0xDFF6)();
		
		EO = 0x00;
	
	EA = 1;
Have someone already done this ?