PIC16F:

 

1. Protections:

PIC16F family microcontrollers use bits in a special Configuration Word to set protection. These bits are programmed along with the main code and cannot be changed during runtime.

 

1.1 Read Protection:

Read protection prevents unauthorized reading of program code and data from the microcontroller's memory via a programmer.

Read Protection Bits:

Bit Description State CP (Code Protection) Protects the entire Flash program memory from external reads. 1 = Off, 0 = On CPD (Data Code Protection) Protects the Data EEPROM memory from external reads. 1 = Off, 0 = On

 

1.2 Write Protection:

Write protection prevents software from modifying certain areas of memory. This is useful for protecting a bootloader or calibration data.

Write Protection Bit:

Bit Description State WRT (Write Protection) Allows protecting a portion of the Flash program memory from being written to. Depending on the model, it can protect the upper half, a quarter, or just the boot block. 1 = Off, 0 = On

 

1.3 Unprotection:

The only way to clear the Code Protection (CP) bit is to perform a Bulk Erase command using a programmer. This operation destroys all content in the program memory and data EEPROM. After this, the microcontroller can be reprogrammed with new configuration bits.

 

2. Configuration Word:

All configuration bits, including protection bits, are stored in one or more 14-bit Configuration Words. These words are located in a special configuration memory area that is not part of the program space.

Configuration Word Location (Example for PIC16F877A):

Address Register 0x2007Configuration Word

Note: For newer families like the PIC16F1xxx, there may be two configuration words at addresses 0x8007 and 0x8008.

Key Security-Related Bits:

LVP (Low-Voltage Programming Enable): Enables low-voltage programming mode. If this bit is enabled, a high voltage Vpp is not required on the MCLR/VPP pin to enter programming mode. For better security, it is recommended to disable this mode (LVP=0).

MCLRE (Master Clear Enable): Defines the function of the MCLR pin. If the bit is disabled, the MCLR pin becomes a regular digital input, which can make it harder to reset and reprogram the device.

 

3. Device IDs:

PIC16F microcontrollers have memory locations for storing identifiers.

ID Locations:

Address Description 0x2000 - 0x2003 User ID (4 locations, user-programmable) 0x2006 Device ID (Device and Revision ID, read-only)

 

Microchip Technology

 

Ask your question: RussianSemiResearch@ya.ru

 

 
RussianSemiResearch. © 2008-2025.E-mail: RussianSemiResearch@ya.ru