code

Discussion in 'Embedded Systems and Microcontrollers' started by Jeeny, Apr 9, 2012.

  1. Jeeny

    Jeeny Thread Starter New Member

    Joined:
    Apr 9, 2012
    Messages:
    5
    kindly helping me to solve this: differential between PETFIE & RETURN
    for pic18f4580
    thx...
  2. chrisw1990

    chrisw1990 Active Member

    Joined:
    Oct 22, 2011
    Messages:
    543
    Location:
    UK, Near Brighton
    you mean RETFIE?
  3. chrisw1990

    chrisw1990 Active Member

    Joined:
    Oct 22, 2011
    Messages:
    543
    Location:
    UK, Near Brighton
    IF i am right, you mean RETFIE, find the info here: different processor but the point is RETFIE is assembly and return is C.
    RETFIE
    return
  4. t06afre

    t06afre AAC Fanatic!

    Joined:
    May 11, 2009
    Messages:
    5,939
    The datasheet is the PIC programmer best friend. Download it from here http://ww1.microchip.com/downloads/en/devicedoc/39637c.pdf See section 25 for the instrction set. If you still need help free feel to ask
    Jeeny likes this.
  5. Jon Wilder

    Jon Wilder New Member

    Joined:
    Oct 25, 2011
    Messages:
    23
    RETURN is used for subroutines. RETFIE is used to return from interrupts (RETurn From IntErrupt).

    When an interrupt source on a PIC generates an interrupt, the GIE bit in INTCON gets cleared by hardware, which disables all unmasked interrupts. The instruction counter then jumps to the interrupt vector address in program ROM and executes the interrupt handler code that resides there.

    Upon executing an RETFIE instruction at the end of the interrupt handler, the GIE bit gets set, which re-enables all unmasked interrupts. If you use RETURN instead of RETFIE, it will still return from the interrupt, but interrupts will not get re-enabled.
Similar Threads
Forum Title Date
Embedded Systems and Microcontrollers getting problem in code showing lot of error Saturday at 3:29 AM
Embedded Systems and Microcontrollers pic code for metering Oct 16, 2014
Embedded Systems and Microcontrollers PIC opcode decoder question Oct 14, 2014
Embedded Systems and Microcontrollers multiplexing code problem Oct 7, 2014
Embedded Systems and Microcontrollers pic 16f877a code problem (frequency counter) Oct 3, 2014

Related Site Pages

Section Title
Worksheet Microcontroller principles

Share This Page