2 bytes to word array variable - fastest way


Results 1 to 16 of 16

Threaded View

  1. #9
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: 2 bytes to word array variable - fastest way

    Hi Henrik,
    I understand your explanation and thank you. But in your last bit of code
    doesn't it need the ".lowbyte" part?
    Code:
     
    For Index = 0 to 16 STEP 2
      accData.lowbyte[Index] = ADRESL 'Low byte  (bytes 0, 2, 4, 6...)
      accData.lowbyte[Index+1] = ADRESH  'High byte  (bytes 1, 3, 5, 7...)
    NEXT

    This is more intuitive though at the cost of a word variable
    Code:
     
    for index = 0 to 16
      tempword.highbyte = ADRESH
      tempword.lowbyte = ADRESL
      adcdata[index] = tempword
    next
    Mike -
    Last edited by MikeWinston; - 8th June 2011 at 18:31.

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