Number Systems step by step

Introduction to Number System
Introduction:
You heard about the number system. Number systems are the techniques for representing numbers of a certain type. It is a mathematical notation for representing numbers, consistently using digits or other symbols. Typically we use a decimal number system in our day to day life. However, the computer only understands binary numbers. Others are octal and hexadecimal number systems. In this post, I will try to cover this topic from various aspects. The weight structure counting technique will also discuss. I tried to make things as simple as possible. First I try to explain some common terms used in the number system.

Key Questions:

What are the different types of number systems?
What are the applications of different number systems?/Why do we use different number systems?
Discuss counting in binary, counting in octal and counting in hexadecimal

Types:
Some commonly used number systems are:
  1. Binary number system (base 2)
  2. Octal number system (base 8)
  3. Decimal number system (base 10)
  4. Hexadecimal number system (base 16)

Number Base (Radix):
The base of any number system is defined by the number of different unique symbols possible in that number system.
Base 2 has only two unique symbols 0,1
Base 8 has 8 unique symbols 0-7
Base 10 has 10 unique symbols 0-9
Base 16 has 16 unique symbols 0-9 A-F

Positional Notation:
In a weighted system, each digit has its value multiplied by its place value/weight. Multiplying each digit with its place value or weight and summing up all, we get the original number. We all know about units, tens, hundreds and thousands, these are the positional notations which is mathematically represented by the POWER of BASE. The digit at tens position has more weight than the digit at a units place. Similarly, the digit at the hundreds place has more weight than the digit at tens place. The concept will be more clear after solved examples are later provided in the post.

Weight:
The weight of numbers is determined by their position. The weight for whole numbers is the positive powers of base/radix that increase from right to left. For fractional numbers, the weights are negative powers of 10 decreases from left to right.

Counting Technique:
While counting in any number system some points should be kept in mind. These are as follows:
  • If we place a zero on the left side of a number it doesn't change the number. For example, if I write 6576 or 06576 both are the same
  • Units place updates at every iteration while the other places remain the same
  • If the unit place can not upgrade further, it's time to reset unit place and tens place upgrades this time
  • If both unit and ten places can not upgrade further, it's time to reset both places and upgrade the hundred place example 099)10 units and tens places can not upgrade further, both are reset to 0 and hundreds place upgrades to 1. So 099 becomes 100

                                                                         
Binary
Decimal
Octal
Hexadecimal
00
00
00
00
01
01
01
01
10
02
02
02
11
03
03
03
100
04
04
04
101
05
05
05
110
06
06
06
111
07
07
07
1000
08
10
08
1001
09
11
09
1010
10
12
0A
1011
11
13
0B
1100
12
14
0C
1101
13
15
0D
1110
14
16
0E
1111
15
17
0F

1. Decimal Number System:
The decimal number system with its ten digits is a base 10 system. We all are familiar with the decimal number system because we use it in our daily lives. But most of us are unfamiliar with weights and positional notations. The understanding of this concept is easy in the decimal system because all of us are familiar with it. Later on, the same concept will be applied to the other number systems.

Largest possible value:
For single-digit numbers, the largest possible value is 9 = 101-1
For two digits number, the largest possible value is 99 = 102-1
For three digits number, the largest possible value is 999 = 103-1
For four digits number, the largest possible value is 9999 = 104-1
For five digits number, the largest possible value is 99999 = 105-1
Generalize,
For n digits number, the largest possible value is 10n-1

Weight Structure:
10n-1...  103 102 101 100 10-1 10-2 10-3... 10-n

How to count decimal number
Counting technique for decimal numbers

Example: The number is given 4567
 Determine its weight and positional notation

Number
4
5
6
7
Positional Notation
3
Thousands
2
Hundreds
1
Tens
0
Units
Weight
103
102
101
100


Example: 4567 expresses it as sum of the values of each digit
Remember: weight increases from right to left for whole numbers
4567=(4*103)+(5*102)+(6*101)+(7*100)
       =(4*1000)+(5*100)+(6*10)+(7*1)
       =4000+500+60+7
        =4567

Example:4567.89 determine its weight and positional notation and express it as sum of the values of each digit

Number
4
5
6
7
.
8
9
Positional Notation
3
Thousands
2
Hundreds
1
Tens
0
Units

-1
Tenths
-2
Hundredth
Weight
103
102
101
100

10-1
10-2


Remember weight decreases from left to right after the decimal point.
4567.89=(4*10003)+(5*1002)+(6*101)+(7*100). (8*10-1)+(9*10-2)
             = (4*1000)+(5*100)+(6*10)+(7*1). (8*0.1)+(9*0.01)
             =4000+500+60+7.(0.8)+(0.09)
             =4567.89

2. Binary Number System:
It is a counting system with only two bits 0 and 1. It is a weighted number system. The rightmost bit is the least significant bit (LSB) and has a weight of 20(weight is determined by POWER of BASE). While the left most bit is the most significant bit (MSB) and its weight depends upon the size of the binary number. When we are working with a particular number system we used to mention its base.
For example 0)2  110)2
The subscript ‘2’ shows base or radix.

Largest possible value:
For a single bit number, the largest possible value is 1)2 = 21-1)10= 1)10
For two bits numbers, the largest possible value is 11)2 = 22-1)10= 3)10
For three bits numbers, the largest possible value is 111)2= 23-1)10= 7)10
For four bits number, the largest possible value is 1111)2= 24-1)10=  15)10
For five bits number, the largest possible value is 11111)2= 25-1)10=31)10
Generalize,
For n bits number, the largest possible value is 2n-1)10

Weight Structure
2n-1...  23 22 21 20  2-1 2-2 2-3... 2-n

Counting in binary
Binary numbers counting technique

Example: 1011)2 express it as sum of the values of each digit, or convert the number in decimal equivalent.
1011)2= (1*23)+(0*22)+(1*21)+(1*20)
         =(1*8)+(0*4)+(1*2)+(1*1)
         =8+0+2+1
         =11)10

Example: 1011.11 determine its weight and positional notation and express it as sum of the values of each digit or convert the number in decimal equivalent

Number
1
0
1
1
.
1
1
Positional Notation
3
Thousands
2
Hundreds
1
Tens
0
Units

-1
Tenths
-2
Hundredth
Weight
23
22
21
20

2-1
2-2


1011)2= (1*23)+(0*22)+(1*21)+(1*20).+(1*2-1)+(1*2-2)
         =(1*8)+(0*4)+(1*2)+(1*1). (1*0.5)+(1*0.25)
         =8+0+2+1.+0.5+0.25
         =11.75)10

3. Octal Number System:
The octal number system is another type of numbering technique that is less common nowadays. It is a base 8 system that has 8 unique symbols. These are 0,1,2,3,4,5,6,7
Largest possible value:
For single-digit numbers, the largest possible value is 7)8= 81-1)10= 7)10
For two digits number, the largest possible value is 77)8= 82-1)10= 63)10
For three digits number, the largest possible value is 777)8= 83-1)10=511)10
For four digits number, the largest possible value is 7777)8= 84-1)10 = 4,095)10
For five digits number, the largest possible value is 77777)8= 85-1)10=32,767)10
Generalize,
For n digits number, the largest possible value is 8n-1)10

Weight Structure:

8n-1...  83 82 81 80 8-1 8-2 8-3... 8-n


How to count octal numbers
Octal numbers counting technique


Example: 1267)8   express it as sum of the values of each digit, or convert the number in decimal equivalent

1267)8 = (1*83)+(2*82)+(6*81)+(7*80)
           =(1*512)+(2*64)+(6*8)+(7*1)
           =512+128+48+7
           =695)10

Example: 1267.44)8 determine its weight and positional notation and express it as sum of the values of each digit or convert the number in decimal equivalent.
Number
1
2
6
7
.
4
4
Positional Notation
3
Thousands
2
Hundreds
1
Tens
0
Units

-1
Tenths
-2
Hundredth
Weight
83
82
81
80

8-1
8-2

1267)8 = (1*83)+(2*82)+(6*81)+(7*80).+(4*8-1)+(4*8-2)
           =(1*512)+(2*64)+(6*8)+(7*1).        +(4*0.125)+(4*0.015625)
           =512+128+48+7+0.5+0.0625
           =695.5625)10

4. hexadecimal Number System:
The base 16 or hexadecimal system has 16 unique symbols. These are 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F

Largest possible value:
For single-digit numbers, the largest possible value is F)16 = 161-1)10=15)10
For two digits number, the largest possible value is FF)16 = 162-1)10=255)10
For three digits number, the largest possible value is FFF)16 = 163-1)10=4095)10
For four digits number, the largest possible value is FFFF)16 = 164-1)10=65,535)10
For five digits number, the largest possible value is FFFFF)16 = 165-1)10=1,048,575)10
Generalize
For n digits number, the largest possible value is  16n-1)10

Weight Structure:
16n-1...  163 162 161 160  16-1 16-2 16-3... 16-n


How to count hexadecimal numbers
Hexadecimal numbers counting technique

Example: 57FF)16 express it as sum of the values of each digit or convert the number in decimal equivalent

57FF)16 = (5*163)+(7*162)+(F*161)+(F*160)
            = (5*4096)+(7*256)+(15*16)+(15*1)
            = 20480+1792+240+15
            = 22527)10

Example:57FF.1A)16  determine its weight and positional notation and express it as sum of the values of each digit or convert the number in decimal equivalent.
Number
5
7
F
F
.
1
A
Positional Notation
3
Thousands
2
Hundreds
1
Tens
0
Units

-1
Tenths
-2
Hundredth
Weight
163
162
161
160

16-1
16-2

57FF)16 = (5*163)+(7*162)+(F*161)+(F*160). (1*16-1)+(10*16-2)
            =(5*4096)+(7*256)+(15*16)+(15*1) (1*0.0625)+(10*0.00390625)
               =20480+1792+240+15.0.0625+0.0390625
            = 22527.0.1015625)10


Applications:
  • The computer uses a binary number system with 'zero’ representing 'off’ position and 'one’ representing an 'on’ position
  • Digital circuits work only with binary values like logic 0’ and logic 1
  • Computer use binary numbers in addressing memory but for memories in the range of gigabytes it is more appropriate to use hexadecimal numbers for addressing
  • Hexadecimal numbers are used as a compact way of representing binary numbers and it is very easy to convert between binary and hexadecimal.
  • Long binary numbers are difficult to write as it is easy to drop a bit. To overcome this problem hexadecimal and octal numbers are used.


Digital Electronics Introduction

Introduction to Digital Electronics

Introduction To Digital Electronics:

Digital electronics is a sub-field of electronics engineering. Digital electronics circuits use digital signals instead of analog signals, and use binary numbers 1 and 0  for representing ON/OFF states respectively. Boolean Algebra is the basis of digital electronics. Today digital technology is not confined to computer systems. It is applied to a wide range of daily use appliances like such as TV, radar, medical instrumentation, military systems, and other consumer electronics.

      Key Questions:

     An overview of digital systems
     Define logic levels
     Define digital waveforms
     Logic families
     Building blocks of digital circuits

Digital Systems Overview:

The two binary digits are used to represent anything in digital systems like numbers, letters, symbols, instructions, logic, etc

Most systems use 1 as a high-level voltage and 0 as a low-level or ground voltage. This is called positive logic.
High=1, Low =0

Negative logic is less common in which systems use 1 as low-level or ground-level voltage whereas 0 represents high-level voltage.
High=0, Low=1

Logic Levels In Digital Electronics 

The binary 1 & 0 are specified by some voltage level. In a practical circuit, a HIGH (1) is voltage in between a specified minimum and specified maximum voltage range. There is a high voltage range for CMOS this range is between 3.5V-5V. Similarly, a LOW (0) is not the ground level or 0V. A LOW is a voltage in between a specified minimum voltage range and a specified maximum voltage range. For CMOS low voltage range is between 0V to 1.5 V.

Low and high logic levels in digital circuits
Logic levels in digital circuits


Digital Waveforms:

There are many kinds of waveforms, but if we are working with digital electronics we always deal with digital waveforms, that switch between only two logic levels 0 & 1.
It represents the two states of Boolean logic (high or low, true or false). At this point, we have to discuss some important parameters and concepts related to waveforms. I also tried to give pictorial representation as well where is possible.

Ideal waveforms: in an ideal waveform the transition from low to high or high to low is instantaneous.

Non-Ideal waveforms: in a nonideal waveform the transition from low to high or high to low takes some time due to stray capacitance and inductance.

Periodic waveforms: the waveform which repeats itself after a fixed interval (termed as Period T). And have an equal pulse width (tw)

Non-Periodic waveforms: the waveform that doesn't represent itself after fixed intervals and may have pulses with different pulse widths.


Periodic waveforms properties
Periodic and nonperiodic waveforms


Pulse train: digital signals are in form of series that are repeated and called pulse trains.

Rising edge: signal/waveform transition from low to high.

Falling edge: signal/waveform transition from high to low.

Leading edge: waveform/ signal edge that occurs first that is at t=0.

Trailing edge: waveform/signal edge that occurs at t=1.

Positive going pulse: the pulse that goes from LOW logic level (0) to HIGH logic level (1) or leading edge is a rising edge and the trailing edge is a falling edge.

Negative going pulse: the pulse that goes from HIGH logic level (1) to LOW logic level (0) or leading edge is the falling edge and the trailing edge is the rising edge.
Leading edge trailing edge falling edge rising edge
Positive going pulse and negative going pulse


Rise time (tr): the time required for a waveform to rise from 10% of its amplitude to 90% of its amplitude.

Fall time (tf): the time required for a waveform to fall from 90% of its amplitude to 10% of its amplitude.

Pulse width (tw): duration of a pulse, measured in between 50% of rise time to 50% fall time

Amplitude: the height of the waveform or the intensity of the waveform.

Period: time in which waveform repeats itself. T=1/f

Frequency: how many times a waveform repeats itself within one second f=1/T
Characteristics of non Ideal waveforms
Ideal and nonideal pulses


Duty cycle: ratio of pulse width (tw) to the period (T) and expressed in percentage
D.C = (tw/T) %

Logic Families:


Logic families include bipolar and metal oxide semiconductors.

  • Bipolar ICs include

    • DTL (Diode Transistor Logic)

    • TTL (Transistor Transistor Logic)

    • ECL (Emitter Coupled Logic)

    • IIL (Integrated Injection Logic)

  • Metal Oxide semiconductors (MOS) ICs include

    • CMOS (Complementary MOS)

    • NMOS (N-channel MOS)

    • PMOS (P-channel MOS)

    • QMOS (Quick MOS)


Building Blocks of Digital Electronics:


Logic gates:

Logic gates perform basic logic operations on one or more binary inputs and produce a single binary output. They implement Boolean logic. Logic gates are fundamental building blocks of digital Integrated circuits. There are three types of logic gates: AND, OR, NOT. The other logic gates are derived from primary gates. Like NOR, NAND, XOR, and XNOR.

Latches and Flip-flops:

A latch is a simple memory element that can hold a bit as long as power is supplied. It has two stable states (as in a bistable multivibrator) that can use to store information. They are asynchronous and work on clock levels.

Latches and flip-flops are basic building blocks of sequential circuits.
Flip-flops are similar to latches. But they are synchronous and work on clock edges.
The output of both latches and flip-flops depends not only on current input but also on previous inputs and outputs.

Timers:
Timers are used in industries or used in other appliances to control process, and automatically starts/stops appliances after a predetermined interval of time. Quartz timers are more accurate than others.

Counters:

As the name implies counter is for counting electronic events, such as pulses. It usually consists of several flip-flops. There are synchronous and asynchronous counters.

Encoders:
An encoder is a device that converts information from one format to another. In digital electronics, it is a combinational circuit that converts information into a coded form, such as binary or BCD. It has 2n input lines and n-bit output lines.

Decoders:
It has the opposite functionality as the encoder. It converts information from n-bit coded input lines and produces 2n unique outputs.

Multiplexers (Mux):

It is also a combinational circuit and has many input lines and a single output. It is used to select one input from many and feed it to the output. It has 2n  input lines and n select lines. And only one output line.

Demultiplexer (Demux):
It is the exact opposite of multiplexers. It is also called a data distributor. It has a single input. 2n output and n select lines. Select lines decide which output line will be available for incoming input. Input is routed to the selected output lines.

Adders:
A digital circuit that performs addition. There are two types of adder circuits. Half adder and full adder.

Popular Posts