12f1822, serial RX under interrupt, echo program doesn't want to play


Results 1 to 9 of 9

Threaded View

  1. #8
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: 12f1822, serial RX under interrupt, echo program doesn't want to play

    Are you missing a bank select in that code snippet?

    Code:
    asm
    myint:
        banksel PIR1            '                    |B0
        btfss   PIR1,RCIF       '                    |B0
        goto    int_out         '                    |B0
        bcf     PIR1,RCIF       '                    |B0
        banksel RCREG           '                    |B3
        movfw   RCREG           '                    |B3
        banksel _RX_BYTE        '                    |B?
        movwf   _RX_Byte        '                    |B?
        banksel TXREG           '                    |B3
        movwf   TXREG           '                    |B3
        nop                     '                    |B3
        btfss   PIR1,TXIF       '                    |B0 <-- *****
        goto    $-1             '                    |B0
           
    int_out:    
        retfie
    endasm
    If _RX_Byte is in bank 0, then maybe this would work?

    Code:
    asm
    myint:
        banksel PIR1            '                    |B0
        btfss   PIR1,RCIF       '                    |B0
        retfie                  '                    |B0
        bcf     PIR1,RCIF       '                    |B0
        banksel RCREG           '                    |B3
        movfw   RCREG           '                    |B3
        movwf   TXREG           '                    |B3
        banksel _RX_BYTE        '                    |B0
        movwf   _RX_Byte        '                    |B0
        btfss   PIR1,TXIF       '                    |B0
        goto    $-1             '                    |B0
        retfie                  '                    |B0
    endasm
    Last edited by Mike, K8LH; - 6th December 2012 at 02:52.

Similar Threads

  1. Two interrupt sources in one program
    By Art in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th January 2012, 15:12
  2. confused problem with interrupt in a working program
    By illuminator4 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th November 2008, 17:01
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. How can i use Interrupt in my program??
    By alabbadi in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th November 2007, 13:28
  5. Simple Interrupt Program
    By eoasap in forum General
    Replies: 5
    Last Post: - 28th October 2005, 16:22

Members who have read this thread : 0

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