please dont rip this site

Microchip instruction CALL

See Pageing

On the 12-bit-core PIC (does not apply to 14-bit-core chips like the f84 and f877) and on the SX chips a subroutine to be called can only exist in the first (256 instruction) half of a 512 instruction page (the call sets bit 8 to 0, no way around that). The only way to call a subroutine anywhere in memory is to have a vector (a goto) in a lower half of a page and call that vector. James Cameron [quozl at us.netrek.org] http://quozl.netrek.org/ says:

[vector tables go] sort of like this ...
        org     0x0
        goto    main

; vector table
alpha   goto    alpha_real
beta    goto    beta_real
delta   goto    delta_real

main
        call    alpha
        [code]
        call    beta
        [etc]
        goto    main

alpha_real
        [lots of code]
        retlw

beta_real
        [lots of code]
        retlw

delta_real
        [lots of code]
        retlw

The point being that this allows the *_real entry points to exist anywhere within the bank memory. You CALL the vector table entry point, and it does a GOTO to the real entry point. It works because GOTO has the extra bit for the address that CALL does not.

If your code extended beyond 0x200, you could place a different vector table at the low end of the second page ...

        org     0x200

; vector table
alpha   bank0
        goto    alpha_real

beta    bank0
        goto    beta_real

However with this trick your code would have to take care to restore PA0 before it tries the next CALL or GOTO within 0x200 to 0x3fe ...

high    call    alpha
        bank1
        goto    high

--


/Techref/member/roger_froud-virgin-/index.htm Here's a handy little program for a 18F2480 that allows you to embed a string in your program which is accessed by the preceding call. In this case, it's used to write strings to an LCD display but the principle is useful elsewhere.

See also:


file: /Techref/microchip/instr/call.htm, 2KB, , updated: 2012/11/29 11:09, local time: 2024/12/30 08:38,
TOP NEW HELP FIND: 
3.144.3.235:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/microchip/instr/call.htm"> Microchip instruction CALL</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .