Searching \ for 'otp overblow' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=otp+overblow
Search entire site for: 'otp overblow'.

Truncated match.
PICList Thread
'otp overblow'
1996\05\25@191337 by Adriano De Minicis

flavicon
face
> If you're crafty you can change already programmed code, but only by
> changing 1s to 0s.  This could still be very useful if those 1s and 0s
> are in the data part of a literal instruction...

I use a simple trick to permit modifications on the code of a OTP
part (in my case a 16C54, but I think that it works well with some
modifications on the other PICs). I've used it also with windowed
PICs, to make quick changes without waiting the UV-erasure time.

It works by converting instructions to NOP (that has code 0x000).

This trick permits to substitute only parts of code called by a
GOTO or CALL instruction. I explain with an example, since my
english is not so good.. sorry :-)

Suppose you have a subroutine XYZ that you want to modify N times.

       goto/call XYZ
       ...
XYZ     bsf     PortB,1
a       ...
       ...
       retlw   0

Instead of jumping directly to XYZ, you jump to a jump-table XYZ_JT
composed of N words. The first time the jump table has the following
structure (here N=3):

       goto/call XYZ_JT        ; jumps to generic XYZ
       ...
XYZ_JT  goto    XYZ1            ; jumps to the first version of XYZ
       data    0xFFF           ; 0xFFF leaves spaces for a second jump
       data    0xFFF           ; and a third jump..
XYZ1    bsf     PortB,1         ; first version of XYZ
a       clrwdt
       ...
       retlw   0

When you have to modify the XYZ1, leave XYZ1 *UNMODIFIED*, add
at the end of the program (where the EPROM is erased) the new version,
substitute "goto XYZ1" with NOP (that it's possible since NOP is coded
with all zeros), and substitute the first data 0xFFF with a "goto XYZ2":

       goto/call XYZ_JT        ; jumps to generic XYZ
       ...
XYZ_JT  NOP                     ; ** CLEARED -> NOP **
       goto    XYZ2            ; ** put here where is v2 **
       data    0xFFF           ; and a third jump..
XYZ1    bsf     PortB,1         ; first version of XYZ
a       clrwdt
       ...
       retlw   0
                               ; previous end of program
XYZ2    bcf     PortB,2         ; second version of XYZ
       goto    a               ; jump to unmodified code

Note that if the modification concerns only instructions at the beginning
of XYZ, you don't have to rewrite the entire XYZ, since you can jump to
the old unmodified part of XYZ1 (in the above example, I've changed
only the first instrucition).

The trick is more difficult to explain than to use. The trick may be
extended many times. The only drawback is the growing delay of the
jump. Be careful to leave the rest of the code the same as before,
otherwise if something is shifted up/down there will be certainly
programming errors (0->1, impossible).

Adriano

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...