PIC pin latch

Status
Not open for further replies.

hantto

Member
Hello!

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.

Regards, Mike
 
Depending how fast you do it and the load it may work or not. It's a nice way to build a cheap touch sensor so far.
 
That's a nice little circuit. I'll have to build it sometime to test it's performance. Cheers!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…