Reverse Bit Order?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    985

    Default Reverse Bit Order?

    Hi Guys,
    I made a cool 144 LED scroller in the last 36 hours:


    I have definitions made up for characters that appear upside down,
    so I need to reverse the order of every bit in a byte to compensate for this.
    Is there a way that's better than moving bits to a new byte ?
    At the moment that's taking 8 lines (one for each bit in the byte).
    Cheers, Art.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default

    Art,
    There is the REV command/operator, does that do what you want?

    /Henrik.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Maybe this will work for you?
    Code:
        BITS    VAR BYTE
        BITS = %10101010
       
        START:
        LCDOUT $FE,1,BIN BITS
        BITS = BITS REV 8
        LCDOUT $FE,$C0,BIN8 BITS
        END
    echo of Henrik
    Last edited by mackrackit; - 23rd January 2010 at 16:29. Reason: opps, an echo
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Thanks Ten words cheaper than handling the bits individually.

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 10:02
  2. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  3. How to receive stream of bytes using PIC USART
    By unifoxz in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 20th June 2009, 11:38
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Members who have read this thread : 2

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