Skip to main content
added 1090 characters in body
Source Link
Michael
  • 948
  • 1
  • 7
  • 23

EDIT
I need to put a pin in this for a while. I should have done alot more work before posting the question. Rather then just waste people's time, I need to pause this for a little bit.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

EDIT
I need to put a pin in this for a while. I should have done alot more work before posting the question. Rather then just waste people's time, I need to pause this for a little bit.

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
added 200 characters in body
Source Link
Michael
  • 948
  • 1
  • 7
  • 23

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 (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                     ;

![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
I need to put a pin in this for a while. I should have done alot more work before posting the question. Rather then just waste people's time, I need to pause this for a little bit.

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 (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                     ;

![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).

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 (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                     ;

![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
I need to put a pin in this for a while. I should have done alot more work before posting the question. Rather then just waste people's time, I need to pause this for a little bit.

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 (PDF) from MicroshipMicrochip 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                     ;

![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 wakedwakes 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).Thanks.

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 (PDF) from Microship 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                     ;

![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 waked 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).Thanks.

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 (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                     ;

![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).

Tweeted twitter.com/#!/StackElectronix/status/290625094370349056
remove salutations, add PDF warning, add reference figures/code
Source Link
Loading
Source Link
Michael
  • 948
  • 1
  • 7
  • 23
Loading