0% found this document useful (0 votes)
40 views16 pages

Electronic Systems: Binary Codes

The document discusses various binary codes and number systems. It begins by defining key terms like bit, nibble, byte, and word. It then explains the binary number system and how to convert between binary and decimal numbers. It also discusses non-binary number systems like hexadecimal and non-positional systems like Binary Coded Decimal (BCD). Converting between binary and hexadecimal is described as easy since they use the same digits 0 and 1. In summary, the document provides an overview of digital number representation formats including binary, hexadecimal, and BCD codes.

Uploaded by

Rosiris Rendón
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views16 pages

Electronic Systems: Binary Codes

The document discusses various binary codes and number systems. It begins by defining key terms like bit, nibble, byte, and word. It then explains the binary number system and how to convert between binary and decimal numbers. It also discusses non-binary number systems like hexadecimal and non-positional systems like Binary Coded Decimal (BCD). Converting between binary and hexadecimal is described as easy since they use the same digits 0 and 1. In summary, the document provides an overview of digital number representation formats including binary, hexadecimal, and BCD codes.

Uploaded by

Rosiris Rendón
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Universitat Politècnica de Catalunya

Departament d’Enginyeria Electrònica


Electronic Systems

Topic 4

BINARY CODES

Lecture: 1 hour Exercises: 1 hour

Some images taken from:


1) DIGITAL FUNDAMENTALS, 11TH edition, Thomas L. Floyd. Editorial Pearson, 2015
Used with permission
BINARY CODES

 Key concepts: Bit, nibble, byte, and word.


Contents

 Binary number system.

 Other binary codes.

2
Electronic Systems. Topic 4
BINARY CODES

Digital signal:
Electric signal that may vary over time but that can only take a
finite set of values.
Digital signals

Binary signal:
Digital signal that con only take two possible values.
Normally denoted as (H) High and (L)Low or as “1” and “0”.

3
Electronic Systems. Topic 4
BIT, NIBBLE, BYTE, WORD

Bit (Binary digit)


1. Number systems and base change

A basic unit of information in information theory,


computing, and digital communications (Wikipedia).

Nibble
Set of four bits.

Byte (Octet)
Set of eight bits.

Word
Fixed-sized piece of data handled as a unit by the
instruction set or the hardware of a processor
(Wikipedia). Usual word-lengths: 8, 16, 32, 64 bits.

Electronic Systems. Topic 4


BINARY NUMBER SYSTEM

• Number system: Mathematical notation for expressing


1. Number systems and base change

numbers of a given set, using digits or other symbols in


a consistent manner. (Wikipedia)
• Positional number system: The contribution of each digit
depends on its position.
• Base (radix): Number of different digits in a positional
numeral system.
• Binary system: Base-2 (positional) numeral system.
• Decimal system: Base-10 (positional) numeral system.

Name Binary Decimal


Base 2 10
Digits 0,1 0,1,2,3,4, 5,6,7,8,9
5
Electronic Systems. Topic 4
BINARY NUMBER SYSTEM

• Decimal number system:


1. Number systems and base change

Base 10: Symbols (0,1,2,3,4,5,6,7,8,9)


…102 101 100, 10-1 10-2 10-3 10-4 …
Example,
(543,21)10 = 5·102 + 4·101 +3·100, 2·10-1 +1·10-2

• Binary number system:


Base 2: Symbols (0,1)
… 24 23 22 21 20, 2-1 2-2
…16 8 4 2 1 , ½ ¼
Example,
(1 0 0 1 , 1)2
1·23 + 0·22+0·21 +1·20, 1·2-1 = (9,5)10
6
Electronic Systems. Topic 4
BINARY NUMBER SYSTEM

Decimal → Binary:
1. Number systems and base change

• Integer part: Divide integer part into two until quotient equals zero. The
code is made up of the residuals, with first one being LSB.
• Fractional part: Multiply fractional part by two until result does not have
fractional part or enough digits are known. The code is made up of the
integer part of the result of each multiplication.

10,37510 = 1010, 0112


Integer part Fractional part
10 2 0,375 x 2 = 0 , 75 ( 1st bit frac. part)
0 5 2
0,75 x 2 = 1 , 5 ( 2on bit frac. part)
1 2 2
0 1 2 0,5 x2=1,0 ( 3rd bit frac. part) (3)
1 0
(3) Stop when the result of a multiplication is
LSB(1) MSB(2)
an integer or enough digits are known
1010 = 10102
(1) LSB: Least Significant Bit 7
(2) MSB: Most Significant Bit 0,37510 = 0,0112
Electronic Systems. Topic 4
1. Number systems and base change BINARY NUMBER SYSTEM

Binary→ Decimal: Add up corresponding powers of the


base (2).
1010,0112 = 1·23+0·22+1·21+0·20+0·2-1+1·2-2+1·2-3 =
8+2+0,25+0,125 = 10,37510

001001112 = 0·27+0·26+1·25+0·24+0·23+1·22+1·21+1·20 =
32+4+2+1 = 3910

8
Electronic Systems. Topic 4
NON-BINARY NUMBER SYSTEMS

• Hexadecimal number system:


1. Number systems and base change

Base 16, symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)


… 163 162 161 160, 16-1 16-2 16-3 …
…4096 256 16 1 , 1/16 1/256 1/4096 ...
Example,
A,616
0·160+6·16-1 = 10+6/16 =10,37510

9
Electronic Systems. Topic 4
NON-BINARY NUMBER SYSTEMS

Hexadecimal → Binary Binary → Hexadecimal


1. Number systems and base change

1F,716 = 00011111, 01112 11011,112 = 00011011,1100


= 1B,C16
1 = 0001 0001 = 1
F = 1111 1011 = B
7 = 0111 1100 = C
• Converting between binary and hexadecimal is easy
• Same number written in the hexadecimal system is shorter (strictly
speaking, non-larger) than written in the decimal system

1F,716 = 1·161+15·160+7·16-1 = 16+15+7/16 = 31,437510

2AC16 = 2·162+ +10·161+12·160 = 512+160+12= 68410


10
Electronic Systems. Topic 4
NON-POSITIONAL NUMBER SYSTEMS

Natural BCD (Binary Coded Decimal ) or BCD8421


1. Number systems and base change

Each decimal digit is represented by a


combination of four(4) bits
Decimal BCD
0 0000 3510=00110101BCD
1 0001
2 0010
3 0011
3 5
4 0100
5 0101
6 0110
17010=000101110000BCD
7 0111
8 1000
9 1001

11
Electronic Systems. Topic 4
NON-POSITIONAL NUMBER SYSTEMS

Natural BCD → Decimal: Starting from the LSB, group


1. Number systems and base change

the bits in fours and translate each group of 4 bits into


their corresponding decimal digit.

1001010001BCD = 25110
0010 0101 0001

2 5 1

011100110001BCD = 73110

0111 0011 0001

12
Electronic Systems. Topic 4
A COMPARISON

Binary Natural Decimal Hexadecimal


BCD
1. Number systems and base change

0000 0000 00 0
0001 0001 01 1
0010 0010 02 2
0011 0011 03 3
0100 0100 04 4
0101 0101 05 5
0110 0110 06 6
0111 0111 07 7
1000 1000 08 8
1001 1001 09 9
1010 0001 0000 10 A
1011 0001 0001 11 B
1100 0001 0010 12 C
1101 0001 0011 13 D
1110 0001 0100 14 E
1111 0001 0101 15 F

13
Electronic Systems. Topic 4
NON-POSITIONAL NUMBER SYSTEMS

• ASCII
 American Standard Code for Information
1. Number systems and base change

Interchange.
 Character encoding standard for electronic
communication.
 Uses seven (7) bits.
 Allows to encode alphabet letters, decimal digits,
punctuation marks, and control characters.
 There exists an international encoding standard
that extends ASCII to eight (8) bit: ISO/IEC 8859.

14
Electronic Systems. Topic 4
NON-POSITIONAL NUMERAL SYSTEMS

• Codi ASCII
1. Number systems and base change

15
Electronic Systems. Topic 4
BIBLIOGRAPHY

 Chapter 2 of DIGITAL FUNDAMENTALS, 11TH edition, Thomas L.


1. Number systems and base change

Floyd. Pearson

16
Electronic Systems. Topic 4

You might also like