You are on page 1of 41

Founded in 1999 Specializing in Embedded System ,Test & Measuring service utility operations and maintenance support services.

. Provides R&D solutions in the area of Embedded Systems, VLSI, DSP and Embedded Wireless.

Special-purpose computer system designed to perform a dedicated function. Performs one or a few pre-defined tasks, usually with very specific requirements, and often includes task-specific hardware and mechanical parts not usually found in a general-purpose computer.

General-purpose microprocessor
CPU for Computers No RAM, ROM, I/O on CPU chip itself ExampleIntels x86, Motorolas 680x0

CPU GeneralPurpose Microprocessor

Data Bus

Many chips on mothers board

RAM

ROM

I/O Port

Timer

Serial COM Port

Address Bus General-Purpose Microprocessor System

Microcontroller :
A smaller computer On-chip RAM, ROM, I/O ports... ExampleMotorolas 6811, Intels 8051, Zilogs Z8 and PIC 16X

CPU

RAM

ROM

A single chip
Serial I/O Timer COM Port Port Microcontroller

Three criteria in Choosing a Microcontroller


1. meeting the computing needs of the task efficiently and cost effectively speed, the amount of ROM and RAM, the number of I/O ports and timers, size, packaging, power consumption easy to upgrade cost per unit 2. availability of software development tools assemblers, debuggers, C compilers, emulator, simulator, technical support 3. wide availability and reliable sources of the microcontrollers.

Microprocessor vs. Microcontroller


Microprocessor CPU is stand-alone, RAM, ROM, I/O, timer are separate designer can decide on the amount of ROM, RAM and I/O ports. expansive versatility general-purpose Microcontroller CPU, RAM, ROM, I/O and timer are all on a single chip fix amount of on-chip ROM, RAM, I/O ports for applications in which cost, power and space are critical single-purpose

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

Comparison of the 8051 Family Members

Feature 8051 ROM (program space in bytes) 4K RAM (bytes) 128 Timers 2 I/O pins 32 Serial port 1 Interrupt sources 6

8052 8K 256 3 32 1 8

8031 0K 128 2 32 1 6

Pin Description of the 8051


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 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 (8031)

Vccpin 40 Vcc provides supply voltage to the chip. The voltage source is +5V. GNDpin 20ground XTAL1 and XTAL2pins 19,18 These 2 pins provide external clock. Way 1using a quartz crystal oscillator Way 2using a TTL oscillator Example 4-1 shows the relationship between XTAL and the machine cycle.

RSTpin 9reset It is an input pin and is active highnormally low. The high pulse must be high at least 2 machine cycles. It is a power-on reset. Upon applying a high pulse to RST, the microcontroller will reset and all values in registers will be lost. Reset values of some 8051 registers Way 1Power-on reset circuit Way 2Power-on reset with debounce

/EApin 31external access There is no on-chip ROM in 8031 and 8032 . The /EA pin is connected to GND to indicate the code is stored externally. /PSEN ALE are used for external ROM. For 8051, /EA pin is connected to Vcc. / means active low. /PSENpin 29program store enable This is an output pin and is connected to the OE pin of the ROM. See Chapter 14.

ALEpin 30address latch enable It is an output pin and is active high. 8051 port 0 provides both address and data. The ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 latch. I/O port pins The four ports P0, P1, P2, and P3. Each port uses 8 pins. All I/O pins are bi-directional.

The 8051 has four I/O ports Port 0 pins 32-39P0P0.0P0.7 Port 1pins 1-8 P1P1.0P1.7 Port 2pins 21-28P2P2.0P2.7 Port 3pins 10-17P3P3.0P3.7 Each port has 8 pins. Named P0.X X=0,1,...,7, P1.X, P2.X, P3.X ExP0.0 is the bit 0LSBof P0 ExP0.7 is the bit 7MSBof P0 These 8 bits form a byte. Each port can be used as input or output (bi-direction).

Inside Structure of 8051 Microcontroller

Embedded C
Compilers produce hex files that is downloaded to ROM of microcontroller

The reasons for writing programs in C


It is easier and less time consuming to write in C than Assembly.

C is easier to modify and update.


You can use code available in function Libraries. C code is portable to other microcontroller with little of no modification

Light Emitting Diodes (LEDs)


Function
A light-emitting diode (LED) is a semiconductor light source. Circuit symbol: LEDs are used as indicator lamps in many devices, and are increasingly used for lighting. .

Testing an LED
Never connect an LED directly to a battery or power supply! It will be destroyed almost instantly because too much current will pass through and burn it out. LEDs must have a resistor in series to limit the current to a safe value, for quick testing purposes a 1k resistor is suitable for most LEDs.

7-segment Display
There are two important types of 7-segment LED digital display.

The Common Cathode Display (CCD) All cathodes are common and ground is being provided. The Common Anode Display (CAD) All anodes are common and Vcc is being provided.

Liquid Crystal Display


Liquid Crystal Displays HD44780(LCDs) cheap and easy way to display text, Displays numbers, letters and fixed symbols Various configurations (1 Line, 2 Line or 4 Line LCDs ). Integrated controller The display has two register
command register data register

By RS you can select register Data lines (DB7-DB0) used to transfer data and commands

Inside LCD
RAM In LCD we have two types of RAM

DDRAM - Display Data RAM Display data RAM (DDRAM) stores display data represented in 8-bit character codes. CGRAM - Character Generator RAM
CGRAM area is used to create custom characters in LCD. In the character generator RAM, the user can rewrite character patterns by program.

Pin Information of LCD:

UART in 8051
One of the 8051s many powerful features is its integrated UART, An UART, universal asynchronous receiver / transmitter is responsible for performing the main task in serial communications with computers.

The device changes incoming parallel information to serial data which can be sent on a communication line. A second UART can be used to receive the information.
To communicate with pc or other devices we need some standards like RS232. A driver(MAX232) is used to convert TTL level to RS232 voltage level.

Max circuitry
Value of capacitors is 10uF Controller section

RS232 section

Baud Rates in the 8051


The 8051 transfers and receives data serially at many different baud rates by using UART. UART divides the machine cycle frequency by 32 and sends it to Timer 1 to set the baud rate. Signal change for each roll over of timer 1
11.0592 MHz

XTAL oscillator

12

Machine cycle frequency 921.6 kHz

32

28800 Hz

By UART To timer 1
To set the Baud rate

Timer 1

Timers
Timers are used
1. To generate time delay. 2. To generate baud rate. 3. To count an event(timer as a counter).

In 8051 we have two Timers.

1.Timer 0 2. Timer 1

Analog to Digital Converter


An analog-to-digital converter is a device which converts continuous signals to discrete digital numbers. The reverse operation is performed by a digital-to-analog converter (DAC). Typically, an ADC is an electronic device that converts an input analog voltage (or current) to a digital number proportional to the magnitude of the voltage or current.

Relays
The term Relay generally refers to a device that provides an electrical connection between two or more points in response to the application of a control signal.

An Electromechanical device Relay operates on +5v switches to +12v or 220 v state Wide variety applications such as in telephone exchanges, digital computers and automation systems

Buzzer Interfacing
A buzzer is an audio signaling device, which may be mechanical, electromechanical or electronic. Typical uses of buzzers include alarms, timers and confirmation of user input such as a mouse click or keystroke.

While interfacing it uses single bit of controller.


BC547 transistor is used to provide switching of buzzer.

Multi-Storey Car Parking is a method of parking and retrieving cars that typically use a system of pallets and lifts. The intention is to compact more cars in the same space, reduce the space needed to park the same number of cars.

1. 2. 3. 4. 5. 6. 7. 8.

Microcontroller 8051 PCB LCD LEDS IR pair Resistors 7404 IC Power jack

9. Capacitors 10. 10k potentiomete 11. MAX232 12. Adapter 5v 13. Switch 14. 7805 regulator 15. Transistors

Main sections
Indicator section
Sensor section
LED Glows Transmitter & receiver Displays

IR Pair

Display section

LCD

A sensor section consists of an IR pairs. A sensor is a device that measures physical quantity and converts it into a signal which can be read by an observer or by an instrument.

An IR pair is provided which will sense whether the car has reached towards the gate or not. There will be 2 IR pairs provided before the main gate at the ground floor. As soon as the car reaches between the 2 IR pairs. It will be sensed by the sensors and the display on the LCD automatically changes and it will show the particular floor on which the car can be parked.

Programming is done using embedded c. KeilC51 compiler is used for this language. A header file is to be added for the controller we are using otherwise we will not be able to access registers related to peripherals. When the program is built, it is then burn into the controller using RS232 cable.

Display is provided at the ground floor that displays where to park the car. Each floor is provided with green and red LEDS. Green for vacancy and Red for no space. Sensors sense the entry of each car and indicate a message on LCD about where to park car. If there is no space a message is displayed NO SPACE.

Erection of multistoried car parking with surface car parking It seeks permission for a larger multistoried car park and an amended parking layout to that approved. Eastside multistoried car park Greenside multistoried car park Minories multistoried car park Woodhouse multistoried car park Manors multistoried car park Westgate multistoried car park Multistoried car park Poole

Provides lower parking cost per building area Solves the problem of less space Reduces human effort in finding out the required space Fast

Deterioration and Maintenance Parking angle considerations Lightning Safety

AUTOMOBILES: Fuel Injection control (for fuel efficiency), Air bags and Automatic braking (for safety), and car entertainment systems. MEDICAL ELECTRONICS: Many sophisticated medical instruments (Body Scanners, Heart rate monitors, Pacemaker etc) Industrial Control: such as CNC machines are example embedded systems. BUSINESS APPLICATIONS: Vending machines, scanners, printers. CONSUMER ELECTRONICS: Cameras, Toys, Cellular Phones, Washing Machines AVIONICS: Airplanes, Satellite Stations Defense: RADARs, SONARs (for surveillance), Guided Missile Systems

You might also like