gnupic@linuxhacker.org

gnupic@linuxhacker.org


Subject: Re: gpsim & sleep
From: Declan. Moriarty
Date: Fri, 28 Mar 2003 09:21:26 +0000

On Thu, Mar 27, 2003 at 06:30:33PM +0100, Yann Gouy enlightened us thusly
> Hi,
> 
> when debugging my app, I'm not able to go out of "sleep" when RB0 goes
> high from low. I have configured OPTION_REG correctly (it seems)
> I am trying to set RB0 high with the RAM window, but as it is configured
> as input, I can't
> 
> my target is a 16f877.
> 
> if someone can help me, it would be very kind.
> 

Read. Print the datasheet. ~200 pages and take it to bed!!

I would

1. Take all the config stuff that affects this and put it in a separate
subroutine. Personally, I wouldn't worry about RB0 being an input; I
would be very careful of INTCON, PIR1, & PIR2. Then run a 'find' on your
code to make sure there isn't another instruction affecting the stuff.

2. Double check all INT settings, __CONFIG settings (config word) and
PORTB settings. If you have anything spurious enabled in PORTB, there's
a strange pecking order as to what settings take precedence. Also make
sure RB0 is actually high before you pull it low! 

3. Write a small program as follows.
Let's take it that RB1 is unused on your device. (Use any pin you like).

Setup_instructions:
bcf PORTB, 1
Sleep

	You will stop here. Then physically pull RB0 low

bsf PORTB, 1

4. Program a pic and try it. Step through with gpsim & try it. Does RB1
go high?


5. If that doesn't work, post it here.
-- 

	With best Regards,


	Declan Moriarty.

gnupic@linuxhacker.org