Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 103

EDUCATION

Embedded systems with 8051


EMPLOYABILITY

micro-controller using
Embedded c
ENTREPRENEURSHIP

By K.Rasagnya

www.task.telangana.gov.in
Contents
EDUCATION

1. Introduction to Embedded systems


• What is an Embedded systems
EMPLOYABILITY

• Definition of Embedded systems

• Components of Embedded systems

2. Embedded systems applications using 8051 Microcontroller

3. Embedded systems design requirements


ENTREPRENEURSHIP

4. Microcontroller vs Microprocessor

5. Embedded software
• Higher level coding

• Assembly language coding

www.task.telangana.gov.in
Contents
EDUCATION

6. Introduction to Microcontroller
• 8051 Microcontroller
EMPLOYABILITY

• Different manufacturers

• Choosing a Microcontroller

• Block diagram and Pin description


ENTREPRENEURSHIP

7. C programming for Microcontroller

8. Keil microvision
• Uses

• Installation of Keil C51 compiler

• Steps for first project creation on Keil


www.task.telangana.gov.in
Contents
EDUCATION

9. Installation of Proteus ISIS

10. Concepts and project on LED


EMPLOYABILITY

• LED blink

• 1 LED blink

• LED alternate on off


ENTREPRENEURSHIP

• LED blinking (4 LED ON & 4 LED OFF )

11. Switch interfacing with 8051

12. Relay interfacing with 8051

13. DC motor interfacing with 8051


www.task.telangana.gov.in
Contents
EDUCATION

14. LCD interfacing with 8051

15. Stepper motor with 8051


EMPLOYABILITY

16. 7 segment display with 8051

17. Timers
ENTREPRENEURSHIP

www.task.telangana.gov.in
Introduction to Embedded systems
EDUCATION

• A system is a group of units, joined together to work in a specific routine and perform
some fixed operation.
EMPLOYABILITY

• An embedded system is that system which has computer hardware with software
embedded in it.

• It has a programmable element inside it, which is developed to perform one dedicated
ENTREPRENEURSHIP

task (EX: MP3 player, which can be used for playing audio).

• An embedded system product is controlled by an internal microprocessor


or microcontroller instead of some external control unit.

www.task.telangana.gov.in
Components of Embedded System
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Components of Embedded System
EDUCATION

• An Embedded System consists of four main components. They are the Processor
EMPLOYABILITY

(Microprocessor or Microcontroller), Memory (RAM and ROM), Peripherals (Input and


Output) and Software (main program).

Processor : 
ENTREPRENEURSHIP

• The heart of an Embedded System is the Processor.

• Based on the functionality of the system, the processor can be anything like a General Purpose
Processor, a single purpose processor, an Application Specific Processor, a microcontroller or
an FPGA.

www.task.telangana.gov.in
EDUCATION

Memory : 

• Memory is another important part of an embedded system.


EMPLOYABILITY

• It is divided in to RAM and ROM. Memory in an Embedded System (ROM to be specific) stores the
main program and RAM stores the program variables and temporary data.

Peripherals : 
ENTREPRENEURSHIP

• In order to communicate with the outside world or control the external devices, an Embedded System
must have Input and Output Peripherals.

• Some of these peripherals include Input / Output Ports, Communication Interfaces, Timers and
Counters, etc.

www.task.telangana.gov.in
EDUCATION

Software : 

• All the hardware work according to the software (main program) written. Software
EMPLOYABILITY

part of an Embedded System includes initialization of the system, controlling inputs


and outputs, error handling etc.

 Many Embedded Systems, usually small to medium scaled systems, generally


ENTREPRENEURSHIP

consists of a Microcontroller as the main processor. With the help of a


Microcontroller, the processor, memory and few peripherals will be integrated in to a
single device.

www.task.telangana.gov.in
Applications of Embedded systems
EDUCATION

• Even with the development of many advanced and superior Microcontrollers, 8051
EMPLOYABILITY

Microcontroller is still being used in many embedded system and applications.

1. Communication :
• Mobile Phones
ENTREPRENEURSHIP

• Satellite systems

• Telephone systems

• ATM machines

www.task.telangana.gov.in
Applications of Embedded systems
EDUCATION

2. Automotive : 3. Consumer Electronics :


EMPLOYABILITY

• Automatic Breaking system • Washing machines

• Noise cancellation • Games and toys ,

• Locator • LCD TV, DVD, Music systems


ENTREPRENEURSHIP

• Sensors • Clocks

• Microwave oven

• Exercise Equipment's

www.task.telangana.gov.in
Applications of Embedded systems
EDUCATION

4. Medical : 5. Industrial :
EMPLOYABILITY

• Monitors for detection of • Traffic control systems


Heart system ( ECG ) • Robot systems
Kidney • Radio remote controls
ENTREPRENEURSHIP

Temperature • Bar code reader and writer


• Blood analysis
• Automatic sprinklers to control
• Drug delivery the wetness of the soil
• Cancer treatments

• Dialysis machine
www.task.telangana.gov.in
Applications of Embedded systems
EDUCATION

6. Defense : 7. Automobiles :
EMPLOYABILITY

• Sonar • Air Bags

• Rader system • Engine Control

• Missile guidance systems • Transmission Control


ENTREPRENEURSHIP

• Automated firing weapons • Temperature Control

• Navigation systems • Keyless Entry

• Wireless control of weapons • Door control unit

www.task.telangana.gov.in
EDUCATION

Embedded systems Design Requirement


EMPLOYABILITY

• Selection of central processing unit

• Selection of Embedded Operating Systems


ENTREPRENEURSHIP

• Selection of Peripherals ( depends on application )

www.task.telangana.gov.in
Microcontroller Vs Microprocessor
EDUCATION

• Microprocessor :
1. Microprocessor acts as a heart of computer system.
EMPLOYABILITY

2. CPU is stand-alone. It is a processor in which memory(RAM &ROM) and I/O component is connected
externally.

3. Designer can decide the amount of RAM, ROM & I/O ports.

4. A processor is installed or mounted on Mother Board and Microprocessor on its own does not do anything.
ENTREPRENEURSHIP

5. In order to function this Microprocessor, we need a Mother Board with number of different chips on board.

6. Expensive and mainly used in personal computers.

www.task.telangana.gov.in
Microcontroller Vs Microprocessor
EDUCATION

• Microcontroller :
1. Microcontroller acts as a heart of embedded system.
EMPLOYABILITY

2. A Microcontroller is a single chip system( on a single integrated circuit) which has many
other components on it ( peripherals embedded on to a single chip ).

3. Fixed amount of on chip ROM, RAM, I/O ports .


ENTREPRENEURSHIP

4. It is a controlling device in which memory and I/O component is present internally. Due this
the circuit will be small.

5. Cost of the entire system will be less.

6. Used mainly in Washing machines, MP3 players etc.

www.task.telangana.gov.in
Embedded Software
EDUCATION

• Embedded Software is the software that controls an embedded system.


EMPLOYABILITY

• All embedded systems need some software for their functioning.

• It is the software which we write for the chosen microcontroller.

• Embedded software or program is loaded in the microcontroller which then takes


ENTREPRENEURSHIP

care of all the operations that are running.

• It is generally 2 types

1. Higher level coding

2. Assembly language coding

www.task.telangana.gov.in
Embedded Software
EDUCATION

• Assembly language coding :


EMPLOYABILITY

1. Every microcontroller manufacturer gives us some instruction sets.

2. The program written using that instructions is called Assembly language


programming.
ENTREPRENEURSHIP

3. The issue is it takes lot of time to study the entire assembly instruction set of a
particular microcontroller.

4. No portability and debugging is difficult.

5. Good for small level projects

www.task.telangana.gov.in
Embedded Software
EDUCATION

• Higher level language :


EMPLOYABILITY

1. In higher level language, program is written using higher level languages such as c, c+
+, java etc.

2. While there are many embedded languages available, C is most popular of them all.
ENTREPRENEURSHIP

3. It is portable and Good efficiency

4. Compilers available for all microcontroller.

5. Good for small to large projects.

www.task.telangana.gov.in
Microcontroller
EDUCATION

• Microcontroller or microprocessor is the very important part of embedded system. So


EMPLOYABILITY

the thing that you should know is your microcontroller.

• Microcontroller is a single chip system, which has all the peripherals on that chip. It
has RAM, ROM and some other peripherals such as timers, counters etc.
ENTREPRENEURSHIP

• A microcontroller will act as a CPU of your embedded system.

• Most commonly used microcontrollers are Arduino, PIC Microcontroller or 8051


Microcontroller etc.

www.task.telangana.gov.in
8051 Microcontroller
EDUCATION

• The 8051 Microcontroller is one of the most popular and most commonly used
microcontrollers in various fields like embedded systems, consumer electronics,
EMPLOYABILITY

automobiles, etc.

• 8051 is the microcontroller architecture developed by Intel in the year 1980.

• 8051 Microcontroller has many features like Serial Communication, Timers, Interrupts, etc. 
ENTREPRENEURSHIP

• Because of their low power consumption, smaller size and simple architecture, 8051 IP
Cores (Intellectual Property Cores)  are used in FPGAs (Field Programmable Gate Array)
and SoCs (System on Chip) instead of Advanced ARM Architecture based MCUs.

www.task.telangana.gov.in
EDUCATION

Different manufacturers of Microcontroller


EMPLOYABILITY

• Atmel • Infineon

• Renesas Semiconductors • Siemens

• Freescale Semiconductors • Silicon Labs


ENTREPRENEURSHIP

• Phillips • NXP

• ST Microelectronics

www.task.telangana.gov.in
Choosing a Microcontroller
EDUCATION

• Depending upon the application, first choose a microcontroller. It depends on the hardware that you
want to connect with. Also the software requirements should be kept in kind while choosing
EMPLOYABILITY

microcontroller.

1. Speed grade in MHz

2. Amount of RAM and ROM


ENTREPRENEURSHIP

3. Task at hand ( based on it we choose (8/16/32 bit )

4. Number of I/O pins ( depending upon number of peripherals we have to interface ).

5. How easy to upgrade to high performance or low power version.

6. Power consumption.

www.task.telangana.gov.in
Microcontroller Architecture
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Microcontroller pin diagram
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Important features of 8051
EDUCATION

1. 4K bytes ROM
EMPLOYABILITY

2. 128 bytes RAM

3. Four 8 bit I/O ports (P0, P1, P2, P3). All I/O ports are bidirectional.

4. Serial ports with 2 lines (TXD & RXD)


ENTREPRENEURSHIP

5. Two 16 bit timers T0, T1 (can be used as timers as well as counters)

6. There is a CPU along with interrupts control unit( INT0, INT1) and an on chip
oscillator (Although the oscillator is on chip, we need to connect crystal externally).

www.task.telangana.gov.in
Important features of 8051
EDUCATION

7. RST (reset) needs a positive signal whenever the microcontroller gets powered ON that’s
why it is a power-on reset. So, on applying a high pulse to RST, the microcontroller will
EMPLOYABILITY

reset and all values in register will be lost.

8. EA (External Access and initially it is active low). For 8051, EA pin is connected to Vcc.

9. PSEN ( Program Store Enable) is an output pin and used for external ROM. It is used
ENTREPRENEURSHIP

when you are download the program externally.

10. ALE ( Address Latch Enable) is an output pin and is active high. It is used for
demultiplexing the address and data.

www.task.telangana.gov.in
8051 Microcontroller Basic Circuit
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Proteus ISIS
EDUCATION

• We have to design a lot of electronics or embedded circuits and its always a


EMPLOYABILITY

best approach to simulate these circuits first on some simulation software


before assembling them on actual hardware.

• Proteus is a simulation and design software tool developed by Labcenter


ENTREPRENEURSHIP

Electronics for Electrical and Electronics circuit design.

• Proteus software is very easy for simulation.

www.task.telangana.gov.in
Proteus ISIS
EDUCATION

• Proteus ISIS is the software used to draw schematics and simulate the
EMPLOYABILITY

circuits in real time.

• It has wide range of components in its library. It has discrete components


like resistors, capacitors, inductors, transformers, digital and analog
ENTREPRENEURSHIP

Integrated circuits, semi-conductor switches, relays, microcontrollers,


processors, motors etc.

www.task.telangana.gov.in
Installation of Proteus ISIS
EDUCATION

• Download the software from given below link


EMPLOYABILITY

https://drive.google.com/u/0/uc?id=14ERAQzsyKfj6eJUtcmXHZRN3exYGVBSn&export=download

• Go to downloads and extract proteus software in any drive (E drive).

• Go to E drive and open proteus folder, then right click on pro-setup77 and click on
ENTREPRENEURSHIP

Run as administrator.

• It will ask you to install, click on yes, next click on ok, click on next.

www.task.telangana.gov.in
Installation of Proteus ISIS
EDUCATION

• Next it will ask for licence key.


EMPLOYABILITY

• Select locally installed licence key and click on next.

• It will show “no license key is selected”, click on next and select Browse for
ENTREPRENEURSHIP

Key File

• Go to drive ( E drive ) where proteus software is present open it then open crack
and select the license key and click on open .

www.task.telangana.gov.in
Installation of Proteus ISIS
EDUCATION

• Click on install next click on yes and then close that window.
EMPLOYABILITY

• Click on next(see destination properly), next, next, next.

• It will take some time to install and then click on finish.


ENTREPRENEURSHIP

• Go to drive(E drive), open proteus software folder and open crack.

• You will have LXK proteus 7.7 SP2 ENG v1.0.0 , right click on it and select
Run as administrator.

www.task.telangana.gov.in
Installation of Proteus ISIS
EDUCATION

• It will show the license for proteus, click on browse and select computer, next
EMPLOYABILITY

select c drive, next select Program Files(x86), next select Labcenter


electronics, next select Proteus 7 Professional and click on ok and click on
update.
ENTREPRENEURSHIP

• You will get “update installed successfully”, click on ok .

• It is done and ready to use.

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

Proteus ISIS

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP Proteus ISIS

www.task.telangana.gov.in
Keil microvision
EDUCATION

• It is the most popular software used for programming of 8051.


EMPLOYABILITY

1. Freeware available on keil website.

2. Easy to use

3. Provides Real time simulation.


ENTREPRENEURSHIP

4. Easy to debug

5. Supports external libraries

www.task.telangana.gov.in
Installation of Keil microvision
EDUCATION

• Open http://www.keil.com/c51/
EMPLOYABILITY

• Go to download, then click on Product Downloads.

• Next click on c51

• It will show a form, fill that form ( device used is at89c51 ).


ENTREPRENEURSHIP

• After filling, click on submit and you will have .EXE, click on it, then click on
start download.

• It will download the file and click on open folder.

www.task.telangana.gov.in
Installation of Keil microvision
EDUCATION

• Then double click on first file ( C55v939.exe ) .


EMPLOYABILITY

• Click on next, we have to give our information and click on next.

• It will take a minute to finish and select the given 2 options and click on finish.

• Search Keil microvision and open it.


ENTREPRENEURSHIP

• Go to project and close project.

• To start a new project, go to project and select new project.

www.task.telangana.gov.in
C Programming for Microcontroller
EDUCATION

• The ‘c’ programming language was developed for UNIX operating system, by
EMPLOYABILITY

Dennis Ritchie in 1971.

• C is a middle-level computer language it has efficiency to create application and


machine oriented programs.
ENTREPRENEURSHIP

• C code is easy to understand.

• Strong library support in c ( stdio.h ) for embedded c we use reg51.h

• Easily switch on other processor/controller.

www.task.telangana.gov.in
Example :
EDUCATION

if syntax : int a, b ;
Scanf(“%d%d”, &a, &b)
EMPLOYABILITY

if(condition) if(a>b)

{ {

do this ; printf(“a is greater”);

} }
ENTREPRENEURSHIP

if(b>a)
{
printf(“b is greater”);
}

www.task.telangana.gov.in
Example :
EDUCATION

if else syntax : int a, b ;


Scanf(“%d%d”, &a, &b)
EMPLOYABILITY

if(condition) if(a>b)

{ {

do this ; printf(“a is greater”);

} }
ENTREPRENEURSHIP

else else

{ {

do this ; printf(“b is greater”);

} }

www.task.telangana.gov.in
Example :
EDUCATION

While loop syntax : main()


{
EMPLOYABILITY

while(condition) int a ;

{ a=1;

do this ; while(a<=10)

increment ; {
ENTREPRENEURSHIP

} printf(“hello”);
a++;
}
}

www.task.telangana.gov.in
Example :
EDUCATION

for loop syntax : main()


{
EMPLOYABILITY

for( initial; condition; increment ) int a ;

{ for(a=1;a<=10;a++)

do this ; {

} printf(“hello”);
ENTREPRENEURSHIP

}
}

www.task.telangana.gov.in
switch syntax : Example :
EDUCATION

main()
switch( integer expression)
{
{
EMPLOYABILITY

int a=1 ;
case 1 :
switch(a)
Do this ;
case 1 :
case 2 :
printf( “one”) ;
Do this ;
case 2 :
ENTREPRENEURSHIP

default :
printf( “two”) ;
Do this ;
default :
}
printf( “default”) ;
}

www.task.telangana.gov.in
EDUCATION

• Infinite loops :
EMPLOYABILITY

For embedded systems, infinite loops are always required for MCU based
applications.

Ex: while(1)
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of LED with 8051 micro-controller
EDUCATION

• Basics of LED :
EMPLOYABILITY

• LED’s are (Light Emitting Diode) components which can emit a specific light.

• It can be RED, GREEN, BLUE or YELLOW.

• LED’s are bidirectional devices and are required to be connected in a specific


ENTREPRENEURSHIP

direction only in a circuit.

• The LED’s are having two leads, they are called as Anode and Cathode.

www.task.telangana.gov.in
Interfacing of LED with 8051 micro-controller
EDUCATION

• Basics of LED :
EMPLOYABILITY

• In cross sectional view, the bigger substrate is


cathode and the smaller substrate is anode.

• Whenever we are interfacing LED with any


ENTREPRENEURSHIP

microcontroller, connect anode to microcontroller


pin and cathode to resistor then connect other pin
of resistor to ground.

www.task.telangana.gov.in
Interfacing of LED with 8051 micro-controller
EDUCATION

Applications of Light Emitting Diode :


EMPLOYABILITY

LEDs find applications in various fields, including optical communication, alarm and


security systems, remote-controlled operations, robotics, etc.

• LED is used as a bulb in the homes and industries


ENTREPRENEURSHIP

• The light-emitting diodes are used in motorcycles and cars

• These are used in mobile phones to display the message

• At the traffic light signals led’s are used

www.task.telangana.gov.in
Interfacing of LED with 8051 micro-controller
EDUCATION

Programs :
EMPLOYABILITY

1. LED Blink

2. Last 4 LED ON and OFF, first 4 LED ON and OFF

3. Alternate LED on and off


ENTREPRENEURSHIP

4. Only 1st LED on and off

www.task.telangana.gov.in
EDUCATION

Basic program for LED using delay routine :


#include<reg51.h> void main()
// for 11.0592MHz Crystal {
void delay(unsigned int count) P2 = 0x00;
EMPLOYABILITY

{ while(1)
unsigned int i; {
while(count) P2 = 0xFF;
{ delay(1000);
i = 115; P2 = 0x00;
while(i > 0) delay(1000);
ENTREPRENEURSHIP

i--; }
count--; }
}
}

www.task.telangana.gov.in
EDUCATION

• Basic program for 1 LED :


Basic program for 4 LED using delay
routine :
sbit led1 = P2^0;
void main()
void main() {
EMPLOYABILITY

P2 = 0x00;
{ while(1)
P2 = 0x00; {
while(1) P2 = 0xF0;
delay(1000);
{
P2 = 0x0F;
ENTREPRENEURSHIP

led1 = 0; delay(1000);
delay(500); }
led1 = 1; }
delay(500);
}
}

www.task.telangana.gov.in
EDUCATION

• Basic program for LED loop(alt on off) :


void main()
{
EMPLOYABILITY

P2 = 0x00;
while(1)
{
P2 = 0xAA;
delay(1000);
ENTREPRENEURSHIP

P2 = 0x55;
delay(1000);

}
}

www.task.telangana.gov.in
Interfacing of LED with 8051 micro-controller
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of switch with 8051 micro-controller
EDUCATION

• Basics of Switch :

• Switch is basically any kind of button.


EMPLOYABILITY

• It has only 2 conditions


• Open

• Close
ENTREPRENEURSHIP

• It is the process of connecting 2 pins together with a


button that is giving user the control to give the input or
not.

www.task.telangana.gov.in
Interfacing of switch with 8051 micro-controller
EDUCATION

• Basics of Switch :

• One point of Switch is connected to microcontroller and other point of


EMPLOYABILITY

switch is connected to ground or Vcc


ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of switch with 8051 micro-controller
EDUCATION

Application of Switch :
EMPLOYABILITY

• Switch is a electronic device that is used to make or break an electrical circuit.

• The primary application of switch is to ON-OFF any circuit.

• The different types of switches which are widely used across industries such as
ENTREPRENEURSHIP

Telecommunication, Industry control equipment, Commercial equipment, and


Home appliances.

www.task.telangana.gov.in
Interfacing of switch with 8051 micro-controller
EDUCATION

Push Button :
EMPLOYABILITY

• Push buttons can be widely seen in calculators, telephones, vending


machines, keypads, kitchen appliances and electronic kits. It is used most
commonly in industrial control panels.
ENTREPRENEURSHIP

• The circuit is powered up with battery. When the push button is pressed,
a current will flow through the LED and LED will glow.

www.task.telangana.gov.in
EDUCATION

Push Button :
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of switch with 8051 micro-controller
EDUCATION

Programs :
EMPLOYABILITY

1. 1 switch and 1 LED

2. 2 switch and 1 LED (sw1 pressed led on, sw2 pressed led off)

3. 2 switch and 1 LED (sw1 sw2 pressed led on)


ENTREPRENEURSHIP

4. 2 switch and 2 LED (sw1 pressed both led on, sw2 pressed both led off)

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of relay
EDUCATION

• Basics of Relay :
EMPLOYABILITY

1. It is an electromechanical device that can be used to switch on/off power


circuits (under control of microcontroller) .

2. We need Relay to switch on and off power appliances.


ENTREPRENEURSHIP

3. Because the logic output is only 5v from a microcontroller. So this 5v can


only turn on or off a small circuits. To turn on or off something that takes
large amount of current we need relay.

www.task.telangana.gov.in
EDUCATION

• Basics of Relay :

1. The electrical part in relay is coil.


EMPLOYABILITY

2. When the coil is energized it becomes


magnet and the magnet is used to
attract the contact(C & NO will
connect).
ENTREPRENEURSHIP

• C is Common or Vo
3. When the coil is not energized NC & C
• NC is Normally Closed
will connect.
• NO is Normally Open

www.task.telangana.gov.in
Interfacing of relay
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
1. By default NC is connected to Vo ( not
EDUCATION

energised /no supply).

2. When supply is given (Vs) to the coil


EMPLOYABILITY

terminals, the electromagnet gets charged


and because of the electric charge in the
coil it gets magnetized.
ENTREPRENEURSHIP

3. Because of this magnetism, the common


• Vs is Relay Switching Voltage (5/9/12/18/24)
point residing on NC gets shifts to NO. • Vg is ground Relay Switching Voltage
• Vo Common terminal

www.task.telangana.gov.in
Interfacing of relay
EDUCATION
EMPLOYABILITY

• So the connection between


common and NO can switch on
and off any kind of device .
• In this circuit connect AC load
ENTREPRENEURSHIP

(LAMP) and AC Supply

www.task.telangana.gov.in
Interfacing of relay
EDUCATION

• Microcontroller gives only 5V on its output pin.


• But relay requires 12V to turn on.
EMPLOYABILITY

• So at the output of Microcontroller we need to connect a transistor to turn on the relay.


Then relay turn on the device.
• When we logic 1 onto the port(P2.0) , it will turn on the transistor. Transistor will turn
ENTREPRENEURSHIP

on relay coil and it gets magnetized and then common(C) connects to Normally
Opened( NO ).
• Resistor(330 to 1K ohm) in series with transistor used to have safe on and off of
transistor.

www.task.telangana.gov.in
Interfacing of relay
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
ULN2803
EDUCATION
EMPLOYABILITY

Power = +12V

Microcontroller port 2 relays


ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of DC motor using L293D with
EDUCATION

8051 micro-controller

• DC motor :
EMPLOYABILITY

1. It is a electrical machines that convert direct current electrical power into


mechanical power.

2. The function of DC motor is to accept DC voltage on its pins and provide


ENTREPRENEURSHIP

movement or motion.

www.task.telangana.gov.in
EDUCATION

• DC motor connection :
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION

• Components for a DC motor circuit (Proteus):


EMPLOYABILITY

1. Battery DC voltage Source(12v)

2. MOTOR (Active simple DC motor model)

3. SW-SPST
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION

• Simple DC motor circuit:


EMPLOYABILITY
ENTREPRENEURSHIP

DC Motor Clockwise Rotation DC Motor Anti Clockwise Rotation

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

• H Bridge :

www.task.telangana.gov.in
EDUCATION

Basics of L293D :

• It is capable of driving two DC motors at the same time


EMPLOYABILITY

(clockwise or anticlockwise).

• It takes a very low voltage signal from microcontroller.


ENTREPRENEURSHIP

• It is based on H bridge driver circuits.

• It needs no external components.

www.task.telangana.gov.in
Interfacing diagram of DC Motor
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing of LCD with 8051
micro-controller
EDUCATION

• Basics of LCD :
EMPLOYABILITY

1. LCD( Liquid Crystal Display ) screen is an electronic display module and is


used in wide range of applications.

2. A 16X2 LCD (text LCD) display is popular.


ENTREPRENEURSHIP

3. A 16X2 LCD means it can display 16 characters per line and there are 2 such
lines. So for 16X2 LCD, it can display 32 characters at a time.

4. In this LCD each character is displayed in 5X7 pixel matrix.

www.task.telangana.gov.in
EDUCATION

5. This LCD has 2 registers, namely


• Command
EMPLOYABILITY

• Data

6. The command register stores the command instructions given to the LCD.
ENTREPRENEURSHIP

7. The data register stores the data to be displayed on the LCD.

8. 16X2 LCD is the most widely used LCD and it is very popular because of its
simplicity.

www.task.telangana.gov.in
EDUCATION

Applications of LCD :
• Mobile Phones
EMPLOYABILITY

• Billing machines

• Calculators

• TV set
ENTREPRENEURSHIP

• Ticket Machine

www.task.telangana.gov.in
Interfacing of LCD with 8051 micro-controller
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Functions for 8051 Interfacing
EDUCATION

sbit rs = P1^0; sbit rs = P1^0;


EMPLOYABILITY

sbit en = P1^1; sbit en = P1^1;


void lcd_cmd(unsigned char data) void lcd_data(unsigned char data)
{ {
rs = 0; rs = 1;
P2 = data; P2 = data;
ENTREPRENEURSHIP

en = 1; en = 1;
delay(500); delay(500);
en = 0; en = 0;
} }

www.task.telangana.gov.in
Interfacing diagram of LCD
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION

Commands of LCD :
• 38 : use 2 lines & 5*7 matrix
EMPLOYABILITY

• 01 : clear display

• 02 : return home

• 04 : Decrement Cursor ( data will be printed left side )


ENTREPRENEURSHIP

• 06 : Increment Cursor ( data will be printed right side )

• 0E : Display the cursor

• 80 (80-87) : Force cursor to the beginning of 1st line

• C0 (C0-C7) : Force cursor to the beginning of 2nd line

www.task.telangana.gov.in
Interfacing of Stepper motor using with
EDUCATION

8051 micro-controller
• Stepper motor :
EMPLOYABILITY

• A stepper motor is an electromechanical device it converts electrical power into


mechanical power. Stepper motor is a kind of brushless motor in which there are
primarily 4 coils arranged.
ENTREPRENEURSHIP

• The magnetism of these 4 coils are varied in such a way that the shaft rotate either
in clockwise or anticlockwise direction.

www.task.telangana.gov.in
EDUCATION

• Stepper motors can be used in various areas of your microcontroller projects such as making
robots, robotic arm, automatic door lock system, medical scanners,blood analysis machinery,
cameras for automatic digital camera focus and zoom functions etc.
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION

• Types of Stepper motor :

There are basic two types of stepper motors available


EMPLOYABILITY

1. Unipolar stepper motor :

• The unipolar stepper motor has five or six wires and four coils (actually two coils
ENTREPRENEURSHIP

divided by center connections on each coil).

• The center connections of the coils are tied together and used as the power
connection. They are called unipolar steppers because power always comes in on
this one pole.

www.task.telangana.gov.in
Unipolar stepper motor
EDUCATION

• "Unipolar stepper motors" which is most common type of stepper motor available
in the market.
EMPLOYABILITY

• A simple example of 6 lead step motor(A,B,C,D and 2 common points) is given


below and the common points are joined together to make 1 wire as common and it
is connected to power supply.
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION

2. Bipolar stepper motor :

• The bipolar stepper motor usually has four wires coming out of it. Unlike unipolar
EMPLOYABILITY

steppers, bipolar steppers have no common center connection. They have two
independent sets of coils instead.

• Working of Stepper Motor :


ENTREPRENEURSHIP

1. When we energize a coil of stepper motor, The shaft of stepper motor (which is
actually a permanent magnet) align itself according to poles of energized coil.

2. So when motor coils are energized in a particular sequence, motor shaft tend to
align itself according to pole of coils and hence rotates.
www.task.telangana.gov.in
EDUCATION

• Step Sequence :

Stepper motors can be driven in two different patterns or sequences. namely,


EMPLOYABILITY

1. Full Step Sequence

2. Half Step Sequence

• Full Step Sequence :


ENTREPRENEURSHIP

• There are two types of full step excitation modes.

• In one-phase - full step, Fig1, the motor is operated with only one phase energized at a
time. This mode requires the least amount of power from the driver of any of the
excitation modes.
www.task.telangana.gov.in
EDUCATION

• In two-phase - full step, Fig2, the motor is operated with both phases energized at
the same time. This mode provides improved torque and speed performance.
EMPLOYABILITY
ENTREPRENEURSHIP

Fig 1 : one phase – full step Fig 2 : two phase – full step

www.task.telangana.gov.in
Full Step Sequence Table
EDUCATION

Step A B C D
EMPLOYABILITY

0(0x0C) 1 1 0 0

1(0x06) 0 1 1 0

2(0x03) 0 0 1 1
ENTREPRENEURSHIP

3(0x09) 1 0 0 1

www.task.telangana.gov.in
EDUCATION

• Half step sequence :

• Half step excitation mode is a combination of one phase on and two phase on
EMPLOYABILITY

full step modes. This results in half the basic step angle. This smaller step angle
provides smoother operation due the increased resolution of the angle.
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing diagram of Stepper Motor
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing diagram of 7 segment display
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Timer
EDUCATION

Timer :
EMPLOYABILITY

1. It is used as a time delay generator.

2. Timing is done on the internal crystal frequency.

3. The concept of timer is nothing but it counts time.


ENTREPRENEURSHIP

4. But the microcontroller does not have any clock to see the time, so it basically
counts the pulses given to the timer module.

www.task.telangana.gov.in
Timer
EDUCATION

Registers used in Timer :


EMPLOYABILITY

• TH0, TL0 : for timer 0

• TH1, TL1 : for timer 1

• TMOD(Time Mode Register) : for mode Selection


ENTREPRENEURSHIP

• TCON (Timer Count Register) : for controlling

www.task.telangana.gov.in
Interfacing diagram of Timer
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
Interfacing diagram of Timer : output
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

www.task.telangana.gov.in
EDUCATION
EMPLOYABILITY
ENTREPRENEURSHIP

Thank you

www.task.telangana.gov.in

You might also like