当前位置:网站首页>【期末复习笔记】数字逻辑
【期末复习笔记】数字逻辑
2022-06-25 08:08:00 【德宏大魔王】
第一章数字逻辑基础
- 二进制、八进制、十进制和十六进制之间的转换
- 原码、反码、补码之间的转换

8421BCD码、格雷码、余三码进制之间的转换
定义概念:
8421码:8421码是最常用的BCD码
,是十进制代码中最常用的一种。在这种编码方式中,每一位二值代码的“1”都代表一个固定数值。将每位“1”所代表的二进制数加起来就可以得到它所代表的十进制数字。因为代码中从左至右看每一位“1”分别代表数字“8”“4”“2”“1”,故得名8421码。其中每一位“1”代表的十进制数称为这一位的权。因为每位的权都是固定不变的,所以8421码是恒权码。
余3码:余3码是在8421的码基础上,把每个代码都加上0011(3)码而形成的,他的主要优点是执行十进制数相加时,能正确的产生进位信号,而且还给减法运算带来了方便
格雷码:使任何两个相邻的代码只有一个二进制位的状态不同,其余3个二进制位必须有相同的状态,这种编码的好处是,从某一编码变到下一个相邻编码时,只有一位的状态发生变化,有利于得到更好的译码波形。格雷码是一种循环码

- 常用的BCD码
| 十进制数 | 8421码 | 余3码 | 格雷码 |
|---|---|---|---|
| 0 | 0000 | 0011 | 0000 |
| 1 | 0001 | 0100 | 0001 |
| 2 | 0010 | 0101 | 0011 |
| 3 | 0011 | 0110 | 0010 |
| 4 | 0100 | 0111 | 0110 |
| 5 | 0101 | 1000 | 1110 |
| 6 | 0110 | 1001 | 1010 |
| 7 | 0111 | 1010 | 1000 |
| 8 | 1000 | 1011 | 1100 |
| 9 | 1001 | 1100 | 1101 |

8421码与十进制转换
例1:
(3)10 =(0011)8421
因为:3可以由8、4、2、1中4个数字中的2和1相加获得,所以只需要在对应的2和1下面写入1即可,其余4位补0
反过来看,用8421码将二进制数每四位标记,含有1的位置上方对应数字相加即可得到10进制数
例2:
(712)10 =(0111 0001 0010)8421
因为:我们按单个数字来看,7可以由8、4、2、1中4个数字中的4+2+1获得、1可以由1获得、2可以由2获得,所以只需要在对应的数字下面写入1,其余一样补0即可
7:
1:
2:
所以(712)10 =(0111 0001 0010)8421
反过来看,用8421码将二进制数每四位标记,含有1的位置上方对应数字相加即可得到10进制数
8421码与余三码转换
前面说到,余3码是在8421的码基础上,把每个代码都加上0011(3)码而形成的,所以我们在8421码的基础上进行运算就可以
例1:
(1001)8421 =(1100)余三码
例2:
(0111 0001 0010)8421 =(1010 0100 0101)余三码

格雷码转换
先写好二进制的数,比如二进制的0110,对应的四位格雷码就是:右数第一位的0和右数第二位的1作异或运算(相同为0,不同为1),这样得到1作为格雷码的第一位,依次类推,最高位的话保持与二进制一样(此处为0),这样就得到格雷码为0101。
(0110)8421 =(0101)格雷码
边栏推荐
- 声纹技术(五):声纹分割聚类技术
- 六级易混词整理
- Is it safe to open a stock account online now?
- What is the role of software validation testing? What is the price of the confirmation test report?
- 【MYSQL】事务的理解
- 现在网上开通股票账号安全吗?
- RTOS 多线程下hardfault问题总结
- SwipeRefreshLayout+RecyclerView无法下拉问题排查
- How to implement a system call
- TrendMicro:Apex One Server 工具文件夹
猜你喜欢

C language "Recursion Series": recursively realizing the n-th power of X

声纹技术(六):声纹技术的其他应用

Exchange: manage calendar permissions

四、卷积神经网络(Convolution Neural Networks)

What do various optimizers SGD, adagrad, Adam and lbfgs do?

How to increase the monthly salary of software testing from 10K to 30K? Only automated testing can do it

cazy長安戰役八卦迷宮

Day 5 script and UI System

获取扫码的客户端是微信还是支付宝

Emergency administrative suspension order issued Juul can continue to sell electronic cigarette products in the United States for the time being
随机推荐
A 35 year old Tencent employee was laid off and sighed: a suite in Beijing, with a deposit of more than 7 million, was anxious about unemployment
各种同步学习笔记
Summary of NLP data enhancement methods
atguigu----18-组件
C#程序终止问题CLR20R3解决方法
C language: count the number of words in a paragraph
Analysis of a video website m3u8 non perceptual encryption
Word2vec, phrases, phraser, keyedvectors commonly used in gensim
[515. find the maximum value in each tree row]
(translation) the use of letter spacing to improve the readability of all capital text
Swiperefreshlayout+recyclerview failed to pull down troubleshooting
紧急行政中止令下达 Juul暂时可以继续在美国销售电子烟产品
C language: bubble sort
通过客户经理的开户二维码开股票账户安全吗?还是去证券公司开户安全?
cazy長安戰役八卦迷宮
城鏈科技平臺,正在實現真正意義上的價值互聯網重構!
In Section 5 of bramble pie project practice, Nokia 5110 LCD is used to display Hello World
What is the file that tp6 automatically executes? What does the tp6 core class library do?
Retrieval model rough hnsw
现在网上开通股票账号安全吗?