You are on page 1of 36

EMBEDDED SYSTEMS USING 8051 MICROCONTROLLER

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

WHAT IS A MICROCONTROLLER?

A microcontroller can be called as a computer on chip. It consists of on-chip RAM,ROM, I/O ports Examples: Intels 8051,Motorolas 6811, Zilogs Z8, Atmels AT89C51
CPU RAM ROM

Serial I/O Timer COM Port Port

A single chip
Microcontroller

WHAT IS A MICROPROCESSOR?
A general purpose digital computer CPU. No RAM,ROM,I/O on CPU chip itself. Examples: Intels x86,Motorolas 680x0.

CPU GeneralPurpose Microprocessor

Data Bus

Many chips on mother board

RAM

ROM

I/O Port

Timer

Serial COM Port

Address Bus General-Purpose Microprocessor System

MICROPROCESSOR VS. MICROCONTROLLER

Microprocessor 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 Microcontroller CPU,RAM, ROM,I/O on single chip. Fixed amount of RAM,ROM. Specific purpose generally having fixed programs Programmable pins.

EMBEDDED SYSTEMS
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.

EXAMPLES AND USES OF EMBEDDED SYSTEMS


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 dvds,washing machines Transportation systems like ABS, EBD,GPS systems Medical equipments like MRI,PET etc.

ADVANTAGES OF EMBEDDED SYSTEMS


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.

THE 8051 MICROCONTROLLER


The 8051 microcontroller was developed in the year 1981 by Intel Corporation. Intels 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.

SALIENT FEATURES OF 8051

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.

BLOCK DIAGRAM
External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter

On-chip RAM

Timer 1 Timer 0

Counter Inputs

CPU
Serial Port

OSC

Bus Control

4 I/O Ports

P0 P1 P2 P3

TxD RxD

Address/Data

PIN DIAGRAM

P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

8051

40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21

Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8)

8051 CLOCK
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 frequency Where c= no. of cycles

8051 PROGRAMMING MODEL

INTERFACING OF LED
LEDs 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.

INTERFACING 7-SEGMENT DISPLAY


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 LEDs glow on 0 logic.

INTERFACING OF RELAY
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.

INTERFACING OF DC MOTORS
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.

INTERFACING OF TIMER/COUNTER
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.

TCON Special function register

TMOD Special function register

Timer/Counter Control Logic

INTERFACING OF OPTO-COUPLER
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.

INTERFACING OF PIEZO-BUZZER
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.

INTERFACING OF LCD
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 LCD b. Character LCD c. LCD with controller

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.

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.

LCDs 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.

INTERFACING ANALOG TO DIGITAL CONVERTER


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 ADC ii. PARALLEL ADC. 1Input line ADC 2-Input line ADC 4-Input line ADC

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.

PROJECT ASSIGNED:

RF REMOTE CONTROL FOR CONTROLLING ELECTRICAL GADGETS

INTRODUCTION TO THE PROJECT


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.

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.

Microcontroller AT89C2051

DTMF Encoder

RF Signal Transmitter

Key Pad
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.

TRANSMITTER CIRCUIT DIAGRAM

(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.

RF Signal Receiver

DTMF Decoder

Microcontroller AT89C51

Relays

LOAD

Trigger Mains Step-dow n voltage Zero Crossing Detector Phase Ref erence TRIAC Mains 230V A C

Block Diagram of Control Panel

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.

RECEIVER CIRCUIT DIAGRAM

You might also like