I know its something that you have already looked at, but just what is in the TRISB register. Just for the heck of it, why not add a couple of lines just before Read_Function: movlw b'xxxxxxxx' ;set bits accordingly . . . tris PORTB Lets just make sure that the DDR is what you think it is. dwayne At 09:50 PM 12/31/00 -0500, David VanHorn wrote: >I'm having trouble with an I/O function. > >I have a capacitor, connected through three resistors, to three I/O pins. >The Capsense pin connects to the cap through a 1k resistor. >The other two pins are varying resistance. >If I set them as inputs, then the resistances don't matter. >If I set either one as output, then it charges or discharges the cap at a >rate determined by it's resistor. > >The basic idea is to read the cap RC time constant, as a form of A/D >converter. > >Everything's fine, till I get to the point where I want to watch the cap >discharge, until it's low, before taking one of the other pins to output high. > >Read_Function: > btfsc PORTB,Capsense ;loop here till low on cap sense pin > goto Read_Function ; > >The Capsense pin is set as an input, as is one of the other two pins >The third is an output, and I can see that it is low, and that the voltage >on the capsense pin is also low, but the code loops here forever, >indicating that it's seeing a high input. > >I've walked through all the banking, and I believe that I'm in the right >banks when I'm talking to PORTB and TRISB. > >I've disabled all peripherals that would otherwise use portb pins. > >So, how could I get stuck here, given a low on the Capsense pin of portb? Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 16 years of Engineering Innovation (1984 - 2000) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body