Will a PIC output latch maintain its value if the port is swiched to input?
I.e. if I write 1 to GP0 and then swich it to input to read the port and then swich it to output again, will the port still be 1?
Yes, with a qualifier. If you use any instructions on the port that are known to cause the R-M-W (read-modify-write) problem, like bcf and bsf, the GP0 output latch may get set to whatever value the GP0 input is at.
a while back i post something on the PicBasic forum. It's working good and cheap. Certainely not the best way but for your own and personnal use it should be good enough.
Use it to your own risk and all the usual disclaimer stuff