Top Banner
VOICE INTERACTIVE SYSTEM FOR COLLEGE AUTOMATION Now-a-days every institution needs automation. As a part of college automation, we have decided to do a project “Voice Interactive System for College Automation”. Our project allows the user to know the student’s attendance and marks quickly through the telephone line without the intention of the college authority. In the hardware side embedded system has been used. A 20 pin microcontroller 89C2051 is used because of its compatibility with our hardware. This microcontroller controls the whole hardware. Telephone line is used for communication purpose. Visual Basic has been used for software programming. Presentation 1
121
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IVRS

VOICE INTERACTIVE SYSTEM FOR COLLEGE

AUTOMATION

Now-a-days every ins t i tu t ion needs automat ion. As a

par t of col lege automat ion, we have decided to do a projec t

“Voice In terac t ive System for Col lege Automat ion” . Our

projec t a l lows the user to know the s tudent ’s a t tendance and

marks quickly through the te lephone l ine wi thout the

in tent ion of the col lege author i ty . In the hardware s ide

embedded sys tem has been used. A 20 pin microcontro l le r

89C2051 is used because of i t s compat ib i l i ty wi th our

hardware . This microcontro l le r cont ro ls the whole hardware .

Telephone l ine i s used for communica t ion purpose . Visual

Bas ic has been used for sof tware programming. Presenta t ion

in the c lass and outcome of the univers i ty are made reachable

to the parents by our projec t . I t wi l l be very obl ig ing to the

parents to be acquainted wi th the i r son’s /daughter ’s rec i ta l in

the col lege .

1

Page 2: IVRS

1 . INTRODUCTION

Embedded sys t em i s a sy s t em i s a sy s t em tha t l i ve s i n s ide

ano the r dev i ce and ac t a s a ha rdware componen t o f t ha t dev i ce . An

embedded sys t em can be de s i r ab l e once cons i s t i ng o f a p roce s so r ,

a s soc i a t ed pe r i phe ra l s and so f twa re u sed fo r a spec i f i c pu rpose . The

embedded sys t em de f ined a s t he s e t o f ha rdware con t ro l l ed by

so f twa re . L ike any compu t ing sy s t em an embedded sys t em i s a

combina t i on o f so f twa re and ha rdware .

In ou r P ro j ec t a 20 p in Mic rocon t ro l l e r AT89C2051 i s u sed t o

con t ro l t he who le ha rdware . The Mic rocon t ro l l e r s ense s t he DTMF

s igna l t h rough t he DTMF decode r IC MT8870 and i t r e sponds

acco rd ing t o t he decoded s i gna l . The c i r cu i t ha s an i nbu i l t Phone R ing

s enso r c i r cu i t and t he sy s t em wi l l t ake ove r t he phone au toma t i ca l l y

u s ing a 12 V r e l ay . The mic rocon t ro l l e r w i l l r e ce ive t he s i gna l f r om

the d i s t ance t e l ephone and i t decodes t he s i gna l and f e t che s t he da t a

f rom the PC th rough t he s e r i a l po r t , ba sed on t he t e l ephone s i gna l ,

and s ends t he da t a t h rough t he t e l ephone l i ne .

The ob j ec t i ve o f ou r p ro j ec t i s t o know the s t uden t ’ s a t t endance

and marks qu i ck ly t h rough t he t e l ephone w i thou t t he i n t en t i on o f t he

co l l ege au tho r i t y . By d i a l i ng t he p rov ided t e l ephone number , one can

ab l e t o d ig up t he i n fo rma t ion o f t he s t uden t . One o f t he advan t ages i s

t he t ime spend ing fo r co l l ege o f f i c i a l s i n a t t emp t ing phone ca l l s f r om

ou t s i de r s w i l l be r educed .

2

Page 3: IVRS

2 . PROJECT DESCRIPTION

2.1 . BLOCK DIAGRAM

Figu re 2 .1 Bas i c B lock D iag ram

3

Page 4: IVRS

2 .2 BLOCK DIAGRAM EXPLANATION

The above B lock d i ag ram cons i s t o f f o l l owing B locks

1 . Te l ephone s ec t i on

2 . DTMF Decode r

3 . R ing De t ec to r

4 . ON/OFF hook S imu la to r

5 . Mic rocon t ro l l e r

6 . Vo l t age conve r t e r

7 . PC Se r i a l Po r t

8 . Pe r sona l Compu te r (PC)

1 . TELEPHONE

Inven t ed by Be l l and h i s a s s i s t an t , Thomas A . Wa t son , t he

t e l ephone marked a s i gn i f i c an t deve lopmen t i n t he h i s t o ry o f

e l e c t r i c a l commun ica t i on sy s t ems . I n t he e a r l i e s t magne to - t e l ephone

o f 1876 , t he speake r ’ s vo i ce was conve r t ed i n to e l e c t r i c a l ene rgy

pa t t e rn s t ha t cou ld be s end ove r r e a sonab ly l ong d i s t ance s ove r w i r e s

t o a r e ce ive r , wh i ch wou ld conve r t t he se ene rgy pa t t e rn s back i n to t he

o r i g ina l sound waves fo r t he l i s t ene r .

Outgo ing Ca l l

The d i a l pad , a l so ca l l ed keypad o r t ouch - tone pad , i s u sed t o

d i a l t e l ephone number s a s we l l a s i n t e r ac t w i th vo i ce p roce s s ing

sy s t em such a s a vo i ce ma i l and i n t e r ac t i ve vo i ce r e sponse ( IVR) . The

add re s s s i gna l i ng fo r an ou tgo ing ca l l c an be accompl i shed by 3

d i f f e r en t me thods : pu l s e d i a l ( r o t a ry ) , r e a l t one mu l t i p l e f r equency

(DTMF) , o r mu l t i f r equency (MF)

4

Page 5: IVRS

Mult i -Frequency (MF) :

I t howeve r became more popu l a r w i th t he i n t roduc t i on o f dua l

t one mu l t i p l e f r equency (DTMF) mode o f d i a l i ng . S ing l e ch ip DTMF

encode r s /decode r s a r e ava i l ab l e t oday , wh ich make t he de s ign ing such

sy s t ems ea sy and r e l i ab l e

Mul t i - f r equency s i gna l i ng i s s im i l a r t o DTMF and i s u sed on

t r unk c i r cu i t , p ay t e l ephones . Combina t i on o f two t ones i s u sed t o

t r ansmi t s i gna l i ng i n fo rma t ion , MF and DTMF s igna l s a r e more

r e l i ab l e and cons ide rab ly f a s t e r t han pu l s e d i a l . I n bo th me thods ,

d ig i t s a r e t r ansmi t t ed a t t he r a t e o f abou t 7 d ig i t s pe r s econd .

Tone combinat ion Dig i t

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

Tab le .2 .1 . Mu l t i p l e F requency fo r Number s

5

Page 6: IVRS

Incoming ca l l

When a t e l ephone s e t i s c a l l ed , t he l oca l exchange gene ra t e s a

h igh r i ng vo l t age o f abou t 90 -105Vol t s AC wi th a f r equency o f 20Hz

supe r imposed ove r t he minus ( - ) 48Vo l t DC. A capac i t o r i n t he phone

pa s se s t he AC bu t b lock DC. Upon de t ec t i ng t he AC vo l t age , t he

phone p rov ide s an aud ib l e s i gna l t ha t a l t o s t he u se r o f an i ncoming

ca l l . Each t e l ephone s e t p rov ide a r i nge r equ iva l en t numbe r (REN) a s

de f i ned w i th in FCC pa r t 68 and E IA RS-470 .The REN i s u sed t o

ensu re t ha t t he l oca l exchange can p rov ide t he co r r ec t amoun t o f

power r equ i r ed t o r i ng t he t e l ephone . I t de sc r i be s t he f r equency

r ange , power r ange , and b i a s vo l t age r ange o f t he t e l ephone s e t . When

t he phone i s an swered , DC cu r r en t beg in s t o f l ow in t he l oop . The

l oca l exchange t he cu r r en t f l ow and r emoves t he supe r imposed r i ng

vo l t age . The -48Vo l t s DC tha t i s a lways on t he l i ne ope ra t e s t he

t e l ephone when i t i s be ing u sed .

2 DTMF SIGNALING

DTMF s t ands fo r Dua l Tone Mul t i p l e F requency . I t i s a

t one cons i s t i ng o f two f r equenc i e s supe r imposed . I nd iv idua l

f r equenc i e s a r e chosen such t ha t i t i s e a sy t o de s ign f i l t e r s and ea sy

t o t r ansmi t t he t ones t h rough a t e l ephone l i ne hav ing bandwid th o f

app rox ima te ly 3 .5 kHz . DTMF was no t i n t ended t o be u sed fo r da t a

t r ans f e r , i t was mean t t o be u sed fo r s end ing t he con t ro l s i gna l s a l ong

t he t e l ephone l i ne . Wi th s t anda rd decode r s i t i s pos s ib l e t o s end 10

beeps pe r s econd i . e . , f i ve b i t s pe r s econd . DTMF s t anda rd spec i f i e s

50ms t ones and 600ms du ra t i on be tween two succe s s ive t ones .

6

Page 7: IVRS

Tab l e .2 .2 . DTMF Keypad F requenc i e s

Theory o f Opera t ion

In DTMF the re a r e 16 d i s t i nc t t ones . Each t one i s t he sum o f

two f r equenc i e s : one f rom a l ow and one f rom a h igh f r equency g roup .

The re a r e fou r d i f f e r en t f r equenc i e s i n e ach g roup . Our phone on ly

u se s 12 o f t he pos s ib l e 16 t ones . I f you l ook a t you r phone , t he r e a r e

on ly 4 rows (R1 , R2 , R3 and R4) and 3 co lumns (C1 , C2 and C3) . The

rows and co lumns s e l ec t f r equenc i e s f rom the l ow and h igh f r equency

g roup r e spec t i ve ly .

The fo l l owing g r aph i s a c ap tu r ed s c r een f rom an o sc i l l o scope .

I t i s a p lo t o f t he t one f r equency fo r t he "1" key :

1209 Hz 1336 Hz 1477 Hz 1633 Hz

697 Hz 1 2 3 A

770 Hz 4 5 6 B

852 Hz 7 8 9 C

941 Hz * 0 # D

7

Page 8: IVRS

Figure 2.2 Tone frequencies for key “1”

You can s ee t ha t t he DTMF gene ra t ed s i gna l i s ve ry d i s t i nc t and

c l ea r . The ho r i zon t a l ax i s i s i n s amp le s . The f r equency o f t he t one i s

abou t 1900 Hz - c l o se t o t he 1906 Hz p red i c t ed by Tab l e 3

(697+1209) .

No t e t ha t t he l a s t co lumn i s no t common ly s een i n t he

t e l ephones t ha t we u sed , bu t t e l ephone exchanges u se t hem qu i t e

o f t en . Nowadays , DTMF i s u sed fo r d i a l i ng t he number s i n

t e l ephones , con f igu r ing t e l ephone exchanges e t c . A CB t r ansce ive r o f

2 .7 MHz i s no rma l ly u sed t o s end f l oa t i ng codes . DTMF was de s igned

t o be ab l e t o s end t he codes u s ing mic rophone . Each beep (o r d ig i t

you d i a l on t he t e l ephone ) i s composed o f two concu r r en t f r equenc i e s ,

wh i ch a r e supe r imposed on amp l i t ude . The h ighe r o f t he two

f r equenc i e s i s no rma l ly a l oud by 4dB , and t h i s sh i f t i s t e rmed a s

tw i s t . I f t he tw i s t i s equa l t o 4dB , t he h ighe r f r equency i s l oud by

4dB . I f t he l ower f r equency i s l oud , t hen t he tw i s t i s s a id t o be

nega t i ve .

8

Page 9: IVRS

Event Low frequency High frequency

Busy signal 480 Hz 620 Hz

Dial tone 350 Hz 440 Hz

Ringback tone (US) 440 Hz 480 Hz

Tab l e .2 .3 . DTMF Even t F requenc i e s

The t one f r equenc i e s , a s de f i ned by t he P rec i s e Tone P l an , a r e

s e l ec t ed such t ha t ha rmon ic s and i n t e rmodu la t i on p roduc t s w i l l no t

c ause an un re l i ab l e s i gna l . No f r equency i s a mu l t i p l e o f ano the r , t he

d i f f e r ence be tween any two f r equenc i e s does no t equa l any o f t he

f r equenc i e s , and t he sum o f any two f r equenc i e s does no t equa l any o f

t he f r equenc i e s . The f r equenc i e s we re i n i t i a l l y de s igned w i th a r a t i o

o f 21 /19 , wh ich i s s l i gh t l y l e s s t han a who le t one . The f r equenc i e s

may no t va ry more t han ±1 .5% f rom the i r nomina l f r equency , o r t he

sw i t ch ing cen t e r w i l l i gno re t he s i gna l . The h igh f r equenc i e s may be

t he s ame vo lume o r l oude r a s t he l ow f r equenc i e s when s en t a c ro s s

t he l i ne . The l oudnes s d i f f e r ence be tween t he h igh and l ow

f r equenc i e s c an be a s l a rge a s 3 dec ibe l s ( dB) and i s r e f e r r ed t o a s

" tw i s t " .

Genera t ing DTMF

DTMF s igna l s c an be gene ra t ed t h rough ded i ca t ed ICs o r by u s ing

RC ne tworks connec t ed t o a m ic rop roces so r . MT8880 i s an example o f

a ded i ca t ed IC . Bu t ge t t i ng t he l a t t e r me thod work i s a b i t d i f f i cu l t i f

h i gh accu racy i s needed . The c ry s t a l f r equency needs t o be s ac r i f i c ed

fo r a non s t anda rd cyc l e l eng th . Hence t h i s me thod i s u sed fo r s imp le

9

Page 10: IVRS

app l i c a t i ons . Mos t o f t en , a P IC mic ro cou ld be u sed fo r t he above

pu rpose .

Decod ing DTMF

Detec t i ng DTMF wi th s a t i s f ac to ry p r ec i s i on i s a ha rd t h ing .

Of t en , a ded i ca t ed IC such a s MT8870 i s u sed fo r t h i s pu rpose . I t u se s

two 6 th o rde r band -pas s f i l t e r s u s ing sw i t ched capac i t o r f i l t e r s and i t

supp re s se s any ha rmon ic s . Hence t hey can p roduce p r e t t y good s i ne

waves f rom d i s t o r t ed i npu t . Hence i t i s p r e f e r r ed . Aga in

mic rop roces so r s c an a l so be u sed , bu t t he i r app l i c a t i on i s l im i t ed .

3 . RING DETECTOR:

I t i s u sed t o de t ec t t he r i ng s i gna l f r om the t e l ephone l i ne . I t

g i ve s ou t a l og i ca l ou tpu t t o t he mic rocon t ro l l e r . An op tocoup l e r

MCT2E i s u sed a s r i ng de t ec to r .

I f r i ng i s p r e sen t – log i c 0

E l s e - l og i c 1

Norma l t ime vo l t age i n t e l ephone l i ne=48V d . c

OFF hook vo l t age -12V d . c

R ing s i gna l vo l t age -75V a . c

4 . ON–OFF HOOK SIMULATOR

I t i s u sed t o p i ckup t he t e l ephone e l ec t ron i ca l l y . A 12 vo l t d . c

s i gna l i s ob t a ined by p l ac ing a r e s i s t o r a c ro s s t he t e l ephone l i ne . I t i s

u sed t o de t ec t whe the r t he Hand s e t i s i n ON hook cond i t i on o r OFF

hook cond i t i on so a s t o s end t he i n fo rma t ion t o t he mic rocon t ro l l e r . A

12 V r e l ay i s u sed fo r t he pu rpose .

10

Page 11: IVRS

5 . MICROCONTROLLER

A by-p roduc t o f m ic rop roces so r deve lopmen t was t he

mic rocon t ro l l e r . The s ame f ab r i c a t i on t e chn iques and p rog ramming

concep t s t ha t make pos s ib l e t he gene ra l -pu rpose mic rop roces so r a l so

y i e lded t he mic rocon t ro l l e r .

Mic ro con t ro l l e r s a r e no t a s we l l known to t he gene ra l pub l i c ,

o r t o many i n t he t e chn i ca l commun i ty , a s a r e t he more g l amorous

mic rop roces so r . The pub l i c i s , howeve r , ve ry we l l awa re t ha t

“ some th ing” i s r e spons ib l e fo r a l l o f t he smar t VCRs , c l ock r ad io s ,

washe r s and d rye r s , v ideo games , t e l ephones , m ic rowaves , TVs ,

au tomob i l e s , t oys , vend ing mach ine s , cop i e r s , e l eva to r s , i r ons , and a

myr i ad o f o the r a r t i c l e s t ha t a r e i n t e l l i gen t and “p rog rammab le” .

Compan i e s a r e a l so awa re t ha t be ing compe t i t i ve i n t h i s age o f t he

m ic roch ip r equ i r e s t he i r p roduc t s , o r t he mach ine ry t hey u se t o make

t hose p roduc t s , t o have some “ smar t s ” .

e

Microproces sor and Microcontro l l e r

Mic rop roces so r and mic rocon t ro l l e r s t em f rom the ba s i c i dea ,

a r e made by t he s ame peop l e , and a r e so ld t he s ame t ype o f sy s t em

des igne r s and sy s t em p rog rammers . Wha t i s t he d i f f e r ence be tween

t he two?

Microproces sor

A mic rop roces so r , a s t he t e rm has come t o be known , i s a

gene ra l -pu rpose d ig i t a l compu te r c en t r a l p roce s s ing un i t (CPU) .

A l though popu l a r l y known a s a “ compu te r on a ch ip” , t he

m ic rop roces so r i s i n no s ense a comple t e d ig i t a l compu te r .

11

Page 12: IVRS

Figu re . 2 . 3 B lock D iag ram o f a Mic rop roces so r

Thi s b lock d i ag ram con t a in s a r i t hme t i c and l og i c un i t (ALU) , a

p rog ram coun t e r (PC) , a s t a ck po in t e r (SP) , some work ing r eg i s t e r s , a

c l ock t im ing c i r cu i t , and i n t e r rup t c i r cu i t s . To make a comple t e

m ic rocompu te r , one mus t add memory , u sua l l y r e ad -on ly p rog ram

memory (ROM) and r andom-acces s da t a memory (RAM) , memory

decode r s , an o sc i l l a t o r , and a number o f i npu t / ou tpu t ( I /O) dev i ce s ,

such a s i n t e r rup t hand l e r s and coun t e r s , may be added t o r e l i eve t he

CPU f rom t ime consuming coun t i ng o r t im ing cho re s . Equ ipp ing t he

mic rocompu te r w i th mass s t o r age dev i ce s , common ly a f l oppy and

ha rd d i sk d r i ve s , and I /O pe r i phe ra l s , such a s keyboa rd and a CRT

d i sp l ay , y i e ld s a sma l l compu te r t ha t c an be app l i ed t o a r ange o f

gene ra l -pu rpose so f twa re app l i c a t i ons .

12

Page 13: IVRS

The ha rdware de s ign o f a m ic rop roces so r CPU i s a r r anged so

t ha t a sma l l o r ve ry l a rge sy s t em can be con f igu red a round t he CPU a s

t he app l i c a t i on demands . The p r ime u se o f a m ic rop roces so r i s t o r e ad

da t a , pe r fo rm ex t ens ive ca l cu l a t i ons on t he da t a , and s t o r e t hose

ca l cu l a t i ons i n a mass s t o r age dev i ce o r d i sp l ay t he r e su l t s f o r human

use . The p rog rams u sed by t he mic rop roces so r a r e s t o r ed i n t he mass

s t o r age dev i ce and l oaded i n to RAM as t he u se r d i r e c t s . A f ew

mic rop roces so r p rog rams a r e s t o r ed i n ROM. The ROM-based

p rog rams a r e p r ima r i l y sma l l f i xed p rog rams t ha t ope ra t e pe r i phe ra l s

and o the r f i xed dev i ce s t ha t a r e connec t ed t o t he sy s t em. The de s ign

o f t he m ic rop roces so r i s d r i ven by t he de s i r e t o make i t a s expandab l e

and f l ex ib l e a s pos s ib l e , i n t he expec t a t i on o f commerc i a l succe s s i n

t he ma rke tp l ace .

Microcontro l l e r

Figu re .2 .4 B lock D iag ram o f Mic rocon t ro l l e r

13

Page 14: IVRS

The above f i gu re shows t he b lock d i ag ram o f a t yp i ca l

m ic rocon t ro l l e r , wh i ch i s a t r ue compu te r on a ch ip . The de s ign

i nco rpo ra t e s a l l o f t he f e a tu r e s found i n a m ic rop roces so r CPU: ALU,

PC , SP , and r eg i s t e r . I t a l so ha s added o the r f e a tu r e s needed t o make

a comple t e compu te r : ROM, RAM, pa ra l l e l I /O , s e r i a l I /O , coun t e r s ,

and a c l ock c i r cu i t L ike t he mic rop roces so r , a m ic rocon t ro l l e r i s a

gene ra l - pu rpose dev i ce , bu t one t ha t i s mean t t o r e ad da t a , pe r fo rm

l im i t ed ca l cu l a t i ons . The p r ime u se o f a m ic ro -con t ro l l e r i s t o con t ro l

i t s env i ronmen t ba sed on t hose ca l cu l a t i ons . The p r ime u se o f a

m ic rocon t ro l l e r i s t o con t ro l t he ope ra t i on o f a mach ine u s ing a f i xed

p rog ram tha t i s s t o r ed i n ROM and t ha t does no t change ove r t he

l i f e t ime o f t he sy s t em.

The de s ign app roach o f t he m ic rocon t ro l l e r m i r ro r s t ha t o f t he

m ic rop roces so r : make a s i ng l e de s ign t ha t c an be u sed i n a s many

app l i c a t i ons a s pos s ib l e i n o rde r t o s e l l , hope fu l l y , a s many a s

pos s ib l e . The mic rop roces so r de s ign accompl i she s t h i s goa l by hav ing

a ve ry f l ex ib l e and ex t ens ive r epe r t o i r e o f mu l t i by t e i n s t ruc t i ons .

These i n s t ruc t i ons work i n a ha rdware con f igu ra t i on t ha t enab l e s

l a rge amoun t s o f memory and I /O t o be connec t ed t o add re s s and da t a

bus p in s on t he i n t eg ra t ed c i r cu i t package . Much o f t he a c t i v i t y i n t he

mic rop roces so r ha s t o do w i th mov ing code and da t a t o and f rom

ex t e rna l memory t o t he CPU. Many i n s t ruc t i ons a r e coup l ed w i th p in s

on t he i n t eg ra t ed c i r cu i t pakage ; t he p in s a r e p rog rammab le t ha t i s ,

c apab l e o f hav ing s eve ra l d i f f e r en t f unc t i ons depend ing on t he w i shes

o f t he p rog rammer . The mic rocon t ro l l e r i s conce rned w i th ge t t i ng

da t a f rom and t o i t s own p in s ; t he a r ch i t e c tu r e and i n s t ruc t i on s e t a r e

op t im ized t o hand l e da t a i n b i t and by t e s i z e .

14

Page 15: IVRS

Microproces sors Vs Microcontro l l e r

The con t r a s t be tween a m ic rocon t ro l l e r and a m ic rop roces so r i s

be s t exempl i f i ed by t he f a c t t ha t mos t m ic rop roces so r s have many

ope ra t i ona l codes (opcodes ) f o r mov ing da t a f rom ex t e rna l memory t o

t he CPU; mic rocon t ro l l e r s may have one o r two . Mic rop roces so r s may

have one o r two t ypes o f b i t hand l i ng i n s t ruc t i ons ; m ic rocon t ro l l e r

w i l l have many .

The fundamen ta l d i f f e r ences be tween mic rop roces so r s and

mic rocon t ro l l e r s a r e t he se :

Mic rop roces so r s r e i n t ended t o be gene ra l pu rpose d ig i t a l

compu te r s whe rea s m ic rocon t ro l l e r s a r e i n t ended t o be spec i a l

pu rpose d ig i t a l con t ro l l e r s .

Microp roces so r s con t a in a CPU, memory add re s s ing c i r cu i t s , and

i n t e r rup t hand l i ng c i r cu i t s . Mic rocon t ro l l e r s have t he se f e a tu r e s a s

we l l a s t ime r s , pa r a l l e l and s e r i a l I /O , and s e r i a l I /O , and i n t e rna l

RAM and ROM.

Microcon t ro l l e r mode l s va ry i n da t a s i z e f rom 4 t o 32 b i t s . Fou r b i t

un i t s a r e p roduced i n huge vo lumes fo r ve ry s imp le app l i c a t i ons ,

and 8 -b i t un i t s a r e t he mos t ve r sa t i l e . S ix t een and 32 b i t un i t s a r e

u sed i n h igh speed con t ro l and s i gna l p roce s s ing app l i c a t i ons

Many mode l s f e a tu r e p rog rammab le p in s t ha t a l l ow ex t e rna l

memory t o be added w i th t he l o s s o f I /O capac i t y .

Eight b i t Microcontro l l e r s

15

Page 16: IVRS

Eigh t b i t ha s p roven t o be a ve ry u se fu l wor ld s i z e fo r sma l l

compu t ing t a sks .1 - by t e word i s adequa t e fo r many con t ro l and

mon i to r i ng app l i c a t i ons . Se r i a l ASCI I da t a i s a l so s t o r ed i n by t e

s i z e s , mak ing 8 b i t s t he na tu r a l cho i ce fo r da t a commun ica t i ons . Mos t

i n t eg ra t ed c i r cu i t memor i e s and many l og i c func t i ons a r e a r r anged i n

an 8 - b i t con f igu ra t i on t ha t i n t e r f ace s e a s i l y t o da t a bus se s o f 8 b i t s .

App l i c a t i on soph i s t i c a t i on can a l so r ange f rom s imp le app l i ance

con t ro l t o h igh speed mach ine con t ro l and da t a co l l e c t i on . Fo r t he se

r e a sons t he mic rocon t ro l l e r vendo r s have e s t ab l i shed ex t ens ive

f ami l i e s o f s im i l a r mode l s . A l l f e a tu r e a common l anguage , bu t d i f f e r

i n t he amoun t o f i n t e rna l ROM, RAM, and o the r cos t s ens i t i ve

f e a tu r e s . Of t en t he memory can be expanded t o i nc lude o f f - ch ip ROM

and RAM; i n some ca se s , t he m ic rocon t ro l l e r ha s no on -boa rd ROM a t

a l l , o r t he ROM i s an e l e c t r i c a l l y r ep rog rammab le r e ad on ly memory

[EPROM] . The ROM l e s s o r EPROM ve r s ions c an be u sed by t he

de s igne r t o p ro to type t he app l i c a t i on , and t he de s igne r c an o rde r t he

ROM ve r s ion i n l a rge quan t i t i e s f rom the f a c to ry . Many t imes t he

ROM ve r s ion i s neve r u sed . The de s igne r makes t he ROM l e s s o r

EPROM des ign su f f i c i en t l y gene ra l so t ha t on con f igu ra t i on may be

u sed many t imes , o r p roduc t i on vo lumes neve r j u s t i f y t he cos t o f a

f a c to ry ROM imp lemen ta t i on . As a fu r t he r en t i c emen t fo r t he buye r ,

some f ami l i e s have member s w i th f ewe r ex t e rna l p in s t o sh r i nk t he

package and t he cos t ; o the r s have spec i a l f e a tu r e s such a s ana log - to -

d ig i t a l and d ig i t a l - t o - ana log conve r t e r s on t he ch ip .

8051 Der iva t ive s

16

Page 17: IVRS

Along t he way , t h i s 8031 a r ch i t e c tu r e ga ined env i ab l e ma rke t

a ccep t ance . Many s emiconduc to r manufac tu r e r s s t a r t ed e i t he r

manufac tu r i ng t he 8031 dev i ce s a s such ( In t e l was l i be r a l i n g iv ing

away l i c ense t o whoeve r a sked ) o r deve lop ing a new k ind o f

m ic rocon t ro l l e r s ba sed on 8031 co re a r ch i t e c tu r e .

Manufac tu r e r s mod i f i ed t he ba s i c 8031 a r ch i t e c tu r e and added

many new pe r iphe ra l f unc t i ons t o make t hem a t t r a c t i ve t o t he

de s igne r s . Because o f t he ru sh , e l e c t ron i c commun i ty s t a r t ed ge t t i ng a

va r i e t y o f 8031 ba sed dev i ce s w i th r ange o f op t i ons . To bea t t he

compe t i t i on , manufac tu r e r s deve loped d i f f e r en t m ic rocon t ro l l e r s w i th

many un ique f ea tu r e s . These pa r t s a r e popu l a r l y known a s ‘8031

De r iva t i ve s ’ . A lmos t eve ry decen t manufac tu r e r boas t ed o f hav ing an

8031 ba sed mic rocon t ro l l e r i n t he l i ne c a rd .

F i r s t ma jo r manufac tu r e r was t he Ph i l i p s who b rough t ou t more

t han 40 -50 de r i va t i ve s w i th a va r i e t y o f I /O op t i ons , memory

combina t i ons , and pe r i phe ra l f unc t i ons . Dev i ce s became ava i l ab l e i n

r egu l a r DIP and SMD packages . Wi th t he ba s i c 8031 co re , Ph i l i p s

po r t ed h igh capac i t y P rog ram Memory (up to 32K/64K) , i t s pa t en t ed

I2C in t e r f ace bus , 8 /10 b i t Ana log t o D ig i t a l Conve r t e r s , CAN Bus ,

Cap tu re and Compare r eg i s t e r s , Wa tch dog t ime r , PWM fac i l i t i e s and

e t c . More I /O po r t s ( a s many a s e i gh t po r t s ) , add i t i ona l t ime r / coun t e r ,

s e cond s e r i a l po r t was a l so made ava i l ab l e i n Ph i l i p s dev i ce s .

Apa r t f r om a l l t he se , Ph i l i p s deve loped many consumer dev i ce s

mean t f o r t e l e com, compu te r and TV app l i c a t i ons . A smar t c a rd

con t ro l l e r was a l so deve loped by i nco rpo ra t i ng a c ryp tog raph i c

eng ine . So Ph i l i p s c l e a r l y e s t ab l i shed i t s e l f a s t he ma rke t l e ade r i n

8031 de r i va t i ve s and s t i l l c a t e r s t o t h i s s egmen t .

17

Page 18: IVRS

Then come Da l l a s s emiconduc to r . Da l l a s r ede s igned t he 8031

a r ch i t e c tu r e and e l im ina t ed was t e c l ock cyc l e s o f o r i g ina l co re and

made a l l i n s t ruc t i ons execu t ed i n l e s s c l ock cyc l e s (max imum o f 4 )

wh ich have t r ad i t i ona l l y t aken up to 12 c lock cyc l e s . So , c ame t he

b i r t h o f H igh speed 8031 De r iva t i ve s .

Da l l a s s emiconduc to r a l so ha s go t a r ange o f s ecu re

m ic rocon t ro l l e r s ba sed on 8031 co re . Th i s m ic rocon t ro l l e r f ami ly u se s

non vo l a t i l e RAM to keep bo th p rog ram and da t a . Because o f t h i s

RAM, t he con t ro l l e r g ive s t he In Sys t em Reprog ram ab i l i t y . Da l l a s

ha s combined t h i s m ic rocon t ro l l e r , SRAM and l i t h ium ce l l i n a s i ng l e

pack . Th i s dev i ce gua ran t ee s 10+ yea r s o f da t a r e t en t i on i n t he RAM

a rea . Th i s 8031 a l so boas t s t he t ampe r p roo f s ecu r i t y f e a tu r e s l i ke

Rea l T ime Memory Enc ryp t i on , u se r s e l e c t ed 48 b i t Enc ryp t i on key ,

memory con t en t s , s e cu r i t y l ock and t he f a c i l i t y t o h ide i n t e r rup t

vec to r t ab l e . As you can ag ree , t h i s pa r t i cu l a r 8031 dev i ce ha s found

a n i che marke t i n bank ing and s ecu r i t y r e l a t ed app l i c a t i ons .

A tme l Corpo ra t i on i s t he ma jo r s emiconduc to r manufac tu r e r who

i n t roduced many f l a sh memor i e s ba sed 8031 de r i va t i ve s a t a

compe t i t i ve cos t . A tme l u sed i t s expe r t i s e i n f l a sh memory t e chno logy

i n to t he ba s i c 8031 co re and b rough t ou t m ic rocon t ro l l e r s w i th a

va r i e t y o f f l a sh memory op t i ons and f ew dev i ce s a l so ca r ry In Sys t em

Reprog ramming f ac i l i t y . You can p rog ram/ rep rog ram th i s

m ic rocon t ro l l e r a f t e r so lde r i ng t he dev i ce i n t he t a rge t boa rd . I f t h i s

p rog ramming f ac i l i t y i s embedded i n t he sy s t em so f twa re , t hen t he

t a sks l i ke r emo te ca l i b r a t i on , ons i t e sy s t em upg rada t i on become a s

e a sy a s s end ing you r da t a /p rog ram in a f l oppy d i sk o r by i n t e rne t .

A tme l dev i ce s spo r t s ecu r i t y l ock t o i t s f l a sh memory t o p ro t ec t t he

con t en t s f rom the p ry ing eyes .

18

Page 19: IVRS

Mean t ime , I n t e l i t s e l f t r i ed t o c a sh i n t he popu l a r i t y o f t h i s

8031 a r ch i t e c tu r e and i n t roduced improved ve r s i ons o f

m ic rocon t ro l l e r s : 80151 and 80251 f ami l i e s . These dev i ce s spo r t 16

b i t a r ch i t e c tu r e u s ing 8031 co re and un fo r tuna t e ly t he se dev i ce s have

no t become a s popu l a r a s 8031 .Even a f t e r many yea r s o f i n t roduc t i on ,

8031 co re i s s t i l l go ing s t rong i n 8 b i t a r ena .

Addres s ing Modes

8031 ' s a s semb ly l anguage i n s t ruc t i on s e t cons i s t s o f an

ope ra t i on mnemon ic and ze ro t o t h r ee ope rands s epa ra t ed by commas .

I n two by t e i n s t ruc t i ons t he de s t i na t i on i s spec i f i ed f i r s t , and t hen t he

sou rce . By t e w ide mnemon ic s l i ke ADD o r MOV use t he Accumula to r

a s a sou rce ope rand and a l so t o r e ce ive t he r e su l t .

The 8031 suppo r t s f i ve t ypes o f add re s s ing modes :

1 . Reg i s t e r Addre s s ing

2 . D i r ec t Addre s s ing

3 . Reg i s t e r I nd i r ec t Addre s s ing

4 . Immed ia t e Addre s s ing

5 . I ndex Addre s s ing

Reg i s t er Addres s ing

Reg i s t e r Addre s s ing acce s se s t he e i gh t work ing r eg i s t e r s (R0

R7) o f t he s e l ec t ed r eg i s t e r bank . The l e a s t s i gn i f i c an t t h r ee b i t s o f

t he i n s t ruc t i on opcode i nd i ca t e wh ich r eg i s t e r i s t o be u sed fo r t he

ope ra t i on . One o f t he fou r banks o f r eg i s t e r s i s t o be p r ede f ined i n

t he PSW be fo re u s ing r eg i s t e r add re s s ing i n s t ruc t i on . ACC, B , DPTR

19

Page 20: IVRS

and CY, ( t he Boo l ean Accumula to r ) c an a l so be add re s sed i n t h i s

mode .

Direc t Addres s ing

Di rec t add re s s ing can acce s s any on ch ip va r i ab l e s o r ha rdware

r eg i s t e r . To i nd i ca t e t he add re s s o f t he l oca t i on , an add i t i ona l by t e i s

a t t a ched t o t he opcode . Depend ing on t he h ighes t o rde r b i t o f t he

d i r ec t add re s s by t e one o f two phys i ca l memory space i s s e l e c t ed .

When t he d i r ec t add re s s r ange i s be tween 0 and 127 (00H

7FH) one o f t he 128 l ow o rde r on ch ip RAM loca t i on i s a cce s sed . A l l

I /O po r t s , spec i a l f unc t i on , con t ro l r eg i s t e r s a r e a s s i gned be tween 128

and 255 (80H FFH) . When d i r ec t add re s s ing i nd i ca t e s any l oca t i on

i n t h i s r ange , co r r e spond ing ha rdware r eg i s t e r i s a cce s sed .

Th i s i s t he on ly me thod ava i l ab l e fo r a cce s s ing I /O po r t s and

spec i a l f unc t i on r eg i s t e r s .

Reg i s t er Ind irec t Addres s ing

Reg i s t e r i nd i r ec t add re s s ing u se s t he con t en t s o f e i t he r R0 o r

R1 ( i n t he p r e s e l ec t ed r eg i s t e r bank ) a s a add re s s po in t e r t o l oca t e i n

a 256 by t e b lock ( t he l ower 128 by t e s o f i n t e rna l RAM in 8031 o r 256

by t e s i n 8032 ) o r t he l ower 256 by t e s o f ex t e rna l da t a memory . No te

t ha t t he spec i a l f unc t i on r eg i s t e r s a r e no t a cce s s ib l e i n t h i s mode .

Acces s t o fu l l 64K ex t e rna l da t a memory add re s s space i s i nd i ca t ed by

t he 16 b i t Da t a Po in t e r r eg i s t e r , DPTR.

Execu t i on o f PUSH and POP in s t ruc t i ons a l so i nvo lve i nd i r ec t

r eg i s t e r add re s s ing . The S t ack Po in t e r i nd i ca t e s t he co r r ec t s t a ck

l oca t i on anywhe re i n t he i n t e rna l RAM.

20

Page 21: IVRS

Immedia te Addres s ing

When a sou rce ope rand i s a cons t an t r a t he r t han a va r i ab l e ,

t hen t he cons t an t c an be embedded i n to t he i n s t ruc t i on i t s e l f . Th i s

k ind o f i n s t ruc t i ons t ake s two by t e s and f i r s t one spec i f i e s t he opcode

and s econd by t e g ive s t he r equ i r ed cons t an t .

Index Addres s ing

Only t he P rog ram Memory can be acce s sed by t h i s mode . Th i s

mode i s i n t ended fo r r e ad ing l ookup t ab l e s i n t he P rog ram Memory . A

16 b i t ba se r eg i s t e r ( e i t he r DPTR o r t he P rog ram Coun te r ) po in t s t o

t he ba se o f t he l ookup t ab l e s and t he Accumula to r c a r r i e s t he cons t an t

i nd i ca t i ng t ab l e en t ry number .

Microcontro l l e r s for Embedded Sys tems

In t he L i t e r a tu r e d i s cus s ing mic rop roces so r s , we o f t en s ee t he

t e rm Embedded Sys t em. Mic rop roces so r s and Mic rocon t ro l l e r s a r e

w ide ly u sed i n embedded sys t em p roduc t s . An embedded sys t em

p roduc t u se s a m ic rop roces so r (o r Mic rocon t ro l l e r ) t o do one t a sk

on ly . A p r i n t e r i s an example o f embedded sys t em s ince t he p roce s so r

i n s ide i t pe r fo rms one t a sk on ly ; name ly ge t t i ng t he da t a and p r i n t i ng

i t . Con t r a s t t h i s w i th a Pen t i um based PC . A PC can be u sed fo r any

number o f app l i c a t i ons such a s word p roce s so r , p r i n t - s e rve r , bank

t e l l e r t e rmina l , V ideo game , ne twork s e rve r , o r I n t e rne t t e rmina l .

So f twa re fo r a va r i e t y o f app l i c a t i ons c an be l oaded and run . Of

cou r se t he r e a son a pc can pe r fo rm myr i ad t a sks i s t ha t i t h a s RAM

memory and an ope ra t i ng sy s t em tha t l oads t he app l i c a t i on so f twa re

i n to RAM memory and l e t s t he CPU run i t .

I n an Embedded sys t em, t he r e i s on ly one app l i c a t i on so f twa re

t ha t i s t yp i ca l l y bu rned i n to ROM. An x86 PC con t a in s o r i s

21

Page 22: IVRS

connec t ed t o va r i ous embedded p roduc t s such a s keyboa rd , p r i n t e r ,

modem, d i sk con t ro l l e r , sound ca rd , CD-ROM dr ive s , mouse , and so

on . Each one o f t he se pe r i phe ra l s ha s a Mic rocon t ro l l e r i n s ide i t t ha t

pe r fo rms on ly one t a sk . Fo r example , i n s ide eve ry mouse t he r e i s a

Mic rocon t ro l l e r t o pe r fo rm the t a sk o f f i nd ing t he mouse pos i t i on and

s end ing i t t o t he PC .

6 . VOLTAGE CONVERTER

Thi s i s u sed t o conve r t TTL log i c vo l t age i n to RS232

vo l t age .

TTL Log i c : l og i c 1= 5v

l og i c 0= GND

RS232 : l og i c 1= +9v

l og i c 0= -9v

IC MAX232 i s u sed a s vo l t age conve r t e r . An ex t e rna l c ry s t a l

o sc i l l a t o r i s u sed fo r i t s ope ra t i on .

7 . PC SERIAL PORT

Thi s po r t i s u sed t o ge t da t a f rom mic rocon t ro l l e r t o pe r sona l

compu te r i n s e r i a l manne r . A l l IBM PC and compa t i b l e compu te r s a r e

t yp i ca l l y equ ipped w i th two se r i a l po r t s and one pa ra l l e l po r t .

A l t hough t he se two t ypes o f po r t s a r e u sed fo r commun ica t i ng w i th

ex t e rna l dev i ce s , t hey work i n d i f f e r en t ways .

A pa ra l l e l po r t s ends and r ece ive s da t a e i gh t b i t s a t a t ime ove r

8 s epa ra t e w i r e s . Th i s a l l ows da t a t o be t r ans f e r r ed ve ry qu i ck ly ;

howeve r , t he c ab l e r equ i r ed i s more bu lky because o f t he number o f

22

Page 23: IVRS

i nd iv idua l w i r e s i t mus t con t a in . Pa r a l l e l po r t s a r e t yp i ca l l y u sed t o

connec t a PC to a p r i n t e r and a r e r a r e ly u sed fo r much e l s e . A s e r i a l

po r t s ends and r ece ive s da t a one b i t a t a t ime ove r one w i r e . Whi l e i t

t ake s e i gh t t imes a s l ong t o t r ans f e r e ach by t e o f da t a t h i s way , on ly a

f ew wi r e s a r e r equ i r ed .

I n f a c t , two-way ( fu l l dup l ex ) commun ica t i ons i s pos s ib l e w i th

on ly t h r ee s epa ra t e w i r e s - one t o s end , one t o r e ce ive , and a common

s igna l g round w i r e .

8 . INTERFACING CIRCUIT

Thi s i s u sed t o i n t e r f ace t he aud io s i gna l f r om the

compu te r t o t he t e l ephone l i ne .

3 . HARDWARE DECSRIPTION

3.1 MICROCONTROLLER

The AT89C2051 i s a l ow-vo l t age , h igh -pe r fo rmance CMOS 8 -b i t

m ic rocompu te r w i th 2 Kby te s o f F l a sh p rog rammab le and e r a sab l e

23

Page 24: IVRS

r e ad on ly memory (PEROM) . The dev i ce i s manufac tu r ed u s ing

A tme l ’ s h igh dens i t y nonvo l a t i l e memory t e chno logy and i s

compa t i b l e w i th t he i ndus t ry s t anda rd MCS-51 i n s t ruc t i on s e t and

p inou t . By combin ing a ve r sa t i l e 8 -b i t CPU wi th F l a sh on a

mono l i t h i c ch ip , t he A tme l AT89C2051 i s a power fu l m ic rocompu te r

wh ich p rov ide s a h igh ly f l ex ib l e and cos t e f f ec t i ve so lu t i on t o many

embedded con t ro l app l i c a t i ons .

The AT89C2051 p rov ide s t he fo l l owing s t anda rd f ea tu r e s : 2

Kby te s o f F l a sh , 128 by t e s o f RAM, 15 I /O l i ne s , two 16 -b i t

t ime r / coun t e r s , f i ve vec to r two- l eve l i n t e r rup t a r ch i t e c tu r e , a f u l l

dup l ex s e r i a l po r t , a p r ec i s i on ana log compa ra to r , on -ch ip o sc i l l a t o r

and c lock c i r cu i t r y .

I n add i t i on , t he AT89C2051 i s de s igned w i th s t a t i c l og i c fo r

ope ra t i on down to z e ro f r equency and suppo r t s two so f twa re

s e l ec t ab l e power s av ing modes . The Id l e Mode s t ops t he CPU wh i l e

a l l owing t he RAM, t ime r / coun t e r s , s e r i a l po r t and i n t e r rup t sy s t em to

con t i nue func t i on ing . The Power Down Mode s aves t he RAM con t en t s

bu t f r e eze s t he o sc i l l a t o r d i s ab l i ng a l l o t he r ch ip func t i ons un t i l t he

nex t ha rdware r e se t .

3 .1 .1 P in Conf igura t ion

The mic rocon t ro l l e r AT89C2051 i s ava i l ab l e i n 20 p in Dua l

I n l i ne Package (DIP) .

24

Page 25: IVRS

F igu re .3 .1 P in d i ag ram o f AT89C2051

3 .1 .2 B lock D iagram

25

Page 26: IVRS

F igu re .3 .2 B lock D iag ram o f AT89C2051

26

Page 27: IVRS

3 .1 .3 P in Descr ip t ion

VCC

Supp ly vo l t age .

GND

Ground .

Por t 1

Po r t 1 i s an 8 -b i t b id i r ec t i ona l I /O po r t . Po r t p in s P1 .2 t o P1 .7

p rov ide i n t e rna l pu l l ups . P1 .0 and P1 .1 r equ i r e ex t e rna l pu l l ups . P1 .0

and P1 .1 a l so s e rve a s t he pos i t i ve i npu t (AIN0) and t he nega t i ve

i npu t (AIN1) , r e spec t i ve ly , o f t he on -ch ip p r ec i s i on ana log

compa ra to r . The Po r t 1 ou tpu t bu f f e r s c an s i nk 20 mA and can d r i ve

LED d i sp l ays d i r ec t l y . When 1 s a r e wr i t t en t o Po r t 1 p in s , t hey can be

u sed a s i npu t s . When p in s P1 .2 t o P1 .7 a r e u sed a s i npu t s and a r e

ex t e rna l l y pu l l ed l ow , t hey w i l l sou rce cu r r en t ( I IL ) because o f t he

i n t e rna l pu l l ups . Po r t 1 a l so r e ce ive s code da t a du r ing F l a sh

p rog ramming and p rog ram ve r i f i c a t i on .

Por t 3

Po r t 3 p in s P3 .0 t o P3 .5 , P3 .7 a r e s even b id i r ec t i ona l I /O p in s

w i th i n t e rna l pu l l -ups . P3 .6 i s ha rd -wi r ed a s an i npu t t o t he ou tpu t o f

t he on -ch ip compa ra to r and i s no t a cce s s ib l e a s a gene ra l pu rpose I /O

p in . The Po r t 3 ou tpu t bu f f e r s c an s i nk 20 mA. When 1s a r e wr i t t en t o

Po r t 3 p in s t hey a r e pu l l ed h igh by t he i n t e rna l pu l l -ups and can be

u sed a s i npu t s . As i npu t s , Po r t 3 p in s t ha t a r e ex t e rna l l y be ing pu l l ed

l ow wi l l sou rce cu r r en t ( I IL ) because o f t he pu l l -ups . Po r t 3 a l so

s e rve s t he func t i ons o f va r i ous spec i a l f e a tu r e s o f t he AT89C2051 a s

l i s t ed be low:

27

Page 28: IVRS

Tab le 3 .1 A l t e rna t e Func t i ons o f po r t 3

Po r t 3 a l so r e ce ive s some con t ro l s i gna l s f o r F l a sh p rog ramming and

p rog ramming ve r i f i c a t i on .

RST

Rese t i npu t . A l l I /O p in s a r e r e se t t o 1 s a s soon a s RST goes

h igh . Ho ld ing t he RST p in h igh fo r two mach ine cyc l e s wh i l e t he

o sc i l l a t o r i s r unn ing r e se t s t he dev i ce . Each mach ine cyc l e t ake s 12

o sc i l l a t o r o r c l ock cyc l e s .

XTAL1

Inpu t t o t he i nve r t i ng o sc i l l a t o r amp l i f i e r and i npu t t o t he

i n t e rna l c l ock ope ra t i ng c i r cu i t .

XTAL2

Outpu t f rom the i nve r t i ng o sc i l l a t o r amp l i f i e r .

28

Page 29: IVRS

3 .1 .4 Osc i l l a tor Charac ter i s t i c s

XTAL1 and XTAL2 a r e t he i npu t and ou tpu t , r e spec t i ve ly , o f an

i nve r t i ng amp l i f i e r wh ich can be con f igu red fo r u se a s an on -ch ip

o sc i l l a t o r , a s shown in F igu re 1 . E i t he r a qua r t z c ry s t a l o r c e r amic

r e sona to r may be u sed . To d r i ve t he dev i ce f rom an ex t e rna l c l ock

sou rce , XTAL2 shou ld be l e f t unconnec t ed wh i l e XTAL1 i s d r i ven a s

shown in F igu re 2 . The re a r e no r equ i r emen t s on t he du ty cyc l e o f t he

ex t e rna l c l ock s i gna l , s i nce t he i npu t t o t he i n t e rna l c l ock ing c i r cu i t r y

i s t h rough a d iv ide by - two f l i p - f l ops , bu t m in imum and max imum

vo l t age h igh and l ow t ime spec i f i c a t i ons mus t be obse rved .

Figure.3.3 Oscillator Connections

3 .2 DTMF Decoder

The MT8870 i s a s i ng l e ch ip DTMF rece ive r i n co rpo ra t i ng

sw i t ched capac i t o r f i l t e r t e chno logy and an advanced d ig i t a l

coun t i ng / ave rag ing a lgo r i t hm fo r pe r i od measu remen t . The

29

Page 30: IVRS

func t i ona l b lock d i ag ram o f MT8870 i s shown in t he be low f i gu re

dep i c t s t he i n t e rna l work ing o f t h i s dev i ce .

F igu re .3 .4 Func t i ona l d i ag ram o f IC MT8870

The DTMF s igna l i s f i r s t bu f f e r ed by i npu t op -amp tha t a l l ows

ad ju s tmen t ga in and cho i ce o f i npu t con f igu ra t i on . The i npu t s t age i s

f o l l owed by a l ow pas s RC ac t i ve f i l t e r , wh i ch pe r fo rms an t a l i a s i ng

func t i on . D ia l t one a t 350 and 440Hz i s t hen r e j e c t ed by a 3 r d o rde r

sw i t ched capac i t o r no t ch f i l t e r . The s i gna l i s s t i l l i n i t s i nd iv idua l

componen t s by two 6 t h o rde r sw i t ched capac i t o r band pa s s f i l t e r . Each

componen t smoo thed by an ou tpu t f i l t e r and squa red by a ha rd

l im i t i ng compa ra to r . The two r e su l t i ng r ec t angu l a r wave fo rms a r e

t hen app l i ed t o a d ig i t a l c i r cu i t , whe re a coun t i ng a lgo r i t hm measu re s

30

Page 31: IVRS

and ave rages t he r e pe r i ods . An accu ra t e r e f e r ence c lock i s de r i ved

f rom an i nexpens ive ex t e rna l 3 . 58MHz c rys t a l .

The t ime r equ i r ed t o de t ec t a va l i d t one pa i r t dP i s a f unc t i on o f

decode a lgo r i t hm, t one f r equency , and t he p r ev ious s t a t e o f t he

decoded l og i c . Es t ( e a r l y , s t e e r i ng ou tpu t ) i nd i ca t e s t ha t two t ones o f

va l i d f r equency have been de t ec t ed and i n i t i a t e s an RC t im ing c i r cu i t .

I f bo th t ones a r e p r e sen t f o r a m in imum gua rd t ime , de t e rmined by an

ex t e rna l RC ne twork , t he DTMF s igna l i s decoded and t he r e su l t i ng

da t a l a t ched on t he ou tpu t r eg i s t e r . The de l ayed s t e e r i ng ou tpu t ( s tD)

i s r a i s ed t o i nd i ca t e t ha t new da t a i s ava i l ab l e . (The ou tpu t

co r r e spond ing t o e ach key p r e s sed i s shown in t he t r u th t ab l e )

3 .2 .1Tone de tec t i on

Af te r r e ce iv ing a DTMF tone t he DTMF decode r (MT8870)

p l ace s t he co r r e spond ing b ina ry number on i t s ou t pu t (S tD) goes h igh

t o s t a t e t ha t new da t a i s ava i l ab l e . The de t ec t i on o f t he de l ayed

s t e e r i ng ou tpu t i s t o t he du ra t i on o f t he r e ce ived DTMF rece ive r ha s

a l r e ady been exp l a ined .

31

Page 32: IVRS

3 .2 .2 PIN DIAGRAM OF IC MT8870

Figu re .3 .5 Pin Diagram o f IC MT8870

32

Page 33: IVRS

Pin Descr ip t ion

Tab le .3 .2 P in de sc r i p t i on o f IC MT8870

33

Page 34: IVRS

Recommended Opera t ing Cond i t i on

Tab le : 3 . 3 Ope ra t i ng cond i t i ons o f IC MT8870

3 .2 .3 Func t iona l Descr ip t ion

The MT8870D/MT8870D-1 mono l i t h i c DTMF rece ive r

o f f e r s sma l l s i z e , l ow power consumpt ion and h igh pe r fo rmance .

I t s a r ch i t e c tu r e cons i s t s o f a band sp l i t f i l t e r s ec t i on , wh ich

s epa ra t e s t he h igh and l ow g roup t ones , f o l l owed by a d ig i t a l

coun t i ng s ec t i on wh ich ve r i f i e s t he f r equency and du ra t i on o f t he

r e ce ived t ones be fo re pa s s ing t he co r r e spond ing code t o t he

ou tpu t bus .

Fi l t er Sec t i on

Sepa ra t i on o f t he l ow-g roup and h igh g roup t ones i s a ch i eved

by app ly ing t he DTMF s igna l t o t he i npu t s o f two s i x th -o rde r

sw i t ched capac i t o r band pa s s f i l t e r s , t he bandwid th s o f wh ich

co r r e spond t o t he l ow and h igh g roup f r equenc i e s . The f i l t e r s ec t i on

a l so i nco rpo ra t e s no t ches a t 350 and 440 Hz fo r excep t i ona l d i a l

34

Page 35: IVRS

t one r e j e c t i on ( s ee F igu re 3 ) . Each f i l t e r ou tpu t i s f o l l owed by a

s i ng l e o rde r sw i t ched capac i t o r f i l t e r s ec t i on wh ich smoo thes t he

s i gna l s p r i o r t o l im i t i ng . L imi t i ng i s pe r fo rmed by h igh -ga in

compa ra to r s wh ich a r e p rov ided w i th hys t e r e s i s t o p r even t de t ec t i on

o f unwan ted l ow- l eve l s i gna l s . The ou tpu t s o f t he compa ra to r s

p rov ide fu l l r a i l l og i c sw ings a t t he f r equenc i e s o f t he i ncoming

DTMF s igna l s .

Decoder Sec t ion

Fo l lowing t he f i l t e r s ec t i on i s a decode r emp loy ing d ig i t a l

coun t i ng t e chn iques t o de t e rmine t he F requenc i e s o f t he i ncoming

t ones and t o ve r i fy t ha t t hey co r r e spond t o s t anda rd DTMF

f r equenc i e s . A complex ave rag ing a lgo r i t hm p ro t ec t s aga in s t t one

s imu la t i on by ex t r aneous s i gna l s such a s vo i ce wh i l e p rov id ing

t o l e r ance t o sma l l f r equency dev i a t i on and va r i a t i ons . Th i s ave rag ing

a lgo r i t hm has been deve loped t o ensu re an op t imum combina t i on o f

immun i ty t o t a l k -o f f and t o l e r ance t o t he p r e sence o f i n t e r f e r i ng

f r equenc i e s ( t h i rd t ones ) and no i s e . When t he de t ec to r r e cogn i ze s t he

p r e sence o f two va l i d t ones ( t h i s i s r e f e r r ed t o a s t he “ s i gna l

cond i t i on” i n some i ndus t ry spec i f i c a t i ons ) t he “Ea r ly S t ee r i ng” (ES t )

ou tpu t w i l l go t o an ac t i ve s t a t e . Any subsequen t l o s s o f s i gna l

cond i t i on w i l l c ause ES t t o a s sume an i nac t i ve s t a t e . The s t e e r i ng

c i r cu i t works i n r eve r se t o va l i da t e t he i n t e r d ig i t pause be tween

s i gna l s . Thus , a s we l l a s r e j e c t i ng s i gna l s t oo sho r t t o be cons ide red

va l i d , t he r e ce ive r w i l l t o l e r a t e s i gna l i n t e r rup t i ons (d ropou t ) t oo

sho r t t o be cons ide red a va l i d pause . Th i s f a c i l i t y , t oge the r w i th t he

c apab i l i t y o f s e l e c t i ng t he s t e e r i ng t ime cons t an t s ex t e rna l l y , a l l ows

t he de s igne r t o t a i l o r pe r fo rmance t o mee t a w ide va r i e t y o f sy s t em

r equ i r emen t s .

35

Page 36: IVRS

3 .2 .4 Guard T ime Adjus tment

In many s i t ua t i ons no t r equ i r i ng s e l ec t i on o f t one du ra t i on and

i n t e r d ig i t a l pause , t he s imp le s t e e r i ng c i r cu i t shown in F igu re 4 i s

app l i c ab l e . Componen t va lue s a r e chosen acco rd ing t o t he fo rmu la :

tREC=tDP+tGTP

t ID= tDA+tGTA

The va lue o f tDP i s a dev i ce pa r ame te r and tREC i s t he

m in imum s igna l du ra t i on t o be r e cogn i zed by t he r e ce ive r . D i f f e r en t

s t e e r i ng a r r angemen t s may be u sed t o s e l ec t i ndependen t l y t he gua rd

t imes fo r t one P re sen t ( tGTP) and t one absen t ( tGTA) . Th i s may be

nece s sa ry t o mee t sy s t em spec i f i c a t i ons wh ich p l ace bo th accep t and

r e j e c t l im i t s on bo th t one du ra t i on and i n t e rd ig i t a l pause . Gua rd t ime

ad ju s tmen t a l so a l l ows t he de s igne r t o t a i l o r sy s t em pa rame te r s such

a s t a l k o f f and no i s e immun i ty . I nc r ea s ing tREC improves t a l k -o f f

pe r fo rmance s i nce i t r educes t he p robab i l i t y t ha t t ones s imu la t ed by

speech w i l l ma in t a in s i gna l cond i t i on l ong enough t o be r eg i s t e r ed .

A l t e rna t i ve ly , a r e l a t i ve ly sho r t tREC wi th a l ong tDO wou ld be

app rop r i a t e f o r ex t r eme ly no i sy . Env i ronmen t s such a s f a s t

a cqu i s i t i on t ime and immun i ty t o t one d rop -ou t s a r e r equ i r ed .

Power -down and Inh ib i t Mode

A log i c h igh app l i ed t o p in 6 (PWDN) wi l l power down the

dev i ce t o m in imize t he power consumpt ion i n a S t and by mode . I t

s t ops t he o sc i l l a t o r and t he func t i ons o f t he f i l t e r s . I nh ib i t mode i s

enab l ed by a l og i c h igh i npu t t o t he p in 5 ( INH) . I t i nh ib i t s t he

de t ec t i on o f t ones r ep re sen t i ng cha rac t e r s A , B , C , and D . The ou tpu t

code w i l l r ema in t he s ame a s t he p r ev ious de t ec t ed code .

36

Page 37: IVRS

Di f f erent ia l Input Conf igura t ion

The i npu t a r r angemen t o f t he MT8870D/MT8870D-1 p rov ide s a

d i f f e r en t i a l - i npu t ope ra t i ona l amp l i f i e r a s we l l a s a b i a s sou rce

(VRef ) wh ich i s u sed t o b i a s t he i npu t s a t m id - r a i l . P rov i s i on i s made

fo r connec t i on o f a f e edback r e s i s t o r t o t he op -amp ou tpu t (GS) fo r

ad ju s tmen t o f ga in . I n a s i ng l e - ended con f igu ra t i on , t he i npu t p in s a r e

connec t ed a s shown in F igu re 10 w i th t he op -amp connec t ed fo r un i t y

ga in and VRef b i a s ing t he i npu t a t 1 /2VDD. F igu re 6 shows t he

d i f f e r en t i a l con f igu ra t i on , wh ich pe rmi t s t he ad ju s tmen t o f ga in w i th

t he f e edback r e s i s t o r .

Crys ta l Osc i l l a tor

The i n t e rna l c l ock c i r cu i t i s comple t ed w i th t he add i t i on o f an

ex t e rna l 3 . 579545 MHz c rys t a l and i s no rma l ly connec t ed a s shown in

F igu re (S ing l e - Ended Inpu t Conf igu ra t i on ) .Howeve r ; i t i s pos s ib l e t o

con f igu re s eve ra l MT8870D/MT8870D-1 dev i ce s emp loy ing on ly a

s i ng l e o sc i l l a t o r c ry s t a l . The o sc i l l a t o r ou tpu t o f t he f i r s t dev i ce i n

t he cha in i s coup l ed t h rough a 30 pF capac i t o r t o t he o sc i l l a t o r i npu t

(OSC1) o f t he nex t dev i ce . Subsequen t dev i ce s a r e connec t ed i n a

s im i l a r f a sh ion . The p rob l ems a s soc i a t ed w i th unba l anced l oad ing a r e

no t a conce rn w i th t he a r r angemen t shown , i . e . , p r ec i s i on ba l anc ing

capac i t o r s a r e no t r equ i r ed .

37

Page 38: IVRS

3 .2 .5 Tone Decod ing o f MT8870

Tab l e 3 .4 : Tone Decod ing o f MT8870

3 .2 .6 Fea tures

• Comple t e DTMF Rece ive r r e commended fo r mos t app l i c a t i ons ,

l e av ing R t o be s e l ec t ed by t he de s igne r

• Low power consumpt ion

• In t e rna l ga in s e t t i ng amp l i f i e r

• Cen t r a l o f f i c e qua l i t y

• Power -down mode

38

Page 39: IVRS

• I nh ib i t mode

• Backward compa t i b l e w i th MT8870C/MT8870C-1

3 .2 .7 App l i ca t ions

• Pag ing sy s t ems

• Repea t e r sy s t ems /mob i l e r ad io

• C red i t c a rd sy s t ems

• Remote con t ro l

• Pe r sona l compu te r s

• Te l ephone answer ing mach ine

3 .3 VOLTAGE CONVERTER (MAX232)

The MAX220–MAX249 f ami ly o f l i ne d r i ve r s / r e ce ive r s i s

i n t ended fo r a l l E IA/TIA-232E and V .28 /V .24 commun ica t i ons

i n t e r f ace s , pa r t i cu l a r l y app l i c a t i ons whe re ±12V i s no t ava i l ab l e .

These pa r t s a r e e spec i a l l y u se fu l i n ba t t e ry -powered sy s t ems , s i nce

t he i r l ow-power shu tdown mode r educes power d i s s i pa t i on t o l e s s

t han 5μW.

Feature

Opera t e f rom S ing l e +5V Power Supp ly

Low-Power Rece ive Mode i n Shu tdown

Mee t A l l E IA/TIA-232E and V .28 Spec i f i c a t i ons

Mul t i p l e Dr ive r s and Rece ive r s

3-S t a t e Dr ive r and Rece ive r Ou tpu t s

39

Page 40: IVRS

3 .3 .1 PIN Diagram

Figu re .3 .6 P in D iag ram o f MAX232

S ince t he RS232 i s no t compa t i b l e w i th t oday ’ s m ic rop roces so r s

and mic rocon t ro l l e r s , we need a l i ne d r i ve r ( vo l t age conve r t e r ) t o

conve r t t he RS232’ s s i gna l s t o TTL vo l t age l eve l s t ha t w i l l be

a ccep t ab l e t o t he 8051 ’ s TxD and RxD p in s . One example o f such a

conve r t e r i s MAX232 f rom Max im Corp . The MAX 232 conve r t s f r om

RS232 vo l t age l eve l s t o TTL vo l t age l eve l s , and v i ce ve r sa . One

advan t age o f t he MAX232 ch ip i s t ha t i t u se s a+5V power sou rce

wh ich i s t he s ame a s t he sou rce vo l t age fo r t he 8051 . I n o the r words ,

w i th a s i ng l e +5 V power supp ly we can power bo th t he 80551 and

MAX232 , w i th no need fo r t he dua l power supp l i e s t ha t a r e common

in many o lde r sy s t ems .

40

Page 41: IVRS

3 .3 .2 Func t i ona l D iag ram o f MAX232

Figu re .3 .7 Func t i ona l D iag ram o f MAX232

The MAX232 ha s two se t s o f l i ne d r i ve r s f o r t r ans f e r r i ng and

r ece iv ing da t a , a s shown in F igu re 10 -7 . The l i ne d r i ve r s u sed fo r

TxD a re c a l l ed T1 and T2 wh i l e t he l i ne d r i ve r s f o r Rxd a r e

de s igna t ed a s R1 and R2 . I n many app l i c a t i ons on ly one o f e ach i s

u sed fo r example , T1 and R1 a r e u sed t oge the r f o r TxD and RxD o f

t he 8051 and t he s econd s e t i s l e f t unused . No t i c e i n MAX232 t ha t t he

T1 l i ne d r i ve r ha s a de s igna t i on o f T1 i n and T1 ou t on p in number s

41

Page 42: IVRS

11 and 14 , r e spec t i ve ly . The T1 i n p in i s t he TTL s ide and i s

connec t ed t o TxD o f t he mic rocon t ro l l e r , wh i l e T1 ou t i s t he RS232

s i de t ha t i s connec t ed t o t he RxD p in o f t he RS232 DB connec to r .

The R1 l i ne d r i ve r ha s a de s igna t i on o f R1 i n and R i ou t on p in

number s 13 and 12 , r e spec t i ve ly . The R1 i n (p in 13 ) i s t he RS232 s i de

t ha t i s connec t ed t o t he TxD p in o f t he RS232 DB connec to r , and R1

ou t ( p in 12 ) i s t he TTL s ide t ha t i s connec t ed t o t he RxD p in o f t he

m ic rocon t ro l l e r . See f i gu re 10 -7 . No t i c e t he nu l l modem connec t i on

whe re RxD fo r one i s TxD fo r t he o the r .

MAX232 r equ i r e s fou r c apac i t o r s r ang ing f rom 1 t o 22F . The

mos t w ide ly u sed va lue fo r t he se c apac i t o r s i s 22n f .

3 .3 .3 APPLICATIONS

Por t ab l e Compu te r s

Low-Power Modems

In t e r f ace T rans l a t i on

Ba t t e ry -Powered RS-232 Sys t ems

Mul t i d rop RS-232 Ne tworks

42

Page 43: IVRS

4 . CIRCUIT DIAGRAM

Figu re .4 .1 C i r cu i t D i ag ram

43

Page 44: IVRS

4 .1 CIRCUIT OPERATION

When t he t e l ephone r i ng a r r i ve s t he r i ng s enso r de t ec t s i t and i t

w i l l s end a s i gna l t o t he mic rocon t ro l l e r . The Mic rocon t ro l l e r w i l l

t hen t ake t he phone w i th he lp o f ON/OFF hook s imu la to r and i t w i l l

s ense t he DTMF s igna l and i t w i l l ge t t he DTMF s igna l and t he

Mic rocon t ro l l e r w i l l sw i t ch on t he co r r e spond ing Re l ay .

A t no rma l t ime t he vo l t age ac ros s t he t e l ephone l i ne i s 48v and

when a r i ng a r r i ve s t hen a vo l t age o f 74v AC i s i n j e c t ed t h rough t he

t e l ephone and t h i s AC wi l l pa s s t h rough t he capac i t o r C4 and t hough

t he zene r d iodes t o t he LED in t he op tocoup l e r and i t w i l l conduc t

and t h i s l i gh t w i l l conduc t t he pho to t r ans i s t o r and t he r e fo re a l ow

s igna l was f ed t o t he mic rocon t ro l l e r and i t w i l l t hen sw i t ch on t he

Hook Re l ay o f a t e l ephone .

The DTMF rece ive r w i l l decode t he t one s i gna l i n to d ig i t a l

wh i ch was f ed t o t he mic rocon t ro l l e r f o r f u r t he r con t ro l . The ma in

pa r t o f t he c i r cu i t was done by t he Mic rocon t ro l l e r AT89C2051 . The

DTMF s igna l f r om the Te l ephone was decoded by t he Decode r IC

MT8870 . The Decode r ge t t he DTMF s igna l f r om Te l ephone l i ne and

t h i s decoded d ig i t a l s i gna l was f ed t o t he Mic rocon t ro l l e r . The

mic rocon t ro l l e r w i l l s en t t he decoded DTMF s igna l t o t he PC th rough

i t s s e r i a l po r t .

The da t a f rom the mic rocon t ro l l e r was f ed t o t he PC th rough a

vo l t age conve r t e r . The da t a f rom the compu te r s e r i a l po r t was i n

RS232 l og i c . Tha t i s f o r l og i c 1 t he vo l t age i s –9V and fo r l og i c 0 t he

vo l t age i s +9V and a t TTL s ide t he Vo l t age fo r l og i c 1 i s +5V and fo r

44

Page 45: IVRS

l og i c 0 i s 0V . The re fo r e fo r connec t i ng t h i s two s ec t i on (RS232 and

TTL) we need a conve r t e r .

The Conve r t e r u sed i n ou r c i r cu i t i s IC MAX232 . Th i s IC ha s

two s e t s o f conve r t e r i n wh ich we a r e u s ing a s e t . The da t a f rom the

PC i s f ed t o t he conve r t e r and t he conve r t e r conve r t s t he da t a i n to

TTL log i c wh ich i s f ed t o t he mic rocon t ro l l e r .

4 .1 .1 Te l ephone R ing s ensor

Th i s C i r cu i t c an be u sed t o connec t any t e l ephone t o t he t e l ephone

l i ne . When t he t e l ephone handse t s a r e i n on -hook pos i t i on , t he cu r r en t

t h rough t he op tocoup l e r LEDs i s i nadequa t e t o a c t i va t e t he i r i nbu i l t

t r an s i s t o r s . Howeve r t he r i ng s i gna l pa s se s t o t e l ephone i n pa r a l l e l

s i nce t he t e l ephone l i ne i s connec t ed t o t he t e l ephone i n s t rumen t s

t h rough combina t i on o f i nbu i l t LEDs o f op tocoup l e r s i n pa r a l l e l w i th

r eve r se d iodes wh i l e t he ‘ - ‘ma rked t e l ephone l i ne i s connec t ed t o t he

r e l ay . I n i t i a l l y when t he handse t s o f a l l t he t e l ephones a r e on t he

c r ad l e s , t he op tocoup l e r w i l l no t conduc t adequa t e ly and a s such t he

emi t t e r s o f i nbu i l t t r an s i s t o r s o f op tocoup l e r s a r e a t l ow l eve l . The

t r ans i s t o r ou tpu t ava i l ab l e a t t he emi t t e r s a r e i nve r t ed t o l og i c 1 s t a t e

and app l i ed t o t he Mic rocon t ro l l e r .

I n t h i s c i r cu i t op tocoup l e r i s u sed t o s ense t he r i ng s i gna l . A

r i ng vo l t age f rom exchange i s a round 70 t o 90vo l t ( 25 HZ AC) come

v i a t e l ephone l i ne s . The t e l ephone l i ne i s connec t ed t o t he r i ng s enso r

(op tocoup l e r IC MCT2E) w i l l de t ec t t h i s s i gna l and t he capac i t o r C2

(1µf /25v ) bypas se s t he 13 .5mA to60maA, AC r i ng ing cu r r en t so t ha t

t he op tocoup l e r ge t t u rned ON ( t he d iode an t i pa r a l l e l w i th t he LED)

an op tocoup l e r p rov ide cond i t i on du r ing t he nega t i ve ha l f cyc l e o f t he

r i ng ing cu r r en t . As t he r e su l t , t r an s i s t o r T1 ge t s f o rwa rd b i a sed and i t

conduc t s , pu l l i ng i t ’ s co l l e c to r t owards g round . Th i s w i l l t u rn ON the

45

Page 46: IVRS

r e l ay by p rov id ing t he magne t i z i ng cu r r en t . Th i s w i l l Cease s t he DC

vo l t age ac ros s t he phone l i ne . The aud io s i gna l i s ex t ended t o t he

ON/OFF hook de t ec to r (Op tocoup l e r IC ) . I f t he t e l ephone hand s e t i s

ON hook cond i t i on means t he t e l ephone L ine cons i s t o f 48v , t o ge t a

c l o sed l oop connec t i on w i th t he exchange f o r commun ica t i on . He re

an op tocoup l e r i s u sed fo r ON/OFF hook de t ec t i on , i t g e t s t h i s 48v a s

i npu t and t he pho tod iode acqu i r e a conduc t i on vo l t age a round 12v by

t he u se o f r e s i s t o r R1 . The conduc t i on o f pho tod iode emi t s l i gh t

t owards pho to t r ans i s t o r and t he r e by i t ge t s t he GND, wh ich connec t

a 10k r e s i s t o r (R2) a c ro s s t he Te l ephone L ine . So t ha t t he exchange

de t ec t a s i gna l f r om the subsc r i be r s , t ha t t he subsc r i be r was r eady fo r

commun ica t i on . I f t he t e l ephone l i ne i s u sed fo r message Tx and Rx

means , t he hand s e t i s f i r s t p i cked up t o con fo rm tha t t he i n coming

s i gna l i s Vo ice o r Message .Af t e r t ha t t he subsc r i be r c an p l ace t he

hand s e t w i th t he ba se s e t . Once t he hand s e t i s p i cked up means t he

µc w i l l s en t a a cknowledgemen t s i gna l t o t he µc a t t he de s igna t i on

s i de . so t ha t t he hook de t ec to r w i l l p rov ide vo l t age d rop i n t he Land

l i ne vo l t age , t he r e by a c l o sed l oop c i r cu i t i s f o rmed be tween

Subsc r i be r s and Te l ephone exchange .

I f i t i s a Vo ice s i gna l means t he ON/OFF hook de t ec to r f unc t i on

i s s ame and t he Hand s e t i s u sed fo r Vo ice commun ica t i on . Once t he

hand s e t i s p l a ced w i th t he ba se s e t a f t e r t he vo i ce o r message

commun ica t i on means t he Re l ay connec t ed w i th R ing s enso r ge t de -

ene rg i zed and Te l ephone l i ne i s d i s connec t ed by t he µc .

Optocoup ler ( IC MCT2E)

The MCT2E op to i so l a to r s cons i s t o f a ga l l i um a r sen ide i n f r a r ed

emi t t i ng d iode d r i v ing a s i l i con pho to t r ans i s t o r i n a 6 -p in dua l i n - l i ne

package .

46

Page 47: IVRS

F igu re .42 Pho to t r ans i s t o r Op tocoup l e

Feature

• UL r ecogn i zed (F i l e # E90700)

• VDE r ecogn i zed (F i l e # 94766)

• MCT2 and MCT2E a r e a l so ava i l ab l e i n wh i t e package

by spec i fy ing -M su f f i x , eg . MCT2-M

Schemat i c D iagram

F igu re .4 .3 Schema t i c d i ag ram o f op tocoup l e r

47

Page 48: IVRS

PIN 1 . ANODE

2 . CATHODE

3. NO CONNECTION

4. EMITTER

5 . COLLECTOR

6. BASE

Appl i ca t ion

• Power supp ly r egu l a to r s

• D ig i t a l l og i c i npu t s

• Mic rop roces so r i npu t s

4 .1 .2 ON/OFF HOOK SIMULATOR

Dur ing r i ng s i gna l 70 t o 90V rms a t 20 -25HZ AC wi l l come

t h rough t he t e l ephone l i ne f rom the Exchange ba t t e ry . The ou tgo ing

s i gna l i ng r e f e r s s i gna l r e ach ing t he exchange f rom the subsc r i be r s

t e l ephone , i nd i ca t i ng ON-hook , OFF- hook , hang up , d i a l i ng e t c . Once

t he hand s e t i s p i cked up means i t i s i n o f f hook cond i t i on and now

the vo l t age r educes t o 47v t o 48v and ( i t i s g iven t o i npu t on ON/OFF

hook de t ec to r op tocoup l e r IC )Crad l e sw i t ch c lo se s t o fo rm a c lo sed

l oop c i r cu i t w i th t he exchange ba t t e ry and t he t e l ephone c i r cu i t . Th i s

c i r cu i t i s r e f e r r ed a s t he l oca l l oop c i r cu i t . Exchange ba t t e ry vo l t age s

a r e t yp i ca l l y 48 vo l t s . The l oop cu r r en t i s u sed by t he exchange t o

e s t ab l i sh ON/OFF hook s t a t u s o f t he t e l ephone . I f t he l oop cu r r en t i s

13 .5mA to 60mA the exchange de t ec t s i t a s OFF hook cond i t i on and i f

t he l oop cu r r en t i s l e s s t han 7 .5mA the exchange i n t e rp r e t s i t a s ON

hook cond i t i on .

48

Page 49: IVRS

The ope ra t ed l i ne vo l t age i s abou t 50v DC and t he i ncoming

vo i ce vo l t age t o t he t e l ephone i n s t rumen t va r i e s f rom 0 .5v t o 1 vo l t

and t he max imum ou t go ing vo i ce vo l t age i s abu t 2v rms .The r i ng

s i gna l i s 70 - 90v rms a t 20 -25HZ. In pu l s e d i a l i ng t e l ephones r eg i s t e r

s i gna l i ng i s known a s DC loop s i gna l i ng . I n t h i s c a se t he d i a l ed

number i s conveyed t o t he exchange by “make” and “b reak” o f l oop

c i r cu i t .

When a r i ng s i gna l i s p r e sen t , t he m ic rocon t ro l l e r w i l l sw i t ch on

t he RELAY to ach i eve OFF hook cond i t i on .

4 .1 .2 .1 RELAY

The r e l ay i s one o f t he mos t w ide ly u sed componen t s i n i ndus t r i a l

e l e c t ron i c s . I n combina t i on w i th t r ans i s t o r s , SCRs , e l e c t ron t ubes , and

o the r c i r cu i t e l emen t , t h i s e l e c t romagne t i c dev i ce pe r fo rms coun t l e s s

t a sks . Th i s r e l ays a r e u sed a s p ro t ec t i ve dev i ce fo r sw i t ch ing , f o r

i nd i ca t i ng and fo r t r ansmi s s ion .

T ransmi s s ion r e l ays a r e u sed i n con junc t i on w i th t r ans fo rmer s ,

i nduc to r s , c apac i t o r s i n power sy s t em and i n t e l ephone and i n o the r

commun ica t i on sy s t ems . Re l ays a r e e l e c t ro magne t i c a l l y ope ra t ed

r emo te ly con t ro l l ed sw i t ches w i th one o r more s e t s o f con t ac t s . When

ene rg i zed , t he r e l ay ope ra t e s t o open o r c l o se i t s con t ac t s o r t o open

some con t ac t s and c lo se o the r s . Con t ac t s wh ich a r e open when t he r e l ay

i s no t ene rg i zed a r e c a l l ed no rma l ly open (NO) o r s imp ly open

con t ac t s . Con t ac t s , wh i ch a r e c l o sed when t he r e l ay i s no t ene rg i zed ,

a r e c a l l ed no rma l ly c l o sed con t ac t s .

49

Page 50: IVRS

F igu re .4 .4 Re l ay

Re l ay con t ac t a r e he ld i n t he i r no rma l pos i t i on e i t he r by sp r i ng o r

by some g rav i t y a c t i va t ed mechan i sm . An ad ju s tmen t o r ad ju s tmen t s a r e

u sua l l y p rov ided t o s e t r e s t r a i n ing fo r ce t o c ause t he r e l ay t o ope ra t e

w i th in p r ede t e rmined c i r cu i t cond i t i ons .

Re l ays a r e e l e c t ro magne t i c componen t s wh ich ha s an ope ra t i ng

co i l and con t ac t . The co i l sha l l be ene rg i zed w i th AC o r DC supp ly .

Acco rd ing ly r e l ays a r e ava i l ab l e w i th AC\DC ope ra t i ng co i l s o f va r i ous

magn i t udes s ay f rom 6V DC to 220 V DC o r fo r AC vo l t age s r ang ing

f rom 20V AC to 440 AC.

The ope ra t i ng p r i nc ip l e o f r e l ays i s a s f o l l ows when t he co i l i s

ene rg i zed , an i r on co re a t t a ched t o t h i s a s semb ly ge t s magne t i z ed . Th i s

t hen a t t r a c t s an a rma tu re wh ich ha s e l e c t r i c a l connec t ed t o i t . The

e l e c t r i c a l t e rmina l s shou ld be f ab r i c a t ed i n such away t ha t t he r e sha l l be

one common t e rmina l ; one no rma l ly c l o sed (NC) con t ac t and one

no rma l ly open (NO) con t ac t s . When t he r e l ay i s no t ene rg i zed t he

connec t i on i s c l o sed be tween common and NO con t ac t s t h i s s t a t e i s

r eve r sed when t he r e l ay i s ene rg i zed t h i s r e l ay c i r cu i t sha l l be u sed t o

sw i t ch on o the r power c i r cu i t s , u s i ng l ow con t ro l vo l t age . The power

c i r cu i t and con t ro l c i r cu i t a r e p r ac t i c a l l y i so l a t ed .

50

Page 51: IVRS

Relay Cons truc t ion

A re l ay i s an e l e c t r i c a l l y con t ro l l ed dev i ce t ha t open and c lo se

e l e c t r i c a l con t ac t a f f ec t i ng o the r con t ac t s ( dev i ce s ) i n t he s ame o r o the r

c i r cu i t s . Ope ra t i on o f t he r e l ay i s d i s cus sed be low .

I f t he c i r cu i t i n t he co i l i s s l owly i nc r ea sed f rom 0 , a po in t w i l l be

r e ached whe re t he a rma tu re snaps ( c l o s ing t he gap ) and c lo se s t he

no rma l ly opened con t ac t (NO) .Th i s i s c a l l ed p i ckup po in t and i s

spec i f i ed by i t c i r cu i t o r vo l t age by t he manufac tu r e r when t he c i r cu i t i n

t he co i l i s g r adua l l y dec rea sed , a po in t we re t he f l ux i s t oo week t o ho ld

t he gap c lo sed i s r e ached and t he a rma tu re snaps open . Th i s i s c a l l ed t he

d ropou t c i r cu i t ( o r vo l t age ) and i s u sua l l y cons ide red l e s s t han t he

p i ckup cu r r en t ( o r vo l t age ) t he on ly no t i c eab l e phys i ca l d i f f e r ence

be tween AC and DC r e l ays w i th t he s ame r a t i ng i s t he add i t i on o f t he

shaded po l e a t t he end o f t he co re . A shaded po l e i s a conduc t i ng r i ng

t ha t c r ea t e s a magne t i c f i e l d t ha t l ay s t he app l i ed f i e l d , p roh ib i t i ng t he

r ap id co l l apse o f t he f l ux ac ros s t he gap . I f t h i s we re no t t he c a se t he

r e l ay wou ld hum o r cha t t e r a t a 60Hz r a t e and con t ac t pos i t i on wou ld be

unde t e rmined . The shad ing a l so cause s a r e r e l ays t o be i nhe ren t l y s l ower

t o r e l e a se t han dc r e l ays i f t he s ame s i z e . The de l ay i s abou t 100ms o r

l onge r t o p r even t con t ac t r e l e a se a t e ach po l a r i t y r eve r sa l on 60 Hz

ope ra t i on .

The con t ac t s i n an e l e c t romagne t i c r e l ays make o r b r eak t he

connec t i on i n e l e c t r i c c i r cu i t s h igh cu r r en t con t ac t s a r e u sua l l y o f t he

s i ng l e bu t t on o r by b i fu r ca t ed s t y l e . Nob l e me t a l a l l oys a r e u sed fo r t he

con t ac t ma t e r i a l t o r educe ox ida t i on t ha t c ause s ox ida t i on t ha t c ause s

h igh r e s i s t ance t he b i fu r ca t ed con t ac t ha s two su r f ace s fo r l e s s con t ac t

r e s i s t ance a t l owe r a c t i va t i ng fo r ce

51

Page 52: IVRS

The co re ba r con t ac t s a r e u sed fo r d ry c i r cu i t (NO o r l i t t l e cu r r en t

f l ow) and a r e made o f go ld t o h inde r and ox ida t i on fo r l ow l eve l (m i l l i

vo l t s o r m ic ro vo l t s ) Swi t ch ing c i r cu i t .

Con t ac t a r c ing i s more common in DC than i n AC c i r cu i t

i n t e r rup t i on t he AC c i r cu i t s go t h rough 0 vo l t age s a t e ach ha l f cyc l e and

ex t i ngu i sh any a r c ing t ha t occu r s . Any me ta l t r ans f e r i s gene ra l l y

e l im ina t ed , excep t f o r r oughen ing o f a con t ac t f a ce s . The DC a rc ing a r e

Spa rk d i s cha rge i s damag ing and w i l l c ause me t a l t o t r ans f e r f rom the

nega t i ve con t ac t t o t he pos i t i ve con t ac t .

4 .1 .3 Ser ia l Por t s in Computer

Al l IBM PC and compa t i b l e compu te r s a r e t yp i ca l l y equ ipped

w i th two se r i a l po r t s and one pa ra l l e l po r t . A l t hough t he se two t ypes

o f po r t s a r e u sed fo r commun ica t i ng w i th ex t e rna l dev i ce s , t hey work

i n d i f f e r en t ways .

A pa ra l l e l po r t s ends and r ece ive s da t a e i gh t b i t s a t a t ime ove r

8 s epa ra t e w i r e s . Th i s a l l ows da t a t o be t r ans f e r r ed ve ry qu i ck ly ;

howeve r , t he c ab l e r equ i r ed i s more bu lky because o f t he number o f

i nd iv idua l w i r e s i t mus t con t a in . Pa r a l l e l po r t s a r e t yp i ca l l y u sed t o

connec t a PC to a p r i n t e r and a r e r a r e ly u sed fo r much e l s e . A s e r i a l

po r t s ends and r ece ive s da t a one b i t a t a t ime ove r one w i r e . Whi l e i t

t ake s e i gh t t imes a s l ong t o t r ans f e r e ach by t e o f da t a t h i s way , on ly a

f ew wi r e s a r e r equ i r ed . I n f a c t , two-way ( fu l l dup l ex ) commun ica t i ons

i s pos s ib l e w i th on ly t h r ee s epa ra t e w i r e s - one t o s end , one t o

r e ce ive , and a common s igna l g round w i r e .

52

Page 53: IVRS

In troduc t ion to Ser ia l Por t

The UART se r i a l po r t ( o r j u s t " s e r i a l po r t f o r sho r t " i s an I /O

( Inpu t /Ou tpu t ) dev i ce . An I /O dev i ce i s j u s t a way t o ge t da t a i n to and

ou t o f a compu te r . The re a r e many t ypes o f I /O dev i ce s such a s s e r i a l

po r t s , pa r a l l e l po r t s , d i sk d r i ve con t ro l l e r s , e t he rne t boa rds , un ive r sa l

s e r i a l buse s , e t c . Mos t PC ' s have one o r two s e r i a l po r t s . Each ha s a

9 -p in connec to r ( some t imes 25 -p in ) on t he back o f t he compu te r .

Compu te r p rog rams can s end da t a (by t e s ) t o t he t r ansmi t p in (ou tpu t )

and r ece ive by t e s f rom the r e ce ive p in ( i npu t ) . The o the r p in s a r e fo r

con t ro l pu rpose s and g round .

The s e r i a l po r t i s much more t han j u s t a connec to r . I t conve r t s

t he da t a f rom pa ra l l e l t o s e r i a l and changes t he e l e c t r i c a l

r ep re sen t a t i on o f t he da t a . I n s ide t he compu te r , da t a b i t s f l ow in

pa r a l l e l ( u s ing many w i r e s a t t he s ame t ime ) . Se r i a l f l ow i s a s t r e am

o f b i t s ove r a s i ng l e w i r e ( such a s on t he t r ansmi t o r r e ce ive p in o f

t he s e r i a l connec to r ) . Fo r t he s e r i a l po r t t o c r ea t e such a f l ow , i t mus t

conve r t da t a f rom pa ra l l e l ( i n s ide t he compu te r ) t o s e r i a l on t he

t r ansmi t p in ( and conve r se ly ) .

Pins and Wires

Old PC ' s u sed 25 p in connec to r s bu t on ly abou t 9 p in s we re

ac tua l l y u sed so t oday mos t connec to r s a r e on ly 9 -p in . Each o f t he 9

p in s u sua l l y connec t s t o a w i r e . Bes ide s t he two wi r e s u sed fo r

t r ansmi t t i ng and r ece iv ing da t a , ano the r p in (w i r e ) i s s i gna l g round .

The vo l t age on any w i r e i s measu red w i th r e spec t t o t h i s g round .

53

Page 54: IVRS

Thus t he min imum number o f w i r e s t o u se fo r 2 -way

t r ansmi s s ion o f da t a i s 3 . Excep t t ha t i t h a s been known to work w i th

no s i gna l g round w i r e bu t w i th deg raded pe r fo rmance and some t imes

w i th e r ro r s . The re a r e s t i l l more w i r e s wh ich a r e fo r con t ro l pu rpose s

( s i gna l i ng ) on ly and no t f o r s end ing by t e s . A l l o f t he se s i gna l s cou ld

have been sha red on a s i ng l e w i r e , bu t i n s t e ad , t he r e i s a s epa ra t e

ded i ca t ed w i r e fo r eve ry t ype o f s i gna l . Some (o r a l l ) o f t he se con t ro l

w i r e s a r e c a l l ed "modem con t ro l l i ne s " . Modem con t ro l w i r e s a r e

e i t he r i n t he a s se r t ed s t a t e ( on ) o f +12 vo l t s o r i n t he nega t ed s t a t e

( o f f ) o f - 12 vo l t s . One o f t he se w i r e s i s t o s i gna l t he compu te r t o s t op

s end ing by t e s ou t t he s e r i a l po r t c ab l e . Conve r se ly , ano the r w i r e

s i gna l s t he dev i ce a t t a ched t o t he s e r i a l po r t t o s t op s end ing by t e s t o

t he compu te r . I f t he a t t a ched dev i ce i s a modem, o the r w i r e s may t e l l

t he modem to hang up t he t e l ephone l i ne o r t e l l t he compu te r t ha t a

connec t i on ha s been made o r t ha t t he t e l ephone l i ne i s r i ng ing

( someone i s a t t emp t ing t o c a l l i n ) .

Bi -Direc t i ona l Communica t ions

The s e r i a l po r t on you r PC i s a f u l l - dup l ex dev i ce mean ing t ha t

i t c an s end and r ece ive da t a a t t he s ame t ime . I n o rde r t o be ab l e t o

do t h i s , i t u se s s epa ra t e l i ne s fo r t r ansmi t t i ng and r ece iv ing da t a .

Some types o f s e r i a l dev i ce s suppo r t on ly one -way commun ica t i ons

and t he r e fo re u se on ly two wi r e s i n t he c ab l e - t he t r ansmi t l i ne and

t he s igna l g round .

Communica t ing By B i t s

Once t he s t a r t b i t ha s been s en t , t he t r ansmi t t e r s ends t he a c tua l

da t a b i t s . The re may e i t he r be 5 , 6 , 7 , o r 8 da t a b i t s , depend ing on t he

number you have s e l ec t ed . Bo th r ece ive r and t he t r ansmi t t e r mus t

54

Page 55: IVRS

ag ree on t he number o f da t a b i t s , a s we l l a s t he baud r a t e . A lmos t a l l

dev i ce s t r ansmi t da t a u s ing e i t he r 7 o r 8 da t a b i t s . No t i c e t ha t when

on ly 7 da t a b i t s a r e emp loyed , you canno t s end ASCI I va lue s g r ea t e r

t han 127 . L ikewi se , u s ing 5 b i t s l im i t s t he h ighes t pos s ib l e va lue t o

31 . Af t e r t he da t a ha s been t r ansmi t t ed , a s t op b i t i s s en t . A s t op b i t

ha s a va lue o f 1 - o r a ma rk s t a t e - and i t c an be de t ec t ed co r r ec t l y

even i f t he p r ev ious da t a b i t a l so had a va lue o f 1 . Th i s i s

a ccompl i shed by t he s t op b i t ' s du ra t i on . S top b i t s c an be 1 , 1 . 5 , o r 2

b i t pe r i ods i n l eng th .

The Par i ty B i t

Bes ide s t he synch ron i za t i on p rov ided by t he u se o f s t a r t and

s t op b i t s , an add i t i ona l b i t c a l l ed a pa r i t y b i t may op t i ona l l y be

t r ansmi t t ed a long w i th t he da t a . A pa r i t y b i t a f fo rds a sma l l amoun t

o f e r ro r check ing , t o he lp de t ec t da t a co r rup t i on t ha t m igh t occu r

du r ing t r ansmi s s ion . You can choose even pa r i t y , odd pa r i t y , ma rk

pa r i t y , space pa r i t y o r none a t a l l . When even o r odd pa r i t y i s be ing

u sed , t he number o f ma rks ( l og i ca l 1 b i t s ) i n e ach da t a by t e i s

coun t ed , and a s i ng l e b i t i s t r ansmi t t ed fo l l owing t he da t a b i t s t o

i nd i ca t e whe the r t he number o f 1 b i t s j u s t s en t i s even o r odd .

Fo r example , when even pa r i t y i s chosen , t he pa r i t y b i t i s

t r ansmi t t ed w i th a va lue o f 0 i f t he number o f p r eced ing marks i s an

even number . Fo r t he b ina ry va lue o f 0110 0011 t he pa r i t y b i t wou ld

be 0 . I f even pa r i t y was i n e f f ec t and t he b ina ry number 1101 0110

was s en t , t hen t he pa r i t y b i t wou ld be 1 . Odd pa r i t y i s j u s t t he

oppos i t e , and t he pa r i t y b i t i s 0 when t he number o f ma rk b i t s i n t he

p r eced ing word i s an odd number . Pa r i t y e r ro r check ing i s ve ry

rud imen ta ry . Whi l e i t w i l l t e l l you i f t he r e i s a s i ng l e b i t e r ro r i n t he

cha rac t e r , i t doe sn ' t show wh ich b i t was r e ce ived i n e r ro r . A l so , i f

55

Page 56: IVRS

even number s o f b i t s a r e i n e r ro r t hen t he pa r i t y b i t wou ld no t r e f l e c t

any e r ro r a t a l l .

Mark pa r i t y means t ha t t he pa r i t y b i t i s a lways s e t t o t he ma rk

s i gna l cond i t i on and l i kewi se space pa r i t y a lways s ends t he pa r i t y b i t

i n t he space s i gna l cond i t i on . S ince t he se two pa r i t y op t i ons s e rve no

u se fu l pu rpose wha t soeve r , t hey a r e a lmos t neve r u sed .

RS-232C

RS-232 s t ands fo r Recommend S t anda rd number 232 and C i s

t he l a t e s t r ev i s i on o f t he s t anda rd . The s e r i a l po r t s on mos t compu te r s

u se a subse t o f t he RS-232C s t anda rd . The fu l l RS-232C s t anda rd

spec i f i e s a 25 -p in "D" connec to r o f wh ich 22 p in s a r e u sed . Mos t o f

t he se p in s a r e no t needed fo r no rma l PC commun ica t i ons , and i ndeed ,

mos t new PCs a r e equ ipped w i th ma l e D t ype connec to r s hav ing on ly

9 p in s .

Pin De ta i l s o f PC Ser ia l por t

RICTSRTSDSR

GNDDTRTDRDCD

RS232Connector

67895

4321

56

Page 57: IVRS

9 P in Connec tor on a DTE dev i ce (PC connec t ion )

P in

NumberDirec t i on o f s i gna l :

1Car r i e r De t ec t (CD) ( f rom DCE) Incoming s i gna l f r om a

modem

2 Rece ived Da t a (RD) Incoming Da t a f rom a DCE

3 Transmi t t ed Da t a (TD) Ou tgo ing Da t a t o a DCE

4 Da ta Te rmina l Ready (DTR) Ou tgo ing handshak ing s i gna l

5 S igna l Ground Common r e f e r ence vo l t age

6 Da ta Se t Ready (DSR) Incoming handshak ing s i gna l

7 Reques t To Send (RTS) Ou tgo ing f l ow con t ro l s i gna l

8 C lea r To Send (CTS) Incoming f l ow con t ro l s i gna l

9R ing Ind i ca to r (R I ) ( f rom DCE) Incoming s i gna l f r om a

modem

Tab l e 4 .1 : P in s o f RS232

The TD ( t r ansmi t da t a ) w i r e i s t he one t h rough wh ich da t a f rom

a DTE dev i ce i s t r ansmi t t ed t o a DCE dev i ce . Th i s name can be

dece iv ing , because t h i s w i r e i s u sed by a DCE dev i ce t o r e ce ive i t s

da t a . The TD l i ne i s kep t i n a ma rk cond i t i on by t he DTE dev i ce when

i t i s i d l e . The RD ( r ece ive da t a ) w i r e i s t he one on wh ich da t a i s

r e ce ived by a DTE dev i ce . RTS s t ands fo r Reques t To Send . Th i s l i ne

and t he CTS l i ne a r e u sed when "ha rdware f l ow con t ro l " i s enab l ed i n

bo th t he DTE and DCE dev i ce s .

57

Page 58: IVRS

The DTE dev i ce pu t s t h i s l i ne i n a ma rk cond i t i on t o t e l l t he

r emo te dev i ce t ha t i t i s r e ady and ab l e t o r e ce ive da t a . I f t he DTE

dev i ce i s no t ab l e t o r e ce ive da t a ( t yp i ca l l y because i t s r e ce ive bu f f e r

i s a lmos t f u l l ) , i t w i l l pu t t h i s l i ne i n t he space cond i t i on a s a s i gna l

t o t he DCE to s t op s end ing da t a . When t he DTE dev i ce i s r e ady t o

r e ce ive more da t a ( i . e . a f t e r da t a ha s been r emoved f rom i t ’ s r e ce ive

bu f f e r ) , i t w i l l p l a ce t h i s l i ne back i n t he ma rk cond i t i on . The

complemen t o f t he RTS wi r e i s CTS , wh ich s t ands fo r C l ea r t o Send .

The DCE dev i ce pu t s t h i s l i ne i n a ma rk cond i t i on t o t e l l t he DTE

dev i ce t ha t i t i s r e ady t o r e ce ive t he da t a .

L ikewi se , i f t he DCE dev i ce i s unab l e t o r e ce ive da t a , i t w i l l

p l a ce t h i s l i ne i n t he space cond i t i on . Toge the r , t he se two l i ne s make

up wha t i s c a l l ed RTS/CTS o r "ha rdware" f l ow con t ro l . The So f twa re

Wedge suppo r t s t h i s t ype o f f l ow con t ro l , a s we l l a s Xon /XOf f o r

" so f twa re" f l ow con t ro l . So f twa re f l ow con t ro l u se s spec i a l con t ro l

cha rac t e r s t r ansmi t t ed f rom one dev i ce t o ano the r t o t e l l t he o the r

dev i ce t o s t op o r s t a r t s end ing da t a . Wi th so f twa re f l ow con t ro l t he

RTS and CTS l i ne s a r e no t u sed .

DTR s t ands fo r Data Termina l Ready . I t s i n t ended func t i on i s

ve ry s im i l a r t o t he RTS l i ne . DSR (Da t a Se t Ready ) i s t he compan ion

t o DTR in t he s ame way t ha t CTS i s t o RTS . Some se r i a l dev i ce s u se

DTR and DSR a s s i gna l s t o s imp ly con f i rm tha t a dev i ce i s connec t ed

and i s t u rned on . The So f twa re Wedge s e t s DTR to t he ma rk s t a t e

when t he s e r i a l po r t i s opened and l e aves i t i n t ha t s t a t e un t i l t he po r t

i s c l o sed . The DTR and DSR l i ne s we re o r i g ina l l y de s igned t o p rov ide

an a l t e rna t e me thod o f ha rdware handshak ing . I t wou ld be po in t l e s s t o

u se bo th RTS/CTS and DTR/DSR fo r f l ow con t ro l s i gna l s a t t he s ame

t ime . Because o f t h i s , DTR and DSR a re r a r e ly u sed fo r f l ow con t ro l .

58

Page 59: IVRS

CD s t ands fo r Carr i er De tec t . Ca r r i e r De t ec t i s u sed by a

modem to s i gna l t ha t i t h a s a made a connec t i on w i th ano the r modem,

o r ha s de t ec t ed a c a r r i e r t one .

The l a s t r ema in ing l i ne i s RI o r Ring Ind ica tor . A modem

togg l e s t he s t a t e o f t h i s l i ne when an i ncoming ca l l r i ngs you r phone .

The Ca r r i e r De t ec t (CD) and t he R ing Ind i ca to r (R I ) l i ne s a r e

on ly ava i l ab l e i n connec t i ons t o a modem. Because mos t modems

t r ansmi t s t a t u s i n fo rma t ion t o a PC when e i t he r a c a r r i e r s i gna l i s

de t ec t ed ( i . e . when a connec t i on i s made t o ano the r modem) o r when

t he l i ne i s r i ng ing , t he se two l i ne s a r e r a r e ly u sed .

4 .2 POWER SUPPLY

F igu re 45 Power Supp ly Un i t

The power supp ly s ec t i on i s t he impor t an t one . I t shou ld de l i ve r

cons t an t ou tpu t r egu l a t ed power supp ly fo r succe s s fu l work ing o f t he

p ro j ec t . A 0 -12V/500mA t r ans fo rmer i s u sed fo r ou r pu rpose ; t he

59

Page 60: IVRS

pr imary o f t h i s t r ans fo rmer i s connec t ed i n t o ma in supp ly t h rough

on /o f f sw i t ch& fuse fo r p ro t ec t i ng f rom ove r load and sho r t c i r cu i t

p ro t ec t i on . The s econda ry i s connec t ed t o t he d iodes conve r t f r om

12V AC to 12V DC vo l t age , wh ich i s f u r t he r r egu l a t ed t o +5v , by

u s ing IC 7805 .

4 .2 .1 Regu la tor IC (LM 7805)

The LM7805 mono l i t h i c 3 - t e rmina l pos i t i ve vo l t age r egu l a to r s

emp loy i n t e rna l cu r r en t - l im i t i ng , t he rma l shu tdown and s a f e - a r ea

compensa t i on , mak ing t hem e s sen t i a l l y i ndes t ruc t i b l e . I f adequa t e

hea t s i nk ing i s p rov ided , t hey can de l i ve r ove r 1 .0A ou tpu t cu r r en t .

They a r e i n t ended a s f i xed vo l t age r egu l a to r s i n a w ide r ange o f

app l i c a t i ons i nc lud ing l oca l ( on -ca rd ) r egu l a t i on fo r e l im ina t i on o f

no i s e and d i s t r i bu t i on p rob l ems a s soc i a t ed w i th s i ng l e -po in t

r egu l a t i on . I n add i t i on t o u se a s f i xed vo l t age r egu l a to r s , t he se

dev i ce s c an be u sed w i th ex t e rna l componen t s t o ob t a in ad ju s t ab l e

ou tpu t vo l t age s and cu r r en t s .

Cons ide rab l e e f fo r t was expended t o make t he en t i r e s e r i e s o f

r egu l a to r s e a sy t o u se and min imize t he number o f ex t e rna l

componen t s . I t i s no t nece s sa ry t o bypas s t he ou tpu t , a l t hough t h i s

does improve t r ans i en t r e sponse . I npu t bypas s ing i s needed on ly i f t he

r egu l a to r i s l oca t ed f a r f r om the f i l t e r c apac i t o r o f t he power supp ly .

F igu re .4 .6 P in s o f LM780

60

Page 61: IVRS

5 . SOFTWARE DESCRIPTION

5.1 V i sua l Bas i c 6 .0

Visua l Bas i c (V i sua l Beg inne r s A l l pu rpose symbo l i c

In s t ruc t i on Code ) i s t he mos t popu l a r p rog ramming l anguage fo r

wor ld ’ s mos t popu l a r ope ra t i ng sy s t em. V i sua l Bas i c i s t he f i r s t

l anguage peop l e cons ide r when t hey wan t r ap id app l i c a t i on

deve lopmen t fo r t he w indow env i ronmen t . V i sua l Bas i c i s evo lved

f rom the o r i g ina l BASIC l anguage , wh ich i s w ide ly u sed l anguage .

Ex i s t i ng ob j ec t s a r e d r agged & d ropped i n t o t he p l ace i n s t e ad o f

wr i t i ng numerous codes . Whi l e wr i t i ng t he p rog rams , we a r e ab l e t o

s ee how the p rog rams run du r ing t he run t ime . Th i s i s g r ea t advan t age

ove r o the r p rog ramming l anguage . VB i s ba sed on an even t d r i ven

me thod mode l ; i t a l so ha s a s e t o f debugg ing t oo l s . The p r ima ry

r ea son beh ind s e l ec t i ng VB was because t he i n t e r f ace was so l i t t l e

compa red t o o the r t oo l s .

Proper t i e s

The p rope r t i e s de sc r i be t he appea rance o f t he GUI componen t .

When add ing a componen t , t he Name p rope r ty shou ld be s e t

immed ia t e ly , a cco rd ing t o t he t h r ee - l e t t e r mnemon ic naming

conven t i ons . The p rope r t i e s a r e d i sp l ayed i n t he P rope r t i e s Window in

Name /Va lue pa i r s i n a l phabe t i c a l o rde r .

Event Procedures

An even t p rocedu re i s a p i ece o f code t ha t r e sponds t o even t s

t ha t c an occu r fo r t ha t ob j ec t . Mos t o f t he even t s a r e gene ra t ed by t he

u se r , enab l i ng t hem to d i c t a t e t he o rde r o f execu t i on .

61

Page 62: IVRS

Forms

The Fo rm i s t he ma in s t age o f you r app l i c a t i on . By de fau l t , t he

S t anda rd Exe op t i on s t a r t s w i th a f o rm ca l l ed "Fo rm1" . The Name

p rope r ty o f t he Fo rm shou ld be named wi th a t h r ee - l e t t e r mnemon ic

p r e f i x o f " f rm" . Each Fo rm wi l l be a Window in you r app l i c a t i on .

Con t ro l s a r e added t o t he fo rm by e i t he r doub l e - c l i ck ing t hem in t he

t oo lbox , o r by s e l ec t i ng t he con t ro l and d r awing a bound ing r ec t ang l e

on t he fo rm . Your app l i c a t i on may use more t han one fo rm .

To add a new Fo rm to t he p ro j ec t , e i t he r s e l e c t "Add Fo rm"

f rom the "P ro j ec t " menu o r r i gh t - c l i ck t he Fo rms fo lde r i n t he P ro j ec t

Exp lo re r and s e l ec t , "Add" , and t hen "Fo rm" .

To l oad a new fo rm , u se t he Show me thod . The pa rame te r ,

vbModa l , i s op t i ona l . I f u sed , vbModa l means t ha t t he fo rm has focus

un t i l c l o sed w i th in t he app l i c a t i on .

The Load command can be u sed t o l oad a fo rm wi thou t showing

i t . Th i s t e chn ique i s u se fu l i f you wan t t o p r e load a fo rm , and t hen

u se e i t he r t he "Show" o r "V i s ib l e " me thod t o make i t v i s i b l e a s and

when r equ i r ed .

No te : I n VB.Ne t , t he r e a r e two t ypes o f Fo rms - Windows Fo rms and

Web Fo rms . Web Fo rms a r e ba sed on ASP .Ne t .

62

Page 63: IVRS

Standard Contro l s

Con t ro l s a r e added t o t he Fo rm f rom the Too lbox . Each con t ro l

ha s a s e t o f p rope r t i e s , and a s e t o f even t p rocedu re s a s soc i a t ed w i th

i t . The fo l l owing l i s t s t he con t ro l , r e ad ing l e f t t o r i gh t , t op t o bo t t om

a s t hey appea r i n t he s t anda rd Too lbox .

The Po in ter

The Po in t e r i s no t a con t ro l , bu t i s u sed t o i n t e r ac t w i th t he

con t ro l s on t he fo rm , a l l owing you t o move and r e s i z e t hem. The

Po in t e r i s s e l e c t ed by de fau l t . When a con t ro l i s added t o t he fo rm ,

t he focus r eve r t s back t o t he Po in t e r .

Pic tureBox Contro l

The P i c tu r eBox i s u sed t o d i sp l ay images o r a c t a s a con t a ine r

t o o the r con t ro l s . The t h r ee - l e t t e r mnemon ic fo r a P i c tu r eBox i s p i c

( eg . p i cFace ) . The ma in even t f o r a P i c tu r eBox i s t he C l i ck even t .

P i c tu r e s a r e l oaded i n to t he P i c tu r eBox us ing t he LoadP ic tu r e

func t i on . The fo l l owing example t ogg l e s be tween f ace0 .g i f and

f ace1 .g i f w i th e ach c l i ck o f t he mouse .

Labe l Contro l

The Labe l con t ro l i s u sed t o d i sp l ay t ex t t ha t c an ' t be changed

d i r ec t l y by t he u se r . Labe l s a r e more common ly u sed t o p l ace cap t i ons

aga in s t o the r con t ro l s o r s t o r e c a l cu l a t ed va lue s . The t h r ee - l e t t e r

mnemon ic fo r a Labe l i s l b l ( eg . l b lP rompt ) .

The de fau l t p rope r ty o f a Labe l i s Cap t i on . The Cap t i on p rope r ty may

be s e t a t de s ign - t ime u s ing t he P rope r t i e s Window, and changed a t

r un - t ime .

63

Page 64: IVRS

Labe l Contro l

The Labe l con t ro l i s u sed t o d i sp l ay t ex t t ha t c an ' t be changed

d i r ec t l y by t he u se r . Labe l s a r e more common ly u sed t o p l ace cap t i ons

aga in s t o the r con t ro l s o r s t o r e c a l cu l a t ed va lue s . The t h r ee - l e t t e r

mnemon ic fo r a Labe l i s l b l ( eg . l b lP rompt ) . The de fau l t p rope r ty o f a

Labe l i s Cap t i on . The Cap t i on p rope r ty may be s e t a t de s ign - t ime

u s ing t he P rope r t i e s Window, and changed a t r un - t ime .

To a l l ow t ex t on more t han one l i ne , t he Mul t i l i ne P rope r ty

mus t be s e t t o T rue . I f t he Sc ro l lBa r s P rope r ty doesn ' t a l l ow a

Hor i zon t a l Sc ro l lBa r , t hen t he t ex t w i l l wrap . The l eng th o f t he Tex t

p rope r ty i s l im i t ed t o 2048 cha rac t e r s f o r a Tex tBox , and abou t 32K i f

t he Mul t iL ine p rope r ty i s s e t t o T rue .

Frame Contro l

The F rame con t ro l i s u sed t o g roup con t ro l s and p rov ide s a

means o f sub -d iv id ing t he Fo rm v i sua l l y . The t h r ee - l e t t e r mnemon ic

fo r a F rame i s f r a ( eg . f r aPaymen tMe thod ) . The de fau l t p rope r ty i s

Cap t i on , wh ich can be u sed t o g ive con t ex t t o t he g roup ing ( eg .

Paymen t Me thod ) .

When op t i on bu t t ons a r e u sed , on ly one may be s e l ec t ed on t he

Fo rm. Op t ion Bu t tons p l aced i n a F rame a r e a s soc i a t ed w i th t he

F rame , and a r e t r e a t ed a s a new g roup .

Command But ton Contro l

The Command Bu t ton i s u sed by t he u se r t o i nvoke some ac t i on .

The t h r ee - l e t t e r mnemon ic fo r a Command Bu t ton i s cmd ( eg .

cmdQui t ) . The de fau l t even t f o r a Command Bu t ton i s "C l i ck" .

64

Page 65: IVRS

Checkbox Contro l

The CheckBox con t ro l i s u sed t o g ive t he u se r a cho i ce o f

ye s /no mu l t i p l e cho i ce op t i ons . The t h r ee - l e t t e r mnemon ic fo r a

CheckBox i s chk ( eg . chkHobb ie s ) . The "Va lue" p rope r ty may be u sed

t o de t e rmine whe the r an i t em has been s e l ec t ed - a va lue o f 1

i nd i ca t e s t r ue , and a va lue o f 0 i nd i ca t e s f a l s e . The fo l l owing

example u se s a command bu t t on t o de t e rmine wh ich i t ems have been

s e l ec t ed f rom a con t ro l a r r ay o f CheckBoxes .

Opt ionBut ton Contro l

The Op t ionBu t ton con t ro l i s u sed t o g roup op t i ons whe re t he

u se r c an on ly s e l ec t on ly one . As on ly one i t em may be s e l ec t ed

Op t ionBu t tons a r e g rouped i n con t a ine r s such a s t he Fo rm, F rame o r

P i c tu r eBox . The t h r ee - l e t t e r mnemon ic fo r an Op t ionBu t ton i s op t ( eg .

op tPaymen tMe thod ) . The "Va lue" p rope r ty may be u sed t o de t e rmine

whe the r an i t em has been s e l ec t ed - e i t he r T rue o r Fa l s e . The

fo l l owing example u se s a CommandBu t ton t o de t e rmine wh ich i t em

has been s e l ec t ed f rom a con t ro l a r r ay o f Op t ionBu t tons .

ComboBox Contro l

The ComboBox i s a combina t i on o f a Tex tBox and a L i s tBox

con t ro l . I t ems may be added t o t he l i s t a t de s ign - t ime u s ing t he "L i s t "

p rope r ty (<CTRL>+<ENTER> t akes you t o t he nex t l i ne t o add a new

i t em) . I t ems may be added t o t he l i s t a t r un - t ime u s ing t he AddI t em

me thod , and r emoved a t r un - t ime u s ing t he Remove I t em me thod ( s ee

be low fo r de t a i l s ) . The "C lea r " me thod r emoves a l l i t ems f rom the

l i s t . The t h r ee - l e t t e r mnemon ic fo r a ComboBox i s cbo ( eg .

cboAr t i s t ) .

65

Page 66: IVRS

Timer Contro l

The T imer con t ro l i s v i s i b l e a t de s ign - t ime , bu t no t shown a t

r un - t ime . I t i s u sed fo r backg round p roce s s ing a t i n t e rva l s spec i f i ed

by t he In t e rva l p rope r ty . The In t e rva l p rope r ty t ake s an i n t ege r i n t he

r ange 0 t o 65 ,535 . The In t e rva l i s measu red i n m i l l i s econds ; t he r e fo re

a va lue o f 1000 equa l s an i n t e rva l o f one s econd . An In t e rva l o f 0

d i s ab l e s t he T imer con t ro l i n VB 6 , bu t no t i n VB.Ne t . To d i s ab l e t he

T imer , s e t t he Enab l ed P rope r ty t o Fa l s e . Se t t i ng i t t o T rue w i l l

enab l e i t aga in . The t h r ee - l e t t e r mnemon ic fo r a T imer i s tmr ( eg .

tmrMove ) . The de fau l t even t f o r a T imer i s t he T imer even t .

Th i s example moves a P i c tu r eBox a round t he fo rm . To t ry t he

example , add a P i c tu r eBox ca l l ed p i cFace , and a T imer c a l l ed

tmrMove t o t he fo rm . Se t t he In t e rva l o f t he T imer t o 1 , and add a

p i c tu r e o f a f a ce t o t he P i c tu r eBox .

5 .2 . V i sua l Bas i c (Ser ia l Communica t ion )

5 .2 .1 In troduc t ion

Thi s chap t e r d i s cus se s how Vi sua l Bas i c c an be u sed t o a cce s s

s e r i a l commun ica t i on func t i ons . Windows h ide s much o f t he

complex i t y o f s e r i a l commun ica t i ons and au toma t i ca l l y pu t s any

r ece ived cha rac t e r s i n a r e ce ive bu f f e r and cha rac t e r s s en t i n to a

t r ansmi s s ion bu f f e r . The r ece ive bu f f e r c an be r ead by t he p rog ram

wheneve r i t ha s t ime and t he t r ansmi t bu f f e r i s emp t i ed when i t i s

f r e e t o s end cha rac t e r s .

5 .2 .2 Communica t ions contro l

Visua l Bas i c a l l ows many add i t i ona l componen t s t o be added t o

t he t oo lbox . The Mic roso f t Comm. componen t i s u sed t o add a s e r i a l

66

Page 67: IVRS

communica t i on f ac i l i t y . I n o rde r t o u se t he Comms componen t t he

f i l e s MSCOMM16.OCX ( fo r a 16 -b i t modu le ) o r MSCOMM32.OCX

( fo r a 32 -b i t modu le ) mus t be p r e sen t i n t he \WINDOWS\SYSTEM

d i r ec to ry . The c l a s s name i s MSComm. The commun ica t i ons con t ro l

p rov ide s t he fo l l owing two ways fo r hand l i ng commun ica t i ons

Event -dr iven

Even t -d r i ven commun ica t i ons i s t he be s t me thod o f hand l i ng

s e r i a l commun ica t i on a s i t f r e e s t he compu te r t o do o the r t h ings . The

even t c an be de f i ned a s t he r e cep t i on o f a cha rac t e r , a change i n CD

( ca r r i e r de t ec t ) o r a change i n RTS ( r eques t t o s end ) . The OnComm

even t c an be u sed t o c ap tu r e t he se even t s . and a l so t o de t ec t

commun ica t i ons e r ro r s .

Pol l ing

CommEven t p rope r t i e s c an be t e s t ed t o de t e rmine i f an even t o r

an e r ro r ha s occu r r ed . Fo r example , t he p rog ram can l oop wa i t i ng fo r

a cha rac t e r t o be r e ce ived . Once i t i s t he cha rac t e r i s r e ad f rom the

r e ce ive bu f f e r . Th i s me thod i s no rma l ly u sed when t he p rog ram has

t ime t o po l l t he commun ica t i ons r e ce ive r o r t ha t a known r e sponse i s

imminen t .

V i sua l Bas i c u se s t he s t anda rd Windows d r i ve r s f o r t he s e r i a l

commun ica t i on po r t s ( such a s s e r i a l u i . d l l and s e r i a l . vxd ) . The

commun ica t i on con t ro l i s added t o t he app l i c a t i on fo r e ach po r t . The

pa rame te r s ( such a s t he b i t r a t e , pa r i t y , and so on ) c an be changed by

s e l ec t i ng Con t ro l Pane l ? Sys t em ? Dev i ce Manage r ? Po r t s (COM

and LPT) ? Po r t Se t t i ngs . The s e t t i ngs o f t he commun ica t i ons po r t

( t he IRQ and t he po r t add re s s ) c an be changed by s e l ec t i ng Con t ro l

67

Page 68: IVRS

Pane l ? Sys t em? Dev i ce Manage r? Po r t s (COM and LPT)? Resou rce s

fo r IRQ and Addre s se s .

Proper t i e s

The Comm componen t i s added t o a f o rm wheneve r s e r i a l

commun ica t i ons a r e r equ i r ed . By de fau l t , t he f i r s t c r ea t ed ob j ec t i s

named MSComm1 ( t he s econd i s named MSComm2, and so on ) . I t c an

be s een t ha t t he ma in p rope r t i e s o f t he ob j ec t a r e : CommPor t ,

DTREnab l e , EOFEnab l e , Handshak ing , I nBuf f e rS i ze , I ndex , I npu tLen ,

I npu tMode , Le f t , Name , Nu l lD i sca rd , Ou tBuf f e rS i ze , Pa r i t yRep l ace ,

RThre sho ld , RTSEnab l e , Se t t i ngs , SThre sho ld , Tag and Top .

Se t t ings

The Se t t i ngs p rope r ty s e t s and r e tu rns t he RS-232 pa rame te r s ,

such a s baud r a t e , pa r i t y , t he number o f da t a b i t , and t he number o f

s t op b i t s . I t s syn t ax i s :

[ f o rm . ]MSComm. Se t t i ngs = s e tS t r [$]

where t he s t rS t r i s a s t r i ng wh ich con t a in s t he RS-232 s e t t i ngs . Th i s

s t r i ng t ake s t he fo rm:

"BBBB,P ,D ,S"

whe re

BBBB def ine s t he baud r a t e ,

P t he pa r i t y ,

D t he number o f da t a b i t s , and

S t he number o f s t op b i t s .

The fo l l owing l i s t s t he va l i d baud r a t e s ( de f au l t i s 9600Baud) :

110 , 300 , 600 , 1200 , 2400 , 9600 , 14400 , 19200 , 38400 , 56000 ,

128000 , 256000 .

68

Page 69: IVRS

The va l i d pa r i t y va lue s a r e (de f au l t i s N) : E (Even ) , M (Mark ) , N

(None ) , O (Odd) , S (Space ) .

The va l i d da t a b i t va lue s a r e (de f au l t i s 8 ) : 4 , 5 , 6 , 7 o r 8 .

The va l i d s t op b i t va lue s a r e (de f au l t i s 1 ) . 1 , 1 . 5 o r 2 .

An example o f s e t t i ng a con t ro l po r t t o 4800Baud , even pa r i t y , 7 da t a

b i t s and 1 s t op b i t i s : Com1 .Se t t i ngs = "4800 ,E ,7 ,1"

CommPort

The CommPor t p rope r ty s e t s and r e tu rns t he commun ica t i on po r t

numbe r . I t s syn t ax i s :

[ f o rm . ]MSComm. CommPor t = por tNumber[%]

which de f i ne s t he po r tNumber f rom a va lue be tween 1 and 99 . A va lue

o f 68 i s r e t u rned i f t he po r t does no t ex i s t .

Por tOpen

The Po r tOpen p rope r ty s e t s and r e tu rns t he s t a t e o f t he

commun ica t i ons po r t . I t s syn t ax i s :

[ f o rm . ]MSComm. Por tOpen = [ {True | Fa l s e } ]

A True s e t t i ng opens t he po r t , wh i l e a Fa l s e c l o se s t he po r t and

c l ea r s t he r e ce ive and t r ansmi t bu f f e r s ( t h i s au toma t i ca l l y happens

when an app l i c a t i on i s c l o sed ) . The fo l l owing example opens

commun ica t i ons po r t numbe r 1 (COM1: ) a t 4800 Baud w i th even

pa r i t y , 7 da t a b i t s and 1 s t op b i t :

Input t ing da ta

The t h r ee ma in p rope r t i e s u sed t o r e ad da t a f rom the r e ce ive

bu f f e r a r e Inpu t , I nBuf f e r Coun t and InBuf f e rS i ze .

69

Page 70: IVRS

Input

The Inpu t p rope r ty r e t u rn s and r emoves a s t r i ng o f cha rac t e r s f rom

the r e ce ive bu f f e r . I t s syn t ax i s :

[ f o rm . ]MSComm. Inpu t

To de t e rmine t he number o f cha rac t e r s i n t he bu f f e r t he

InBuf f e rCoun t p rope r ty i s t e s t ed ( t o be cove red i n t he nex t s ec t i on ) .

Se t t i ng Inpu tLen t o 0 c ause s t he Inpu t p rope r ty t o r e ad t he en t i r e

con t en t s o f t he r e ce ive bu f f e r .

InBuf ferS i ze

The InBuf f e rS i ze p rope r ty s e t s and r e tu rns t he max imum number

o f cha rac t e r s t ha t c an be r e ce ived i n t he r e ce ive bu f f e r ( by de fau l t i t

i s 1024 by t e s ) . I t s syn t ax i s :

[ f o rm . ]MSCommInBu f f e rS i z e = [numBy te s%]

The s i z e o f t he bu f f e r shou ld be s e t so t ha t i t c an s t o r e t he max imum

number o f cha rac t e r s t ha t w i l l be r e ce ived be fo re t he app l i c a t i on

p rog ram can r ead t hem f rom the bu f f e r .

The InBuf f e rCoun t p rope r ty r e t u rn s t he number o f cha rac t e r s i n

t he r e ce ive bu f f e r . I t c an a l so be u sed t o c l e a r t he bu f f e r by s e t t i ng

t he number o f cha rac t e r s t o 0 . I t s syn t ax i s :

[ f o rm . ]MSCommInBuf fe rCoun t= [ coun t%]

Output t ing da ta

The t h r ee ma in p rope r t i e s u sed t o wr i t e da t a t o t he t r ansmi t bu f f e r

a r e Ou tpu t , Ou tBuf f e rCoun t and Ou tBuf f e rS i ze .

The Ou tpu t p rope r ty wr i t e s a s t r i ng o f cha rac t e r s t o t he t r ansmi t

bu f f e r . I t s syn t ax i s :

[ fo rm . ]MSComm. ou tpu t= [ou tS t r i ng$ ]

70

Page 71: IVRS

OutBuf ferS i ze

The Ou tBuf f e rS i ze p rope r ty s e t s and r e tu rns t he number o f

cha rac t e r s i n t he t r ansmi t bu f f e r ( de f au l t s i z e i s 512 cha rac t e r s ) . I t s

syn t ax i s :

[ f o rm . ]MSCommOutBuf f e r s i z e = [NumByte s%]

OutBu f f e rCoun t

The Ou tBuf f e rCoun t p rope r ty r e t u rn s t he number o f cha rac t e r s i n

t he t r ansmi t bu f f e r .The t r ansmi t bu f f e r c an a l so be c l e a r ed by s e t t i ng

i t t o 0 . I t s syn t ax i s :

[ fo rm . ]MSCommOutBuf f e rCoun t . = [0 ]

5 .3 . FLOW CHART

5.3 .1 . Micro Contro l l e r

Algor i thm

STEP 1 : S t a r t t he p rog ram

STEP 2 : Check whe the r r i ng s i gna l i s p r e sen t o r no t .

STEP 3 : I f r i ng s i gna l i s p r e sen t , make t e l ephone OFF HOOK and

s end FF t o Pe r sona l Compu te r , e l s e go t o STEP 2 .

STEP 4 : Ge t t he DTMF s igna l t h rough t he DTMF decode r .

STEP 5 : Check whe the r # i s p r e s sed o r no t . I f # i s p r e s sed , t hen

d i s connec t t he phone and go t o STEP 2 .

STEP 6 : I f # i s no t p r e s sed , t hen s end t he DTMF da t a t o t he pc

t h rough t he s e r i a l po r t and go t o STEP 4 .

71

Page 72: IVRS

72

Page 73: IVRS

5 .3 .2 . VISUAL BASIC

Algor i thm

STEP 1 : S t a r t t he p rog ram

STEP 2 : Check fo r t he da t a FF .

STEP 3 : I f da t a FF i s p r e sen t , p l ay t he we l come message , e l s e go

t o s t ep 2 .

STEP 4 : P l ay t he message t o en t e r t he ro l l numbe r .

STEP 5 : Check whe the r f ou r number s a r e en t e r ed o r no t .

STEP 6 : I f ye s , p l ay message t o en t e r

1 ATTENDENCE

2 MARKS

# DISCONNECT

e l s e go t o s t ep 5 .

STEP 7 : I f numbe r 1 i s p r e s sed , t hen check t he a t t endance and p l ay

p r e sen t o r absen t message and go t o s t ep 6 .

STEP 8 : I f numbe r 1 i s no t p r e s sed , check whe the r number 2 i s

p r e s sed o r no t . I f so p l ay t he ma rks fo r t he co r r e spond ing

r o l l numbe r and go t o s t ep 6 .

STEP 9 : I f numbe r 2 i s no t p r e s sed , check whe the r number # i s

p r e s sed o r no t . I f so t e rmina t e t he p rog ram and go t o s t ep 2 .

STEP 10 : I f numbe r # i s no t p r e s sed , go t o s t ep 6 un t i l # i s p r e s sed .

73

Page 74: IVRS

74

Page 75: IVRS

6 . PCB DESIGN

6.1 COMPONENT LAYOUT

75

Page 76: IVRS

6 .2 . PCB Des ign

The PCB des ign s t a r t s r i gh t f r om the s e l ec t i on o f t he

l amina t e s .The two ma in t ypes o f ba se l amina t e a r e epoxy g l a s s and

pheno l i c pape r l amina t e s a r e gene ra l l y u sed fo r s imp le c i r cu i t s .

Though i t i s ve ry cheap and can ea s i l y be d r i l l ed , pheno l i c pape r ha s

poo r e l e c t r i c a l cha rac t e r i s t i c s and i t ab so rbs more mo i s tu r e t han

epoxy g l a s s . Epoxy g l a s s ha s h ighe r mechan i ca l s t r eng th .

The impor t an t p rope r t i e s t ha t have t o be cons ide red fo r

s e l e c t i ng t he PCB subs t r a t e a r e t he d i e l e c t r i c s t r eng th , i n su l a t i on

r e s i s t ance , wa t e r abso rp t i on p rope r ty , coe f f . o f t he rma l

expans ion , shea r s t r eng th , ha rdnes s , d imens iona l s t ab i l i t y e t c .

6 .3 . PCB Fabr i ca t ion

The f ab r i c a t i on o f a PCB inc ludes fou r s t eps .

a ) P repa r ing t he PCB pa t t e rn .

b ) T rans f e r r i ng t he pa t t e rn on to t he PCB.

c ) Deve lop ing t he PCB.

d ) F in i sh ing ( i . e ) d r i l l i ng , cu t t i ng , smoo th ing , t u rn ing e t c .

Pa t t e rn de s ign ing i s t he p r ima ry s t ep i n f ab r i c a t i ng a PCB. In

t h i s s t ep , a l l i n t e r connec t i on be tween t he componen t s i n t he g iven

c i r cu i t a r e conve r t ed i n to PCB t r acks . Seve ra l f a c to r s such a s

pos i t i on ing t he d i ame te r o f ho l e s , t he a r ea t ha t e ach componen t wou ld

occupy , t he t ype o f end t e rmina l shou ld be cons ide red .

76

Page 77: IVRS

Trans ferr ing the PCB Pat t ern

The coppe r s i de o f t he PCB shou ld be t ho rough ly c l e aned w i th

t he he lp o f a l coho l i c sp i r i t o r pe t ro l . I t mus t be comple t e ly f r e e f rom

dus t and o the r con t aminan t s .

The mi r ro r image o f t he pa t t e rn mus t be c a rbon cop i ed and t o t he

l amina t e t he comple t e pa t t e rn may now be made each r e s i s t an t w i th

t he he lp o f pa in t and t h in b rush .

Deve lop ing

I n t h i s deve lop ing a l l exce s s ive coppe r i s r emoved f rom the boa rd

and on ly t he p r i n t ed pa t t e rn i s l e f t beh ind . Abou t 100ml o f t ap wa t e r

shou ld be hea t ed t o 75 ° C and 30 .5 g r ams o f FeC l 3 added t o i t , t he

m ix tu r e shou ld be t ho rough ly s t i r r ed and a f ew d rops o f HCl may be

added t o speed up t he p roce s s .

The boa rd w i th i t s coppe r s i de f a c ing upward shou ld be p l aced i n

a f l a t bo t t omed p l a s t i c t r ay and t he aqueous so lu t i on o f FeC l 2 pou red

i n t he e t ch ing p roce s s wou ld t ake 40 t o 60 min t o comple t e .

A f t e r e t ch ing t he boa rd i t shou ld be washed unde r runn ing wa t e r

and t hen he ld aga in s t l i gh t . t he p r i n t ed pa t t e rn shou ld be c l e an ly

v i s i b l e . The pa in t shou ld be r emoved w i th t he he lp o f t h inne r .

Fin i sh ing Touches

A f t e r t he e t ch ing i s comple t ed , ho l e o f su i t ab l e d i ame te r shou ld

be d r i l l ed , t hen t he PCB may be t i n p l a t ed u s ing an o rd ina ry 35 Wa t t s

so lde r i ng rod a long w i th t he so lde r co re , t he coppe r s i de may be

g iven a coa t o f va rn i sh t o p r even t ox ida t i on .

77

Page 78: IVRS

Dri l l ing

Dr i l l s f o r PCB use u sua l l y come wi th e i t he r a s e t o f co l l e c t s o f

va r i ous s i z e s o r a 3 - J aw chuck . Fo r a ccu racy howeve r 3 - j aw chunks

a r en ’ t b r i l l i an t and sma l l d r i l l be low 1 mm f rom g rooves i n t he j aws

p r even t i ng good g r i p s .

So lder ing

Beg in t he cons t ruc t i on by so lde r i ng t he r e s i s t o r s f o l l owed by

t he capac i t o r s and t he LEDs d iodes and IC socke t s . Don’ t t r y

so lde r i ng an IC d i r ec t l y un l e s s you t ru s t you r sk i l l i n so lde r i ng . A l l

componen t s shou ld be so lde red a s shown in t he f i gu re . Now connec t

t he sw i t ch and t hen so lde r / s c r ew i f on t he PCB us ing mu l t i p l e washe r s

o r space s . So lde r i ng i t d i r e c t l y w i l l on ly r educe i t s he igh t above o the r

componen t s and hampe r i n i t s e a sy f i xa t i on i n t he c ab ine t . Now

connec t t he ba t t e ry l e ad .

Assembl ing

The c i r cu i t c an be enc lo sed i n any k ind o f c ab ine t . Be fo re

f i t t i ng t he PCB su i t ab l e ho l e s mus t be d r i l l ed i n t he c ab ine t f o r t he

sw i t ch , LED and buzze r . No t e t ha t a r o t a ry sw i t ch can be u sed i n s t ead

o f a s l i de t ype .

Swi t ch on t he c i r cu i t t o be de s i r ed r ange . I t w i l l au toma t i ca l l y

s t a r t i t s t im ing cyc l e s . To be su r e t ha t i t i s work ing p rope r ly wa t ch

t he LED f l a sh . The componen t s a r e s e l ec t ed t o t r i gge r t he a l a rm a f ew

minu t e s be fo re t he s e t l im i t .

78

Page 79: IVRS

7 . CONCLUSION

Embedded sys t em p l ays a ma jo r r o l e i n advanced commun ica t i on

sy s t em. Embedded sys t em i s t he cu r r en t t e chno logy and ha s a b r i gh t

f u tu r e . Any r ea l t ime app ly can be con t ro l l ed . Our p ro j ec t w i l l be

ve ry ob l i g ing t o t he pa r en t s t o be acqua in t ed w i th t he i r

son ’ s /daugh t e r ’ s r e c i t a l i n t he co l l ege . P r e sen t a t i on i n t he c l a s s and

ou t come o f t he un ive r s i t y a r e made r eachab l e t o t he pa r en t s by ou r

p ro j ec t . Moreove r , t he t ime spend ing fo r co l l ege o f f i c i a l s i n

a t t emp t ing phone ca l l s f r om ou t s i de r s w i l l be r educed .

We had succe s s fu l l y execu t ed ou r p ro j ec t “VISCA” by u s ing ou r

co l l ege t e l ephone l i ne .

9 . FUTURE ENHANCEMENT

Our p ro j ec t shou ld be mod i f i ed t o know the p ro f i l e o f t he

s t uden t .

Acces s t he co l l ege da t abase fo r t he execu t i on o f ou r p ro j ec t .

Sound shou ld be mod i f i ed by r eco rd ing t he sound i n a sound

p roo f room.

79

Page 80: IVRS

APPENDIX 1

INSTRUCTION SET OF MCS51 FAMILY

Table: 1 Arithmetic Instruction for MCS51

80

Page 81: IVRS

Table: 2 Logical Operations

81

Page 82: IVRS

Table: 3 Data Transfer Instruction

82

Page 83: IVRS

83

Page 84: IVRS

Table: 4 Boolean Variable Manipulations and Machine Control

Instructions

REFERENCES

84

Page 85: IVRS

1 . Kenne th . J .Aya l a (Second ed i t i on ) . “The 8051 Mic rocon t ro l l e r

A rch i t e c tu r e , p rog ramming and app l i c a t i ons” .

2 . Muhammad Al i Maz id i , J an i ce G i l l i sp i e Maz id i . ( 2002 )

THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS

3 . Mohammed Azam, P rog ramming w i th V i sua l Bas i c 6 .0

85