Code Protection


Closed Thread
Results 1 to 12 of 12

Thread: Code Protection

  1. #1
    Join Date
    Sep 2006
    Posts
    4

    Default Code Protection

    How do I protect my code from someone reading the device? I am using a PIC16F876A. I want to ensure someone cannot remove the chip to read it. Does doing this impair the ability for microcode studio to program the device?

    Thanks,

    Joe.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JoeEvert View Post
    How do I protect my code from someone reading the device? I am using a PIC16F876A. I want to ensure someone cannot remove the chip to read it. Does doing this impair the ability for microcode studio to program the device?

    Thanks,

    Joe.
    Code protection is all in the datasheets.

    And no it won't impair Microcode Studio's ability to do anything, 'cause Microcode Studio isn't a PIC programmer. However, no matter what programmer you've got, code protection only affects readback from the PIC. If you try to program over a code protected PIC, generally, the programmer will have to do a complete erasure, thereby erasing any code that was there in the first place.

  3. #3
    Join Date
    Sep 2006
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Yes, I looked at the data sheet, unfortunately it does not discuss the code protection bit in detail. It says it exists but does not discuss what the ramifications are with using it. The datahsheet says this is bit 13 of the configuration word?

    Specifically how is this used? If I set the bit to 1 it implies that the code is protected. Is that written at device program time? Is there a directive to indicate this? Specifically I am looking for how to implement this in my code or is this only implemented in the firmware program options.

    On the ME programmer there is a code protection option. Does that do the same thing? The application does not remember the setting I choose and appears to default to disabled when it loads.

    Thanks,

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JoeEvert View Post
    Yes, I looked at the data sheet, unfortunately it does not discuss the code protection bit in detail. It says it exists but does not discuss what the ramifications are with using it. The datahsheet says this is bit 13 of the configuration word? Specifically how is this used? If I set the bit to 1 it implies that the code is protected. Is that written at device program time? Is there a directive to indicate this? Specifically I am looking for how to implement this in my code or is this only implemented in the firmware program options. On the ME programmer there is a code protection option. Does that do the same thing? The application does not remember the setting I choose and appears to default to disabled when it loads. Thanks,
    And the datasheet isn't going to discuss code protection in detail, that's the whole idea. Suffice to say, if you try to read a code protected device the 'normal' way, you'll get garbage.
    You set the appropriate config word bit as required. You program the flash, eeprom, id, etc, verify it all, the write the config word. The PIC isn't protected until that config word with that particular config bit is written.
    If you're programmer doesn't remember it's settings, either it's not supposed to (hard to believe) or you've got a software problem. Probably something to do with path's or something. I don't have that programmer, I don't know. Generally, I set my bits in the source code, and don't worry about it.

  5. #5
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Just set code protection in your programmer - (blowing fuses) I believe if you want to be very secure you can make a little socket which grounds all the pins except the PGM pin and then apply like 24V to the PGM pin which will render that pin usless.

  6. #6
    Join Date
    Jan 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Exclamation 12C508A code protect problem

    Hi All,

    I programmed a 12C508a chip and wrote code in configuration to protect the code. I programmed it with EPIC Programmer Ver2.44 and also set the code protection to all in options menu.

    The chip is programmed but not protected. When I Read data in EPIC Programmer, it reads the chip and by menu View code it show the contents of the program in Hex format.

    Why it does not protect the chip? Any help in the problem???

    Shahzad

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by thetrueman View Post
    I programmed a 12C508a chip and wrote code in configuration to protect the code. I programmed it with EPIC Programmer Ver2.44 and also set the code protection to all in options menu.
    Are you sure you didn't set them to ALL OFF?

  8. #8
    Join Date
    Jan 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default 12C508A Code Protection

    Hi,

    Yes while programming at the top of code I confing Code Protect ON and while downloading to chip, in the EPIC programmer software options menu I set Code protection to ALL.

    I just read this chip with ALL-100 Universal Programmer and it reads the chip 12C508A. So how to protect the code to be invisible to others???

  9. #9
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Some programmers have a setting to read the config in the hex file or not... maybe your programmer is using default settings.

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi, Thetrueman

    1) could you show us your config settings ( from the program AND read from the chip ).

    2) now ... keep cool, but the C series chips are really easy to " crack" ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  11. #11
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    Hi Alain. I doubt that he still has the code. Its been ... 2 years now!

    Were you having any of the fine French wines?

    Please do sent me a bottle!

    Ioannis

  12. #12
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi, Ioannis,

    You're perfectly righ ...

    I begin to open the 1989 - 90 vintages ... really nice !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Error 0X0000008E when connecting a 18F2550 USB HID
    By FranciscoMartin in forum USB
    Replies: 8
    Last Post: - 16th October 2008, 17:20
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Can't remove code protection of 16F88!!!
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2006, 13:18

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts