> > Hello, Martin. > > Sorry to email you directly. I have tested the code following your advice, > but no luck. Have you had a change to look at it more? That's ok even though > you haven't. > > My question is when I send 0V to i/o port, can I define the i/o port > as a output and clear the bit such as, > > bcf rp0 > bcf portb, 0 > bsf rp0 > movlw 0xff > movwf trisb > > or, i/o port could be input and clear the bit??? > In old assembly, I just used "in" as a input and "out" as a output > but I don't know how to do this with PIC. > > Thank you for reading my email. have a great day. A couple of points: 1) The settin of trisb makes all inputs. You need a 'clrw' instead of 'movlw 0xff' to make them outputs. 2) Though contriversial using the TRISB instruction is much better here instead of fiddling with rp0. Though uChip has threatened discontinuation for years, the instruction is still available in all 16XXXX and 17XXXX chips. So try this: bcf portb,0 clrw trisb This should set all of port B to outputs and set portb.0 to 0. BAJ > > chunhee >