Page 1 of 1

Use of LATX register

PostPosted: Fri Jul 25, 2014 5:56 am
by tulan.kansagara
Need to know in detail about LATx Register.

Re: Use of LATX register

PostPosted: Fri Jul 25, 2014 9:41 am
by vloki
It should be described in the datasheet ;-)
(view the figure, try to understand and come back with questions in detail)

lmgtfy

Re: Use of LATX register

PostPosted: Fri Jul 25, 2014 6:51 pm
by tunelabguy
tulan.kansagara wrote:Need to know in detail about LATx Register.

Writing to it is the same as writing to the corresponding PORTx register. Reading from it reads the last thing written, not necessarily what is read from the PORTx pins right now. The reason they could be different is if external circuit loading prevents the pin from achieving the state that was commanded. Also a pin that is configured as an input pin will obviously not follow what is written to the PORTx or the LATx register. The real benefit of having a LATx register as distinct from the PORTx register is when executing a Bit Clear or Bit Set instruction. The LATx register does what you expect. The PORTx register might not do what you expect. Setting or Clearing one bit might also change some other bit, but if you do that with the LATx register that does not happen. For more information look for info on the "Read-Modify-Write" problem in the old PICs that did not have the LATx registers.

P.S.: I'm glad Dario posted a link to this forum from the old broken official Microchip forum. Thanks Dario.

Re: Use of LATX register

PostPosted: Fri Jul 25, 2014 7:53 pm
by vloki
Hi Robert, nice to "see" you :!:

Re: Use of LATX register

PostPosted: Sat Jul 26, 2014 1:43 am
by ric
tunelabguy wrote:...

P.S.: I'm glad Dario posted a link to this forum from the old broken official Microchip forum. Thanks Dario.

Welcome aboard :)
Send me a PM on the official forum just to confirm you are you. ;)