I am quite sure Olin is incorrect here. The statement "TEMP = PORTB" would almost certainly become "MOVF PORTB,W" and "MOVWF TEMP". The "MOVF" instruction will not affect the PORTB latch because it is NOT read-modify-write (although MOVF PORTB,F would be). Bob Ammerman RAm Systems ----- Original Message ----- From: "Olin Lathrop" To: Sent: Wednesday, May 22, 2002 7:48 AM Subject: Re: [PIC]: State of output drivers after a tris change > > > TRISB = 0 > > > PORTB = 0xAA > > > > > > TRISB = 255 > > > TEMP = PORTB > > > > > > TRISB = 0 > > > > > > After to port is set back to output what will be the state of the pins? > > > Does the contents of the output driver get destroyed when changing TRIS, > or when performing a read operation on the port? I'm hoping that my original > value ( AA ) is presented on the pins when I switch back to output mode. > > > > It should still be 0xAA because you did nothing to change the PORTB > > output value. > > Actually he did, so it won't be. TEMP = PORTB (assuming I interpret his > pseudo code correctly) reads port B while all bits are set as inputs. This > will essentially copy the input values to the output latches. The resulting > port B value therefore depends on the external circuit. > > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads