>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 13 May 2005 10:15 >To: Microcontroller discussion list - Public. >Subject: Re: [PIC] strange problem > > > >> while(B0!=1); > >What is connected to the other 7 bits of PORTB ? Since your >setting in TRISB makes them all inputs, unless they are all >wired to 0v then the above loop will NOT wait for you to press >the button. > >You probably want to test just the bottom bit like this ... > > while((B0 & 1) == 0) ; > >Peter I'm not familiar with the compiler (CCS?), but the syntax suggests that the original code is a bit test on RB0 and therefore quite valid. To the OP: If you are certain it's not a watchdog issue, then persuade your compiler to produce an assembly listing so you can check if the code the compiler is producing matches your source. It's a very small program so should be easy enough to follow. Post it to the list if it dosen't make sense. 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. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist