gnupic: Thread: gpsim & sleep


[<<] [<] Page 1 of 1 [>] [>>]
Subject: gpsim & sleep
From: Yann Gouy ####@####.####
Date: 27 Mar 2003 17:43:42 -0000
Message-Id: <1048786240.1804.316.camel@mvc2>

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.

a+
	Yann


Subject: Re: gpsim & sleep
From: "Declan. Moriarty" ####@####.####
Date: 28 Mar 2003 09:33:31 -0000
Message-Id: <20030328092126.GA201@genius.chateau.dec>

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.
Subject: Re: gpsim & sleep
From: Ralf Forsberg ####@####.####
Date: 28 Mar 2003 11:03:53 -0000
Message-Id: <20030328105047.GA10340@home.se>

On Thu, Mar 27, 2003 at 06:30:33PM +0100, Yann Gouy wrote:
> 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

Open the 'breadboard' or 'pins' window and click on the pin.

There is a bugs related to sleep registered at:
http://sourceforge.net/tracker/index.php?func=detail&aid=576916&group_id=2341&atid=102341

> if someone can help me, it would be very kind.

There's probably a bp.clear_sleep() missing somewhere, probably
around PORTB::setbit in src/ioports.cc. But don't know enough about the
sleep mode and portb interrupts to make a reasonable patch for this.

 / Ralf

Subject: Re: gpsim & sleep
From: Yann Gouy ####@####.####
Date: 28 Mar 2003 11:30:45 -0000
Message-Id: <1048850272.1804.359.camel@mvc2>

I can manage to find out my problem.

if someone can help me, here is the very heart of my bug:

list   p=16f877
include "p16f877.inc"

	__CONFIG	_CP_OFF & _DEBUG_OFF & _CPD_OFF & _LVP_ON & _BODEN_OFF &
_PWRTE_ON & _WDT_OFF & _HS_OSC

;------------------------------------------
;	début du programme
;
	ORG	0x0000
	nop
	goto	main

;------------------------------------------
;	routine d'interuption
;
; tout le traitement du vol est fait dans cette interruption
; on ne rentre dans cette interruption que si le décollage a
; été correctement détecté (accéléro + SV >= 1)
;
	ORG	0x0004
	retfie			; fin de l'interruption

;------------------------------------------
;	routine principale
;
main:
	movlw	TRISB		; on configure le portB
	movwf	FSR		;
	movlw	b'11111111'
	;	  1		non utilisée
	;	   1		non utilisée
	;	    1		non utilisée
	;	     1		non utilisée
	;	      1		non utilisée
	;	       1	signal 2/3
	;	        1	signal 2/3
	;	         1	signal accéléro-contact
	movwf	INDF
	movlw	PORTB
	movwf	FSR
	clrw
	movwf	INDF		; par défaut, les sorties sont à zéro

	; on configure le PIC pour sortir du mode sleep
	; lorsque l'accéléro-contact s'enclenchera (front montant)
	movlw	INTCON
	movwf	FSR
	bcf	INDF, INTF	; INTF = 0 IT nettoyée
	bsf	INDF, INTE	; INTE = 1 IT permise pour réveil
	movlw	OPTION_REG
	movwf	FSR
	bsf	INDF, INTEDG	; RB0 int sur front montant
	nop

	; puis on s'endort
	;sleep
scan:
	nop
	goto scan

	; si on s'est réveillé et que l'on revient ici,
	; c'est que l'enclenchement de l'accéléro n'était
	; pas justifié, il faut donc recommencer au début
	goto	main

END

Subject: Re: gpsim & sleep
From: Scott Dattalo ####@####.####
Date: 28 Mar 2003 14:59:35 -0000
Message-Id: <Pine.LNX.4.44.0303280646220.27428-100000@ruckus.brouhaha.com>

On Fri, 28 Mar 2003, Ralf Forsberg wrote:

> On Thu, Mar 27, 2003 at 06:30:33PM +0100, Yann Gouy wrote:
> > 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
> 
> Open the 'breadboard' or 'pins' window and click on the pin.
> 
> There is a bugs related to sleep registered at:
> http://sourceforge.net/tracker/index.php?func=detail&aid=576916&group_id=2341&atid=102341
> 
> > if someone can help me, it would be very kind.
> 
> There's probably a bp.clear_sleep() missing somewhere, probably
> around PORTB::setbit in src/ioports.cc. But don't know enough about the
> sleep mode and portb interrupts to make a reasonable patch for this.


I concur -- there is a bug in gpsim.

Scott

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.