Getting Into and Out of Deep Sleep on PIC24FJxxxGCxxx Family Parts
All deep sleep-related registers on PIC24FJxxxGCxxx family devices must be written to twice in order for the device to go into and come out of deep sleep.
The following code example puts the target device in deep sleep and releases the I/O pins after waking from deep sleep: