You are on page 1of 28

CONTENTS:

Pg.no INTRODUCTION EMBEDEDSYSTEMS BLOCK DIAGRAM DISCRIPTION PIN DIAGRAM RC5 CODING WHAT IS IR DC MOTORS MOTOR DRIVERS POWER SUPPLY UNIT EMBEDED C KEIL S/W PROGRAMING PROCEDURE APPLICATIONS CONCLUSION 2 2 3 4 5 14 17 19 20 21 23 23 26 27

Introduction:
The main scope of this project is to develop the robot using embedded technology to reduce the complexity in design. To control the movement of robot using remote

Embededsystems:
In this world of knowledge everything around us is run by Computing Systems. The technical Brilliance and Developments in different fields has led to a drastic change in our lives especially in the communications field. Due to various changes in technologies many systems have come up with

breathtaking developments. One amongst them is the Embedded Systems. It is the evolution or further development of computing system. Its applications provide tremendous opportunities for creative use of computer technology. Almost every new system introduced in the market is an example of Embedded System.

An embedded system is a combination of computer circuitry and software that is built into a product for purposes such as control, monitoring and communication without human intervention. Embedded systems are at the core of every modern electronic product, ranging from toys to medical equipment to aircraft control systems.

In contrast to general-purpose computers, embedded systems perform a narrow range of pre-defined tasks. Thus, they usually do not have any of the typical computer peripheral devices such as a keyboard, display monitor, serial connections, mass storage (e.g., hard disk drives), etc. or any kind of user interface software, unless required by the product in which they are used in. This can make it possible to greatly reduce the complexity, size and cost and increase the robustness of embedded systems as compared with general purpose system.

Block diagram:
POWER CIRCUIT DC 5V

TV transmitter

LCD DISPLAY 2*16

MICRO CONTROLLER TV RECEIVER

DC MOTOR

Description
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8k bytes of Flash programmable anderasable read only memory (PEROM).The device is manufactured using Atmels high-density nonvolatile 11Memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and Pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip. The Atmel AT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications

Features
y y y y y y y y y y y The AT89C52 provides the following standard features: Compatible with MCS-51 Products Endurance: 1,000 Write/Erase Cycles 8K Bytes of In-System Reprogrammable Flash Memory 128 bytes of Internal RAM (128 x 8-bit) 32 Programmable I/O Lines Two 16-bit Timer/Counters Five vector two-level interrupt architecture A full duplex serial port Three-level Program Memory Lock Six Interrupt Sources On-chip oscillator and clock circuitry

PIN DIAGRAM

Pin Description
VCC
Supply voltage.

GND
Ground.

Port 0

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight

TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode P0 has internal pull-ups. Port 0 also receives thecodeduringFlash programming, and outputs the code bytes during program verification. External pull-ups are required during program verification.

Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups.The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs.As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesse to external data 16-bit addresses(MOVX@DPTR) in this application ituses strong memory uses internal pull-ups when emitting1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI); Port 2 emits the contents of the P2 Special Function Register.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups.The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups.Port 3 also serves the functions of various special features of the AT89C51 as listed below:

Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7

Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory Write strobe) RD (external data memory read strobe)

Port 3 also receives some control signals for Flash programming and verification.

RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN
Program Store Enable is the read strobe to external program memory. When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two
PSEN activations are skipped during each access to external data memory.

EA /VPP

External Access Enable must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2
Output from the inverting oscillator amplifier

Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used.To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flipflop, but minimum and maximum voltage high and low time specifications must be observed.

OSCILLATOR CONNECTIONS

At89c51: Types of Memory


The 89c51 has three very general types of memory The memory types are On ChipMemory,External Code Memory, and External RAM

On-Chip Memory

:it refers to any memory (Code, RAM, or other) that physically exists on the

microcontroller itself. On-chip memory can be of several types, but we'll get into that shortly.

External Code Memory :is code (or program) memory that resides off-chip. This is often in
the form of an external EPROM.

External RAM

is RAM memory that resides off-chip. This is often in the form of standard static RAM or flash RAM.

Code Memory:

Code memory is the memory that holds the actual 89c51 program that is to be

run. This memory is limited to 64K and comes in many shapes and sizes: Codememory may be found onchip, either burned into the microcontroller as ROM or EPROM. Code may also be stored completely offchip in an external ROM or, more commonly, an external EPROM. Flash RAM is also another popular method of storing a program. Various combinations of these memory types may also be used--that is to say, it is possible to have 4K of code memory on-chip and 64k of code memory off-chip in an EPROM.When the program is stored on-chip the 64K maximum is often reduced to 4k, 8k, or 16k. This varies depending on the version of the chip that is being used. Each version offers specific capabilities and one of the distinguishing factors from chip to chip is how much ROM/EPROM space the chip has.

External RAM:
As an obvious opposite of Internal RAM, the 89c51 also supports what is called External RAM.As the name suggests, External RAM is any random access memory which is found off-chip. Since the memory is off-chip it is not as flexible in terms of accessing, and is also slower. For example, to increment an Internal RAM location by 1 requires only 1 instruction and 1 instruction cycle. To increment a 1-byte value stored in External RAM requires 4 instructions and 7 instruction cycles. In this case, external memory is 7 times slower!What External RAM loses in speed and flexibility it gains in quantity. While Internal RAM is limited to 128 bytes (256 bytes with an 8052), the 89c51 supports External RAM up to 64K.

On-Chip Memory

As mentioned, the 89c51 includes a certain amount of on-chip memory.

On-chip memory is really one of two types: Internal RAM and Special Function Register (SFR) memory.

10

The layout of the 89c51's internal RAM and Special Function Register (SFR) memory. The layout of the 89c51's internal memory is presented in the following memory map..

As is illustrated in above map, the 89c51 has a bank of 128 bytes of Internal RAM. This Internal RAM is found on-chip on the 89c51 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 89c51 is reset this memory is cleared.

Register Banks:
The 89c51 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 Accumulator. Thus if the Accumulator (A) contained the value 6 and R4 contained the value 3, the Accumulator would 11

contain the value 9 after this instruction was executed.However, as the memory map shows, the "R" Register R4 is really part of Internal RAM. Specifically, R4 is address 04h. This can be seen in the bright green section of the memory map. But, the 89c51 has four distinct register banks. When the 89c51 is first booted up, register bank 0 (addresses 00h through 07h) is used by default. However, your program may instruct the 89c51 to use one of the alternate register banks; i.e., register banks 1, 2, or 3. In this case, R4 will no longer be the same as Internal RAM address 04h. For example, if your program instructs the 89c51 to use register bank 3, "R" register R4 will now be synonomous with Internal RAM address 1Ch. The concept of register banks adds a great level of flexibility to the 89c51, especially when dealing with interrupts (we'll talk about interrupts later). However, always remember that the register banks really reside in the first 32 bytes of Internal RAM.

Bit Memory:
The 89c51, being a communications-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, numberd 00h through 7Fh. The user may make use of these variables with commands such as SETB and CLR. For example, to set bit number 24 (hex) to 1 you would execute the instruction: SETB 24h 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. Thus, if you write the value FFh to Internal RAM address 20h youve effectively set bits 00h through 07h. Bit variables 00h through 7Fh are for userdefined functions in their programs. However, bit variables 80h and above are actually used to access certain SFRs on a bit-by-bit basis.

89c51: Basic Registers


The Accumulator:
The Accumulator, as its name suggests, is used as a general register to accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile register the 12

89c51 has due to the shear number of instructions that make use of the accumulator. More than half of the 89c51s 255 instructions manipulate or use the accumulator in some way.

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 auxillary registers in many operations. To continue with the above example, perhaps you are adding 10 and 20. The original number 10 may be stored in the Accumulator whereas the value 20 may be stored in, say, register R4. To process the addition you would execute the command

The "B" Register:


The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1byte) value.The "B" register is only used by two 89c51 instructions: MUL AB and DIV AB. Thus, if you want to quickly and easily multiply or divide A by another number, you may store the other number in "B" and make use of these two instructions.Aside from the MUL and DIV instructions, the "B" register is often used as yet another temporary storage register much like a ninth "R" register.

The Data Pointer (DPTR):


The Data Pointer (DPTR) is the 89c51s only user-accessable 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 89c51 to access external memory. When the 89c51 accesses external memory it will access external memory at the address indicated by DPTR.While DPTR is most often used to point to data in external memory, many programmers often take advantge of the fact that its the only true 16-register available. It is often used to store 2-byte values which have nothing to do with memory locations.

The Program Counter (PC):


The Program Counter (PC) is a 2-byte address which tells the 89c51 where the next instruction to execute is found in memory. When the 89c51 is initialized PC always starts at 0000h and is

13

incremented each time an instruction is executed. It is important to note that PC isnt always incremented by one. Since some instructions require 2 or 3 bytes the PC will be incremented by 2 or 3 in these cases

The Stack Pointer (SP):


The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit (1-byte) value. The Stack Pointer is used to indicate where the next value to be removed from the stack should be taken from.When you push a value onto the stack, the 89c51 first increments the value of SP and then stores the value at the resulting memory location.When you pop a value off the stack, the 89c51 returns the value from the memory location indicated by SP, and then decrements the value of SP.

RC5 CODEING
 RC5 protocol was developed as a remote control communication protocol for consumer electronics.  The RC5 code uses the biphase modulation technique which means that every bit consists of 2 parts which are never the same.

 The carrier frequency of the rc5 code is 36 kHz so take always a receiver with a response frequency of 36 kHz.

14

 The information available in the binary form must be encoded into a signal before it can be transmitted. This is known Data Encoding.  The signal generated at this stage is a digital signal. The encoded Signal has some desirable properties.

 If the transmission link is capable in sending the digital signal at the desired speed and to the desired distance then the signal will be sent in its digital form.  In Monchester encoding, the transition at the middle of the bit is used for both synchronization and bit representation.

 This is a return to zero (RTZ) signal.

15

 Binary 0 -> Low voltage level in the first half and High voltage level in the second half.

 Binary 1 -> High Voltage level in the first half and Low Voltage level in the second half.  The RC5 code uses the bifase modulation technique which means that every bit consists of 2 parts which are never the same.

 Detecting an IR signal the output of the integrated receiver will be 0V.  The duration time of each bit is equal to 1,778 ms, and the total time of a full rc5 code is 24,778 ms.

 The space between two transmitted codes is 50 bit times or 88,889ms.To improve noise rejection the pulses are modulated at a carrier frequency  The carrier frequency of the rc5 code is 36 kHz so take always a receiver with a response frequency of 36 kHz.

16

17

 The IR detector is only looking for infrared thats flashing on and off 38,500 times per second. 18

 It has built-in optical filters that allow very little light except the 980 nm infrared.  It also has an electronic filter that only allows signals around 38.5 kHz to pass through.  This is the type of signal produced by the remote control.  This prevents IR interference from common sources such as sunlight and indoor lighting

pulse width modulation (PWM): Pulse durations are used in many applications, a few of
which are motor control, and communication. Since the IR detector sends low pulses that can be measured to determine what information the IR remote is sending, it's an example of using PWM for communication.

Carrier signal: The IR remote uses a 38.5 kHz "carrier signal" to transmit the pulse durations
from the remote to the IR detector.

Communication protocol: A communication protocol is a set of rules for devices that have
to exchange electronic messages. Protocols tend to have rules for voltages, the amount of time signals last, carrier signal frequencies and/or wavelengths, and much more. When two or more devices follow the rules of a given protocol, they should be able to communicate and exchange information.

19

DCMOTORS
.  DC motors are electric motors without commutators .  Commutataion is handled externally by the motor controller.  Controller charges opposite coils attracting the center rotor magnets.

20

MOTOR DRIVERS

Its Powerful  Configured with LED direction indicators.  Able to deliver (2.4A surge) and 36 volts supply power.

21

POWER SUPPLY UNIT


BLOCK DIAGRAM :

Step Down Transformer

Bridge Rectifier

Positive Charge Capacitor

Positive Voltage Regulator LPF

5v

POWER SUPPLY UNIT As we all know any invention of latest technology cannot be activated without the source of power. So it this fast moving world we deliberately need a proper power source which will be apt for a particular requirement. All the electronic components starting from diode to Intel ICs only work with a DC supply ranging from _+5v to _+12. we are utilizing for the same, the most cheapest and commonly available energy source of 230v-50Hz and stepping down , rectifying, filtering and regulating the voltage. This will be dealt briefly in the forth-coming sections. STEP DOWN TRANSFORMER When AC is applied to the primary winding of the power transformer it can either be stepped down or up depending on the value of DC needed. In our circuit the transformer of 230v/15-0-15v is used to perform the step down operation where a 230V AC appears as 15V AC across the secondary winding . One alteration of input causes the top of the transformer to be positive and the bottom negative. The next alteration will temporarily cause the reverse. The current rating of the transformer used in our project is 2A. Apart from stepping down AC voltages , it gives isolation between the power source and power supply circuitries. RECTIFIER UNIT In the power supply unit, rectification is normally achieved using a solid state diode. Diode has the property that will let the electron flow easily in one direction at proper biasing condition . As AC is applied to the diode, electrons only flow when the anode and cathode is negative. Reversing the polarity of voltage will not permit electron flow. A commonly used circuit for supplying large amounts of DC power is the bridge rectifier. A bridge rectifier of four diodes (4*IN4007) are used to achieve full wave rectification. Two diodes will conduct during the negative cycle and the other two will conduct during the positive half cycle. The DC voltage appearing across the output terminals of the bridge rectifier will be somewhat less than 90% of the applied rms value. Normally one alteration of the input voltage will reverse the polarities. Opposite ends of the transformer will therefore always be 180 deg out of phase with each other. 22

For a positive cycle, two diodes are connected to the positive voltage at the top winding and only one diode conducts . At the same time one of the other two diodes conducts for the negative voltage that is applied from the bottom winding due to the forward bias for that diode. In this circuit due to positive half cycleD1 & D2 will conduct to give 10.8v pulsating DC. The DC output has a ripple frequency of 100Hz. Since each altercation produces a resulting output pulse, frequency = 2*50 Hz. The output obtained is not a pure DC and therefore filtration has to be done.

FILTERING UNIT Filter circuits which is usually a capacitor acting as a surge arrester always follow the rectifier unit. This capacitor is also called as a decoupling capacitor or a bypassing capacitor, is used not only to short the ripple with frequency of 120Hz to ground but also to leave the frequency of the DC to appear at the output. A load resistor R1 is connected so that a reference to the ground is maintained . C1R1 is for bypassing ripples. C2R2 is used as a low pass filter, i.e. it passes only low frequency signals and bypasses high frequency signals. The load resistor should be 1% to 2.5% of the load. 1000wf/25v 10wf/25v O,1wf : for the reduction of ripples from the pulsating. : for maintaining the stability of the voltage at the load side. : for bypassing the high frequency disturbances.

VOLTAGE REGULATORS The voltage regulators play an important role in any power supply unit. The primary purpose of a regulator is to aid the rectifier and filter circuit in providing a constant DC voltage to the device. Power supplies without regulators have an inherent problem of changing DC voltage values due to variations in the load or due to fluctuations in the AC liner voltage. With a regulator connected to the DC output, the voltage can be maintained within a close tolerant region of the desired output. IC7812 and 7912 is used in this project for providing +12v and 12v DC supply. Specifications : Resistors R1 and R2 maintain line load regulation. At the secondary side of the transformer,Applied voltage = 15v Conducting drop across the diodes = 2*0.6= 1.2v without capacitor: Vavg = (15-1.2)v = 13.8c pulsating DC Frequency = 100Hz With capacitor: V=Vavg *1.414(formfactor)= 19.51v frequency = oHz With 7812 voltage regulator : V0= +12v With 7912 voltage regulator : V0= -12v

23

EMBEDED C
 The biggest difference between C compilers for embedded systems and C compilers for desktop computers is the distinction between the "platform" and the "target".  The "platform" is where the C compiler runs -- a laptop running Linux or a desktop running Windows.  The "target" is where the executable code generated by the C compiler will run -- the CPU in the embedded system, often without any underlying operating system.

KEIL SOFTWARE PROGRAMING PROCEDURE


How to write Embedded C Program in Keil Software.

Procedure Steps

Step-1: Install Keil MicroVision-2 in your PC, Then after Click on that Keil UVision-2 icon. After opening the window go to toolbar and select Project Tab then close previous project. Step-2: Next select New Project from Project Tab. Step-3: Then it will open Create New Project window. Select the path where you want to save project and edit project name. Step-4: Next it opens Select Device for Target window, It shows list of companies and here you can select the device manufacturer company.

24

Step-5: For an example, for your project purpose you can select the chip as 89c51/52 from Atmel Group. Next Click OK Button, it appears empty window here you can observe left side a small window i.e, Project Window. Next create a new file Step-6: From the Main tool bar Menu select File Tab and go to New, then it will open a window, there you can edit the program. Step-7: Here you can edit the program as which language will you prefer either Assembly or C. Step-8: After editing the program save the file with extension as .c or .asm, if you write a program in Assembly Language save as .asm or if you write a program in C Language save as .c in the selected path. Take an example and save the file as test.c. Step-9: Then after saving the file, compile the program. For compilation go to project window select source group and right click on that and go to Add files to Group.

Step-10: Here it will ask which file has to Add. For an example here you can add test.c as you saved before Step-11: After adding the file, again go to Project Window and right click on your c file then select Build target for compilation. If there is any Errors or Warnings in your program you can check in Output Window that is shown bottom of the Keil win Step-12: Here in this step you can observe the output window for errors and warnings. dow Step-13: If you make any mistake in your program you can check in this slide for which error and where the error is by clicking on that error.

25

Step-14: After compilation then next go to Debug Session. In Tool Bar menu go to Debug tab and select Start/Stop Debug Session. Step-15: Here a simple program for Leds Blinking. LEDS are connected to PORT-1. you can observe the output in that port. Step-16: To see the Ports and other Peripheral Features go to main toolbar menu and select peripherals. Step-17: In this slide see the selected port i.e, PORT-1. Step-18: Start to trace the program in sequence manner i.e, step by step execution and observe the output in port window.

Step-19: After completion of Debug Session Create an Hex file for Burning the Processor. Here to create an Hex file go to project window and right click on Target next select Option for Target. Step-20: It appears one window; here in target tab modify the crystal frequency as you connected to your microcontroller. Step-21: Next go to Output tab. In that Output tab click on Create HEX File and then click OK. Step-22: Finally Once again compile your program. The Created Hex File will appear in your path folder.

26

APPLICATIONS
 Entertainment  Automobile  Aerospace  Gaming

27

Conclusion
This application has demonstrated a method of receiving and decoding IR and RC5 messages which is used to control a robot through TV remote.

28

You might also like