| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| loupan 
 
 
 Joined: 22 Oct 2007
 Posts: 21
 
 
 
			    
 
 | 
			
				| Boot Block Code Protection Bit |  
				|  Posted: Thu Apr 01, 2010 2:18 pm |   |  
				| 
 |  
				| If I understand the data sheet for the 18f8722, there are 2 code protection bits that seem to overlap: 
 bit 6 CPB: Boot Block Code Protection bit
 1 = Boot block (000000-0007FFh) not code-protected
 0 = Boot block (000000-0007FFh) code-protected
 
 An then bit 0 of the CPn bits (CP0):
 
 bit 7 CP7: Code Protection bit(1)
 1 = Block 7 (01C000-01FFFFh) not code-protected
 0 = Block 7 (01C000-01FFFFh) code-protected
 bit 6 CP6: Code Protection bit(1)
 1 = Block 6 (01BFFF-018000h) not code-protected
 0 = Block 6 (01BFFF-018000h) code-protected
 bit 5 CP5: Code Protection bit(2)
 1 = Block 5 (014000-017FFFh) not code-protected
 0 = Block 5 (014000-017FFFh) code-protected
 bit 4 CP4: Code Protection bit(2)
 1 = Block 4 (010000-013FFFh) not code-protected
 0 = Block 4 (010000-013FFFh) code-protected
 bit 3 CP3: Code Protection bit(3)
 1 = Block 3 (00C000-00FFFFh) not code-protected
 0 = Block 3 (00C000-00FFFFh) code-protected
 bit 2 CP2: Code Protection bit
 1 = Block 2 (008000-00BFFFh) not code-protected
 0 = Block 2 (008000-00BFFFh) code-protected
 bit 1 CP1: Code Protection bit
 1 = Block 1 (004000-007FFFh) not code-protected
 0 = Block 1 (004000-007FFFh) code-protected
 bit 0 CP0: Code Protection bit
 1 = Block 0 (000800, 001000 or 002000(4)-003FFFh) not code-protected
 0 = Block 0 (000800, 001000 or 002000(4)-003FFFh) code-protected
 
 
 
 Are these one and the same? I realize that CP0 has to also use the fuse that sets the size associated with CP0 (4K, 2K, or 1K), but assuming I set it to 1K, do these two configuration bits do the same thing?
 
 Thanks for any help.
 |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Apr 01, 2010 2:42 pm |   |  
				| 
 |  
				| They are not the same, because Block 0 protection (CP0) starts at a minimum address of 0x800.   The Boot Block protection (CPB) always
 start at address 0x0000  (and ends at 0x7FF).
 |  | 
	
		|  | 
	
		| loupan 
 
 
 Joined: 22 Oct 2007
 Posts: 21
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Apr 02, 2010 5:38 am |   |  
				| 
 |  
				| Thanks PCM Programmer! |  | 
	
		|  | 
	
		|  |