Bcd Fomat Help


Results 1 to 17 of 17

Thread: Bcd Fomat Help

Threaded View

  1. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,161


    Did you find this post helpful? Yes | No

    Default

    To convert Decimal back to BCD, reverse the Process...

    RTCSeconds=DecimalSeconds DIG 1
    RTCSeconds=RTCSeconds<<4
    RTCSeconds=RTCSeconds+(DecimalSeconds DIG 0)

    ------------------------------------------------------------

    Are you sure about that?

    I'm trying to convert a 6 digit decimal number into binary and found this thread. If I take 32 for example and manually run it through your code, I get lost.

    DECNUM = 32
    BINNUM = DECNUM dig 1 : 0000 0011
    BINNUM = BINNUM<<4 : 0011 0000
    BUNNUM = BINNUM+(DECNUM dig 0) : 0011 0010

    But if I use my calculator, 32 = 0010 0000.

    I don't see how you can just split the decimal digits and concatenate theM to make a binary number. Or am I missing something in your formula?

    Robert "Dazed 'n confused'
    Last edited by Demon; - 4th October 2016 at 16:31.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. DS1302 16F628 Woes
    By idtat in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2009, 14:15
  2. BCD problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th September 2008, 16:36
  3. Rotary BCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 03:04
  4. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 21:56
  5. Leading 0's or BCD
    By RYTECH in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th December 2005, 01:06

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