From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9870 and binary coded decimal (BCD)

Solved!
Go to solution

I have a scale that outputs the weight in 4 digit ASCII form which I would like to input into a CompactRio 9072 with a NI 9870 card and convert to a binary integer. The weight appears as the 7th to 10th character on lines that are terminated by a CR. I am thinking I will need a loop that once the 10th character is read, the 4 least significant bits of the 4 characters are converted from BCD to binary and the character counter resets to 0 when a CR is read. I need a good method for converting BCD to an integer value in either labview or vhdl. The rest of the logic for this project is in vhdl, so I would not mind adding the conversion logic there, except that all the algorithms I have found require decimal division or comparison in several clock cycles.

0 Kudos
Message 1 of 2
(2,587 Views)
Solution
Accepted by topic author imr

Hello imr

 

Thank you very much for getting in touch with us!

 

I believe the following community example will resolve part of your issue.

 

Binary String to Number
https://decibel.ni.com/content/docs/DOC-11704

 

I have also provided some further information for those unaware of what Binary Coded Decimal represents.

 

What is Binary Coded Decimal (BCD)?
http://digital.ni.com/public.nsf/allkb/59C2A05C123008F286256CA90069A6F8

Thank you for choosing National Instruments!

Sincerely,

Greg S.
0 Kudos
Message 2 of 2
(2,563 Views)