硬件算法__二进制转BCD码

参考二进制转BCD码


数字逻辑电路中经常遇到二级制转换为BCD码的要求,比如显示数码管什么的,这是为了方便人们的固有计数模式。这里学习一个移位加3法

  1. 举个例子(一下直接贴原文了,加上小白的翻译)
    这里写图片描述

    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)
    目的:
    二进制数分别用十进制来转换代替
    (这个例子是用于8位二进制数,其他位数的二进制数的转换也是按照相同的规则)

3.Algorithm: 算法

If any column (100's, 10's, 1's, etc.) is 5 or greater, add 3 to that column.

如果一个纵列(比如百位,十位,个位,等等)等于5或者大于5,就在这个纵列加3

Shift all #'s to the left 1 position.

向左移所有的位置一个位

If 8 shifts have been performed, it's done! Evaluate each column for the BCD values.

如果8次左移已经完成,核查下在每一个纵列对应的BCD码是否正确

Go to step 1. 

如果没有达到8次,则回到步骤1

4.Algorithm In Action: 算法行为图
这里写图片描述

5.BCD Conversion in Hardware: BCD码转换的硬件语言描述

这里写图片描述

6 9.1版本波形结果
这里写图片描述
这里写图片描述

(function () {('pre.prettyprint code').each(function () { var lines = (this).text().split(\n).length;var numbering = $('
    ').addClass('pre-numbering').hide(); (this).addClass(hasnumbering).parent().append( numbering); for (i = 1; i
    • 7
      点赞
    • 23
      收藏
      觉得还不错? 一键收藏
    • 0
      评论
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值