getting my head around PICS with SR-Latch registers - and how to properly use them


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    78

    Default 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

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,361

    Default 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.

  3. #3
    Join Date
    Jan 2007
    Posts
    78

    Default Re: getting my head around PICS with SR-Latch registers - and how to properly use the

    Thanks Hendrick!

  4. #4

    Default Re: getting my head around PICS with SR-Latch registers - and how to properly use the

    With these PICs is there a "Best Practice" command
    Yes. Write to the LAT register. Read from the PORT register.

Similar Threads

  1. bitwise head scratcher? Rather, pulling my hair out.
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th March 2020, 21:07
  2. 12f675 to latch output while it does something else
    By AVGuru in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 24th September 2014, 03:55
  3. My Head Hurts with Tables, Lookup, EXT etc etc
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th June 2012, 07:21
  4. Oh Dear. My head is spinning. HPWM RGB LEDs What to choose?
    By jimseng in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th March 2012, 17:03
  5. How to latch an output for a pre-defined time
    By Dennis in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st December 2009, 18:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts