You are on page 1of 41

Unit 5

Chapter 1
Designing Embedded System with 8051
Microcontroller
Factors to be
selecting Contoller
Factors to be considered selecting a Controller
System
Requirement

Memory
Cost Architecture
Choosing
a
Controller
Compatibility Availability

Power
Consumption
Factors to be considered selecting a Controller
System Requirement:
• The selection process starts with a decision of choosing either 4-bit,
8-bit, 16-bit or 32-bit microcontroller required by the application.
• The criteria like speed requirement, data width needs can decide
system requirements.

Memory Architecture:
• Memory requirement involves Program memory (flash, OTP, ROM etc)
and Data memory (on-chip SRAM or external RAM).
• It is best to choose a device which provides sufficient or more
memory space than the expectation of need.
Factors to be considered selecting a Controller
Availability:
• Before trying to implement the system, the availability of the device
should be checked.
• If sufficient quantity is available now and in future so chances of
failure will be less even though there is more time elapsed between
order approval and supply of product.

Power Consumption:
• High power requirements lead to bulky power supply design. It also
demands for cooling fans to deal with power dissipated in the form of
heat. This make the overall system messy and expensive.
• Power consumption of the controller should be minimum. Controller
should support power saving modes to reduce power consumption.
Factors to be considered selecting a Controller
Compatibility:
• The function of the system can be changed or upgraded by changing
software or replacing some ICs. The microcontroller should be
compatible with slight changes incurred.
• Controller should also support third party development tools.

Cost:
• It is the biggest deciding factor while selecting a microcontroller.
• The cost should be within reachable limit of the end user to ensure
successful deployment of the product and gain marginal profit when
product is launched in market
Why 8051?
Why 8051 Microcontroller for Embedded System

Has 6 interrupts - 2 external interrupts , 2 timer interrupts and 2 serial interrupts

Has two 16-bit timers/counters

Has 32 I/O lines (four 8-bit ports P0, P1, P2, P3)

Internal Program memory (ROM) of 4 KB and data memory (RAM) of 256 bytes. (Expandable up to 64 K bytes

It has 2 power saving modes – Idle mode and Power Down mode

Provides programmable full duplex serial interface

Supports various onboard & external interfaces like I2C, UART, SPI, CAN, USB, and TCP/IP

Has integrated ADC/DAC

Cost is very low

Available through more than 20 vendors with more than 100 variants of 8051.
Power Saving modes
of 8051
Power Saving Modes of 8051

IDLE Mode 8051 can be put in idle mode by setting bit 0 of PCON register

Input clock to CPU is stopped and CPU stops working

Stops program execution, contents of internal RAM are preserved

Timer / Counters operates normally

Interrupts and serial ports remain active

To exit from idle mode, hardware Reset or interrupt is applied


Power Saving Modes of 8051

Power 8051 enters Power Down by setting bit 1 of PCON register


Down
Mode On chip oscillator, timers and serial port operation stops

Program execution stops, Content of internal RAM are preserved

All interrupts become non-functional

To exit from Power Down, hardware Reset is applied


Structure of
Embedded Program
Comments
• These are readable text that are written to help the reader understand
the code easily.
• They are ignored by the compiler and do not take up any memory in the
final code (after compilation).
• There are two ways you can write comments: one is the single line
comments denoted by // and the other is multiline comments denoted by
/*….*/.
Preprocessor directive

• It is indication to the compiler that


it must look into this file for symbols
that are not defined in the program.
Usually represented using #include…
or #define…. #include<reg51.h>
• Used to indicate a header file
specific to the microcontroller,
which contains all the SFRs.
• In case of Keil Compiler it is reg51.h
which is written in the beginning of
program.
Global Variables:

• Global Variables, as the name suggests, are Global to


the program i.e., they can be accessed anywhere in
the program
Local Variables:

• In contrast to Global Variables, Local Variables are


confined to their respective function
Main Function:

• Every C or Embedded C Program has one main


function, from where the execution of the program
begins
Infinite Loop
Significance of Infinite Loop
• One of the most important differences between embedded system
programs and programs written for other computer platforms is that
the embedded programs almost always run in infinite loop.
• The infinite loop is necessary as embedded software’s job is never
completed. It should run until either the world comes the end or the
board is reset, whichever happens first.
• Most embedded systems have only one piece of software running on
them and if the software stops the hardware is rendered useless.
(Example: Digital watch, Microwave oven, Smoke detection fire alarm)
• Hence the functional parts of an embedded program are almost
always surrounded by an infinite loop “while(1)” that ensures that
they run forever.
Example:
#include<reg51.h>
main()
{
While(1)
{
.
Here the part of program is to be written that you
. want to repeat forever
.
}

}
Host & Target platforms
Host Platform vs Target Platform

Host Platform Target Platform


• It is a general purpose computer • Target is hardware processor board that
• Software Development is performed contain memory, I/O, etc
on a Host computer • Target hardware platform contains only
• It is called Development what is needed for final deployment
environment • It is called Runtime environment
• Host platform contains development • Target hardware platform does not
Tools like Editor, Cross-compiler and contain development tools like editor,
Debugger etc. compiler, debugger
Simulator

AD V AN TAG ES AN D D I S AD V AN TAG ES
Advantages of Simulator

1. Simple and straight forward.


❑ Simulator is a software utility with assumptions about the hardware.
❑ It only requires concentrating on debugging of the code, hence straight
forward.

2. No Hardware
❑ Simulators are purely software oriented. The IDE simulates the target
CPU.
❑ Since no hardware is required the code can be written and tested even
before the hardware prototype is ready thus saving development time.
Advantages of Simulator

3. Simulate I/O peripherals


❑ Simulator provides the option to simulate various I/O peripherals.
❑ Using simulator's I/O support one can edit the values for I/O
registers. Hence it eliminates the need for connecting I/O devices

4. Simulation of abnormal conditions


❑ Using simulator the code can be tested for any desired value.
❑ This helps to study the code behaviour in abnormal conditions
without actually testing it on the hardware.
Disadvantages of Simulator

1. Lack of real time behaviour


❑ A simulator assumes the ideal condition for code execution.
❑ Hence the developer may not be able to debug the code under all
possible combinations of input.
❑ The results obtained in simulation may deviate from actual results on
target hardware.

2. Lack of real timeliness


❑ The I/O condition in hardware is unpredictable.
❑ Simulator is usually under ideal condition, hence lacks real timeliness.
EDLC
Embedded-product Development Life Cycle
EDLC
(Embedded-product Development Life Cycle)
• It is a problem-solving approach
based on ‘Analysis-Design- Analysis
Implementation’.
• Analysis: Understanding what
product needs to be developed. Design
• Design: Deciding approach to
be used to build the product
• Implementation: Developing the Implementation
product by realizing the design.
Need for EDLC

EDLC is essential for understanding the scope and complexity of the work
involved in embedded systems development.

It can be used in any developing any embedded product

EDLC defines the interaction and activities among various groups of a product
development phase.
Objectives of EDLC

Ensure that high quality Risk minimization defect


Maximize the productivity
products are delivered to prevention in product
to get high returns
user development
Ensure that high quality products are delivered to
user

Quality in any product development is Return On Investment


achieved by the product

Investments incurred for developing the product are:-

• Initial investment
• Developer recruiting
• Training
• Infrastructure requirement
Risk minimization and defect prevention in product
development

Product development may require ‘loose’ or ‘tight’ project


management

Project management is essential for predictability co-ordination


and risk minimization

Resource allocation is critical and it has a direct impact on defect


prevention
Maximize the productivity to get high returns

Productivity is a measure of efficiency as well as Return On


Investment

It is based on total manpower efficiency

Productivity is said to be increased, if the product is capable of


yielding maximum returns with reduced investment.

Saving manpower effort will definitely result in increased


productivity.
Phases of
EDLC
Based on the need for the product, a 'Statement of
Need' or 'Concept Proposal' is prepared

New or Custom Product Development:

• Need for a product which does not exist in the market

Need Product Re-engineering:

• In order to sustain in the market, constantly improve an existing product by


incorporating new technologies and design

Product Maintenance:

• Product maintenance 'need' deals with providing technical support to the end
user for an existing product in the market
Defines the scope of the concept, performs cost
benefit analysis and feasibility study and prepares
project management and risk management plans.

Conceptualization Feasibility Study

• Technical and Financial feasibility

Cost Benefit Analysis (CBA)

• Revealing and assessing the total development cost and profit


expected from the product.

Product Scope

• Deals with the activities involved in the product to be made.

Planning Activities

• Requires various plans to be developed first before development like


Resource Planning & Risk management Plans.
Analysis and Documentations
Analysis
Requirements that need to be
addressed

Defining Test Plan and Procedures

• Unit testing
• Integration testing
• System testing
• User acceptance testing
Identifies application environment and creates an overall
architecture for the product.

Design Starts with the Preliminary Design and establishes the top level
architecture for the product.

On completion it resembles a ‘black box’ that defines only the


inputs and outputs.

Final product is called Preliminary Design Document (PDD).

Once the PDD is accepted by the End User the next task is to
create the ‘Detailed Design’.

It encompasses the Operations manual design, Maintenance


Manual Design and Product Training material Design and is
together called the ‘Detailed Design Document’.
Development and Testing

Development phase transforms the design into a


realizable product.

The detailed specification generated during the


design phase is translated into hardware and
firmware.

The Testing phase can be divided into independent


testing of firmware and hardware that is:

• Unit testing
• Integration testing
• System testing
• User acceptance testing
Deployment is the process of launching the first fully
functional model of the product in the market.

It is also known as First Customer Shipping (FCS).

Deployment Tasks performed during this phase are:


• Notification of Product Deployment
• Deployment schedule
• Brief description about the product
• Targeted end user
• Extra features supported
• Product support information
• Execution of training plan
• Proper training should be given to the end user top get
them acquainted with the new product.
• Product installation
• Install the product as per the installation document to
ensure that it is fully functional.
• Product post Implementation Review
• After the product launch, a post implementation review is
done to test the success of the product.
• The support phase deals with the operational
and maintenance of the product in the
production environment.
• Bugs in the product may be observed and
Support reported.
• The support phase ensures that the product
meets the user needs and it continues
functioning in the production environment.
• Activities involved under support are
• Setting up of a dedicated support
wing: Involves providing 24 x 7
supports for the product after it is
launched.

• Identify Bugs and Areas of


Improvement: Identify bugs and take
measures to eliminate them.

You might also like