2012年11月1日 星期四

Binary to BCD Conversion Algorithm



Home
Home

Binary to BCD Conversion Algorithm

162 converts to 1-6-2



Purpose:

Conversion of a binary number into separate binary numbers representing digits of the decimal number.
(this example is for 8-bits, other sizes follow the same pattern)


Algorithm:



  1. If any column (100's, 10's, 1's, etc.) is 5 or greater, add 3 to that column.
  2. Shift all #'s to the left 1 position.
  3. If 8 shifts have been performed, it's done! Evaluate each column for the BCD values.
  4. Go to step 1.


Psuedo-Code:

PsuedoCode


Algorithm In Action:

Algorithm Table



BCD Conversion in Hardware:

Verilog:
Verilog Code

沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...