Move seperate bytes into a word


Results 1 to 19 of 19

Threaded View

  1. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    this one
    Code:
    Z VAR WORD
    A VAR Z.LOWBYTE
    B VAR BYTE
    C VAR Z.HIGHBYTE
    D VAR BYTE
    
    '
    '    Some other code where you set A, B, C & D BYTE variables
    '
    
    Z.HIGHBYTE = Z.HIGHBYTE | (D<<4)
    Z.LOWBYTE = Z.LOWBYTE | (B<<4)
    ought to be the the less memory hungry.

    while changing the last two line by
    Code:
    Z = Z | (B<<4) | (D<<12)
    should use more code space.

    In the above A & C are Aliases, so shouldn't need any extra RAM.

    this
    Code:
    z=a+b<<4+c<<8+d<<12
    ought to use load of RAM and time to execute... BUT this said, I'm rusty and my memory/capacity fade since few months...
    Last edited by mister_e; - 11th November 2008 at 22:37.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  4. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  5. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23

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