Need help with LAT instruction


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Need help with LAT instruction

    Alberto, read about "read modify write" and you'll understand the purpose of LAT. If you write to PORTx and read from LATx you should be squeaky.
    George

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Need help with LAT instruction

    Quote Originally Posted by towlerg View Post
    Alberto, read about "read modify write" and you'll understand the purpose of LAT. If you write to PORTx and read from LATx you should be squeaky.
    That's his way of saying don't do it. Read from PORT and write to LAT is the correct message conveyed.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Need help with LAT instruction

    Mike, I did a little research and came to the conclusion that you should both read and write the LAT register.

    My logic is a follows, as you correctly say you must write to LAT (to set the latches and thus remember the correct state of the gpio ) but if you read from the PORT you're still left with the RMW problem. But is you read from LAT that goes away.

    Alberto, sorry for the confusion.
    George

Similar Threads

  1. Replies: 125
    Last Post: - 24th June 2018, 14:44
  2. Instruction cycle measurement
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 6th August 2012, 07:50
  3. LAT replaces PORT command?
    By markscotford in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd December 2011, 16:37
  4. Instruction times
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th June 2009, 09:16
  5. What does this MCLR instruction mean?
    By bartman in forum General
    Replies: 16
    Last Post: - 30th November 2004, 00:32

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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