Jim Pantera

ram assy emulation code to page erase byte write flash

Discussion created by Jim Pantera on Sep 27, 2006
Latest reply on Sep 29, 2006 by Jim Pantera
does anyone have one for the mc9s08rd32dwe
i know people are doing this, what code is working for them, chime in please
i looked at a few but most of them are w/o documentation
-where is the flash command loaded
-the varriable to page erase and or write flash byte
-the data to be written to flash is declared where what

i tried this code:
#pragma DATA_SEG _RAMROUTINE
unsigned char Ram_Routine[] = {
0xc6,0x18,0x25,0xa5,0x10,0x27,0x07,0x45,0x18,
//address 1 //address 2
0x25,0xf6,0xaa,0x10,0xf7,0x32,0x06,0xA0,0xc6,0x06,0xA2,
0xf7,0xa6,0x40,0x45,0x18,0x25,0xe7,0x01,0xf6,0xaa,0x80,
0xf7,0x9d,0x9d,0x9d,0x9d,0xc6,0x18,0x25,0xc6,0x18,0x25,
0xa5,0x40,0x27,0xf9,0x81};
#pragma DATA_SEG DEFAULT

#pragma DATA_SEG _FLASHVARS
unsigned int FixedAddres; //by the code this seems to it should be 0x60 abouts
unsigned char DataToWrite;
#pragma DATA_SEG DEFAULT

//this is how the above is used:
//looking through my example DataToWrite is at 0x7e2 and FixedAddres at 0x7E0, but //looking at teh Ram_Routine code i think its 0x6e2 and 0x6e0. in most of the ram
//based flash erase write code not alot of documentation.
void Flash_Program(Byte data){
DataToWrite = data;
Ram_Routine[22] = 0x20;
__asm jsr Ram_Routine;
}

Outcomes