0% found this document useful (0 votes)
43 views36 pages

Notes - ESD - Embedded Systems

Embedded System

Uploaded by

Hiren Trivedi
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)
43 views36 pages

Notes - ESD - Embedded Systems

Embedded System

Uploaded by

Hiren Trivedi
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/ 36

EMBEDDED SYSTEM DESIGN

Dr. Surya Prakash


Assistant Professor
Dept. of ECE, IIIT Allahabad

Email ID : [email protected]
Webpage : https://sites.google.com/view/dr-surya-prakash

* Some figures and content referred from internet resources in this document
INTRODUCTION
Definition
Embedded System: Examples
• Any device that include a computer but is not itself a • Personal Digital Assistant (PDA)
general-purpose computer which contain Hardware • Printer
and Software – part of some larger system and • Cell Phone
expected to function without human intervention and • Automobile: Engine, Brakes, Dash, etc.
expected to respond, monitor, control external • Television
environment using sensor and actuators. • Household Appliances
• Surveillance Systems

Input

CPU Output

Memory

Embedded Computer

Other Examples
Characteristics
• Sophisticated Functionality Examples:
• Real Time Operation - Must finish operations by deadlines • Web enabled cash-less Vending Machine – up 8-bit Motorola 68HC11
• Hard real time: missing deadline causes failure (e.g. Nuclear • NASA;s Mars Sojourner Rover – up 8-bit intel 80C85
Reactor) • GPS Receiver – up 16-bit
• Soft real time: missing deadline results in degraded performance • MP3 Player – up 32-bit RISC
(e.g. Videogames Graphics) • DVD Player – up 32-bit RISC
• Many systems are multi-rate: must handle operations at widely • Sony Aibo ERS – 110 Robotic Dog – up 64-bit MIPS RISC
varying rates (Inputs at different rates)
• Low Manufacturing Cost
• Manufacturing cost has different components
• Non recurring engineering cost for design and development
• Cost of production and marketing each unit
• Best technology choice will depend on the number of units we
plan to produce
• Application Dependent Processor
• Restricted Memory
• Low Power (Battery Operated Mostly)
• Application Dependent Requirements (like Aircraft, Medical, etc.)
• Fault-Tolerance - Continue operation despite hardware or software
faults
• Safe - Systems to avoid physical or economic damage to person or
property
• Dedicated Systems - Real-time, fault-tolerant, and safe
• Predefined Functionality – Accordingly hardware and software
designed
• Programmability rarely used during lifetime of the system
Embedded Systems
Types of Embedded Systems Nature of System Functions
• Similar to General Computing • Control Laws (Sensing and Actuation)
• PDA, Video Game, Set-top boxes, Automatic • Sequential Logic (Task specific not general
Teller Machine purposes)
• Control Systems • Signal Processing
• Feed-back control of real time systems • Application Specific Interfacing (sensor and
• Vehicle engine, flight control, nuclear reactors actuators communication, IoT, etc.)
• Signal Processing • Fault Response (Low battery notification)
• RADAR, SONAR, DVD Players
• Communications and Networking
• Cellular Phones, Internet Appliances
Detailed Architecture

Software
FPGA/ASIC Memory

Sensor ADC CPU DAC Actuator

Human Diagnostic Power Cooling


Interface Port (Auxiliary System)

Electromechanical
Backup & Safety

External
Environment
Implementing Embedded System
• Hardware Hardware Evolution
• Processing Element • System on chip - ARM
• Peripherals • Application Specific Processors
• Input and output Devices • DSP – Digital Signal Processor
• Interfacing Sensors and Actuators • General Purpose Microprocessors & Micro Controllers
• Interfacing Protocols – Faster Clock Rate, Higher Degree of Integration
• Memory
• Bus Software
• Programs must be logically and temporally correct
• Software • Must deal with inherent physical concurrency
• System Software – OS, Compiler, Emulator • Reactive Systems
• Application – Driver Laser Printer • Reliability and Fault Tolerance and Critical issue
• Application specific and single purpose
Multi-Tasking and Concurrency

• Embedded systems need to deal with several inputs and outputs and multiple events occurring independently
• Separating tasks simplifies programming, but required somehow switching back and forth among different task (multi-
tasking)
• Concurrency is a property of systems in which several computations are executing simultaneously, and potentially
interacting with each other.

Multitasking Concurrency
Embedded Systems Goal, Challenges & Design
Goal: Challenges:
• Performance • How much hardware do we need?
• Overall speed, Deadlines • What is the word size of the CPU?
• Functionality and user interface • What is the size of the Memory?
• Manufacturing cost
• Power consumption • How do we meet our deadlines?
• Other requirements (Physical size, etc.) • Faster hardware and/or cleverer software

• How do we minimize power?


• Turn off unnecessary logic?
• Reduce memory accesses?

Design:
Multi-Objective Multi-Descipline Life Cycle
Dependability Electronic Hardware Requirement
Affordability Software Design
Safety Mechanical Hardware Manufacturing
Security Control Algorithm Deployment
Scalability Humans Logistics
Timeliness Society/Institution Retirement
Requirement & Development Process
Functional & Non-Functional Requirements: Top-Down Vs. Bottom-Up: Stepwise Refinement:
• Functional Requirements: • Top-Down Design: At each level of abstraction, we
• Output as a function of input • Start from the most must:
abstract description • Analyze the design to
• Non-functional requirements • Work to most detailed determine characteristics of
• Time required to compute output • Bottom-Up Design the current state of the
• Size, weight, etc. • Work from small design;
• Power consumption components to big system • Refine the design to add detail
• Reliability
• Etc. Note: Real design uses both
techniques

Design & Development Process:


Architecture Component System
Requirements Specification Testing
(Block Level) Design Integration
EMBEDDED HARDWARE
Embedded System Hardware

• Embedded system hardware is used for processing of input to Processors:


produce output in task specific fashion • Microprocessors and
Microcomputer/Microcontrollers
Data Processing • Key Requirements
Input Interface Output Interface • Energy Efficiency
System
• High code density

General Purpose Microprocessor System: Data Bus


• CPU for computers
• No RAM, ROM, I/O on CPU chip itself
• Example: Intel’s x86, Motorola’s 680x0 CPU

General
I/O Serial
Purpose RAM ROM Timer
Port Port
Micro-
Processor

Address Bus
Microprocessor
• A controller is used to control some process. At one
time, controllers were built exclusively from logic
components, and were usually large, heavy boxes.
Later on, microprocessors were used and the entire
controller could fit on a small circuit board. This is still
common–one can find many controllers powered by
one of the many common microprocessors (including
Zilog Z80, Intel 8088, Motorola 6809, and others).
• As the process of miniaturization continued, all of the
components needed for a controller were built right
onto one chip.
• A one chip computer, or microcontroller was born. A
CPU built into a single VLSI chip is called
microprocessor. The simplified block diagram of the
CPU is shown in the Figure. It contains arithmetic and
logic unit (ALU), Instruction decode and control unit,
Instruction register, Program counter (PC), clock circuit
(internal or external), reset circuit (internal or General Block Diagram of CPU (Microprocessor)
external) and registers. For example, Intel 8085 is 8-bit
microprocessor and Intel 8086/8088 is 16-bit
microprocessor.
• Microprocessor is general-purpose digital computer central processing unit (CPU). The microprocessor is general-purpose device and
additional external circuitry are added to make it a microcomputer.
Microcomputer
• A digital computer with a
microprocessor as the CPU
along with I/O devices,
and memory is known as a
microcomputer. The block
diagram in the Figure
shows a microcomputer.

Microcomputer Block Diagram


MicroController
• Basically, a micro-controller is a device which integrates a Components of a Micro-Controller:
number of components of a microprocessor systems onto a • A timer module to allow the micro-controller to
single chip perform tasks for the certain time periods
• A micro controller combines onto the same microchip • A serial I/O port to allow data to flow between
• CPU core the micro-controller and other devices such as a
• Memory (RAM and ROM) PC or another micro-controller
• Some Parallel digital I/O & more • An ADC to allow the micro-controller to accept
analog input data for processing and DAC to
CPU Memory I/O provide an analog output

Bus Parallel Port


Program
Why Micro-Controller? Memory Counter/
• Low cost, small packaging Timer
• Low power consumption
• Programmable, re-programmable
Data Memory
• Lots of I/O capabilities
Core
• Easy integration with circuits Serial Port
• For applications in which cost, power, and space are critical
• Single purpose
MicroController
• A microcontroller is a highly integrated chip, which
includes all or most of the parts needed for a controller
on a single chip. The microcontroller typically includes:
CPU (Central Processing Unit), RAM (Random Access
Memory), EPROM/PROM/ROM (Erasable Programmable
Read Only Memory), I/O (input/output) – serial and
parallel, timers, and interrupt controller. For example,
Intel 8051 is an 8-bit microcontroller and Intel 8096 is a
16-bit microcontroller.

• By only including the features specific to the task


(control), the cost is relatively low. A typical
microcontroller has bit manipulation instructions, easy
and direct access to I/O (input/output), and quick and
efficient interrupt processing. The figure shows the
block diagram of a typical microcontroller. Detailed Microcontroller Block Diagram
MicroController : History
• It was year 1969, and a team of Japanese engineers from the BUSICOM company arrived to United States with a request that a few integrated circuits for calculators be
made using their projects. The proposition was set to INTEL, and Marcian Hoff was responsible for the project. Since he was the one who has had experience in working with
a computer (PC) PDP8, it occured to him to suggest a fundamentally different solution instead of the suggested construction. This solution presumed that the function of the
integrated circuit is determined by a program stored in it. That meant that configuration would be more simple, but that it would require far more memory than the project
that was proposed by Japanese engineers would require. After a while, though Japanese engineers tried finding an easier solution, Marcian's idea won, and the first
microprocessor was born. In transforming an idea into a ready made product , Frederico Faggin was a major help to INTEL. He transferred to INTEL, and in only 9 months
had succeeded in making a product from its first conception. INTEL obtained the rights to sell this integral block in 1971. First, they bought the license from the BUSICOM
company who had no idea what treasure they had. During that year, there appeared on the market a microprocessor called 4004. That was the first 4-bit microprocessor
with the speed of 6 000 operations per second. Not long after that, American company CTC requested from INTEL and Texas Instruments to make an 8-bit microprocessor
for use in terminals. Even though CTC gave up this idea in the end, Intel and Texas Instruments kept working on the microprocessor and in April of 1972, first 8-bit
microprocessor appeard on the market under a name 8008. It was able to address 16Kb of memory, and it had 45 instructions and the speed of 300 000 operations per
second. That microprocessor was the predecessor of all today's microprocessors. Intel kept their developments up in April of 1974, and they put on the market the 8-bit
processor under a name 8080 which was able to address 64Kb of memory, and which had 75 instructions, and the price began at $360.
• In another American company Motorola, they realized quickly what was happening, so they put out on the market an 8-bit microprocessor 6800. Chief constructor was
Chuck Peddle, and along with the processor itself, Motorola was the first company to make other peripherals such as 6820 and 6850. At that time many companies
recognized greater importance of microprocessors and began their own developments. Chuck Peddle leaved Motorola to join MOS Technology and kept working intensively
on developing microprocessors.
• At the WESCON exhibit in United States in 1975, a critical event took place in the history of microprocessors. The MOS Technology announced it was marketing
microprocessors 6501 and 6502 at $25 each, which buyers could purchase immediately. This was so sensational that many thought it was some kind of a scam, considering
that competitors were selling 8080 and 6800 at $179 each. As an answer to its competitor, both Intel and Motorola lowered their prices on the first day of the exhibit down
to $69.95 per microprocessor. Motorola quickly brought suit against MOS Technology and Chuck Peddle for copying the protected 6800. MOS Technology stopped making
6501, but kept producing 6502. The 6502 was a 8-bit microprocessor with 56 instructions and a capability of directly addressing 64Kb of memory. Due to low cost , 6502
becomes very popular, so it was installed into computers such as: KIM-1, Apple I, Apple II, Atari, Comodore, Acorn, Oric, Galeb, Orao, Ultra, and many others. Soon
appeared several makers of 6502 (Rockwell, Sznertek, GTE, NCR, Ricoh, and Comodore takes over MOS Technology) which was at the time of its prosperity sold at a rate of
15 million processors a year!
• Others were not giving up though. Frederico Faggin leaves Intel, and starts his own Zilog Inc. In 1976 Zilog announced the Z80. During the making of this microprocessor,
Faggin made a pivotal decision. Knowing that a great deal of programs have been already developed for 8080, Faggin realized that many would stay faithful to that
microprocessor because of great expenditure which redoing of all of the programs would result in. Thus he decided that a new processor had to be compatible with 8080, or
that it had to be capable of performing all of the programs which had already been written for 8080. Beside these characteristics, many new ones have been added, so that
Z80 was a very powerful microprocessor in its time. It was able to address directly 64 Kb of memory, it had 176 instructions, a large number of registers, a built in option
for refreshing the dynamic RAM memory, single-supply, greater speed of work etc. Z80 was a great success and everybody converted from 8080 to Z80. It could be said
that Z80 was without a doubt commercially most successful 8-bit microprocessor of that time. Besides Zilog, other new manufacturers like Mostek, NEC, SHARP, and SGS
also appeared. Z80 was the heart of many computers like Spectrum, Partner, TRS703, Z-3 .
• In 1976, Intel came up with an improved version of 8-bit microprocessor named 8085. However, Z80 was so much better that Intel soon lost the battle. Altough a few more
processors appeared on the market (6809, 2650, SC/MP etc.), everything was actually already decided. There weren't any more great improvements to make manufacturers
convert to something new, so 6502 and Z80 along with 6800 remained as main representatives of the 8-bit microprocessors of that time.
Microcontroller : Types
• Microcontrollers can be classified on the basis of internal bus width, architecture, memory and instruction set. Figure
shows the various types of microcontrollers.
Microcontroller Types : 8,16 & 32-Bit

• THE 8-BIT MICROCONTROLLER


• When the ALU performs arithmetic and logical operations on a byte (8-bits) at an instruction, the microcontroller
is an 8-bit microcontroller. The internal bus width of 8-bit microcontroller is of 8-bit. Examples of 8-bit
microcontrollers are Intel 8051 family and Motorola MC68HC11 family.

• THE 16-BIT MICROCONTROLLER


• When the ALU performs arithmetic and logical operations on a word (16-bits) at an instruction, the
microcontroller is an 16-bit microcontroller. The internal bus width of 16-bit microcontroller is of 16-bit. Examples
of 16-bit microcontrollers are Intel 8096 family and Motorola MC68HC12 and MC68332 families. The performance
and computing capability of 16 bit microcontrollers are enhanced with greater precision as compared to the 8-bit
microcontrollers.

• THE 32-BIT MICROCONTROLLER


• When the ALU performs arithmetic and logical operations on a double word (32-bits) at an instruction, the
microcontroller is an 32-bit microcontroller. The internal bus width of 32-bit microcontroller is of 32-bit. Examples
of 32-bit microcontrollers are Intel 80960 family and Motorola M683xx and Intel/Atmel 251 family. The
performance and computing capability of 32 bit microcontrollers are enhanced with greater precision as
compared to the 16-bit microcontrollers.
Microcontroller Types : Embedded & External Memory

• EMBEDDED MICROCONTROLLERS
• When an embedded system has a microcontroller unit that has all the functional blocks (including program as well
as data memory) available on a chip is called an embedded microcontroller. For example, 8051 has Program &
Data Memory, I/O Ports, Serial Communication, Counters and Timers and Interrupt Control logic on the chip is an
embedded microcontroller.

• EXTERNAL MEMORY MICROCONTROLLERS


• When an embedded system has a microcontroller unit that has not all the functional blocks available on a chip is
called an external memory microcontroller. In an external memory microcontroller, all or part of the memory units
are externally interfaced using an interfacing circuit called the glue circuit. For example, 8031 has no program
memory on the chip and is an external memory microcontroller.
Microcontroller Types : Architecture

Von Neuman (Princeton) Architecture:


• Only one bus between CPU and Memory
Program
• RAM and program memory share the same bus
&
and the same memory, and so must have the CPU Bus
Data
same bit width Memory
• Bottleneck: Getting instructions interferes with
accessing RAM

Harvard Architecture:
• Separate program bus and data bus: can be
different widths Program Data
• Instruction pipelining easy Memory
Bus CPU Bus
Memory
12/14/16-bit 8-bit
Microcontroller Types : Architecture : Von-Neuman
• There are mainly two categories of processors, namely, Von-Neuman (or Princeton) architecture and Harvard
Architecture. These two architecture differ in the way data and programs are stored and accessed.

VON-NEUMAN ARCHITECTURE
• Microcontrollers based on the Von-Neuman architecture have a
single data bus that is used to fetch both instructions and data.
Program instructions and data are stored in a common main
memory. When such a controller addresses main memory, it
first fetches an instruction, and then it fetches the data to
support the instruction. The two separate fetches slows up the
controller’s operation. Figure shows the Von-Neuman
Architecture. The Von-Neuman architecture’s main advantage is
that it simplifies the microcontroller design because only one
memory is accessed. In microcontrollers, the contents of RAM
can be used for data storage and program instruction storage.
For example, the Motorola 68HC11 microcontroller Von-
Neuman architecture.
Example : An Instruction “Read a byte from memory and store it in the accumulator” as follows:
Cycle 1 :- Read instruction
Cycle 2 - Read data out of RAM and put into Accumulator
Microcontroller Types : Architecture : Harvard
• There are mainly two categories of processors, namely, Von-Neuman (or Princeton) architecture and Harvard
Architecture. These two architecture differ in the way data and programs are stored and accessed.

HARVARD ARCHITECTURE
• Microcontrollers based on the Harvard Architecture have separate
data bus and an instruction bus. This allows execution to occur in
parallel. As an instruction is being “pre-fetched”, the current
instruction is executing on the data bus. Once the current
instruction is complete, the next instruction is ready to go. This pre-
fetch theoretically allows for much faster execution than Von-
Neuman architecture, on the expense of complexity. Figure shows
the Harvard Architecture. The Harvard Architecture executes
instructions in fewer instruction cycles than the Von-Neuman
architecture.
For example, the intel MCS-51 family of microcontrollers and PIC microcontrollers uses Harvard Architecture. The same
instruction (as shown under Von-Newman architecture) would be executed as follows:
Cycle 1: - Complete previous instruction
- Read the “Move Data to Accumulator” instruction
Cycle 2: - Execute “Move Data to Accumulator” instruction
- Read next instruction
Hence each instruction is effectively executed in one instruction cycle.
Microcontroller Types : Instruction Set
CISC – Complex Instruction Set Computer:
• A large number of instructions each carrying out a different permutation of the same operation
• Instructions provide for complex operations
• Different instructions for different format
• Different instructions of different length
• Different addressing modes
• Requires multiple cycles for execution
• E.g. – Pentium, 8085 etc.

RISC – Reduced Instruction Set Computer:


• Instructions for simple operations that can be executed in a single cycle
• Each instruction of fixed length
• Facilitates instruction pipelining
• Large general purpose register set
• Can contain data or address (symmetry)
• Load store architecture
• No memory access for data processing instructions
Microcontroller Types : Instruction Set : CISC
• Almost all of today’s microcontrollers are based on the CISC (Complex Instruction Set Computer) concept. When an
microcontroller has an instruction set that supports many addressing modes for the arithmetic and logical instructions,
data transfer and memory accesses instructions, the microcontroller is said to be of CISC architecture.
• The typical CISC microcontroller has well over 80 instructions, many of them very powerful and very specialized for
specific control tasks. It is quite common for the instructions to all behave quite differently. Some might only operate
on certain address spaces or registers, and others might only recognize certain addressing modes.
• The advantages of the CISC architecture are that many of the instructions are macro-like, allowing the programmer to
use one instruction in place of many simpler instructions.
• An example of CISC architecture microcontroller is Intel 8096 family.
Microcontroller Types : Instruction Set : RISC
• The industry trend for microprocessor design is for Reduced Instruction Set Computers (RISC) designs. When a
microcontroller has an instruction set that supports fewer addressing modes for the arithmetic and logical instructions
and for data transfer instructions, the microcontroller is said to be of RISC architecture.
• The benefits of RISC design simplicity are a smaller chip, smaller pin count, and very low power consumption.
• Some of the typical features of a RISC processor- Harvard architecture are
1. Allows simultaneous access of program and data.
2. Overlapping of some operations for increased processing performance.
3. Instruction pipelining increases execution speed.
4. Orthogonal (symmetrical) instruction set for programming simplicity.
5. Allows each instruction to operate on any register or use any addressing mode.

SISC (SPECIFIC INSTRUCTION SET COMPUTER)


• Actually, a microcontroller is by definition a Reduced Instruction Set Computer. It could really be called a Specific
Instruction Set Computer (SISC). The basic idea behind the microcontroller was to limit the capabilities of the CPU
itself, allowing a complete computer (memory, I/O, interrupts, etc.) to fit on the single chip. At the expense of the
more general purpose instructions that make the standard microprocessors (8088, 68000, 32032) so easy to use, the
instruction set was designed for the specific purpose of control (powerful bit manipulation, easy and efficient I/O, and
so on).
Microcontroller : Memory Unit
• Memory is part of the microcontroller whose function is to
store data.
• The easiest way to explain it is to describe it as one big closet
with lots of drawers. If we suppose that we marked the
drawers in such a way that they can not be confused, any of
their contents will then be easily accessible. It is enough to
know the designation of the drawer and so its contents will be
known to us for sure.
• Memory components are exactly like that. For a certain input
we get the contents of a certain addressed memory location
and that's all. Two new concepts are brought to us: addressing
and memory location. Memory consists of all memory
locations, and addressing is nothing but selecting one of
them.
• This means that we need to select the desired memory location on one hand, and on the other hand we need to wait
for the contents of that location. Beside reading from a memory location, memory must also provide for writing onto
it. This is done by supplying an additional line called control line. We will designate this line as R/W (read/write).
Control line is used in the following way: if r/w=1, reading is done, and if opposite is true then writing is done on the
memory location. Memory is the first element, and we need a few operation of our microcontroller .
Microcontroller : Central Processing Unit

• Let add 3 more memory locations to a specific block that will


have a built in capability to multiply, divide, subtract, and
move its contents from one memory location onto another.
The part we just added in is called "central processing unit"
(CPU). Its memory locations are called registers.

• Registers are therefore memory locations whose role is to help with performing various mathematical operations or
any other operations with data wherever data can be found. Look at the current situation. We have two independent
entities (memory and CPU) which are interconnected, and thus any exchange of data is hindered, as well as its
functionality. If, for example, we wish to add the contents of two memory locations and return the result again back to
memory, we would need a connection between memory and CPU. Simply stated, we must have some "way" through
data goes from one block to another.
Microcontroller : Bus
• That "way" is called "bus". Physically, it represents a group of
8, 16, or more wires
• There are two types of buses: address and data bus. The first
one consists of as many lines as the amount of memory we
wish to address, and the other one is as wide as data, in our
case 8 bits or the connection line. First one serves to transmit
address from CPU memory, and the second to connect all
blocks inside the microcontroller.
Microcontroller : Input-Output Unit
• As far as functionality, the situation has
improved, but a new problem has also appeared:
we have a unit that's capable of working by itself,
but which does not have any contact with the
outside world, or with us! In order to remove this
deficiency, let's add a block which contains
several memory locations whose one end is
connected to the data bus, and the other has
connection with the output lines on the
microcontroller which can be seen as pins on the
electronic component.
• Those locations we've just added are called "ports". There are several types of ports : input, output or bidirectional
ports. When working with ports, first of all it is necessary to choose which port we need to work with, and then to
send data to, or take it from the port.
• When working with it the port acts like a memory location. Something is simply being written into or read from it, and
it could be noticed on the pins of the microcontroller.
Microcontroller : Serial Communication
• Beside stated previously we've added to the already existing unit the possibility of communication with an outside world. However, this way of
communicating has its drawbacks. One of the basic drawbacks is the number of lines which need to be used in order to transfer data. What if it is being
transferred to a distance of several kilometers? The number of lines times number of kilometers doesn't promise the economy of the project. It leaves us
having to reduce the number of lines in such a way that we don't lessen its functionality. Suppose we are working with three lines only, and that one line
is used for sending data, other for receiving, and the third one is used as a reference line for both the input and the output side. In order for this to work,
we need to set the rules of exchange of data. These rules are called protocol. Protocol is therefore defined in advance so there wouldn't be any
misunderstanding between the sides that are communicating with each other. Let's suppose we have the following protocol. The logical unit "1" is set up
on the transmitting line until transfer begins. Once the transfer starts, we lower the transmission line to logical "0" for a period of time (which we will
designate as T), so the receiving side will know that it is receiving data, and so it will activate its mechanism for reception. Let's go back now to the
transmission side and start putting logic zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest value.
Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit, let us bring the logical unit "1" back on the line which
will mark the end of the transmission of one data. The protocol we've just described is called in professional literature NRZ (Non-Return to Zero).

• As we have separate lines for receiving and sending, it is possible to receive


and send data (info.) at the same time. So called full-duplex mode block which
enables this way of communication is called a serial communication block.
Unlike the parallel transmission, data moves here bit by bit, or in a series of
bits what defines the term serial communication comes from. After the
reception of data we need to read it from the receiving location and store it in
memory as opposed to sending where the process is reversed. Data goes from
memory through the bus to the sending location, and then to the receiving
unit according to the protocol.
Microcontroller : Timer Unit
• However, in order to utilize it in industry we
need a few additionally blocks. One of those is
the timer block which is significant to us
because it can give us information about time,
duration, protocol etc. The basic unit of the
timer is a free-run counter which is in fact a
register whose numeric value increments by
one in even intervals, so that by taking its value
during periods T1 and T2 and on the basis of
their difference we can determine how much
time has elapsed. This is a very important part
of the microcontroller whose understanding
requires most of our time.
Microcontroller : Watchdog
• One more thing is requiring our attention is a flawless functioning of
the microcontroller during its run-time. Suppose that as a result of
some interference (which often does occur in industry) our
microcontroller stops executing the program, or worse, it starts
working incorrectly. Of course, when this happens with a computer,
we simply reset it and it will keep working.
• However, there is no reset button we can push on the microcontroller
and thus solve our problem. To overcome this obstacle, we need to
introduce one more block called watchdog. This block is in fact
another free-run counter where our program needs to write a zero in
every time it executes correctly. In case that program gets "stuck",
zero will not be written in, and counter alone will reset the
microcontroller upon achieving its maximum value. This will result in
executing the program again, and correctly this time around. That is
an important element of every program to be reliable without man's
supervision.
Microcontroller : Analog to Digital Converter
• As the peripheral signals usually are substantially different
from the ones that microcontroller can understand (zero
and one), they have to be converted into a pattern which
can be comprehended by a microcontroller. This task is
Physical
performed by a block for analog to digital conversion or by configuration of
an ADC. This block is responsible for converting an the interior of a
microcontroller
information about some analog value to a binary number
and for follow it through to a CPU block so that CPU block
can further process it.
• Finally, the microcontroller is now completed, and all we need to do
now is to assemble it into an electronic component where it will access
inner blocks through the outside pins. The picture shows what a
microcontroller looks like inside.
• Thin lines which lead from the center towards the sides of the MEMORY
microcontroller represent wires connecting inner blocks with the pins
on the housing of the microcontroller so called bonding lines. Chart on
the following page represents the center section of a microcontroller.
• For a real application, a microcontroller alone is not enough. Beside a
microcontroller, we need a program that would be executed, and a few
more elements which make up a interface logic towards the elements
of regulation.
Microcontroller outline with its basic elements and internal connections
Microcontroller : Program
• Program writing is a special field of work with microcontrollers and is called "programming". Try to write a small program in a language that we will make
up ourselves first and then would be understood by anyone.

START
REGISTER1=MEMORY LOCATION_A
REGISTER2=MEMORY LOCATION_B
PORTA=REGISTER1 + REGISTER2
END

• The program adds the contents of two memory locations, and views their sum on port A. The first line of the program stands for moving the contents of
memory location "A" into one of the registers of central processing unit. As we need the other data as well, we will also move it into the other register of
the central processing unit. The next instruction instructs the central processing unit to add the contents of those two registers and send a result to port
A, so that sum of that addition would be visible to the outside world. For a more complex problem, program that works on its solution will be bigger.
• Programming can be done in several languages such as Assembler, C and Basic which are most commonly used languages. Assembler belongs to lower
level languages that are programmed slowly, but take up the least amount of space in memory and gives the best results where the speed of program
execution is concerned. As it is the most commonly used language in programming microcontrollers. Programs in C language are easier to be written,
easier to be understood, but are slower in executing from assembler programs. Basic is the easiest one to learn, and its instructions are nearest a man's
way of reasoning, but like C programming language it is also slower than assembler. In any case, before you make up your mind about one of these
languages you need to consider carefully the demands for execution speed, for the size of memory and for the amount of time available for its assembly.
• After the program is written, we would install the microcontroller into a device and run it. In order to do this we need to add a few more external
components necessary for its work. First we must give life to a microcontroller by connecting it to a power supply (power needed for operation of all
electronic instruments) and oscillator whose role is similar to the role that heart plays in a human body. Based on its clocks microcontroller executes
instructions of a program. As it receives supply microcontroller will perform a small check up on itself, look up the beginning of the program and start
executing it. How the device will work depends on many parameters, the most important of which is the skillfulness of the developer of hardware, and
on programmer's expertise in getting the maximum out of the device with his program.
THANK YOU
Q UESTIONS/ S UGGESTIONS

You might also like