36
VINEET CHACHRA UNIVERSITY INSTITUTE OF ENGINEERING AND TECHNOLOGY MAHARSHI DAYANAND UNIVERSITY , ROHTAK

Embedded Systems Using 8051 Microcontroller

Embed Size (px)

Citation preview

Page 1: Embedded Systems Using 8051 Microcontroller

VINEET CHACHRAUNIVERSITY INSTITUTE OF ENGINEERING AND TECHNOLOGYMAHARSHI DAYANAND UNIVERSITY , ROHTAK

Page 2: Embedded Systems Using 8051 Microcontroller

A microcontroller can be called as a computer on chip.

It consists of on-chip RAM,ROM, I/O ports… Examples: Intel’s 8051,Motorola’s 6811,

Zilog’s Z8, Atmel’s AT89C51

RAM ROM

I/O Port

Timer

Serial COM Port Microcontroller

CPU A single chip

Page 3: Embedded Systems Using 8051 Microcontroller

A general purpose digital computer CPU.

No RAM,ROM,I/O on CPU chip itself. Examples: Intel’s x86,Motorola’s 680x0.

CPU

General-Purpose Micro-processor

RAM ROM I/O Port

TimerSerial COM Port

Data Bus

Address Bus

General-Purpose Microprocessor System

Many chips on mother board

Page 4: Embedded Systems Using 8051 Microcontroller

Microprocessor CPU is stand alone.

RAM,ROM,I/O are separate.

Designer can decide on amount of RAM, ROM.

General purpose and versatile.

Unique pins.

Microcontroller CPU,RAM, ROM,I/O

on single chip. Fixed amount of

RAM,ROM. Specific purpose

generally having fixed programs

Programmable pins.

Microprocessor Microcontroller

Page 5: Embedded Systems Using 8051 Microcontroller

An embedded system is a special-purpose computer system designed to perform one or few designated functions, often with real time computing constraints. It is usually embedded as a part of complete device including hardware and mechanical parts. Since an embedded system is dedicated to specific tasks, they are optimized and hence mass produced. Processing function is done by a microcontroller or microprocessor.

Page 6: Embedded Systems Using 8051 Microcontroller

Embedded systems span all aspects of modern life and there are many examples of their use.

Telecommunication systems including modems and routers.

Consumer electronics like dvd’s,washing machines

Transportation systems like ABS, EBD,GPS systems

Medical equipments like MRI,PET etc.

Page 7: Embedded Systems Using 8051 Microcontroller

Since they can be optimized, it leads to reduced costs thus making mass production possible.

They can be designed to perform in diverse environment conditions.

They have very high reliability. They can be implemented using wide

variety of processors.

Page 8: Embedded Systems Using 8051 Microcontroller

The 8051 microcontroller was developed in the year 1981 by Intel Corporation.

Intel’s official designation for 8051 family is MCS-51.

Initially built using NMOS technology but later CMOS technology used owing to low power consumption.

It is a Harvard architecture i.e it has physically separate storage and signal pathways for instructions and data.

Page 9: Embedded Systems Using 8051 Microcontroller

8-bit data bus and 16-bit address bus. 128 bytes on-chip RAM. 4 k bytes on-chip ROM. Four byte bi-directional input/output ports. 4 parallel and one serial port. Two 16 bit counter/timers ,4 flags and on chip clock

oscillator. Two-level interrupt priority with 6 interrupt sources.. 16 bytes of addressable and 80 bytes of general

purpose memory.

Page 10: Embedded Systems Using 8051 Microcontroller

CPU

On-chip RAM

On-chip ROM for program code

4 I/O Ports

Timer 0

Serial PortOSC

Interrupt Control

External interrupts

Timer 1

Timer/Counter

Bus Control

TxD RxDP0 P1 P2 P3

Address/Data

Counter Inputs

Page 11: Embedded Systems Using 8051 Microcontroller

1234567891011121314151617181920

4039383736353433323130292827262524232221

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RST

(RXD)P3.0(TXD)P3.1

(T0)P3.4(T1)P3.5

XTAL2XTAL1

GND

(INT0)P3.2(INT1)P3.3

(RD)P3.7(WR)P3.6

VccP0.0(AD0)P0.1(AD1)P0.2(AD2)P0.3(AD3)P0.4(AD4)P0.5(AD5)P0.6(AD6)P0.7(AD7)EA/VPPALE/PROGPSENP2.7(A15)P2.6(A14)P2.5(A13)P2.4(A12)P2.3(A11)P2.2(A10)P2.1(A9)P2.0(A8)

8051

Page 12: Embedded Systems Using 8051 Microcontroller

A quartz crystal oscillator connected at pins XTAL1 and XTAL2.

The circuit shown below generates a pulse train at the frequency of crystal.

Time of an instruction:Tinst = C x 12d crystal frequencyWhere c= no. of cycles

Page 13: Embedded Systems Using 8051 Microcontroller
Page 14: Embedded Systems Using 8051 Microcontroller

LED’s are generally connected at port 0 of 8051 i.e. p0.0-p0.8.

From 0-0.5volts logic 0 i.e. LED glows. From 3-5volts logic 1 i.e. LED is off.

Page 15: Embedded Systems Using 8051 Microcontroller

It has a common anode or a common cathode thus making it a 9 pin structure as shown in diagram.

Common anode generally used i.e. all LED’s glow on 0 logic.

Page 16: Embedded Systems Using 8051 Microcontroller

A relay is an electromechanical switch. Depending upon contact types it can be:

one C/O(change over),2 C/O,3C/O or 4 C/O.

Connected on port 2 of 8051.

Page 17: Embedded Systems Using 8051 Microcontroller

Motor could be dc series, dc shunt, pmdc or stepper motor.

Ports p2.2 and p2.3 as alternate high and low for PMDC and p2.4 to p2.7 for stepper motor.

Page 18: Embedded Systems Using 8051 Microcontroller

The 8051 has two timers, TIMER0 and TIMER1 registers. Both can be used as either timer for internal pulse counting and as counter for external pulse counting.

SFR TCON used to control the timer operation and TMOD used to select the timer mode i.e. (a). Mode 0 – 13-bit timer mode. 8192 pulses

(b). Mode 1 – 16-bit timer mode. 65536 pulses (c). Mode 2 - 8-bit timer mode. 256 pulses (d). Mode 3 – 8-bit split timer mode.

Page 19: Embedded Systems Using 8051 Microcontroller

TCON Special function register

TMOD Special function register

Timer/Counter Control Logic

Page 20: Embedded Systems Using 8051 Microcontroller

An opto-coupler is used to provide a short optical transmission path to transfer a signal b/w elements of a circuit while transmitter and receiver are electrically isolated.

It consists of a LED and a transistor. Port pins P1.7 and p3.2 are used.

Page 21: Embedded Systems Using 8051 Microcontroller

A buzzer is made of piezo-electric crystals. It produces oscillation when electric field is applied to its terminals. Since the oscillation are in audible range i.e. 20Hz to 20KHz, a alarm sound gets generated.

It is connected with pin p1.6 of microcontroller. When it is set i.e. value is one a sound is generated.

Page 22: Embedded Systems Using 8051 Microcontroller

A liquid crystal display (LCD) is an electronically modulated optical amplification shaped into a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source (backlight) or reflector.

LCD can be classified as:a. Graphics LCDb. Character LCDc. LCD with controllerd. LCD without controller

Page 23: Embedded Systems Using 8051 Microcontroller

The LCD memory has two 8-bit registers: Instruction Register and Data Register. The IR stores instruction codes and address information for DRAM and CGRAM. While the DR temporarily stores data to be written into DDRAM or CGRAM.

Page 24: Embedded Systems Using 8051 Microcontroller

The pins of LCD are :o Data pins D0-D7.o Register select pin RS. When RS=0 command register selected. When RS =1 data register is selected.oRead or write pin R/W. When R/W=0 write and when R/W =1 read function created.o Enable pin E. A high to low edge needed to latch the data.oContrast control pin VEE. Used to control contrast voltage.

Page 25: Embedded Systems Using 8051 Microcontroller

LCD’s internal controller accepts several commands to modify the display accordingly. e.g. 38h – 8-bit interface, 5*7 pixels. 01h – clear screen. 1Eh - scroll display one character right.

Page 26: Embedded Systems Using 8051 Microcontroller

ADC converts an analog data to binary coded data which can be directly fed to digital processors. So the output is some form of digital number.

ADC can be broadly divided into two types:i. SERIAL ADCii. PARALLEL ADC.

• 1–Input line ADC• 2-Input line ADC• 4-Input line ADC• 8-Input line ADC (0809)

Page 27: Embedded Systems Using 8051 Microcontroller

Features:1.Easy interface with 8-bit analog channel.2.Uses successive approximation(SAR) as conversion technique.3.TTL voltage level specifications with 28-pin dip package.4.Thus can produce numbers 0 through 255.

Page 28: Embedded Systems Using 8051 Microcontroller

PROJECT ASSIGNED:

Page 29: Embedded Systems Using 8051 Microcontroller

The Project RF Remote Control can be used to remotely control a number of Electrical or Electronic Gadgets connected to it.

As the name suggests the project employs Radio Frequency waves for wireless transmission and reception.

Frequency modulation at frequency of 433.92 MHz is used.

Page 30: Embedded Systems Using 8051 Microcontroller

THE PROJECT CONSISTS OF TWO PARTS i.e. TRANSMITTER AND RECEIVER.

(A). TRANSMITTER :

The transmitter design is based on ATMEL AT89C2051 Microcontroller. The AT89C2051 (20pin DIP IC) makes the remote controller design as simple & compact. The remote controller is powered by 9V Battery. The remote control has a small keypad, which is used to control the equipments.The block diagram is shown next.

Page 31: Embedded Systems Using 8051 Microcontroller

Key Pad

MicrocontrollerAT89C2051

DTMFEncoder

RF SignalTransmitter

Block Diagram of Transmitter

WORKING:

The key pressed by the user is read by the microcontroller. The key value is send to the DTMF (Dual Tone Multi-Frequency) encoder. The encoder generates voice tone for that particular key value. The Tone is modulated (FM) with Carrier Frequency (433MHZ) and transmitted using RF module.

Page 32: Embedded Systems Using 8051 Microcontroller
Page 33: Embedded Systems Using 8051 Microcontroller

(B)RECIEVER:

The receiver design is based on ATMEL AT89C51 microcontroller. The Microcontroller is used as the master in the receiver end which is used to control all the devices. It decodes the Signal from the transmitter and control the relays according to the signal. It is designed in such way to control different equipment /appliance using relays. Also this receiver can produce a variable Power source, which can be used to vary the speed of any motor/fan . The block diagram of the receiver is shown next.

Page 34: Embedded Systems Using 8051 Microcontroller

MicrocontrollerRF SignalReceiver

DTMFDecoder

AT89C51

Zero CrossingDetector

MainsStep-downvoltage

PhaseReference

Relays

TRIAC

Mains230V AC

Trigger

LOAD

Block Diagram of Control Panel

Page 35: Embedded Systems Using 8051 Microcontroller

WORKING:

The RF signal transmitted by remote control is received by RF receiver module. The output of the RF Receiver will be DTMF signal. This DTMF signal is decoded and the binary value is generated using the decoder. The AT89C51 microcontroller gets the signal from the DTMF decoder and based on the information the microcontroller changes the output status of the relays. The controller does not drive the relays. So the relay driver circuitry is implemented in between the microcontroller and relays. The microcontroller can also vary the power applied to the motor / Fan by varying the firing angle of a TRIAC. The information about varying the motor power is read from the remote controller.

Page 36: Embedded Systems Using 8051 Microcontroller