Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use code protection?

Status
Not open for further replies.

Engr Saeed

Newbie level 5
Joined
Jun 7, 2011
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Pakistan
Activity points
1,343
hi guys


i wnt to know ,how can i made my pic mcrocontroller safe from reading.means how to implement code protect in pic microo controller.
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

What chip/compiler?
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

check this

PIC read protect
In WinPic800:

Click "Setting" next to "data" on the toolbar.

Check the CP and the CPD check boxes. This will tell WinPic800 to clear the code protect bit and the code protect data bit to disable a read of the program memory or the EEPROM memory.

orr

If you use universal programmer in LABTOOL , then it gives you option to do it.. so the option has to be given by the software you use to program the controller..
**broken link removed**
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

Download the appropriate datasheet for your PIC, search for "code protection" for its particulars.

For example, for a PIC16F87XA, code protection is controlled by the WRT0, WRT1 and CPD bits contained in the CONFIGURATION WORD REGISTER:

bit 10-9 WRT1:WRT0 Flash Program Memory Write Enable bits
For PIC16F876A/877A:
11 = Write protection off; all program memory may be written to by EECON control
10 = 0000h to 00FFh write-protected; 0100h to 1FFFh may be written to by EECON control
01 = 0000h to 07FFh write-protected; 0800h to 1FFFh may be written to by EECON control
00 = 0000h to 0FFFh write-protected; 1000h to 1FFFh may be written to by EECON control
For PIC16F873A/874A:
11 = Write protection off; all program memory may be written to by EECON control
10 = 0000h to 00FFh write-protected; 0100h to 0FFFh may be written to by EECON control
01 = 0000h to 03FFh write-protected; 0400h to 0FFFh may be written to by EECON control
00 = 0000h to 07FFh write-protected; 0800h to 0FFFh may be written to by EECON control

bit 8 CPD: Data EEPROM Memory Code Protection bit
1 = Data EEPROM code protection off
0 = Data EEPROM code-protected

Hope this points you in the right direction.
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

You can set both the FLASH and EEPROM code protection by using the Configuration Bit Settings in the MikroC IDE, look for CPD and WRT bits.
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

Hmm... Seems that MikroC doesn't have code protection for 877.

You could try something like:
Code:
#pragma config CP1 = OFF
#pragma config CP2 = OFF
#pragma config WRT = OFF

I haven't used this, so it up to You to test.

Check pages 46 & 120 in the datasheet for correct settings.

EDIT:
There's 'Flash program write' setting. I'm not sure if that is code protection, since 877a has separate code protection setting.
 

Re: HOW TO USE CODE protection........................................ URGENTLY:;;;;;

i have used it but it does not work as my old chap has read my chip and copied it.

---------- Post added at 21:42 ---------- Previous post was at 21:41 ----------

iam using 877a and i want to use code protection for it
 

Here's the winPIC's file format of device.ini, it has a setting to configure code and data protection:

File format of WinPic's PIC device list

The only other alternative is to use the assembly example of activating code protection in the PIC16F87XA datasheet and embedded the assembly code in your C program.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top