Can you show more code? What you've done so far seems ok. ----- Original Message ----- From: Barry King To: Sent: Friday, April 14, 2000 12:11 Subject: Won't interrupt on change > This should be easy, but I can't get it to work- I'm trying to put > the PIC to sleep and wake up on keypress, but the PIC won't wake up. > > I looked in the FAQ and all, but no joy, so here is the situation: > > I'm using Port B to scan a 16 key matrix. RB0..3 are active low scan > lines, RP4..7 are the read back lines, RBPUs active. All OK, been > there, done that, decoded it, have the T-shirt :) > > I want to put the PIC to sleep and wake up on any key press. > > So, I set the scan lines all active (RB0..3 are low), > (I checked- they are low) > I TRIS port A and C for minimum current draw, but I don't TRIS port B. > Then I: > -mask my other interrupt sources > -read PortB to set the current state (RB4..7 are high). > -clear the RBIF > -enable the RBIE > -enable GIE > -SLEEP > > PIC is asleep, the osc stopped. > > I never wake up when a key is pressed. Clearly, PORTB is changing > state, I can see it on the scope, nice low level on a previously high > RB7. I can jiggle that port all I want and it won't wake up or reset. > > Target is a 16LC76/JW with a blindfold over its window. > > I can run the code right up to the point of the SLEEP under emulation > (PICMASTER), and all the FSRs are set as I outlines above. If I hang > in a loop like: > > here: goto here > > ...instead of executing the Sleep, The PIC gets the interrupt, the > ISR runs, and I "wake up". > > I thought maybe the PICMASTER was unable to wake from sleep under any > circumstance, but I burned a real chip with the same code, and it > won't wake either. > > Which stupid thing did I forget? > > Thanks all, > > Barry. > ------------ > Barry King, KA1NLH > NRG Systems "Measuring the Wind's Energy" > http://www.nrgsystems.com > Check out the accumulated (PIC) wisdom of the ages at: > PIC/PICList FAQ: http://www.piclist.org >