Pavi Internship Report 2 PDF

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 55

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNANA SANGAMA, BELAGAVI-590018

An internship report on
“DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM AND IOT”

A Project Report submitted in partial fulfillment of the requirements for the VIII
Semester degree of Bachelor of Engineering in Electronics & Communication
Engineering of Visvesvaraya Technological University, Belagavi

Submitted by
PRAVEEN SHANTU RATHOD 2SR17EC028

Under The Guidance Of

Dr. ARUNKUMAR K M
Assistant Professor
Dept. of Elecronics and Comunication Engineering
S.T.J.I.T Ranebennur

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


SRI TARALABALU JAGADGURU INSTITUTE OF TECHNOLOGY
RANEBENNUR-581115
2020-2021
SRI TARALABALU JAGADGURU INSTITUTE OF TECHNOLOGY
RANEBENNUR–581115
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

CERTIFICATE

This is to certify that the Internship report entitled “DESIGN AND DEVELOPMENT OF
EMBEDDED SYSTEM AND IOT” submitted by PRAVEEN SHANTU RATHOD
(2SR17EC028) to the VISVESVARAYA TECHNOLOGICAL UNIVERSITY(VTU),
BELGAUM towards Partial fulfillment of the requirements for the award of the degree of
BACHELOR OF ENGINEERING(B.E) in ELECTRONICS AND COMMUNICATION
ENGINEERING
(ECE) is a bonafied record of the work carried out by her under supervision and guidance of
Dr. Arunkumar K M Assistant Professor, Dept of ECE, STJIT,Ranebennur during the
Academic year 2020-2021.

Signature of the Guide Signature of the Co-Ordinator


Dr. Arunkumar K M Mr. Samarth M Kerudi
Ass. Prof Ass. Prof

Signature of the HOD Signature of the Principal


Prof. B Maheshwarappa Dr. Shivakumara B.
Head of Department Principal
DECLARATION
I, PRAVEEN SHANTU RATHOD (2SR17EC028), student of 8th semester BE,in
Electronics & Communication Engineering, Sri Taralabalu Jagadguru Institute of
Technology,Ranebennur hereby declare that the training report on “DESIGN AND
DEVELOPMENT OF EMBEDDED SYSTEM AND IOT” submitted to Visvesvaraya
Technological University, Belagavi, in paritial fulfillment of degree of Bachelor of Engineering
is the original work conducted by me.

The information and data in the report is authentic to the best of my knowledge. This internship
training report is not being published or submitted to any other university for award of any other
degree, diploma or other similar titles.

Date : PRAVEEN SHANTU RATHOD

Place : Ranebennur USN:2SR17EC028


ACKNOWLEDGEMENT
It is my pleasure to be indebted to various people, who directly or indirectly contributed in the
development of work and who influenced my thinking, behavior and acts during the course of
study.

From 30th September 2020 to 30th October 2020, I had the privilege and pleasure of joining a
team of dedicated leaders from INVENTERON TECHNOLOGIES AND BUSINESS
SOLUTIONS LLP, MYSORE. The goal of the internship was to help students by giving an
opportunity to work in their organization with their entire team and to make understand the
company working style and corporate standards, under the direction of Mr. Mohammed
AthaRazvi.

My gratitude and thanks to Prof. B Maheshwarappa HOD, Department of Electronics and


communication Engineering ,STJIT, Ranebennur, during the internship for her kind co-operation
and encouragement in all moments of my approach.

I also extend my sense of gratitude to my seminar guide Dr. Arunkumar K M. Assistant


Professor, Department of Electronics & Communication Engineering, who provided his valuable
suggestions and precious time in accomplishing my internship report.

I am thankful to Internship Co-ordinator, Mr. Samarth M Kerudi Assistant Professor,


Department of Electronics & Communication Engineering, for the guidance and valuable
suggestions.

Finally, it is a pleasure and happiness to appreciate the friendly co-operations showed by all the
staff members of Electronics and Communication department, STJIT, Ranebennur.

PRAVEEN SHANTU RATHOD


TABLE OF CONTENT

SL.NO CONTENTS PAGE NO

1 CHAPTER 1
1.1 Introduction about the company 1
1.1(a) Company Profile 1
1.1(b) Services Offered 1
1.2 Company Strategy 2
1.2(a) Core Values 2
1.2(b) Goals 2
1.3 Company Products 2
1.4 Domains 3
1.5 Organizational Chart 3

2 CHAPTER 2
INTRODUCTION TO C LANGUAGE
2.1 Introduction and Programing Language 4-5
2.1(a) History of C 6
2.1(b) Characteristics of C 6
2.1(C) Structure of C Program 6
2.2 Identifiers 7
2.3 Data types 8
2.4 Operators 9-13
2.5 Control Statements 14-18
2.6 Functions 19-20
2.7 Pointers 20-21

3 CHAPTER 3
INTRODUCTION TO EMBEDDED SYSTEM
3.1 Embedded System 22
3.2 Feature of Embedded System 22-24
3.3 Application of Embedded System 24-25

4 CHAPTER 4
4.1 Introduction to 8051 microcontroller 26-33
4.2 Feature and Application of 8051 microcontroller 33-34
4.3 Introduction to IOT 35-36

5 CHAPTER 5
5.1 Introduction to keil and proteus software 37
5.2 Steps 38-39
DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

CHAPTER 1
INTRODUCTION
1.1INTRODUCTION ABOUT COMPANY:

Inventeron Technologies and Business Solutions LLP, is an Indian based


Engineering and electronics company headquarters in Bangalore, Karnataka, India. It was
incorporated on 24 December 2013. It is both product and service-oriented software company
having its products in wireless communication technology and provides quality service to its
valuable clients in its domain.

CEO of Inventeron Technologies and Business Solutions is Mr. Mohammed AthaRazvi.

Inventeron’s core products are Embedded components (including IC’s, control boards,
Controllers, Microprocessors, fuel systems, Water Level controllers, Security Systems,
Biometric login systems, Wireless devices etc.), industrial products (Network Tower
Management systems) and Apps (E-commerce apps, website design and development).

(a) COMPANY PROFILE:

Company Name : Inventeron Technologies and Business Solutions LLP


Private Company incorporated on 24 December, 2013.
The registered office of the company is at #14/1, Ground Floor,
Magadi Road Tollgate, Magadi Main road, Bangalore.
Owner : Mr. Mohammed Atharazvi 24December, 2013.
Types of Business: Innovations in Embedded Electronics providing quality services and
varieties of electronic products.

1.1(b) SERVICES OFFERED:

Inventeron Technologies is an IT software/ embedded company


 Embedded application development
 Web design and development
 IT Service
 Server maintenance
 PCB design
 ERP
 IT Training
 Communication and Networking
 Online Web and Multimedia
 Cloud Computing
 Business Solution
 Project Management

Dept. of ECE, STJIT, Ranebennur Page 1


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

COMPANY STATERGY:

• Purpose: To be a leader in the software Industry by providing enhancedservices,


Relationship and profitability.
• Vision: To provide quality services that exceeds the expectations of our esteemed
Customers.
• Mission: To build long term relationships with our customers and clients and provides
Provide exceptional customer services by pursuing business through innovation and
Advanced technology.

1.2(a) CORE VALUE:

• To incorporate good business practices in order to achieve customer satisfaction and


Treating the customers with respect and faith.
• To grow through creativity, invention and innovation
• To integrate honesty, integrity and business ethics into all aspects of the business
Functioning.

1.2(b) GOALS:

• To improve, grow and become more efficient in the field electronics engineering and
Software development and develop a strong base of key clients.
• To understand customer requirements and fulfill them.
• Increase the assets and investments of the organization to support the development
Of services and expansion of the organization.
• To increase the productivity and improve the customer service satisfaction.
• To do Innovations in Embedded Electronics and provide quality services to deliver a
Range of products.

COMPANY PRODUCTS:
Inventeron Technologies and Business Solutions LLP have it company products like-
• Smart Surveillance system
• Safety and Security Systems
• Biometrics
• Smart Traffic Systems
• Vehicle Tracking Systems
• Tower Management System
• Education Management Systems
• Hotel Management System
• Personal safety Equipment’s
• Wireless Communication Devices
• LED Products
• Water Controlling Units

Dept. of ECE, STJIT, Ranebennur Page 2


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

• Water level controller


• Smart ration management system.

DOMAINS:

Inventeron Technologies and Business Solutions LLP have working with several
Domains like:
• Information Technology
• Government
• Food and Beverages
• Health Care
• Outsourcing

ORGANISATIONAL CHART:

• To improve communication across departments and teams.


• To determine to business associates (banks, finance partners) that your business is
Structured for success and that you have people filling crucial roles.
• To help your plan for growth and transition.

Dept. of ECE, STJIT, Ranebennur Page 3


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

CHAPTER 2
INTRODUCTION TO C LANGUAGE

INTRODUCTION
Software is a collection of programs and a program is a collection of instructions given to the
computer. Development of software is a stepwise process. Before developing software, number
of processes is done. The first step is to understand the user requirements. Problem analysis
arises during the requirement phase of software development. Problem analysis is done for
obtaining the user requirements and to determine the input and output of the program.
For solving the problem, an "algorithm" is implemented. Algorithm is a sequence of steps that
gives method of solving a problem. This "algorithms" creates the logic of program. On the basis
of this “algorithm", program code is written. The steps before writing program code are as-
User requirements

Problem analysis

Input and Output

Designing algorithm

Program coding
Process of program development

 DESIGN METHOD:
Designing is the first step for obtaining solution of a given problem. The purpose of
designing is to represent the solution for the system. It is really difficult to design a large
system because the complexity system cannot be represented easily. So various methods
have been evolved for designing.

 TOP DOWN DESIGN:


Every system has several hierarchies of components. The top-level component represents
the whole tern. Top-Down design method starts from top-level component to lowest level
(bottom) component. In this design method, the system is divided into some major
components.
Then each major component is divided into lower level components. Similarly other
Components are divided till the lowest level component.

 BOTTOM UP DESIGN:
Bottom-Up design method is the reverse of Top-Down approach. It starts from the lowest
level component to the highest-level component. It first designs the basic components
and from these basic components the higher-level components are designed.

Dept. of ECE, STJIT, Ranebennur Page 4


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

PROGRAMMING LANGUAGE

Before learning any language, it is important to know about the various types of languages and
their features. It is interesting to know what the basic requirements of the programmers were and
what difficulties they faced with the existing languages. The programming languages can be
classified into two types
1. Low level languages
2. High level languages

1. Low Level Language:

The languages in this category are the Machine level language and Assembly language.

1. (a) MACHINE LEVEL LANGUAGE:

Computers can understand only digital signals, which are in binary digits i.e. 0 and 1. So the
instruction given to the computer can be only in binary codes. The machine language consists of
instructions that are in binary 0 or 1. Computers can understand only machine level language.
Writing a program in machine level language is a difficult task because it is not easy for
programmers to write instructions in binary code. A machine level language program is error-
prone and its maintenance is very difficult. Furthermore machine language programs are not
portable. Every computer has its own machine instructions, so the programs written for one
computer are not valid for other computers.

1. (B) ASSEMBLY LANGUAGE:


The difficulties faced in machine level language were reduced to some extent by using a
modified from machine level language called assembly language. In assembly language
instructions are given in English like words, such as MOV, ADD, and SUB etc. So it is easier to
write and understand assembly programs, since a computer can understand only machine level
language, hence assembly language program must be translated into machine language. The
translator that is used for translating is called "assemble

2. HIGH-LEVEL LANGUAGE:
High-level languages are designed keeping in mind the features of portability i.e. these languages
are machine independent. These are English like languages, so it is easy to write and understand
the programs of high-level language. While programming in a high level language, the
programmer is not concerned with the low level details, and so the whole attention can be paid to
the logic of the problem being solved. For translating a high-level language program into
machine language, compiler or interpreter is used. Every language has its own compiler or
interpreter. Some languages in this category are- FORTRAN, COBOL, BASIC, Pascal etc.

Dept. of ECE, STJIT, Ranebennur Page 5


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

2.1(a) HISTORY OF C

In earlier days, every language was designed for some specific purpose. For example FORTRAN
(Formula Translator) was used for scientific and mathematical applications, COBOL (Common
Business Oriented Language) was used for business applications. So need of such a language
was felt which could withstand most of the purposes. "Necessity is the mother of invention".
From here the first step towards C was put forward by Dennis Ritchie.
The C language was developed in 1970's at Bell laboratories by Dennis Ritchie. Initially it was
designed for programming in the operating system called UNIX. After the advent of C, the
whole UNIX operating system was rewritten using it. Now almost the entire UNIX operating
system and the tools supplied with it including the C compiler itself are written in C.

2.1(b) CHARACTERISTICS OF C

It is a middle level language. It has the simplicity of a high level language as well as the power
of low level language. This aspect of C makes it suitable for writing both application' programs
and system programs. Hence it is an excellent, efficient and general-purpose language for most
of the application I such as mathematical, scientific, business and system software applications.
C is small language, consisting of only 32 English words known as keywords (if, else, for, break
etc…) the power of C is augmented by the library functions provided with it. Moreover, the
language is extendible since it allows the users to add their own library functions to the library.

2.1(c) STRUCTURE OF C
C program is a collection of one or more- functions. Every function is a collection of statements
and performs some specific task. The general structure of C program is-

Comments
Preprocessor directives
Global variables
Main ( ) function
{
Local variables
Statements
………..
………..
}
Func 1( )
{
Local variables
Statements
………..
………..
}
Func 2 ( )

Dept. of ECE, STJIT, Ranebennur Page 6


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

{
Local variables
Statements
………..
………..
}

Comments can be placed anywhere in a program and are enclosed between the delimiters /* and
*/. Comment are generally used for documentation purposes

IDENTIFIERS
All the words that we'll use in our C programs will be either keywords or identifiers. Keywords
are predefined and can't be changed by the user, while identifiers are user defined words and are
used to give names to entities like variables, arrays, fUi1ctions, structures etc. Rules for naming
identifiers are given below-
(1) The name should consist of only alphabets (both upper and lower case), digits and
Underscore sign (_).
(2) First character should be an alphabet or underscore.
(3) The name should not be a keyword.
(4) Since C is case sensitive, the uppercase and lowercase letters are considered different. For
example code, Code and CODE are three different identifiers.
(5) An identifier name may be arbitrarily long. Some implementations of C recognize only the
first eight characters, though most implementations recognize 31 characters. ANSI standard
compilers recognize 31 characters.
The identifiers are generally given meaningful names. Some examples of valid identifier names-
Value a
Net _pay rec1 _data MARKS examples of invalid identifier names are-

5bc First character should be an alphabet or underscore


Int is a keyword
Rec# # is a special character
avg no blank space is not permitted

Dept. of ECE, STJIT, Ranebennur Page 7


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

DATA TYPES
C supports different types of data. Storage representation of these data types is different in
memory. There are four fundamental data types in C, which are int, char, and float and double..
'char' is used to store any single character, ‘int’ is used to store integer value, 'float' is used for
storing single precision floating point number and 'double' is used for storing double precision
floating point number. We can use type qualifiers with these basic types to get some more types.
There are two types of type qualifiers
1. Size qualifiers - short, long
2. Sign qualifiers signed, unsigned

When the qualifier unsigned is used the number is always positive, and when signed is used
number may be positive or negative. If the sign qualifier is not mentioned, then by default signed
qualifier is assumed. The range of values for signed data types is less than that of unsigned type.
This is because in signed type, the leftmost bit is used to represent the sign, while in unsigned
type this bit is also used to represent the value.

The size and range of different data types on a 16-bit machine is given in the following table.
The size and range may vary on machines with different word sizes.

Basic data type Data type with type qualifier Size(Byte) Range
Char Char or signed char 1 -128 to 127
Unsigned char 1 0 to 255
int int or signed int 2 -32768 to 32767
unsigned int 2 0 to 65535
short int or signed short int 1 -128 to 127
unsigned short int 1 0 to 255
long int or signed long int 4 -2147483648 to 2147483647
unsigned long int 4 0 to 4294967295
Float float 4 3.4E-38 to 3.4E+38
double double 8 1.7E-308 to 1.7E+308
long double 10 3.4E-4932 to 1.1E+4932

Dept. of ECE, STJIT, Ranebennur Page 8


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

OPERATORS

An operator specifies an operation to be performed that yields a value. The variables, constants
can be joined by various operators to form an expression. An operand is a data item on which an
operator acts. Some operators require two operands, while others act upon only one operand. C
includes a large number of operators that fall under several different categories, which are as
1. Arithmetic operators
2. Assignment operators
3. Increment and Decrement operators
4. Relational operators
5. Logical operators
6. Conditional operator
7. Comma operator
8. Size of operator
9. Bitwise operators
10. Other operators

1. ARITHMETIC OPERATORS:

Arithmetic operators are used for numeric calculations.


They are of two types –
1. Unary arithmetic operators
2. Binary arithmetic operators

1.1 Unary Arithmetic Operators:


Unary operators require only one operand.
For example- +x -y
Here '-' changes the sign of the operand y.

1.2 Binary Arithmetic Operators:


Binary operators require two operands. There are five binary arithmetic operators-

Operators Purpose
+ Addition
- Subtraction
* Multiplication
/ Division
% Gives the remainder in integer division

% (modulus operator) cannot be applied with floating point operands. There is no exponent
operator in C. However there is a library function pow () to carry out exponentiation operation.
Note that unary plus and unary minus operators are different from the addition and subtraction
operations.

Dept. of ECE, STJIT, Ranebennur Page 9


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

2. ASSIGNMENT OPERATORS:

A value can be stored in a variable with the use of assignment operator. This assignment operator
" = " is used in assignment expressions and assignment statements.
The operand on the left hand side should be a variable, while the operand on the right hand side
can any variable, constant or expression. The value of right hand operand is assigned to the left
hand operand. Here are some examples of assignment expressions
x = 8/* 8 is assigned to x*/
y = 5/* 5 is assigned to y*/
s = x+y-2/* Value of expression x+y-2 is assigned to s*/
y = x /* Value of x is assigned to y*/
x = y /* Value of y is assigned to x*/
The value that is being assigned is considered as value of the assignment expression. For
Example = 8 is an assignment expression whose value is 8.
We can have multiple assignment expressions also, for example
x = y = z = 20
Here all the three variables x, y, t will be assigned value 20, and the value of the whole
expression will be 20.
If we put a semicolon after the assignment expression then it becomes an assignment statement.
For example these are assignment statements
x = 8;
y=5;
s = x+y-2;
x = y = z = 20;
When the variable on the left hand side of assignment operator also occurs on right hand side
then we can avoid writing the variable twice by using compound assignment operators. For
example
x=x+5
Similarly we have other compound assignment operators
x =5 is equivalent to = x – 5
Y*=5 is equivalent to y = y* 5
Sum/=5 is equivalent to sum = sum / 5
K%= 5 is equivalent to k = k % 5

3. INCREMENT AND DECREMENT OPERATOR:

C has two useful operators increment (++) and decrement (- -). These are unary operators
because they operate on a single operand. The increment operator (++) increments the value of
the variable by 1 and decrement operator (- -) decrements the value of the variable by 1.
++x is equivalent to x = x + 1
- -x is equivalent to x = x - 1
These operators should be used only with variables; they can't be used with constants or
expressions. For example the expressions ++5 or ++(x+y+z) are invalid.
These operators are of two types:

Dept. of ECE, STJIT, Ranebennur Page 10


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

1. Prefix increment / decrement - operator is written before the operand (e.g. ++x or - -x)
2.Postfix increment / decrement - operator is written after the operand (e.g. x++ or x - -)

4. RELATIONAL OPERATORS:
Relational operators are used to compare values of two expressions depending on their relations.
An expression that contains relational operators is called relational expression. If the relation is
true "then we value of relational expression is 1 and if the relation is false then the value of
expression is O. The relational operators are

Operators Meaning
< Less than
<= Less than or equal to
== Equal to
!= Not equal to
> Greater than
>= Greater than or equal to

5. LOGICAL OPERATORS:

An expression that combines two or more expressions is termed as a logical expression. For
combining these expressions we use logical operators. These operators return 0 for false and 1
for true. The operands may be constants, variables or expressions. C has three logical operators.

Operators Meaning
&& AND
|| OR
! NOT

1. AND (&&) OPERATOR:

This operator gives the net result true if both the conditions are true, otherwise the result is false.
Boolean Table

Condition 1 Condition 2 Result


False False False
False True False
True False False
True True True

Let us take three variables a=10, b=5, c=0


Suppose we have a logical expression-
(a = = 10) && (b < a)

Dept. of ECE, STJIT, Ranebennur Page 11


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Here both the conditions a = = 10 and b <a are true, and hence this whole expression is true.
Since the logical operators return 1 for true hence the value of this expression is 1.

Expression Result Value of expression


(a==10)&&(b>a) True && False False 0
(b>=a)&&(b==3) False && False False 0
a && b True && True True 1
a && c True && False False 0

2. OR (||) OPERATOR:

This operator gives the net result false, if both the conditions have the value false, otherwise the
result is true.
Boolean Table

Condition 1 Condition 2 Result


False False False
False True True
True False True
True True True

Let us take. Three variables a = 10, b = 5, c =0


Consider the logical expression-
(a >= b) I I (b > 15)
This gives result true because one condition is true
Expression Result Value of expression
a || b True || False True 1
a || c True || False True 1
(a<9)||(b>10) False || False False 0
(b!=7) || c True || False True 1

3. NOT (!)OPERATOR:
This is a unary operator and it negates the value of the condition. If the value of the condition is
false then it gives the result true. If the value of the condition is true then it gives the result false.
Boolean Table
Condition Result
False True
True False

Let us take three variables a = 10, b = 5, c = 0


Suppose we have this logical expression-
! (a = = 10)
The value of the condition (a= =10) is true. NOT operator negates the value of the

Dept. of ECE, STJIT, Ranebennur Page 12


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Condition. Hence the result is false.

Expression Result Value of expression


!a !true False 0
!c !false True 1
!(b>c) !true False 0
!(a && c) !false true 1

6. CONDITIONAL OPERATORS:

Conditional operator is a ternary operator (? And :) which requires three expressions as operands.
This written as
Test Expression? expression1: expression2
Firstly the Test Expression is evaluated.
(1) If Test Expression is true (nonzero), then expression1 is evaluated and it becomes the
value of the overall conditional expression.
(2) If Test Expression is false (zero), then expression2 is evaluated and it becomes the value
of overall conditional expression.
For example consider this conditional expression-
a >b? a: b

7. COMMA OPERATORS:

The comma operator (,) is used to permit different expressions to appear in situations where only
one expression would be used. The expressions are separated by the comma operator. The
separated expressions are evaluated from left to right and the type and value of the rightmost
expression is the type and value of the compound expression.
For example consider this expression-
a = 8, b = 7, c = 9, a+b+c
Here we have combined 4 expressions. Initially 8 is assigned to the variable a, then 7 is assigned
to the variable b, 9 is assigned to variable c and after this a+b+c is evaluated which becomes the
value of whole expression. So the value of the above expression is 24. Now consider this
statement
Sum = (a = 8, b = 7, c = 9, a+b+c);

8. SIZE OF OPERATORS:

Size of a unary operator, this operator gives the size of its operand in terms of bytes. The operand
can be a variable, constant or any data type (int, float, char etc.). For example size of (int) gives
the bytes occupied by the int data type i.e.2

9. BITWISE OPERATORS:

Dept. of ECE, STJIT, Ranebennur Page 13


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

C has the ability to support the manipulation of data at the bit level. Bitwise operators are used
for operations on individual bits. Bitwise operators operate on integers only. The bitwise
operators are as

Bitwise operator Meaning


& Bitwise AND
| Bitwise OR
~ One’s complement
<< Left shift
>> Right shift
^ Bitwise XOR

CONTROL STATEMENT:

In C programs, statements are executed sequentially in the order in which they appear in the
program. But sometimes we may want to use a condition for executing only a part of program.
Also many situations arise where we may want to execute some statements several times.
Control statements enable us to specify the order in which the various instructions in the program
are to be executed. This determines the flow of control. Control statements define how the
control is transferred to other parts of the program. C language supports four types of control-
statements, which are as
1. if...else
2. go to
3. Switch
4. loop
-while
- do...while
-for

1. if…else:

This is a bi-directional conditional control statement. This statement is used to test a condition
and take one of the two possible actions. If the condition is true then a single statement or a block
of statements is executed (one part of the program), otherwise another single statement or a block
of statements is executed (other part of the program). Recall that in C, any nonzero value is
regarded as true while zero is regarded as false.
Syntax:
if (condition) if (condition)
Statement 1; {
Statement; ………
}

There can be a single statement or a block of statements after the if part.

Dept. of ECE, STJIT, Ranebennur Page 14


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Condition
True

False
Statement 1

Next Statement

Flow chart of if control statement

Here if the condition is true (nonzero) then statement! Is executed, and if it is false (zero), then
the next statement which is immediately after the if control statement is executed.

2. go to:

This is an unconditional control statement that transfers the flow of control to another part of the
program.
The go to statement can be used as-
go to label;
……..
……..
label:
Statement;
………
……..
Here label is any valid C identifier and it is followed by a .colon. Whenever the statement go to
label; is encountered, the control is transferred to the statement that immediately after the label.

3. Switch:

This is a multi-directional conditional control statement. Sometimes there is a need in program to


choice among number of alternatives. For making this choice, we use the switch statement. This
c be written as
Switch (expression)
{

Dept. of ECE, STJIT, Ranebennur Page 15


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Case constant 1:
Statement
…………
Case constant 2:
Statement
…………
………....
…………
Case constant N:
Statement
………..
default:
Statement
………..
}

4. loops:
loops are used when we want to execute a part of the program or a block of statements several
times. For example, suppose we want to print "e is the best" 10 times. One way to get the desired
output. We write 10 printf statements, which is not preferable. Other way out is - use loop. Using
loop can write one loop statement and only one printf statement, and this approach is definitely
better the first ·one. With the help of loop we can execute a part of the program repeatedly till
some condition is true.
There are three loop statements in C-
1. While
2. do while
3. for

1. While loop:
While statement can be written as:
While (condition) while (condition)
Statement; {
Statement; ……...
Statement; }

False
While (condition)
True

Body of loop
Next Statement out of
loop

Dept. of ECE, STJIT, Ranebennur Page 16


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Flow chart of while loop

Like if-else statement here also we can have a single statement or a block of statements, a here it
is known as the body loop. Now let's see how this -loop works.

2. do while loop:
The 'do...while' statement is also used for looping. The body of this loop may contain a single
statement or a block of statements. The syntax for writing this loop is:

do do
Statement; {
While (condition); statement;
Statement;
While (condition); }

Body of loop

False

Condition

True
Next statement out of
loop
Flow chart of do ... while loop

Here firstly the statements inside loop body are executed and then the condition is evaluated. If
the condition is true, then again the loop body is executed and this process continues until the
conditional becomes false. Note that unlike while loop, here a semicolon is placed after the
condition.

3. for loop:
The 'for' statement is very useful while programming in C. It has three expressions and
semicolons are used for separating these expressions. The 'for' statement can be written as-
for (expression1; expression2; expression3)

Dept. of ECE, STJIT, Ranebennur Page 17


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Statement;
for (expression1; expression2; expression3)
{
Statement;
Statement;
………..
}
The loop body can be a single statement or block of statements.
Expressional is an initialization expression, expression2 is a test expression or condition and
expression3 .is an update expression. Expression1 is executed only once when the loop starts and
is used to initialize the loop... variables. This expression is generally an assignment expression.
Expression2 is a condition and is tested before each iteration of the loop. This condition
generally uses relational and logical operators. Expression3 is an update expression and is
executed each time after the body of the loop is executed.

Initialization expression

False
Condition

True

Body of loop

Update expression

Next statement out


of loop

Flow chart of for loop

Dept. of ECE, STJIT, Ranebennur Page 18


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

FUNCTIONS:
A function is a self-contained subprogram that is meant to do some specific, well-defined task.
A (program consists of one or more functions. If a program has only one function then it must be
the main) function.

 User Defined Functions :


Users can create their own functions for performing any specific task of the program.
These types of functions are called user-defined functions. To create and use these
functions, we should know about these three things
1. Function definition.
2. Function declaration
3. Function call

1. FUNCTION DEFINITION:

The function definition consists of the whole description and code of a function. It tells what the
functional is doing and what are its inputs and outputs. A function definition consists of two
parts - a functional header and a function body. The general syntax of a function definition is-
return_ type func_ name (type1 arg1, type2 arg2,……)
{
local variables declarations;
Statement;
………….
return (expression);
}

The first line in the function definition is known as the function header and after this the body of
the function is written enclosed in curly braces.
The return type denotes the type of the value that will be returned by the function. The return_
type is optional and if omitted, it is assumed to be int by default. A function can return. Either
one value 0 no value if a function doe~ not return any value then void should be written in place
of return_ type func_ name specifies the name of the function and it can be any valid C
identifier.

2. FUNCTION DECLARATION:
The calling function needs information about the called function. If definition of the called
function placed before the calling function, then declaration is not needed.
Here the definition of sum ( ) is written before main ( ), so main ( ) knows everything about the
function sum ( ). But generally the function main ( ) is placed at the top and all other functions

Dept. of ECE, STJIT, Ranebennur Page 19


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

are placed after it. In this case, function declaration is needed. The function declaration is also
known -as the function prototype, and it informs the compiler about the following three things
1. Name of the function
2. Number and type of argument received by the function.
3. Type of value returned by the function.
Function declaration tells the compiler that a function with these features will be defined and
used later in the program. The general syntax of a function declaration is-
return type func_ name (type1, arg1, type2 arg2, ....... );

3. FUNCTION CALL:

The function definition describes what a function can do, but to actually use it in the program the
function should be called somewhere. A function is called by simply writing its name followed
by the argument list inside the parentheses.
func_ name (arg1, arg2, arg3 ... )
These arguments arg1, arg2, , .. are called actual arguments.

main ( ) func1 ( )
{ {
Statement 1; ………….
func 1( ); ………….
Statement 2; }
Statement 3;
func 2(9, 3);
Statement 4; func2 (int a, int b)
Statement 5; {
} ………….
………….
}

Transfer of control when function is called

POINTERS:

C is a very powerful language and the real power of C lies in pointers. The concept of pointers is
interesting as well as challenging. It is very simple to use pointers provided the basics are
understood thoroughly. So it is necessary to visualize every aspect of pointers instead of just
having a superficial knowledge about their syntax and usage. The use of pointers makes the code
more efficient and compact.
Some of the uses of pointers are-
(i)Accessing array elements.
(ii) Returning more than one value from a function.

Dept. of ECE, STJIT, Ranebennur Page 20


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

(iii) Accessing dynamically allocated memory.


(iv) Implementing data structures like linked lists, trees, and graphs.

POINTER VARIABLE:

Finally after this brief introduction, it is time to introduce pointers. A pointer is a variable that
store memory address. Like all other variables it also has a name, has to be declared and
occupies some space memory. It is called pointer because it points to a particular location in
memory by storing the address of that location.

DECLARATION OF POINTER VARIABLE:


Like other variables, pointer variables should also be declared before being used.. The general
syntax of declaration is
data_ type *p name;
Here pname is the name of pointer variable, which should be a C identifier. The asterisk ‘*’
preceding this name informs the compiler that the variable is declared as a pointer. Here data_
type is known as the base type of pointer let us take some pointer declarations-
int *iptr;
float *fptr;
char *cptr, ch1, ch2;
Here iptr is a pointer that should point to variables of type int, similarly fptr and iptr should point
to variables of float and char type respectively. Here type of variable iptr is 'pointer to int or (int
*), or we can say that base type iptr is int. We can also combine the declaration of simple
variables. And pointer variables as we have done in the third declaration statement where ch1
and ch2 are declared as variable of type char.

POINTER TO POINTER:
We know that pointer is a variable that can contain memory address. This pointer variable takes
some space in memory and hence it also has an address. We can store the address of a pointer
variable in some other variable, which is known as a pointer to pointer variable. Similarly we can
have a pointer to pointer to pointer variable and this concept can be extended to any limit, but in
practice only pointer to pointer IS used. Pointer to pointer is generally used while passing pointer
variables to functions.
The syntax of declaring a pointer to pointer is as-
data type **pptr;
Here variable pptr is a pointer to pointer and it can point to a pointer pointing to a variable of
type data type. The double asterisk used in the declaration informs the compiler that a pointer to
pointer is being declared.

Dept. of ECE, STJIT, Ranebennur Page 21


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

CHAPTER 3

INTRODUCTION TO EMBEDDED SYSTEM

EMBEDDED SYSTEM:
It is a combination of hardware & software which is designed to perform one or more specific set
of functions. In an embedded system, there is only one application software that is typically
burned into ROM.

An embedded system is a controller with a dedicated function within a larger mechanical or


electrical system, often with real-time computing constraints. It is embedded as part of a
complete device often including hardware and mechanical parts. Embedded systems control
many devices in common use today. Ninety-eight percent of all microprocessors manufactured
are used in embedded systems.

Modern embedded systems are often based on microcontrollers (i.e. microprocessors with
integrated memory and peripheral interfaces), but ordinary microprocessors (using external chips
for memory and peripheral interface circuits) are also common, especially in more complex
systems.

In either case, the processor(s) used may be types ranging from general purpose to those
specialized in certain class of computations or even custom designed for the application at hand.
A common standard class of dedicated processors is the digital signal processor (DSP).Since the
embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the
size and cost of the product and increase the reliability and performance.

FEATURES OF EMBEDDED SYSTEM:

• Embedded systems are small size, low power consumption, rugged operating ranges &
Low per unit cost.
• Embedded systems are based on microcontroller that is CPUs with integrated memory
Or peripheral interfaces.
• Wide variety of operating systems and processors are used in embedded systems.
• They are highly reliable. Internship on DESIGN AND DEVELOPMENT OFEMBEDDED
SYSTEM and IOT Dept. of. ECE, MYCEM, Mysore.
• The power consumption is very low. An embedded system is a controller with a
Dedicated function within a larger mechanical or electrical system.
Embedded system Hardware components are as follows:
• Power supply

Dept. of ECE, STJIT, Ranebennur Page 22


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

• Processor
• Memory
• Timers/Counters
• Communication ports
• Assembler
• Application specific circuits
• Reset & oscillator circuits
• Input devices interfacing / Driver circuits
• Output devices interfacing / Driver circuits
• Interrupt controller

Fig.2.2 (a): Embedded System

An embedded system is a system that has software or firmware embedded in computer hardware.
It makes a system dedicated to a specific part of an application or product of a larger system.
Depending on the application, embedded system may be programmable or non-programmable.

Examples of embedded systems include various products such as washing machine, microwave
ovens, cameras, printers and automobiles. They use microprocessors and microcontrollers as
well as specially designed processors such as digital signal processors (DSP).

Dept. of ECE, STJIT, Ranebennur Page 23


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Fig. 2.2(b): Components of Embedded Systems

2.3 APPLICATIONS OF EMBEDDED SYSTEM

Embedded systems find wide applications in day to day situations and in real time applications,
few of them have been listed below.

(a)EMBEDDED SYSTEM FOR DETECTING RASH DRIVING ON HIGHWAYS

The main intention of this project is to design a highway speed-checker device that identifies
rash driving on highways and alarms the traffic authorities if the speed checker finds any vehicle
violating the set speed limits on highways.

(b)APPLICATION OF EMBEDDED SYSTEM FOR STREET LIGHT CONTROL

The main intention of this project is to detect the movement of vehicles on highways and to
switch on street lights ahead of it, and then to switch off the street lights as the vehicle go past
the street lights to conserve energy. In this project, a PIC microcontroller is programmed by
using embedded C or assembly language.

Dept. of ECE, STJIT, Ranebennur Page 24


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

(c)EMBEDDED SYSTEM FOR TRAFFIC SIGNAL CONTROL SYSTEM

The main goal of this project is to design a density-based traffic signal system. At every junction,
the signal timing changes automatically according to the traffic density at every junction. Traffic
jam is a major problem in many cities across the world and gives regular nightmares to the
commuters and travelers.

(d)EMBEDDED SYSTEM FOR VEHICLE TRACKING

The main purpose of this project is to find the exact location of a vehicle by using a GPS modem
and in order to reduce vehicle thefts. The GSM modem sends an SMS to a predefined mobile
which stores the data in it. An LCD display is used to display the location information in terms
of latitude and longitude values. The microcontroller (AT89C52) is preprogrammed with the
Kiel software and therefore, continuously checks the GPS modem.

(e)EMBEDDED SYSTEM FOR HOME AUTOMATION SYSTEM

The main purpose of this project is to design a home automation system with the Android
application based remote control. Remote operation is performed by Android OS based smart-
phone or Tablet etc., upon a Graphical User Interface based touch screen operation. In order to
achieve this, Android application act as a transmitter that sends on/off commands to the receiver
where in loads are connected.

(f)EMBEDDED SYSTEM FOR AUTO INTENSITY CONTROL

This project is designed to auto intensity control of LED based street lights by using solar power
from the photovoltaic panels. The awareness for solar energy is increasing, and many institutions
and peoples are opting solar energy. In this project, photovoltaic panels are used for charging
batteries by converting the sun energy into electrical energy. A solar charge controller circuit is
used to control the charging.

Dept. of ECE, STJIT, Ranebennur Page 25


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

CHAPTER 4

INTRODUCTION TO 8051 MICROCONTROLLER

INTRODUCTION TO 8051 MICROCONTROLLER

 The 8051 is an 8-bit microcontroller with 8-bit data bus and16-bit address bus.
 The 16-bit address bus can address a 64K (216) byte code memory space and a
separate 64K byte of data memory space.
 The 8051 has 4K on-chip read only code memory and 128 bytes of internal Random
Access Memory (RAM).
 Besides internal RAM, the 8051 has various Special Function Register (SFR) such as
the Accumulator, the B register, and many other control registers.
 34 8-bit general purpose registers in total.
 The ALU performs one 8-bit operation at a time.
 Two 16 bit/counter timers.
 3 internal interrupts (one serial), 2 external interrupts.
 Four 8-bit I/O ports.
 Some 8051 chips come with UART for serial communication and ADC for analog to
digital conversion.

COMPARISION OF MICROCONTROLLER AND MICROPROCESSORS

MICROCONTROLLER MICROPROCESSOR
A microcontroller is a dedicated chip A microprocessor is a general
which is also called single chip purpose device which is called a
computer. CPU.
A microcontroller includes RAM, A microprocessor do not contain on
ROM, serial and parallel interfaces, chip I/O ports, Timers, Memories etc.
timers, interrupt circuitry (in addition
to CPU) in a single chip.
Microcontrollers are used in small , Microprocessors are most commonly
minimum component designs used as the CPU in microcomputer
performing control-oriented systems.
applications

Microcontroller instructions are both Microprocessor instructions are


bit addressable as well as byte mainly nibble or byte addressable.
addressable.

Dept. of ECE, STJIT, Ranebennur Page 26


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Microcontroller based system design Microprocessor based system design


is rather simple and cost effective. is complex and expensive.

The instruction set of a The instruction set of microprocessor


microcontroller is very simple with is complex with large number of
less number of instructions. instructions.
A microcontroller has no zero flag. A microprocessor has zero status flag.

PIN DIAGRAM OF 8051 MICROCONTROLLER:

Pin out Description:

 PINS 1-8: port1 each of these pins can be configured as an input or an output.
 PIN 9: RST A logic one on this pin disables the microcontroller and clears the contents
of most registers. In other words, the positive voltage on this pin resets the
microcontroller. By applying logic zero to this pin, the program starts execution from the
beginning.

Dept. of ECE, STJIT, Ranebennur Page 27


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

 PINS 10-17: port 3 similar to port 1, each of these pins can serve as general input or
output. Besides, all of them have alternative functions.
 PIN 10: RXD serial asynchronous communication input or serial synchronous
communication output.
 PIN 11: TXD serial asynchronous communication output or serial synchronous
communication clock output.
 PIN 12: INT0 Interrupt 0input.
 PIN 13:INT1 Interrupt 1 input.
 PIN 14: T0 Counter 0 clock input.
 PIN 15: T1 Counter 1 clock input.
 PIN 16: WR Write to external (additional) RAM.
 PIN 17: RD Read from external RAM.
 PIN 18, 19:XTAL2/XTAL1 is for oscillator input.
 PIN 20: GND –Ground.
 PIN 21-28: Port 2–If there is no intention to use external memory then these port pins are
configured as general inputs/outputs. In case external memory is used, the higher address
byte, i.e. addresses A8-A15 will appear on this port. Even though memory with capacity
of 64Kb is not used, which means that not all eight port bits are used for its addressing,
the rest of them are not available as inputs/outputs.
 PIN 29: PSEN –Program store Enable. If external ROM is used for storing program, then
a logic zero (0) appears on it every time the microcontroller reads a byte from memory.
 PIN 30: ALE-Address latch enable.
1- Address on AD0 to AD7.
0- Data on AD0 to AD7.
 PIN 31: EA- it indicates the presence of external memory.
 PIN 32-39: Port 0 similar to P2.
 PIN 40: VCC +5V power supply.

FUNCTIONAL BLOCK DAIGRAM OF 8051 MICROCONTROLLER


 The Intel 8051 contains two separate buses for both program and data. So, it has two
distinctive memory spaces of 64K x 8 size for both program and data.
 It is based on an 8 bit central processing unit with an 8 bit accumulator and another 8-bit
B register as main processing blocks.
 Other portions of the architecture include few 8 bit and 16 bit registers and 8-bit memory
locations.
 It has some amount of data RAM built in the device for internal processing. This area is
used for stack operations and temporary storage of data.
 8051 is supported with on-chip peripheral functions like I/O ports, Timers/Counters,
serial communication port.

Dept. of ECE, STJIT, Ranebennur Page 28


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Fig: Block Diagram of 8051

CENTRAL PROCESSING UNIT (CPU):

 The CPU is the brain of the microcontrollers expected task reading user’s programs and
executing as per the instruction stored there in.
 Its primary elements are an Accumulator (AC), Stack Pointer (SP), Program Counter
(PC), Program Status Word (PSW), Data Pointer (DTPR) and few more 8-bit register.

ARITHMETIC LOGIC UNIT (ALU):

 The Arithmetic logic unit performs the computing functions; it includes the accumulator,
temporary register, arithmetic and logic circuits.
 The temporary register is used to hold data during an arithmetic /logic operation.
 The result is stored in accumulator register.

ACCUMULATOR:

 The accumulator register act as an operand register, in case of some instructions.


 This may either be implicit or specified in the instruction.

Dept. of ECE, STJIT, Ranebennur Page 29


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

 The accumulator register has been allotted on address in the on –chip special function
register

Figure: Architecture of 8051

PROGRAM STATUS WORD (PSW):

This set of flags contains the status information and is considered as one of the special function
registers.

Dept. of ECE, STJIT, Ranebennur Page 30


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

D7 D6 D5 D4 D3 D2D1 D0
PSW.7 PSW.6 PSW.5 PSW.4 PSW.3 PSW.2 PSW.1 PSW.0

CY AC FO RS1 RS0 OV ------ P


Figure: Program status word (PSW)

PSW.0: CY: Carry Flag


PSW.1: ---: User Definable Flag
PSW.2: OV: overflow Flag
PSW.3: RS0: Register Bank Select Bit 0
PSW.4: RS1: Register Bank Select Bit 1
PSW.5: FO: Flag 0 available for general purpose
PSW.6: AC: Auxiliary Carry Flag
PSW.7: CY: Carry Flag

The bits PSW.3 and PSW.4 are denoted as RS0 and RS1. These bits are used to select the bank
register of the RAM location.

STACK POINTER (SP)

 This 8-bit register is incremented before the data is stored onto the stack using PUSH or
CALL instructions.
 This registers contains 8-bit stack top address. The stack may be defined anywhere in the
on-chip 128 byte RAM. After reset, the SP register is initialized to 07.
 After each write two stack operation, the 8-bit contents of the operand are stored onto the
stack, after incrementing the SP register by 1.
 Thus if SP contains 07H, the forthcoming PUSH operation will store the date at address
08H in the internal RAM.
 The SP content will be incremented to 08.the 8051 stack is not a top-down data structure,
like other Intel processors. This register has also been allotted on address in the special
function register bank.

DATA POINTER (DTPR)

 This 16-bit register contains a higher byte (DPH) and the lower byte (DPL) of a 16-bit
external data RAM address.
 It is accessed as a 16-bit register or two 8-bit registers as specified above. It has been
allotted to two address in the special function register bank, for its two bytes DPH and
DPL.

PORT 0 TO 3 LACHES AND DRIVES

 This four latches and driver pairs are allotted to each of the four on-chip I/O ports.

Dept. of ECE, STJIT, Ranebennur Page 31


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

 These latches have been allotted address in the especial function register bank.
 Using the allotted addresses, the users can communicate with these ports. These are
identified as P0, P1 and P3.

SERIAL DATA BUFFER

 The serial data buffer internally contains two independent registers.


 One of them is a transmit buffer which is necessarily a parallel–in serial–out (PISO)
register.
 The other is called receive buffer which is a serial–in parallel–out (SIPO) register.
 Loading a byte to the transmit buffer initiates serial transmission of that byte.
 The serial data buffer is identified as SBUF and is one of the special function register.
 If a byte is written to SBUF, it initiates serial transmission and if the SBUF is read, it
reads received serial data.

TIMER REGISTER

 These two 16-bit register can be accessed as the lower and upper bytes.
 For examples, TL0 represents the lower byte of the timing register 0, while TH0
represents the upper byte of the timing register 0.
 Similarly, TL1 and TH1 represent lower and higher byte of the timing register 1.
 All these registers as be accessed using the four addresses allotted to them which lie in
the special function register (SFR) address range,i.e.80Hto FF.

CONTROL REGISTER

 The special function register IP, IE, TMOD, TCON, SCON and PCON contain control
and status information for interrupts, Timer / Counters and serial port.
 All of the registers have been allotted addresses in the special function register bank of
8051.

TIMING AND CONTROL UNIT

 This unit derives all the necessary timing and control signals recovered for the internal
operation of the circuit.
 It also derives control signals recovered for controlling the system bus.

OSCILLATOR

 This circuit generates the basic timing clock signal for the operation of the circuit using
crystal oscillator.

Dept. of ECE, STJIT, Ranebennur Page 32


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

INSTRUCTION REGISTER

This register decodes the OPCODE of an instruction to be executed and gives information to
the timing and control unit to generate necessary signal for the execution of the instruction.

EPROM and Program Address Register


This block provides an on-chip EPROM and a mechanism to internally address it. (Note that
EPROM is not available in all versions of 8051)

RAM and RAM Address Register

These blocks provide internal 128 bytes of RAM and a mechanism to address it internally.

SFR (Special Function Register) Register Bank

 This is a set of special function registers, which can be addressed using their respective
addresses which lie in the range of 80H to FFH.
 Finally, the interrupt, serial port and timer units control and perform their specific
function under the control of the timing and control unit.

FEATURES AND APPLICATIONS OF 8051MICROCONTROLLER

FEATURES OF 8051 MICROCONTROLLER

An 8051 microcontroller comes bundled with the following features −

 4KB bytes on-chip program memory (ROM)


 128 bytes on-chip data memory (RAM)
 Four register banks
 128 user defined software flags
 8-bit bidirectional data bus
 16-bit unidirectional address bus
 32 general purpose registers each of 8-bit
 16 bit Timers (usually 2, but may have more or less)
 Three internal and two external Interrupts
 Four 8-bit ports,(short model have two 8-bit ports)
 16-bit program counter and data pointer
 8051 may also have a number of special features such as UARTs, ADC, Op-amp, etc.

Dept. of ECE, STJIT, Ranebennur Page 33


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

APPLICATION OF 8051 MICROCONTROLLER:

The microcontroller 8051 applications include a large amount of machines, principally because it
is simple to incorporate in a project or to assemble a machine around it. The following are the
key spots of the spotlight:

Applications of 8051 microcontroller

1. Energy Management: Competent measuring device systems aid in calculating energy


consumption in domestic and industrialized applications. These meter systems are prepared
competent by integrating microcontrollers.

2. Touch screens: A high degree of microcontroller suppliers integrate touch sensing abilities in
their designs. Transportable devices such as media players, gaming devices & cell phones are
some illustrations of micro-controller integrated with touch sensing screens.

3. Automobiles: The microcontroller 8051 discovers broad recognition in supplying automobile


solutions. They are extensively utilized in hybrid motor vehicles to control engine variations.
Also, works such as cruise power and anti-brake mechanism has it more capable with created
the amalgamation of micro-controllers.

4. Medical Devices: Handy medicinal gadgets such as glucose & blood pressure monitors bring
into play micro-controllers, to put on view the measurements, as a result, offering higher
dependability in giving correct medical results.

Dept. of ECE, STJIT, Ranebennur Page 34


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

INTRODUCTION TO IOT (INTERNET OF THINGS)

INTRODUCTION TO IOT:

The internet of Things (IOT) is the network of physical objects or “things” embedded with
electronics, software, sensors, and network connectivity, which enables these objects to collect
and exchange data.

IOT has many applications in agriculture, smart cities, smart home, healthcare, business sectors,
Traffic monitoring, transport and logistics etc. This is growing mega trend that will influence
everything from businesses to our daily personal lives.

The internet of things, or IOT, is a system of interrelated computing devices, mechanical and
digital machines, objects, animals or people that are provided with unique identifiers (UIDs) and
the ability to transfer data over a network without requiring human-to human or human-to-
computer interaction.

The definition of the Internet of things has evolved due to the convergence of multiple
technologies, real-time analytics, machine learning, commodity sensors, and embedded systems.
Traditional fields of embedded systems, wireless sensor networks, control systems, automation
(including home and building automation), and others all contribute to enabling the Internet of
things.

In the consumer market, IOT technology is most synonymous with products pertaining to the
concept of the "smart home", covering devices and appliances (such as lighting fixtures,
thermostats, home security systems and cameras, and other home appliances) that support one or
more common ecosystems, and can be controlled via devices associated with that ecosystem,
such as smart phones and smart speakers.

APPLICATIONS OF IOT
Internet of Things (IOT) has introduced wide spectrum of applications. Few of the applications
have been discussed in following sections.

Consumer Applications: A growing portion of IOT devices are created for consumer use,
including connected vehicles, home automation, wearable technology (as part of Internet of
Wearable Things (IOWT), connected health, and appliances with remote monitoring capabilities.

Smart Home: IOT devices are a part of the larger concept of home automation, which can
include lighting, heating and air conditioning, media and security systems. Long-term benefits
could include energy savings by automatically ensuring lights and electronics are turned off.

A smart home or automated home could be based on a platform or hubs that control smart
devices and appliances. For instance, using Apple's Home Kit, manufacturers can have their
home products and accessories controlled by an application in IOS devices such as the iPhone

Dept. of ECE, STJIT, Ranebennur Page 35


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

and the Apple Watch. This could be a dedicated app or IOS native applications such as SIRI.
This can be demonstrated in the case of Lenovo's Smart Home Essentials, which is a line of
smart home devices that are controlled through Apple's Home app or SIRI without the need for a
Wi-Fi bridge.

There are also dedicated smart home hubs that are offered as standalone platforms to connect
different smart home products and these include the Amazon Echo, Google Home, Apple's
Home Pod, and Samsung's Smart Things Hub. In addition to the commercial systems, there are
many non-proprietary, open source ecosystems; including Home Assistant, Open HAB and
Demotic.

Elder care: One key application of a smart home is to provide assistance for those with
disabilities and elderly individuals. These home systems use assistive technology to
accommodate an owner's specific disabilities. Voice control can assist users with sight and
mobility limitations while alert systems can be connected directly to cochlear implants worn by
hearing-impaired users.

They can also be equipped with additional safety features. These features can include sensors
that monitor for medical emergencies such as falls or seizures. Smart home technology applied in
this way can provide users with more freedom and a higher quality of life. The term "Enterprise
IOT" refers to devices used in business and corporate settings. By 2019, it is estimated that the
EIOT will account for 9.1 billion devices.

The Internet of Medical Things (also called the internet of health things) is an application of the
IOT for medical and health related purposes, data collection and analysis for research, and
monitoring. This 'Smart Healthcare', as it is also called, led to the creation of a digitized
healthcare system, connecting available medical resources and healthcare services.

IOT devices can be used to enable remote health monitoring and emergency notification systems.
These health monitoring devices can range from blood pressure and heart rate monitors to
advanced devices capable of monitoring specialized implants, such as pacemakers, Fit bit
electronic wristbands, or advanced hearing aids.

Some hospitals have begun implementing "smart beds" that can detect when they are occupied
and when a patient is attempting to get up. It can also adjust itself to ensure appropriate pressure
and support is applied to the patient without the manual interaction of nurses.

Dept. of ECE, STJIT, Ranebennur Page 36


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

CHAPTER 5

INTRODUCTION TO KEIL AND PROTEUS SOFTWARE


INTRODUCTION TO KEIL:

This manual is an introduction to the KEIL development tools designed for Cortex-MX, ARM7,
ARM9, C166, XE166, XC2000, and 8051 microcontrollers. It introduces the µVision Integrated
Development Environment, Simulator, and Debugger and presents a step-by-step guided tour of
the numerous features and capabilities the KEIL embedded development tools offer.

INTRODUCTION TO PROTEUS:
Proteus is one of the most famous simulators. It can be used to simulate almost every circuit on
electrical fields. It is easy to use because of the GUI interface that is very similar to the real
prototype board. Moreover, it can be used to design Print Circuit Board (PCB).

Dept. of ECE, STJIT, Ranebennur Page 37


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

STEPS
The project development cycle is similar to any other software development project.

1. Create a project, select the target device from the Device Database, and configure the
tools settings.
2. Create source files in c
3. Build applications with project manager
4. Debug and correct errors in source files, verify and optimize application
5. Download code to flash ROM or SRAM and test the linked application

PROCEDURE:
STEP1: After opening Keil uV4, Go to PROJECT tab and create new uVision project.
Now select new folder and give name to project.

STEP2: After creating project now select your device model. E.g.: NXP-LPC2148.

Dept. of ECE, STJIT, Ranebennur Page 38


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

STEP3: So now your project is created and message window will appear to add startup file of
your Device click on YES so it will be added to your project folder.

STEP4: Now go to file and create new file and save it with .C extension if you will write
program in c language or save with .asm for assembly language. E.g. led.c

STEP5: Now write your program and save it again.

STEP6: After that on left you can see project window [if it’s not there….. go to view tab and
click on project window] ---And now come on project window.

Right click on target and click on options for target.

Dept. of ECE, STJIT, Ranebennur Page 39


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Here you can change your device also.

Click output tab here and check create hex file if you want to generate hex file. Now click on
ok so it will save changes.

STEP7: Now Expand target and you will see source group.
 Right click on group.

Dept. of ECE, STJIT, Ranebennur Page 40


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

 Click on Add files to source group.

Now add your program file which you have written in C/assembly. You can see program file
added under source group.

STEP8: Now click on Build target. You can find it under project tab or in toolbar. It can also
be done by pressing F7 key.

Dept. of ECE, STJIT, Ranebennur Page 41


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

STEP9: You can see status of your program in Build output window [if it’s not there go to
view and click on build output window].

EXAMPLE: LED INTERFACING PROGRAM USING KEIL AND


PROTEUS.
#include<reg51.h>

Sbit led=P2^1;

Void delay (int x)

Int i, j;

for (i=0; i<1275; i++)

for (j=0; j<x; j++);

Void main ()

While (1)

Led =1;

Delay (20);

Led =0;

Delay (20);

Dept. of ECE, STJIT, Ranebennur Page 42


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Output in keil:

Output in Proteus:

Dept. of ECE, STJIT, Ranebennur Page 43


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

PROJECT

WIRELESS HOSPITAL SANITATION

 This project describes the evolving role of robotics in healthcare and allied areas with
special concerns relating to the management and control of the spread of the novel corona
virus disease 2019 (covid-19).
 The prime utilization of such robots is to minimize person to person contact and to ensure
cleaning, sterilization and support in hospitals and similar facilities such as quarantine.
 This well result in minimizing the life threat to medical staff and doctors taking an active
role in the management of the covid -19 pandamic.

PROGRAM
#include <reg51.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
//DEFINE CONSTANT
#define Baud_rate 0xFD // BAUD RATE 9600

//DEFINE PROTOTYPES
void SerialInitialize (void);
void SendByteSerially (unsigned char);
void cct_init (void);
void Send_string (unsigned char);

sbit Motor1 = P2^0;


sbit Motor2 = P2^1;
sbit Motor3 = P2^2;
sbit Motor4 = P2^3;
sbit Motor5 = P2^4;
sbit Motor6 = P2^5;

// define pins for lcd


void delay (int x)
{
int i, j;
for (i=0; i<1275; i++)
for (j=0; j<x; j++);
}

Dept. of ECE, STJIT, Ranebennur Page 44


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

void forward ()
{
Motor1 = 1;
Motor2 = 0;
Motor3 = 1;
Motor4 = 0;
}

void Backward ()
{
Motor1 = 0;
Motor2 = 1;
Motor3 = 0;
Motor4 = 1;

void right ()
{
Motor1 = 1;
Motor2 = 0;
Motor3 = 0;
Motor4 = 1;

}
void left()
{
Motor1 = 0;
Motor2 = 1;
Motor3 = 1;
Motor4 = 0;

void stop ()
{
Motor1 = 1;
Motor2 = 1;
Motor3 = 1;
Motor4 = 1;

void forward1 ()
{

Dept. of ECE, STJIT, Ranebennur Page 45


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Motor4 = 1;
Motor5 = 0;
}

void Backward1 ()
{

Motor4 = 0;
Motor5 = 1;
}

void stop1 ()
{

Motor5 = 1;
Motor4 = 1;
}

void main ()
{
cct_init ();
SerialInitialize ();
//lcd initialise
EA = 1;
ES = 1;
while (1) {

}
}

void cct_init (void) //initialize cct


{
P0 = 0x00; //not used
P1 = 0x00; //Used for Appliances
//P2 = 0x00; //not used
P3 = 0x03; //used for serial

void SerialInitialize (void) // INITIALIZE SERIAL PORT


{
TMOD = 0x20; //Timer1 IN MODE 2-AUTO RELOAD TO
GENERATE BAUD RATE

Dept. of ECE, STJIT, Ranebennur Page 46


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

SCON = 0x50; //SERIAL MODE 1, 8-DATA BIT 1-


START BIT, 1-STOP BIT, REN ENABLED
TH1 = Baud_rate; // LOAD BAUDRATE TO TIMER REGISTER
TR1 = 1; // START TIMER
}

void SendByteSerially (unsigned char serialdata)


{
SBUF = serialdata; // LOAD DATA TO SERIAL BUFFER
REGISTER
while (TI == 0); //WAIT UNTIL TRANSMISSION
TO COMPLETE
TI = 0; // CLEAR TRANSMISSION INTERRUPT
FLAG
}

void Send_string (unsigned char *p)


{
while (*p)
{
SendByteSerially (*p++);
}
}

void serial_ISR (void) interrupt 4


{
//receive character
char chr;
char str[10];
int n, m, i;
if (RI==1)
{
chr = SBUF;
RI = 0;
}

P0 = ~P0; //Show the data has been updated

if (chr=='f')
{
Send_string ("robot forward");
forward ();
}
else if (chr=='b')
{

Dept. of ECE, STJIT, Ranebennur Page 47


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Send_string ("robot backward");


backward ();
}
else if (chr=='r')
{
Send_string ("robot right");
right ();
}
else if (chr=='l')
{
Send_string ("robot left");
left ();
}
else if (chr=='a')
{
Send_string ("sanitizing");
forward1 ();
}

RI = 0;
}

Dept. of ECE, STJIT, Ranebennur Page 48


DESIGN AND DEVELOPMENT OF EMBEDDED SYSTEM

Output in keil

Output in proteus

Dept. of ECE, STJIT, Ranebennur Page 49

You might also like