Combining 4 nibble to 16bits


Results 1 to 8 of 8

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Perhaps something like this:
    Code:
    Result var word
    
    'Nibble 1 is the 4 most significant bits, Nibble4 the 4 least significant.
    'Most signinficant bit in nibble 1 is most significant bit in result.
    Result = (Nibble1 * 4096) + (Nibble2*256) + (Nibble3 * 16) + Nibble4
    Nibble1----Nibble2---Nibble3--Nibble4
    0 0 1 0 - 1 1 0 0 - 0 0 0 1 - 1 1 1 0 = 11294(dec)

    (2*4096)+(12*256)+(1*16)+14 = 11294

    /Henrik Olsson.
    Last edited by HenrikOlsson; - 11th November 2006 at 16:10.

Similar Threads

  1. 4 pin 4 x 4 keypad interface using pic basic pro
    By dunlao_john in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th January 2009, 05:21
  2. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  3. 16f88 - pin RA4 as analog input
    By savnik in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 15th December 2006, 13:55
  4. Real Time Clock & Eeprom
    By smart_storm in forum General
    Replies: 8
    Last Post: - 17th February 2006, 19:03
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

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