A little DT_INT confusion.


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I am not sure where the problem is either.
    Maybe it has something to do with setting the interrupt registers before the instants are enabled. Darrel.s routine sets these so you do not need to do it.

    Reading through other post this seems similar (post 52 and 53). I am sure you have read them but it is all I can find at the moment.
    http://www.picbasic.co.uk/forum/show...3402#post23402

    And I think this is related
    http://www.picbasic.co.uk/forum/show...=9786#post9786

    Did you say what PIC you are using?
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Angry

    It's a PIC18F2520.

    I was going to run the risk of talking to myself, and add another short bit - I finally got smart, and put something in the main loop, so I could see if the uart interrupt handler ever returned from it's job, and found that it isn't!!

    Everything just appears to stop after a uart interrupt. It does what it's suppose to, (reads from one port, and writes to the other) and never returns to the main loop.

    I'm at a loss, and hoping that would be of some help.

    Code:
    'INITIALIZE INTERRUPTS
    ASM
    INT_LIST  MACRO       ;IntSource,Label,Type,ResetFlag?
            INT_Handler INT2_INT, _EXTTS,PBP,yes
            INT_Handler RX_INT, _RDRINT,PBP,yes                     
        ENDM
        INT_CREATE                               ;CREATES THE INTERRUPT PROCESSOR 
    ENDASM
    
    START:
    GOSUB CLS
    PAUSE 100
    SEROUT2 DIAGOUT,MODE,["SDIF2 VER. 1",10,13]
     
    'ENABLE INTERRUPTS
    @ INT_ENABLE RX_INT                          ;READER UART INTERRUPT
    @ INT_ENABLE INT2_INT                        ;EXTERNAL INTERRUPT
    
    '======================
    MAIN:
    '======================
    SEROUT2 DIAGOUT,MODE,["."]
    FOR X=1 TO 100
         PAUSE 1
    NEXT X
    GOTO MAIN
    
    '======================
    RDRINT:                                      'TAG READER INTERRUPT! 
    '======================                     
    HSERIN [WAIT($02),STR TAG\8\$03]             'READ TAG FROM THIS PORT      (WORKS)         
    SEROUT2 DIAGOUT,MODE,[STR TAG,10,13]         'SEND TAG DATA TO THIS PORT   (WORKS)                                                              
    @ INT_RETURN                                 ; <=== THIS IS NOT RETURNING! (DOES NOT WORK)
    
    ''======================
    EXTTS:
    ''======================
    'SEND SPECIAL DATA NOW 
    SEROUT2 DIAGOUT,MODE,["00995031",10,13]      '(WORKS)
    @ INT_RETURN                                 ;(WORKS)
    Last edited by circuitpro; - 20th October 2010 at 01:32.

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Dave! You nailed it. I don't know how you remember/find all these links!!

    I changed the Uart interrupt to this, and it now works:

    Code:
    '======================
    RDRINT:                                      'TAG READER INTERRUPT! 
    '======================                     
    HSERIN [WAIT($02),STR TAG\8\$03]             'READ TAG FROM THIS PORT      (WORKS)         
    SEROUT2 DIAGOUT,MODE,[STR TAG,10,13]         'SEND TAG DATA TO THIS PORT   (WORKS)
    While PIR1.5 = 1     ; clear the buffer
        HSERIN [X]
    Wend                                                              
    @ INT_RETURN                                 ; <=== NOW WORKING :-)
    I want to really look up what that is doing now, and write a note or two. THANK YOU.

    Len
    Last edited by circuitpro; - 20th October 2010 at 01:49.

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