Sei sulla pagina 1di 76

CONTENTS

1. ABSTRACT
2. INTRODUCTION
3. DETAILS ABOUT RADIO FREQUENCIES
4. DETAILS ABOUT MICROCONTROLLER
5. BLOCK DIAGRAM
6. INTRODUCTION TO SERIAL COMMUNICATION
7. CIRCUIT ANALYSIS
8. HARDWARE REQUIREMENT
9. SOFTWARE REQUIREMENT
10. FABRICATION DETAILS
11. CONCLUSION & REFERENCES
12. BIBLIOGRAPHY

ABSTRACT

In this project work the basic and essential concepts of radio communication
were utilized to create a wireless communication channel between two Computers. One
computer is placed at the transmitter section. In this section we can see the display of the
parameter values. The second computer is placed at the receiving end, where the
maintenance persons are monitoring the system. Here we can monitor the parameters
condition continuously. A PIC micro-controller (16f877A) and MAX232, RS232 are used
as interfacing units between the system and RF transmitter and also at the receiver
section.
The program code is written in Assembly language and the serial communication
concept is used to transfer the data. This project can be used as an alternate to wireless
communication.

1. INTRODUCTION
The project report describes on the design development and fabrication of one
demo unit of the project work Implementation of wireless communication between
computers.
Now a day, with the advancement technology, particularly in the field of Microcontrollers, all the activities in our daily living have become a part of Information
Technology and we find micro-controllers in each and every application. Thus, trend is
directing towards Microcontrollers Based Project works. However, in this project work,
the transferring of data serially is monitored. Subsequently, after serial processing, these
signals are encoded. This information is transmitted through RF transmitter. The received
information (using suitable RF receiver) is again decoded into digital signal at the
receiver end. Then the decisions are taken with the help of micro-controllers and
associated software.
The micro-controller block is playing a major role in this project work. The
Micro-controller chip is used in this project work is PIC 16f877A, and this is like heart of
the project work. The PIC micro-controller is 40 pin IC.
Micro controllers are embedded inside some other device so that they can
control the features or actions of the product. Another name for a micro-controller,
therefore, is Embedded Controller. Micro controllers are dedicated to one task and run
one specific program. The program is stored in ROM (read only memory) and generally
does not change. Micro controllers are often low-price devices. A battery operated microcontroller might consume 50 mille watts. A micro-controller has a dedicated input device
and often (but not always) has a small LED or LCD display for output. A micro-controller

also the input from the device it is controlling and controls the device by sending to
different components in the device.
Now coming to the project work, to obtain the parameter (transferring of data
serially between to computers) from transmitter to the receiver, where the serial data
transfer is monitored, the radio transmission technique is incorporated in the design. For
this Radio transmission, there are number of mechanisms by which Radio waves may
travel from a transmitting to a receiving antenna. The terms, GROUND WAVES, SKY
WAVES and SCOPE or TROPOSHERIC WAVES designates the more important of
these.
The ground wave can exist when the transmitting and receiving are close to
surface of the earth and are vertically polarized. The sky wave represents that reaches
receiving antenna as a result of a bending of the wave path introduced by the ionization in
the upper atmosphere. The space wave represents energy that travels from the
transmitting to the receiving antenna in the earth troposphere. The radio transmission at
frequencies above about 30MHz is normally the space wave propagation. The
transmitters that are frequency modulated find extensive use at frequencies use at
frequencies above 40MHz.

1.1 EMBEDDED SYSTEMS:


A system is something that maintains its existence and functions as a whole
through the interaction of its parts. E.g. Body, Mankind, Access Control, etc A system is a
part of the world that a person or group of persons during some time interval and for
some purpose choose to regard as a whole, consisting of interrelated components, each
component characterized by properties that are selected as being relevant to the purpose.

Embedded System is a combination of hardware and software used to achieve a


single specific task.

Embedded systems are computer systems that monitor, respond to, or control an
external environment.

Environment connected to systems through sensors, actuators and other I/O


interfaces.

Embedded system must meet timing & other constraints imposed on it by


environment.

An embedded system is a microcontroller-based, software driven, reliable, realtime control system, autonomous, or human or network interactive, operating on diverse
physical variables and in diverse environments and sold into a competitive and cost
conscious market. An embedded system is not a computer system that is used primarily
for processing, not a software system on PC or UNIX, not a traditional business or
scientific application. High-end embedded & lower end embedded systems. High-end
embedded system - Generally 32, 64 Bit Controllers used with OS. Examples Personal
Digital Assistant and Mobile phones etc. Lower end embedded systems - Generally 8,16
Bit Controllers used with a minimal operating systems and hardware layout designed for
the specific purpose. Examples Small controllers and devices in our every day life like
Washing Machine, Microwave Ovens, where they are embedded in.

2. DETAILS ABOUT RADIO FREQUENCIES

2.1 Radio Frequencies


A radio wave is an electromagnetic wave propagated by an antenna. Radio waves
have different frequencies, and by tuning a radio receiver to a specific frequency you can
pick up a specific signal.

Radio is a technology that allows the transmission of signals by modulation of


electromagnetic waves with frequencies those of light.
In todays economy, people are demanding more and more mobility to function
efficiently. To address this demand, companies are moving data by air instead of wire.
There are many applications in which it is more efficient to move data wirelessly. For this
reason, it is necessary to make communications between two PCs as easy as possible by
allowing people to move computers without moving wires. A communication client
program will interface with the users PC to send data to the wireless data link. On the
opposing end, a different user will use the second communications program to receive the
data from their data link. The data itself will be sent by RF waves from a transmitter
device to a receiver device. The RF transmission will be transparent to the users PCs as
if they were directly connected to each other using a RS232 crossover cable.

2.2 Implementation
To implement the wireless RS232 interface two different circuit boards will be
designed. The two boards will consist of a transmitter and receiver. The transmitter will
accept data from a RS232 (9-pin) of a PC port and transfer the information to RF signal.
The receiver will capture the RF signal, transferring it back to a digital signal, and finally
import it into the RS232 (9-pin) port of a PC. The purpose of the rest of this document is
to specify the integration of this RF technology.
2.3 Units
As the unit of frequency is the hertz (Hz), frequencies shall be expressed:
-

in kilohertz (kHz), up to and including 3000 kHz;

in megahertz (MHz), above 3 MHz, up to and including 3000 MHz;

in gigahertz (GHz), above 3 GHz, up to and including 3000 GHz.

3. DETAILS ABOUT MICROCONTROLLER


The micro-controller is a chip, which has a computer processor with all its support
function, memory (both program storage and RAM), and I/O built in to the device. These
built in functions minimize the need for external circuits and devices to design in the final
applications.
Most microcontrollers do not require a substantial amount of time to learn how to
efficiently program them, although many of then which have quirks which you will have
to understand before you attempt to develop your first application.
Along with micro-controllers getting faster, smaller and more power efficient they
are also getting more and more features. Often, the first version of micro-controller will
just have memory and digital I/O, but as the device family matures, more and more pat
numbers with varying features will be available.
With all the 8052 manufactures products taken into the account, there are over
two hundred different 8052 part numbers, each with different features and capabilities.
For most applications, we will be able to find a device within the family that meets our
specifications with a minimum of external devices, or an external but which will make
attaching external devices easier, both in terms of wiring and programming.
For many micro controllers, programmers can be built very cheaply, or even built
in to the final application circuit eliminating the need for a separate circuit. Also
simplifying this requirement is the availability of micro-controllers with SRAM and
EEPROM for control store, which will allow program development without having to
remove the micro controller from the application circuit.

4. BLOCK DIAGRAM

Figure 1 From MAX232 port of pc

Figure 2 To MAX232 port of pc

4.1 DESCRIPTION OF THE BLOCK DIAGRAM


The Block diagram of the project work Implementation of Wireless
Communication between two Computers is explained. For better understanding, the total
block diagram is divided into two various blocks and each block explanation is provided
in this chapter. The complete block diagram consists of the following blocks.
Functional Units
MAX232 Connector
Power Supply
Reset
Micro-controller
Encoder-Buffer
Decoder- Buffer
Serial Interface
Transmitter
Receiver
Antenna
4.1.1 Functional Units
The above figure conceptually displays the proposed system architecture for our
project. Each box represents a different functional unit. Each box will be described below
to give the reader a better understanding of this system.

4.1.2 MAX232 Connector


The MAX232 connector will be used to transfer data from the MAX232 (16-pin)
port of a PC to the input line converter. The connector will be a 90-degree flat mount
design that will allow the pins of a serial connection to be transferred to data lines in a PC
board. A typical model would be 182-09F-ND Right Angle D-Sub connector made by
Norcomp.
4.1.3 Power Supply
The AC main Block is the power supply which is of single phase 230V ac. This
should be given to step down transformer to reduce the 230V ac voltage to low voltage.
i.e., to 6V or 12V ac this value depends on the transformer inner winding. The output of
the transformer is given to the rectifier circuit. This rectifier converts ac voltage to dc
voltage. But the voltage may consist of ripples or harmonics.
To avoid these ripples the output of the rectifier is connected to filter. The filter
thus removes the harmonics. This is the exact dc voltage of the given specification. But
the controller operates at 5V dc and the relays and driver operates at 12V dc voltage. So
we need a regulator to reduce the voltage. 7805 regulator produces 5V dc and 7812
regulator produces 12V dc. Both are positive voltages.
4.1.4 Reset
The dual button switch will allow the user to start, stop, and reset the device as
they see fit. It will also have a data line going to the led to indicate if the circuit is on/Off.
4.1.5 Micro Controller

Micro controller is a true computer on a chip the design incorporates all of the
features found in a microprocessor CPU: arithmetic and logic unit, stack pointer, program
counter and registers. It has also had added additional features like RAM, ROM, Serial
I/O, counters and clock circuit.
4.1.6 Encoder-Buffer
The Encoder-Buffer is to be designed to condition the signal for the transmitter by
adding error detection and encoding. i.e. how 0s and 1s will be declared. One proposal
for is to use Manchester encoding. Manchester encoding uses logic of a high to low as 0
and low to high as a 1. That implies that every bit period is divided into two and insures
that the transaction from high to low or low to high is in the middle of each period. By
creating this phenomenon we allow the transmitter to synchronize with the receiver at
every bit. With this we will be able to maximize reliability and implement techniques to
assist in error detection.
4.1.7 Decoder-Buffer
The Decoder-Buffer is to be designed to condition the signal for the receiver by
checking for errors and reproducing the 1s and 0s by implementing the same logic as
the encoder. The decoder-buffer will synchronize with the encoder-buffer reading the
information, checking fore errors and sending it on to the serial interface.
4.1.8 Serial Interface
The serial interface on the transmitter will accept a data line from the MAX 232
connector and transfer it to TTL/CMOS standard logic level. The TTL/CMOS signal will
then be sent on a data line to the Encoder/Buffer. The serial interface on the receiver will

accept a data from the Decoder/Buffer and transfer it to TTL/CMOS standard logic level.
The TTL/CMOS signal will then be sent on a data line to the MAX232 Connector.

4.1.9 Transmitter
The transmitter will be an AM hybrid transmitter that operates at a frequency of
433.92 MHz. The transmitter accepts a TTL/CMOS signal on a data line from the
Encoder/Buffer and will output a signal to an antenna. The proposed transmitter is
manufactured in Italy by Telecontrolli s.p.a and supplied by Okwelectronics; part number
AMRT4-433.
4.1.10 Receiver
The receiver will be a AM SuperRegen Receiver Module that operates at a
frequency of 433.92MHz. The receiver accepts a signal from an antenna and will output
TTL/CMOS signal on a data line to the Decoder/Buffer. The proposed receiver is
manufactured in Italy by Telecontrolli s.p.a and supplied by Okwelecronics; part number
AMHRR3-433.
4.1.11 Antenna
User defined depending on required signal distance / power.

5. Serial Interface
The serial interface is comprised of a send and receive interface. The send
interface is accomplished by connecting a serial connector to the serial transmit pin,
ground and looping back the request to send (RTS) and clear to send (CTS) pins. Looping
the RTS and CTS pins allows the computer to effectively control its own handshaking.
The receive interface is accomplished by connecting to the receive pin of a second serial
interface rather than the transmit pin, and once again connecting the RTS and CTS pins.

>Amplitude Shift Keying


ASK- in the context of digital communications is a modulation process, which
imparts to a sinusoid two or more discrete amplitude levels. These are related to the
number of levels adopted by the digital message. For a binary message sequence there are
two levels, one of which is typically zero. Thus the modulated waveform consists of
bursts of a sinusoid binary ASK signal (lower), together with the binary sequence which
initiated it (upper). Neither signal has been band limited. There are sharp discontinuities
shown at the transition points. These result in the signal having an unnecessarily wide
bandwidth. Band limiting is generally introduced before transmission, in which case
these discontinuities would be round off. The band limiting may be applied to the
digital message, or the modulated signal itself. The data rate is often made a sub-multiple

of the carrier frequency. One of the disadvantages of ASK, compared with FSK and PSK,
for example, is that it has not got a constant envelope. This makes its processing (e.g.,
power amplification) more difficult, since linearity becomes an important factor.
However, it does make for ease of demodulation with an envelope detector.

>RF ASK Module 433.92MHz


Low Cost solution for Telemetry and Radio control. We have mini size transmitter
TWS434 and receiver RWS434 at frequencies. The transmitter speed is up to 3Kbps (uses
SAW device) and the receiver is 5Kbps (LC superregen). The operation range is up to
200 feet (70mts).

Transmitter

TWS-434 Pin Diagram


Receiver

RWS-434 Pin Diagram

POWER SUPPLY:

CIRCUIT DESCRIPTION
POWER SUPPLY:
Power supply unit consists of Step down transformer, Rectifier, Input filter,
Regulator unit, Output filter.
The Step down Transformer is used to step down the main supply voltage from
230V AC to lower value. This 230 AC voltage cannot be used directly, thus it is stepped
down. The Transformer consists of primary and secondary coils. To reduce or step down
the voltage, the transformer is designed to contain less number of turns in its secondary
core. The output from the secondary coil is also AC waveform. Thus the conversion from
AC to DC is essential. This conversion is achieved by using the Rectifier Circuit/Unit.
The Rectifier circuit is used to convert the AC voltage into its corresponding
DC voltage. There are Half-Wave, Full-Wave and bridge Rectifiers available for this
specific function. The most important and simple device used in Rectifier circuit is the
diode. The simple function of the diode is to conduct when forward biased and not to
conduct in reverse bias.
The Forward Bias is achieved by connecting the diodes positive with positive of
the battery and negative with batterys negative. The efficient circuit used is the Full
wave Bridge rectifier circuit. The output voltage of the rectifier is in rippled form, the
ripples from the obtained DC voltage are removed using other circuits available. The
circuit used for removing the ripples is called Filter circuit.
Capacitors are used as filter. The ripples from the DC voltage are removed and
pure DC voltage is obtained. And also these capacitors are used to reduce the harmonics
of the input voltage. The primary action performed by capacitor is charging and

discharging. It charges in positive half cycle of the AC voltage and it will discharge in
negative half cycle. Here we used 1000F capacitor. So it allows only AC voltage and
does not allow the DC voltage. This filter is fixed before the regulator. Thus the output is
free from ripples.
Regulator regulates the output voltage to be always constant. The output voltage
is maintained irrespective of the fluctuations in the input AC voltage. As and then the AC
voltage changes, the DC voltage also changes. Thus to avoid this Regulators are used.
Also when the internal resistance of the power supply is greater than 30 ohms, the output
gets affected. Thus this can be successfully reduced here. The regulators are mainly
classified for low voltage and for high voltage. Here we used 7805 positive regulator. It
reduces the 6V dc voltage to 5V dc Voltage.
The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often
used as filter. The principle of the capacitor is to charge and discharge. It charges during
the positive half cycle of the AC voltage and discharges during the negative half cycle. So
it allows only AC voltage and does not allow the DC voltage. This filter is fixed after the
Regulator circuit to filter any of the possibly found ripples in the output received finally.
Here we used 0.1F capacitor. The output at this stage is 5V and is given to the
Microcontroller
The output of the 7805 regulator is connected to PIC 16f877A microcontroller,
transmitter, receives.

CIRCUIT OPERATION
The input of the circuit is taken from the main. It is a single-phase 230V ac voltage.
This 230 AC voltage cannot be used directly, thus it is stepped down. The Step down
Transformer is used to step down the main supply voltage from 230V AC to lower value.
Because the microcontroller and sensors are operated at +5V dc voltage and relays and
drivers will be operate at +12V dc voltage. So first this 230C AC voltage should be
stepped down and then it should be converted to dc. After converting to dc it is applied to
controller, sensors, relays and drivers. In this project we used 230/12V step down
transformer. The output of 7805 regulator is given to PIC microcontroller and three
sensors. The main part of this project is PIC micro controller.
>Encoder
An encoder is a circuit in which a code or signal presented in one format can be
changed to format compatible with the circuitry it interfaces with. In case of the TX-01
the format delivered by the user is a 12-bit parallel code consisting of 8 address bits and 4
data bits. This code must be changed to a serial format in order to become compatible
with the transmitters input. This is the job of the TX-01 encoder motherboard, or more
specifically, the HT12E encoder IC found on the TX-01 encoder motherboard (an
encoder is already built-in to the TX-99K4A).
>Transmitter
A transmitter is a circuit with an output sent through the air by light, sound or
electromagnetic waves at a specific frequency. In the case of the TX-99K4A, the output is
an amplitude modulated radio frequency of 300MHz. The transmitter receives a coded
signal from the encoder and uses that signal to modulate its 300MHz carrier. In simple

terms, the output of the transmitter is an electromagnetic representation of the input data
code.
>Receiver
A receiver is a circuit capable of accepting and processing light, sound, or
electromagnetic waves of a specific frequency. In the case of the RE-99, the 300MHz
radio frequency signal sent by the transmitter is received, and the incoming data extracted
from that signal. The extracted data is then sent out in serial format to the decoder board.
>Decoder
A Decoder is a circuit in which a coded signal of a specific format (usually that of
its compatible encoder) is received and changed to a format compatible with the circuitry
it interfaces with (usually the format originally presented to the encoder is the same
format used for the output of the decoder when used in wireless systems, but not always).
In the case of the RE-01, the incoming code is a 12 bit serial format. This code must be
checked to ensure that the first 8 bits (address bits) match the address of the decoder IC.
This is the job of the RE-01 decoder motherboard, or more specifically, the HT12D
decoder IC. Found on the RE-01 decoder motherboard.
If the incoming 8 bit address is correct, the last 4 bits of the 12 bit code (data bits)
are passed on to the data outputs of the RE-01, and the Valid ID relay closes and remains
closed until the incoming signal is no longer present. The 4 data bits, however, latch and
remain in whatever state they were set to by the last transmission, until they are changed
by the next transmission.

INTRODUCTION TO SERIAL COMMUNICATION


All IBM PC and compatible computers are typically equipped with two serial
ports and one parallel port. Although these two types of ports are used for communicating
with external devices, they work in different ways. A parallel port sends and receives data
eight bits at a time over 8 separate wires. This allows data to be transferred very quickly;
however, the cable required is more bulky because of the number of individual wires it
must contain. Parallel ports are typically used to connect a PC to a printer and are rarely
used for much else. A serial port sends and receives data one bit at a time over one wire.
While it takes eight times as long as to transfer each byte of data this way, only a few
wires are required. In fact, two-way (full duplex) communications is possible with only
three separate wires- one to send, one to receive, and a common signal ground wire.
Bi-directional communications
Communicating by wires
The Parity Bit
Cable lengths
MAX-232C
DCE And DTE devices
9 pin to 25 pin Adapters
Synchronous and Asynchronous Communications
>Bi-directional Communications
The serial port on your PC is a full-duplex device meaning that it can send and
receive data at the same time. In order to be able to do this, it uses separate lines for
transmitting and receiving data. Some types of serial devices support only one-way

communications and therefore use only two-wires in the cable the transmit line and the
signal ground.
>Communicating by bits
Once the start bit has been sent, the transmitter sends the actual data bits. There
may either be 5,6,7, or 8 data bits, depending on the number you have selected. Both
receiver and the transmitter must agree on the number of data bits, as well as the baud
rate. Almost all devices transmit data using either 7 or 8 data bits. Notice that when only
7 data bits are employed, you cannot send ASCII values greater than 127. Likewise, using
5 bits limits the highest possible value to 31. After the data has been transmitted, a stop
bit is sent. A stop bit has a value of 1- or a mark state- and it can be detected correctly
even if the previous data bit also had a value of 1. This is accomplished by the stop bits
duration.
>The Parity Bit
Besides the synchronization provided by the use of start and stop bits, an
additional bit called a parity bit may optionally be transmitted along with the data. A
parity bit affords a small amount of error checking, to help detect data corruption that
might occur during transmission.
>Cable Lengths
The MAX-232 standard imposes a cable length limit of 50 feet. You can usually
ignore this standard, since a cable can be as long as 10000 feet at baud rates up to
19200 if you use a high quality, well shielded cable. The external environment has a large
effect on lengths for unshielded cables.

>MAX232 (Voltage Converter)


Since the RS232 is not compatible with todays microprocessors and micro
controller, we need line driver to convert the RS232 signals to TTL voltage levels that
will be acceptable to the 8051s TXD and RXD pins. One example of such a converter is
MAX 232 from maxim corp. The MAX 232 converts from RS232 voltage levels to TTL
voltage levels, and vice versa. One advantage of MAX232 chip is that it uses a +5V
power source, which is the same as the source voltage for the PIC 16f877A micro
controller. In other words, with a single +5v power supply we can power both the PIC
and MAX 232, with no need of for the dual power supplies that are common in many
older systems. The MAX 232 requires four capacitors ranging from 1 to 22 microfarad.
The most widely used value for this capacitor is 22microfarad.
PIN DIAGRAM OF MAX232:

>DCE and DTE devices


Two terms you should be familiar with are DTE and DCE. DTE stands for Data
Terminal Equipment, and DCE stands for Data Communication Equipment. These terms
are used to indicate the pin-out for the connectors on a device and the direction of the
signals on the pins. Your computer is a DTE device, while most other devices are usually
DCE devices. If you have trouble keeping the two straight then replace the term DTE
device with your PC and the term DCE device with remote Device in the following
discussion. The RS-232 standard states that DTE devices use a 25-pin male connector,
and DCE devices use a 25-pin female connector. You can therefore connect a DTE device
to a DCE using a straight pin-for-pin connection. However, to connect two like devices,
you must instead use a null modem cable. Null modem cables cross the transmit and
receive lines in the cable.
The DTE device puts this line in a mark condition to tell the remote device that it
is ready and able to receive data. If the DTE device is not able to receive data (typically
because its receive buffer is almost full), it will put this line in the space condition as a
signal to the DCE to stop sending data. When the DTE device is ready to receive more
data it will place this line back in the mark condition. The complement of the RTS wire is
CTS, which stands for Clear to Send. The DCE device puts this line in a mark condition
to tell the DTE device that it is ready to receive the data. Likewise, if the DCE device is
unable to receive data, it will place this line in the space condition. Together, these two
lines make up what is called RTS/CTS or hardware flow control. The software wedge
supports this type of flow control as well as Xon/Xoff or software flow control.
Software flow control uses special control characters transmitted from one device to

another to tell the other device to stop or start sending data. With software flow control
the RTS and CTS lines are not used.
DTR stands for Data Terminal Ready. Its intended function is very similar to the
RTS line. DSR (Data Set Ready) is the companion to DTR in the same way that CTS is to
RTS. Some serial devices use DTR and DSR as signals to simplify confirm that a device
is connected and turned on. The software wedge sets DTR to the mark state when the
serial port is opened and leaves it in that state until the port is closed. The DTR and DSR
lines were originally designed to provide an alternate method of hardware handshaking. It
would be pointless to use both RTS/CTS and DTR/DSR for flow control signals at the
same time. Because of this DTR and DSR are rarely used for flow control.

>Synchronous and Asynchronous Communications


There are two basic types of serial communications, synchronous and
asynchronous. With synchronous communications, the two devices initially synchronize
themselves to each other, and then continually send characters to stay in sync. Even when
the data is not really being sent, a constant flow of bits allows each device to know where
the other is at any given time. That is, each character that is sent is either actual data or an
idle character. Synchronous communications allows faster data transfer rates than
asynchronous methods, because additional bits to mark the beginning and end of each
data byte are not required. The serial ports on IBM style PCs are asynchronous devices
and therefore only support asynchronous serial communications. Asynchronous means no
synchronization, and thus does not require sending and receiving idle characters.
However, the beginning and end of each byte of data must be identified by start and stop

bits. The start bit indicates when the data byte is about to begin and the stop bit signals
when it ends. The requirement to send these additional two bits causes asynchronous
communication to be slightly slower than synchronous however it has the advantage that
the processor does not have to deal with the additional idle characters.

CODING
TRANSMITTER
#include<pic.h>
unsigned int j,RX;
void delay();
//__CONFIG(WDTDIS & XT & PWRTEN & BOREN & LVPDIS);
void main()
{
TRISC=0x80;

SPBRG=207;
BRGH=1;
RCSTA=0X90;
TXSTA=0X24;

GIE=PEIE=RCIE=1;
while(1)
{
TXREG=0;
while(!TRMT);
delay();
}
}

void interrupt isr()


{
if(RCIF==1)
{
RCIF=0;
RX=RCREG;
TXREG=RX;
while(!TRMT);
}
}
void delay()
{
for(j=0;j<=400;j++);
}

RECEIVER
#include<pic.h>
unsigned int j,RX;
void delay();
//__CONFIG(WDTDIS & XT & PWRTEN & BOREN & LVPDIS);
void main()
{
TRISC=0x80;
SPBRG=207;
BRGH=1;

RCSTA=0X90;
TXSTA=0X24;
GIE=PEIE=RCIE=1;
while(1)
{
while(RX==0);
TXREG=RX;
while(!TRMT);
RX=0;
}
}

void interrupt isr()


{
if(RCIF==1)
{
RCIF=0;
RX=RCREG;
}
}
void delay()
{
for(j=0;j<=400;j++);
}

Installing coding into PIC microcontroller:


1. Write the program in MPLAB IDE.
2. Save the file as *.c. and compile it.
3. After successful compilation of the coding close the MPLAB IDE.
4. Fix the Controller IC into PIC Flash kit.
5. Then click on Micro controller Micro Systems PIC Flash Software Icon on the
desktop.
6. It displays on dialog box. Then select open and select the program which we
already saved as *.c.
7. Then it asks the Confirmation that The IC is empty, select ok.
8. Then it asks Fuses Settings, select YES
9. Then it displays Fuses Settings Dialog Box.
10. In that put WDT -- > Disabled, WRT-- > Enabled, Oscillator-- > XT then click on
OK.
11. Then it displays the Program successfully installed into PIC.
12. Then Remove the IC from the PIC Flash and it is ready for used into the project
or circuit operation.

Hardware Requirements:
1. Power supply unit
2. Micro controller
3. MAX 232 IC
4. Serial Interface
5. Transmitter and Receiver
POWER SUPPLY UNIT:
Circuit Diagram

Power supply unit consists of following units


i) Step down transformer
ii) Rectifier unit
iii) Input filter
iv) Regulator unit
v) Output filter

STEPDOWN TRANSFORMER:
The Step down Transformer is used to step down the main supply voltage from
230V AC to lower value. This 230 AC voltage cannot be used directly, thus it is stepped
down. The Transformer consists of primary and secondary coils. To reduce or step down
the voltage, the transformer is designed to contain less number of turns in its secondary
core. The output from the secondary coil is also AC waveform. Thus the conversion from
AC to DC is essential. This conversion is achieved by using the Rectifier Circuit/Unit.
RECTIFIER UNIT:
The Rectifier circuit is used to convert the AC voltage into its corresponding DC
voltage. There are Half-Wave, Full-Wave and bridge Rectifiers available for this specific
function. The most important and simple device used in Rectifier circuit is the diode. The
simple function of the diode is to conduct when forward biased and not to conduct in
reverse bias.
The Forward Bias is achieved by connecting the diodes positive with positive of
the battery and negative with batterys negative. The efficient circuit used is the Full
wave Bridge rectifier circuit. The output voltage of the rectifier is in rippled form, the
ripples from the obtained DC voltage are removed using other circuits available. The
circuit used for removing the ripples is called Filter circuit.
INPUT FILTER:
Capacitors are used as filter. The ripples from the DC voltage are removed and
pure DC voltage is obtained. And also these capacitors are used to reduce the harmonics
of the input voltage. The primary action performed by capacitor is charging and
discharging. It charges in positive half cycle of the AC voltage and it will discharge in

negative half cycle. So it allows only AC voltage and does not allow the DC voltage. This
filter is fixed before the regulator. Thus the output is free from ripples.
REGULATOR UNIT:

7805 Regulator
Regulator regulates the output voltage to be always constant. The output voltage
is maintained irrespective of the fluctuations in the input AC voltage. As and then the AC
voltage changes, the DC voltage also changes. Thus to avoid this Regulators are used.
Also when the internal resistance of the power supply is greater than 30 ohms, the output
gets affected. Thus this can be successfully reduced here. The regulators are mainly
classified for low voltage and for high voltage. Further they can also be classified as:
i) Positive regulator
1---> input pin
2---> ground pin
3---> output pin
It regulates the positive voltage.
ii) Negative regulator
1---> ground pin
2---> input pin
3---> output pin
It regulates the negative voltage.

OUTPUT FILTER:
The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often
used as filter. The principle of the capacitor is to charge and discharge. It charges during
the positive half cycle of the AC voltage and discharges during the negative half cycle. So
it allows only AC voltage and does not allow the DC voltage. This filter is fixed after the
Regulator circuit to filter any of the possibly found ripples in the output received finally.
Here we used 0.1F capacitor. The output at this stage is 5V and is given to the
Microcontroller.
MICRO CONTROLLER:
A computer-on-a-chip is a variation of a microprocessor which combines the
processor core (CPU), some memory, and I/O (input/output) lines, all on one chip. The
computer-on-a-chip is called the microcomputer whose proper meaning is a computer
using a (number of) microprocessor(s) as its CPUs, while the concept of the
microcomputer is known to be a microcontroller. A microcontroller can be viewed as a
set of digital logic circuits integrated on a single silicon chip. This chip is used for only
specific applications.
ADVANTAGES OF USING A MICROCONTROLLER OVER
MICROPROCESSOR:
A designer will use a Microcontroller to
1. Gather input from various sensors
2. Process this input into a set of actions
3. Use the output mechanisms on the Microcontroller to do something useful

4. RAM and ROM are inbuilt in the MC.


5. Cheap compared to MP.
6. Multi machine control is possible simultaneously.
Examples:
8051 (ATMAL), PIC (Microchip), Motorola (Motorola), ARM Processor,
Applications:
Cell phones, Computers, Robots, Interfacing to two pcs.
Microcontroller Core Features:
High-performance RISC CPU.
Only 35 single word instructions to learn.
All single cycle instructions except for program branches which are two cycle.
Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle.
Up to 8K x 14 words of FLASH Program Memory, Up to 368 x 8 bytes of Data
Memory (RAM) Up to 256 x 8 bytes of EEPROM data memory.
Pin out compatible to the PIC16C73B/74B/76/77
Interrupt capability (up to 14 sources)
Eight level deep hardware stack
Direct, indirect and relative addressing modes.
Power-on Reset (POR).
Power-up Timer (PWRT) and Oscillator Start-up Timer (OST).
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
Programmable code-protection.

Power saving SLEEP mode.


Selectable oscillator options.
Low-power, high-speed CMOS FLASH/EEPROM technology.
Fully static design.
In-Circuit Serial Programming (ICSP) .
Single 5V In-Circuit Serial Programming capability.
In-Circuit Debugging via two pins.
Processor read/write access to program memory.
Wide operating voltage range: 2.0V to 5.5V.
High Sink/Source Current: 25 mA.
Commercial and Industrial temperature ranges.
Low-power consumption.
In this project we used PIC 16f877A microcontroller. PIC means Peripheral Interface
Controller. The PIC family having different series. The series are 12- Series, 14- Series,
16- Series, 18- Series, and 24- Series. We used 16 Series PIC microcontroller.

Pic Microcontroller 16F877A:

Operating frequency: DC-20Mhz.

Flash program memory(14 bit words):8K

Data memory(in bytes):368

EEPROM Data memory(in bytes):256

Interrupts:15

I/o ports: A,B,C,D,E

Timers:3

Analog comparators:2

Instructions:35

PIN DIAGRAM OF PIC 16F874A/877A:

FUNCTIONAL BLOCK DIAGRAM OF PIC 16F877A

DESIGN OF EMBEDDED SYSTEM


Like every other system development design cycle embedded system too have a
design cycle. The flow of the system will be like as given below. For any design cycle
these will be the implementation steps. From the initial state of the project to the final
fabrication the design considerations will be taken like the software consideration and the
hardware components, sensor, input and output. The electronics usually uses either a
microprocessor or a microcontroller. Some large or old systems use general-purpose
mainframe computers or minicomputers.
User Interfaces:
User interfaces for embedded systems vary widely, and thus deserve some special
comment. User interface is the ultimate aim for an embedded module as to the user to
check the output with complete convenience. One standard interface, widely used in
embedded systems, uses two buttons (the absolute minimum) to control a menu system
(just to be clear, one button should be "next menu entry" the other button should be
"select this menu entry").
Another basic trick is to minimize and simplify the type of output. Designs
sometimes use a status light for each interface plug, or failure condition, to tell what
failed. A cheap variation is to have two light bars with a printed matrix of errors that they
select- the user can glue on the labels for the language that he speaks. For example, most
small computer printers use lights labeled with stick-on labels that can be printed in any
language. In some markets, these are delivered with several sets of labels, so customers
can pick the most comfortable language.

In many organizations, one person approves the user interface. Often this is a
customer, the major distributor or someone directly responsible for selling the system.
PLATFORM:
There are many different CPU architectures used in embedded designs such as
ARM, MIPS, Coldfire/68k, PowerPC, X86, PIC, 8051, Atmel AVR, H8, SH, V850, FRV, M32R etc.
This in contrast to the desktop computer market, which as of this writing (2003) is
limited to just a few competing architectures, mainly the Intel/AMD x86, and the
Apple/Motorola/IBM PowerPC, used in the Apple Macintosh. With the growing
acceptance of Java in this field, there is a tendency to even further eliminate the
dependency on specific CPU/hardware (and OS) requirements.
Standard PC/104 is a typical base for small, low-volume embedded and ruggedized
system design. These often use DOS, Linux or an embedded real-time operating system
such as QNX or Inferno.
A common configuration for very-high-volume embedded systems is the system
on a chip, an application-specific integrated circuit, for which the CPU was purchased as
intellectual property to add to the IC's design. A related common scheme is to use a fieldprogrammable gate array, and program it with all the logic, including the CPU. Most
modern FPGAs are designed for this purpose.
Tools:
Like typical computer programmers, embedded system designers use compilers,
assemblers, and debuggers to develop embedded system software. However, they also
use a few tools that are unfamiliar to most programmers.

Software tools can come from several sources:

Software companies that specialize in the embedded market.

Ported from the GNU software development tools.


Sometimes, development tools for a personal computer can be used if the

embedded processor is a close relative to a common PC processor. Embedded system


designers also use a few software tools rarely used by typical computer programmers.
One common tool is an "in-circuit emulator" (ICE) or, in more modern designs,
an embedded debugger. This debugging tool is the fundamental trick used to develop
embedded code. It replaces or plugs into the microprocessor, and provides facilities to
quickly load and debug experimental code in the system. A small pod usually provides
the special electronics to plug into the system. Often a personal computer with special
software attaches to the pod to provide the debugging interface.
Another common tool is a utility program (often home-grown) to add a checksum
or CRC to a program, so it can check its program data before executing it.
An embedded programmer that develops software for digital signal processing
often has a math workbench such as MathCad or Mathematica to simulate the
mathematics.
Less common are utility programs to turn data files into code, so one can include
any kind of data in a program. A few projects use Synchronous programming languages
for extra reliability or digital signal processing.
DEBUGGING:
Debugging is usually performed with an in-circuit emulator, or some type of
debugger that can interrupt the microcontroller's internal microcode. The microcode

interrupt lets the debugger operate in hardware in which only the CPU works. The CPUbased debugger can be used to test and debug the electronics of the computer from the
viewpoint of the CPU. This feature was pioneered on the PDP-11.
As the complexity of embedded systems grows, higher level tools and operating
systems are migrating into machinery where it makes sense. For example, cell phones,
personal digital assistants and other consumer computers often need significant software
that is purchased or provided by a person other than the manufacturer of the electronics.
In these systems, an open programming environment such as Linux, OSGi or Embedded
Java is required so that the third-party software provider can sell to a large market.
OPERATING SYSTEM:
Embedded systems often have no operating system, or a specialized embedded
operating system (often a real-time operating system), or the programmer is assigned to
port one of these to the new system.
BUILT- IN SELF- TEST:
Most embedded systems have some degree or amount of built-in self-test.
There are several basic types.
1. Testing the computer.
2. Test of peripherals.
3. Tests of power.
4. Communication tests.
5. Cabling tests.
6. Rigging tests.
7. Consumables test.

8. Operational test.
9. Safety test.
START UP:
All embedded systems have start-up code. Usually it disables interrupts, sets up
the electronics, tests the computer (RAM, CPU and software), and then starts the
application code. Many embedded systems recover from short-term power failures by
restarting (without recent self-tests). Restart times under a tenth of a second are common.
Many designers have found a few LEDs useful to indicate errors (they help
troubleshooting). A common scheme is to have the electronics turn on all of the LED(s) at
reset (thereby proving that power is applied and the LEDs themselves work), whereupon
the software changes the LED pattern as the Power-On Self Test executes. After that, the
software may blink the LED(s) or set up light patterns during normal operation to
indicate program execution progress or errors. This serves to reassure most
technicians/engineers and some users. An interesting exception is that on electric power
meters and other items on the street, blinking lights are known to attract attention and
vandalism.

Software Tools:
1. MPLAB
2. Protel
3. Propic
4. HI-Tech PIC C Compiler
MPLAB Integration:
MPLAB Integrated Development Environment (IDE) is a free, integrated toolset for
the development of embedded applications employing Microchip's PIC micro and dsPIC
microcontrollers. MPLAB IDE runs as a 32-bit application on MS Windows, is easy to
use and includes a host of free software components for fast application development and
super-charged debugging. MPLAB IDE also serves as a single, unified graphical user
interface for additional Microchip and third party software and hardware development
tools. Moving between tools is a snap, and upgrading from the free simulator to MPLAB
ICD 2 or the MPLAB ICE emulator is done in a flash because MPLAB IDE has the same
user interface for all tools.
Choose MPLAB C18, the highly optimized compiler for the PIC18 series
microcontrollers, or try the newest Microchip's language tools compiler, MPLAB C30,
targeted at the high performance PIC24 and dsPIC digital signal controllers. Or, use one
of the many products from third party language tools vendors. They integrate into
MPLAB IDE to function transparently from the MPLAB project manager, editor and
compiler.

INTRODUCTION TO EMBEDDED C:
Ex: Hitec c, Keil c
HI-TECH Software makes industrial-strength software development tools and C
compilers that help software developers write compact, efficient embedded processor
code.
For over two decades HI-TECH Software has delivered the industry's most
reliable embedded software development tools and compilers for writing efficient and
compact code to run on the most popular embedded processors. Used by tens of
thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere
and many others, HI-TECH's reliable development tools and C compilers, combined with
world-class support have helped serious embedded software programmers to create
hundreds of breakthrough new solutions.
Whichever embedded processor family you are targeting with your software,
whether it is the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help
you write better code and bring it to market faster.
HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro
10/12/14/16/17 series of microcontrollers. HI-TECH PICC is an industrial-strength ANSI
C compiler - not a subset implementation like some other PIC compilers. The PICC
compiler implements full ISO/ANSI C, with the exception of recursion. All data types are
supported including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes
full use of specific PIC features and using an intelligent optimizer, can generate highquality code easily rivaling hand-written assembler. Automatic handling of page and bank
selection frees the programmer from the trivial details of assembler code.

Embedded C Compiler:

ANSI C - full featured and portable

Reliable - mature, field-proven technology

Multiple C optimization levels

An optimizing assembler

Full linker, with overlaying of local variables to minimize RAM usage

Comprehensive C library with all source code provided

Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data
types

Mixed C and assembler programming

Unlimited number of source files

Listings showing generated assembler

Compatible - integrates into the MPLAB IDE, MPLAB ICD and most 3rd-party
development tools

Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, Solaris

Embedded Development Environment:


PICC can be run entirely from the. This environment allows you to manage all of
your PIC projects. You can compile, assemble and link your embedded application with a
single step.

Optionally, the compiler may be run directly from the command line, allowing
you to compile, assemble and link using one command. This enables the compiler to be
integrated into third party development environments, such as Microchip's MPLAB IDE.
Embedded system tools:
Assembler:
An assembler is a computer program for translating assembly language
essentially, a mnemonic representation of machine language into object code. A cross
assembler (see cross compiler) produces code for one type of processor, but runs on
another. The computational step where an assembler is run is known as assembly time.
Translating assembly instruction mnemonics into opcodes, assemblers provide the ability
to use symbolic names for memory locations (saving tedious calculations and manually
updating addresses when a program is slightly modified), and macro facilities for
performing textual substitution typically used to encode common short sequences of
instructions to run inline instead of in a subroutine. Assemblers are far simpler to write
than compilers for high-level languages.
Assembly language has several benefits:

Speed: Assembly language programs are generally the fastest programs around.

Space: Assembly language programs are often the smallest.

Capability: You can do things in assembly which are difficult or impossible in


High level languages.

Knowledge: Your knowledge of assembly language will help you write better
programs, even when using High level languages. An example of an assembler we
use in our project is RAD 51.

Simulator:
Simulator is a machine that simulates an environment for the purpose of training or
research. We use a UMPS simulator for this purpose in our project.
UMPS:
Universal microprocessor program simulator simulates a microcontroller with its external
environment. UMPS is able to simulate external components connected to the
microcontroller. Then, debug step is dramatically reduced. UMPS is not dedicated to only
one microcontroller family, it can simulate all kind of microcontrollers. The main
limitation is to have less than 64K-Bytes of RAM and ROM space and the good
microcontroller library. UMPS provide all the facilities other low-cost simulator does not
have. It offers the user to see the "real effect" of a program and a way to change the
microcontroller family without changing IDE. UMPS provide a low-cost solution to the
problems. UMPS is really the best solution to your evaluation.
UMPS key features:
-The speed, UMPS can run as fast as 1/5 the real microcontroller speed. No need to wait
2 days to see the result of a LCD routine access. All the microcontroller parts are
simulated, interrupts, communication protocol, parallel handshake, timer and so on.
- UMPS have an integrated assembler/disassembler and debugger. It is able to accept an
external assembler or compiler. It has a text editor which is not limited to 64K-bytes and

shows keyword with color. It can also communicate with an external compiler to
integrate all the debug facilities you need.
- UMPS is universal, it can easily be extended to other microcontroller with a library. Ask
us for toolkit development.
- External resource simulation is not limited. It can be extended to your proper needs by
writing your own DLL.
- UMPS allows you to evaluate at the lowest cost the possibility to build a
microcontroller project without any cable. - UMPS include a complete documentation on
each microcontroller which describe special registers and each instruction
Compiler:
A compiler is a program that reads a program in one language, the source language and
translates into an equivalent program in another language, the target language. The
translation process should also report the presence of errors in the source program.

Source

Target

Compiler

Program

Program

Error
Messages

There are two parts of compilation. The analysis part breaks up the source program into
constant piece and creates an intermediate representation of the source program. The
synthesis part constructs the desired target program from the intermediate representation.

The cousins of the compiler are:


1. Preprocessor.
2. Assembler.
3. Loader and Link-editor.
A naive approach to that front end might run the phases serially.
1. Lexical analyzer takes the source program as an input and produces a long
string of tokens.
2. Syntax Analyzer takes an out of lexical analyzer and produces a large tree.
Semantic analyzer takes the output of syntax analyzer and produces another tree.
Similarly, intermediate code generator takes a tree as an input produced by semantic
analyzer and produces intermediate code

Phases of compiler:
The compiler has a number of phases plus symbol table manager and an error handler.

Input Source
Program

Lexical
Analyzer

Syntax
Analyzer

Symbol
Semantic

Error

Analyzer

Handler

Table
Manager

Intermediate
Code

Generator

Code
Optimizer

Code
Generator

Out Target
Program

COMPONENTS USED:
1. Step Down Transformer (230/12V) 1 No.
2. Diodes (1N4007) 4 No
3.

Capacitors - 1000F 1 No, 22pF- 10 Nos

4. Regulators 7805 1 No
5. PIC micro controller (16f877A) 2 No
6. Crystal Oscillator (4MHz) 2 Nos
7. MAX232 Connectors 2Nos
8. Reset
9. Encoder-Buffer HT-12EIC
10. Decoder-Buffer HT-12D IC
11. Serial Interface
12. Transmitter TWS434
13. Receiver RWS434

FABRICATION DETAILS
The fabrication of one demonstration unit is carried out in the following sequence.
Finalizing the total circuit diagram, listing out the components and sources of
procurement.
Procuring the components, testing the components and screening the components.
Making layout, repairing the interconnection diagram as per the circuit diagram.
Assembling the components as per the component layout and circuit diagram and
soldering components.
Integrating the total unit, intertwining the unit and final testing the unit.

APPLICATIONS:
1.
2.
3.
4.

Add display
Railway announcement
Factory announcement
Defense communication

CONCLUSION
The above project has shown the successful implementation of wireless
communication using the PIC 16f877A micro controller.
A Transmitter kit is developed and connected to PC to Receive the character, the
character is then encoded and transmitted through radio frequency. At the end of receiver
section the decoder will decode the encoded data and applied to the controller. The
receiver data is then transmitted to another PC.
This concludes the communication of data from PC to PC.

>Feature modification
1. The user could change the signal character into a word or a text in order to
improve the communication.
2. While the transmission and receiving of data there is a possibility for the
existence of noise, because of the usage of micro controller. Hence we can use a
protocol with the header and tailer and also inclusion of CRC checker. So that the
communication can be achieved with securely.

Bibliography:
BOOKS:
Customizing and programming ur pic microcontroller- Myke Predcko
Complete guide to pic microcontroller -e-book
C programming for embedded systems- Kirk Zurell
Teach yourself electronics and electricity- Stan Giblisco
Embedded Microcomputer system- onathan w.Valvano(2000)
Embedded PIC microcontroller- John Peatman
Telecommunication and computer by Martin

Web sites:

www.Microchips.com

http://www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uv
od.htm

www.how stuff works.com

www.texasinstruments.com

www.nationalsemiconductors.com

www.fairchildsemiconductors.com

Potrebbero piacerti anche