Hello,
I´m having very serious problems trying to write inside internal flash memory in PIC18F27J53. This device does not have an EEPROM memory, therefore I have to save the data inside internal Flash memory.
The main problem I have is that when I rewrite any postion the value is not saved correctly. I´m not able to write a byte in an addres that it has been writen before even erasing it before and rewriting it later.
The write size that I´m using is 2 Bytes and the erase size is 1024 Bytes.
Please help me,
Thank you very much
I´m having very serious problems trying to write inside internal flash memory in PIC18F27J53. This device does not have an EEPROM memory, therefore I have to save the data inside internal Flash memory.
The main problem I have is that when I rewrite any postion the value is not saved correctly. I´m not able to write a byte in an addres that it has been writen before even erasing it before and rewriting it later.
The write size that I´m using is 2 Bytes and the erase size is 1024 Bytes.
Please help me,
Thank you very much
Code:
#include <18F27J53.h>
#fuses NOCPUDIV,NOWDT,NOPROTECT,PLLEN,PLL2,CLOCKOUT,INTRC_PLL_IO// , NOPROTECT
#PIN_SELECT RX2=PIN_C1 //Pines utilizados para la UART
#PIN_SELECT TX2=PIN_C0
#use delay(clock=48000000)
#use rs232(uart2,baud=920000,xmit=PIN_C0,rcv=PIN_C1,bits=8,stream=PORT1 )
void main()
{
disable_interrupts(GLOBAL);
//delay_ms(100);
write_program_eeprom(0x1FF80,0xAABB);
//delay_ms(500);
write_program_eeprom(0x1FFC0,0xCCDD);
erase_program_eeprom(0x1FF80);
write_program_eeprom(0x1FF80,0xAABB);
while(1);
}