18F2480 asm interrupt


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default 18F2480 asm interrupt

    Hi All

    I have created an assembler interrupt handler for a PIC18F2480 using the following code.

    DEFINE INTHAND InterruptHandler
    ASM
    InterruptHandler
    ; ********* Serial Framing Error Interrupt *********
    btfsc RCSTA,2 ; check if serial framing error interrupt is set
    call _FramingError ; call serial framing error subroutine
    ; ********* Serial Overrun Error Interrupt *********
    btfsc RCSTA,1 ; check if serial overrun error interrupt is set
    call _OverrunError ; call serial overrun error subroutine
    ; ********* Serial Receive Interrupt *********
    btfsc PIR1,5 ; check if serial receive interrupt is set
    call _ReceiveSerialData ; call receive serial data subroutine
    ; ********* Serial Transmit Interrupt *********
    btfss _TxFlag ; check if serial transmit flag is set
    goto InterruptHandlerEnd ; goto interrupt handler end
    btfsc PIR1,4 ; check if serial transmit interrupt is set
    call _TransmitSerialData ; call transmit serial data subroutine
    InterruptHandlerEnd
    retfie FAST ; return from the interrupt
    ENDASM

    My question is, do I need to have my wsave, ssave and psave variables for context saving or does the 18F2480 handle all the context saving and restoring? If I do need context saving, what variables do I need?


    Any help would be greatly appreciated.


    Thanks

    Richard

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Yes you need to save the context. Look at the PIC18F2480's data sheet page 128. It even gives you the ASM code to save and restore the context.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Using Darrel Taylor's "Instant Interrupts" would get the job done right the first time.
    Charles Linquist

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies.

    Richard

Similar Threads

  1. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  2. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  3. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  4. 16F877a ASM Interrupt Confused
    By modifyit in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th September 2005, 03:16
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts