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

Truncated match.
PICList Thread
'Program length'
1997\06\25@163031 by 61)

flavicon
face
I apologize for the relatively simplistic question re: RTFM material.
I am writing my first PIC '84 program.

It maps out to 01BE in length in terms of EPROM used for the program
(via the xxxx.LST output file from MPASM).

When adding YANF (Yet Another Neat Feature) ... (actually fix a bit of bad
logic) the length increases past this length (to 01AD for example).

The program now does not function.  It appears that the if I have the
functioning program and continuously add nops to the program I can get to a
point where the program ceases to function, therefore no matter what the
code is  ... even jumped over code ... the length itself creates the
symptom of crashing.  Is not the maximum space for a '84 larger than this?
Or is a maximum  program length to 200H - FFH (data registers + misc
space)?

Thanks,
Mike

1997\06\25@165532 by Mike Keitz

picon face
On Wed, 25 Jun 1997 22:29:54 +0200 "Michael Giuggio (Tel (860)763-6861)"
<spam_OUTMichael.GiuggioTakeThisOuTspamPE.LSI.LEGO.DK> writes:
>I apologize for the relatively simplistic question re: RTFM material.
>I am writing my first PIC '84 program.
>
>It maps out to 01BE in length in terms of EPROM used for the program
>(via the xxxx.LST output file from MPASM).
>
>When adding YANF (Yet Another Neat Feature) ... (actually fix a bit of
>bad
>logic) the length increases past this length (to 01AD for example).
>
>The program now does not function.  It appears that the if I have the
>functioning program and continuously add nops to the program I can get
>to a
>point where the program ceases to function

<...>

What has probably happened is the extra code inserted has moved some of
the targets of computed jumps (usually used to access RETLW tables) out
of the first 256 program words.  Unless you set the PCLATH register
otherwise, ADDWF PCL,f MOVWF PCL, etc. will always land in 256 word
"page" 0 (PC=00XX).  For example, if you have a table at 0xFE:

; This instruction is at 0xFE now.  Before adding a neat feature, it was
at ;  0xF0, and the program worked then.
gettabl addwf   PCL,f
       retlw   05
; Next instruction is at 0x100.  This is bad.
       retlw   08
       retlw   03
       retlw   04

If you call gettabl with 2 in W, expecting it to return 8, suprise.  What
will actually happen (if PCLATH is still 0) is the PIC will jump to 0000,
starting the program over as if a reset had occurred.  Not good.

I find it convenient to move all the RETLW tables and other targets of
computed gotos up to page 3 with an ORG h'300' directive, then set PCLATH
to 3 while initializing all the TRIS registers, etc. after reset.  The
tables will then stay put if code is added or removed from the rest of
the program.  Or you can put all the tables in first, then org the rest
of the program to 0x100.

1997\06\26@121043 by ggio (Tel x6861)

flavicon
face
I want to publically thank MKEITZ on the quick analysis.  A sharp head.
I don't believe I ever would have found it....
(and I thought I was just getting comfortable with the PIC) <smiled sigh>.
Note:  The '84 has only 1 real page  ... 3rd page is not an option, I moved
the
computed jumps up in code space.  Thanks again.

                 My Q condensed:
>>I am writing my first PIC '84 program.
>>When adding YANF (Yet Another Neat Feature) extending the length of
>> program made it not function.
><...>
                   His (Mike's?) Reply Condensed
{Quote hidden}

1997\06\26@133532 by vanes

flavicon
face
Mike Keitz wrote:
{Quote hidden}

Hi!

Try this: it allows you to put your lookup tables wherever you want 'em.
You can even put them ON the edge of the first page and run over to the
second page.

;===================LOOKUP TABLE
LOOKUP
       MOVWF   OFFSET          ;MOVE
       MOVLW   HIGH    BASEADD ;LOAD HIGH BYTE OF BASE ADDRESS INTO W
       MOVWF   PCLATH          ;HIGH BASEADD INTO PC-LATCH
       MOVLW   LOW     BASEADD ;LOAD LOW BYTE OF BASE ADDRESS INTO W
       ADDWF   OFFSET,W        ;ADD OFFSET TO PC LOW
!!-->>  BTFSC   STATUS,C        ;TEST FOR ROLL-OVER IN PC
!!-->>  INCF    PCLATH          ;INCREMENT PCLATH IF ROLL-OVER DETECTED
       MOVWF   PCL             ;LOW BASEADD INTO PCL

BASEADD RETLW   B'01111101'     ;1 - DUD! DUE TO MOD8 INCREMENTING TO 1
       RETLW   B'01111101'     ;1
       RETLW   B'10101010'     ;2
       RETLW   B'01101010'     ;3
       RETLW   B'11100100'     ;4
       RETLW   B'01111000'     ;5
       RETLW   B'10101100'     ;6
       RETLW   B'01101001'     ;7

--
eric van es
vanesspamKILLspamilink.nis.za
cape town, south-africa

1997\06\26@202304 by Ray Gardiner

flavicon
face
snipped original problem
{Quote hidden}

Nice solution Eric, why didn't I think of that? ,don't answer ;-)
For a slight run time penalty this is a much neater way than some
of the macro based solutions I have seen.






Ray Gardiner  Technical Director DSP systems Pty. Ltd. .....rayKILLspamspam.....dsp-systems.com
private email to:- EraseMErayspam_OUTspamTakeThisOuTnetspace.net.au          http://www.dsp-systems.com

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