Download Visible light communication which is between

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microcontroller wikipedia , lookup

HD-MAC wikipedia , lookup

LCD television wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Serial digital interface wikipedia , lookup

Telecommunications engineering wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Radio transmitter design wikipedia , lookup

Telecommunication wikipedia , lookup

Rectiverter wikipedia , lookup

Index of electronics articles wikipedia , lookup

Charlieplexing wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
ACKNOWLEDGEMENT
We thank our Founder Chairman Thiru. MJF. Ln. LEO MUTHU for his
great endeavors in establishing this institution and standing as a figure of guidance.
We also thank our C.E.O Mr. J. SAI PRAKASH LEO MUTHU and
Principal Dr. C.V. JAYAKUMAR for their kind cooperation and inspiration.
We thank Prof. A.R. RAJINI, Head of the Department, Electronics
and Communication Engineering for giving us freedom to carry out the project work
in the chosen domain.
We thank our Project Coordinator Mr/Ms.X.XXXX, Assistant
Professor, for his/her constant support right from the commencement of the project
work and also for providing us necessary details with regard to presentation and
documentation.
We are ever grateful to our Project Guide Dr.J.Britto Pari, Assistant
Professor, who was a buttress to carry out our project and for his valuable
suggestions at every stage of the project. We sincerely thank him for the support
rendered from the day we commenced our work.
Our gratitude extends to the staff of ECE Department whose words
of encouragement kept our spirits high throughout the course of the project.
We thank the entire people who contributed directly and indirectly for
the completion of this project.
ABSTRACT
RF communication is becoming more crowded due to excessive use of wireless
communication technologies like Bluetooth and Wi-Fi. Thus a new solution which
has a higher bandwidth than RF and also one which is immune to electromagnetic
interference is required. The proposed system incorporates both available power
lines and visible light for transmission of information within a closed area. Visible
light communication (VLC) is used as an effective solution as it does not cause any
radio frequency exposure hazards and Power Line Carrier Communication (PLC)
carries not only power with it but also data on a conductor. An integrated solution
can be obtained by combining the above two concepts to transmit data over long
distances within a building. To develop the proposed system, the Incoming bit
stream from the transmitter (computer in ground floor) is sent to a PLM which demultiplexes it into N parallel bit streams and each bit stream is modulated using subcarriers which are orthogonal to each other using OFDM which uses the available
spectrum most efficiently. The PLM is connected to the power line. By using
superimposition technique which is done by capacitive coupling, the modulated
signal is superimposed over the current wave in the power line and is transmitted via
the power line(8th floor is connected with the same line) and in this receiver side,
PLM is used to demodulate the data into the original data bit stream. The bit stream
is sent to the VLC transceiver’s lamp driver with White LED. The microchip in the
transceiver converts the digital bit stream in the form of light. When a ‘1’ is sent the
LED flashes and when a ‘0’ is sent, the LED turns off. A photodiode receives the
light and the microcontroller connected to it converts it back into our original data
and is displayed. The speed of VLC is so high (400-800THz) and thus rapid pulses
of light is used to transmit data appears as a single flash to our eyes.
TABLE OF CONTENTS
CHAPTER
NO.
TITLE
ABSTRACT
PAGE
NO.
ii
LIST OF FIGURES
LIST OF TABLES
1
viii
x
LIST OF ABBREVIATIONS
xi
INTRODUCTION
1
1.1 Objective
1.2 Motivation
1.3 Social Relevance
1.4 Application
2
LITERATURE REVIEW
2.1 Power Line Communication
2.2 Visible Light Communication
3
METHODOLOGY
3.1 Introduction
3.2 Block Diagram
3.2.1 Sender Module
3.2.2 Receiver Module
3.2.2.a VLC Transceiver
3.2.2.b LCD Module
3.3 Flow Diagram
10
3.4 Working of Proposed system
3.3 Description of Block Diagram
3.3.1 USB - UART Interface
3.3.2 PLC Introduction
3.3.2.a PLC Transmitter Section
3.3.2.b PLC Receiver Section
3.3.3 VLC Introduction
3.3.3.a VLC Transmitter Section
3.3.3.b VLC Receiver Section
3.4 Components Required
3.4.1 Hardware Components
3.4.2 Software Tools
4 RESULTS AND DISCUSSIONS
5 CONCLUSIONS
REFERENCES
WEB REFERENCES
LIST OF TABLES
TABLE.NO
TITLE
Table: 3.2.2.1
Microcontroller overview
Table: 3.3.1
LCD command
Table: 3.3.2
LCD PIN details
PAGE NO
CHAPTER 1
INTRODUCTION
OBJECTIVE:
To implement a Indoor Communication System using hybrid communication where in the
existing power lines and the light sources are used to transmit data and to display it in a
LCD module.Communication by this way provides ease of access and this proposed system
does not require a Wi-Fi or internet connection.This is also an advantage because it does
not cause crowding of the RF bandwidth and the speed is also improved.(1014 Hertz range).
Power line communication is the art of sending data through power lines. It can provide spectrum of services such
as internet, home automation and home entertainment. Major problem associated with this is the isolation of power
line. One of the solutions for the above problem is integrating power line with visible light communication. The idea
of integration of these two systems for indoor networking was pioneered by Komineet.al which was based on single
carrier modulation then to improve their old system to overcome the effects of power-line noises they used multicarrier modulation (OFDM) method .Through my proposal I aim to give a glimpse of the possibilities of all that I
can do with the visible light and power line to achieve a smart class environment in rural schools. I aim to present
the scope of this technology in near future.
Power lines were used in proposed system as transmitting medium because all infrastructures are readily available so
it does not require new wires. In this system LED is not only used as a lighting device but also used as a communication
device. It is a kind of optical wireless communication that uses the “visible”white ray as the medium. This dual
function of LED for lighting and communication emerges many new andinterestingapplications. The function is based
on the fast switchingofLEDs and the modulation of the visible-light waves forfree-space communications .The
advantages
of
theproposedsystem
when
compared
with
infrared
wirelesscommunicationareLEDlighthashigherpowerthusreceiverterminaldoesnot need to narrow the angle, the
shadowing can beminimizedbecause LED lights are distributed within a room,theinstallation is easy and LED is
aesthetically pleasing, they do not cause or suffer from radio or electromagneticinterference.So it can be used in RF
sensitive environment suchashospitals, airplane etc. In the proposed system the signal tobetransmitted is sent through
the
power
line.
It
ismodulatedbefore
reaching
on
visible
light
transmitter.
Themodulatedsignalispickedupbythetransmitter.LEDwillconverttheelectrical signal into optical signal and the
Photodiode receivesthesesignals and convert back into the electrical signal. Itisdemodulated according to the intensity
of receivedlight.
MOTIVATION:
RF communication is becoming more crowded due to excessive use of wireless
communication technologies like Bluetooth and Wi-Fi. Thus a new solution which
has a higher bandwidth than RF and also one which is immune to electromagnetic
interference is required. The proposed system incorporates both available power
lines and visible light for transmission of information within a closed area. Visible
light communication (VLC) is used as an effective solution as it does not cause any
radio frequency exposure hazards and Power Line Carrier Communication (PLC)
carries not only power with it but also data on a conductor. An integrated solution
can be obtained by combining the above two concepts to transmit data over long
distances within a building.
SOCIAL RELEVANCE - ECO-FRIENDLY GREEN THECHNOLOGY
In case of power line communication part, power line cables that are used depends on home plug network as they are
not producing any radiation which help to harm human beings. Where in case of visible light communication, the vital
part of Visible light communication (VLC) system is LEDs, which send data by flashing light at speeds undetectable
to the human eyes. LEDs are more advantageous than the existing incandescent bulbs and fluorescent tubes in terms
of long life expectancy, high tolerance to humidity, low power consumption, and minimal heat generation lighting.
Visible light communication system is cheap, durable, robust, secure, aesthetic & fashionable with untrammeled
bandwidth opportunities.The visible light occupies unregulated and unlicensed THz spectrum since it does not cause
or suffer from any electromagnetic interferencewhereas interference is common in using Wi-Fi or any other RF
systems.Visible light communication does not have any possibility of leaking out when the light is isolated, which
offers better security than wireless LAN, and does not suffer performance losses even when a variety of computers
are connected at once. Receiver obtains at least one strong Line of Sight (LOS) signal as the transmitters are on the
ceiling. This is not the case in most IR transmission situations.Undoubtedly, VLC is free of any health concerns, as it
uses eco-friendly green technology rather than microwaves, which can cause harm to the human body. Thus, the
proposed system sounds better to be implemented in rural schools as both power line communication and visible light
communication are Eco-friendly.
APPLICATION:












Smart classes is still a dream in rural areas and the conventional method is to use a projector.Also, to have a
computer for each class is a tedious task.
It is an expensive method and thus hybrid communication can be a suitable alternative.
Due to money constraints,children in rural schools are not as much exposed to technology as the urban
children.
A viable solution may be to use the existing power lines and the light source.
VLC using the light-emitting diode (LED) is an appealing alternative to the RF communication technology
for indoor communication.
Visible light communication (VLC) can be used as an effective solution as it does not cause any radio
frequency exposure hazards.
However, the LED lamps should access to the backbone information network and this requirement is not
easily satisfied. Power line communication (PLC) systems utilize the ubiquitous power line network to power
the LED lamps while serving as the backbone network for the VLC systems naturally.
Hence an integrated solution using PLCC and VLC is used.
One computer pre loaded with the stuffs is enough.The computer need not necessarily be in the same place
as of the classrooms.It can be in the HM’s cabin also
Data to be sent is sent via the power lines.
In the receiver side,a light source switches ON and OFF depending upon either 0 or 1 received.(Switching is
so fast that it appears as a single flash to our eyes)
This light is detected by a photodiode and can be displayed on a screen thereby eliminating the need for a
projector.
CHAPTER 2
LITERATURE REVIEW
2.1 POWER LINE COMMUNICATION
2.1.1
2.2 VISIBLE LIGHT COMMUNICATION
2.2.1 Eco-friendly Data Transmission In Visible Light Communication
In recent years, there is a rapid development in the solid state light-emitting diode (LED)
materials which gave way for the next generation data communication known as visible light
communication. VLC has a promising future and it acts as a complement to the present RF
communication by achieving larger bandwidth and high data rate. At present, the day to day
activities use lot of LED based lights for illumination, which can also be used for communication
because of the advantages like fast switching, high power efficiency and safe to human vision.
Hence, this paper presents about eco-friendly data communication through visible light which
consists of the white LEDs that transmit audio signals to the receiver. The receiver circuit consists
of solar panel connected with the amplifier and speakers to recover back the amplified version of
original input signal.
2.2.2 Visible Light Communication for Wireless Data Transmission
Visible Light Communication (VLC) technology, one of the advanced optical wireless
communication technologies, in which light in the visible region (375nm-780nm) is used as
a medium for data transmission is more secure and achieves high data rates as compared to
conventional wireless technologies like Wi-Fi, Bluetooth, Wi-max etc., which use radio waves
for communication. While using wireless internet, when more than one device is tapped into the
network, then bandwidth got frustrated at the slow speeds. To overcome the shortage of bandwidth
we can use light to transfer the data which can be known as “DATA THROUGH
ILLUMINATION”. The idea behind is that, infra-red remote is slightly modified i.e., LED light
bulb that varies in intensity which cannot be followed by the naked eye. It is possible to encode
the data in the light by varying the light at which the LEDs flicker on and off to give different
strings of 1s and 0s.While using mixtures of red, green and blue LEDs to alter the light frequency
encoding a different data channel. If you can‟t see the light then you cannot access the data so the
security would be snapped.
2.2.3 High-Speed Visible Light Communications Using Znse-Based White Light Emitting
Diode
In this letter, we report for the first time an experimental study on improving modulation
rate of a ZnSe-based white LED. The white LED exhibits a color temperature of approximately
6400 K (x = 0.31, y = 0.37), which is almost independent of the injected current. In order to
improve the LED’s modulation rate, we use peaking and carrier sweep-out effects generated by
our proposed current-shaping circuit. The experimental results confirm that we can significantly
improve the on-off keying modulation rate of a 30 MHz bandwidth ZnSe-based white LED by a
factor of 7. An error free transmission link has been demonstrated at a data rate of 400 Mbit/s.
2.2.4 Fast And Efficient Adaptation Techniques For Visible Light Communication Systems
Beam steering visible light communication(VLC) systems have been shown to offer
performance enhancements over traditional VLC systems. However, an in-crease in the
computational cost is incurred. In this paper, we introduce fast computer-generated holograms to
speed up the adaptation process. The new, fast, and efficient fully adaptive VLC system can
improve the receiver signal-to-noise ratio (SNR) and reduce the required time to estimate the
position of the VLC receiver. It can also adapt to environmental changes, providing a robust link
against signal blockage and shadowing. In addition, an angle diversity receiver and a delay
adaptation technique are used to reduce the effect of inter symbol interference and multipath
dispersion. Significant enhancements in the SNR with VLC channel bandwidths of more than
26GHz are obtained, resulting in a compact impulse response and a VLC system that is able to
achieve higher data rates (25 Gbps) with full mobility in the considered realistic indoor
environment.
2.2.5 Separate Dimming Controlling And Data Transmission For An Indoor Visible Light
Communication System
Simultaneous dimming controlling and data transmission are usually required in a white
LED based indoor visible light communication system. However, the diming controlling of LED
normally interferes the data transmission due to the modulation nonlinearity of LED. In order to
solve this problem, a scheme by separating the LEDs for the functions of dimming control and
data transmission respectively is proposed in this paper. In the scheme, the LEDs used for dimming
control function are driven by a dc amplified circuit, and the LEDs for data transmission are driven
by a digital modulation circuit respectively. In this way, the modulation distortion to the data signal
caused by the modulation nonlinearity can be avoided even if the dimming is at high level dc
driven current. The proof-of-concept experiment of a 2.5Mbit/s visible light communication
system demonstrates that the dimming controlling and data transmission can be realized
simultaneously in a simple way, and the data transmission is not affected by the dimming
controlling function. Compared to previous methods, the scheme in this paper is simpler and cost
effective, and makes sense when high rate data is transmitted in a visible light communication
system
CHAPTER 3
METHODOLOGY
3.1 INTRODUCTION
Power line communication is the art of sending data through power lines. It can provide spectrum
of services such as internet, home automation and home entertainment. Major problem associated
with this is the isolation of power line. One of the solutions for the above problem is integrating
power line with visible light communication. The idea of integration of these two systems for
indoor networking was pioneered by Komineet.al which was based on single carrier modulation
then to improve their old system to overcome the effects of power-line noises they used multicarrier modulation (OFDM) method .
Power lines were used in proposed system as transmitting medium because all infrastructures are
readily available so it does not require new wires .In this system LED is not only used as a lighting
device but also used as a communication device. It is a kind of optical wireless communication
that uses the “visible” white ray as the medium. This dual function of LED for lighting and
communication emerges many new and interesting applications. The function is based on the fast
switching of LEDs and the modulation of the visible-light waves for free- space communications
.The advantages of the proposed system when compared with infrared wireless communication
are LED light has higher power thus receiver terminal does not need to narrow the angle, the
shadowing can be minimized because LED lights are distributed within a room, the installation is
easy and LED is aesthetically pleasing, they do not cause or suffer from radio or electromagnetic
interference. So it can be used in RF sensitive environment such as hospitals, airplane etc. In the
proposed system the signal to be transmitted is sent through the power line. It is modulated before
reaching on visible light transmitter. The modulated signal is picked up by the transmitter. LED
will convert the electrical signal into optical signal and the Photodiode receives these signals and
convert back into the electrical signal. It is demodulated according to the intensity of received
light.
3.2 BLOCK DIAGRAM
3.2.1 SENDER MODULE
3.2.2 RECEIVER MODULE
3.2.2.a VLC Transceiver
3.2.2.b LCD Module
3.3 Flow Diagram
3.4 Working of Proposed system
The system mainly consists of power line and visible light section. PLC employs the
infrastructure of electrical power distribution system as communication medium. The
Incoming bit stream from the transmitter (computer in ground floor)is sent to a PLM which de
multiplexes it into N parallel bit streams and each bit stream is modulated using sub-carriers
which are orthogonal to each other using OFDM(Orthogonal Frequency Division
Multiplexing) which uses the available spectrum most efficiently. Power line modem is
plugged into the existing power line network. By using superimposition technique which is
done by capacitive coupling, the modulated signal is superimposed over the current wave in
the power line and is transmitted via the power line and this signal is captured by the PLC
receiver in the receiver side and it is demodulated to get the original data bit stream. The bit
stream is sent to the VLC transceiver’s lamp driver with White LED. The microchip in the
transceiver converts the digital bit stream in the form of light. When a ‘1’ is sent the LED turns
ON and when a ‘0’ is sent, the LED turns off. A photodiode receives the light and the
microcontroller connected to it converts it back into our original data and is displayed ie., LED
will convert the electrical signal into optical signal which is received using a photodiode and
convert back into electrical signal. The speed of VLC is so high (400-800THz) and thus rapid
pulses of light is used to transmit data appears as a single flash to our eyes due to persistence
of vision. Advantage of this proposed system is that VLC communication is simplex and it is
cost effective as it does not require RF for transmission, fast(in THz) .
3.5 Description of Block Diagram
3.5.1 USB - UART Interface
3.5.2 PLC Introduction
In power line communication data is sent through power line. This system uses a commercial
alternating current electric power source 230 V/50Hz power line and an USB-UART interface
as a communication medium and consists of visible light communication parts including PLC
receiving and transmitting parts. Basic processes involved in transmitting side are modulation,
transmitting the signal in such a manner that it reduces signal distortion, demodulation and
routing it to the visible light section. Power line modem can perform the above functions and
transmits and receives data at the rate of 9600 bps .Basically a power line modem consists of a
pic microcontroller, a carrier frequency oscillator, a digital modulator and an interfacing circuit.
The input data from a computer is transmitted to a PLC transmitter modem through an USB-
UART port. The pic microcontroller accepts the serial data transmitted from server and through
a level shifter the data is given to an OOK (ON OFF Key) modulator which performs OFDM
modulation. In this modulation technique the modulator transmits carrier signal for transmission
of digital data “one” and no carrier signal is present during the transmission of a “zero”. A
carrier frequency oscillator of frequency 400 kHz is used to produce a high frequency carrier
signal for minimizing distortion. The modulated signal is loaded to power line through an
interfacing circuit consisting of capacitive coupler. The interfacing circuit is used to isolate the
230 V/50 Hz from the low voltage environment. The data transmitted through power line is
received at another server through a power line modem which acts as a demodulator. The
received signal is amplified and given to an OOK demodulator which reconstructs original
digital data. The receiver unit is also isolated from power line using an interfacing circuit
consists of a capacitive coupler.
3.5.2.a PLC Transmitter Section
The PLC transmitter circuit mainly consists of the PLC modem, automatic voltage regulator
.The data is transmitted through the USB-UART Interface to the power line through the
exclusive PLC modem. The PLC modem offers a solution for switching of an access-point of
visible light communication into or out of a PLC network.
3.5.2.b PLC Receiver Section
PLC receiver circuit which has little bit same approach as PLC transmitter circuit, except that
amplification and driving circuits are added to the LED transmitter parts to work as VLC
transmitter. The signal that comes through the AC power line is received through the exclusive
PLC modem, and is converted to current signal form by an operational amplifier, then biased
with DC source. A DC-current level is chosen such that, ensures the device operates in a linear
regime. The biased current is fed to LED driver unit.
3.5.3 VLC Introduction
Visible light communication which is between 400THz to 800THz of frequency and wavelength
between 400nm to 700nm acts as a very good communication medium and thus is used by the
White LEDs’ to transfer information signals over light taking to a next generation network.
The data sent through the power line is routed to the visible light section by the
microcontroller. It consists of a modulation stage, transmitter section, receiver section,
demodulation stage. Voltage Controlled Oscillator is used to modulate the input signal. Input
signal to be superimposed is given to the control voltage pin of voltage controlled oscillator.
The VCO is a general purpose voltage controlled oscillator which may be used to generate
square and triangular waves, the frequency of which is a very linear function of a control voltage.
The frequency is also a function of an external resistor and capacitor.
3.5.3.a VLC Transmitter Section
Modulation circuit of transmitter
The biased current from the PLC receiver is fed to LED driver unit. The power of LED is varied
according to the waveform of data signal. LED will act as visible light transmitter module
depending upon data rate they used to flick but their flickering is not detectable by human eyes.
So for human beings it will act as one of simple light source.
3.5.3.b VLC Receiver Section
Demodulation circuit of Receiver
At the receiver side, the practical active high technique is used, in which a PIN photodiode
sensor produces a current proportional to the appearing light power, i.e. proportional to the
square of the received electric field. Filtering is used to remove the slow yellow light. The mA
current from photodiode needs to be amplified by an operational amplifier. Then by making it
TTL compatible to communicate with microcontroller and client PC, the data is reached to client
which is the LCD SCREEN.
3.6 Components Required
3.6.1 Hardware Components
1. Power Supply
2. USB-UART Interface
3. Power Line Modem(PLM)
4. PIC16F877A
5. VLC Transceiver
6. Led Lamp driver
7. Photodiode
8. LCD
1. Power Supply
A power supply provides a constant output regardless of voltage variations."Fixed" threeterminal linear regulators are commonly available to generate fixed voltages of plus 3 V, and plus
or minus 5 V, 9 V, 12 V, or 15 V when the load is less than about 7 amperes.
The "78xx" series (7805, 7812, etc.) regulate positive voltages while the "79xx" series
(7905, 7912, etc.) regulate negative voltages. Often, the last two digits of the device number are
the output voltage; eg, a 7805 is a +5 V regulator, while a 7915 is a -15 V regulator. The 78xx
series ICs can supply up to 1.5 Amperes depending on the model.
Features
1.
Output Current up to 1A
2.
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24
3.
Thermal Overload Protection
4.
Short Circuit Protection
5.
Output Transistor Safe Operating Area Protection
The basic power supply schematic
In a typical linear power supply, AC line voltage is first down-converted to a smaller peak
voltage using a transformer which is then rectified using a full wave bridge rectifier circuit. A
capacitor filter is then used to smoothen the obtained sinusoidal signal. The residual periodic
variation or ripple in this filtered signal is eliminated using an active regulator.To obtain a DC
power supply with both positive and negative output voltages, a center-tapped transformer is used,
where a third wire is attached to the middle of the secondary winding and it is taken as the common
ground point. Then voltages from the opposite ends of the winding will be positive or negative
with respect to this point.
Circuit description
This circuit is a small +5V power supply, which is useful when
experimenting with digital electronics. Small inexpensive wall
transformers with variable output voltage are available from
any electronics shop and supermarket. Those transformers are
easily available, but usually their voltage regulation is very
poor, which makes them not very usable for digital circuit
experiments unless a better regulation can be achieved in some
way. The following circuit is the answer to the problem. This
circuit can give +5V output at about 150 mA current, but it can
be increased to 1A when good cooling is added to 7805
regulator chip. The circuit has over overload and terminal
Circuit Diagram Of The
protection. The capacitors must have enough high voltage
Power Supply.
rating to safely handle the input voltage feed to circuit. The
circuit is very easy to build into a piece of overboard.
Pin out of the 7805 regulator IC.
1.Unregulated voltage in
2. Ground
3. Regulated voltage out
2.USB-UART INTERACE:
start|< five to eight data bits >| stop bit(s)
0
---- - - - - - - - - - -
Space (logic low)
| | | | | | | | | | | |
|S|1|2|3|4|5|6|7|8|S|S|
| | | | | | | | | | | |
1
- - - - - - - - - - - --------
Mark (logic high)
Asynchronous Code Format.
The right-most bit is always transmitted first. If parity is present,the parity bit comes after the
data bits but before the stop bit(s).
UART stands for the Universal Asynchronous Receiver/Transmitter. In asynchronous
transmitting, teletype-style UARTs send a "start" bit, five to eight data bits, least-significant-bit
first, an optional "parity" bit, and then one, one and a half, or two "stop" bits. The start bit is the
opposite polarity of the data-line's idle state. The stop bit is the data-line's idle state, and provides
a delay before the next character can start. (This is called asynchronous start-stop transmission).
In mechanical teletypes, the "stop" bit was often stretched to two bit times to give the mechanism
more time to finish printing a character. A stretched "stop" bit also helps resynchronization. The
parity bit can either make the number of "one" bits between any start/stop pair odd, or even, or it
can be omitted. Odd parity is more reliable because it assures that there will always be at least one
data transition, and this permits many UARTs to resynchronize.
In synchronous transmission, the clock data is recovered separately from the data stream
and no start/stop bits are used. This improves the efficiency of transmission on suitable channels
since more of the bits sent are usable data and not character framing. An asynchronous
transmission sends nothing over the interconnection when the transmitting device has nothing to
send; but a synchronous interface must send "pad" characters to maintain synchronism between
the receiver and transmitter. The usual filler is the ASCII "SYN" character. This may be done
automatically by the transmitting device. USART chips have both synchronous and asynchronous
modes.
3.POWER LINE MODEM:
Power line modem is useful to send and receive serial data over existing AC mains
power lines of the building. It has high immunity to electrical noise persistence in the
power line and built in error checking so it never gives out corrupt data. The modem is
in form of a ready to use circuit module,which is capable of providing 9600 baud rate
low rate bi-directional data communication. Due to its small size it can be integrated into
and become part of the user’s power line data communication system.
FEATURES:
Transmit and Receive serial data at 9600 bps
Data Tx/Rx LEDs
Powered from 5V
Low Cost & Simple to use
Built in Error Checking
Direct interface with microcontroller uart txd, rxd pins
DESCRIPTION:
The module provides bi-directional half-duplex communication over the mains of any
voltage up to 250V AC and for frequency 50Hz or 60Hz. Half Duplex communication
means it can either transmit or receive data at a time but not both at same time. Normally
module is in receiving mode all the time listening to incoming communication on the power
line. Once the application gives serial data to transmit on its RX-IN pin, it switches over
to transmit and transmits the data through power line.Once transmit process is complete
it switches back to receive mode. The transmission of data is indicated by Red LED. The
reception of data by modem is indicated by Green LED which is on TXout pin itself. Data
communication of the modules is transparent to user’s data terminals and protocol
independent, as a result, multiple units can be connected to the mains without affecting
the operation of the others. There is no hassle of building interface circuits. Interface to
user’s data devices is a simple data-in and data-out serial link. Transmission is based on
byte by byte basis. Once one byte is given to module for transmission, atleast 500ms(mili
second) time is required inbetween before a new byte is given to module again since the
module waits for zero crossing of AC mains to transfer a bit. For AC 50Hz system the
zero crossing of AC signals happens every 10ms and modem needs 50 zero crossings
to transmit one byte with error checking data. That is why it takes 500ms for one byte.
For example we want to transmit character “TEST”, then we will have to transmit ‘T’, then
wait 500ms, then transmit ‘E’ and wait 500ms, then transmit ‘S’ and wait 500ms, then
transmit ‘T’ and wait 500ms. This can be quite slow speed for big data transfer, but the
purpose of this module is transfer of small data bytes for which this speed is ok to
implement.
SPECS OVERVIEW:
Embedded ready-to-go Power Line Carrier Modem module with SMT components
Small form factor for easy of system integration
Bi-directional half-duplex data communication over the mains
Applicable to universal mains voltage and frequency up to 250v, 50 - 60 Hz
Protocol independent, data transfer transparent to user's data terminals
High noise immunity and reliable data communication
Simple serial interface to user's data devices of 9600 bps
Built-in on board AC coupling circuit with direct connection to mains
Built-in carrier generation and detection
Multiple units can be connected to the power line of the distribution transformer
TTL level serial interface to user's data devices
Built with industrial grade components for operation under harsh environment
Indicates Transmit and Receive with LEDs
Built in Error Checking so it never gives out corrupt data.
SHOCK HAZARD:
It has built-in on board AC isolated coupling circuit, which allows direct and simple
connections to mains. Due to isolation on AC part, there is no worry to get shock on the
low voltage side when working with it which is shown in blue box below. When AC main
line is connected to module, do not touch the non-isolated part which is shown in red.
INTERFACING PIN DETAILS:
INTERFACING FROM USB PORT AND POWERING FROM USB PORT:
It will appear as virtual serial port on PC to which the user can communicatein two
ways through any software which can transmit / receive by this serial port like
hyperterminal or custom made software.
4.PIC16F877A Microcontroller Overview:
Table3.2.2.1- Microcontroller Overview
Fig 3.2.2.2 PIN Description
Fig 3.2.2.3 PIC Architecture
3.2.3 MEMORY ORGANIZATION
There are three memory blocks in each of thePIC16F87XA devices. The program memory
and data memory have separate buses so that concurrent access can occur and the third memory
block is EEPROM data memory block and is detailed as “Data EEPROM and Flash Program
Memory”.
3.2.1 Program Memory Organization
The PIC16F87XA devices have a 13-bit program counter capable of addressing an 8K
word x 14 bit program memory space. The PIC16F876A/877Adevices have 8K words x 14 bits of
Flash program memory, while PIC16F873A/874A devices have4K words x 14 bits. Accessing a
location above the physically implemented address will cause a wraparound. The Reset vector is
at 0000h and the interrupt vector is at 0004h.
3.2.2 Data Memory Organization
The data memory is partitioned into multiple banks which contain the General Purpose Registers
and the Special Function Registers. Bits RP1 (Status<6>) andRP0 (Status<5>) are the bank select
bits. Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for
the Special Function Registers. Above the Special Function Registers are General Purpose
Registers, implemented as static RAM. All implemented banks contain Special Function Registers.
Some frequently used Special Function Registers from one bank may be mirrored in another bank
for code reduction and quicker access.
3.2.4 DATA EEPROM AND FLASH PROGRAM MEMORY
The data EEPROM and Flash program memory is read-able and writable during normal operation
(over the full VDD range). This memory is not directly mapped in the register file space. Instead,
it is indirectly addressed through the Special Function Registers. There are six SFRs used to read
and write this memory:
• EECON1
• EECON2
• EEDATA
• EEDATH
• EEADR
• EEADRH
When interfacing to the data memory block, EEDATAholds the 8-bit data for read/write
and EEADR holds the address of the EEPROM location being accessed. These devices have 128
or 256 bytes of data EEPROM(depending on the device), with an address range from00h to FFh.
On devices with 128 bytes, addresses from80h to FFh are unimplemented and will wraparound
tithe beginning of data EEPROM memory. When writing to unimplemented locations, the on-chip
charge pump will be turned off. When interfacing the program memory block, thee DATA and
EEDATH registers form a two-byte word that holds the 14-bit data for read/write and the
EEADRand EEADRH registers form a two-byte word that holds the 13-bit address of the program
memory location being accessed. These devices have 4 or 8K words of program Flash, with an
address range from 0000h to0FFFh for the PIC16F873A/874A and 0000h to 1FFFhfor the
PIC16F876A/877A. Addresses above the range of the respective device will wraparound to the
beginning of program memory. The EEPROM data memory allows single-byte read and write.
The Flash program memory allows single-word reads and four-word block writes. Program
memory write operations automatically perform an erase-before-write on blocks of four words. A
byte write in data EEPROM memory automatically erases the location and writes the new data
(erase-before-write). The write time is controlled by an on-chip timer. The write/erase voltages are
generated by an on chip charge pump, rated to operate over the voltage range of the device for byte
or word operations. When the device is code-protected, the CPU may continue to read and write
the data EEPROM memory. Depending on the settings of the write-protect bits, the device may or
may not be able to write certain blocks of the program memory; however, reads of the program
memory are allowed. When code-protected, the device programmer can no longer access data or
program memory; this does NOT inhibit internal reads or writes.
3.2..5 I/O PORTS
Some pins for these I/O ports are multiplexed with an alternate function for the peripheral
features on the device. In general, when a peripheral is enabled, that pin may not be used as a
general purpose I/O pin. Additional information on I/O ports may be found in the Pismire™ MidRange Reference Manual (DS33023).
3.5.1 PORTA and the TRISA Register
PORTA is a 6-bit wide, bidirectional port. The corresponding data direction register is TRISA.
Setting aTRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the
corresponding output driver in a High Impedance mode). Clearing a TRISA bit (= 0) will make
the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected
pin).Reading the PORTA register reads the status of the pins, whereas writing to it will write to
the port latch. All write operations are read-modify-write operations. Therefore, a write to a port
implies that the port pins are read, the value is modified and then written to the port data latch. Pin
RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The
RA4/T0CKIpin is a Schmitt Trigger input and an open-drain output. All other PORTA pins have
TTL input levels and full CMOS output drivers. Other PORTA pins are multiplexed with analog
inputs and the analog VREF input for both the A/D converters and the comparators. The operation
of each pin is selected by clearing/setting the appropriate control bits in the ADCON1 and/or
CMCON registers. The TRISA register controls the direction of the port pins even when they are
being used as analog inputs. The user must ensure the bits in the TRISA register are maintained
set when using them as analog inputs.
3.5.2 PORTB and the TRISB Register
PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISB. Setting aTRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put the
corresponding output driver in a High-Impedance mode). Clearing a TRISB bit (= 0)will make the
corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected
pin).Three pins of PORTB are multiplexed with the In-Circuit Debugger and Low-Voltage
Programming function:RB3/PGM,RB6/PGC and RB7/PGD. The alternate functions of these pins
are described in Section 14.0“Special Features of the CPU”. Each of the PORTB pins has a weak
internal pull-up. Single control bit can turn on all the pull-ups. This is per-formed by clearing bit
RBPU (OPTION_REG<7>). The weak pull-up is automatically turned off when the port pin is
configured as an output. The pull-ups are disabled on a Power-on Reset.
3.5.3 PORTC and the TRISC Register
PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISC. Setting aTRISC bit (= 1) will make the corresponding PORTCpin an input (i.e., put the
corresponding output driver in a High-Impedance mode). Clearing a TRISC bit (= 0)will make the
corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected
pin).PORTC is multiplexed with several peripheral functions(Table 4-5). PORTC pins have
Schmitt Trigger input buffers. When the I2C module is enabled, the PORTC<4:3>pins can be
configured with normal I2C levels, or with SMBus levels, by using the CKE bit
(SSPSTAT<6>).When enabling peripheral functions, care should be taken in defining TRIS bits
for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other
peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect
while the peripheral is enabled, read-modify-write instructions (BSF, BCF, XORWF) with TRISC
as the destination, should be avoided. The user should refer to the corresponding peripheral section
for the correct TRIS bit settings.
3.5.4 PORTD and TRISD Registers
PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually
configurable as an input or output. PORTD can be configured as an 8-bit wide microprocessor port
(Parallel Slave Port) by setting control bit, PSPMODE (TRISE<4>). In this mode, the input buffers
are TTL.
3.5.5 PORTE and TRISE Register
PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6and RE2/CS/AN7) which are
individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers. The
PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE
(TRISE<4>) is set. In this mode, the user must make certain that theTRISE<2:0> bits are set and
that the pins are configured as digital inputs. Also, ensure that ADCON1 is configured for digital
I/O. In this mode, the input buffers areTTL.Register 4-1 shows the TRISE register which also
controls the Parallel Slave Port operation. PORTE pins are multiplexed with analog inputs. When
selected for analog input, these pins will read as ‘0’s.TRISE controls the direction of the RE pins,
even when they are being used as analog inputs. The user must make sure to keep the pins
configured as inputs when using them as analog inputs.
3.2.6 TIMER0 MODULE
The Timer0 module timer/counter has the following features:
• 8-bit timer/counter
• Readable and writable
• 8-bit software programmable prescaler
• Internal or external clock select
• Interrupt on overflow from FFh to 00h
• Edge select for external clock
Figure 3.6-1 is a block diagram of the Timer0 module and the prescaler shared with the
WDT.
Timer mode is selected by clearing bit T0CS(OPTION_REG<5>). In Timer mode, the
Timer0module will increment every instruction cycle (withoutprescaler). If the TMR0 register is
written, the increment is inhibited for the following two instruction cycles. The user can work
around this by writing an adjusted value to the TMR0 register. Counter mode is selected by setting
bit T0CS(OPTION_REG<5>). In Counter mode, Timer0 will increment either on every rising or
falling edge of pinRA4/T0CKI. The incrementing edge is determined byte Timer0 Source Edge
Select bit, T0SE(OPTION_REG<4>). Clearing bit T0SE selects the rising edge.
3.2.7 ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE
The Analog-to-Digital (A/D) Converter module has five inputs for the 28-pin devices and
eight for the 40/44-pindevices.The conversion of an analog input signal results in corresponding
10-bit digital number. The A/D module has high and low-voltage reference input that is soft-ware
selectable to some combination of VDD, VSS, RA2or RA3.The A/D converter has a unique feature
of being able to operate while the device is in Sleep mode. To operate in Sleep, the A/D clock must
be derived from the A/D’s internal RC oscillator.
The A/D module has four registers. These registers are:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
The ADCON0 register, shown in Register 11-1, controls the operation of the A/D module. The
ADCON1register, shown in Register 11-2, configures the functions of the port pins. The port pins
can be configured as analog inputs (RA3 can also be the voltage reference) or as digital I/O.
3.2.9 INSTRUCTION SET SUMMARY
The PIC16 instruction set is highly orthogonal and is comprised of three basic categories:
• Byte-oriented operations
• Bit-oriented operations
• Literal and control operations
Each PIC16 instruction is a 14-bit word divided into an opcode which specifies the instruction type
and one or more operands which further specify the operation of the instruction. The formats for
each of the categories is presented in Figure 15-1, while the various opcode fields are summarized
in Table 15-1.Table 15-2 lists the instructions recognized by the MPASM™ Assembler. A
complete description of each instruction is also available in the Pismire® Mid-Range MCU Family
Reference Manual (DS33023).For
byte-oriented
instructions, ‘f’ represents a file register
designator and ‘d’ represents a destination designator. The file register designator specifies which
file register is to be used by the instruction. The destination designator specifies where the result
of the operation is to be placed. If ‘d’ is zero, the result is placed in the W register. If ‘d’ is one,
the result is placed in the file register specified in the instruction. For bit-oriented instructions, ‘b’
represents a bit field designator which selects the bit affected by the operation, while ‘f’ represents
the address of the file in which the bit is located. For literal and control operations, ‘k’ represents
an eight or eleven-bit constant or literal value One instruction cycle consists of four oscillator
periods; for an oscillator frequency of 4 MHz, this gives a normal instruction execution time of 1
µs. All instructions are executed within a single instruction cycle, unless a conditional test is true,
or the program counter is changed as a result of an instruction. When this occurs, the execution
takes two instruction cycles with the second cycle executed as a NOP.
5.VLC TRANSCEIVER:
6.LED
Infrared is an energy radiation with a frequency below our eyes sensitivity.Infra-red light
emitted by IR Diodes is pulsated at 36 thousand times per second
A light-emitting diode (LED) is a two-lead semiconductor light source. It is a p–n junction diode,
which emits light when activated.When a suitable voltage is applied to the leads, electrons are able
to recombine withelectron holes within the device, releasing energy in the form of photons. This
effect is called electroluminescence, and the color of the light (corresponding to the energy of the
photon) is determined by the energy band gap of the semiconductor.
The first visible-light LEDs were also of low intensity, and limited to red. Modern LEDs are
available across the visible, ultraviolet, and infrared wavelengths, with very high brightness.
Early LEDs were often used as indicator lamps for electronic devices, replacing small incandescent
bulbs. They were soon packaged into numeric readouts in the form of seven-segment displays, and
were commonly seen in digital clocks.
Recent developments in LEDs permit them to be used in environmental and task lighting. LEDs
have many advantages over incandescent light sources including lower energy
Advantages:
•
Efficiency: LEDs emit more lumens per watt than incandescent light bulbs.
•
Color: LEDs can emit light of an intended color without using any color filters as traditional
lighting methods need.
•
Size: LEDs can be very small are easily attached to printed circuit boards.
•
Warmup time: LEDs light up very quickly.
•
Cool light: In contrast to most light sources, LEDs radiate very little heat in the form of IR
that can cause damage to sensitive objects or fabrics.
•
Lifetime: LEDs can have a relatively long useful life.
•
Shock resistance: LEDs, being solid-state components, are difficult to damage with
external shock, unlike fluorescent and incandescent bulbs, which are fragile.
•
Focus: The solid package of the LED can be designed to focus its light.
Disadvantages
•
Temperature dependence: LED performance largely depends on the ambient temperature
of the operating environment.
•
Initial price: LEDs are currently slightly more expensive on an initial capital cost basis,
than other lighting technologies.
•
Voltage sensitivity: LEDs must be supplied with a voltage above their threshold voltage
and a current below their rating.
•
Color rendition: Most cool-white LEDs have spectra that differ significantly from a black
body radiator like the sun or an incandescent light
•
Efficiency droop: The efficiency of LEDs decreases as the electric current increases.
Applications:
LED uses fall into four major categories:
•
Visual signals where light goes more or less directly from the source to the human eye, to
convey a message or meaning
•
Illumination where light is reflected from objects to give visual response of these objects
•
Measuring and interacting with processes involving no human vision
•
Narrow band light sensors where LEDs operate in a reverse-bias mode and respond to
incident light, instead of emitting light.
7. Photodiode:
A photodiode is a type of photo detector capable of converting light into either current or voltage
There is a window for the optical signals at the front (IR receiver/transmitter, status LEDs). The
transmitter should be mounted in a protected environment. The receiver is to be mounted in some
place. Transmitter mounted at any place. Transmitter and receiver must be parallel in their axes
and point towards one another.
ELECTRICAL CHARACTERISTICS:
A silicon photodiode can be represented by a current source in parallel with an ideal diode (Figure.
3). The current source represents the current generated by the incident radiation, and the diode
represents the p-n junction. In addition, a junction capacitance (Cj ) and a shunt resistance (RSH)
are in parallel with the other components. Series resistance (RS) is connected in series with all
components in this model. Figure 3. Equivalent Circuit for the silicon photodiode Shunt
Resistance, RSH Shunt resistance is the slope of the current-voltage curve of the photodiode at the
origin, i.e. V=0. Although an ideal photodiode should have an infinite shunt resistance, actual
values range from 10’s to 1000’s of Mega ohms. Experimentally it is obtained by applying ±10
mV, measuring the current and calculating the resistance. Shunt resistance is used to determine the
noise current in the photodiode with no bias (photovoltaic mode). For best photodiode performance
the highest shunt resistance is desired. Series Resistance, RS Series resistance of a photodiode
arises from the resistance of the contacts and the resistance of the undepleted silicon (Figure 1). It
is given by: ( 1 ) Where WS is the thickness of the substrate
POWER:
Supply Voltage:
2.8 - 3.4 V
Transmit Current:
45 mA (@ 3.3 V)
Receive Current:
50 mA (@ 3.3 V)
Power-down Sleep Current:
<10 µA
8. LCD Operation
In recent years the LCD is finding widespread use replacing LEDs (seven-segment LEDs
or other multisegment LEDs). This is due to the following reasons:

The declining prices of LCDs.

The ability to display numbers, characters, and graphics. This is in contrast to
LEDs, which are limited to numbers and a few characters.

Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of
the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU
(or in some other way) to keep displaying the data.

Ease of programming for characters and graphics.
3.3.1 LCD pin descriptions:
The LCD discussed in this section has 14 pins. The function of each pin is given in the
table below.
VCC,VSS, and VEE :
While VCC and VSS provide +5V and ground, respectively, VEE is used for controlling
LCD contrast.
RS, Register Select :
There are two very important registers inside the LCD. The RS pin is used for their
selection as follows. If RS=0, the instruction command code register is selected, allowing the user
to send a command such as clear display, cursor at home, etc. If RS=1 the data register is selected,
allowing the user to send data to be displayed on the LCD.
R/W, Read/Write :
R/W input allows the user to write information to the LCD or read information from it.
R/W=1 when reading; R/W=0 when writing.
E, Enable :
The enable pin is used by the LCD to latch information presented to its data pins. When
data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD
to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide.
D0-D7 :
The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents
of the LCD’s internal registers.
To display letters and numbers, we send ASCII codes for the letters A-Z, a-z, and numbers
0-9 to these pins while making RS=1.
There are also instruction command codes that can be sent to the LCD to clear the display
or force the cursor to the home position or blink the cursor. Table lists the instruction command
codes.
We also use RS=0 to check the busy flag bit to see if the LCD is ready to receive
information. The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if R/W=1,
RS=0. When D7=1 ( busy flag=1 ), the LCD is busy taking care of internal operations and will not
accept any new information. It is recommended to check the busy flag before writing any data to
the LCD.
Code
Command to LCD Instruction Register
( Hex )
1
Clear display screen
2
Return home
4
Decrement cursor ( shift cursor to left )
6
Increment cursor ( shift cursor to right )
5
Shift display right
7
Shift display left
8
Display off, cursor off
A
Display off, cursor on
C
Display on, cursor off
E
Display on, cursor blinking
F
Display off, cursor blinking
10
Shift cursor position to left
14
Shift cursor position to right
18
Shift the entire display to the left
1C
Shift the entire display to the right
80
Force cursor to beginning of 1st line
C0
Force cursor to beginning of 2nd line
38
2 lines and 5x7 matrix
Table: 3.3.1-LCD command
Steps to Interface LCD with PIC Microcontroller
STEP 1 : Identify :Determine what you want LCD are available in many flavors which are
specified as follows 16x1 , 16x2 , 20x2 in the format AxB where A is the number of columns (
chatters ) and B is the number of Rows ( lines ) An LCD might also be Back lit .
STEP 2 : Connect : Most of the LCD's follow the standard Hitachi Pin out which is simply ...
Fig. 3.3 LCD
Pin
Name
Function
USE
1
Vss
Ground
2
Vdd
+ve Supply
5v Volts Regulated DC
3
Vee
Contrast
This is used to set the contrast1
4
RS
Register Set
Register
No
select
“0”:Instruction
Busy
flag
reading)
&
register
address
signal
(when
counter
writing)
(When
“1”:Data
register
(when
writing
&
reading)
5
R/W
Read / Write
Read/write
select
signal
“0” for writing , “1” for reading
6
E
Enable
Operation
(data
read/write)
enable
signal
7
D0
Data Bit 0
8
D1
Data Bit 1
9
D2
Data Bit 2
10
D3
Data Bit 3
11
D4
Data Bit 4
12
D5
Data Bit 5
13
D6
Data Bit 6
14
D7
Data Bit 7
15
A
+4.2 for Back light
16
K
Power supply Back
Positive supply for back light if available
light ( 0V)
Table: 3.3.2-LCD PIN details
In some LCD's you might not find the 15 and 16 pin so don’t worry. Here is how you must wire
them up.
STEP 3 : Interface :
Now connect pins RS ,RW ,E ,D0 - D7 to pins on the micro controller Lets suppose I
connect Data bus on port A and the RS , RW , E on port B . (you can save pins by using LCD in
Nibble Mode (4 data pins ) and permanently grounding the RW line ( always in write mode ) .
Now well see how to go from simple switching it on to graphics on the LCD .
An Intelligent LCD Need Only a few Commands And data to function Command Set for
the LCD.
3.6.2 Software Tools
1.Real Term I2C Software
2.Embedded C
3. MPLAB X IDE
1. Introduction About MPLAB X IDE
MPLAB® X IDE is a software program that is used to develop applications for Microchip
microcontrollers and digital signal controllers. (Experienced embedded-systems designers may
want to skip to the next chapter.)This development tool is called an Integrated Development
Environment, or IDE, because it provides a single integrated “environment” to develop code for
embedded microcontrollers.
4.2 Implementing An Embedded System Design With MPLAB X IDE
A development system for embedded controllers is a system of programs running on a
computer to help write, edit, debug and program code – the intelligence of embedded systems
applications – into a microcontroller. MPLAB X IDE is such a system; it contains all the
components needed to design and deploy embedded systems applications. The typical tasks for
developing an embedded controller application are:
1. Create the high level design. From the features and performance desired, decide which PIC
MCU or dsPIC DSC device is best suited to the application, then design the associated hardware
circuitry. After determining which peripherals and pins control the hardware, write the firmware
– the software that will control the hardware aspects of the embedded application. A language tool
such as an assembler, which is directly translatable into machine code, or a compiler that allows a
more natural language for creating programs, should be used to write and edit code. Assemblers
and compilers help make the code understandable, allowing function labels to identify code
routines with variables that have names associated with their use, and with constructs that help
organize the code in a maintainable structure.
2. Compile, assemble and link the software using the assembler and/or compiler and linker to
convert your code into “ones and zeroes” – machine code for the PIC MCUs. This machine code
will eventually become the firmware (the code programmed into the microcontroller).
3. Test your code. Usually a complex program does not work exactly the way imagined, and
“bugs” need to be removed from the design to get proper results. The debugger allows you to see
the “ones and zeroes” execute, related to the source code you wrote, with the symbols and function
names from your program. Debugging allows you to experiment with your code to see the value
of variables at various points in the program, and to do “what if” checks, changing variable values
and stepping through routines.
4. “Burn” the code into a microcontroller and verify that it executes correctly in the finished
application.
4.3 The Development Cycle
The process for writing an application is often described as a development cycle, since it
is rare that all the steps from design to implementation can be done flawlessly the first time. More
often code is written, tested and then modified in order to produce an appli-cation that performs
correctly. The Integrated Development Environment allows the embedded systems design
engineer to progress through this cycle without the distraction of switching among an array of
tools. By using MPLAB X IDE, all the functions are integrated, allowing the engineer to
concentrate on completing the application without the interruption of separate tools and different
modes of operation. MPLAB X IDE is a “wrapper” that coordinates all the tools from a single
graphical user interface, usually automatically. For instance, once code is written, it can be
converted to executable instructions and downloaded into a microcontroller to see how it works.
In this process multiple tools are needed: an editor to write the code, a project manager to organize
files and settings, a compiler or assembler to convert the source code to machine code and some
sort of hardware or software that either connects to a target microcontroller or simulates the
operation of a microcontroller.
Fig 4.1 The Development Cycle
4.4 CREATING AND SETTING UP A PROJECT
Step 1 Create a New Project
Step 2 opens on an MPLAB X IDE dialog that looks different than the dialog in Step1. Choose
your device here, in this case PIC32MX360F512L, and then click Next >.
`Step 3 This step appears if a header is available for your selected device. Since there is no header
for the PIC32MX360F512L device, MPLAB X IDE knows to skip this step.
Step 4 selects the tool. Tool support for the selected device is signified by the colored circles
(lights)
in
front
of
the
toolname.
Step 5 only appears if MPLAB REAL ICE in-circuit emulator is selected as the tool. For the
MPLAB REAL ICE in-circuit emulator, you may specify a plug-in board to use. A plug-in board
is the circuit board that is inserted into the emulator’s driver board slot. Since the Explorer 16
board works with either the Standard or High-Speed Communications driver boards, leave the
“Supported Plugin Board” as “None”.
Select your tool and then click Next>.
Step 6 selects the language tool, either a C compiler or assembler. Again, the colored
circle (light) in front of the compiler name signifies the device support level. Mouse over for text.
The version and installation location of a language tool is displayed beneath that tool. This allows
you to select from several installed language tools.Select your tool and then click Next>.
Step 7 selects the project name, location and other project options.
Enter the project name MyProject.
By default, projects will be placed in: