On Fri, 2005-05-13 at 10:31 +0100, Michael Rigby-Jones wrote: > > >-----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. Ah , right I see now that "B0" means bit zero of PORTB. Not ANSI C then ! Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist