1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Problem with internal memory in PIC18F27J53

Discussion in 'Code Repository' started by sixto91, Mar 23, 2015.

  1. sixto91

    sixto91 New Member

    Joined:
    Jan 22, 2015
    Messages:
    7
    Likes:
    0
    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



    Code (text):
     #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);


    }


    [​IMG]
     

Share This Page