2 bytes to word array variable - fastest way


Results 1 to 16 of 16

Threaded View

  1. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

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

    Have you tested that? it seems like it will shift ADRESH 8 times, then assign it to the word. DOing it like that would be better I think like this:
    Code:
    adcdata[index] = ADRESH
    adcdata[index] = adcdata[index]<<8
    adcdata[index] = adcdata[index]+ADRESL
    Not sure about that either.

    I think you can do this:
    Code:
    adcdata.highbyte[index] = ADRESH
    adcdata.lowbyte[index] = ADRESL
    I am not certain on this, so my reply is as much a question as an answer. Hmmm, that sounds a little deep

    OK, this I am certain about:
    Code:
    tempword var word
     
    tempword.highbyte = ADRESH
    tempword.lowbyte = ADRESL
    adcdata[index] = tempword
    Last edited by cncmachineguy; - 8th June 2011 at 01:45.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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