Decoding variable into 4 digits of BCD, are there simple ways to this?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Decoding variable into 4 digits of BCD, are there simple ways to this?

    The binary code you displayed is correct, however that is 82, not 52,
    52 would put "2" on the 4th digit AND the first digit as well. (the numbers are hex, by the way - not decimal)
    Last edited by Charlie; - 7th March 2020 at 12:52.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,156


    Did you find this post helpful? Yes | No

    Default Re: Decoding variable into 4 digits of BCD, are there simple ways to this?

    Yes I see, is there a number to directly use decimal variable, or I need to convert it to hex?

    And by the way, since I will have 16 total of such modules, to save number of MCU pins used, I come up with idea of using CD4514BE - 4 to 16 decoder, this should allow me to by using only 5 pins from MCU, drive up to 16 modules.
    Name:  latcher2.JPG
Views: 2769
Size:  55.1 KB
    Last edited by CuriousOne; - 8th March 2020 at 05:19.

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Decoding variable into 4 digits of BCD, are there simple ways to this?

    from 0-9 hex and decimal are exactly the same so no "conversion" is required. The high nibble is really decoding the device since you need a pin for each device so you want binary 0001, 0010, 0100, 1000. This is hex 1,2,4,8. It is simplest to treat the byte as 2 nibbles, the low one with the number to display, the other with the address.

Similar Threads

  1. Best way or ways?
    By Ramius in forum General
    Replies: 9
    Last Post: - 1st August 2013, 03:01
  2. Ways to make code easily reviewable and extendable
    By Ted's in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 23rd August 2008, 01:10
  3. Array to simple Variable converting
    By mrx23 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2006, 17:44
  4. Showing numbers in diffrent ways?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th July 2005, 16:57
  5. PIC problem, ways to do reset
    By lab310 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th May 2005, 15: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