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
0
votes
2 answers

VHDL - BCD to Binary input buffer - issues displaying the result

I am using Vivado 2014.2 to write VHDL code for a BCD to Binary input buffer that could be used for a calculator or a combo lock. My method is simple. to do x*10 it is the same as x(2 + 8) = x*2 + x*8. x*2 = 1 left shift (2^1 = 2) x*8 = 3 left…
greatgamer34
  • 35
  • 1
  • 7
0
votes
1 answer

VHDL Warning: (vcom-1263) Configuration specification "all : bcd" applies to no component instantiation statements

I have been stuck with this problem for a while. I would be really grateful if someone is able help. Have gone through most of the code repeatedly without any solution. There are sets of codes in use; this bcd counter is used further in the rest of…
0
votes
1 answer

interpreting i2c register map for ISL12022

I am trying to program an ISL12022M RTC and am having trouble interpreting the register map (self taught with little experience). The documentation says that the RTC registers (SC,MN,HR,DT,MO,YR,DW) are BCD representations. In order to allow write…
Cathy_Hanna
  • 85
  • 1
  • 11
0
votes
2 answers

Difference between signed and unsigned 16bit BCDs?

How do you tell the difference? For example, say you have 0110 0101 1001 0011. The unsigned BCD is 6593, but what is the signed value?
trusktr
  • 44,284
  • 53
  • 191
  • 263
0
votes
1 answer

Compressing numeric string ids using BCD in C

I have a bunch of ids in the form of uint32_t-uint32_ttwo unsigned integers separated by a hyphen. I'm looking to compress them. I was thinking to convert them to BCD (in other words two digits per byte) and output the compressed string. For…
Pete Darrow
  • 455
  • 5
  • 20
0
votes
3 answers

Converting an integer to 0x equivalent (Hex)

I have an integer input of 1991. How do I convert the input to 0x1991 instead of 7C7? I already wrote the code to convert the hex to decimal(the answer will be 6545) int ui = 0x202; int BCD(int value) //Converting 0xhex to decimal { int result…
user7186318
0
votes
1 answer

ISO8583 - Encoding method for the Numeric part of the AlphaNumeric field type

Should I use BCD encoding for the numeric part in the Alphanumeric field while the message encoding is BCD instead of ASCII? For example, should I encode "12AB" to x31 x32 x41 x42 (all ASCII) or x12 x41 x42 (BCD and ASCII) ? and if it's former,…
cece2048
  • 1,121
  • 2
  • 11
  • 17
0
votes
1 answer

BCD subtraction program for the Z80

This program is taken from the book Programming the Z80, the program is intended to do x-byte BCD subtraction, x could be any integer, and that's by counting the bytes of the two operands and executing the subtraction instruction consequentially…
Abdelrahman Eid
  • 881
  • 2
  • 13
  • 28
0
votes
0 answers

Javascript bluetooth le ap read and write packed binary coded decimal

Phonegap app Bluetooth Plugin: cordova-plugin-ble-central https://github.com/don/cordova-plugin-ble-central Using Javascript and HTML. I am currently writing a PhoneGap app which is reading, writing and getting notifications to and from a bluetooth…
Wittner
  • 583
  • 5
  • 21
0
votes
2 answers

Decode a Binary Coded Decimal

I have a field pic X(03) with a date in it as X'160101' format yymmdd. I will like to know how to convert it to pic x(06). So far I tried to move it back to a 9(03) comp and move the 9(03) comp to a 9(06) but it didn't work. How can I do this?
user3127986
  • 388
  • 1
  • 10
  • 33
0
votes
3 answers

BYTE BCD to ASCII conversion optimization

I've written a function in c that converts a byte (unsigned char) BCD string into ASCII. Please have look at the code and advice some improvements. Is there any other efficient way that can convert BYTE BCD to ASCII. BYTE_BCD_to_ASC(BYTE…
Fakhar Imran
  • 11
  • 1
  • 1
  • 2
0
votes
2 answers

Binary Coded Decimal Maths in embedded Java

I would like to use decimals represented in byte arrays (BCD format) to perform mathematical increments on the decimal values in the form of byte arrays. An example is I would like to do 255 + 1 in maths which gives 256. When done in a binary array…
thotheolh
  • 7,040
  • 7
  • 33
  • 49
0
votes
1 answer

vhdl to verilog bintobcd converting

Hello guys I am trying to translate following vhdl code to verilog however it does not work even if they look like pretty same. I get no errors however it is not working with verilog one but works with vhdl one. Can you guys please help me to work…
fallen
  • 31
  • 11
0
votes
1 answer

Method returning 222 * (2 + 2 + 2) instead of 222 * 222

public BCD multiplyBCDs(BCD other) { BCD thisBCD = new BCD(digit); BCD newBCD = new BCD(0); int DIGIT = 0; do { newBCD = newBCD.addBCDs(other.multiplyBy(thisBCD.nthDigit(DIGIT))); other = other.multiplyByTen(); …
Turruc
  • 1
  • 1
  • 2
0
votes
1 answer

Error in BCD multiplication

My method is supposed to take two BCDs, which are ints constructed from a driver, and multiply them together: public BCD multiplyBCDs(BCD other){ //to multiply two BCDs together BCD basebcd = new BCD(digit); BCD otherbasebcd = other; int…
fufupug
  • 53
  • 1
  • 5