getting my head around PICS with SR-Latch registers - and how to properly use them
Hello,
I am just starting to play with the 16F1825 PIC which has SR latch registers.
I understand the 16F1xxx family of PICs have the SR latch register - and previous PICs did not.
I understand this register facilitates better read-modify-write functionality.
But on the subject of sending commands to PORT registers, I've also read that the commands PORTC.4 = 0 and LATC.4 = 0 are essentially the same command - because the system ends up writing the same thing to the same PORT register.
With these PICs is there a "Best Practice" command - for turning on/off specific pins?
Thanks
dw
Re: getting my head around PICS with SR-Latch registers - and how to properly use the
In a perfect world (or a simulator) writing to PORT will have the same effect as writing to LAT. In the real world that's not always the case - depending on various circuimstances.
On any PIC that has LAT register I'd say best practise is to use the LAT register(s), they're there for a reason.
With that said, do note that having LAT register(s) and having a SR-latch peripheral is not at all the same thing.
Re: getting my head around PICS with SR-Latch registers - and how to properly use the
Re: getting my head around PICS with SR-Latch registers - and how to properly use the
Quote:
With these PICs is there a "Best Practice" command
Yes. Write to the LAT register. Read from the PORT register.