Sie sind auf Seite 1von 45

EC 310

Microcontroller Based Systems

Introduction - Part I

Lecture 1
1 of 45

Dr Javaid

What is a Computer?
Computer
Device capable of
Performing computations
Making logical decisions

Works billions of times faster than human


beings
Fastest supercomputers today
Perform hundreds of billions of additions per
second

2 of 45

Dr Javaid

What is a Computer?
Programs
Sets of instructions that process data
Guide computer through orderly sets of
actions specified by computer programmers

Computer system
Comprised of various hardware devices

3 of 45

Keyboard
Screen (monitor)
Disks
Memory
Processing Units
Dr Javaid

Computer Organization
Every computer divided into six units
1. Input unit
Receiving section of computer
Obtains data from input devices
Keyboard, mouse, disk or scanner

Places data at disposal of other units

2. Output unit
Shipping section of computer
Puts processed info on various output devices
Monitors, paper printouts, speakers

Makes info available outside the computer


4 of 45

Dr Javaid

Computer Organization
3. Central Processing Unit (CPU)
Administrative section of computer
Coordinates and supervises other sections

4. Arithmetic and Logic Unit (ALU)


Performs calculations (addition, subtraction,
multiplication and division)
Contains decision mechanisms and can make
comparisons

5 of 45

Dr Javaid

Computer Organization
5. Memory unit
Rapid access, low capacity warehouse
Temporarily retains information entered through
input unit
Retains info that has already been processed until
it can be sent to output unit
Often called memory, primary memory, or random
access memory (RAM)

6. Secondary storage unit


Long-term, high-capacity warehouse
Stores programs or data not currently being used
by other units on secondary storage devices
Hard Drives, disks or CDs

Takes longer to access than primary memory


6 of 45

Dr Javaid

Evolution of an Operating System


Early Computers
Single-user batch processing
Jobs on decks of punched cards
One job ran at a time
Results took hours to process

Operating Systems
Managed transitions between jobs
Increased amount of work computer could
accomplish

7 of 45

Dr Javaid

Evolution of an Operating System


Timesharing Operating Systems (1960s)
Computers accessed through terminals
Devices with keyboards and screens

Hundreds of people use system at once


Quickly performs small portions of each persons
job
Gives appearance of running simultaneously

8 of 45

Dr Javaid

Evolution of an Operating System


UNIX
Originally an experimental timesharing OS
Developed by Dennis Ritchie and Ken Thompson in
late 60s
Developed at Bell Labs
Written in C

Open-Source software ?
Source code freely distributed among programmers
Created large community

Powerful and flexible


Handled any task a user required
Developed into many flavors
Linux ( Red Hat, Debain, mandriva )
BSD (Berkeley Software Distribution )
9 of 45

Dr Javaid

Evolution of an Operating System


UNIX
Advantages of UNIX
Crashing
Very safe against Virus attack
Real time (RT Linux)

10 of 45

Dr Javaid

Evolution of an Operating System


Microsoft Windows
Microsoft introduced an operating environment named Windows
in November 1985 as an add-on to MS-DOS in response to the
growing interest in graphical user interfaces (GUIs).
Microsoft Windows dominated the world's personal computer
market, overtaking Mac OS, which had been introduced
previously.
At the 2004 IDC Directions conference, it was stated that
Windows had approximately 90% of the client operating system
market.
The most recent client version of Windows is Windows 7; the
most recent server version is Windows Server 2008.

http://en.wikipedia.org/wiki/Comparison_of_Windows_and_Linux
11 of 45

Dr Javaid

Windows VS Linux
Windows Linux

Notes

Estimated
87.90%
1.02%
April 2009
Desktop Usage
Share
Microsoft's agreement with vendors to sell
Pre-installation Pre-installed by Pre-installed by
default on
default on very few only the Windows OS is being challenged in
almost all new new desktop PCs. court by French consumer rights groups.
desktop PCs However, Ubuntu is Such agreements by Microsoft were found
now available on all illegal in the case United States v. Microsoft.
System76
computers, some
Dell computers,
Server revenue
37.3%
13.8%
2009Q1
market share
supercomputer
1.0%
88.6%
June 2009
operating
system family
share

12 of 45

Dr Javaid

Types of Computing
Personal Computing
Pioneered by Apple and IBM
Computer prices dropped
Computers reasonable for personal or business use

Stand-alone units
People work on personal machines
SneakerNet
Transported disks to share information

Machines linked together


Telephone lines
Local Area Networks (LANs)
Led to distributed computing
13 of 45

Dr Javaid

Types of Computing
Distributed Computing
Work distributed over networks
N-Tier applications
n stands for number of computer used for application or
in how many parts program has been distributed.
Split parts of applications over numerous computers (3tier application )
User interface
Database
Business-logic processing
Different parts interact when application runs

14 of 45

Dr Javaid

Types of Computing
Client/Server Computing
Clients / Workstations
High-powered desktop machines
Easily share information over computer networks

Servers
Store programs and data
Information accessed by clients

Capabilities provided by modern Operating


Systems
Windows, UNIX, Linux, MacOS

15 of 45

Dr Javaid

Programming Languages
Programming Language - a set of rules, symbols, and
special words used to construct a computer program.
Hundreds exist today.
High-Level Language - A computer language that is
more understandable and closer to standard notations
than assembler language. It is more close to plain English
Low Level (Assembly Language) - A low-level
programming language in which a mnemonic is used to
represent each of the machine language instructions for a
specific computer
Machine Language - The binary representation of the
instructions that a computer's hardware can perform.
16 of 45

Dr Javaid

Programming Languages
High-Level Languages
Single statements accomplish substantial
tasks
Translated to machine language
Compilers convert to machine language
Conversion takes considerable time
Interpreters run programs without compiling
Used in development environment

Instructions comprehensible to humans


Looks mostly like everyday English
Contain common mathematical notation
17 of 45

Dr Javaid

Programming Languages
Low Level (Assembly Languages)
English-like abbreviations
Represent elementary operations of computer

Translated to machine language


Assemblers convert to machine language
High-speed conversion

Clear to human readers as compare to


Machine language
Still tedious to use
Many instructions for simple tasks
Led to high-level languages
18 of 45

Dr Javaid

Programming Languages
Machine Languages
Only language understood directly by
computer
Defined by computers hardware design
Machine-dependent
Languages specific to particular computers

Difficult to understand for human readers


Ultimately reduced to 0s and 1s
Binary code

Slow, tedious and error-prone


Led to Assembly languages

19 of 45

Dr Javaid

Assembly is a Low Level Language


Highest Level

Ada
Modula-2
Pascal
COBOL
FORTRAN
BASIC

Middle Level

C++
C

Lowest Level
20 of 45

Assembler
Dr Javaid

Human VS PC
Speed
Accuracy / Consistency
Intelligence
How much PC is intelligent ?

21 of 45

Dr Javaid

Steps Required to Serve a Glass of Water

22 of 45

Receive information
Identify the command
Recognize the command
Find the location
Access the location
Pick up glass and fill with water
Come back and serve

Dr Javaid

Comparison b/w Human and PC


Human

Machine

Receive
Information
Identify the
command instr
Recognize the
command

Ears

Keyboard

Brain

Translate (from
AN to binary)

Brain

Decode
(decipher binary)

Follow the
instruction

Hands/legs

23 of 45

Execute the
command
Dr Javaid

The Programmers Model of a Microcomputer


From the programmers point of view, it does not
matter if a machine is microprocessor /
microcontroller based or is a larger machine.
Programmers see the computer as having three
characteristics:
An address space.
A set of register.
The instruction set of the computer.

24 of 45

Dr Javaid

The Address Space


The address space is a set of storage location, each of which
has an address.
The computers main memory is used for storage of
instructions and data and for addressing I/O devices.
8 Bits are often called bytes.
The size of the address space is defined by the number of bits
the computer uses to form an address (e.g. a machine that uses
16 bits for addresses can access at most 2 pow(16) = 65536
location).
These sizes are usually given in term of K where K = 2 pow
10 = 1024, e.g. 65536 = 64K.
25 of 45

Dr Javaid

Registers
The register set of a computer is fundamental to its
operation.
The registers available serve many functions, including
the storage of temporary data.
Some registers usually have a specialized function, while
others may be general purpose.

26 of 45

Dr Javaid

The Instructions Set


The instruction set is the set of command that the computer
can obey, and out of which machine-code programs are
constructed.
These are very simple commands.
The instruction set specify a set of operations such as ADD,
SUBTRACT, JUMP, and also a set of Addressing Modes,
which specify where operand data is to be found (e.g in
register, at a particular memory address, at a computed
memory address).

27 of 45

Dr Javaid

Buses
A collection of wires through which data is
transmitted from one part of a computer to
another. You can think of a bus as a highway on
which data travels within a computer.
Data Bus
Address Bus
Control Bus

28 of 45

Dr Javaid

Data Bus
Information (often called data) inside a computer, is
exchanged among the various components by means of
metallic conductors called data lines. A group of data
lines is called a data bus.
Each data line carries a unit of data called a bit. A bit can
be on or off. On is usually considered to be 5 volts, and
off is considered to be 0 volts.
Data Bus is bi-directional.

29 of 45

Dr Javaid

Data Bus
Data can be represented on paper as a series of ones and
zeros. A one means a bit is on, and a zero means it is off.
A byte with a value of 0 would be represented as
00000000.
Non-zero bytes can be any combination of 1s and 0s.
01100010

30 of 45

Dr Javaid

Address Bus
Data inside a computer is accessed by means of metallic
conductors called address lines. Each of them carries a bit
of information, the same as a data line. A group of address
lines is called an address bus. Just as with data, a bit can
be on or off, and addresses can be represented on paper as
a series of ones and zeros.
Address Bus is Uni-directional.
Addresses are seldom represented in binary. They are
almost always shown in HEX with the 0x prefix.

31 of 45

Dr Javaid

Control Bus
These lines do what their name suggests. The CPU can,
for example, use these lines to tell memory whether a
read or a write is required. This is done by sending
current down the appropriate control lines like, the read
and write lines.

32 of 45

Dr Javaid

Types of Memory
RAM (Random Access Memory)
Random access means that locations in the memory can be
written to or read from in any order, regardless of the
memory location that was last accessed. (Read Write)
ROM (Read Only Memory)

33 of 45

Dr Javaid

RAM
Read and Write
Integrated circuits that allow the stored data to be
accessed in any order, i.e. at random. The word
random thus refers to the fact that any piece of data
can be returned in a constant time, regardless of its
physical location.
The word RAM is mostly associated with volatile
types of memory, where the information is lost after
the power is switched off.

34 of 45

Dr Javaid

Types of RAM
SRAM (Static RAM)
Stores data in the state of a flip-flops
Each flip-flop requires at least 6 transistors so cell size is
larger
Does not need to be periodically refreshed, as SRAM uses
bistable latching circuitry to store each bit.
Volatile i.e. data is eventually lost when the memory is not
powered.
Expensive

35 of 45

Dr Javaid

Types of RAM
DRAM (Dynamic RAM)
Stores data in the capacitors
One transistor is required, cell size is smaller
Need to be periodically refreshed, because of capacitor
leakage.
Volatile i.e. data is eventually lost when the memory is not
powered.
Cheaper cost per unit

DDR3 SDRAM (Double Data Rate 3 Synchronous


Dynamic RAM) is the current Ram available in the
market
DDR4 is expected to be released in 2012
36 of 45

Dr Javaid

Types of RAM
NV-RAM (nonvolatile RAM)
Non-Volatile i.e. data is not lost when the memory is not
powered.
Combines the best of RAM and ROM, the read and write
ability of RAM plus non-volatility of ROM.
Internal Lithium battery as a backup energy source
Can retain contents up to Ten years

37 of 45

Dr Javaid

38 of 45

Dr Javaid

Types of Memory
RAM (Random Access Memory)
Random access means that locations in the memory can be
written to or read from in any order, regardless of the
memory location that was last accessed.
ROM (Read Only Memory)

39 of 45

Dr Javaid

ROM
ROM does not lose contents when the power is
turned off.
Non-Volatile memory
PROM, EPROM, EEPROM, Flash EPROM and
Masked ROM

40 of 45

Dr Javaid

Types of ROM
PROM (Programmable ROM)

Consists of a fuses.
Programmed by blowing the fuses.
Require Special burner to program the ROM
The PROM has to be discarded, if info burned is
wrong.
Also referred as OTP (one-time programmable)

41 of 45

Dr Javaid

Types of ROM
EPROM (Erasable Programmable ROM)
EPROM invented to allow making changes in the
contents of PROM.
Required during development of the prototype
Also referred as UV-EPROM (ultra-voilet)
Steps for programming
Take the chip out of socket for programming
Contents must be erased by placing chip in EPROM
erasure
Then place it in ROM burner for programming.
Place chip back in a socket.

Problem erase time is around 20 min


42 of 45

Dr Javaid

Types of ROM
EEPROM (Electrically erasable Programmable ROM)

43 of 45

Electronically erasable method is instant.


Can be programmed while it is still in the system.
Does not require external erasure and programming device.
Cost is more as compared to UV-PROM

Dr Javaid

Types of ROM
Flash memory EPROM
Process of erasure in a second or in flash.
Erasure method is electrical flash EEPROM.
Also known as flash memory

44 of 45

Dr Javaid

Types of ROM
Mask ROM
Contents are programmed by the IC manufacturer
Not user programmable
Masked ROM is used when needed volume is high and is absolute
that contents will not be changed
Cost is significantly low but in case of error whole batch has to be
discarded

45 of 45

Dr Javaid

Das könnte Ihnen auch gefallen