I wrote: > 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. > << Olin wrote: > On all but the 18 family PICs, any read of a port sets the output latches to > the value that was read. This has been beaten to death here many times and > is described in the manual. Search the archives. 1) I don't remember seeing the question about whether reading a port affects the data in the output latches before. If I had, and I had also seen the answer, then I would not have asked. If I had not seen the answer I would have looked for it in the archives. 2) I searched for the phrases "output and latch" "port and latch" and "read and modify and write" in the archives, at least one of which I would have expected to appear in any question similar to mine, and subsequent answer.- so perhaps you could suggest alternative search terms which would have come up with all the questions and answers that have aparently been beaten to death behind my back. 3) As for searching the manual, I have this quote from the I/O PORTS, PORTA section of the 16F877 datasheet (DS30292C) regarding PORTA: "Reading the PORTA register reads the state of the pins, whereas writing to it will write to the port latch. All write operations are read-modify-write operations. Therefore, a write to a port implies that the port pins are read, the value is modified and written to the port data latch." Although my question was regarding PORTB, the block diagrams of RA3:RA0 and RA5 pins (Figure 3-1), RB7:RB4 pins (Figure 3-4) and RB3:RB0 pins all show similar functionality in that the "RD Port" control line does not trigger the CK input of the port latch, therefore not over writing the data latch with the value presented on the pins. However, the pic could very easily assert both the RD Port and WR Port control lines at the same time in a deliberate attempt to set the output latch to the most recent value read from the port pins. I can not find any reference to the existence (or not) of this functionality in the datasheet which is why, in the hope that somebody with experience of this could give a definitive answer, I posted the original question. Perhaps if you ever get receive any of the consultants fees with which you threaten people who email you directly, you can spend it on getting some manners, and if you have any left after that, getting the size of your head reduced. -- Jon Baker -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads