16F1823 - Can't get RA3 (MCLR) to be a switch input (attached switch resets PIC).


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You can test the input for 0, but any interrupt flag bits that get set should always be cleared before re-enabling the interrupt.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    You can test the input for 0, but any interrupt flag bits that get set should always be cleared before re-enabling the interrupt.
    Thanks once again Bruce, here's my interrupt handler now (complete with a clear flag at the end!)...

    Code:
    Switch_Interrupt:
    @ INT_DISABLE IOC_INT  ; Disable further IOC while handling an IOC interrupt
    
            IF Sw1 = 0 AND Sw2 = 1 THEN           
            HSEROUT ["INTERRUPT Sw1", 13, 10]
            goto interrupt_end
            endif
            
            IF Sw1 = 1 AND Sw2 = 0 THEN
            HSEROUT ["INTERRUPT Sw2", 13, 10]
            goto interrupt_end
            endif
            
            IF Sw1 = 0 AND Sw2 = 0 THEN
            HSEROUT ["INTERRUPT Sw3", 13, 10]
            goto interrupt_end
            endif
     
            interrupt_end:
            IOCAF = 0
    @ INT_ENABLE IOC_INT
    
    @ INT_RETURN

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