Você está na página 1de 74

PC based robot controlling using wireless communication with ASK modulation INDEX

CONTENTS
1. Abbreviations 2. Introduction 3. Block Diagram 4. Block Diagram Description 5. Schematic 6. Schematic Description 7. Hardware Components
Microcontroller DC motor sensor buzzer POWER SUPPLY

8. Circuit Description 9. Software 10.Conclusion (or) Synopsis


11. Bibliography

ABBREVIATIONS
SYMBOL ACC B PSW SP DPTR DPL DPH P0 P1 P2 P3 IP IE TMOD TCON T2CON T2MOD TH0 TL0 TH1 TL1 TH2 TL2 SCON SBUF PCON NAME Accumulator B register Program status word Stack pointer Data pointer 2 bytes Low byte High byte Port0 Port1 Port2 Port3 Interrupt priority control Interrupt enable control Timer/counter mode control Timer/counter control Timer/counter 2 control Timer/counter mode2 control Timer/counter 0high byte Timer/counter 0 low byte Timer/counter 1 high byte Timer/counter 1 low byte Timer/counter 2 high byte Timer/counter 2 low byte Serial control Serial data buffer Power control

Abstract: This project is designed to control the robot direction using PC. The control unit in receiver section controls the robot direction according to the commands given from PC which is present in the transmitter section by using RF wireless communication. As control unit 8051 microcontroller is used. One is transmitter and the second one is receiver section. Transmitter section consists of microcontroller, PC and RF transmitter. Micro controller is interfaced to PC through serial communication using MAX 232 level converter. Different directions of the robot are controlled by giving instructions to the robot with the help of data given to the PC using keypad. Data will be given to microcontroller and controller will transmit that data to receiver module by using RF transmitter. Those data from the transmitter antenna will be transmitted and received by receiver antenna at the receiver section. Transmitter section consists of microcontroller, robot and RF receiver. The data received at the RF receiver is given to micro controller and according to the program written with in the controller, controller controls the robot directions. Robot can move in left, right directions etc robot direction can be changed by changing the command given to the PC. Robotics is the science and technology of robots, their design, manufacture, and application. Robotics requires a working knowledge of electronics, mechanics and software, and is usually accompanied by a large working knowledge of many subjects. Although the appearance and capabilities of robots vary vastly, all robots share the features of a mechanical, movable structure under some form of autonomous control.

The structure of a robot is usually mostly mechanical and can be called a kinematic chain (its functionality being akin to the skeleton of the human body). The chain is formed of links (its bones), actuators (its muscles) and joints which can allow one or more degrees of freedom. Most contemporary robots use open serial chains in which each link connects the one before to the one after it. These robots are called serial robots and often resemble the human arm. Some robots, such as the Stewart platform, use closed parallel kinematic chains.

Block diagram: Transmitter section:

Transmitter

Receiver section: Power


supply MCU Receiver

RF transmitter

Power supply PC
Tools & Software: Soldering station Kiel IDE Multisim 10.0 Express PCB

RF Receiver MCU Motor 2

Motor1

EMBEDDED SYSTEM: An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies of scale. Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port both features usually belong to "general purpose computers", the line of nomenclature blurs even more.

Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure.

Examples of Embedded Systems:

Avionics, such as inertial guidance systems, flight control hardware/software and other integrated systems in aircraft and missiles Cellular telephones and telephone switches Engine controllers and antilock brake controllers for automobiles Home automation products, such as thermostats, air conditioners, sprinklers, and security monitoring systems Handheld calculators Handheld computers Household appliances, including microwave ovens, washing machines, television sets, DVD players and recorders Medical equipment

Personal digital assistant Videogame consoles Computer peripherals such as routers and printers. Industrial controllers for remote machine operation.

Block diagram: Transmitter section:

Transmitter

Receiver section: Power


supply MCU Receiver

RF transmitter

Power supply PC

RF Receiver MCU Motor 2

Block Diagram Explanation:

This Project mainly consists of Power Supply section, Microcontroller section, Motor Driver section and a sensor. Motor1

Power Supply Section: This section is meant for supplying Power to all the sections mentioned above. It basically consists of a 12V DC battery followed by a positive voltage regulator is used to regulate the required dc voltage for the Microcontroller circuit operation. Microcontroller Section: This section forms the control unit of the whole project. This section basically consists of a Microcontroller with its associated circuitry like Crystal with capacitors, Reset circuitry, Pull up resistors (if needed) and so on. The Microcontroller forms the heart of the project because it controls the devices being interfaced and communicates with the devices according to the program being written. In transmitter the function of this block is to send the data from PC to RF transmitter. At reciver side this block is retrieve the data and do the function according to the command Motor1, Motor 2: This section basically consists of the required circuitry to drive the motors. This is nothing but an H-Bridge circuitry to drive the motors which controls direction of the robot. PC: This block acts as remote control. It is nothing but a personal computer. The commands from PC are transferred to MCU. RF transmitter: This block contains RF transmitter module along with an encoder circuit. When MCU sends the data to this module from here this data converted into Radio signals. RF receiver: This block contains a reciver module with a decoder circuit. The data from RF receiver is retrieved and pass it to MCU.

Schematic Diagram:

Schematic Explanation:
Firstly, the required operating voltage for Microcontroller 89s51 is 5V. Hence the 5V D.C. power supply is needed by the same. So in this project we are using +12V DC battery for providing the required voltage for the circuit operation. The12V DC battery is connected to the LM7805 regulator so that it allows us to have a Regulated Voltage which is +5V. This regulated voltage is filtered for ripples using an electrolytic capacitor 100F. Now the output from this section is fed to 40th pin of 89s51 microcontroller to supply operating voltage. This is required for the operation of the motor driver circuitry to drive the motors. The microcontroller 89c51 with Pull up resistors at Port0 and crystal oscillator of 11.0592 MHz crystal in conjunction with couple of capacitors of is placed at 18th & 19th pins of 89c51 to make it work (execute) properly.

Receiver: The motor driver is nothing but a H-bridge circuitry for controlling motors. That is for the controlling of the robot direction. The motor driver circuitry includes the two HBridges. Each H-bridge will take care of controlling motor. Each H-bridge having two inputs. That is, four inputs of two H-bridges are connected to the port pins P2.0, P2.1,P2.2, P2.3 of the Microcontroller. According the logic values applied at the input of the H-bridge circuitry the direction of the robot will be controlled. software. Sensor is connected to P2.0. HT12D IC is used to retrieve the data from RF receiver module. The function of this IC is to match the address of transmitter and collect the serial data and this data is transferred to microcontroller. Transmitter: The IC HT12E IC is used to encode the data from microcontroller and make it serial along with the destination address. This serial data is then transferred to RF transmitter. The command to the destination is taken from the computer. Microcontroller serial communication is used. MAX232 IC is used in between microcontroller and PC. This IC is used to convert the logic levels for microcontroller and PC. So MAX232 is logic level IC with capacitors as supporting circuitry. That will be done through the

MICRO CONTROLLER (AT89S51)

Introduction
A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single silicon chip.

If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM, EPROM and peripherals. But controller is provided all these facilities on a single chip. Development of a Micro controller reduces PCB size and cost of design. One of the major differences between a Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the real world application. Intel has introduced a family of Micro controllers called the MCS-51.

Figure: micro controller

Features:
Compatible

with MCS-51 Products

4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes

Description

The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmels highdensity nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.

Block diagram:

Figure: Block diagram

Pin diagram:

Figure: pin diagram of micro controller

Pin Description
VCC - Supply voltage. GND - Ground.

Port 0: Port 0 is an 8-bit open drain bidirectional 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 can 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 the code bytes during Flash 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 bidirectional 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 bidirectional 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 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3: Port 3 is an 8-bit bidirectional 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 pull-ups 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 receives some control

signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.

RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG: Address Latch Enable (ALE) is an 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 (PSEN) is the read strobe to external program memory. When the AT89S51 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. EA 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. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. 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 Figs 6.2.3. 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 6.2.4.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.

Fig 6.2.3 Oscillator Connections

Fig 6.2.4 External Clock Drive Configuration

Serial Communication
Computers can transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet away. Examples of parallel data transfer are printers and hard disks; each uses cables with many wire strips. Although in such cases a lot of data can be transferred in a short amount of time by using many wires in parallel, the distance cannot be great. To transfer to a device located many meters away, the serial method is used. In serial communication, the data is sent one bit at a time, in contrast to parallel communication, in which the data is sent a byte or more at a time. Serial communication of the 8051 is the topic of this chapter. The 8051 has serial communication capability built into it, there by making possible fast data transfer using only a few wires. If data is to be transferred on the telephone line, it must be converted from 0s and 1s to audio tones, which are sinusoidal-shaped signals. A peripheral device called a modem, which stands for modulator/demodulator, performs this conversion. 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. In data transmission if the data can be transmitted and received, it is a duplex transmission. This is in contrast to simplex transmissions such as with printers, in which the computer only sends data. Duplex transmissions can be half or full duplex, depending on whether or not the data transfer can be simultaneous. If data is transmitted one way at a time, it is referred to as half duplex. If the data can go both ways at the same time, it is full duplex. Of course, full duplex requires two wire conductors for the data lines, one for transmission and one for reception, in order to transfer and receive data simultaneously. Asynchronous serial communication and data framing The data coming in at the receiving end of the data line in a serial data transfer is all 0s and 1s; it is difficult to make sense of the data unless the sender and receiver agree on a set

of rules, a protocol, on how the data is packed, how many bits constitute a character, and when the data begins and ends. Start and stop bits Asynchronous serial data communication is widely used for character-oriented transmissions, while block-oriented data transfers use the synchronous method. In the asynchronous method, each character is placed between start and stop bits. This is called framing. In the data framing for asynchronous communications, the data, such as ASCII characters, are packed between a start bit and a stop bit. The start bit is always one bit, but the stop bit can be one or two bits. The start bit is always a 0 (low) and the stop bit (s) is 1 (high). Data transfer rate The rate of data transfer in serial data communication is stated in bps (bits per second). Another widely used terminology for bps is baud rate. However, the baud and bps rates are not necessarily equal. This is due to the fact that baud rate is the modem terminology and is defined as the number of signal changes per second. In modems a single change of signal, sometimes transfers several bits of data. As far as the conductor wire is concerned, the baud rate and bps are the same, and for this reason we use the bps and baud interchangeably. The data transfer rate of given computer system depends on communication ports incorporated into that system. For example, the early IBMPC/XT could transfer data at the rate of 100 to 9600 bps. In recent years, however, Pentium based PCS transfer data at rates as high as 56K bps. It must be noted that in asynchronous serial data communication, the baud rate is generally limited to 100,000bps. Computers can transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet away. Examples of parallel transfers are printers and hard disks; each uses cables with many wire strips. Although in such cases a lot of data can be transferred in a short amount of time by using many wires in parallel, the distance cannot be great. To transfer to a device located many meters away, the serial method is used. In serial communication, the data is sent one bit at a time, in contrast to parallel communication, in which the data is sent a byte or more at a time. The 8051 has serial communication capability built into it, there by making possible

fast data transfer using only a few wires. The PC uses RS 232 as a Serial Communication Standard. RS232 Standards To allow compatibility among data communication equipment made by various manufacturers, an interfacing standard called RS232 was set by the Electronics Industries Association (EIA) in 1960. In 1963 it was modified and called RS232A. RS232B AND RS232C were issued in 1965 and 1969, respectively. Today, RS232 is the most widely used serial I/O interfacing standard. This standard is used in PCs and numerous types of equipment. However, since the standard was set long before the advert of the TTL logic family, its input and output voltage levels are not TTL compatible. In RS232, a 1 is represented by -3 to -25V, while a 0 bit is +3 to +25V, making -3 to +3 undefined. For this reason, to connect any RS232 to a microcontroller system we must use voltage converters such as MAX232 to convert the TTL logic levels to the RS232 voltage levels, and vice versa. commonly referred to as line drivers. RS232 pins RS232 cable connector commonly referred to as the DB-25 connector. In labeling, DB-25P refers to the plug connector (male) and DB-25S is for the socket connector (female). Since not all the pins are used in PC cables, IBM introduced the DB-9 Version of the serial I/O standard, which uses 9 pins only, as shown in table. DB-9 pin connector MAX232 IC chips are

12345 6789 (Out of computer and exposed end of cable)

Pin Functions: Pin Description 1 Data carrier detect (DCD) 2 Received data (RXD) 3 Transmitted data (TXD) 4 Data terminal ready(DTR) 5 Signal ground (GND) 6 Data set ready (DSR) 7 Request to send (RTS) 8 Clear to send (CTS) 9 Ring indicator (RI) Note: DCD, DSR, RTS and CTS are active low pins. The method used by RS-232 for communication allows for a simple connection of three lines namely Tx, Rx, and Ground. TXD: carries data from DTE to the DCE. RXD: carries data from DCE to the DTE SG: signal ground

8051 connection to RS232:

The RS232 standard is not TTL compatible; therefore, it requires a Line Driver such as the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa.

The 8051 has two pins that are used specifically for transferring and receiving data serially. These two pins are TXD and RXD and are a part of the port 3 (P3.0 and P3.1). Pin 11 of the 8051 is designated as TXD and pin 10 as RXD. These pins are TTL compatible; therefore, they require a line driver to make them RS232 compatible. One such line driver is the MAX232 chip. MAX232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One advantage of the MAX232 chip is that it uses a +5V power source which, is the same as the source voltage for the 8051. In the other words, with a single +5V power supply we can power both the 8051 and MAX232, with no need for the power supplies. The MAX232 has two sets of line drivers for transferring and receiving data. The line drivers used for TXD are called T1 and T2, while the line drivers for RXD are designated as R1 and R2. In many applications only one of each is used.

MAX-232
Logic Signal Voltage Serial RS-232 (V.24) communication works with voltages (between -15V ... -3V and used to transmit a binary '1' and +3V ... +15V to transmit a binary '0') which are not compatible with today's computer logic voltages. On the other hand, classic TTL computer logic operates between 0V ... +5V (roughly 0V ... +0.8V referred to as low for binary '0', +2V ... +5V for high binary '1' ). Modern low-power logic operates in the range of 0V ... +3.3V or even lower. So, the maximum RS-232 signal levels are far too high for today's computer logic electronics, and the negative RS-232 voltage can't be grokked at all by the computer logic. Therefore, to receive serial data from an RS-232 interface the voltage has to be reduced, and the 0 and 1 voltage levels inverted. In the other direction (sending data from some logic over RS-232) the low logic voltage has to be "bumped up", and a negative voltage has to be generated, too.

RS-232 TTL Logic --------------------------------------------------------15V ... -3V <-> +2V ... +5V <-> 1 +3V ... +15V <-> 0V ... +0.8V <-> 0 All this can be done with conventional analog electronics, e.g. a particular power supply and a couple of transistors or the once popular 1488 (transmitter) and 1489 (receiver) ICs. However, since more than a decade it has become standard in amateur electronics to do the necessary signal level conversion with an integrated circuit (IC) from the MAX232 family (typically a MAX232A or some clone). In fact, it is hard to find some RS-232 circuitry in amateur electronics without a MAX232A or some clone. The MAX232 & MAX232A

Fig: A MAX232 integrated circuit The MAX232 from Maxim was the first IC which in one package contains the necessary drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It became popular, because it just needs one voltage (+5V) and generates the necessary RS-232 voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry. Circuitry designers no longer need to design and build a power supply with three voltages (e.g. -12V, +5V, and +12V), but could just provide one +5V power supply, e.g. with the help of a simple 78x05 voltage converter.

The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the MAX232A is much more often used than the original MAX232, and the MAX232A only needs external capacitors 1/10th the capacity of what the original MAX232 needs. It should be noted that the MAX232 (A) is just a driver/receiver. It does not generate the necessary RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-232 signal, it does not provide a serial/parallel conversion. All it does is to convert signal voltage levels. Generating serial data with the right timing and decoding serial data has to be done by additional circuitry, e.g. by a 16550 UART or one of these small micro controllers (e.g. Atmel AVR, Microchip PIC) getting more and more popular. The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap. It has also helped that many companies now produce clones (ie. Sipex). These clones sometimes need different external circuitry, e.g. the capacities of the external capacitors vary. It is recommended to check the data sheet of the particular manufacturer of an IC instead of relying on Maxim's original data sheet. The original manufacturer (and now some clone manufacturers, too) offers a large series of similar ICs, with different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g. The MAX232 and MAX232A need external capacitors for the internal voltage pump, while the MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more expensive in electronic shops than the MAX232A because of its internal capacitors. It is also more difficult to get the MAX233 than the garden variety MAX232A. A similar IC, the MAX3232 is nowadays available for low-power 3V logic.

MAX232(A) DIP Package

No.

Name

Purpose + connector

Signal Voltage

Capacitor Capacitor MAX232 MAX232A 100nF

C1+

capacitor C1 output pump connector of

capacitor should stand at for 1F least 16V capacitor

V+

voltage +10V,

stand at least 16V

should 1F to VCC 100nF to VCC

C1-

capacitor C1 + connector

capacitor should stand at for 1F least 16V capacitor should stand at for 1F least 16V capacitor should stand at for 1F least 16V voltage -10V, capacitor

100nF

C2+

capacitor C2 connector

100nF

C2-

capacitor C2 output of

100nF

6 7 8

VT2out R2in

pump / inverter Driver 2 output

stand at least 16V RS-232

should 1F to GND 100nF to GND

Receiver 2 input RS-232

9 10 11 12 13 14 15 16

R2out T2in T1in R1out R1in T1out GND VCC

Receiver 2 output TTL Driver 2 input Driver 1 input TTL TTL

Receiver 1 output TTL Receiver 1 input RS-232 Driver 1 output Ground Power supply RS-232 0V +5V 1F to VCC 100nF to VCC see above see above

V+(2) is also connected to VCC via a capacitor (C3). V-(6) is connected to GND via a capacitor (C4). And GND(16) and VCC(15) are also connected by a capacitor (C5), as close as possible to the pins. A Typical Application The MAX232 (A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS232 signals can be converted in each direction. The old MC1488/1498 combo provided four drivers and receivers. Typically a pair of a driver/receiver of the MAX232 is used for

TX and RX

and the second one for

CTS and RTS.

There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial interface. If the DTE really requires these signals either a second MAX232 is needed, or some other IC from the MAX232 family can be used (if it can be found in consumer electronic shops at all). An alternative for DTR/DSR is also given below.

The circuitry is completed by connecting five capacitors to the IC as it follows. The MAX232 needs 1.0F capacitors, the MAX232A needs 0.1F capacitors. MAX232 clones show similar differences. It is recommended to consult the corresponding data sheet. At least 16V capacitor types should be used. If electrolytic or tantalic capacitors are used, the polarity has to be observed. The first pin as listed in the following table is always where the plus pole of the capacitor should be connected to.

Capacitor + Pin - Pin Remark C1 C2 1 4 3 5

C3 C4 C5

2 GND 16

16 6 GND This looks non-intuitive, but because pin 6 is

on -10V, GND gets the + connector, and not the -

The 5V power supply is connected to

+5V: Pin 16 GND: Pin 15 The output of the VT pin is high only when the transmission is valid. Otherwise it is low always. Output type: There are 2 types of output to select from: Momentary type: The data outputs follow the encoder during a valid transmission and the reset. Latch type: The data outputs follow the encoder during a valid

DC Motor
DC motors are configured in many types and sizes, including brush less, servo, and gear motor types. A motor consists of a rotor and a permanent magnetic field stator. The magnetic field is maintained using either permanent magnets or electromagnetic windings. DC motors are most commonly used in variable speed and torque.

Motion and controls cover a wide range of components that in some way are used to generate and/or control motion. Areas within this category include bearings and bushings, clutches and brakes, controls and drives, drive components, encoders and resolves, Integrated motion control, limit switches, linear actuators, linear and rotary motion components, linear position sensing, motors (both AC and DC motors), orientation position sensing, pneumatics and pneumatic components, positioning stages, slides and guides, power transmission (mechanical), seals, slip rings, solenoids, springs. Motors are the devices that provide the actual speed and torque in a drive system. This family includes AC motor types (single and multiphase motors, universal, servo motors, induction, synchronous, and gear motor) and DC motors (brush less, servo motor, and gear motor) as well as linear, stepper and air motors, and motor contactors and starters. In any electric motor, operation is based on simple electromagnetism. A currentcarrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion. Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization).

Fig 25: Block Diagram of the DC motor

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors (and all that Beamers will see), the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor (together with the axle and attached commutator) rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -- with the rotor inside the stator (field) magnets. The geometry of the brushes, commutator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, and driving it to continue rotating. In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque ripple" (the amount of torque it could produce is cyclic with the position of the rotor).

] Fig 26: Block Diagram of the DC motor having two poles only So since most small DC motors are of a three-pole design, let's tinker with the workings of one via an interactive animation (JavaScript required): Fig 27: Block Diagram of the DC motor having Three poles You'll notice a few things from this -- namely, one pole is fully energized at a time (but two others are "partially" energized). As each brush transitions from one commutator contact to the next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this occurs within a few microsecond). We'll see more about the effects of this later, but in the meantime you can see that this is a direct result of the coil windings' series wiring:

Fig 28: Internal Block Diagram of the Three pole DC motor

H-Bridge:

Fig: shows the H-Bridge operation. The H-Bridge consists of a four PNP transistors such as Q1, Q2, Q3 and Q4. These transistors are arranged in a way that a DC motor M can rotate. A and B are represented as two inputs for operating a motor through the transistors. For the circuit operation, we are providing +12V DC as a VCC. The operation will be explained as follows: The inputs A and B can be applied as a either logic 0 or logic 1 ie., may be either 5V DC voltage or Ground. If the input A =logic 0 and B=logic1 then transistors Q1 and Q4 will be ON state and Q2 and Q3 will be OFF state. The current flows from Q1 to Q4 so that the motor M can rotate in clockwise direction. If the input A =logic 1 and B=logic0 then transistors Q1 and Q4 will be OFF state and Q2 and Q3 will be ON state. The current flows from Q1 to Q4 so that the motor M can rotate in Anti-clockwise direction. If the input A =logic 1 and B=logic1 then transistors Q1 and Q4 will be OFF state and Q2 and Q3 will be OFF state. No current flows from in the circuit. The circuit will be in hold condition. The motor will not rotate any direction. So, there is no wastage of power will occur. Otherwise, if both inputs are low that is all transistors are come under

working and more current will flows in the circuit. But the motor will be at hold condition. More power is wasted

Power supply
The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply For example a 5V regulated power supply system as shown below:

Transformer:
A transformer is an electrical device which is used to convert electrical power from one Electrical circuit to another without change in frequency.

Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

An Electrical Transformer

Turns ratio = Vp/ VS = Np/NS Power Out= Power In VS X IS=VP X IP


Vp = primary (input) voltage Np = number of turns on primary coil Ip = primary (input) current

RECTIFIER:
A circuit which is used to convert a.c to dc is known as RECTIFIER. The process of conversion a.c to d.c is called rectification TYPES OF RECTIFIERS: Half wave Rectifier Full wave rectifier 1. Centre tap full wave rectifier. 2. Bridge type full bridge rectifier.

Comparison of rectifier circuits: Type of Rectifier Parameter Number of diodes 1 PIV of diodes Vm 2Vm Vm 2 4 Half wave Full wave Bridge

D.C output voltage Vdc,at no-load Ripple factor Ripple frequency Rectification efficiency Transformer Utilization Factor(TUF) RMS voltage Vrms

Vm/ 0.318Vm

2Vm/ 0.636Vm

2Vm/ 0.636Vm

1.21 f 0.406 0.287 Vm/2

0.482 2f 0.812 0.693 Vm/2

0.482 2f 0.812 0.812 Vm/2

Full-wave Rectifier:
From the above comparison we came to know that full wave bridge rectifier as more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit.

Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.
A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to achieve full-wave rectification. This is a widely used configuration, both with individual

diodes wired as shown and with single component bridges where the diode bridge is wired internally.

Fig(A)

Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b) with dotted arrows.

Fig(B) During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c) with dotted arrows.

Fig(C) Filter:
A Filter is a device which removes the a.c component of rectifier output but allows the d.c component to reach the load

Capacitor Filter:
We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Ripples can be removed by one of the following methods of filtering. (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due to low impedance. At ripple frequency and leave the d.c.to appears the load. (b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c)

(c) Various combinations of capacitor and inductor, such as L-section filter

section filter,

multiple section filter etc. which make use of both the properties mentioned in (a) and (b)

above. Two cases of capacitor filter, one applied on half wave rectifier and another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 RMS value). To calculate the value of capacitor(C), C = *3*f*r*Rl Where, f = supply frequency, r = ripple factor, Rl = load resistance Note: In our circuit we are using 1000F. Hence large value of capacitor is placed to reduce ripples and to improve the DC component.

Regulator:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.

Fig 6.1.6 A Three Terminal Voltage Regulator

78XX:
The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX offer several fixed output voltages making them useful in wide range of applications. When used as a zener diode/resistor combination replacement, the LM78XX usually results in an effective output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 & TO263packages,

Features:
Output Current of 1.5A Output Voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited No External Component Output Voltage 5.0V, 6V, 8V, 9V, 10V,12V, 15V, 18V, 24V Offer in plastic TO-252, TO-220 & TO-263 Direct Replacement for LM78XX

RF Encoder

RF transmitter section: RF transmitters are electronic devices that create continuously varying electric current, encode sine waves, and broadcast radio waves. RF transmitters use oscillators to create sine waves, the simplest and smoothest form of continuously varying waves, which contain information such as audio and video. Modulators encode these sign wives and antennas broadcast them as radio signals. There are several ways to encode or modulate this information, including amplitude modulation (AM) and frequency modulation (FM). Radio techniques limit localized interference and noise. With direct sequence spread spectrum, signals are spread over a large band by multiplexing the signal with a code or signature that modulates each bit. With frequency hopping spread spectrum, signals move through a narrow set of channels in a sequential, cyclical, and predetermined pattern. Selecting RF transmitters requires an understanding of modulation methods such as AM and FM. On-off key (OOK), the simplest form of modulation, consists of turning the signal on or off. Amplitude modulation (AM) causes the base band signal to vary the amplitude or height of the carrier wave to create the desired information content. Frequency modulation (FM) causes the instantaneous frequency of a sine wave carrier to depart from the center frequency by an amount proportional to the instantaneous value of the modulating signal. Amplitude shift key (ASK) transmits data by varying the amplitude of the transmitted signal. Frequency shift key (FSK) is a digital modulation scheme using two or more output frequencies. Phase shift key (PSK) is a digital modulation scheme in which the phase of the transmitted signal is varied in accordance with the base band data signal. Additional considerations when selecting RF transmitters include supply voltage, supply current, RF connectors, special features, and packaging. Some RF transmitters include visual or audible alarms or LED indicators that signal operating modes such as power on or reception. Other devices attach to coaxial cables or include a connector or port to which an antenna can be attached. Typically, RF transmitters that are rated for

outdoor use feature a heavy-duty waterproof design. Devices with internal calibration and a frequency range switch are also available. RF transmitters are used in a variety of applications and industries. Often, devices that are used with integrated circuits (ICs) incorporate surface mount technology (SMT), through hole technology (THT), and flat pack. In the telecommunications industry, RF transmitters are designed to fit in a metal rack that can be installed in a cabinet. RF transmitters are also used in radios and in electronic article surveillance systems (EAS) found in retail stores. Inventory management systems use RF transmitters as an alternative to barcodes. RF transmitter ST-TX01-ASK:
General Description: The ST-TX01-ASK is an ASK Hybrid transmitter module. The ST-TX01-ASK is designed by the Saw Resonator, with an effective low cost, small size, and simple-to-use for designing.

Frequency Range:
Supply Voltage: 3~12V. Output Power: Circuit Shape:

315 / 433.92 MHZ.

4~16dBm Saw

Applications Wireless security systems Car Alarm systems Remote controls. Sensor reporting

Automation systems

Fig 17: Pin Description of the Transmitter module

Fig 18: Interfacing TX module to a Micro controller RF ENCODER (HT12E): Features _ Operating voltage _ 2.4V~5V for the HT12A _ 2.4V~12V for the HT12E _ Low power and high noise immunity CMOS technology _ Low standby current: 0.1_A (typ.) at VDD=5V _ HT12A with a 38kHz carrier for infrared transmission medium _ Minimum transmission word _ Four words for the HT12E _ One word for the HT12A _ Built-in oscillator needs only 5% resistor _ Data code has positive polarity _ Minimal external components _ HT12A/E: 18-pin DIP/20-pin SOP package Applications _ Burglar alarm system _ Smoke and fire alarm system _ Garage door controllers _ Car door controllers

_ Car alarm system _ Security system _ Cordless telephones _ Other remote control systems General Description The 212 encoders are a series of CMOS LSIs for remote control system applications. They are capable of encoding information which consists of N address bits and 12_N data bits. Each address/data input can be set to one of the two logic states. The programmed addresses/data are transmitted together with the header bits via an RF or an infrared transmission medium upon receipt of a trigger signal. The capability to select a TE trigger on the HT12E or a DATA trigger on the HT12A further enhances the application flexibility of the 212 series of encoders. The HT12A additionally provides a 38kHz carrier for infrared systems.

Note: Address/Data represents pins that can be address or data according to the decoder requirement.

Fig 19: Block diagram of HT 12E Encoder

Pin Description:

Fig 20: Pin description of HT12E

Note: D8~D11 are all data input and transmission enable pins of the HT12A. TE is a transmission enable pin of the HT12E.

Absolute Maximum Ratings Supply Voltage (HT12A) .............._0.3V to 5.5V Storage Temperature................._50_C to 125_C Operating Temperature..............._20_C to 75_C

Supply Voltage (HT12E) ..............._0.3V to 13V Input Voltage....................VSS_0.3 to VDD+0.3V

Fig 21: Timing diagram of the HT12E and HT12A

Application Circuits:

Fig 22: Application circuit of HT12E

Flow Chart:

Fig 23: Flow chat for data transmission in HT12E RF receiver section: RF receivers are electronic devices that separate radio signals from one another and convert specific signals into audio, video, or data formats. RF receivers use an antenna to receive transmitted radio signals and a tuner to separate a specific signal from all of the other signals that the antenna receives. Detectors or demodulators then extract information that was encoded before transmission. There are several ways to decode or modulate this information, including amplitude modulation (AM) and frequency modulation (FM). Radio techniques limit localized interference and noise. With direct sequence spread spectrum, signals are spread over a large band by multiplexing the signal with a code or signature that modulates each bit. With frequency hopping spread spectrum, signals move through a narrow set of channels in a sequential, cyclical, and predetermined pattern.

Selecting RF receivers requires an understanding of modulation methods such as AM and FM. On-off key (OOK), the simplest form of modulation, consists of turning the signal on or off. Amplitude modulation (AM) causes the base band signal to vary the amplitude or height of the carrier wave to create the desired information content. Frequency modulation (FM) causes the instantaneous frequency of a sine wave carrier to depart from the center frequency by an amount proportional to the instantaneous value of the modulating signal. Amplitude shift key (ASK) transmits data by varying the amplitude of the transmitted signal. Frequency shift key (FSK) is a digital modulation scheme using two or more output frequencies. Phase shift key (PSK) is a digital modulation scheme in which the phase of the transmitted signal is varied in accordance with the base band data signal. RF receivers vary in terms of performance specifications such as sensitivity, digital sampling rate, measurement resolution, operating frequency, and communication interface. Sensitivity is the minimum input signal required to produce a specified output signal having a specified signal-to-noise (S/N) ratio. Digital sampling rate is the rate at which samples can be drawn from a digital signal in kilo samples per second. Measurement resolution is the minimum digital resolution, while operating frequency is the range of received signals. Communication interface is the method used to output data to computers. Parallel interfaces include general-purpose interface bus (GPIB), which is also known as IEEE 488 and HPIB Protocol. Serial interfaces include universal serial bus (USB), RS232, and RS485. Additional considerations when selecting RF receivers include supply voltage, supply current, receiver inputs, RF connectors, special features, and packaging. Some RF receivers include visual or audible alarms or LED indicators that signal operating modes such as power on or reception. Other devices attach to coaxial cables or include a connector or port to which an antenna can be attached. Typically, RF receivers that are rated for outdoor use feature a heavy-duty waterproof design. Devices with internal calibration and a frequency range switch are also available.

RF receiver ST-RX04-ASK: Description: The RX04 is a low power ASK receiver IC which is fully compatible with the MitelKESRX01 IC and is suitable for use in a variety of low power radio applications including remote keyless entry. The RX04 is based on a singleConversion, super-heterodyne receiver architecture and incorporates an entire phaselocked loop (PLL) for precise local oscillator generation.
Applications: Car security system Wireless security systems Sensor reporting automation system Remote Keyless entry

Features Low power consumption. Easy for application. On-Chip VCO with integrated PLL using crystal oscillator reference. Integrated IF and data filters. Operation temperature range : 1060 Operation voltage: 5 Volts. Available frequency at : 315/434 MHz

Functional description:

Fig: RF receiver module. Fig 24: RF receiver module. RF DECODER (HT 12D): Features _ Operating voltage: 2.4V~12V _ Low power and high noise immunity CMOS technology _ Low standby current _ Capable of decoding 12 bits of information _ Binary address setting _ Received codes are checked 3 times _ Address/Data number combination _ HT12D: 8 address bits and 4 data bits _ HT12F: 12 address bits only _ Built-in oscillator needs only 5% resistor _ Valid transmission indicator _ Easy interface with an RF or an infrared transmission medium _ Minimal external components _ Pair with Holteks 212 series of encoders _ 18-pin DIP, 20-pin SOP package Applications _ Burglar alarm system _ Smoke and fire alarm system _ Garage door controllers _ Car door controllers

_ Car alarm system _ Security system _ Cordless telephones _ Other remote control systems General Description The 212 decoders are a series of CMOS LSIs for remote control system applications. They are paired with Holteks 212 series of encoders (refer to the encoder/decoder cross reference table). For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. The decoders receive serial addresses and data from a programmed 212 series of encoders that are transmitted by a carrier using an RF or an IR transmission medium. They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. The VT pin also goes high to indicate a valid transmission. The 212 series of decoders are capable of decoding informations that consist of N bits of address and 12_N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data bits, and HT12F is used to decode 12 bits of address information.

Notes: Data type: L stands for latch type data output. VT can be used as a momentary data output.

Fig 25: Block Diagram of HT 12D Decoder Note: The address/data pins are available in various combinations (see the address/data table).

Pin Assignment:

Fig 26: Pin diagram of HT12D

Absolute Maximum Ratings Supply Voltage .........................................._0.3V to 13V Storage Temperature ............................_50_C to 125_C Input Voltage ................................VSS_0.3 to VDD+0.3V Operating Temperature..........................._20_C to 75_C

Functional Description Operation The 212 series of decoders provides various combinations of addresses and data pins in different packages so as to pair with the 212 series of encoders. The decoders receive data that are transmitted by an encoder and interpret the first N bits of code period as addresses and the last 12_N bits as data, where N is the address code number. A signal on the DIN pin activates the oscillator, which in turn decodes the incoming address and data. The decoders will then check the received address three times continuously. If the received address codes all match the contents of the decoders local address, the 12_N bits of data are decoded to activate the output pins and the VT pin is set high to indicate a valid transmission. This will last unless the address code is incorrect or no signal is received. The output of the VT pin is high only when the transmission is valid. Otherwise it is always low. Output type: Of the 212 series of decoders, the HT12F has no data output pin but its VT pin can be used as a momentary data output. The HT12D, on the other hand, provides 4 latch type data pins whose data remain unchanged until new data are received.

Fig 27: Timing Diagram of Decoder HT12D

Fig 28: Application circuit of HT12D

Flowchart The oscillator is disabled in the standby state and activated when a logic _high_ signal applies to the DIN pin. That is to say, the DIN should be kept low if there is no signal input.

Fig 29: Flow chart of HT12D for data transmission

Circuit description:
Main aim of the project is to control the speed of DC motor using RF, switches are provided at the transmitter section, speed will be increased for every switch, i.e., speed values are predefined for these switches. When the first switch is pressed, value of the switch is given to RF encoder, encoded data will be sent through the antenna connected to it. Transmitted switch value is received by antenna at the receiver, it is given to the decoder connected next to antenna, decoded data will be given to microcontroller through 4 data lines of the decoder, and this data is processed by the microcontroller and gives the signal to DC motor connected to the microcontroller. As first switch is pressed, motor will start slowly, as the next switch is pressed, speed is increased in steps. For giving supply to microcontroller, motor and other devices, we provide a power supply circuit.

SOFTWARE Components
ABOUT SOFTWARE Software used is: *Keil software for C programming *Express PCB for lay out design *Express SCH for schematic design KEIL Vision3 What's New in Vision3? Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2.

What is Vision3? Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor. A powerful debugger.

Express PCB Express PCB is a Circuit Design Software and PCB manufacturing service. One can learn almost everything you need to know about Express PCB from the help topics included with the programs given. Details: Express PCB, Version 5.6.0 Express SCH The Express SCH schematic design program is very easy to use. This software enables the user to draw the Schematics with drag and drop options. A Quick Start Guide is provided by which the user can learn how to use it. Details: Express SCH, Version 5.6.0 EMBEDDED C: The programming Language used here in this project is an Embedded C Language. This Embedded C Language is different from the generic C language in few things like a) b) Data types Access over the architecture addresses.

The Embedded C Programming Language forms the user friendly language with access over Port addresses, SFR Register addresses etc.

Embedded C Data types: Data Types unsigned char signed char unsigned int signed int sbit bit sfr Size in Bits 8-bit 8-bit 16-bit 16-bit 1-bit 1-bit 8-bit Data Range/Usage 0-255 -128 to +127 0 to 65535 -32,768 to +32,767 SFR bit addressable only RAM bit addressable only RAM addresses 80-FFH only

Unsigned char:
The unsigned char is an 8-bit data type that takes a value in the range of 0-255(00FFH). It is used in many situations, such as setting a counter value, where there is no need for signed data we should use the unsigned char instead of the signed char. Remember that C compilers use the signed char as the default if we do not put the key word

Signed char:
The signed char is an 8-bit data type that uses the most significant bit (D7 of D7D0) to represent the or + values. As a result, we have only 7 bits for the magnitude of the signed number, giving us values from -128 to +127. In situations where + and are needed to represent a given quantity such as temperature, the use of the signed char data type is a must.

Unsigned int:
The unsigned int is a 16-bit data type that takes a value in the range of 0 to 65535 (0000-FFFFH).It is also used to set counter values of more than 256. We must use the int data type unless we have to. Since registers and memory are in 8-bit chunks, the misuse of

int variables will result in a larger hex file. To overcome this we can use the unsigned char in place of unsigned int.

Signed int:
Signed int is a 16-bit data type that uses the most significant bit (D15 of D15-D0) to represent the or + value. As a result we have only 15 bits for the magnitude of the number or values from -32,768 to +32,767.

Sbit (single bit):


The sbit data type is widely used and designed specifically to access single bit addressable registers. It allows access to the single bits of the SFR registers. Accessing SFR addresses 80-FFH Another way to access the SFR RAM space 80-FFH is to use the sfr data type. This is shown in the below example .Both the bit and byte addresses for the P0-P3 ports are given in the table. Notice in the given example that there is no #include<reg51.h> statement which allows us to access any byte of the SFR RAM space 80-FFH. Single Bit Addresses of Ports P0 P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 Addr 80H 81H 82H 83H 84H 85H 86H 87H P1 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 Addr 90H 91H 92H 93H 94H 95H 96H 97H P2 P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 Addr A0H A1H A2H A3H A4H A5H A6H A7H P3 P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Addr B0H B1H B2H B3H B4H B5H B6H B7H Ports Bit D0 D1 D2 D3 D4 D5 D6 D7

DATA CONVERTION PROGRAMS IN EMBEDDED C


Many micro-controllers have a real time clock (RTC) where the time and date are kept even when the power is off. These time and date are often in packed BCD by RTC. To display them they must be converted to ASCII. So, in this topic we are showing application of logic and instructions in the conversion of BCD and ASCII. ASCII numbers On ASCII key boards, when the key 0 is activated, 0110000 (30h) is provided to the system. Similarly 31h (0110001) is provided for the key 1, and so on as shown in the table Packed BCD to ASCII conversion The RTC provides the time of day (hour, minutes, seconds) and the date (year, month, day) continuously, regardless of whether the power is ON or OFF. In the conversion procedure the packed BCD is first converted to unpacked BCD. Then it is tagged with 0110000 (30h). ASCII code for Digits 0-9 Key 0 1 2 3 4 5 6 7 8 9 ASCII (hex) 30 31 32 33 34 35 36 37 38 39 Binary 011 0000 011 0001 011 0010 011 0011 011 0100 011 0101 011 0110 011 0111 011 1000 011 1001 BCD (unpacked) 0000 0000 0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001

ASCII to packed BCD conversion To convert ASCII to packed BCD it is first converted to unpacked and then combined to make packed BCD. For example 4 and 7 on the keyboard give 34h and 37h respectively the goal is to produce 47h or 0100 0111 which is packed BCD. Key 4 7 ASCII 34 37 01000111 or 47h Checksum byte in ROM To ensure the integrity of ROM contents, every system must perform the checksum calculation. The process of checksum will detect any corruption of the contents of ROM. One of the cause of the ROM corruption is current surge either when the system is turned on or during operation. To ensure data integrity in ROM the checksum process uses, what is a checksum byte. The is an extra byte that is tagged to the end of the series of the of data. To calculate the checksum byte of a series of bytes of data, the following steps can be used 1) 2) Add the bytes together and drop the carries. Take the 2s complement of the total sum. This is the checksum byte , which unpacked BCD 00000100 00000111 packed BCD

becomes the last byte of the series

Binary (hex) to decimal and ASCII conversion in embedded C


In C-language we use a function call printf which is standard IO library function doing the conversions of data from binary to decimal, or vice versa. But here we are using our own functions for conversions because it occupies much of memory. One of the most commonly used is binary to decimal conversion. In devices such as ADC chips the data is provided to the controller in binary. In order to display binary data we need to convert it to decimal and then to ASCII. Since the hexadecimal format is a

convenient way of representing binary data we refer to binary data as hex. The binary data 00-FFH converted to decimal will give us 000 to 255. One way to do this is to divide it by 10 and keep the remainder, for example 11111101 or FDH is 253 in decimal. The following is one version of the algorithm for conversion of hex (binary) to decimal. Quotient FD/0A 19/0A 19 2 Remainder 3(low digit) LSD 5(middle digit) 2(high digit) (MSD)

Code:
Transmitter: #include<reg51.h>

sbit l1 = P2^0; sbit l2 = P2^1; sbit r1 = P2^2; sbit r2 = P2^3;

unsigned char i,j; bit flag =0,f;

void srrx() interrupt { if(RI==1) { i=SBUF; RI=0; } } void serinit()

{ TMOD = 0x20; TH1 = 0xFD; TL1 = 0xFD; SCON = 0x50;

void srstring(unsigned char value) { SBUF=value; while(TI==0); }

void delay(unsigned int value) { unsigned int i,j; for(i=0;i<=value;i++) for(j=0;j<=1275;j++); } void main() { delay(50); serinit(); ES=1;

while(1) {

if(i==8){P2=0x01;} if(i==2){ P2=0x02;} if(i==6){ P2=0x03;} if(i==4){ P2=0x04;}

} } Reciver:

#include <reg51.H>

unsigned char value,value1,x; sbit gas sbit = P2^0; = P2^2; = P2^3; = P2^4; = P2^5; = P2^5; tsop = P2^1;

sbit motor1 sbit motor2 sbit motor1 sbit motor2 sbit sbit buzzer

= P2^4;

#include<reg51.h>

sbit l1 = P2^0; sbit l2 = P2^1; sbit r1 = P2^2; sbit r2 = P2^3;

unsigned char i,j; bit flag =0,f;

void srrx() interrupt { if(RI==1) { i=SBUF; RI=0; } }

void serinit() { TMOD = 0x20; TH1 = 0xFD; TL1 = 0xFD; SCON = 0x50;

void srstring(unsigned char value) { SBUF=value; while(TI==0); }

void delay(unsigned int value) { unsigned int i,j; for(i=0;i<=value;i++) for(j=0;j<=1275;j++); }

void main() { unsigned char flag=0;

while (1) { if(P2==0x01){motor=1;motor2=1;); if(P2==0x02){motor=0;motor2=0;); if(P2==0x03){motor=1;motor2=0;); if(P2==0x04){motor=0;motor2=1;);

CONCLUSION
The project PC

based robot controlling using wireless

communication with ASK modulation has been successfully designed and tested.
Integrating features of all the hardware components used have developed it. Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced ICs and with the help of growing technology the project has been successfully implemented.

BIBLIOGRAPHY
NAME OF THE SITES: 1. 2. 3. 4. WWW.MITEL.DATABOOK.COM WWW.ATMEL.DATABOOK.COM WWW.FRANKLIN.COM WWW.KEIL.COM

REFERENCES 1. 8051-MICROCONTROLLER AND EMBEDDED SYSTEM. Mohd. Mazidi.

Você também pode gostar