I am trying to implement the "Ultra Low Power Wake Up" feature on a small PIC project. The idea is the chip will go to sleep, and then be woken up in the future by the ULPWU interrupt.  

The idea behind the ULPWU is that you connect a capacitor to this pin, charge it and put the chip to sleep. When configured, the ULPWU pin will slowly discharge the capacitor. Once the voltage on the cap falls to some value, the chip wakes up and possibly generates an interrupt.  

This [application note](http://ww1.microchip.com/downloads/en/AppNotes/00879D.pdf) (PDF) from Microchip explains how the ULPWU is programmed and implemented. See Example 2 and Figure 2 (below).

**Example 2:**

    BANKSEL PORTA           ;
    BSF PORTA, 0            ;Set RA0 data latch
    BANKSEL ANSEL           ;
    BCF ANSEL, 0            ;RA0 to digital I/O
    BANKSEL TRISA           ;
    BCF TRISA, 0            ;Output high to
    CALL CapDelay           ;charge capacitor 
    BANKSEL PIR2            ;
    BCF PIR2, ULPWUIF       ;Clear flag
    BANKSEL PCON            ;
    BSF PCON, ULPWUE        ;Enable ULP Wake-up
    BSF TRISA,  0           ;RAO to input
    BSF PIE2, ULPWUIE       ;Enable interrupt
    MOVLW B’11000000’       ;Enable peripheral
                            ;interrupt
    MOVWF   INTCON          ;
    SLEEP                   ;Wait for interrupt
    NOP                     ;

<br/>
![enter image description here][1]

I have carried this out but am stuck with a strange problem.

When the chip goes to sleep, there is 5V being supplied by the ULWU pin (RA0). If I connect this pin to ground, the chip wakes up and does what it is supposed to do.  

My question is, why is there 5V on this pin when it is supposed to be an input? If I have this pin connected to a charged capacitor, the capacitor never discharges (the 5V on the pin is keeping it charged).

**EDIT**  
Here is my test code. I am not using a capacitor in this case. I am simply switching the RA0 pin from high to low. The question remains, why is RA0 High when it is supposed to be discharging a capacitor in order to trigger the wake up feature?  

    INCLUDE	registers.asm
    __CONFIG 0x2EFF20E5
         ORG	0x00
        GOTO	MAIN
    ;***********************************************
    ;Interrupt Service Routine
    ;turn on an led and return
    ;*********************************************
        ORG	0X04
    ISR
        BANKSEL	PORTD
        BSF	PORTD,7
	RETFIE

    MAIN
        CALL	SETUP
        CALL	SETUP_WU
        SLEEP
    TRAP
        GOTO	TRAP
    
    SETUP
        BANKSEL	ANSELH
        CLRF	ANSELH		;CONFIGURE ALL PINS FOR DIGITAL IO
        CLRF	ANSEL
        BANKSEL	TRISD	;PORTD IS OUTPUT
        CLRF	TRISD
        BANKSEL	PORTD
        CLRF	PORTD
        RETURN

    SETUP_WU
        BANKSEL	PORTA
        BSF	PORTA,0
        BANKSEL	ANSEL
        CLRF	ANSEL
        BANKSEL	TRISA
        BCF	TRISA,0
        BANKSEL	PIR2
        BCF	PIR2,2
        BANKSEL	PCON
        BSF	PCON,5
        BSF	TRISA,0
        BSF	PIE2,2
        MOVLW	B'11000000'
        MOVWF	INTCON
        RETURN
	
    END


  [1]: https://i.sstatic.net/gvfPY.png