Вы находитесь на странице: 1из 35

PRX1011 Lecture 2

Overview
Digital Basic

Digital Units

Digital Design

Digital vs Analogue Language Data Representation Number conversion

Computer Boolean algebra Boolean equation simplification Design Process Logic gates

Digital Units

Computers Essential?
Do you have computers with you now? How many hours do you interact with a computer per day? How long can you last without computers? Knowledge of computer usage to enhance ones life Information Technology So, what is a computer?

Digital VS Analogue

Analog - continuously variable physical quantity such as spatial position or voltage Digital - information represented by discrete values (digits) of a physical quantity Example:

Analog Tape vs MP3, FM and AM radio

Which is better? FM vs AM
AM sound stored in varied amplitude FM sound stored in number of times wave change direction Both signal is susceptible to change in amplitude. So effect will be,

AM sound data stored in amplitude

corrupted FM amplitude change ignored, no static at all

Computer as a Digital Device


Before digital computer exists, analog computers is used. Data is stored in physical phenomena such as mechanical, electrical or hydraulic

Specific usage, not usable for task other than it is designed for Since the creation of transistor, computer is now reprogrammable and could be used for various types of calculations

Digital Language

Human and computer interaction Human converse in high level language while computers only understood machine language A lot of different language used to intermediate this differences also known as programming language Compiler is a program used to convert a high level language into machine language

Example

C++ Machine language

Binary digit (bit)

Computers are formed from combinations of massive amount off switches Switches can only recognize 0 and 1 ON or OFF Smallest form of data is bit (0 or 1) 8 bit = 1 byte Computers only understand instruction and data in binary

Quantifying Digital Data

When do we use bit/byte? Byte Storage (Hard Disk, USB Drive 8GB) Bit Bandwidth (Broadband - 1Mbps)

Data Representation

Numbers
Decimal base 10 Binary base 2 Hexadecimal base 16

Characters
ASCII & Unicode
Decimal 1 2 9 Binary 1 10 1001 Hexadecimal 01 02 09 ASCII 0110001 0110010 0111001 Unicode U+0031 U+0032 U+0039

10

1010

0A 0110001 0110000

U+0031 U+0030

ASCII
American Standard Code for Information Interchange Used to store characters 8bit = 1 byte Permutation = 2^8 = 256 different characters

Unicode
1. 2.

3.
4.

Due to ASCII having not enough permutation of different characters What character is this? Computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems >109000 characters. Enough?

Decimal - Binary Conversion


Decimal to binary Convert 15710 to binary value:

157 2 = 78 with 78 2 = 39 with 39 2 = 19 with 19 2 = 9 with 9 2 = 4 with 4 2 = 2 with 2 2 = 1 with 1 2 = 0 with a a a a a a a a remainder remainder remainder remainder remainder remainder remainder remainder of of of of of of of of 1 0 1 1 1 0 0 1

<--- write remainder from bottom to top

15710 = 100111012

Binary - Decimal Conversion


Binary to decimal Convert 101002 to decimal value:

1 x 24 = 16 Multiplying the binary 0 x 23 = 0 value with the respective 1 x 22 = 4 power of 2 in an orderly 0 x 21 = 0 manner 0 x 20 = 0

1 x 24 + 0 x 23 + 1 x 22 + 0 x 21 + 0 x 20 = 16 + 0 + 4 + 0 + 0 = 2010

Limitation of Decimal and Binary


Decimal
Human system

Binary
Machine system

Decimal Conversion to binary is tedious

Binary Number become too long to work with practically

Solution is to find a number system that would be easy to convert to and from binary and number length is practical to work with.

hence, Hexadecimal is used!

Hexadecimal
Human-friendly representation of binary coded values 255(decimal) = 11111111(binary) = FF(hexadecimal)

Hexadecimal - Binary Conversion


Converting from binary to hexadecimal can be done by grouping 4 numbers of binary together and changing each of it into hexadecimal independently before combining them Example:

Convert B5A16 into binary digit


B 1011 5 0101 A 1010
2

= 1011 0101 1010

Binary Hexadecimal Conversion


Converting from hexadecimal to binary can be done by changing each of the hexadecimal number into four binary digits independently before combining them Example:

Convert 1011 0101 10102 into hexadecimal


1011 B 0101 5 1010 A
16

= B5A

Digital Design

Computer

< 1940, computer is a profession Accepts input process data produces output

Boolean Algebra (Logic)


Developed by George Boole in 1854 Gates

Precedence

Solve the one with the highest precedence first

Rules

One

variable

AND & OR
With

constant 0 or 1

De

NOT

Morgans theorem

Another view on rules


A Boolean algebra is a set B on which are defined two binary operations + and and one unary operation and in which there are two distinct elements 0 and 1 such that the following properties hold for all x, y, z B

Example of Simplification

Example 1

Example of Simplification

Example 2

Digital Design

Step by step digital design process:


Determine input and output
Truth table Logic Equation

Logic Circuit

Design a logic circuit to determine whether a person have to bring an umbrella to work.

Determine Input & Output


Output = Umbrella (T/1=Bring, F/0=Leave) Input = Rain (Is it raining?) Forecast (Will it rain?) Car (With car umbrella is not needed)

Truth Table

Determine output from all possible combination, arrange in order to avoid error No of combination = 2^(no of input) 3 variables, thus 2^3 = 8
Input Rain (R) 0 0 0 Forecast (F) 0 0 1 Car (C) 0 1 0 Output Umbrella (U) 0 0 1

0
1 1 1 1

1
0 0 1 1

1
0 1 0 1

0
1 0 1 0

U = RFC + RFC + RFC

Logic Equation
Simple circuit logic equation can be obtained through observation without truth table From truth table, simplify with Boolean algebra or.... ...(extra knowledge) by using Karnaugh Map (K-Map)

Simplify..

Boolean Algebra From truth table, RFC + RFC + RFC =(RF+RF+RF)C =(RF+R(F+F))C =(RF+R(1))C =(RF+R)C =(R+R)(R+F)C =1(R+F)C =(R+F)C

K-Map
FC 00 01 11 10 R 0 0 0 0 1 1 1 0 0 1

U = RC+FC = (R+F)C

Logic Circuit

Draw logic circuit from the simplified equation, U=(R+F)C

Ready for simulation and testing to ensure logic is correct and follows truth table

The final problem

Input
A = Class time has ended
B = Lecture has been delivered C = Attendance has been signed

D = Bags are packed

Output
X = You may leave the lecture hall

X = (A+B)CD

Вам также может понравиться