You are on page 1of 37

INTRODUCTION

This training report is all about the embedded systems and its application in various fields of real world. We are living in the Embedded World. We are surrounded with many embedded products and our daily life largely depends on the proper functioning of these gadgets. Television, Radio, CD player, Washing Machine or Microwave Oven in our kitchen, Card readers, Access Controllers, Palm devices of our work space enable us to do many of our tasks very effectively. Apart from all these, many controllers embedded in our car take care of car operations between the bumpers. All kinds of magazines and journals regularly dish out details about latest technologies, new devices; fast applications which make us believe that our basic survival is controlled by these embedded products. Now we can agree to the fact that these embedded products have successfully invaded into our world. What is this Embedded System? Theoretically, an embedded controller is a combination of piece of microprocessor based hardware and the suitable software to undertake a specific task.

What is the role of microprocessors and microcontrollers in embedded system ?


Microprocessors or microcontrollers are the main heart of any embedded system. They run the hardware according to the program burnt into them.

Components of embedded system


Analog Components:- Sensors (LDR,LM35 etc.) Digital Components:- Processor, Coprocessors, Memories, Controllers, Buses, Application Specific Integrated Circuits Converters A2D, D2A, Software:- Application Programs, Exception Handlers.

Embedded designing
1. Core hardware:- 8051 Microcontroller, PIC Microcontroller, AVR Microcontroller, ARM Microcontroller, FPGA(Field Programmable Gate Array), CPLD(Complex Programmable Logic Device). Phillips 89V51RD2.
1

2. Firmware tools:- 8051- KEIL Compiler & Assembler , PIC - Source Boost , micro c, AVR Code Vision Avr , ARM - KEIL advanced versions. KEIL microVISION3. 3. Programming tools:- 8051 Flash Magic , ECE Flash, PIC - Matrix pppv3 , pickit , AVR Pony Prog . Flash Magic , ECE Flash 4. Hardware tools:- Hardware programmers , Application debuggers. 8051 Application Board.

Hardware Programmers and application debuggers

List of components on this hardware(clockwise from top left):1. LEDs. 2. DIP Sensors. 3. Buzzer. 4. Relays. 5. Microcontroller. 6. LCD. 7. A/D Converter. 8. Push to on switches. 9. EEPROM.
2

10. RTC. 11. Seven segment. 12. Stepper motor interface.

MICROCONTROLLERS
Circumstances that we find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. This development has made it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for production of microprocessors, and the first computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about.

Microcontroller, as the name suggests, are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example, the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. The key features of microcontrollers include: High Integration of Functionality Microcontrollers sometimes are called single-chip computers because they have on-chip memory and I/O circuitry and other circuitries that enable them to function as small standalone computers without other supporting circuitry. Field Programmability, Flexibility Microcontrollers often use EEPROM or EPROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then large quantities of microcontrollers can be programmed to be used in embedded systems. Easy to Use Assembly language is often used in microcontrollers and since they usually follow RISC architecture, the instruction set is small. The development package of microcontrollers often includes an assembler, a simulator, a programmer to "burn" the chip and a demonstration board. Some packages include a high level language compiler such as a Ccompiler and more sophisticated libraries.

Criteria to choose a microcontroller


 Packaging  Power consumption  The amount of RAM and ROM on chip
3

 The number of I/O pins and the timer on Chip  Speed  Cost per unit  Availability of software development tools, such as compilers, assemblers, and debuggers

RAM ARCHITECHTURE :-

Fig :- RAM architecture The 8051 has a bank of 128 bytes of Internal RAM. This Internal RAM is found on-chip on the 8051 so it is the fastest RAM available, and it is also the most flexible in terms of reading, writing, and modifying its contents. Internal RAM is volatile, so when the 8051 is reset this memory is cleared. The 128 bytes of internal ram is subdivided as shown on the memory map. The first 8 bytes (00h - 07h) are "register bank 0". These alternative register banks are located in internal RAM in addresses 08h through 1Fh.Bit memory actually resides in internal RAM, from addresses 20h through 2Fh. The 80 bytes remaining of Internal RAM, from addresses 30h through 7Fh, may be used by user variables that need to be accessed frequently or at high-speed. This area is also utilized by the microcontroller as a storage area for the operating stack.

Registers
The 8051 uses 8 "R" registers which are used in many of its instructions. These "R" registers are numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6, and R7).These registers are generally used to assist in manipulating values and moving data from one memory location to another. The concept of register banks adds a great level of flexibility to the 8051.

Bit Memory
4

The 8051, being a communication oriented microcontroller, gives the user the ability to access a number of bit variables. These variables may be either 1 or 0. There are 128 bit variables available to the user, numbered 00h through 7Fh. The user may make use of these variables with commands such as SETB and CLR. It is important to note that Bit Memory is really a part of Internal RAM. In fact, the 128 bit variables occupy the 16 bytes of Internal RAM from 20h through 2Fh.

Special Function Register (SFR) Memory


Special Function Registers (SFRs) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows a program to read or write to the 8051s serial port .SFR is a part of Internal Memory. This is not the case. When using this method of memory access (its called direct address), any instruction that has an address of 00h through 7Fh refers to an Internal RAM memory address; any instruction with an address of 80h through FFh refers to an SFR control register.

Registers
The Accumulator The Accumulator, as its name suggests, is used as a general register to accumulate theresults of a large number of instructions. It can hold an 8-bit (1-byte) value and is the mostversatile register. The "R" registers The "R" registers are a set of eight registers that are named R0, R1, etc. up to and including R7. These registers are used as auxiliary registers in many operations. The "B" Register The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1-byte) value. The "B" register is only used by two 8051 instructions: MUL AB and DIV AB.

The Data Pointer (DPTR) The Data Pointer (DPTR) is the 8051s only user-accessible 16-bit (2-byte) register. The Accumulator, "R" registers, and "B" register are all 1-byte values. DPTR, as the name suggests, is used to point to data. It is used by a number of commands which allow the 8051 to access external memory. The Program Counter (PC) The Program Counter (PC) is a 2-byte address which tells the 8051 where the next instruction to execute is found in memory. When the 8051 is initialized PC always starts at 0000h and is incremented each time an instruction is executed.

Addressing Modes
5

An "addressing mode" refers to how you are addressing a given memory location. The addressing modes are as follows, With an example of each: Immediate Addressing MOV A, #20h Direct Addressing MOV A, #30h Indirect Addressing MOV A, @R0 External Direct MOVX A, @DPTR Code Indirect MOVC A, @A+DPTR Each of these addressing modes provides important flexibility.

Interrupts
An interrupt is a special feature which allows the 8051 to provide the illusion of "multitasking," although in reality the 8051 is only doing one thing at a time. .

Timers
Timers are one of the categories of hardware time delays. Time delays are used to keep a system into halting System or sleepy mode. We have two timers-timer0, timer1.Hardware time delays are used to generate exact time delays.

Reset Circuit of Microcontroller


Capacitor is storing charge permanently until we use it. Crystal Oscillator is used to generate a carrier signal with stable frequency. With the help of this oscillator we will deduce the execution speed in terms of bytes/ sec. It generates 12 clock pulses /machine cycle. Capacitors provide charge for crystal oscillator. If we are not connecting any external memory to micro controller, EA is connected to Vcc in case of 8051.

Fig :- reset circuit of microcontroller

Embedded C
Compilers produce hex files that is downloaded to ROM of microcontroller.  It is easier and less time consuming to write in C than Assembly.  C is easier to modify and update. C code is portable to other microcontroller with little of no modification.

Microcontrollers versus Microprocessors


Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.

Microprocessors : CPU is stand alone, RAM, ROM, I/O, timer are separate.  Designer can decide on the amount of ROM, RAM and I/O ports.  Expensive.  Versatality.  Multipurpose. Microcontrollers : CPU, RAM, ROM, I/O and timer are all on a single chip.  Fixed amount of on-chip ROM, RAM, I/O ports .  For applications in which cost, power, space are critical.  Specific purpose .  Concerned with the rapid movement of the bits within the chip.  More complex.

HOW TO WORK ON KEIL MICROVISION3 ?

1.Double Click on the icon present on the desktop.

2.The following window will be popped-up.

3. Go to the project & click on new project.

4.Make a folder on desktop & give file name.


8

5.when you click on the save button ,following window opens.

6. Select Philips & 89V51RD2

7. Then select NO on the pop-up given below.


9

8.Then make a New File.

9. Write or copy your gsm code there & save it with extension .c or .asm depending on your coding.

10

10.Go to target & then source group, right click on there & click on the option add o the project.

11.Select your asm or c file which you want to add.

12.Go to the option for target, click on output & tick on create hex file option .

11

13.Now build target. (Click on the pointed option)..

14.It will show you 0 errors & 0 warning on Output Window.

12

INTE F

ING OF 8051 WIT

LE

Li
F i

E i i

Di

(LEDs)

LEDs emit li t when an elect ic current passes through them.

Circuit symbol

T sti

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.

13

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.

LED Interfacing with 8051


1st Method

P2.0 = 1 // LED OFF P2.0 = 0 // LED ON P2=0xff // All LEDs OFF 2nd Method

P2.0 = 1 // LED ON P2.0 = 0 // LED OFF P2=0xff // All LEDs ON

Switch Circuitry
 The pulse acts as input to microcontroller.  A switch generates a high to low pulse.  Microcontroller senses the transition and perform appropriate task.

14

LEDs on and off using switch


# include<reg51.h> sbit sw1=P1^0; sbit sw2=P1^1; void main() { sw1=0; sw2=0; while(1) {
if(sw1==1)

{ P0=0XFF; } If(sw2==1) { P0=0X00; } } }

INTERFACING OF 8051 WITH SEVEN SEGMENT

LEDs displays
LEDs can be combined together in a single package to produce displays such as bar graphs, strips, arrays and 7-segment displays .
15

Bar-graph

Seven-segment

Star burst

Dot matrix

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.

16

7 segment interfacing

INTERFACING OF 7-SEGMENT WITH LCD

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  Data lines (DB7-DB0) used to transfer data and commands

Inside LCD
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. CGRAM area is used to create custom characters in LCD.
17

Instruction register corresponds to the register where you send commands to LCD e.g LCD shift command, LCD clear, LCD address etc. Data register is used for storing data which is to be displayed on LCD.

Pin diagram of LCD

RS: Register Select RS = 0 -> Command Register is selected RS = 1 -> Data Register is selected R/W: Read or Write
18

0 -> Write, 1 -> Read E: Enable (Latch data) Used to latch the data present on the data pins. A high-to-low edge is needed to latch the data. VEE : contrast control

LCD Initialization Commands


1.Specify function set: Send 38H for 8-bit,double line and 5x7 dot character format. 2.Display On-Off control: Send 0EH for display and blink cursor on. 3.Entry mode set: Send 06H for cursor in increment position and shift is invisible. 4. Clear display: Send 01H to clear display and return cursor to home position.

19

Interfacing with Microcontroller

Algorithm to send data to LCD:


1.Make R/W low 2.Place data byte on data register(Port) 3.Make RS=0 ;if data byte is command RS=1 ;if data byte is data (ASCII value) 4.Pulse E (HIGH to LOW) 5.Repeat the steps to send another data byte.

20

SERIAL COMMUNICATION

When a microprocessor communicates with the outside world, it provides the data in byte-sized chunks. In some cases, such as printers, the information is simply grabbed from the 8-bit data bus and presented to the 8-bit data bus of the printer. This can work only if the cable is not too long, since long cables diminish and even distort signals. Furthermore, an 8-bit data path is expensive. For this reasons, serial communication is used for transferring data between two systems located at distances of hundreds of feet to millions of miles apart. Two types of communications are:- serial and parallel communication.

Parallel communication

Serial communication

Serial data communication uses two methods, asynchronous and synchronous. The synchronous method transfers a block of data at a time, while the asynchronous method transfers a single byte at a time. It is possible to write software to use either of these methods , but the programs can be tedious and long. For this reason, there are special IC chips made by many manufacturers for serial data communications. These chips are commonly referred to as UART.

21

Synchronous transmission

Asynchronous transmission

UART in 8051
A 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.

MAX232 Since the RS232 is not compatible with todays microprocessors and microcontrollers, we need a line driver to convert the RS232s signals to TTL voltage levels t hat will be compatible to the 8051s TxD and RxD pins

22

Max ci cuitry

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.

Timer 1, mode 2 (8-bit, auto-reload) Define TH1 to set the baud rate. XTAL = 11.0592 MHz The system frequency = 11.0592 MHz / 12 = 921.6 kHz
23

Timer 1 has 921.6 kHz/ 32 = 28,800 Hz as source. TH1=FDH means that UART sends a bit every 3 timer source. Baud rate = 28,800/3= 9,600 Hz

Steps to transmit data from uc to pc


1.Load SCON register. 2.Laod TMOD register(timer1 in mode 2). 3. Load baud rate in TH1. 4. Start the timer. 5. Place character in SBUF. 6. Monitor TI flag. 7. Clear TI flag.

Steps to Receive data from pc to uc

1.Load SCON register. 2.Laod TMOD register(select timer1 mode 2). 3. Load baud rate in TH1. 4. Start the timer. 5. Monitor RI flag. 7. Read SBUF. 8. Clear RI.

24

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.

Interfacing of ADC with 8051

25

Steps to interface 0809 ADC with 8051 uc


1. Set initial values of SOC,EOC and OE. 2. Set ADD A, ADD B,ADD C. 3. High to low pulse on ALE. 4. High to low pulse on SOC with clock. 5. Monitor EOC bit. 6. Send h to l pulse to OE. 7. Read data. 8. Repeat the steps.

INTERFACING WITH RELAY, BUZZERS AND MOTORS

A relay is a electrically controllable switch widely used in industrial controls, automobiles, and appliances. It allows the isolation of two separate sections of a system with two different voltage sources. For e.g. a +5V system can be isolated from a 120V system by placing a relay between them. One such relay is called an electromagnetic relay.It has a wide variety applications such as in telephone exchanges, digital computers and automation systems.

Relay Operation
When there is no voltage applied on coil, switch is open.When a voltage is applied on coil , magnetic field is produced.It attracts the armature towards the 2nd pin closing the switch.

26

Relay application
Bulb is ON , when voltage is applied on relay input(coil). Bulb is OFF , when no voltage is applied on relay input(coil).

Optocouplers
Optocoupler are the devices , which tends current to flow in one direction.And are used between controller and relay section , to prevent controller from high voltage.

27

Relay circuit

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.

28

While interfacing it uses single bit of controller.BC547 transistor is used to provide switching of buzzer.

INTRODUCTION TO ROBOTICS

What is Robot?
a robot is a software-controllable mechanical device that uses sensors to guide one or more end-effectors through programmed motions in a workspace in order to manipulate physical objects. It can do jobs that are dangerous for humans like cleaning the main circulating pump housing in the nuclear power plant and repetitive jobs that are boring, stressful, or labor-intensive for humans.

Actuators
y Common robotic actuators utilize combinations of different electro-mechanical devices y Synchronous motor y Stepper motor y AC servo motor y Brushless DC servo motor y Brushed DC servo motor.
29

DC Motors
The most common actuator in mobile robotics simple, cheap, and easy to use. come in a great variety of sizes, to accommodate different robots and tasks

Principles of Operation
DC motors convert electrical into mechanical energy.They consist of permanent magnets and loops of wire inside.When current is applied, the wire loops generate a magnetic field, which reacts against the outside field of the static magnets. The interaction of the fields produces the movement of the shaft/armature. Thus, electromagnetic energy becomes motion.

Pulse Width Modulation


Pulse width modulation is a technique for reducing the amount of power delivered to a DC motor. Instead of reducing the voltage operating the motor (which would reduce its power), the motor's power supply is rapidly switched on and off. The percentage of time that the power is on determines the percentage of full operating power that is accomplished.

Stepper motor
A stepper motor is a widely used device that translates electrical pulses into mechanical movement. In applications such as disk drives, dot matrix printers, and robotics, the stepper motor is used for position control. Stepper motors commonly have a permanent magnet rotor surrounded by a stator. There are also steppers called variable reluctance stepper motor that do not have a PM rotor.

30

Working

GSM (Global System for Mobile communication)

GSM (Global System for Mobile communication) is a digital mobile telephony system that is widely used in Europe and other parts of the world. GSM uses a variation of time division multiple access (TDMA) and is the most widely used of the three digital wireless telephony technologies (TDMA, GSM, and CDMA). GSM digitizes and compresses data, then sends it down a channel with two other streams of user data, each in its own time slot. It operates at either the 900 MHz or 1800 MHz frequency band. Mobile services based on GSM technology were first launched in Finland in 1991. Today, more than 690 mobile networks provide GSM services across 213 countries and GSM represents 82.4% of all global mobile connections. According to GSM World, there are now more than 2 billion GSM mobile phone users worldwide. GSM World references China as "the largest single GSM market, with more than 370 million users, followed by Russia with 145 million, India with 83 million an the USA with 78 d million users."
31

Subscriber Identity Module (SIM)


 One of the key features of GSM is the Subscriber Identity Module, commonly known as a SIM card.  It contains the user's subscription information and phone book.  This allows the user to retain his or her information after switching handsets.  Alternatively, the user can also change operators while retaining the handset simply by changing the SIM.

GSM Architecture

SIM 300 Modem Features


 RS232 interface for direct communication with computer.  Push type SIM Card holder.
32

 GSM Antenna.  On board power supply regulator for external Supply voltage range 7V to 32V .

INTRODUCTION TO RFID

RFID stands for Radio-Frequency Identification. The acronym refers to small electronic devices that consist of a small chip and an antenna. The chip typically is capable of carrying 2,000 bytes of data or less . An RFID system has two main components: the RF reader (known also as the base station or interrogator) and the RF tag (or transponder). When RFID tags are attached to physical objects they enable those objects to identify themselves to RFID readers through the use of radio frequency communication.The radio frequency part of RFID is the communication medium between tags and readers. With passive RFID tags, radio frequency is also used to deliver power to the tag, as they do not have on-board power systems.

Why is RFID better than using bar codes?


Bar codes are line-of-sight technology, which means people usually have to orient the bar code towards a scanner for it to be read. Radio frequency identification, by contrast, doesnt require line of sight. RFID tags can be read as long as they are within range of a reader. Bar codes have other shortcomings as well. If a label is ripped, soiled or falls off, there is no way to scan the item. Standard bar codes identify only the manufacturer and product, not the unique item. The bar code on one cylinder is the same as every other, making it impossible to identify which one might pass the inspection.

The Tag
There are two main components present in the RFID tag. Firstly, a small silicon chip or integrated circuit which contains a unique identification number (ID). Secondly, an antenna that can send and receive radio waves.

33

These tags can be attached to or incorporated into a product, animal, or person for the purpose of identification using radio waves. Chip-based RFID tags contain silicon chips and antennas. Passive tags require no internal power source, whereas active tags require a power source.

Readers
An RFID reader is a device that is used to interrogate an RFID tag. The reader has an antenna that emits radio waves; the tag responds by sending back its data. The reader has two basic components  A scanning antenna
 A transceiver with a decoder to interpret the data

Readers (interrogators) can be at a fixed point such as Entrance/exit, Point of sale, Warehouse. Readers can also be mobile -- tethered, hand-held, or wireless .

EMBEDDED APPLICATIONS

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 DEFENCE: RADARs, SONARs (for surveillance), Guided Missile Systems.

34

CONCLUSION

By this Embedded System training course we have knowledge and hands-on experience in the embedded computer system technology. By this I am specialized in software and system design, giving, hardware design, which is vital for most embedded software designers. In short, now there is a chance for the very novices in electronics design to create a simple embedded computer based device and Ive learnt the maximum from the experience. I learnt both about design and tools. I learnt to study the components to fit the various pieces together into a complete system and understood the role of a microcontroller, seeing it as basic building block. I also learnt about hardware-software interaction. I learnt to design the schematics and layout using Printed Circuit Board (PCB) tools (e.g. OrCad), although their more advanced functions were not covered in the course. I learnt to use an emulator and other microcontroller development tools while testing the assembled circuit board. Admittedly, I learned a lot from this training.

Bibliography
 THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEMby Muhammad Ali Mazidi ,Janice Gillispie Mazidi, Rolin D. Mckinlay.  The 8051 MICROCONTROLLER by K. J. Ayala.  "Advanced Microprocessors and Microcontrollers" by B.P. Singh & Renu Singh.

Net Links
www.wikipedia.com www.electronicsforyou.com www.encyclopedia.com

35

36

37