piclist 2001\04\05\121957a >
Thread: Calling subroutines in a 16C57 Paged Memory?
www.piclist.com/techref/microchip/memory.htm?key=memory
flavicon
face BY : David Cary email (remove spam text)



Dear Ian Hynes,

I agree that the paging mechanism on the PIC is annoying.

That's why I always use the
 BANKISEL ; Select Bank for indirect access via FSR and INDF
 BANKSEL ; Select RAM bank
 PAGESEL ; Select ROM page (for GOTO and CALL)
macros (aren't they built into your assembler ?)
rather than trying to roll my own macros.

Ian Hynes <elekSTOPspamspamspam_OUTNETSTRA.COM.AU> on 2001-04-05 06:06:47 AM wrote:


>Bank_0 MACRO             ;Page & Bank select macros.
> bcf   FSR,5
> bcf   FSR,6
> ENDM
>
>Bank_1 MACRO
> bsf   FSR,5
> bcf   FSR,6
> ENDM

This just looks wrong to me. The FSR doesn't have any page select bits; it's
(the lo 8 bits of) a pointer. (The hi bits are set in a different register using
BANKISEL).

...
>        Page_1
>        Bank_1
>        call    test01        ;Call a routine in Page #1
>        nop                   ;We should finish up here.
>        goto    $

My assembler (MPASM) Does the Right Thing when I say
    PAGESEL test01
    call test01
.
(When I look at the ``.lst'' file, I see that PAGESEL expands to some BSF and/or
BCF instructions, similar to your macros).

{Quote hidden}

Did you know that the bits that control which bank of RAM one can access are
*different* from the bits that control which page of ROM one can GOTO ?

I would write
    BANKSEL FWD_TIME
    movf FWD_TIME,w
    BANKSEL charac
    movf charac,w
    PAGESEL lcdtx4
    call lcdtx4
which works correctly no matter where those items are located.

--
David Cary

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspamBeGonespamRemoveMEmitvma.mit.edu with SET PICList DIGEST in the body


<86256A25.0059A141.00@Brunswickoutdoor.com>

See also: www.piclist.com/techref/microchip/memory.htm?key=memory
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Calling subroutines in a 16C57 Paged Memory?

month overview.

new search...