I did this and doesn't work. movlw b'11100001' movwf TRISB call dly ;aprox. 10ms movf PORTB,w movwf TEMP Yet doesn't work correct. Why? -----Mensagem Original----- De: Tony Nixon Para: Enviada em: Domingo, 3 de Outubro de 1999 20:15 Assunto: Re: CHANGE TRISB > anbarsystem@ZAZ.COM.BR wrote: > > >The value that I get is crazy, it is very > > different from the value that is really present. > > > > BSF STATUS,RP0 ;BANK1 > > BSF TRISB,7 ;PB7,PB6,PB5 > > NOW ARE INPUTS > > BSF TRISB,6 > > BSF TRISB,5 > > BCF STATUS,RP0 ;BANK0 > > MOVF PORTB,W ;VALOR OF PB IN W > > I would try to avoid multiple consecutive writes to the TRIS register > using BSF intructions. > Try > movlw b'11100001' > movwf TRISA > > Also, it may be possible, depending on your clock speed, that reading > the port immediately after changing a port pin to an input is giving > incorrect results, because the input register has not had enough time to > stabilize. Maybe a small delay in between would fix this. > > -- > Best regards > > Tony > > http://www.picnpoke.com > Email sales@picnpoke.com