How to protect code in 16f877a

62 views
Skip to first unread message

picgak

unread,
Oct 3, 2012, 10:04:50 AM10/3/12
to jal...@googlegroups.com
Hi,
How can we protect the programmed code from being read back or erased using JAL , I am using the bert library . can someone explain this in detail.
Thank you
Regards ani

Joep Suijs

unread,
Oct 3, 2012, 10:31:43 AM10/3/12
to jal...@googlegroups.com
Hi Ani,

I'n not sure if erase protection (from an external programmer) is
possible. Having said that, the features you want to use are set with
the 'configuration words' of a pic and are explained in detail in the
datasheet of the pic you use.
Configuration word settings are also refered to as 'fuses' and are set
in JAL with the 'pragma target' command. How exactly is determined by
the device files you are using.
Since you aren't using jallib device files (and have not mentioned
which pic you use), I can't help you on this. I suggest you ask your
question on the jallist (http://tech.groups.yahoo.com/group/jallist/).

Joep


2012/10/3 picgak <ani...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jallib/-/WWHf-DH4j0UJ.
> To post to this group, send email to jal...@googlegroups.com.
> To unsubscribe from this group, send email to
> jallib+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.

picgak

unread,
Oct 4, 2012, 1:31:59 AM10/4/12
to jal...@googlegroups.com

Hi Joep,
I am using 16f877A  the following portion of code is from the bert libray for 16f877a 

include 16f877a_inc_all
pragma target clock       20_000_000
const word _fuses         = 0x3fff ; default value
pragma target osc         hs
pragma target watchdog    off
-- HS, -BOD, ,-LVP, -WDT, -CP  = 0x3F22
pragma target fuses       0x3F32

To protect the code should I change something in this portion  -CP  = 0x3F22
Regards ani

Joep Suijs

unread,
Oct 4, 2012, 2:23:30 AM10/4/12
to jal...@googlegroups.com
Let me repeat part of of my reply ;)

> Since you aren't using jallib device files (...), I can't help you on

picgak

unread,
Nov 13, 2012, 7:10:11 AM11/13/12
to jal...@googlegroups.com


On Wednesday, October 3, 2012 7:34:50 PM UTC+5:30, picgak wrote:
Hi,
In Jallib how do we protect the code written on it
Thank you
Regards ani
 

vasile surducan

unread,
Nov 13, 2012, 8:24:49 AM11/13/12
to jal...@googlegroups.com
Hi, take the datasheet of the PIC16F877A and read how to protect de
code at page 144, bit 10-9

http://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf

then transform all the binary sequence there in hex and replace your
value which is 0x3F22 with the new one

Vasile
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jallib/-/pouowFjA87wJ.

Rob Hamerling

unread,
Nov 13, 2012, 10:17:58 AM11/13/12
to jal...@googlegroups.com


On 13-11-12 13:10, picgak wrote:

> On Wednesday, October 3, 2012 7:34:50 PM UTC+5:30, picgak wrote:
>
> In Jallib how do we protect the code written on it

Have a look in the device file. The last pragma is what you need to use
in your program. Hopefully you'll agree that:
pragma TARGET CP ENABLE
is what you are looking for.

Regards, Rob.


--
R. Hamerling, Netherlands --- http://www.robh.nl

picgak

unread,
Nov 13, 2012, 12:46:36 PM11/13/12
to jal...@googlegroups.com
Thanks Vasile and RobH for your quick and informative replay
Regards ani
Reply all
Reply to author
Forward
0 new messages