2017-04-15 05:44 AM
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); }}}2017-04-15 08:27 AM
>>
unsigned int *ptr=(unsigned int *)0X4000;
Perhaps unsigned char would be more appropriate for a pointer that advances one byte at a time?
2017-04-15 09:41 AM
Thanks Clive for your reply...I will do this
2017-04-16 04:55 AM
Hello Clive its working now. Thanks