Jallist Archive Nov 2003

Re: Wake up from sleep using RB0/INT

From: "japus10" <japus11(at)terra.es>
Date: 03 Nov 2003 08:35:50 -0000

> pressed the first time I would like the PIC to store the current 
> status of port_b into eeprom, then zero port_b (to lower power 
> consumption)

   You should leave pins as input and pull-up or pull-down resistors. 

> before going into sleep mode.  Once in sleep mode when 
> the button is pressed again I want the PIC to wake up and then 
recall 
> the status of port_b.

  
> if I leave the GIE bit disabled the PIC will NOT branch to the 
> interrupt vector on a RB0 interrupt.  From what I understand if the 
> global interrupt enable bit is not checked, an interrupt on RB0 
will 
> just wake the PIC up from sleep mode and then continue executing 
the 
> program from where it left off. 

  from datasheets:

Note: If the global interrupts are disabled (GIE is
cleared), but any interrupt source has both
its interrupt enable bit and the correspond-ing
interrupt flag bits set, the device will
immediately wake-up from SLEEP. The
SLEEP instruction is completely executed.

> My question is "What does this 
> mean?"  Do I still need to write an interrupt routine using pragma 
> interrupt to handle the RB0 interrupt or can I simply poll the 
> appropraite interrupt bits to determine if an interrupt has occured 
> and then take the appropriate actions?
> 
> If i still have to write an interrupt routine what would something 
> like that look like?  I don't want anyone to write the routine for 
> me, just point me in the right direction.  Tell me what I need to 
> look out for or things to keep in mind while coding.  But any 
advise  
> you can provide would be greatly appreciated.  Also I appologize 
for 
> the lengthy post.


    Means nothing, that is, you can do it with a interrupt or without 
it.



Javi.



Seiz System Engineering AbelCam AbelCam WebCam Software for Windows