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
vote
2 answers

If statement is not executing properly while trying to create double dabble to convert binary to BCD

I am trying to build a binary to BCD converter using the double dabble algorithm. I wrote the code for the same, and when I simulated the entire thing, it was observed that my if statement is not getting executed properly. `timescale 1ns /…
1
vote
1 answer

8051 assembler program to copy values from a range to another maintaining odd values and transforming even values to BCD

I need to do this task: Write the program in 8051 assembler which copies the memory range 30H – 3FH to the memory range 40H – 4FH, copying the odd values without a change and the even values converted to the BCD format. Do not use any…
Marco
  • 11
  • 1
1
vote
1 answer

Having trouble unpacking Comp-3 in .Net. There are letter characters aside from sign character inside Comp-3 value

I am trying to import a Mainframe EDI File back to SQL Server using .NET and I am having problems unpacking some comp-3 fields. This file was from one of our clients and I have the Copy Book layout for the following fields: 05 EH-GROSS-INVOICE-AMT …
Sirch Dcmp
  • 147
  • 1
  • 9
1
vote
1 answer

16 bit (4 digits) BCD addition (TASM 8086)

I am trying to add two 4 digits (16 bit) BCD numbers and display the result. I have written the code below but I want to know how do I handle the carry bit because this program is hanging up DosBox (TASM Emulator) For some reason my professor wanted…
1
vote
1 answer

Uses of the AF, PF in modern asm

I've done some browsing and it seems like the PF and AF are very rarely used, and for a beginner such as myself, can basically be ignored as they rarely if ever will come up. From what I've found it seems the use-cases are: Binary-coded decimal for…
carl.hiass
  • 1,526
  • 1
  • 6
  • 26
1
vote
1 answer

Paradox BCD field - Number is out of Range error

I'm attempting to update an old Paradox (BDE) table using an older Delphi XE6 application. One particular table has two fields; a Date field, and a BCD field. I'm unable to post a new record to the (FuelSurch) table due to the BCD (FuelSur) field…
Hackbrew
  • 349
  • 1
  • 10
  • 23
1
vote
1 answer

BCD adder in Verilog (with gates)

My goal is coding a BCD adder in Verilog with gates. I have some issues: 1- How can I select bits from first "four bit adders" outputs. My sum is S. After I used S in first adder, can I select bits like S[0] or is there another way? 2- How can I…
Tolga
  • 102
  • 1
  • 8
1
vote
1 answer

How can I write packed BCD numbers to an old instrument (Varian FR41 Gaussmeter) with LabVIEW?

I am currently trying to communicate with an old instrument that uses packed BCD numbers only (it's a Varian FR41 Controller Gaussmeter if anyone is familiar). I am using LabVIEW to replicate some old C code that output the BCD code. Below is the C…
Jesse
  • 244
  • 2
  • 15
1
vote
1 answer

How does the shift register work in binary to bcd conversion

I found this code for a 12 bit binary to bcd conversion but I can't seem to understand the shift register part (just showing the state machine part). I need help in understanding how exactly the '&' works in a shift register and if someone can also…
silverhawk
  • 23
  • 3
1
vote
1 answer

How To Convert QBytearray BCD to Decimal QString Representation?

Hi I read a Packed BCD from a file that I Want to convert it to it's decimal representation. the data length is 32 bytes and for example this is what is in the file : 95 32 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00…
pumper
  • 141
  • 1
  • 10
1
vote
2 answers

How to parse byte[] (including BCD coded values) to Object in Java

I'd like to know if there is a simple way to "cast" a byte array containing a data-structure of a known layout to an Object. The byte[] consists of BCD packed values, 1 or 2-byte integer values and character values. I'm obtaining the byte[] via…
mmm
  • 1,277
  • 5
  • 18
  • 34
1
vote
1 answer

Emulating ADC instruction in Java

I'm attempting to create the MOS6502's ADC instruction in Java. More specifically the ADC decimal instruction, which uses BCD integer representation instead of 2's complement representation. This instruction is being modified to only be concerned…
user9443161
1
vote
0 answers

BCD of a decimal to Hexadecimal

I have this problem: convert: 17535455(base 10) to BCD to hexadecimal (another way of saying it: convert the BCD of 17535455(base 10) to Hexadecimal) should I convert the BCD directly to Hexadecimal? If that would be the case then the answer would…
user8476655
1
vote
0 answers

7 segment display decoder (3 bits of input)

I am trying to wire up a circuit that shows the digits 0 to 7. I have the wiring right because I press each button (shown in picture) and the appropriate numbers light up. I have already made a truth table to point out which decimal goes where so I…
K-Rob
  • 11
  • 3
1
vote
2 answers

16bit to bcd conversion

I'm trying to make a 16bit to BCD conversion. I have found this link for a 8 bit and I'm trying to convert it to 16 bits. http://vhdlguru.blogspot.nl/2010/04/8-bit-binary-to-bcd-converter-double.html I don't know what im doing wrong the rpm_1000…
Dylan
  • 45
  • 1
  • 9