Professional Documents
Culture Documents
on the PIC10F322, the FPM is broken down into rows XXDh 0x23D8
consisting of sixteen 14-bit words, which are accessible
by an address of XX0h to XXFh. XXEh 0x23D9
Second, the FPM can only be erased by a minimum of XXFh 0x23DA Once the last 14-
a row at a time. When erased, the contents are set to bit word of the
all 1s. When writing, only 0s can be written. FPM row has been
written and the
XX0h 0x23DB User Data is
Third, again using the PIC10F322 as an example, updated and
Microchip specifies the minimum program Flash XX1h 0x3FFF
written again the
row is erased and
memory cell endurance to be 10K erase and write the updated User
cycles from -40C to +85C. Considering each memory XX2h 0x3FFF Data written to the
first locations of
cell as 1-bit in the 14-bit FPM word, this application the FPM row.
IMPLEMENTATION DETAILS This function writes and reads 12 bits of user data to
and from the FPM. A write is done by writing the next
The software library consists of one main function available/open FPM location (bits <11:0>). Bits
routine: <13:12> are used as flags, indicating if a FPM row
uint16_t ReadWrite_HEFlash(uint8_t location has been written or not, as follows:
rw, uint16_t data, uint8_t rowstar- Bits <13:12> = 0b11 = Open
taddr) Bits <13:12> = 0b10 = Written (Closed)
The arguments for the above function are the following: Write example:
rw designates if the function will perform a read ReadWrite_HEFlash(1, 0x3CA, 0xF0)
of the FPM or a write to the FPM
The above function will write a value of 0x3CA to the
rw = 1 = Write to FPM
next available/open FPM location within the row, which
rw = 0 = Read of FPM
has a starting address of 0xF0 (see Figure 1 and
data is the 12-bit value written by the user
Figure 2).
rowstartaddr is the starting address of the
FPM row being used. A rows starting address
can be determined by looking at the first nibble
starting with the LSB of the FPM addresses. The
beginning row address always starting with the
first nibble equal to 0x0. For example, 0xE0 to
0xEF is one row, with 0xE0 being the row start
address.
Initiate Write to
FPM
NO
End
Read example:
buffer = ReadWrite_HEFlash(0, 0x000,
0xF0)
The above function will return the last 12-bits value of
user data written to the selected FPM row and place the
value in buffer. In the case of a read, the data field
is a dont care and will be ignored. If a read is
performed and no user data has been written to the
FPM, a value of 0xFFF will be returned (see Figure 3
and Figure 4).
Initiate Read of
FPM
YES
End
void Save_INTERRUPT(void) {
SaveInt = INTCON; //save interrupt status
void Unlock_FLASH(void) {
PMCON2 = 0x55; //FLASH Write/ERASE Unlock SEQUENCE
PMCON2 = 0xAA;
WR = 1;
while (WR);
WREN = 0; //INHIBITS PROGRAMMING AND ERASING OF PROGRAM FLASH
}
void Write_FLASH(void) {
//PMCON1 = 0b00100100; //LOAD PROGRAM MEMORY Write LATCHES
//Unlock_FLASH();
PMCON1 = 0b00000100; //Write PROGRAM Write LATCHES TO PROGRAM MEMORY
Unlock_FLASH();
}
Interrupts
Special attention should be paid if interrupts are used in
the application. When interrupts are being used in the
main user code, save_INTERRUPT(); and
INTCON = SaveInt; should be on uncommented in
LPC_HEFlash.C.
This will cause the device to disable all interrupts
during read and write high-endurance FPM cycles, as
well as saving the state of the INTCON register before
a read or write cycle and restoring it afterwards. The
interrupts are disabled to avoid an interrupt occurring
during a read or write cycle and resulting in FPM data
corruption.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchips Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as unbreakable.
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchips code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
CERTIFIED BY DNV Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Companys quality system processes and procedures
are for its PIC MCUs and dsPIC DSCs, KEELOQ code hopping
== ISO/TS 16949 == devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchips quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.