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.