View previous topic :: View next topic |
Author |
Message |
Prefekt
Joined: 21 Oct 2010 Posts: 85
|
PIC18f4550 does not wake up from sleep |
Posted: Thu Sep 29, 2011 2:13 pm |
|
|
Hello,
My PIC is sleeping after the sleep() command. But I can't wake up the pic?
I have from the ex_wakeup.c this:
Code: |
ext_int_edge(H_TO_L);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
|
On which pins will the pic wake up?
Anybody an Idea?
Best regards
Volker
Last edited by Prefekt on Sat Oct 01, 2011 5:54 am; edited 1 time in total |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Thu Sep 29, 2011 2:25 pm |
|
|
Look at section 3.3 in the datasheet titled SLEEP MODE and section 9.7 about interrupts.
Also, see Section 10.2 near the bottom of the first column. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
Prefekt
Joined: 21 Oct 2010 Posts: 85
|
|
Posted: Sat Oct 01, 2011 5:59 am |
|
|
Hello,
the ex_wakeup works fine.
But I my appliction the pic does not wake up. I USB the USB connection from the ex_usb_serial.c example and enable INT_EXT and GLOBAL interrupts.
On the pin B0 is a push button from +5V and a pull down resistor...
Best regards
Volker |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Oct 01, 2011 6:21 am |
|
|
Post your CCS compiler version and a short, complete, compilable program that shows the problem. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sat Oct 01, 2011 3:02 pm |
|
|
Seriously, you can't do this.....
If your device is connected to a USB bus, then you can't just put it to sleep. Doing so, risks putting the USB bus into an unpredictable state. The USB controller itself, should only be put to sleep, when an IDLEIF is received from the USB host. Otherwise, you need to leave the USB component powered (you can sleep the CPU itself). A device connected to the USB bus, _must_ respond when the master talks to it. It you completely sleep the CPU, this won't happen....
You can use sleep(SLEEP_IDLE), to leave the USB components powered.
Best Wishes |
|
|
|