A little help with shifting out Arrays?


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: A little help with shifting out Arrays?

    Hi guys,
    I just did some tests here. Here's the testcode:
    Code:
    Leader VAR BYTE
    myArray VAR BYTE[3]
    Trailer VAR byte
    
    Leader = 170
    Trailer = 85
    
    Test1:
      myArray[0] = 1
      myArray[1] = 127
      myArray[2] = 255
      PortB.5 = 0
      SHIFTOUT PortB.6, PortB.7, 1, [myArray\24]
      PortB.5 = 1
    
    PauseUs 10
    
    Test2:
      myArray[0] = 255
      myArray[1] = 127
      myArray[2] = 1
      PortB.5 = 0
      SHIFTOUT PortB.6, PortB.7, 1, [myArray\24]
      PortB.5 = 1
    
    Pauseus 10
    
    Test3:
      myArray[0] = 1
      myArray[1] = 127
      myArray[2] = 255
    
      PortB.5 = 0
      SHIFTOUT PortB.6, PortB.7, 1, [myArray[0], myArray[1], myArray[2]]
      PortB.5 = 1
    
    Pause 100
    END
    The idea with the Leader and Trailer bytes was to see if the memory is alocated in the order it declared and if the shiftout would "fall into" those - turns out that's not the case in this example. Here are the captured results:
    Name:  Test_123JPG.JPG
Views: 1593
Size:  114.3 KB
    I was a bit surprised that both test 1 and test 2 gave the same results but it did.

    /Henrik.

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: A little help with shifting out Arrays?

    Quote Originally Posted by HenrikOlsson View Post
    I was a bit surprised that both test 1 and test 2 gave the same results but it did.
    That IS a bit suprising.

    But, it difinately shows that shifting out the array in the original post won't work, but doing it as seperate bytes of the array will work. So that is a 4th method that will work.

    Thanks Henrik!
    Last edited by SteveB; - 24th September 2012 at 21:39. Reason: typo

  3. #3
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: A little help with shifting out Arrays?

    Hey! thanks Henrik!!! I seriously meant to get back to that but got hung up on other issues and it got lost in the bottom of my pile of a million things to get done. I did get my code working in respect to this just loading the individual bytes of a long variable, and then shifting out the long. so I guess stuck with what worked. Thanks for the test. Makes it easier to wrap my little brain around it now. Why long works is another story. I would expect the 4th "empty" byte that I'm not using would cause issues. it may still be yet, it may be that my hardware isn't choking on it enough to be noticed. Oh well. Works good enough for me!

Members who have read this thread : 0

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