Embedded Sys: PIC 12F1572 NVM Write/Erase/Read.

Discussion in 'Embedded Systems and Microcontrollers' started by ArvindAllAboutC, Oct 10, 2018.

PIC 12F1572 NVM Read/Write/Erase

  1. Device driver re configuration.

    0 vote(s)
    0.0%
  2. General algorithm for byte by byte to set of 14-bit by 14 -bit

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. ArvindAllAboutC

    Thread Starter New Member

    Oct 10, 2018
    1
    0
    Hello,

    I am working on the PIC Micro controller where it got a data flash of 128 bytes which were divided into 74 locations(14 bits each), I have an requirement of writing 100 bytes on the memory.

    Upto my understanding in order to write into NVM PMADRH: PMADRL register pair should be filled with the desired register next to it then load the data and initiate the operation, But there is a problem in here How can I write a 100 byte buffer/Array into the Data flash which got divided into the locations of 14 bit each. May be this calls for a bigger complexity in writing/reading. even if I proceed, I cannot afford for it in terms of code memory as only 26 bytes left.

    Kindly correct me if my understanding is wrong, and help me with an solution
     
  2. Sensacell

    Moderator

    Jun 19, 2012
    1,934
    593
    You can compress the data- 7 bytes fits into 4 X 14 bit words.
     
  3. Picbuster

    Active Member

    Dec 2, 2013
    791
    97
    I do not understand where this 74 locations comes from. Please explain
    Each byte in flash is normal addressable in this case 128 locations.
    Your compiler should have read and write commands like
    eeprom_write(Position, bytevalue);
    xxx =eeprom_read(Position);
    some use structures and read/write the structure.
    It,s all in the C compiler manual.
    The function will handle all interrupts and timing thingies to write and get that byte.

    Picbuster
     
  4. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,383
    1,478
    This chip has flash program memory (14 bits per location) which you can use to store data but this shoud only be used for data that does not change often.

    There is also 128 bytes HEF (high endurance flash) memory but the data sheet does not include much about it.

    I was going to use a chip with HEF but it is nowhere near as easy to use as EEPROM so I ditched that chip and used one with EEPROM.
     
  5. jpanhalt

    Expert

    Jan 18, 2008
    6,318
    1,190
    1) If you only have 26 bytes of program memory left, how can you use that for 100 bytes of NVM?
    2) If it is a buffer, why does it need to be NVM?
    3) If you can use RAM (i.e., general purpose ram), that can be addressed as one block using the FSR's. It will be more than sufficient for 100 bytes.
     
Loading...