AnsweredAssumed Answered

EEPROM addressing issue

Question asked by Chayan Roy on Apr 15, 2017
Latest reply on Apr 16, 2017 by Chayan Roy

Hello,

Here is my code for writing a byte into internal eeprom. Problem is  when -ever  I write a byte to the internal data rom ,its is  written to (address+1)  place into the  rom ...what I  mean to say..is ..if I try to  write some  value say..8 ..at a specific address ..say..0x4021,the value  is written to  the address 0x4022 instead of address 0x4021.  I am readingthe written content in STVP. Am I making  any mistake......any suggestion will be great help to me. Thanks.

 

#include "STM8S003F3P.h"

 

 unsigned int *ptr=(unsigned int *)0X4000;
 
main()
{
while (1){

 

if(!(FLASH_IAPSR & (1<<3))){
                            
                            FLASH_DUKR=0XAE;
                            FLASH_DUKR=0X56;
                            
                            *ptr++=7;
                            FLASH_IAPSR &=~(1<<3);
                            
                            
                            
                            }

 


}
}

Outcomes