| | Darren Gibbs wrote: ===== ...I'm not sure what the point of the code protection bits is if you can read code with the table read instructions... ===== Hello Darren, You have to think about what 'protection' means from two angles: 1) From a PIC MCU programmatic sense (PIC's perspective while executing code) 2) And from and external device programmer sense (External device programmer's perspective) Sometimes you want the PIC MCU to be able to read/write some of its code memory (or combinations thereof) programmatically but you don't want a device programmer to do the same. Perhaps this breakdown I whipped up will help you to understand things a bit more: :: Code-Protect bit ---------------- 1) The 'Code-Protect bits' do not affect the PIC in a programmatic sense (regardless of the fact that the bits are either enabled or disabled) 2) The 'Code-Protect bits' (when enabled) will affect the ability for a device programmer to read the PIC's "true" contents (unless the PIC's true contents are 0s for the applicable code memory locations). :: Write-Protect bit ----------------- 1) The 'Write-Protect bits' (when enabled) do affect the PIC in a programmatic sense. If a block is table write-protected, the PIC will not be able to erase or write code memory programmatically -- even if the table write attempt occurs in the *same* code memory block that is table write-protected. 2) The 'Write-Protect bits' setting (in isolation) do not affect the ability for a device programmer to erase or write to the PIC's code memory. I say 'in isolation' meaning that the 'code protection' bits are assumed to be disabled for this statement to be true. :: External Block Table Read bit ----------------------------- 1) The 'External Block Table Read bits' (when enabled) do affect the PIC in a programmatic sense. If a code memory block is external table read-protected, the PIC will not be able to read the PIC's "true" contents from a code memory block outside of the code memory block that is table read-protected. However, *any* external table read-protected block can read its own memory contents. 2) The 'External Block Table Read bits' (in isolation) do not affect the ability for a device programmer to read the PIC's code memory. Again, I say 'in isolation' meaning that the 'code protection' bits are assumed to be disabled for this statement to be true. Darren, just spend some more time reading the data sheet and it should eventually make sense -- even if you have to re-read it ten times that is perfectly fine -- do not feel bad. Are you ok with the description of the Data EEPROM and configuration bits (aka configuration bytes, or configuration words) protection techniques? Best regards, Ken Pergola P.S. What Microchip usually refers to 'program memory' I usually refer to as 'code memory' since it is less awkward to say "program code memory' instead of 'program program memory (when referring to the act of programming this type of flash memory in the PIC MCU). -- Sent from the MicroControllers - PIC forum at Nabble.com: http://www.nabble.com/-PIC-Code-Protection-t840970.html#a2179848 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist