Hi, the time you said makes me suspect that is is the Watchdog Reset. To locate the nature of this phenomena I suggest to check the PD and TO bits immediately after sleep. Imre On Mon, 14 Sep 1998, Tom Crane wrote: > Dear All, > I am not getting the sort of timing on wakeup from the SLEEP > instruction on a PIC16C84 based system I'm working on that I had (naively?) > expected. The datasheet (DS30081F) is not explicit on this point I would be > interested if anybody could confirm/refute my findings. > > I am clocking the chip at 4MHz and am executing some test code, > > < Clear all bits in INTCON - ie. ensure GIE=0> > < Zero PORT registers & Turn PORT A & B to Inputs> > bsf STATUS, RP0 ; Select Register Bank 1 > bsf OPTION_REG, INTEDG; Choose Int Interrupt on RB0 rising edge transitio n > bcf STATUS, RP0 ; Reselect Register Bank 0 > bsf INTCON, INTE ; Enable Int interrupt > bcf INTCON, INTF ; Clear Int Flag first > sleep ; Execute the SLEEP instruction > movf PORTB, W ; PIC has woken up, So read PORTB to clear its port c hange mismatch condition > bcf INTCON, INTF ; Clear the INTF flag which signalled the Int Interru pt condition > < Zero PORT registers & Turn PORT A & B to Outputs> > bsf PORTB, 7 > bcf PORTB, 7 > > > When using an internal clock (ie. 4MHz crystal + usual 2 caps) I find that the > delay between applying a rising-edge signal to RB0 and detecting the signal on > RB7 is ~10mS, varying several mS from occasion to occasion. > > When feeding the PIC with an external 4MHz clock the delay is ~200mS. > > Presumably dependence on clock source is due to the 'oscillator driver' needin g > to restart when running on internal clock - the datasheet describes it as bein g > turned off in sleep mode. > > In any event, since my application needs to wake the PIC with a precision of 1 > machine cycle - ie. 1uS w.r.t. the applied interrupt RB0 signal, I assume I'm > wasting my time messing about with the SLEEP instruction ?... > > Regards. > Tom. > -- > Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill, > Egham, Surrey, TW20 0EX, England. > Email: uhap023@vms.rhbnc.ac.uk > SPAN: 19.875 > Fax: 01784 472794 > >