> >The last value written to PORT is in LAT. eg LATD holds the > >contents that are to be written out if a pin is configured as an > >output > > This is not quite correct. All writes to a port must by definition go > to the data latch (LATx), even if you are actually writing to PORTx > i.e. although you can read the pin states via PORTx you always > change their state through LATx. The big problem comes from > writing to PORTx, whereby the pins are read, the value modified > and then written back to the data latch Isn't that what I (hoped to have) said ? I tried to differentiate between i/p and o/p and driving and reading "The last value written to PORT is in LAT. eg LATD holds the contents that are to be written out if a pin is configured as an output" <- here I was assuming an all-output port "But, a read of PORT (which may be caused by a read-modify- write instruction) over-writes what is in LAT. This can be trouble if PORT is a mix of inputs and outputs, because PORT writes to LAT" That would have been better written without the parentheses. IOW writing to PORT is a r-m-w action We need a picture with some examples ;-) -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu