Andreas Luft

need help about writing in flash (56F8036 / 16 bit controller)

Discussion created by Andreas Luft on Jun 6, 2007
Latest reply on Jun 19, 2007 by Andreas Luft
Hello at all,

I am using 56F8036 16 bit microcontroller and I dont know why but I can't write to the flash memory. I have tried the following:

//--- the significant portion of the code: ----------------------------------------------------------------
[...]
#include "periph.h"        // includes: #define periphBitClear( Mask, Addr )  (*(Addr) &= ~(Mask))
#include "IO_Map.h"     // includes: #define FM_PROT   *((volatile word *)0x0000F410)
void pmem_writing();   // prototyp
[...]
void update(void)
{
    UInt16 addr_m;
    UInt16 value_m;
    UInt16 *p_value_m;

    periphBitClear(0xFFFF, &FM_PROT);
           
    addr_m = 0x2000;
    value_m = 0x1234;
    p_value_m = &value_m;

    pmem_writing(addr_m, *p_value_m);
}
[...]
inline void pmem_writing(register UInt16* addr, register UInt16 data)
{
   asm(move.w  data,p:smileysad:addr)+);
}

// --------------------------------------------------------------------------------

But it does not work, what am I making wrong?

Outcomes