Beruflich Dokumente
Kultur Dokumente
INTRODUCT ION
1.1 Overview
Today computers are available in many offices and homes and therefore there is a
need to share data and programs among various computers with the advancement
increased and thus has extended the power of computer beyond the computer
room. Now a user sitting at one place can communicate with computers at any
electric signals carried along a conductor, optical signals along optical fibers and
communication channel, the data and information, computer files and any other
program can be transmitted to other computer systems within seconds. Power line
communication is a system for carrying data on a conductor which isalso used for
electric power transmission. Broadband over Power Lines (BPL) uses PLC by
sending and receiving information bearing signals over power lines to provide
transmission lines, distributed over medium voltage, and used inside buildings at
lower voltages. Power line communications can be applied at each stage. Most
1
PLC technologies limit themselves to one set of wires (for example, premises
wiring), but some can cross between two levels (for example, both the distribution
network and premises wiring). All power line communications systems operate by
power line communications use different frequency bands, depending on the signal
transmission characteristics of the power wiring used. Since the power wiring
the power wire circuits have only a limited ability to carry higher frequencies. The
information rate of multiple Gbps is an exception to this limitation. Data rates over
200 kHz) carriers impressed on high-voltage transmission lines may carry one or
two analog voice circuits, or telemetry and control circuits with an equivalent data
rate of a few hundred bits per second; however, these circuits may be many miles
long. Higher data rates generally imply shorter ranges; a local area network
operating at millions of bits per second may only cover one floor of an office
in various offices, homes, industries and companies all over the world. Several
forms of PC to PC communication exist and one form [1] is by the Ethernet where
the PCs are connected to a common Bus system and share information together,
the connection arrangement between the computers could be Star, Mesh and Tree.
Two computers can also share information through the internet [2] which is the
widest form of communication between computers all over the world through the
communication such as the infrared, however, infrared has high frequency thus its
signals cannot penetrate through obstacles and also cannot travel for a longer
travel for longer distances [3, 4]. Wireless fidelity (Wi-Fi) is another form of
communication medium for PCs and is one of the Wireless Personal Area
Networks (WPAN). Virtual Local Area Networks (VLAN) are another form of
uses low power transmitter and receivers and inexpensive hardware architecture
[6]. It could be seen that several methods are been employed as form of
This project, present an effective communication between the two PCs through a
analog data which is digitized with a help of an A/D converter and with help of
chapter two deals with hardware description, chapter three deals with
PLC, chapter five deals with the description of the development system and finally,
4
CHAPTER TWO
HARDWARE DESCRIPTION
2.1 Introduction
memory unit, serial to parallel communication unit, timer unit and further look at
Microcontroller, as the name suggests, are small controllers. These are like
single chip computers that are often embedded into systems to function as processing
/controllers unit. For example, a remote control may probably have microcontrollers
inside that do decoding and other controlling functions. They are also used in
computers because they have on-chip memory and I/O circuitry and other circuitries
that enable them to function as small standalone computers without other supporting
circuitry.
as their storage device to allow field programmability so they are flexible to use. Once
Easy to Use - Assembly language is often used in microcontroller and since they
usually follow RISC architecture, the instruction set is small. The development package
6
the chip and a demonstration board .Some packages include a high level language
Memory is part of [10] the microcontrollers whose function is to store data. The
easiest way to explain it is to describe it as one big closet with lots of drawers. Suppose
that the drawers are marked in such a way that they cannot be confused, then their
7
Fig 2.1 Memory Unit of Microcontroller
memory components are exactly like that. For a certain input, the contents of the
addressed memory location can be accessed. Two new concepts are brought to us:
addressing and memory location. Memory consists of all memory locations, and
addressing is nothing but selecting one of them. This means that when a desired
8
memory location is selected, there is the need to wait for the contents of that location.
Besides reading from a memory location, memory must also provide for writing onto it.
This is done by supplying [11] an additional line called control line. This line is
designated R/W (read/write). Control line are used in the following way: if r/w=1,
reading is done, and if opposite is true then writing is done on the memory location.
Memory is the first element, and a few other operations are needed for the running of
the microcontroller.
Let’s add three memory locations to a specific block that will have a built in capability
to multiply, divide, subtract, and move its contents from one memory location onto
another. This is called “Central Processing Unit” (CPU). Its memory locations are
called registers.
9
Fig 2.2 Central Processing Unit of Microcontroller
Registers are therefore memory locations whose role is to help with performing various
mathematical operations or any other operations with data wherever data can be found.
Look at the current situation. There are two independent entities (memory and CPU)
which are interconnected that enhance the exchange of data and functionality. An
example is adding the contents of two memory locations and returning the result again k
to memory will need a connection between memory and CPU. Simply stated, there
must be some “way” through which data moves from one block to another.
10
The locations just added are called “ports”. There are several types of ports: Input,
output or bidirectional ports. When working with ports, first of all it is necessary to
choose which port is to be worked with, and then to send data to, or take it from the
port.
When working with it the port acts like a memory location. Something is simply being
written into or read from it, and it could be noticed on the pins of the microcontroller.
11
2.3.4 Serial Communication
Beside stated [9] above we’ve added to the already existing unit the possibility of
drawbacks. One of the basic drawbacks is the number of lines which need to be used in
The number of lines time’s numbers of kilometers doesn’t promise the economy of the
project. This means that the number of lines must be reduced in a manner that will
not lessen its functionality. Suppose we are working with three lines only, and that one
line is used for sending data ,other for receiving, and the third one is used as a reference
line for both the input and output side. In order for this to work, there is the need to set
the rules for the exchange of data. These rules are called protocol. Protocol is, therefor,
defined in advance so that there wouldn’t be any misunderstanding between the sides
that are communicating with each other. The logical unit “1” is set up on the
transmitting line until transfer begins. Once the transfer starts, the transmission line is
lowered to logical ‘0” for a period of time, designated T, so the receiving side will
know that it is receiving data, and so it[10] will activate its mechanism for reception.
Returning to the transmission side and start putting logic zeros and ones in the
transmitter line in the order of a bit of the lowest value to a bit of the highest value. Let
each bit stay on line for a time period T, and in the end, or after the 8th bit bring the
12
logical unit “1” back on the line which will mark the end of the transmission of one
data. This protocol just described is called, in professional literature, NRZ (Non-Return
to Zero).
As there are separate lines for receiving and sending, it is possible to receive and send
data at the same time. The so called full-duplex mode blocks which enables this way of
13
communication is called a serial communication block. Unlike the parallel transmission,
data moves here bit by bit, or in a series of bits from which the term serial
communication is derived. After the reception of data, the need to read it from the
receiving location and [11] store it in memory as opposed to sending where the process
is reversed. Data goes from memory through the buys to the sending location, and then
After the explanation of serial communication explained, it is clear that data can be
received, sent and processed data serially.
However, in order to utilize it in industry a few additionally blocks are needed. One of
these is the timer block which is significant to us because it gives information about
time, duration, protocol etc. The basic unit of the timer is a free-run counter which is in
fact a register whose numeric value increments by one in even intervals, so that by
14
taking its value during periods T1 and T2 and on the basis of their difference the time
lapsed can be determined . This is a very important part of the microcontroller whose
15
CHAPTER THREE
3.1 Introduction
The ability to convert analog signals to digital and vice-versa is very important in
ADC0804LCN shows the pin out and a typical application schematic. The A/D
differential input voltage [Vin(+) - Vin(-)] matches a voltage derived from a tapped
resistor string across the reference voltage. The normal operation proceeds as
follows. On the high-to-low transition of the WR input, the internal SAR latches
and the shift-register stages are reset, and the INTR output will be set high. As long
as the CS input and WR input remain low, the A/D will remain in a reset state.
Conversion will start from 1 to 8 clock periods after at least one of these inputs
features: Differential analog voltage inputs, Logic inputs and outputs meet both
MOS and TTL voltage level specifications, Works with 2.5V (LM336) voltage
single 5V supply, No zero adjust required, 0.3[Prime] standard width 20-pin DIP
package
Figure.3.1.ADC Interfacing
the conversion is finished, it goes low to signal the CPU that the converted data is
ready to be picked up. After INTR goes low, we make CS = 0 and send a high-to-
low pulse to the RD pin to get data out of the ADC0804 chip. CLK IN and CLK
clock is used for timing. However, the ADC chip has an internal clock generator.
To use the internal clock generator or known as self clocking of ADC chip, the
CLK IN and CLK R pins are connected to a capacitor and a resistor. In that case
18
the clock frequency is determined by the equation: f = 1/1.1 RC. Typical value are
R = 1 0 kohm and C = 150 pF. Substituting in the equation we will get the value of
f = 606 kHz. Vin(+) and Vin(-): These are the differential analog inputs where Vin
= Vin(+) - Vin(-). Often the pin Vin(-) is connected to ground and the Vin(+) pin is
used as the analog input to be converted to digital. Vcc = this is the +5 volt power
supply. It is used as a reference voltage when the Vref/2 input is not connected.
LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin,
as the user is not required to subtract a large constant voltage from its output to
obtain convenient Centigrade scaling. The LM35 does not require any external
temperature and ±3⁄4°C over a full −55 to +150°C temperature range. Low cost is
assured by trimming and calibration at the wafer level. The LM35’s low output
readout or control circuitry especially easy. It can be used with single power
supplies, or with plus and minus supplies. As it draws only 60 μA from its supply,
it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to
operate over a −55° to +150°C temperature range, while the LM35C is rated for a
19
−40° to +110°C range (−10° with improved accuracy). The LM35 series is
LM35CA, and LM35D are also available in the plastic TO-92 transistor package.
The LM35D is also available in an 8-lead surface mount small outline package and
Linear + 10.0 mV/°C scale factor, 0.5°C accuracy guaranteeable (at +25°C), Rated
for full −55° to +150°C range, Suitable for remote applications, Low cost due to
20
Fig: 3.2 Temperature Sensor
21
Fig: 3.3 Temperature to Digital Converter
network. It is both an OSI layer 1 (physical layer) and layer 2 (data link layer)
level addressing system through the use of MAC addresses. It allows users to
connect to each other either by using cables or wirelessly. Although other network
technologies exist, Ethernet has achieved near-ubiquity since the mid-1990s. Every
Ethernet network card has a unique 48-bit serial number called a MAC address,
22
network must have a card with a unique MAC address. No two cards ever
Whereas network cards used to be expansion cards that plug into a computer bus,
the low cost and ubiquity of the Ethernet standard means that most newer
chipset, or implemented via a low cost dedicated Ethernet chip, connected through
the PCI (or the newer PCI express bus). A separate network card is not required
unless multiple interfaces are needed or some other type of network is used. Newer
specific physical layer and data link layer standard such as Ethernet or token ring.
This provides a base for a full network protocol stack, allowing communication
among small groups of computers on the same LAN and large-scale network
communications through routable protocols, such as IP. There are four techniques
used to transfer data, the NIC may use one or more of these techniques.
23
· Polling is where the microprocessor examines the status of the peripheral
under program control.
· Programmed I/O is where the microprocessor alerts the designated
peripheral by applying its address to the system's address bus.
· Interrupt-driven I/O is where the peripheral alerts the microprocessor that it's
ready to transfer data.
· DMA is where the intelligent peripheral assumes control of the system bus
to access memory directly. This removes load from the CPU but requires a
separate processor on the card.
A network card typically has a twisted pair, BNC, or AUI socket where the
network cable is connected, and a few LEDs to inform the user of whether the
network is active, and whether or not there is data being transmitted on it. The
Network Cards are typically available in 10/100/1000 Mbit/s(Mbit/s). This means
they can support a transfer rate of 10 or 100 or 1000 Megabits per second.
The card (shown in the figure below) provides an interface to the media. This may
transceiver mounted on the network interface card PCB. The card usually also
contains the protocol control firmware and Ethernet Controller needed to support
the Medium Access Control (MAC) data link protocol used by Ethernet.
24
Fig: 3.4 Network Interface Card
The RS232 connector was originally developed to use 25 pins. In this DB25
connector pin out provisions were made for a secondary serial RS232
number of Telebit modem models the secondary channel is present. It can be used
to query the modem status while the modem is on-line and busy communicating.
25
On personal computers, the smaller DB9 version is more commonly used today.
The diagrams show the signals common to both connector types in black. The
defined pins only present on the larger connector are shown in red. Note, that the
protective ground is assigned to a pin at the large connector where the connector
outside is used for that purpose with the DB9 connector version.
The pinout is also shown for the DEC modified modular jack. This type of
connector has been used on systems built by Digital Equipment Corporation; in the
26
early days, one of the leaders in the mainframe world. Although this serial
interface is differential (the receive and transmit have their own floating ground
level which is not the case with regular RS232) it is possible to connect RS232
compatible devices with this interface because the voltage levels of the bit streams
27
CHAPTER FOUR
4.1 Introduction
29
START
MICROCONT ROLLER
RECIEVES DIGITAL O/P FROM
ADC
PC 1
PLC
END
30
4.3 Operation of PC to PC Communication using PLC
output is an analog data which is digitized with a help of an A/D converter. The
temperature data is logged into one PC and it is transmitted to other PC through the
process easy using high level graphical programming language Visual Basic. All
signal on the wiring system. Different types of power line communications use
the power wiring used. Since the power wiring system was originally intended for
transmission of AC power, in conventional use, the power wire circuits have only a
factor for each type of power line communications. A new discovery called E-Line
this limitation.
Data rates over a power line communication system vary widely. Low-frequency
31
carry one or two analog voice circuits, or telemetry and control circuits with an
equivalent data rate of a few hundred bits per second; however, these circuits
may be many miles long. Higher data rates generally imply shorter ranges; a local
area network operating at millions of bits per second may only cover one floor of
32
CHAPTER FIVE
The cross compiler acts as a bridge between the programming software and
microcontroller. Supposing programming of the microcontroller is to be
using ‘C’, the code written in ‘C’ language cannot be directly executed by
microcontroller. This code, written in ‘C’, is fed into a cross compiler which
converts it into hexadecimal code, understood and executed by the
microcontroller. The advantages of using cross compilers is that in case of
some applications programming of the microcontroller using assembly
language it becomes less bulky and tedious. When using the cross compilers
one can program the microcontroller in any other language which is easy to
program and also debug . The commonly used cross compilers are SDCC
(Small devices C compiler), Keil etc.
In this project the use of Keil cross compiler is to program the microcontroller.
This chapter we discuss the introduction to programming in Keil, features of Keil
and finally the advantages of using Keil as compared to other cross compilers.
When writing a program for any microcontroller using cross compiler, the
33
converted code cannot be written directly on to the microcontroller. This means
there is the need to use a special technique to load the program into the
microcontroller. One of the methods is to use a microcontroller with a flash
memory. Flash memory is similar to erasable programmable read only memory. So
once program is written and debugged using cross compiler, we need to flash the
program on to the flash memory of the memory. Once program is flashed the
microcontroller is loaded with the hex code and it will be ready for execution
Keil software provides the premier 8051 development tools to industry .The keil
software comprises of different tool kits. A tool kit consist of several application
programs which can be used to create the 8051 application .When using keil
software for a project the development cycle is some what similar to a software
development project .It consist of creating source file in C or assembly language
compiling or assembling the source files, debugging error in the source file,
linking file from complier and assembler and finally building a project linking all
the files and testing the linked application.
All files created through the micro vision integrated development environment
are passed to the C51 compiler or A51 assembler. The compiler and assembler
process the source files and create relocatable object files. Object files created by
the compiler or assembler may be used by the library manager to create a library.
A library is a specially formatted, ordered program collection of object modules
that a linker can process. When the linker processes a library, only the object
modules in the library necessary for program creation are used. Object files created
34
by the compiler and assembler and library files created by the library manager are
processed by the linker to create an absolute object module. An absolute object file
or module is an object file with no reloadable code. All the code in an absolute
object file resides at fixed locations.
The absolute object file created by the linker may be used to program EPROM or
other memory devices. The absolute object module may also be used with the
dScope-51 debugger / simulator or with an in-circuit emulator. The dScope-51
source level debugger/simulator is ideally suited for fast, reliable high-level-
language program debugging. The debugger contains a high-speed simulator and a
target debugger that let can be used to simulate an entire 8051 system including
on-chip peripherals. By loading specific I/O drivers, the attributes and peripherals
of a variety of 8051 family can be stimulated. The RTX-51 real time operating
system is a multitasking kernel for the 8051 family. The RTX-51 real time kernel
simplifies the system design, programming, and debugging of complex
applications where fast reaction to time critical events are essential. The kernel is
fully integrated into the C51compiler and is easy to use. Task description tables
and operating system consistency are automatically controlled by the BL51 code
banking linker/locater.
The Fig 4.1 shows the full extent of the Keil Software 8051 development tools.
The tools listed in this diagram comprise the professional developer’s kit. In
addition to the professional kit, Keil Software provides a number of other tool kits
for the 8051 developer. The most capable kit is the professional developer’s kit is
described as follows:
35
The professional developer’s kit includes everything the professional 8051
developer needs to create sophisticated embedded applications. This tool kit
includes the following components:
37
§ Existing routine can be reused in new programs by utilizing modular
programming techniques available with C.
§ The C language is very portable and very popular. C compilers are available
for almost all target systems. Existing software investments can be quickly
and easily converted from or adapted to other processors or environments.
The A51 assembler is a macro assembler for the 8051 microcontroller family. It
translates symbolic assembly language mnemonics into relocatable object code
where the utmost speed, small code size, and hardware control are critical. The
macro facility speeds development and conserves maintenance time since common
sequences need only be developed once. The A51 assembler supports symbolic
access to all features of the 8051 architecture and is configurable for the numerous
8051 derivatives. The A51 assembler translates an assembler source file into a
relocatable object module. If the DEBUG control is used, the object file contains
full symbolic information for debugging with dScope or an in-circuit emulator. In
addition to the object file, the A51 assembler generates a list file which may
optionally include symbol table and cross reference information. The A51
assembler is fully compatible with Intel ASM-51 source modules. The A51
assembler supports all members of the 8051 family. The special function register
(SFR) set of the 8051 is predefined. However, the NOMOD51 control lets you
override these definitions with processor-specific include files. The A51 assembler
is shipped with include files for the 8051, 8051fx, 8051GB, 8052, 80152, 80451,
80452, 80515, 80C517, 80C517A, 8x552, 8xC592, 8xCL782, 8xCL410 and
80C320 microcontrollers. You can easily create include files for other 8051 family
members.
38
5.1.6 BL51 CODE BANKING LINKER/LOCATOR
The 51 code banking linker/locator combines one or more object modules into a
single executable 8051 program. The linker also resolves external and public
references, and assigns absolute addresses to relocatable programs segments. The
BL51 code banking linker/locator processes object modules created by the keil
C51 compiler and A51 assembler and the Intel PL/M-51 compiler and ASM-51
assembler. The linker automatically selects the appropriate run-time library and
links only the library modules that are required. Normally, the BL51 code banking
linker/locator is invoked from the command line specifying the names of the object
modules to combine. The default controls for the BL51 code banking linker/locator
have been carefully chosen to accommodate most applications without the need to
specify additional directives. However, it is easy to specify custom settings for
applications.
The OC51 banked object file converter creates absolute object modules for each
code bank in a banked object module. Banked object modules are created by the
BL51 code banking linker/locator when a bank switching application is created.
Symbolic debugging information is copied to the absolute object files and can be
used by dScope or an in-circuit emulator. The OC51 banked object file converter
may be used to create absolute object modules for the command area and for each
code bank in your banked object module. The Intel HEX files may then be
generated for each of the absolute object modules using the OH51 object-hex
converter.
39
5.1.8 OH51 OBJECT-HEX CONVETER
The OH51 object-hex converter creates Intel hex files from absolute object
modules. Absolute object modules can be created by the BL51 code baking linker
or by the OC51 banked object file converter. Intel hex files are ASCII files that
contain a hexadecimal representation of an application. They can be easily loaded
into a device programmer for writing on Erasable programmable read only
memory.
The LIB51 library manager allows for the creation and maintenance of library
files. A library file is a formatted collection of one or more object files. Library
files provide a convenient method of combining and referencing a large number of
object files. Libraries can be effectively used by the BL51 code banking
linker/locator. The LIB51 library manager allows for the creation of a library file,
addition or removal of object modules to or from a library file, and may be
controlled interactively or from the command line.
DScope-51 is a source level debugger and simulator for programs created with the
keil C51 compiler and A51 assembler and the Intel PL/M-51 compiler and ASM-
51 assembler. Dscope-51 is a software-only product that allows for the simulation
of the features of an 8051 without actually having target hardware. Scope-51 may
be used to test and debug an embedded applications before actual 8051 hardware is
ready. Dscope-51 simulates a wide variety of 8051 peripherals including the
internal serial port, external I/O, and timers.
40
5.1.9 µVISION/51 FOR WINDOWS
Microcontroller, as the name suggests, are small controllers. These are like single chip
computers that are often embedded into systems to function as processing /controllers
unit. For example, a remote control may probably have microcontrollers inside that do
decoding and other controlling functions. They are also used in automobiles, washing
machines, microwave ovens, toys…etc, where automation is needed. The key features
of microcontrollers include:
41
• High integration of Functionality
Microcontrollers sometimes are called single chip computers because they have
on-chip memory and I/O circuitry and other circuitries that enable them to
function as small standalone computers without other supporting circuitry.
• Easy to Use
Assembly language is often used in microcontroller and since they usually follow
RISC architecture, the instruction set is small. The development package of
microcontrollers often includes an assembler ,a simulator ,a programmer to “
burn “ the chip and a demonstration board .Some packages include a high level
language compiler such as a C compiler and more sophisticated libraries.
42
them in the performance of tasks that benefit the user. In this context the term
application refers to both the application software and its implementation. In some
types of embedded systems, the application software and the operating system
software may be indistinguishable to the user, as in the case of software used to
control a VCR, DVD player or microwave oven.
The application software for this project has been developed from a high level
graphical programming language (visual basic).This method of implementation
gives the user a more flexibility to have hands on the system. The application
software is a virtual representation of the actual instrument and provides all
facilities for the user to control the working of the system. This technique of
operating the system (the actual instrument) is highly advantageous, as it does not
permit the actual instrument to be misused, for example, here, the minimum and
maximum ranges of the system is defined and hence prevents the user from
exceeding the limits. Thus the application software provides high security to the
actual instrument. Moreover certain graphical representation of the real time values
with high resolution can also be implemented.
43
SCREEN SHOTS
44
45
CHAPTER SIX
46
REFERENCES
[1] B. L kakrati and A. K fsator, “PLC,” 24th Edition, Scand and Company,
Delhi, 2003.
[5] J. O. Bird and P. J Chivers, “Engineering and Physical Science Pocket Book,”
Newnew 1995.
[6] H. Uppal , “ Electrical Power System,” 3rd Edition, New Delhi, India, 1995.
Through Remote Embedded Linux,” IEEE Transactions, vol 12-35, page 34,
Nov 2005
11/10/2009
[10] http://www.mikroe.com/en/books/picbook/1_chapter.htm
13/10/2009
[11] http://www.allheadlinenews.com/articles/7012111732#ixzz0TMaQxsK
15/10/2009
[12] http://www.c++.com/en/books/picbook/1_chapter.htm
15/10/2009
[13] http://microp.ce.rit.edu/eecc250-winter99/250-2-9-2000.pdf
17/10/2009
[14] http://spsen.ce.rit.edu/eecc250-winter99/250-2-9-2000.pdf
17/10/2009
[15] http://Hbridge.ce.rit.edu/eecc250-winter99/250-2-9-2000.pdf
19/10/2009
[16] http://dcmotor.ce.rit.edu/eecc250-winter99/250-2-9-2000.pdf
19/10/2009
48