Sei sulla pagina 1di 86

VOICE INTERACTIVE SYSTEM FOR COLLEGE

AUTOMATION

Now-a-days every institution needs automation. As a

p a r t o f c o l l e g e a u t o m a t i o n , w e h a v e d e c i d e d t o d o a p r oj e c t

“Voice Interactive System for College Automation”. O ur

project allows the user to know the student’s attendance and

marks quickly through the telephone line without the

i n t e n t i o n o f t h e c o l l e g e a u t h o r i t y . I n t h e h a r d w ar e s i d e

embedded system has been used. A 20 pin microcontroller

89C2051 is used because of its compatibility with o ur

hardware. This microcontroller controls the whole hardware.

T e l e p h o n e l i n e i s u s e d f or c o m m u n i c a t i o n p ur p o s e . V i s u a l

B a s i c h a s b e e n u s e d f or s o f t w a r e p r o gr a m m i n g . P r e s e n t a t i o n

i n t h e c l a s s a n d o u t c o m e o f t h e u n i v e r s i t y ar e m a d e r e a c h a b l e

t o t h e p a r e n t s b y o u r pr o j e c t . I t w i l l b e v e r y o b l i g i n g t o t h e

parents to be acquainted with their son’s/daughter’s recital in

the college.

1
1. INTRODUCTION

Embedded system is a system is a system that lives inside


another device and act as a hardware component of that device. An
embedded system can be desirable once consisting of a processor,
associated peripherals and software used for a specific purpose. The
embedded system defined as the set of hardware controlled by
software. Like any computing system an embedded system is a
combination of software and hardware.

In our Project a 20 pin Microcontroller AT89C2051 is used to


control the whole hardware. The Microcontroller senses the DTMF
signal through the DTMF decoder IC MT8870 and it responds
according to the decoded signal. The circuit has an inbuilt Phone Ring
sensor circuit and the system will take over the phone automatically
using a 12 V relay. The microcontroller will receive the signal from
the distance telephone and it decodes the signal and fetches the data
from the PC through the serial port, based on the telephone signal,
and sends the data through the telephone line.

The objective of our project is to know the student’s attendance


and marks quickly through the telephone without the intention of the
college authority. By dialing the provided telephone number, one can
able to dig up the information of the student. One of the advantages is
the time spending for college officials in attempting phone calls from
outsiders will be reduced.

2
2. PROJECT DESCRIPTION

2.1. BLOCK DIAGRAM

TELEPHONE
LINE

DTMF DECODER PC
SERIAL
VOLTAGE PORT
CONVERTER

PERSONAL
MICRO COMPUTER
RING DETECTOR
CONTROLLER

PC
SPEAKER
OUT
ON/OFF
HOOK
SIMULATOR

INTERFACING
CIRCUIT

Figure 2.1 Basic Block Diagram

3
2.2 BLOCK DIAGRAM EXPLANATION

The above Block diagram consist of following Blocks


1. Telephone section
2. DTMF Decoder
3. Ring Detector
4. ON/OFF hook Simulator
5. Microcontroller
6. Voltage converter
7. PC Serial Port
8. Personal Computer (PC)

1. TELEPHONE

Invented by Bell and his assistant, Thomas A. Watson, the


telephone marked a significant development in the history of
electrical communication systems. In the earliest magneto-telephone
of 1876, the speaker’s voice was converted into electrical energy
patterns that could be send over reasonably long distances over wires
to a receiver, which would convert these energy patterns back into the
original sound waves for the listener.

Outgoing Call

The dial pad, also called keypad or touch-tone pad, is used to


dial telephone numbers as well as interact with voice processing
system such as a voice mail and interactive voice response (IVR). The
address signaling for an outgoing call can be accomplished by 3
different methods: pulse dial (rotary), real tone multiple frequency
(DTMF), or multi frequency (MF)

4
Multi-Frequency (MF):

It however became more popular with the introduction of dual


tone multiple frequency (DTMF) mode of dialing. Single chip DTMF
encoders/decoders are available today, which make the designing such
systems easy and reliable

Multi-frequency signaling is similar to DTMF and is used on


trunk circuit, pay telephones. Combination of two tones is used to
transmit signaling information, MF and DTMF signals are more
reliable and considerably faster than pulse dial. In both methods,
digits are transmitted at the rate of about 7 digits per second.

Tone combination Digit


700+900 1
700+1100 2
900+1100 3
700+1300 4
900+1300 5
1100+1300 6
700+1500 7
900+1500 8
1100+1500 9
1300+1500 0

Table.2.1. Multiple Frequency for Numbers

Incoming call

5
When a telephone set is called, the local exchange generates a
high ring voltage of about 90-105Volts AC with a frequency of 20Hz
superimposed over the minus (-) 48Volt DC. A capacitor in the phone
passes the AC but block DC. Upon detecting the AC voltage, the
phone provides an audible signal that altos the user of an incoming
call. Each telephone set provide a ringer equivalent number (REN) as
defined within FCC part 68 and EIA RS-470.The REN is used to
ensure that the local exchange can provide the correct amount of
power required to ring the telephone. It describes the frequency
range, power range, and bias voltage range of the telephone set. When
the phone is answered, DC current begins to flow in the loop. The
local exchange the current flow and removes the super imposed ring
voltage. The -48Volts DC that is always on the line operates the
telephone when it is being used.

2 DTMF SIGNALING

DTMF stands for Dual Tone Multiple Frequency. It is a


tone consisting of two frequencies superimposed. Individual
frequencies are chosen such that it is easy to design filters and easy
to transmit the tones through a telephone line having bandwidth of
approximately 3.5 kHz. DTMF was not intended to be used for data
transfer, it was meant to be used for sending the control signals along
the telephone line. With standard decoders it is possible to send 10
beeps per second i.e., five bits per second. DTMF standard specifies
50ms tones and 600ms duration between two successive tones.

6
1209 Hz 1336 Hz 1477 Hz 1633 Hz
Table.2.2.
697 Hz 1 2 3 A DTMF
Keypad
770 Hz 4 5 6 B Frequencies

852 Hz 7 8 9 C
Theory of
941 Hz * 0 # D Operation

In DTMF there are 16 distinct tones. Each tone is the sum of


two frequencies: one from a low and one from a high frequency group.
There are four different frequencies in each group. Our phone only
uses 12 of the possible 16 tones. If you look at your phone, there are
only 4 rows (R1, R2, R3 and R4) and 3 columns (C1, C2 and C3). The
rows and columns select frequencies from the low and high frequency
group respectively.

The following graph is a captured screen from an oscilloscope.


It is a plot of the tone frequency for the "1" key:

7
Figure 2.2 Tone frequencies for key “1”

You can see that the DTMF generated signal is very distinct and
clear. The horizontal axis is in samples. The frequency of the tone is
about 1900 Hz - close to the 1906 Hz predicted by Table 3
(697+1209).

Note that the last column is not commonly seen in the


telephones that we used, but telephone exchanges use them quite
often. Nowadays, DTMF is used for dialing the numbers in
telephones, configuring telephone exchanges etc. A CB transceiver of
2.7 MHz is normally used to send floating codes. DTMF was designed
to be able to send the codes using microphone. Each beep (or digit
you dial on the telephone) is composed of two concurrent frequencies,
which are superimposed on amplitude. The higher of the two
frequencies is normally aloud by 4dB, and this shift is termed as
twist. If the twist is equal to 4dB, the higher frequency is loud by
4dB. If the lower frequency is loud, then the twist is said to be
negative.

8
Event Low frequency High frequency

Busy signal 480 Hz 620 Hz

Dial tone 350 Hz 440 Hz

Ringback tone (US) 440 Hz 480 Hz

Table.2.3. DTMF Event Frequencies

The tone frequencies, as defined by the Precise Tone Plan, are


selected such that harmonics and intermodulation products will not
cause an unreliable signal. No frequency is a multiple of another, the
difference between any two frequencies does not equal any of the
frequencies, and the sum of any two frequencies does not equal any of
the frequencies. The frequencies were initially designed with a ratio
of 21/19, which is slightly less than a whole tone. The frequencies
may not vary more than ±1.5% from their nominal frequency, or the
switching center will ignore the signal. The high frequencies may be
the same volume or louder as the low frequencies when sent across
the line. The loudness difference between the high and low
frequencies can be as large as 3 decibels (dB) and is referred to as
"twist".

Generating DTMF

DTMF signals can be generated through dedicated ICs or by using


RC networks connected to a microprocessor. MT8880 is an example of
a dedicated IC. But getting the latter method work is a bit difficult if
high accuracy is needed. The crystal frequency needs to be sacrificed
for a non standard cycle length. Hence this method is used for simple

9
applications. Most often, a PIC micro could be used for the above
purpose.

Decoding DTMF

Detecting DTMF with satisfactory precision is a hard thing.


Often, a dedicated IC such as MT8870 is used for this purpose. It uses
two 6th order band-pass filters using switched capacitor filters and it
suppresses any harmonics. Hence they can produce pretty good sine
waves from distorted input. Hence it is preferred. Again
microprocessors can also be used, but their application is limited.

3. RING DETECTOR:

It is used to detect the ring signal from the telephone line. It


gives out a logical output to the microcontroller. An optocoupler
MCT2E is used as ring detector.
If ring is present –logic 0
Else-logic 1
Normal time voltage in telephone line=48V d.c
OFF hook voltage-12V d.c
Ring signal voltage-75V a.c

4. ON–OFF HOOK SIMULATOR

It is used to pickup the telephone electronically. A 12 volt d.c


signal is obtained by placing a resistor across the telephone line. It is
used to detect whether the Hand set is in ON hook condition or OFF
hook condition so as to send the information to the microcontroller. A
12 V relay is used for the purpose.

10
5. MICROCONTROLLER

A by-product of microprocessor development was the


microcontroller. The same fabrication techniques and programming
concepts that make possible the general-purpose microprocessor also
yielded the microcontroller.

Micro controllers are not as well known to the general public,


or to many in the technical community, as are the more glamorous
microprocessor. The public is, however, very well aware that
“something” is responsible for all of the smart VCRs, clock radios,
washers and dryers, video games, telephones, microwaves, TVs,
automobiles, toys, vending machines, copiers, elevators, irons, and a
myriad of other articles that are intelligent and “programmable”.
Companies are also aware that being competitive in this age of the
microchip requires their products, or the machinery they use to make
those products, to have some “smarts”.
e
Microprocessor and Microcontroller

Microprocessor and microcontroller stem from the basic idea,


are made by the same people, and are sold the same type of system
designers and system programmers. What is the difference between
the two?

Microprocessor
A microprocessor, as the term has come to be known, is a
general-purpose digital computer central processing unit (CPU).
Although popularly known as a “computer on a chip”, the
microprocessor is in no sense a complete digital computer.

11
Arithmetic and logic unit

Accumulator

Working Register(s)

Program counter Stack pointer

Clock circuit Interrupt circuit

Figure .2.3 Block Diagram of a Microprocessor

This block diagram contains arithmetic and logic unit (ALU), a


program counter (PC), a stack pointer (SP), some working registers, a
clock timing circuit, and interrupt circuits. To make a complete
microcomputer, one must add memory, usually read-only program
memory (ROM) and random-access data memory (RAM), memory
decoders, an oscillator, and a number of input/output (I/O) devices,
such as interrupt handlers and counters, may be added to relieve the
CPU from time consuming counting or timing chores. Equipping the
microcomputer with mass storage devices, commonly a floppy and
hard disk drives, and I/O peripherals, such as keyboard and a CRT
display, yields a small computer that can be applied to a range of
general-purpose software applications.

12
The hardware design of a microprocessor CPU is arranged so
that a small or very large system can be configured around the CPU as
the application demands. The prime use of a microprocessor is to read
data, perform extensive calculations on the data, and store those
calculations in a mass storage device or display the results for human
use. The programs used by the microprocessor are stored in the mass
storage device and loaded into RAM as the user directs. A few
microprocessor programs are stored in ROM. The ROM-based
programs are primarily small fixed programs that operate peripherals
and other fixed devices that are connected to the system. The design
of the microprocessor is driven by the desire to make it as expandable
and flexible as possible, in the expectation of commercial success in
the marketplace.

Microcontroller

13
ALU I/O
Timer/ counter
port

Accumulater I/O
Register(s) port

Interrupt
Internal circuit
Internal RAM
ROM

Stack pointer Clock circuit

Program counter

Figure.2.4 Block Diagram of Microcontroller

The above figure shows the block diagram of a typical


microcontroller, which is a true computer on a chip. The design
incorporates all of the features found in a microprocessor CPU: ALU,
PC, SP, and register. It also has added other features needed to make
a complete computer: ROM, RAM, parallel I/O, serial I/O, counters,
and a clock circuit Like the microprocessor, a microcontroller is a
general- purpose device, but one that is meant to read data, perform

14
limited calculations. The prime use of a micro-controller is to control
its environment based on those calculations. The prime use of a
microcontroller is to control the operation of a machine using a fixed
program that is stored in ROM and that does not change over the
lifetime of the system.

The design approach of the microcontroller mirrors that of the


microprocessor: make a single design that can be used in as many
applications as possible in order to sell, hopefully, as many as
possible. The microprocessor design accomplishes this goal by having
a very flexible and extensive repertoire of multi byte instructions.
These instructions work in a hardware configuration that enables
large amounts of memory and I/O to be connected to address and data
bus pins on the integrated circuit package. Much of the activity in the
microprocessor has to do with moving code and data to and from
external memory to the CPU. Many instructions are coupled with pins
on the integrated circuit pakage; the pins are programmable that is,
capable of having several different functions depending on the wishes
of the programmer. The microcontroller is concerned with getting
data from and to its own pins; the architecture and instruction set are
optimized to handle data in bit and byte size.

Microprocessors Vs Microcontroller

The contrast between a microcontroller and a microprocessor is


best exemplified by the fact that most microprocessors have many
operational codes (opcodes) for moving data from external memory to
the CPU; microcontrollers may have one or two. Microprocessors may
have one or two types of bit handling instructions; microcontroller
will have many.

15
The fundamental differences between microprocessors and
microcontrollers are these:

• Microprocessors re intended to be general purpose digital


computers whereas microcontrollers are intended to be special
purpose digital controllers.
• Microprocessors contain a CPU, memory addressing circuits, and
interrupt handling circuits. Microcontrollers have these features as
well as timers, parallel and serial I/O, and serial I/O, and internal
RAM and ROM.
• Microcontroller models vary in data size from 4 to 32 bits. Four bit
units are produced in huge volumes for very simple applications,
and 8-bit units are the most versatile. Sixteen and 32 bit units are
used in high speed control and signal processing applications
• Many models feature programmable pins that allow external
memory to be added with the loss of I/O capacity.

Eight bit Microcontrollers

Eight bit has proven to be a very useful world size for small
computing tasks.1- byte word is adequate for many control and
monitoring applications. Serial ASCII data is also stored in byte
sizes, making 8 bits the natural choice for data communications. Most
integrated circuit memories and many logic functions are arranged in
an 8- bit configuration that interfaces easily to data busses of 8 bits.

16
Application sophistication can also range from simple appliance
control to high speed machine control and data collection. For these
reasons the microcontroller vendors have established extensive
families of similar models. All feature a common language, but differ
in the amount of internal ROM, RAM, and other cost sensitive
features. Often the memory can be expanded to include off- chip ROM
and RAM; in some cases, the microcontroller has no on-board ROM at
all, or the ROM is an electrically reprogrammable read only memory
[EPROM]. The ROM less or EPROM versions can be used by the
designer to prototype the application, and the designer can order the
ROM version in large quantities from the factory. Many times the
ROM version is never used. The designer makes the ROM less or
EPROM design sufficiently general so that on configuration may be
used many times, or production volumes never justify the cost of a
factory ROM implementation. As a further enticement for the buyer,
some families have members with fewer external pins to shrink the
package and the cost; others have special features such as analog-to-
digital and digital-to-analog converters on the chip.

8051 Derivatives

Along the way, this 8031 architecture gained enviable market


acceptance. Many semiconductor manufacturers started either
manufacturing the 8031 devices as such (Intel was liberal in giving
away license to whoever asked) or developing a new kind of
microcontrollers based on 8031 core architecture.

17
Manufacturers modified the basic 8031 architecture and added
many new peripheral functions to make them attractive to the
designers. Because of the rush, electronic community started getting a
variety of 8031 based devices with range of options. To beat the
competition, manufacturers developed different microcontrollers with
many unique features. These parts are popularly known as ‘8031
Derivatives’. Almost every decent manufacturer boasted of having an
8031 based microcontroller in the line card.

First major manufacturer was the Philips who brought out more
than 40-50 derivatives with a variety of I/O options, memory
combinations, and peripheral functions. Devices became available in
regular DIP and SMD packages. With the basic 8031 core, Philips
ported high capacity Program Memory (upto 32K/64K), its patented
I2C interface bus, 8/10 bit Analog to Digital Converters, CAN Bus,
Capture and Compare registers, Watch dog timer, PWM facilities and
etc. More I/O ports (as many as eight ports), additional timer/counter,
second serial port was also made available in Philips devices.

Apart from all these, Philips developed many consumer devices


meant for telecom, computer and TV applications. A smart card
controller was also developed by incorporating a cryptographic
engine. So Philips clearly established itself as the market leader in
8031 derivatives and still caters to this segment.

Then come Dallas semiconductor. Dallas redesigned the 8031


architecture and eliminated waste clock cycles of original core and
made all instructions executed in less clock cycles (maximum of 4)
which have traditionally taken upto 12 clock cycles. So, came the
birth of High speed 8031 Derivatives.

18
Dallas semiconductor also has got a range of secure
microcontrollers based on 8031 core. This microcontroller family uses
non volatile RAM to keep both program and data. Because of this
RAM, the controller gives the In System Reprogram ability. Dallas
has combined this microcontroller, SRAM and lithium cell in a single
pack. This device guarantees 10+ years of data retention in the RAM
area. This 8031 also boasts the tamper proof security features like
Real Time Memory Encryption, user selected 48 bit Encryption key,
memory contents, security lock and the facility to hide interrupt
vector table. As you can agree, this particular 8031 device has found
a niche market in banking and security related applications.

Atmel Corporation is the major semiconductor manufacturer who


introduced many flash memories based 8031 derivatives at a
competitive cost. Atmel used its expertise in flash memory technology
into the basic 8031 core and brought out microcontrollers with a
variety of flash memory options and few devices also carry In System
Reprogramming facility. You can program/reprogram this
microcontroller after soldering the device in the target board. If this
programming facility is embedded in the system software, then the
tasks like remote calibration, onsite system upgradation become as
easy as sending your data/program in a floppy disk or by internet.
Atmel devices sport security lock to its flash memory to protect the
contents from the prying eyes.

Meantime, Intel itself tried to cash in the popularity of this


8031 architecture and introduced improved versions of
microcontrollers: 80151 and 80251 families. These devices sport 16
bit architecture using 8031 core and unfortunately these devices have
not become as popular as 8031.Even after many years of introduction,
8031 core is still going strong in 8 bit arena.

19
Addressing Modes

8031's assembly language instruction set consists of an


operation mnemonic and zero to three operands separated by commas.
In two byte instructions the destination is specified first, and then the
source. Byte wide mnemonics like ADD or MOV use the Accumulator
as a source operand and also to receive the result.

The 8031 supports five types of addressing modes:


1. Register Addressing
2. Direct Addressing
3. Register Indirect Addressing
4. Immediate Addressing
5. Index Addressing

Register Addressing

Register Addressing accesses the eight working registers (R0


R7) of the selected register bank. The least significant three bits of
the instruction opcode indicate which register is to be used for the
operation. One of the four banks of registers is to be predefined in
the PSW before using register addressing instruction. ACC, B, DPTR
and CY, (the Boolean Accumulator) can also be addressed in this
mode.

Direct Addressing

Direct addressing can access any on chip variables or hardware


register. To indicate the address of the location, an additional byte is

20
attached to the opcode. Depending on the highest order bit of the
direct address byte one of two physical memory space is selected.

When the direct address range is between 0 and 127 (00H


7FH) one of the 128 low order on chip RAM location is accessed. All
I/O ports, special function, control registers are assigned between 128
and 255 (80H FFH). When direct addressing indicates any location
in this range, corresponding hardware register is accessed.
This is the only method available for accessing I/O ports and
special function registers.

Register Indirect Addressing

Register indirect addressing uses the contents of either R0 or


R1 (in the pre selected register bank) as a address pointer to locate in
a 256 byte block (the lower 128 bytes of internal RAM in 8031 or 256
bytes in 8032) or the lower 256 bytes of external data memory. Note
that the special function registers are not accessible in this mode.
Access to full 64K external data memory address space is indicated by
the 16 bit Data Pointer register, DPTR.

Execution of PUSH and POP instructions also involve indirect


register addressing. The Stack Pointer indicates the correct stack
location anywhere in the internal RAM.

Immediate Addressing

When a source operand is a constant rather than a variable,


then the constant can be embedded into the instruction itself. This
kind of instructions takes two bytes and first one specifies the opcode
and second byte gives the required constant.

21
Index Addressing

Only the Program Memory can be accessed by this mode. This


mode is intended for reading lookup tables in the Program Memory. A
16 bit base register (either DPTR or the Program Counter) points to
the base of the lookup tables and the Accumulator carries the constant
indicating table entry number.

Microcontrollers for Embedded Systems

In the Literature discussing microprocessors, we often see the


term Embedded System. Microprocessors and Microcontrollers are
widely used in embedded system products. An embedded system
product uses a microprocessor (or Microcontroller) to do one task
only. A printer is an example of embedded system since the processor
inside it performs one task only; namely getting the data and printing
it. Contrast this with a Pentium based PC. A PC can be used for any
number of applications such as word processor, print-server, bank
teller terminal, Video game, network server, or Internet terminal.
Software for a variety of applications can be loaded and run. Of
course the reason a pc can perform myriad tasks is that it has RAM
memory and an operating system that loads the application software
into RAM memory and lets the CPU run it.

In an Embedded system, there is only one application software


that is typically burned into ROM. An x86 PC contains or is
connected to various embedded products such as keyboard, printer,
modem, disk controller, sound card, CD-ROM drives, mouse, and so
on. Each one of these peripherals has a Microcontroller inside it that
performs only one task. For example, inside every mouse there is a
Microcontroller to perform the task of finding the mouse position and
sending it to the PC.

22
6. VOLTAGE CONVERTER

This is used to convert TTL logic voltage into RS232


voltage.

TTL Logic: logic 1= 5v


logic 0= GND

RS232 : logic 1= +9v


logic 0= -9v
IC MAX232 is used as voltage converter. An external crystal
oscillator is used for its operation.

7. PC SERIAL PORT

This port is used to get data from microcontroller to personal


computer in serial manner. All IBM PC and compatible computers are
typically equipped with two serial ports and one parallel port.
Although these two types of ports are used for communicating with
external devices, they work in different ways.

A parallel port sends and receives data eight bits at a time over
8 separate wires. This allows data to be transferred very quickly;
however, the cable required is more bulky because of the number of
individual wires it must contain. Parallel ports are typically used to
connect a PC to a printer and are rarely used for much else. A serial
port sends and receives data one bit at a time over one wire. While it
takes eight times as long to transfer each byte of data this way, only a
few wires are required.

23
In fact, two-way (full duplex) communications is possible with
only three separate wires - one to send, one to receive, and a common
signal ground wire.

8. INTERFACING CIRCUIT

This is used to interface the audio signal from the


computer to the telephone line.

3. HARDWARE DECSRIPTION

3.1 MICROCONTROLLER

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit


microcomputer with 2 Kbytes of Flash programmable and erasable
read only memory (PEROM). The device is manufactured using
Atmel’s high density nonvolatile memory technology and is
compatible with the industry standard MCS-51 instruction set and
pinout. By combining a versatile 8-bit CPU with Flash on a
monolithic chip, the Atmel AT89C2051 is a powerful microcomputer

24
which provides a highly flexible and cost effective solution to many
embedded control applications.

The AT89C2051 provides the following standard features: 2


Kbytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit
timer/counters, five vector two-level interrupt architecture, a full
duplex serial port, a precision analog comparator, on-chip oscillator
and clock circuitry.

In addition, the AT89C2051 is designed with static logic for


operation down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to
continue functioning. The Power Down Mode saves the RAM contents
but freezes the oscillator disabling all other chip functions until the
next hardware reset.

3.1.1 Pin Configuration

The microcontroller AT89C2051 is available in 20 pin Dual


Inline Package (DIP).

25
Figure.3.1 Pin diagram of AT89C2051

3.1.2 Block Diagram

26
Figure.3.2 Block Diagram of AT89C2051

27
3.1.3 Pin Description

VCC
Supply voltage.

GND
Ground.

Port 1
Port 1 is an 8-bit bidirectional I/O port. Port pins P1.2 to P1.7
provide internal pullups. P1.0 and P1.1 require external pullups. P1.0
and P1.1 also serve as the positive input (AIN0) and the negative
input (AIN1), respectively, of the on-chip precision analog
comparator. The Port 1 output buffers can sink 20 mA and can drive
LED displays directly. When 1s are written to Port 1 pins, they can be
used as inputs. When pins P1.2 to P1.7 are used as inputs and are
externally pulled low, they will source current (IIL) because of the
internal pullups. Port 1 also receives code data during Flash
programming and program verification.

Port 3
Port 3 pins P3.0 to P3.5, P3.7 are seven bidirectional I/O pins
with internal pull-ups. P3.6 is hard-wired as an input to the output of
the on-chip comparator and is not accessible as a general purpose I/O
pin. The Port 3 output buffers can sink 20 mA. When 1s are written to
Port 3 pins they are pulled high by the internal pull-ups and can be
used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89C2051 as
listed below:

28
Table 3.1 Alternate Functions of port 3

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

RST
Reset input. All I/O pins are reset to 1s as soon as RST goes
high. Holding the RST pin high for two machine cycles while the
oscillator is running resets the device. Each machine cycle takes 12
oscillator or clock cycles.

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

XTAL2
Output from the inverting oscillator amplifier.

29
3.1.4 Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively, of an


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

Figure.3.3 Oscillator Connections

3.2 DTMF Decoder

The MT8870 is a single chip DTMF receiver in corpora ting


switched capacitor filter technology and an advanced digital
counting / averaging algorithm for period measurement. The
functional block diagram of MT8870 is shown in the below figure
depicts the internal working of this device.

30
Figure.3.4 Functional diagram of IC MT8870

The DTMF signal is first buffered by input op-amp that allows


adjustment gain and choice of input configuration. The input stage is
followed by a low pass RC active filter, which performs ant aliasing
function. Dial tone at 350 and 440Hz is then rejected by a 3rd order
switched capacitor notch filter. The signal is still in its individual
components by two 6th order switched capacitor band pass filter. Each
component smoothed by an output filter and squared by a hard
limiting comparator. The two resulting rectangular waveforms are
then applied to a digital circuit, where a counting algorithm measures
and averages there periods. An accurate reference clock is derived
from an inexpensive external 3.58MHz crystal.

31
The time required to detect a valid tone pair tdP is a function of
decode algorithm, tone frequency, and the previous state of the
decoded logic. Est (early, steering output) indicates that two tones of
valid frequency have been detected and initiates an RC timing circuit.
If both tones are present for a minimum guard time, determined by an
external RC network, the DTMF signal is decoded and the resulting
data latched on the output register. The delayed steering output (stD)
is raised to indicate that new data is available. (The output
corresponding to each key pressed is shown in the truth table)

3.2.1Tone detection
After receiving a DTMF tone the DTMF decoder (MT8870)
places the corresponding binary number on its out put (StD) goes high
to state that new data is available. The detection of the delayed
steering output is to the duration of the received DTMF receiver has
already been explained.

32
3.2.2 PIN DIAGRAM OF IC MT8870

Figure.3.5 Pin Diagram of IC MT8870

33
Pin Description

Table.3.2 Pin description of IC MT8870

34
Recommended Operating Condition

Table: 3.3 Operating conditions of IC MT8870

3.2.3 Functional Description

The MT8870D/MT8870D-1 monolithic DTMF receiver


offers small size, low power consumption and high performance.
Its architecture consists of a band split filter section, which
separates the high and low group tones, followed by a digital
counting section which verifies the frequency and duration of the
received tones before passing the corresponding code to the
output bus.

Filter Section

Separation of the low-group and high group tones is achieved


by applying the DTMF signal to the inputs of two sixth-order
switched capacitor band pass filters, the bandwidths of which
correspond to the low and high group frequencies. The filter section
also incorporates notches at 350 and 440 Hz for exceptional dial
tone rejection (see Figure 3). Each filter output is followed by a
single order switched capacitor filter section which smoothes the

35
signals prior to limiting. Limiting is performed by high-gain
comparators which are provided with hysteresis to prevent detection
of unwanted low-level signals. The outputs of the comparators
provide full rail logic swings at the frequencies of the incoming
DTMF signals.

Decoder Section

Following the filter section is a decoder employing digital


counting techniques to determine the Frequencies of the incoming
tones and to verify that they correspond to standard DTMF
frequencies. A complex averaging algorithm protects against tone
simulation by extraneous signals such as voice while providing
tolerance to small frequency deviation and variations. This averaging
algorithm has been developed to ensure an optimum combination of
immunity to talk-off and tolerance to the presence of interfering
frequencies (third tones) and noise. When the detector recognizes the
presence of two valid tones (this is referred to as the “signal
condition” in some industry specifications) the “Early Steering”(ESt)
output will go to an active state. Any subsequent loss of signal
condition will cause ESt to assume an inactive state. The steering
circuit works in reverse to validate the inter digit pause between
signals. Thus, as well as rejecting signals too short to be considered
valid, the receiver will tolerate signal interruptions (dropout) too
short to be considered a valid pause. This facility, together with the
capability of selecting the steering time constants externally, allows
the designer to tailor performance to meet a wide variety of system
requirements.

36
3.2.4 Guard Time Adjustment

In many situations not requiring selection of tone duration and


inter digital pause, the simple steering circuit shown in Figure 4 is
applicable. Component values are chosen according to the formula:
tREC=tDP+tGTP
tID=tDA+tGTA
The value of tDP is a device parameter and tREC is the
minimum signal duration to be recognized by the receiver. Different
steering arrangements may be used to select independently the guard
times for tone Present (tGTP) and tone absent (tGTA). This may be
necessary to meet system specifications which place both accept and
reject limits on both tone duration and interdigital pause. Guard time
adjustment also allows the designer to tailor system parameters such
as talk off and noise immunity. Increasing tREC improves talk-off
performance since it reduces the probability that tones simulated by
speech will maintain signal condition long enough to be registered.
Alternatively, a relatively short tREC with a long tDO would be
appropriate for extremely noisy. Environments such as fast
acquisition time and immunity to tone drop-outs are required.

Power-down and Inhibit Mode

A logic high applied to pin 6 (PWDN) will power down the


device to minimize the power consumption in a Stand by mode. It
stops the oscillator and the functions of the filters. Inhibit mode is
enabled by a logic high input to the pin 5 (INH). It inhibits the
detection of tones representing characters A, B, C, and D. The output
code will remain the same as the previous detected code.

37
Differential Input Configuration

The input arrangement of the MT8870D/MT8870D-1 provides a


differential-input operational amplifier as well as a bias source
(VRef) which is used to bias the inputs at mid-rail. Provision is made
for connection of a feedback resistor to the op-amp output (GS) for
adjustment of gain. In a single-ended configuration, the input pins are
connected as shown in Figure 10 with the op-amp connected for unity
gain and VRef biasing the input at 1/2VDD. Figure 6 shows the
differential configuration, which permits the adjustment of gain with
the feedback resistor.

Crystal Oscillator

The internal clock circuit is completed with the addition of an


external 3.579545 MHz crystal and is normally connected as shown in
Figure (Single- Ended Input Configuration).However; it is possible to
configure several MT8870D/MT8870D-1 devices employing only a
single oscillator crystal. The oscillator output of the first device in
the chain is coupled through a 30 pF capacitor to the oscillator input
(OSC1) of the next device. Subsequent devices are connected in a
similar fashion. The problems associated with unbalanced loading are
not a concern with the arrangement shown, i.e., precision balancing
capacitors are not required.

38
3.2.5 Tone Decoding of MT8870

Table 3.4: Tone Decoding of MT8870


3.2.6 Features

• Complete DTMF Receiver recommended for most applications,


leaving R to be selected by the designer
• Low power consumption
• Internal gain setting amplifier
• Central office quality
• Power-down mode
• Inhibit mode
• Backward compatible with MT8870C/MT8870C-1

39
3.2.7 Applications

• Paging systems
• Repeater systems/mobile radio
• Credit card systems
• Remote control
• Personal computers
• Telephone answering machine

3.3 VOLTAGE CONVERTER (MAX232)

The MAX220–MAX249 family of line drivers/receivers is


intended for all EIA/TIA-232E and V.28/V.24 communications
interfaces, particularly applications where ±12V is not available.
These parts are especially useful in battery-powered systems, since
their low-power shutdown mode reduces power dissipation to less
than 5μW.

Feature

• Operate from Single +5V Power Supply


• Low-Power Receive Mode in Shutdown
• Meet All EIA/TIA-232E and V.28 Specifications
• Multiple Drivers and Receivers
• 3-State Driver and Receiver Outputs

40
3.3.1 PIN Diagram

Figure.3.6 Pin Diagram of MAX232

Since the RS232 is not compatible with today’s microprocessors


and microcontrollers, we need a line driver (voltage converter) to
convert the RS232’s signals to TTL voltage levels that will be
acceptable to the 8051’s TxD and RxD pins. One example of such a
converter is MAX232 from Maxim Corp. The MAX 232 converts from
RS232 voltage levels to TTL voltage levels, and vice versa. One
advantage of the MAX232 chip is that it uses a+5V power source
which is the same as the source voltage for the 8051. In other words,
with a single +5 V power supply we can power both the 80551 and
MAX232, with no need for the dual power supplies that are common
in many older systems.

41
3.3.2 Functional Diagram of MAX232

Figure.3.7 Functional Diagram of MAX232

The MAX232 has two sets of line drivers for transferring and
receiving data, as shown in Figure 10-7. The line drivers used for
TxD are called T1 and T2 while the line drivers for Rxd are
designated as R1 and R2. In many applications only one of each is
used for example, T1 and R1 are used together for TxD and RxD of
the 8051 and the second set is left unused. Notice in MAX232 that the
T1 line driver has a designation of T1 in and T1 out on pin numbers
11 and 14, respectively. The T1 in pin is the TTL side and is

42
connected to TxD of the microcontroller, while T1 out is the RS232
side that is connected to the RxD pin of the RS232 DB connector.

The R1 line driver has a designation of R1 in and R iout on pin


numbers 13 and 12, respectively. The R1 in (pin 13) is the RS232 side
that is connected to the TxD pin of the RS232 DB connector, and R1
out (pin 12) is the TTL side that is connected to the RxD pin of the
microcontroller. See figure 10-7. Notice the null modem connection
where RxD for one is TxD for the other.

MAX232 requires four capacitors ranging from 1 to 22F. The


most widely used value for these capacitors is 22nf.

3.3.3 APPLICATIONS

• Portable Computers
• Low-Power Modems
• Interface Translation
• Battery-Powered RS-232 Systems
• Multidrop RS-232 Networks

43
4. CIRCUIT DIAGRAM

Figure.4.1 Circuit Diagram

44
4.1 CIRCUIT OPERATION

When the telephone ring arrives the ring sensor detects it and it
will send a signal to the microcontroller. The Microcontroller will
then take the phone with help of ON/OFF hook simulator and it will
sense the DTMF signal and it will get the DTMF signal and the
Microcontroller will switch on the corresponding Relay.

At normal time the voltage across the telephone line is 48v and
when a ring arrives then a voltage of 74v AC is injected through the
telephone and this AC will pass through the capacitor C4 and though
the zener diodes to the LED in the optocoupler and it will conduct
and this light will conduct the photo transistor and therefore a low
signal was fed to the microcontroller and it will then switch on the
Hook Relay of a telephone.

The DTMF receiver will decode the tone signal into digital
which was fed to the microcontroller for further control. The main
part of the circuit was done by the Microcontroller AT89C2051. The
DTMF signal from the Telephone was decoded by the Decoder IC
MT8870. The Decoder get the DTMF signal from Telephone line and
this decoded digital signal was fed to the Microcontroller. The
microcontroller will sent the decoded DTMF signal to the PC through
its serial port.

The data from the microcontroller was fed to the PC through a


voltage converter. The data from the computer serial port was in
RS232 logic. That is for logic 1 the voltage is –9V and for logic 0 the
voltage is +9V and at TTL side the Voltage for logic 1 is +5V and for

45
logic 0 is 0V. There fore for connecting this two section (RS232 and
TTL) we need a converter.
The Converter used in our circuit is IC MAX232. This IC has
two sets of converter in which we are using a set. The data from the
PC is fed to the converter and the converter converts the data into
TTL logic which is fed to the microcontroller.

4.1.1 Telephone Ring sensor

This Circuit can be used to connect any telephone to the telephone


line. When the telephone handsets are in on-hook position, the current
through the optocoupler LEDs is inadequate to activate their inbuilt
transistors. However the ring signal passes to telephone in parallel
since the telephone line is connected to the telephone instruments
through combination of inbuilt LEDs of optocouplers in parallel with
reverse diodes while the ‘-‘marked telephone line is connected to the
relay. Initially when the handsets of all the telephones are on the
cradles, the optocoupler will not conduct adequately and as such the
emitters of inbuilt transistors of optocouplers are at low level. The
transistor output available at the emitters are inverted to logic 1 state
and applied to the Microcontroller.

In this circuit optocoupler is used to sense the ring signal. A


ring voltage from exchange is around 70 to 90volt (25 HZ AC) come
via telephone lines. The telephone line is connected to the ring sensor
(optocoupler IC MCT2E) will detect this signal and the capacitor C2
(1µf/25v) bypasses the 13.5mA to60maA, AC ringing current so that
the optocoupler get turned ON (the diode antiparallel with the LED)
an optocoupler provide condition during the negative half cycle of the
ringing current. As the result, transistor T1 gets forward biased and it
conducts, pulling it’s collector towards ground. This will turn ON the

46
relay by providing the magnetizing current. This will Ceases the DC
voltage across the phone line. The audio signal is extended to the
ON/OFF hook detector (Optocoupler IC).If the telephone hand set is
ON hook condition means the telephone Line consist of 48v, to get a
closed loop connection with the exchange for communication. Here
an optocoupler is used for ON/OFF hook detection, it gets this 48v as
input and the photodiode acquire a conduction voltage around 12v by
the use of resistor R1. The conduction of photodiode emits light
towards photo transistor and there by it gets the GND, which connect
a 10k resistor (R2) across the Telephone Line. So that the exchange
detect a signal from the subscribers, that the subscriber was ready for
communication. If the telephone line is used for message Tx and Rx
means, the hand set is first picked up to conform that the in coming
signal is Voice or Message .After that the subscriber can place the
hand set with the base set. Once the hand set is picked up means the
µc will sent a acknowledgement signal to the µc at the designation
side .so that the hook detector will provide voltage drop in the Land
line voltage, there by a closed loop circuit is formed between
Subscribers and Telephone exchange.

If it is a Voice signal means the ON/OFF hook detector function


is same and the Hand set is used for Voice communication. Once the
hand set is placed with the base set after the voice or message
communication means the Relay connected with Ring sensor get de-
energized and Telephone line is disconnected by the µc.

Optocoupler (IC MCT2E)

The MCT2E optoisolators consist of a gallium arsenide infrared


emitting diode driving a silicon phototransistor in a 6-pin dual in-line
package.

47
Figure.42 Phototransistor Optocouple

Feature

• UL recognized (File # E90700)


• VDE recognized (File # 94766)
• MCT2 and MCT2E are also available in white package
by specifying -M suffix, eg. MCT2-M

Schematic Diagram

Figure.4.3 Schematic diagram of optocoupler

48
PIN 1. ANODE
2. CATHODE
3. NO CONNECTION
4. EMITTER
5. COLLECTOR
6. BASE

Application

• Power supply regulators


• Digital logic inputs
• Microprocessor inputs

4.1.2 ON/OFF HOOK SIMULATOR

During ring signal 70 to 90V rms at 20 -25HZ AC will come


through the telephone line from the Exchange battery. The outgoing
signaling refers signal reaching the exchange from the subscribers
telephone, indicating ON-hook, OFF- hook, hang up, dialing etc. Once
the hand set is picked up means it is in off hook condition and now
the voltage reduces to 47v to 48v and (it is given to input on ON/OFF
hook detector optocoupler IC)Cradle switch closes to form a closed
loop circuit with the exchange battery and the telephone circuit. This
circuit is referred as the local loop circuit. Exchange battery voltages
are typically 48 volts. The loop current is used by the exchange to
establish ON/OFF hook status of the telephone. If the loop current is
13.5mA to 60mA the exchange detects it as OFF hook condition and if
the loop current is less than 7.5mA the exchange interprets it as ON
hook condition.

49
The operated line voltage is about 50v DC and the incoming
voice voltage to the telephone instrument varies from 0.5v to 1 volt
and the maximum out going voice voltage is abut 2v rms.The ring
signal is 70- 90v rms at 20 -25HZ.In pulse dialing telephones register
signaling is known as DC loop signaling. In this case the dialed
number is conveyed to the exchange by “make” and “break” of loop
circuit.
When a ring signal is present, the microcontroller will switch on
the RELAY to achieve OFF hook condition.

4.1.2.1 RELAY

The relay is one of the most widely used components in industrial


electronics. In combination with transistors, SCRs, electron tubes, and
other circuit element, this electromagnetic device performs countless
tasks. This relays are used as protective device for switching, for
indicating and for transmission.

Transmission relays are used in conjunction with transformers,


inductors, capacitors in power system and in telephone and in other
communication systems. Relays are electro magnetically operated
remotely controlled switches with one or more sets of contacts. When
energized, the relay operates to open or close its contacts or to open
some contacts and close others. Contacts which are open when the relay
is not energized are called normally open (NO) or simply open
contacts. Contacts, which are closed when the relay is not energized,
are called normally closed contacts.

50
Figure.4.4 Relay

Relay contact are held in their normal position either by spring or


by some gravity activated mechanism. An adjustment or adjustments are
usually provided to set restraining force to cause the relay to operate
within predetermined circuit conditions.

Relays are electro magnetic components which has an operating


coil and contact. The coil shall be energized with AC or DC supply.
Accordingly relays are available with AC\DC operating coils of various
magnitudes say from 6V DC to 220 V DC or for AC voltages ranging
from 20V AC to 440 AC.

The operating principle of relays is as follows when the coil is


energized, an iron core attached to this assembly gets magnetized. This
then attracts an armature which has electrical connected to it. The
electrical terminals should be fabricated in such away that there shall be
one common terminal; one normally closed (NC) contact and one
normally open (NO) contacts. When the relay is not energized the
connection is closed between common and NO contacts this state is
reversed when the relay is energized this relay circuit shall be used to
switch on other power circuits, using low control voltage. The power
circuit and control circuit are practically isolated.

51
Relay Construction

A relay is an electrically controlled device that open and close


electrical contact affecting other contacts (devices) in the same or other
circuits. Operation of the relay is discussed below.

If the circuit in the coil is slowly increased from 0, a point will be


reached where the armature snaps (closing the gap) and closes the
normally opened contact (NO).This is called pickup point and is
specified by it circuit or voltage by the manufacturer when the circuit in
the coil is gradually decreased, a point were the flux is too week to hold
the gap closed is reached and the armature snaps open. This is called the
dropout circuit (or voltage) and is usually considered less than the
pickup current (or voltage) the only noticeable physical difference
between AC and DC relays with the same rating is the addition of the
shaded pole at the end of the core. A shaded pole is a conducting ring
that creates a magnetic field that lays the applied field, prohibiting the
rapid collapse of the flux across the gap. If this were not the case the
relay would hum or chatter at a 60Hz rate and contact position would be
undetermined. The shading also causes are relays to be inherently slower
to release than dc relays if the same size. The delay is about 100ms or
longer to prevent contact release at each polarity reversal on 60 Hz
operation.

The contacts in an electromagnetic relays make or break the


connection in electric circuits high current contacts are usually of the
single button or by bifurcated style. Noble metal alloys are used for the
contact material to reduce oxidation that causes oxidation that causes
high resistance the bifurcated contact has two surfaces for less contact
resistance at lower activating force

52
The core bar contacts are used for dry circuit (NO or little current
flow) and are made of gold to hinder and oxidation for low level (milli
volts or micro volts) Switching circuit.

Contact arcing is more common in DC than in AC circuit


interruption the AC circuits go through 0 voltages at each half cycle and
extinguish any arcing that occurs. Any metal transfer is generally
eliminated, except for roughening of a contact faces. The DC arcing are
Spark discharge is damaging and will cause metal to transfer from the
negative contact to the positive contact.

4.1.3 Serial Ports in Computer

All IBM PC and compatible computers are typically equipped


with two serial ports and one parallel port. Although these two types
of ports are used for communicating with external devices, they work
in different ways.

A parallel port sends and receives data eight bits at a time over
8 separate wires. This allows data to be transferred very quickly;
however, the cable required is more bulky because of the number of
individual wires it must contain. Parallel ports are typically used to
connect a PC to a printer and are rarely used for much else. A serial
port sends and receives data one bit at a time over one wire. While it
takes eight times as long to transfer each byte of data this way, only a
few wires are required. In fact, two-way (full duplex) communications
is possible with only three separate wires - one to send, one to
receive, and a common signal ground wire.

53
Introduction to Serial Port

The UART serial port (or just "serial port for short" is an I/O
(Input/Output) device. An I/O device is just a way to get data into and
out of a computer. There are many types of I/O devices such as serial
ports, parallel ports, disk drive controllers, ethernet boards, universal
serial buses, etc. Most PC's have one or two serial ports. Each has a
9-pin connector (sometimes 25-pin) on the back of the computer.
Computer programs can send data (bytes) to the transmit pin (output)
and receive bytes from the receive pin (input). The other pins are for
control purposes and ground.

The serial port is much more than just a connector. It converts


the data from parallel to serial and changes the electrical
representation of the data. Inside the computer, data bits flow in
parallel (using many wires at the same time). Serial flow is a stream
of bits over a single wire (such as on the transmit or receive pin of
the serial connector). For the serial port to create such a flow, it must
convert data from parallel (inside the computer) to serial on the
transmit pin (and conversely).

Pins and Wires

Old PC's used 25 pin connectors but only about 9 pins were
actually used so today most connectors are only 9-pin. Each of the 9
pins usually connects to a wire. Besides the two wires used for
transmitting and receiving data, another pin (wire) is signal ground.
The voltage on any wire is measured with respect to this ground.

54
Thus the minimum number of wires to use for 2-way
transmission of data is 3. Except that it has been known to work with
no signal ground wire but with degraded performance and sometimes
with errors. There are still more wires which are for control purposes
(signaling) only and not for sending bytes. All of these signals could
have been shared on a single wire, but instead, there is a separate
dedicated wire for every type of signal. Some (or all) of these control
wires are called "modem control lines". Modem control wires are
either in the asserted state (on) of +12 volts or in the negated state
(off) of -12 volts. One of these wires is to signal the computer to stop
sending bytes out the serial port cable. Conversely, another wire
signals the device attached to the serial port to stop sending bytes to
the computer. If the attached device is a modem, other wires may tell
the modem to hang up the telephone line or tell the computer that a
connection has been made or that the telephone line is ringing
(someone is attempting to call in).

Bi-Directional Communications

The serial port on your PC is a full-duplex device meaning that


it can send and receive data at the same time. In order to be able to
do this, it uses separate lines for transmitting and receiving data.
Some types of serial devices support only one-way communications
and therefore use only two wires in the cable - the transmit line and
the signal ground.

Communicating By Bits

Once the start bit has been sent, the transmitter sends the actual
data bits. There may either be 5, 6, 7, or 8 data bits, depending on the
number you have selected. Both receiver and the transmitter must

55
agree on the number of data bits, as well as the baud rate. Almost all
devices transmit data using either 7 or 8 data bits. Notice that when
only 7 data bits are employed, you cannot send ASCII values greater
than 127. Likewise, using 5 bits limits the highest possible value to
31. After the data has been transmitted, a stop bit is sent. A stop bit
has a value of 1 - or a mark state - and it can be detected correctly
even if the previous data bit also had a value of 1. This is
accomplished by the stop bit's duration. Stop bits can be 1, 1.5, or 2
bit periods in length.

The Parity Bit

Besides the synchronization provided by the use of start and


stop bits, an additional bit called a parity bit may optionally be
transmitted along with the data. A parity bit affords a small amount
of error checking, to help detect data corruption that might occur
during transmission. You can choose even parity, odd parity, mark
parity, space parity or none at all. When even or odd parity is being
used, the number of marks (logical 1 bits) in each data byte is
counted, and a single bit is transmitted following the data bits to
indicate whether the number of 1 bits just sent is even or odd.

For example, when even parity is chosen, the parity bit is


transmitted with a value of 0 if the number of preceding marks is an
even number. For the binary value of 0110 0011 the parity bit would
be 0. If even parity was in effect and the binary number 1101 0110
was sent, then the parity bit would be 1. Odd parity is just the
opposite, and the parity bit is 0 when the number of mark bits in the
preceding word is an odd number. Parity error checking is very
rudimentary. While it will tell you if there is a single bit error in the
character, it doesn't show which bit was received in error. Also, if

56
even numbers of bits are in error then the parity bit would not reflect
any error at all.

Mark parity means that the parity bit is always set to the mark
signal condition and likewise space parity always sends the parity bit
in the space signal condition. Since these two parity options serve no
useful purpose whatsoever, they are almost never used.

RS-232C

RS-232 stands for Recommend Standard number 232 and C is


the latest revision of the standard. The serial ports on most computers
use a subset of the RS-232C standard. The full RS-232C standard
specifies a 25-pin "D" connector of which 22 pins are used. Most of
these pins are not needed for normal PC communications, and indeed,
most new PCs are equipped with male D type connectors having only
9 pins.

Pin Details of PC Serial port

RS232
Connector
1 CD DSR 6
2 RD
3 RTS 7
TD
4 CTS 8
DTR
5 RI 9
GND

57
9 Pin Connector on a DTE device (PC connection)
Pin
Direction of signal:
Number
Carrier Detect (CD) (from DCE) Incoming signal from a
1
modem
2 Received Data (RD) Incoming Data from a DCE
3 Transmitted Data (TD) Outgoing Data to a DCE
4 Data Terminal Ready (DTR) Outgoing handshaking signal
5 Signal Ground Common reference voltage
6 Data Set Ready (DSR) Incoming handshaking signal
7 Request To Send (RTS) Outgoing flow control signal
8 Clear To Send (CTS) Incoming flow control signal
Ring Indicator (RI) (from DCE) Incoming signal from a
9
modem

Table 4.1: Pins of RS232

The TD (transmit data) wire is the one through which data from
a DTE device is transmitted to a DCE device. This name can be
deceiving, because this wire is used by a DCE device to receive its
data. The TD line is kept in a mark condition by the DTE device when
it is idle. The RD (receive data) wire is the one on which data is
received by a DTE device. RTS stands for Request To Send. This line
and the CTS line are used when "hardware flow control" is enabled in
both the DTE and DCE devices.

The DTE device puts this line in a mark condition to tell the
remote device that it is ready and able to receive data. If the DTE
device is not able to receive data (typically because its receive buffer
is almost full), it will put this line in the space condition as a signal
to the DCE to stop sending data. When the DTE device is ready to

58
receive more data (i.e. after data has been removed from it’s receive
buffer), it will place this line back in the mark condition. The
complement of the RTS wire is CTS, which stands for Clear to Send.
The DCE device puts this line in a mark condition to tell the DTE
device that it is ready to receive the data.

Likewise, if the DCE device is unable to receive data, it will


place this line in the space condition. Together, these two lines make
up what is called RTS/CTS or "hardware" flow control. The Software
Wedge supports this type of flow control, as well as Xon/XOff or
"software" flow control. Software flow control uses special control
characters transmitted from one device to another to tell the other
device to stop or start sending data. With software flow control the
RTS and CTS lines are not used.

DTR stands for Data Terminal Ready. Its intended function is


very similar to the RTS line. DSR (Data Set Ready) is the companion
to DTR in the same way that CTS is to RTS. Some serial devices use
DTR and DSR as signals to simply confirm that a device is connected
and is turned on. The Software Wedge sets DTR to the mark state
when the serial port is opened and leaves it in that state until the port
is closed. The DTR and DSR lines were originally designed to provide
an alternate method of hardware handshaking. It would be pointless to
use both RTS/CTS and DTR/DSR for flow control signals at the same
time. Because of this, DTR and DSR are rarely used for flow control.

CD stands for Carrier Detect. Carrier Detect is used by a


modem to signal that it has a made a connection with another modem,
or has detected a carrier tone.

59
The last remaining line is RI or Ring Indicator. A modem
toggles the state of this line when an incoming call rings your phone.

The Carrier Detect (CD) and the Ring Indicator (RI) lines are
only available in connections to a modem. Because most modems
transmit status information to a PC when either a carrier signal is
detected (i.e. when a connection is made to another modem) or when
the line is ringing, these two lines are rarely used.

4.2 POWER SUPPLY

Figure 45 Power Supply Unit

The power supply section is the important one. It should deliver


constant output regulated power supply for successful working of the
project. A 0-12V/500mA transformer is used for our purpose; the
primary of this transformer is connected in to main supply through
on/off switch& fuse for protecting from overload and short circuit
protection. The secondary is connected to the diodes convert from
12V AC to 12V DC voltage, which is further regulated to +5v, by
using IC 7805.

60
4.2.1 Regulator IC (LM 7805)

The LM7805 monolithic 3-terminal positive voltage regulators


employ internal current-limiting, thermal shutdown and safe-area
compensation, making them essentially indestructible. If adequate
heat sinking is provided, they can deliver over 1.0A output current.
They are intended as fixed voltage regulators in a wide range of
applications including local (on-card) regulation for elimination of
noise and distribution problems associated with single-point
regulation. In addition to use as fixed voltage regulators, these
devices can be used with external components to obtain adjustable
output voltages and currents.
Considerable effort was expended to make the entire series of
regulators easy to use and minimize the number of external
components. It is not necessary to bypass the output, although this
does improve transient response. Input bypassing is needed only if the
regulator is located far from the filter capacitor of the power supply.

Figure.4.6 Pins of LM780


5. SOFTWARE DESCRIPTION

5.1 Visual Basic 6.0

61
Visual Basic (Visual Beginners All purpose symbolic
Instruction Code) is the most popular programming language for
world’s most popular operating system. Visual Basic is the first
language people consider when they want rapid application
development for the window environment. Visual Basic is evolved
from the original BASIC language, which is widely used language.
Existing objects are dragged & dropped in to the place instead of
writing numerous codes. While writing the programs, we are able to
see how the programs run during the run time. This is great advantage
over other programming language. VB is based on an event driven
method model; it also has a set of debugging tools. The primary
reason behind selecting VB was because the interface was so little
compared to other tools.

Properties
The properties describe the appearance of the GUI component.
When adding a component, the Name property should be set
immediately, according to the three-letter mnemonic naming
conventions. The properties are displayed in the Properties Window in
Name/Value pairs in alphabetical order.

Event Procedures
An event procedure is a piece of code that responds to events
that can occur for that object. Most of the events are generated by the
user, enabling them to dictate the order of execution.

Forms
The Form is the main stage of your application. By default, the
Standard Exe option starts with a form called "Form1". The Name
property of the Form should be named with a three-letter mnemonic

62
prefix of "frm". Each Form will be a Window in your application.
Controls are added to the form by either double-clicking them in the
toolbox, or by selecting the control and drawing a bounding rectangle
on the form. Your application may use more than one form.

To add a new Form to the project, either select "Add Form"


from the "Project" menu or right-click the Forms folder in the Project
Explorer and select, "Add", and then "Form".

To load a new form, use the Show method. The parameter,


vbModal, is optional. If used, vbModal means that the form has focus
until closed within the application.

The Load command can be used to load a form without showing


it. This technique is useful if you want to preload a form, and then
use either the "Show" or "Visible" method to make it visible as and
when required.

Note: In VB.Net, there are two types of Forms - Windows Forms and
Web Forms. Web Forms are based on ASP.Net.

Standard Controls
Controls are added to the Form from the Toolbox. Each control
has a set of properties, and a set of event procedures associated with

63
it. The following lists the control, reading left to right, top to bottom
as they appear in the standard Toolbox.

The Pointer
The Pointer is not a control, but is used to interact with the
controls on the form, allowing you to move and resize them. The
Pointer is selected by default. When a control is added to the form,
the focus reverts back to the Pointer.

PictureBox Control
The PictureBox is used to display images or act as a container
to other controls. The three-letter mnemonic for a PictureBox is pic
(eg. picFace). The main event for a PictureBox is the Click event.
Pictures are loaded into the PictureBox using the LoadPicture
function. The following example toggles between face0.gif and
face1.gif with each click of the mouse.

Label Control
The Label control is used to display text that can't be changed
directly by the user. Labels are more commonly used to place captions
against other controls or store calculated values. The three-letter
mnemonic for a Label is lbl (eg. lblPrompt).
The default property of a Label is Caption. The Caption property may
be set at design-time using the Properties Window, and changed at
run-time.

Label Control
The Label control is used to display text that can't be changed
directly by the user. Labels are more commonly used to place captions

64
against other controls or store calculated values. The three-letter
mnemonic for a Label is lbl (eg. lblPrompt). The default property of a
Label is Caption. The Caption property may be set at design-time
using the Properties Window, and changed at run-time.

To allow text on more than one line, the Multiline Property


must be set to True. If the ScrollBars Property doesn't allow a
Horizontal ScrollBar, then the text will wrap. The length of the Text
property is limited to 2048 characters for a TextBox, and about 32K if
the MultiLine property is set to True.

Frame Control
The Frame control is used to group controls and provides a
means of sub-dividing the Form visually. The three-letter mnemonic
for a Frame is fra (eg. fraPaymentMethod). The default property is
Caption, which can be used to give context to the grouping (eg.
Payment Method).

When option buttons are used, only one may be selected on the
Form. Option Buttons placed in a Frame are associated with the
Frame, and are treated as a new group.

Command Button Control


The Command Button is used by the user to invoke some action.
The three-letter mnemonic for a Command Button is cmd (eg.
cmdQuit). The default event for a Command Button is "Click".

Checkbox Control
The CheckBox control is used to give the user a choice of
yes/no multiple choice options. The three-letter mnemonic for a

65
CheckBox is chk (eg. chkHobbies). The "Value" property may be used
to determine whether an item has been selected - a value of 1
indicates true, and a value of 0 indicates false. The following
example uses a command button to determine which items have been
selected from a control array of CheckBoxes.

OptionButton Control
The OptionButton control is used to group options where the
user can only select only one. As only one item may be selected
OptionButtons are grouped in containers such as the Form, Frame or
PictureBox. The three-letter mnemonic for an OptionButton is opt (eg.
optPaymentMethod). The "Value" property may be used to determine
whether an item has been selected - either True or False. The
following example uses a CommandButton to determine which item
has been selected from a control array of OptionButtons.

ComboBox Control

The ComboBox is a combination of a TextBox and a ListBox


control. Items may be added to the list at design-time using the "List"
property (<CTRL>+<ENTER> takes you to the next line to add a new
item). Items may be added to the list at run-time using the AddItem
method, and removed at run-time using the RemoveItem method (see
below for details). The "Clear" method removes all items from the
list. The three-letter mnemonic for a ComboBox is cbo (eg.
cboArtist).

Timer Control

66
The Timer control is visible at design-time, but not shown at
run-time. It is used for background processing at intervals specified
by the Interval property. The Interval property takes an integer in the
range 0 to 65,535. The Interval is measured in milliseconds; therefore
a value of 1000 equals an interval of one second. An Interval of 0
disables the Timer control in VB 6, but not in VB.Net. To disable the
Timer, set the Enabled Property to False. Setting it to True will
enable it again. The three-letter mnemonic for a Timer is tmr (eg.
tmrMove). The default event for a Timer is the Timer event.
This example moves a PictureBox around the form. To try the
example, add a PictureBox called picFace, and a Timer called
tmrMove to the form. Set the Interval of the Timer to 1, and add a
picture of a face to the PictureBox.

5.2. Visual Basic (Serial Communication)

5.2.1 Introduction

This chapter discusses how Visual Basic can be used to access


serial communication functions. Windows hides much of the
complexity of serial communications and automatically puts any
received characters in a receive buffer and characters sent into a
transmission buffer. The receive buffer can be read by the program
whenever it has time and the transmit buffer is emptied when it is
free to send characters.

5.2.2 Communications control

Visual Basic allows many additional components to be added to


the toolbox. The Microsoft Comm. component is used to add a serial
communication facility. In order to use the Comms component the

67
files MSCOMM16.OCX (for a 16-bit module) or MSCOMM32.OCX
(for a 32-bit module) must be present in the \WINDOWS\SYSTEM
directory. The class name is MSComm. The communications control
provides the following two ways for handling communications

Event-driven

Event-driven communications is the best method of handling


serial communication as it frees the computer to do other things. The
event can be defined as the reception of a character, a change in CD
(carrier detect) or a change in RTS (request to send). The OnComm
event can be used to capture these events. and also to detect
communications errors.

Polling

CommEvent properties can be tested to determine if an event or


an error has occurred. For example, the program can loop waiting for
a character to be received. Once it is the character is read from the
receive buffer. This method is normally used when the program has
time to poll the communications receiver or that a known response is
imminent.

Visual Basic uses the standard Windows drivers for the serial
communication ports (such as serialui.dll and serial.vxd). The
communication control is added to the application for each port. The
parameters (such as the bit rate, parity, and so on) can be changed by
selecting Control Panel ? System ? Device Manager ? Ports (COM
and LPT) ? Port Settings. The settings of the communications port
(the IRQ and the port address) can be changed by selecting Control

68
Panel? System? Device Manager? Ports (COM and LPT)? Resources
for IRQ and Addresses.

Properties

The Comm component is added to a form whenever serial


communications are required. By default, the first created object is
named MSComm1 (the second is named MSComm2, and so on). It can
be seen that the main properties of the object are: CommPort,
DTREnable, EOFEnable, Handshaking, InBufferSize, Index, InputLen,
InputMode, Left, Name, NullDiscard, OutBufferSize, ParityReplace,
RThreshold, RTSEnable, Settings, SThreshold, Tag and Top.

Settings

The Settings property sets and returns the RS-232 parameters,


such as baud rate, parity, the number of data bit, and the number of
stop bits. Its syntax is:
[form.]MSComm.Settings = setStr[$]
where the strStr is a string which contains the RS-232 settings. This
string takes the form:
"BBBB,P,D,S"
where
BBBBdefines the baud rate,
P the parity,
D the number of data bits, and
S the number of stop bits.
The following lists the valid baud rates (default is 9600Baud):
110, 300, 600, 1200, 2400, 9600, 14400, 19200, 38400, 56000,
128000, 256000.

69
The valid parity values are (default is N): E (Even), M (Mark), N
(None), O (Odd), S (Space).
The valid data bit values are (default is 8): 4, 5, 6, 7 or 8.
The valid stop bit values are (default is 1). 1, 1.5 or 2.
An example of setting a control port to 4800Baud, even parity, 7 data
bits and 1 stop bit is: Com1.Settings = "4800,E,7,1"

CommPort

The CommPort property sets and returns the communication port


number. Its syntax is:
[form.]MSComm.CommPort = portNumber[%]
which defines the portNumber from a value between 1 and 99. A value
of 68 is returnedif the port does not exist.

PortOpen

The PortOpen property sets and returns the state of the


communications port. Its syntax is:
[form.]MSComm.PortOpen = [{True | False}]
A True setting opens the port, while a False closes the port and
clears the receive andtransmit buffers (this automatically happens
when an application is closed). The following example opens
communications port number 1 (COM1:) at 4800 Baud with even
parity, 7 data bits and 1 stop bit:

Inputting data

The three main properties used to read data from the receive
buffer are Input, InBuffer Count and InBufferSize.

70
Input

The Input property returns and removes a string of characters from


the receive buffer. Its syntax is:
[form.]MSComm.Input
To determine the number of characters in the buffer the
InBufferCount property is tested (to be covered in the next section).
Setting InputLen to 0 causes the Input property to read the entire
contents of the receive buffer.

InBufferSize

The InBufferSize property sets and returns the maximum number


of characters that can be received in the receive buffer (by default it
is 1024 bytes). Its syntax is:
[form.]MSCommInBufferSize = [numBytes%]
The size of the buffer should be set so that it can store the maximum
number of characters that will be received before the application
program can read them from the buffer.

The InBufferCount property returns the number of characters in


the receive buffer. It can also be used to clear the buffer by setting
the number of characters to 0. Its syntax is:
[form.]MSCommInBufferCount= [count%]

Outputting data
The three main properties used to write data to the transmit buffer
are Output, OutBufferCount and OutBufferSize.
The Output property writes a string of characters to the transmit
buffer. Its syntax is:
[form.]MSComm. output= [outString$]

71
OutBufferSize

The OutBufferSize property sets and returns the number of


characters in the transmit buffer (default size is 512 characters). Its
syntax is:

[form.]MSCommOutBuffer size = [NumBytes%]

OutBufferCount

The OutBufferCount property returns the number of characters in


the transmit buffer.The transmit buffer can also be cleared by setting
it to 0. Its syntax is:
[form.]MSCommOutBufferCount. = [0]

5.3. FLOW CHART

5.3.1. Micro Controller

Algorithm

STEP 1: Start the program


STEP 2: Check whether ring signal is present or not.
STEP 3: If ring signal is present, make telephone OFF HOOK and
send FF to Personal Computer, else go to STEP 2.
STEP 4: Get the DTMF signal through the DTMF decoder.
STEP 5: Check whether # is pressed or not. If # is pressed, then
disconnect the phone and go to STEP 2.
STEP 6: If # is not pressed, then send the DTMF data to the pc
through the serial port and go to STEP 4.

72
START

CHECK
RING SENSOR
NO RING

RING

MAKE TELEPHONE
OFF H OOK &
SEND FF TO PC

GET DTMF
SIGNAL

NO IF
PRESSED
#

SENSE THE
DTMF DATA TO
THE PC TH ROUGH YES
THE SERIAL PORT

DISCONNECT
PHONE

73
5.3.2. VISUAL BASIC

Algorithm

STEP 1: Start the program


STEP 2: Check for the data FF.
STEP 3: If data FF is present, play the welcome message, else go
to step 2.
STEP 4: Play the message to enter the roll number.
STEP 5: Check whether four numbers are entered or not.
STEP 6: If yes, play message to enter
1 ATTENDENCE
2 MARKS
# DISCONNECT
else go to step 5.
STEP 7: If number 1 is pressed, then check the attendance and play
present or absent message and go to step 6.
STEP 8: If number 1 is not pressed, check whether number 2 is
pressed or not. If so play the marks for the corresponding
roll number and go to step 6.
STEP 9: If number 2 is not pressed, check whether number # is
pressed or not. If so terminate the program and go to step 2.
STEP 10: If number # is not pressed, go to step 6 until # is pressed.

74
START

NO CH ECK FOR
DATA "FF"

YES

PLAY THE WELCOME MESSAGE

PLAY MESSAGE TO ENTER THE ROLL NUMBER

NO IF FOUR NUMBERS
ARE ENTERED

YES

PLAY MESSAGE TO ENTER


1. FOR ATTENDENCE
2. FOR MARKS
#. TO DISCONNECT

CHECK THE ATTENDENCE YES


AND PLAY PRESENT OR IF 1. PRESSED
ABSENT MESSAG E
NO
PLAY THE MARKS YES
FO R THE
IF 2. PRESSED
CORRESPONDING
ROLL NUMB ER
NO
NO
IF # PRESSED
YES

75
6. PCB DESIGN

6.1 COMPONENT LAYOUT

76
6.2. PCB Design

The PCB design starts right from the selection of the


laminates .The two main types of base laminate are epoxy glass and
phenolic paper laminates are generally used for simple circuits.
Though it is very cheap and can easily be drilled, phenolic paper has
poor electrical characteristics and it absorbs more moisture than
epoxy glass. Epoxy glass has higher mechanical strength.

The important properties that have to be considered for


selecting the PCB substrate are the dielectric strength, insulation
resistance, water absorption property, coeff. of thermal expansion
,shear strength, hardness, dimensional stability etc.

6.3. PCB Fabrication

The fabrication of a PCB includes four steps.

a) Preparing the PCB pattern.


b) Transferring the pattern onto the PCB.
c) Developing the PCB.
d) Finishing (i.e) drilling, cutting, smoothing, turning etc.

Pattern designing is the primary step in fabricating a PCB. In


this step, all interconnection between the components in the given
circuit are converted into PCB tracks. Several factors such as
positioning the diameter of holes, the area that each component would
occupy, the type of end terminal should be considered.

77
Transferring the PCB Pattern

The copper side of the PCB should be thoroughly cleaned with


the help of alcoholic spirit or petrol. It must be completely free from
dust and other contaminants.

The mirror image of the pattern must be carbon copied and to the
laminate the complete pattern may now be made each resistant with
the help of paint and thin brush.

Developing

In this developing all excessive copper is removed from the board


and only the printed pattern is left behind. About 100ml of tap water
should be heated to 75 ° C and 30.5 grams of FeCl3 added to it, the
mixture should be thoroughly stirred and a few drops of HCl may be
added to speed up the process.

The board with its copper side facing upward should be placed in
a flat bottomed plastic tray and the aqueous solution of FeCl2 poured
in the etching process would take 40 to 60 min to complete.

After etching the board it should be washed under running water


and then held against light .the printed pattern should be cleanly
visible. The paint should be removed with the help of thinner.

Finishing Touches

After the etching is completed ,hole of suitable diameter should


be drilled ,then the PCB may be tin plated using an ordinary 35 Watts
soldering rod along with the solder core ,the copper side may be
given a coat of varnish to prevent oxidation.

78
Drilling

Drills for PCB use usually come with either a set of collects of
various sizes or a 3-Jaw chuck. For accuracy however 3-jaw chunks
aren’t brilliant and small drill below 1 mm from grooves in the jaws
preventing good grips.

Soldering

Begin the construction by soldering the resistors followed by


the capacitors and the LEDs diodes and IC sockets. Don’t try
soldering an IC directly unless you trust your skill in soldering. All
components should be soldered as shown in the figure. Now connect
the switch and then solder/screw if on the PCB using multiple washers
or spaces. Soldering it directly will only reduce its height above other
components and hamper in its easy fixation in the cabinet. Now
connect the battery lead.

Assembling

The circuit can be enclosed in any kind of cabinet. Before


fitting the PCB suitable holes must be drilled in the cabinet for the
switch, LED and buzzer. Note that a rotary switch can be used instead
of a slide type.

Switch on the circuit to be desired range. It will automatically


start its timing cycles. To be sure that it is working properly watch
the LED flash. The components are selected to trigger the alarm a few
minutes before the set limit.

79
7. CONCLUSION

Embedded system plays a major role in advanced communication


system. Embedded system is the current technology and has a bright
future. Any real time apply can be controlled. Our project will be
very obliging to the parents to be acquainted with their
son’s/daughter’s recital in the college. Presentation in the class and
outcome of the university are made reachable to the parents by our
project. Moreover, the time spending for college officials in
attempting phone calls from outsiders will be reduced.

We had successfully executed our project “VISCA” by using our


college telephone line.

9. FUTURE ENHANCEMENT

 Our project should be modified to know the profile of the


student.
 Access the college database for the execution of our project.
 Sound should be modified by recording the sound in a sound
proof room.

80
APPENDIX 1

INSTRUCTION SET OF MCS51 FAMILY

Table: 1 Arithmetic Instruction for MCS51

81
Table: 2 Logical Operations

82
Table: 3 Data Transfer Instruction

83
84
Table: 4 Boolean Variable Manipulations and Machine Control
Instructions

REFERENCES

85
1. Kenneth.J.Ayala (Second edition). “The 8051 Microcontroller
Architecture, programming and applications”.

2. Muhammad Ali Mazidi , Janice Gillispie Mazidi.(2002)


THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS

3. Mohammed Azam, Programming with Visual Basic 6.0

86

Potrebbero piacerti anche