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

PIC 12F1572 NVM Read/Write/Erase

  • Device driver re configuration.

    Votes: 0 0.0%
  • General algorithm for byte by byte to set of 14-bit by 14 -bit

    Votes: 0 0.0%

  • Total voters
    0

Thread Starter

ArvindAllAboutC

Joined Oct 10, 2018
2
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
 

Picbuster

Joined Dec 2, 2013
1,047
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
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
 

AlbertHall

Joined Jun 4, 2014
12,345
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.
 

jpanhalt

Joined Jan 18, 2008
11,087
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.
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.
 
Top