Surprisingly Useful PIC18F Discovery

Discussion in 'Embedded Systems and Microcontrollers' started by ErnieM, Sep 17, 2013.

  1. ErnieM

    Thread Starter AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Having used the 18F series Microchips only for several years, I know I don't know a tenth of what they can do...

    I just learned something I'd never noticed before: The CALL and RETURN instructions have an extra argument 's'.

    According to the datasheet, if the 's' argument is 1, then WREG, STATUS, and BSR are pushed onto the "fast return stack" for a CALL and popped off the stack for a RETURN.

    Neat, I thought...I could find some use for this.

    Now you need be careful when playing around as these use the "fast return stack" and that is the same fast return stack that is used for interrupts, regardless if RETFIE FAST instruction is used or not.

    So, basically, if you are not using interrupt at all you can grab the benefit of a super fast call and return for that one precious routine you need damn fast. Or multiple routines if you are damn careful not to call one from another.

    Leave it Microchip to leave no trick unused and make available some hardware where you just may need it.

    It's all well documented in the data sheet between the "INSTRUCTION SET SUMMARY" section 24.0 and section 9.9 "Context Saving During Interrupts."

    Just thought I'd bring this up for those who might be interested.
     
    joeyd999 likes this.
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,675
    2,722
    Good find, Ernie.

    I'm gonna have to check that feature out! :D
     
  3. Eric007

    Senior Member

    Aug 5, 2011
    1,041
    33
    Oh Oh lol...:)
     
  4. Eric007

    Senior Member

    Aug 5, 2011
    1,041
    33
    I created a thread asking about 'who write the datasheet and design' those PICs but I had no replies...

    So i'm going to ask it again! Is it a 'special' team of engineers within Microchip that sit and design/and write or ...anyway how does it work over there? anybody knows?
     
  5. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,163
    The people that know can't tell but if you need to order a few million of a custom part I'm sure someone will call you back to design it for you. :p
     
  6. Eric007

    Senior Member

    Aug 5, 2011
    1,041
    33
    Why they can't? Is it a secret? I'm just curious...
     
  7. ErnieM

    Thread Starter AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Perhaps this question would best be asked on the Microchip forum.

    They have actual MC employees looking at those.
     
  8. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,907
    2,163
    It was 98 percent a joke but typically the TD group and anyone who has access to future device plans is under an NDA about internal device processes and procedures. It doesn't mean it's secret, it's just that YOU are not authorized to talk about it. "ErnieM" is correct.
     
    Last edited: Sep 19, 2013
  9. Eric007

    Senior Member

    Aug 5, 2011
    1,041
    33
    A joke...:) well it sounded like one but...
    I think you know and can share the info since you are *part of the Microchip team* ... Humm so tell us... :D
     
Loading...