Mike, That's interesting, I've just gone back and looked at the interrupts section in my book and I'd totally missed that bit :( Though in my defence they had hidden that part away beyond the next section, but still... I'll fix that and see if it helps. Thanks for pointing it out... Matt On Tuesday 30 March 2004 15:58, Michael Rigby-Jones wrote: > >-----Original Message----- > > From: Matt Marsh [mailto:matt@MATTMARSH.NET] > > >So, the program should start and light the LED by default. > >When I press the button for the first time the LED should go > >out and stay out until the system is reset. However, the LED > >just comes on and stays on. > > > >Here is the code: > >ISR > > clrwdt > > bcf INTCON,3 ; Reset timer interrupt > > > > movlw d'1' ; Subtract 1 from sequence > > number to subwf SEQ,w ; make it zero based > > addwf PCL,f > > goto Sequence1 > > goto Sequence2 > > The first thing I noticed about this is that you are not > performing any context saving! You are modifying W both here and > in the main loop (when a button is pressed). You should be > saving any registers that the main loop isn't expecting to get > clobbered before doing anything else in your ISR. The datasheet > for the PIC you are using should have some example code that > shows how to save STATUS and W which are generaly the most > important two. > > Regards > > Mike > > > > > ================================================================= >====== This e-mail is intended for the person it is addressed to > only. The information contained in it may be confidential and/or > protected by law. If you are not the intended recipient of this > message, you must not make any use of this information, or copy > or show it to any person. Please contact us immediately to tell > us that you have received this e-mail, and return the original to > us. Any use, forwarding, printing or copying of this message is > strictly prohibited. No part of this message can be considered a > request for goods or services. > ================================================================= >====== Any questions about Bookham's E-Mail service should be > directed to postmaster@bookham.com. > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- Matt N. Marsh Email: matt@mattmarsh.net Yahoo: marshmn Web: http://www.mattmarsh.net/ Jabber: mattmarsh@jabber.org MSN: matt@mattmarsh.net ICQ: 250467363 AIM: MattMarshUK -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body