Questions tagged [bcd]

A binary-coded decimal (BCD) is a method of representing each decimal digit of a number with a fixed number of bits.

Though binary-coded decimal is less efficient memory-wise than 2's complement there are some advantages that result in BCD still being in use today, particularly in databases and applications where monetary and similarly sensitive data types are stored and manipulated.

194 questions
-1
votes
1 answer

How to convert from BCD to ASCII and print the result?

I want to output the RTC date. I realized that I had to convert from BCD to ASCII in order to do that, but I do not know what to do. To convert, I use this page: BCD to ASCII conversion, but it uses interrupt 21h and in this page:…
LocketGoma
  • 75
  • 1
  • 2
  • 11
-1
votes
1 answer

Decimal to BCD to ASCII

Perhaps this task is a bit more complicated than what I've written below, but the code that follows is my take on decimal to BCD. The task is to take in a decimal number, convert it to BCD and then to ASCII so that it can be displayed on a…
-1
votes
1 answer

Conversion byte decimal to byte bcd

I need to convert a Delphi function to Java function. This function convert a byte decimal to byte bcd: function ByteToBCD(Number : byte) : byte; begin result:= ((Number div 10) shl 4) or (Number mod 10); end;
Rafael Guerra
  • 45
  • 1
  • 7
-1
votes
4 answers

Hex to BCD conversion

To convert (213AFE)H to BCD, first it has to be converted to binary which gives (2177790)D. Now each digit is converted to its BCD code which gives (0010 0001 0111 0111 0111 1001 0000)BCD. Another way is to convert the hex value to binary which…
toothie
  • 1,019
  • 4
  • 20
  • 47
-1
votes
1 answer

How to convert either binary/denary/hexadecimal/octal to Binary Coded Decimal (BCD) in python

I'm using python and need to find out the following to finish off a converter, How to convert either binary/denary/hexadecimal/octal to Binary Coded Decimal (BCD) in python
Cowie
  • 1
  • 1
-1
votes
3 answers

BCD and 7segment decoder show strange result

I'm trying to create connection from BCD to 7-segment decoder. When I press button UP_* or DOWN_*, it should counting up or counting down. But my simulation only displays 0000001 even when I press button UP or DOWN. BCD module code: module…
user3110542
  • 29
  • 1
  • 2
  • 6
-2
votes
1 answer

Python function to convert datetime object to BCD

This is the best that I have come up with so far. I am not entirely happy with it because I have to use a % 100 to prevent an overflow of the year byte. As a result I have to add 2000 back to the year in the reverse function. Can anyone improve…
Ryan Hope
  • 502
  • 2
  • 14
-2
votes
1 answer

HEXA to packed BCD conversion?

How should I go about converting an uint8 array that contains hexa values into packed bcd values? Would a simple shift by 4 positions do the work? If possible I would appreciate a few examples in code to better understand my issue
alex2597
  • 17
  • 3
-2
votes
1 answer

Encoding numbers in BCD (Casio serial interface)

I am attempting to create a device that talks to a Casio fx-9750 calculator through its serial port with an Arduino. I have figured out how to receive values and decode the BCD, but I'm stuck on how to create the required values from a float (to…
Matthew B
  • 1
  • 1
  • 4
-2
votes
3 answers

BCD Hex String to Integer

I was able to modify the solution provided by Brad Christie to get the results I am expecting for the Hours, Minutes, Seconds, Months, Days, and Years all of which are in BCD Format: static Int32 GetYearFromBCD(Int32 time) { int length =…
Security Hound
  • 2,577
  • 3
  • 25
  • 42
-2
votes
1 answer

How to convert string to hex in unpacked BCD format?

I want to convert the String Entered convert into BCD. a = '2015' ''.join(format(int(c), '04b') for c in str(int(a, 16))) is giving me '1000001000010011'. But I want it to read 0010 0000 0001 0011 as in unpacked BCD format. Can anyone help me with…
abhi1610
  • 721
  • 13
  • 28
-3
votes
1 answer

how to convert an ascii number 057836 to a packed bcd number using 8086

I am having problems converting ascii numbers to BCD numbers. I know that converting small numbers is done by subtracting 30h from each number, but with this big number I don't know how to deal with it, I thought of dividing the number Into bytes,…
tania miah
  • 15
  • 1
  • 5
-3
votes
2 answers

VHDL Coding: 10 bit Decimal conversion to BCD is it possible?

Good Day, My latest assignment is to convert the 10 bit decimal (since the maximum decimal number of 10 bit is 1023) to 16 bit BCD. When the input decimal is greater than or equal to 1024, then the error waveform will go high. The whole module of…
c2s1
  • 5
  • 1
  • 3
-3
votes
2 answers

What is algorithm of converting 8 bit binary to 16 bit bcd?

What is algorithm of converting 8 bit binary to 16 bit BCD? for example: how can i do this? 1111 1111 (binary) -> 0000 0010 0101 0101
1 2 3
12
13