You are on page 1of 42

SMART TICKETING FOR INDIAN RAILWAYS

CHAPTER 1
PREAMBLE
1.1. Introduction
A broad range of diverse te!no"ogies a##"ied to trans#ortation to $a%e s&ste$s $ore
effiient' re"iab"e and safer' t!e te!no"ogies e$#"o&ed o("d be s(! as
o$$(niation' o$#(ter infor$atis' sensors' s$art devies) T!e one of t!e
a##"iation of t!e s(! te!no"ogies for inreasing t!e effiien& of t!e Indian rai"*a&
s&ste$ is %no*n as Smart Card Ticketing for More Intelligent Raila! "!"tem
for Indian Raila!#.
1.$. Statement of Pro%lem
Indian Rai"*a&s +IR, is t!e seond "argest rai" N-W in t!e g"obe' *!i! arr& abo(t
./ $i""ion #assengers ever&da&) Abo(t *!i! 0)1 to 0)2 $i""ion !ave reservation and
re$aining abo(t .3)1 $i""ions trave"s on t!e ti%ets) So it is diffi("t to trae a"" t!e
(na(t!orised #assengers *!o are trave""ing *it!o(t t!e ti%ets or *it! t!e fa%e ti%ets
b& t!e Ti%et C!e%er +TC,)
Even if .4 of t!e #assengers trave" *it!o(t ti%et' or if over trave"
t!ere *i"" be !(ge "oss to t!e Indian rai"*a&) So o(r #ro5et #ro#oses a s$art ard
ti%eting s&ste$ to red(e t!e "oss to t!e Indian rai"*a&)
1.&. '(er(ie)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
T!is s$art ti%eting s&ste$ onsist of s$art ards for t!e #assengers as
a ti%ets' t!e ter$ina"s +s$art devie, t!at aess t!e ards for ea! and ever&
o$#art$ents' and one $ore devie *it! t!e TC)
A"" t!e ter$ina" devies are net*or%ed *it! t!e TC devie' net*or%
an be *ired or even *ire"ess) One t!e train de#arts one station a"" t!e ter$ina"
devies (#dates t!e n($ber of #assengers in t!at #arti("ar o$#art$ent as #er t!e
entr& and e6it of t!e #assengers' to t!e TC devie' so t!e TC *i"" o$e to %no* t!e
n($ber of #assengers for ea! and ever& o$#art$ent)
One data of #assengers is trans$itted to TC !e *i"" get t!e infor$ation
not on"& n($ber of #assengers b(t a"so t!e n($ber of #assengers trave""ing *it!o(t
ti%ets' n($ber of #assengers trave""ing *it! inva"id ti%ets et) in t!e res#etive
bogies' *!i! *i"" !i$ to at! fra(d #assengers o$#arative"& in eas& *a&)
CHAPTER $
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
S*STEM +ESCRIPTI',
-ig $.1. S!"tem Block +iagram
-ig.$.$. Internal Block +iagram of Terminal +e(ice .for
com/artment0)
SKSVMACET DEPT. OF E&C Page
Centralised
Device
(TC)
Terminal
device 1 !r
c!m"artme
nt
Terminal
device # !r
c!m"artme
nt
Terminal
device $ !r
c!m"artment
%&
sens!r
SMART TICKETING FOR INDIAN RAILWAYS
-ig $.&.Internal Block +iagram of Centrali"ed +e(ice .TC0)
SKSVMACET DEPT. OF E&C Page
&F%D
&eader
Micr!c!ntr!ler
'(c)1*)$
Ma+
$,$*
T! TC device
Micr!c!ntr!ler
'(c)1
1-.$
/CD
1-+$
/CD
Fr!m terminal
devices
SMART TICKETING FOR INDIAN RAILWAYS
$.&. -unctional +e"cri/tion
Ea! and ever& ter$ina" +7ogie, devie e$#"o&s a RFID Reader onneted to
t!e $iro ontro""er) RFID $od("e is a non8ontat $et!od and t!e *ear and tear on
t!e ard is non8e6istent) T!e RFID reader onsists of a .91K!: osi""ator t!at a""o*s
interrogation of t!e RFID trans#onder) T!e infor$ation in t!e trans#onder is re"a&ed
via t!e reader to a $iro ontro""er t!ro(g! a seria" interfae) T!e RFID trans#onder
*i"" trans$it t!e ID odes *it!o(t $a%ing #!&sia" ontat *it! t!e reader) T!is non8
ontat $et!od of ID ode reading *i"" a""o* non8invasive identifiation #roess)
Additiona""&' t!e RFID trans#onder !as t!e advantage of being i$$(ne to
d(st' dirt' grease' #aint and an& ot!er onta$inant fo(nd in ever&da& "ife t!at
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
genera""& affet o"der $et!ods of identifiation "i%e barodes and !($an readab"e
"ettering)
T!e RFID Tags are (sed to detet t!e entr& and e6it of t!e stations and as *e""
as s$art ti%ets) And a"so t!ere is a interr(#t detetor to detet t!e entr& of t!e #(b"i
into t!e bogie)
One t!e train is entered an& ne* station' t!en t!e devie o(nts t!e n($ber of
#ersons entering into t!e bogie b& t*o $eans ' one t!ro(g! t!e interr(#t detetor and
anot!er t!ro(g! t!e RFID reader' and if t!e train is e6ited t!en t!e ea! and ever&
ter$ina" devies trans$its t!e infor$ation abo(t t!e n($ber of #assengers in t!e
bogie' and if an& differene in n($ber of #assengers avai"ab"e and t!e va"id
#assengers to t!e TC devie t!ro(g! t!e seria" o$$(niation at ;<00 b#s ba(d rate'
t!e ter$ina" devie reeives a"" t!e infor$ation sent b& t!e ea! and ever& ter$ina"
devies and *i"" be dis#"a&ed' so t!e TC *i"" o$e to %no* a"" t!e infor$ation of a""
t!e bogie=s)
Ad(antage")
> Te!no"og& obso"esene of e6isting e?(i#$ent
> I$#"e$entation of ne* +innovative, fare #o"i&
> Red(tion of fra(d
> Inrease of #assenger "o&a"t&
> Red(tion of o#erating and $aintenane osts
> Inrease of boarding s#eeds b& red(ing transation ti$es
Ease8of8(se for #assengers
@ Ease8of8ontro" for o#erators
@ Inter$oda"it& +transfer ti%ets,
@ Si$#"iit& of "earing and s!aring reven(es bet*een o#erators
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
Si$#"iit& of reven(e o""etion
And a"so *e are #ro#osing t!e RFID based ti%ets for its "o* ost' eas& o#eration'
#ortabi"it&' d(rabi"it&' re"iabi"it& and being $(! $ore (ser friend"&) A"so t!e !ig!
s#eed RFID tags and detetors $a%e t!e tra%ing s&ste$ of a
r(nning train $ere"& a !i"d=s #"a&)
+i"ad(antage"
T!e on"& disadvantage is t!at t!e ost of RFID tags as a ti%ets)
A//lication")
S(! %ind of ti%eting s&ste$ an not on"& for rai"*a& s&ste$' it an be a"so
i$#"e$ented for ot!er $ass trans#ort s&ste$s)
CHAPTER &
12C31 MICR'C',TR'LLER
&.1. -eature"
> Co$#atib"e *it! MCS81.A Brod(ts
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
> /K 7&tes of In8S&ste$ Re#rogra$$ab"e F"as! Me$or&
C End(raneD .'000 Write-Erase C&"es
> F(""& Stati O#erationD 0 E: to 9/ ME:
> T!ree8"eve" Brogra$ Me$or& Lo%
> .9F 6 F8bit Interna" RAM
> 39 Brogra$$ab"e I-O Lines
> T*o .<8bit Ti$er-Co(nters
> Si6 Interr(#t So(res
> Brogra$$ab"e Seria" C!anne"
> Lo*8#o*er Id"e and Bo*er8do*n Modes
&.$. +e"cri/tion
T!e ATF;C1. is a "o*8#o*er' !ig!8#erfor$ane CMOS F8bit $iroo$#(ter
*it! /K b&tes of F"as! #rogra$$ab"e and erasab"e read on"& $e$or& +BEROM,) T!e
devie is $an(fat(red (sing At$e"=s !ig!8densit& non8vo"ati"e $e$or& te!no"og&
and is o$#atib"e *it! t!e ind(str&8standard MCS81. instr(tion set and #in o(t) T!e
on8!i#
F"as! a""o*s t!e #rogra$ $e$or& to be re#rogra$$ed in8s&ste$ or b& a
onventiona" non8vo"ati"e $e$or& #rogra$$er) 7& o$bining a versati"e F8bit CBG
*it! F"as! on a $ono"it!i !i#' t!e At$e" ATF;C1. is a #o*erf(" $iroo$#(ter
*!i! #rovides a !ig!"&8f"e6ib"e and ost8effetive so"(tion to $an& e$bedded
ontro" a##"iations)
T!e ATF;C1. #rovides t!e fo""o*ing standard feat(resD /Kb&tes of F"as!' .9F
b&tes of RAM' 39 I-O "ines' t*o .<8bitti$er-o(nters' a five vetor t*o8"eve" interr(#t
ar!itet(re' a f("" d(#"e6 seria" #ort' on8!i# osi""ator and "o% ir(itr&) In
addition' t!e ATF;C1. is designed *it! stati "ogi for o#eration do*n to :ero
fre?(en& and s(##orts t*o soft*are se"etab"e #o*er saving $odes) T!e Id"e Mode
sto#s t!e CBG *!i"e a""o*ing t!e RAM' ti$er-o(nters' seria" #ort and interr(#t
s&ste$ to ontin(e f(ntioning) T!e Bo*er8do*n Mode saves t!e RAM ontents b(t
free:es t!e osi""ator disab"ing a"" ot!er !i# f(ntions (nti" t!e ne6t !ard*are reset)
&.&. Pin +e"cri/tion
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
4CC) S(##"& vo"tage)
5,+) Gro(nd)
Port 6) Bort 0 is an F8bit o#en8drain bi8diretiona" I-O #ort) As an o(t#(t #ort' ea!
#in an sin% eig!t TTL in#(ts) W!en .s are *ritten to #ort 0 #ins' t!e #ins an be (sed
as !ig! i$#edane in#(ts) Bort 0 $a& a"so be onfig(red to be t!e $("ti#"e6ed "o*
order address-data b(s d(ring aesses to e6terna" #rogra$ and data $e$or&) In t!is
$ode B0 !as interna" #(""8(#s) Bort 0 a"so reeives t!e ode b&tes d(ring F"as!
#rogra$$ing' and o(t#(ts t!e ode b&tes d(ring #rogra$ verifiation) E6terna" #(""8
(#s are re?(ired d(ring #rogra$ verifiation)
Port 1) Bort . is an F8bit bi8diretiona" I-O #ort *it! interna" #(""8(#s) T!e Bort .
o(t#(t b(ffers an sin%-so(re fo(r TTL in#(ts) W!en .s are *ritten to Bort . #ins
t!e& are #(""ed !ig! b& t!e interna" #(""8(#s and an be (sed as in#(ts) As in#(ts' Bort
. #ins t!at are e6terna""& being #(""ed "o* *i"" so(re (rrent +IIL, bea(se of t!e
interna" #(""8(#s)
Bort . a"so reeives t!e "o*8order address b&tes d(ring F"as! #rogra$$ing and
verifiation)
Port $) Bort 9 is an F8bit bi8diretiona" I-O #ort *it! interna" #(""8(#s) T!e Bort 9
o(t#(t b(ffers an sin%-so(re fo(r TTL in#(ts) W!en .s are *ritten to Bort 9 #ins
t!e& are #(""ed !ig! b& t!e interna" #(""8(#s and an be (sed as in#(ts) As in#(ts Bort
9 #ins t!at are e6terna""& being #(""ed "o* *i"" so(re (rrent +IIL, bea(se of t!e
interna" #(""8(#s) Bort 9 e$its t!e !ig!8order address b&te d(ring fet!es fro$
e6terna" #rogra$ $e$or& and d(ring aesses to e6terna" data $e$or& t!at (ses .<8
bit addresses +MOHI JDBTR,) In t!is a##"iation' it (ses strong interna" #(""8(#s
*!en e$itting .s) D(ring aesses to e6terna" data $e$or& t!at (ses F8bit addresses
+MOHI J RI,' Bort 9 e$its t!e ontents of t!e B9 S#eia" F(ntion Register) Bort 9
a"so reeives t!e !ig!8order address bits and so$e ontro" signa"s d(ring F"as!
#rogra$$ing and verifiation)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
Port &) Bort 3 is an F8bit bi8diretiona" I-O #ort *it! interna" #(""8(#s) T!e Bort 3
o(t#(t b(ffers an sin%-so(re fo(r TTL in#(ts) W!en .s are *ritten to Bort 3 #ins
t!e& are #(""ed !ig! b& t!e interna" #(""8(#s and an be (sed as in#(ts) As in#(ts' Bort
3 #ins t!at are e6terna""& being #(""ed "o* *i"" so(re (rrent +IIL, bea(se of t!e
#(""8(#s) Bort 3 a"so serves t!e f(ntions of vario(s s#eia" feat(res of t!e ATF;C1.
as "isted be"o*D Bort 3 a"so reeives so$e ontro" signa"s for F"as! #rogra$$ing and
verifiation)
RST) Reset in#(t) A !ig! on t!is #in for t*o $a!ine &"es *!i"e t!e osi""ator is
r(nning resets t!e devie)
ALE7PR'5) Address Lat! Enab"e o(t#(t #("se for "at!ing t!e "o* b&te of t!e
address d(ring aesses to e6terna" $e$or&) T!is #in is a"so t!e #rogra$ #("se in#(t
+BROG, d(ring F"as! #rogra$$ing) In nor$a" o#eration ALE is e$itted at a onstant
rate of .-< t!e osi""ator fre?(en&' and $a& be (sed for e6terna" ti$ing or "o%ing
#(r#oses) Note' !o*ever' t!at one ALE
Port Pin Alternate -unction"
B3)0 RID +seria" in#(t #ort,
B3). TID +seria" o(t#(t #ort,
B3)9 INT0 +e6terna" interr(#t 0,
B3)3 INT. +e6terna" interr(#t .,
B3)/ T0 +ti$er 0 e6terna" in#(t,
B3)1 T. +ti$er . e6terna" in#(t,
B3)< WR +e6terna" data $e$or& *rite strobe,
B3)2 RD +e6terna" data $e$or& read strobe,
Port & a"so reeives so$e ontro" signa"s for F"as! #rogra$$ing and verifiation)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
RST) Reset in#(t) A !ig! on t!is #in for t*o $a!ine &"es *!i"e t!e osi""ator is
r(nning resets t!e devie)
ALE7PR'5) Address Lat! Enab"e o(t#(t #("se for "at!ing t!e "o* b&te of t!e
address d(ring aesses to e6terna" $e$or&) T!is #in is a"so t!e #rogra$ #("se in#(t
+BROG, d(ring F"as! #rogra$$ing) In nor$a" o#eration ALE is e$itted at a onstant
rate of .-< t!e osi""ator fre?(en&' and $a& be (sed for e6terna" ti$ing or "o%ing
#(r#oses) Note' !o*ever' t!at one ALE #("se is s%i##ed d(ring ea! aess to
e6terna" Data Me$or&) If desired' ALE o#eration an be disab"ed b& setting bit 0 of
SFR "oation FEE) Wit! t!e bit set' ALE is ative on"& d(ring a MOHI or MOHC
instr(tion) Ot!er*ise' t!e #in is *ea%"& #(""ed !ig!) Setting t!e ALE8disab"e bit !as
no effet if t!e $iroontro""er is in e6terna" e6e(tion $ode)
PSE,) Brogra$ Store Enab"e is t!e read strobe to e6terna" #rogra$ $e$or&) W!en
t!e ATF;C1. is e6e(ting ode fro$ e6terna" #rogra$ $e$or&' BSEN is ativated
t*ie ea! $a!ine &"e' e6e#t t!at t*o BSEN ativations are s%i##ed d(ring ea!
aess to e6terna" data $e$or&)
EA74PP) E6terna" Aess Enab"e) EA $(st be stra##ed to GND in order to enab"e
t!e devie to fet! ode fro$ e6terna" #rogra$ $e$or& "oations starting at 0000E
(# to FFFFE) Note' !o*ever' t!at if "o% bit . is #rogra$$ed' EA *i"" be interna""&
"at!ed on reset) EA s!o("d be stra##ed to HCC for interna" #rogra$ e6e(tions) T!is
#in a"so reeives t!e .98vo"t #rogra$$ing enab"e vo"tage +HBB, d(ring F"as!
#rogra$$ing' for #arts t!at re?(ire .98vo"t HBB)
8TAL1) In#(t to t!e inverting osi""ator a$#"ifier and in#(t to t!e interna" "o%
o#erating ir(it)
8TAL$) O(t#(t fro$ t!e inverting osi""ator a$#"ifier)
'"cillator C9aracteri"tic") ITAL. and ITAL9 are t!e in#(t and o(t#(t'
res#etive"&' of an inverting a$#"ifier *!i! an be onfig(red for (se as an on8!i#
osi""ator' as s!o*n in Fig(re .) Eit!er a ?(art: r&sta" or era$i resonator $a& be
(sed) To drive t!e devie fro$ an e6terna" "o% so(re' ITAL9 s!o("d be "eft
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
(nonneted *!i"e ITAL. is driven as s!o*n in Fig(re 9) T!ere are no re?(ire$ents
on t!e d(t& &"e of t!e e6terna" "o% signa"' sine t!e in#(t to t!e interna" "o%ing
ir(itr& is t!ro(g! a divide8b&8t*o f"i#8f"o#' b(t $ini$($ and $a6i$($ vo"tage
!ig! and "o* ti$e s#eifiations $(st be observed)
Idle Mode) In id"e $ode' t!e CBG #(ts itse"f to s"ee# *!i"e a"" t!e on !i# #eri#!era"s
re$ain ative) T!e $ode is invo%ed b& soft*are) T!e ontent of t!e on8!i# RAM and
a"" t!e s#eia" f(ntions registers re$ain (n!anged d(ring t!is $ode) T!e id"e $ode
an be ter$inated b& an& enab"ed interr(#t or b& a !ard*are reset) It s!o("d be noted
t!at *!en id"e is ter$inated b& a !ard *are reset' t!e devie nor$a""& res($es
#rogra$ e6e(tion' fro$ *!ere it "eft off' (# to t*o $a!ine &"es before t!e
interna" reset a"gorit!$ ta%es ontro") On8!i# !ard*are in!ibits aess to interna"
RAM in t!is event' b(t aess to t!e #ort #ins is not in!ibited) To e"i$inate t!e
#ossibi"it& of an (ne6#eted *rite to a #ort #in *!en Id"e is ter$inated b& reset' t!e
instr(tion fo""o*ing t!e one t!at invo%es Id"e s!o("d not be one t!at *rites to a #ort
#in or to e6terna" $e$or&)
Fig 3).D Osi""ator onnetion)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
Fig(re 3)9D E6terna" "o% devie onfig(ration)
&.:. Programming t9e -la"9
T!e ATF;C1. is nor$a""& s!i##ed *it! t!e on8!i# F"as! $e$or& arra& in t!e
erased state +t!at is' ontents K FFE, and read& to be #rogra$$ed) T!e #rogra$$ing
interfae ae#ts eit!er a !ig!8vo"tage +.98vo"t, or a "o*8vo"tage +HCC, #rogra$
enab"e signa") T!e "o*8vo"tage #rogra$$ing $ode #rovides a onvenient *a& to
#rogra$ t!e ATF;C1. inside t!e (ser=s s&ste$' *!i"e t!e !ig!8vo"tage #rogra$$ing
$ode is o$#atib"e *it! onventiona" t!ird #art& F"as! or EBROM #rogra$$ers) T!e
ATF;C1. is s!i##ed *it! eit!er t!e !ig!8vo"tage or "o*8vo"tage #rogra$$ing $ode
enab"ed) T!e res#etive to#8side $ar%ing and devie signat(re odes are "isted in t!e
fo""o*ing tab"e)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
T!e ATF;C1. ode $e$or& arra& is #rogra$$ed b&te8b& b&te in eit!er #rogra$$ing
$ode) To #rogra$ an& nonb"an% b&te in t!e on8!i# F"as! Me$or&' t!e entire
$e$or& $(st be erased (sing t!e C!i# Erase Mode)
CHAPTER :
HAR+;ARE +ESI5, < I,TER-ACI,5
:.1 Poer Su//l!
:.1.1. 3 4olt" Poer Su//l! ="ing >163IC
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
Main b(i"ding b"o% of an& e"etroni s&ste$ is t!e #o*er s(##"& to #rovide
re?(ired #o*er for t!eir o#eration) For t!e $iroontro""er' a(dio a$#"ifier' %e&board'
edge onnetor L1H' re?(ired)) T!e #o*er s(##"& #rovides reg("ated o(t#(t vo"tage of
L1H)
Fig(re /).).D 1v #o*er s(##"&
T!ree ter$ina" IC 2F01 $eets t!e re?(ire$ent of L1H reg("ated) T!e
seondar& vo"tage fro$ t!e $ain transfor$er is retified b& diodes D.8D/ and is
fi"tered b& a#aitor C.) T!is (nreg("ated d vo"tage is s(##"ied to in#(t #in of
reg("ator IC) C9 is an in#(t b&#ass a#aitor and C3 is to i$#rove ri##"e re5etion)
T!e IC (sed are fi6ed reg("ator *it! interna" s!ort ir(it (rrent "i$iting and t!er$a"
s!(t do*n a#abi"it&
:.$ Li?uid Cr!"tal +i"/la! .LC+0 Module
:.$.1. Introduction
Fre?(ent"& a ATF;C1. #rogra$ $(st interat *it! t!e o(tside *or"d (sing
in#(t and o(t#(t devies t!at devies t!at o$$(niate diret"& *it! a !($an being)
One of t!e $ost o$$on o(t#(t devies (sed is a LCD) So$e o$$on LCD=s are
.<69 and 9069 dis#"a&s' *!i! $ean .< !araters #er 9 "ine and 90 !araters #er
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
"ines' res#etive"&) Fort(nate"&' Standards e6ist *!i! a""o* (s to o$$(niate *it!
vast $a5orit& of LCD) T!e Standard is referred is referred to as ED//2F0G' *!i!
refer to t!e ontro""er !i#' *!i! Reeivers data fro$ $iroontro""er and
o$$(niates diret"& *it! LCD)
:.$.$. H+::>16=
T!e //2F0 standard re?(ires 3 ontro" "ines as / or F I-O "ines for t!e data b(s
t!e (ser $a& se"et *!et!er t!e LCD is to o#erate *it! /8bit data b(s or F8data b(s)
T!e 3 ontro" "ines are EN' RS and RW) T!e EN "ine is a""ed Enab"e) T!is ontro"
"ine is (sed to te"" LCD t!at *e are sending it Data) To send data t!e' #rogra$ s!o("d
first send Eig! in t!is "ine and t!en set t!e ot!er t*o Contro" "ine and #(t data on t!e
data b(s) W!en ot!er "ines are read&' EN s!o("d be $ade LOW)
T!e RS "ine is Register se"etor "ine) W!en RS is LOW' t!e data is to be
treated as a Co$$and or s#eia" instr(tion +s(! as CLEAR SCREEN' ETC,) W!en
RS is EIGE' t!e data being sent is te6t data t!at s!o("d be dis#"a&ed on t!e sreen)
T!e RW "ine is read-*rite ontro" "ine) W!en it is LOW' t!e infor$ation on
data b(s is being *ritten to LCD) W!en RW is EIGE' t!e #rogra$ is effetive"&
?(er&ing t!e LCD *it! t!e instr(tion Get LCD stat(s)
A $ore rob(st $et!od is to (se MGET LCD STATGSN o$$and to deter$ine
if t!e LCD is t!e "ast rea""& (se t!e LCD' $(st initia"i:e and onfig(re it) T!is is
ao$#"is!ed b& sending a n($ber of instr(tions to t!e LCD) T!e first instr(tion
*i"" be to s#eif& *!et!er *e are (sing / or F8 "ine data b(s) Sending a &19 o$$and
to t!e LCD dose t!is) 7efore *e send t!e Co$$and t!e RS "ine s!o("d be $ade "o*)
We t!en send t!e 6E9 o$$and to t(rn t!e LCD On) Last"& *e send t!e 6@9
o$$and so t!at ever& ti$e *e send a !arater t!e (rsor a(to$atia""& $oves rig!t)
:.$.&. Cur"or Po"itioning
T!e //2F0 ontain a ertain a$o(nt of $e$or&' *!i! is assigned to dis#"a&)
A"" Te6t *e *rite to //2F0 is stored in t!is $e$or&' and t!e //2F0 s(bse?(ent"&
reads t!is Me$or& to dis#"a& t!e te6t on LCD itse"f)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
:.$.:. +i"/la!
In t!e above $e$or& $a#' area (# to 0F and /F is t!e visib"e dis#"a&) As one
an see' it $eas(res .< C!araters #er 9 "ines) T!e n($bers in ea! bo6 in $e$or&
address t!at orres#onds to t!at on sreen) T!(s t!e MSet C(rsor BositionN instr(tion
169 te""s t!e LCD to #osition t!e (rsor) Adding t!e (rsor Bosition to F0! does t!ese
sets t!e (rsor to t!e re?(ired #osition on t!e sreen)
:.$.3. PI, A""ignment)
PI, ,'. S*MB'L
1 4""
$ 4++
& 46
: RS
3 R7;
@ E
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
> +B'
1 +B1
2 +B$
16 +B&
11 +B:
1$ +B3
1& +B@
1: +B>
13 LE+A.B0
1@ LE+A.A0
:.$.@. LC+ InitialiCing %! In"truction 1A%it interface mode
SKSVMACET DEPT. OF E&C Page
0A%T FO& MO&E T1A# ,2MS AFTE&VDD &%SES
TO 3.)V
D%SP/A4 O#*OFF
CO#T&O/&S&0D56D5-D5)D53D5,D5$D51D522222221DC5
E#T&4 MODE
SET&S&0D56D5-D5)D53D5,D5$D51D5222222221%*DS1
0A%T FO& MO&E T1A# ,(7S
PO0E& O#
F7#CT%O#A/
SET&S&0D56D5-D5)D53D5,D5$D51D52222211#F88
0A%T FO& MO&E T1A# ,(7S
D%SP/A4
C/EA&&S&0D56D5-D5)D53D5,D5$D51D522222222221
0A%T FO& MO&E T1A# 1.),MS
SMART TICKETING FOR INDIAN RAILWAYS
Condition) fo"cD $>6k9C
SKSVMACET DEPT. OF E&C Page
INITIALIOATION END
# 2 19/%#E MODE
1 $9/%#E MODE
F 2 D%SP/A4 OFF
1 D%SP/A4 O#
D 2 D%SP/A4 OFF
1 D%SP/A4 O#
C
2 C7&SO& OFF
1 C7&SO& O#
SMART TICKETING FOR INDIAN RAILWAYS
:.:. Interru/t +etector.IR Sen"or0
SKSVMACET DEPT. OF E&C Page
5
2 5/%#K OFF
1 5/%#K O#
%*D
2 DEC&EME#T
MODE
1 %#C&EME#T
MODE
S1
2 E#TT%&E S1%FT
OFF
1 E#T%&E S1%FT
O#
SMART TICKETING FOR INDIAN RAILWAYS
As t!e na$e i$#"ies' t!e sensor is a"*a&s ON' $eaning t!at t!e IR "ed is onstant"&
e$itting "ig!t) t!is design of t!e ir(it is s(itab"e for counting o%Eect"' or counting
re(olution" of a rotating ob5et' t!at $a& be of t!e order of .1'000 r#$ or $(!
$ore) Eo*ever t!is design is $ore #o*er ons($ing and is not o#ti$i:ed for !ig!
ranges) in t!is design' range an be fro$ . to .0 $' de#ending on t!e a$bient "ig!t
onditions)
As &o( an see t!e s!e$ati is divided into 9 #arts t!e "ender and t!e recei(er)
T9e "ender is o$#osed of an IR LED +D9, in series *it! a /20 O!$ resistor'
&ie"ding a for*ard (rrent of 2)1 $A)
T9e recei(er #art is $ore o$#"iated' t!e 9 resistors R1 and R< for$ a vo"tage
divider *!i! #rovides 9)1H at t!e anode of t!e IR LED +!ere' t!is "ed *i"" be (sed as
a sensor,) W!en IR "ig!t fa""s on t!e LED +D.,' t!e vo"tage dro# inreases' t!e
at!odePs vo"tage of D. $a& go as "o* as .)/H or $ore' de#ending on t!e "ig!t
intensit&) T!is vo"tage dro# an be
deteted (sing an O#8A$# +o#erationa" A$#"ifier LM&31,) Yo( *i"" !ave to ad5(st
t!e variab"e resistor +BOT), RF so t!e t!e vo"tage at t!e #ositive in#(t of t!e O#8A$#
+#in No) 1, *o("d be so$e*!ere near .)< Ho"t) if &o( (nderstand t!e f(ntioning of
O#8A$#s' &o( *i"" notie t!at t!e o(t#(t *i"" go Eig! *!en t!e vo"t at t!e at!ode of
D. dro#s (nder .)<) So t!e o(t#(t *i"" be Eig! *!en IR "ig!t is deteted' *!i! is t!e
#(r#ose of t!e reeiver)
CHAPTER 3
R-I+ Module
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
3.1. '(er(ie of R-I+
RFID is a o$#"ete s&ste$ so"(tion t!at o#erates in t!e e"etro$agneti
s#etr($ to trans$it data *it!o(t ontat or "ine of sig!t)
RFID is a s&ste$ *it! t!e fo""o*ing o$#onentsD
. Trans#onder +or Tag,
9 Reader-Writer +Interrogator,
3 Antenna
T!e trans#onder is at t!e !eart of t!e s&ste$ and onsists of a s$a"" e"etroni
ir(it *it! an atta!ed si"ion !i#) RFID tags are #o*ered and "assified as ative or
#assive) Ative tags !ave an interna" batter& t!at a""o*s for "ong8read ranges) T!e& are
t&#ia""& read-*rite a#ab"e and are often seen in to"" o""etion a##"iations) Bassive
tags do not !ave a batter& and #o*ered b& a se#arate so(re t&#ia""& t!e interrogator)
A t&#ia" reader ontains an antenna to trans$it infor$ation to t!e tag as *e""
as reeive it fro$ t!e tag) T!e si:e and for$ of t!e antenna *i"" be de#endent on t!e
s#eifi a##"iation as *e"" as fre?(en& !osen) It t&#ia""& !o(ses a deoder and RF
$od("e as *e"" as t!e antenna) Readers an be fi6ed' i)e) $o(nted' or #ortab"e s(! as
a !and!e"d de#ending on t!e a##"iation)
A Tag is a trans#onder *!i! reeives a radio signa" and in res#onse to it sends
o(t a radio signa")
Tag ontains an antenna' and a s$a"" !i# t!at stores a s$a"" a$o(nt of data
Tag an be #rogra$$ed at $an(fat(re or on insta""ation
Tag is #o*ered b& t!e !ig! #o*er e"etro$agneti fie"d generated b& t!e
antennasC(s(a""& in door*a&s
T!e fie"d a""o*s t!e !i#-antenna to ref"et ba% an e6tre$e"& *ea% signa"
ontaining t!e data
Co""ision Detetion C reognition of $("ti#"e tags in t!e read range C is
e$#"o&ed to se#arate"& read t!e individ(a" tags
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
An R-I+ reader is a devie t!at is (sed to interrogate an RFID tag) T!e
reader !as an antenna t!at e$its radio *avesQ t!e tag res#onds b& sending ba% its
data)
T!e reader !as t*o basi o$#onents C
A sanning antenna
A transeiver *it! a deoder to inter#ret t!e data
T!e ob5etive of t!e E"etroni Brod(t Code +EBC, is to #rovide (ni?(e
identifiation of #!&sia" ob5ets)
3.$. L- 'EM R-I+ Modulate +T1$3R Serie"
T!e +T1$3R "erie" RFID Bro6i$it& OEM Reader Mod("e !as a b(i"t8in
antenna in $ini$i:ed for$ fator) It is designed to *or% on t!e ind(str& standard
arrier fre?(en& of .91 %E:) T!is LF reader $od("e *it! an interna" or an e6terna"
antenna fai"itates o$$(niation *it! Read8On"& trans#ondersRt&#e GNISGE or
TK1130 via t!e air interfae) T!e tag data is sent to t!e !ost s&ste$s via t!e *ired
o$$(niation interfae *it! a #rotoo" se"eted fro$ t!e $od("e #ino(t) T!e LF
DT.91R $od("e is best s(ited for a##"iations in Aess Contro"' Ti$e and
Attendane' Asset Manage$ent' Eand!e"d Readers' I$$obi"i:ers' and ot!er RFID
enab"ed a##"iations)
Fig(re 1)9D RFID sensor
-eature"
Se"etab"e GART or Wigand9<
B"(g8and8B"a&' needs L1H to beo$e a reader
No re#eat reads
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
LED-7ee#er indiates tag reading o#eration
E6e""ent read #erfor$ane *it!o(t an e6terna" ir(it
Co$#at si:e and ost8effetive
A ver& effiient $od("e for #ortab"e readers)
3.&. Block +iagram
Fig(re 1)3D 7"o% diagra$ LF DT.91R $od("e
T!e LF DT.91R reader onsist a RF front end interfaed *it! t!e baseband
#roessor t!at o#erates *it! L1H #o*er s(##"&) An antenna is interfaed *it! t!e RF
front end' and t(ned at .91 %E: to detet a tag +trans#onder, t!at o$es in t!e viinit&
of t!e reader fie"d) T!e data read fro$ t!e tag b& t!e front end is deteted and deoded
b& t!e baseband #roessor and is t!en sent to t!e GART interfae) T!e DT.91R is
designed for a reading range of 10 $$ to .00 $$) A LED and a bee#er an be
interfaed to t!e #in o(t to indiate t!e tag read stat(s) DT.91R !as a b(i"t8in ir(itr&
for noise red(tion)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
3.:. S/ecification"

SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
Fig(re 1)/D S!e$ati diagra$ of LFTD.91R Mod("e
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
3.3. Tran"/onder"
An (n(s(a""& si$#"e $et!od of onverting t!e interrogating RF fie"d into a
data8$od("ated signa" *!i! an be trans$itted ba% to t!e reader ontrib(tes to t!e
"o* $an(fat(ring ost of t!is trans#onder design) T!e ir(it (ses on"& one
ine6#ensive $iro*ave se$iond(tor +a diode, and a""o*s a"" #arts to be $o(nted
on an FR8/ #rinted ir(it board *it! t!e #at! antennas +Fig(re .,) 7& ontrast' ot!er
a##roa!es (se e6#ensive $iro*ave #arts' in"(ding SAW devies' osi""ators'
$i6ers' fi"ters and a$#"ifiers) Designs invo"ving $ore RF ir(itr& tend to be #o*er
!(ngr&' re?(iring inreased RF interrogation fie"ds)
Fig(re 1)1).D T!e o$#"ete trans#onder' *it! t!e 2/AC00 test osi""ator)
Fig(re 1)1)9 s!o*s t!e b"o% diagra$ of t!e "o* #o*er trans#onder) A ;.1 ME:
reeive antenna #o*ers t!e retifier-fre?(en& do(b"er-AM $od("ator) It #rovides a
retified DC so(re to t!e MCG *!i! ret(rns data to be AM $od("ated onto t!e
do(b"ed fre?(en&) An .F30 ME: antenna trans$its t!e $od("ated arrier)
Fig(re 1)1)9D7"o% diagra$ of t!e #assive trans#onder

SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
3.@. L- Coil +ri(er
T!e ATA192; is an LF oi" driver IC intended for #assive entr&-8go +BEG,
s&ste$s) It an drive (# to si6 "o*8fre?(en&8antennas +i)e)' oi"s, to #rovide a *a%e8
(# and initia"i:ation !anne" to t!e %e& fob)
3.>. -unctional +e"cri/tion
3.>.1. '/eration Mode"
ATA192; feat(res five o#eration $odes) T!e& areD
> Bo*er8do*n $ode +reset state,
> Id"e $ode
> O#erating $ode
> S!(tdo*n $ode
> Diagnosis $ode
Bo*er8do*n $ode is ative after s(##"& vo"tages !ave been a##"ied to t!e
!i#) No interna" ir(itr& is ative in t!is $ode and as s(! #o*er ons($#tion is
$ini$a") If no o#eration of t!e !i# is de$anded' it s!o("d be %e#t in t!is state) To
enter #o*er8do*n $ode' a negative #("se on t!e NRES #in for at "east tNRES'$in is
re?(ired)
After *a%e8(# fro$ #o*er8do*n $ode b& a "ogi !ig! signa" at t!e STCS #in'
t!e !i# is in id"e $ode) T!at is' t!e osi""ator is r(nning and t!e ontro" "ogi *aits
for o$$ands o$ing fro$ t!e seria" interfae) F(rt!er$ore' t!e se"eted o(t#(t
driver stage is read& for o#eration +t!e vo"tage on t!e orres#onding o(t#(t #in A6B is
a##ro6i$ate"& !a"f t!e batter& s(##"& vo"tage,) T!e (rrent ons($#tion of t!e !i# is
no* $ain"& defined b& t!e ross (rrent t!ro(g! t!e ative driver stage +#"ease refer
a"so to Setion 3)9 MCoi" Driver StageN,)
W!en #roessing oi" driving o$$ands' t!e !i# is in o#eration $ode) Fro$
t!e interfae #oint of vie*' t!ere is no differene fro$ t!e id"e $odeQ !o*ever' (rrent
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
ons($#tion is no* !ig!er as t!e o(t#(t driver stages are o#erating and' de#ending
on t!e se"eted o(t#(t (rrent' t!e DC8DC onverter is a"so o#erating)
If a onnetion fai"(re +s!ort ir(it on an& of t!e oi" onnetion "ines, is
deteted' t!e ATA192; enters t!e s!(tdo*n $ode to #rotet itse"f fro$ da$age) In
t!is $ode' t!e interfae o#erates in id"e $ode b(t *it! a"" #o*er stages s!(tdo*n and
no LF trans$ission o$$and #roessing) T!is $ode s!o("d be e6ited (sing t!e Reset
Fa("t Stat(s o$$and +see be"o*,' !o*ever' it an a"so be e6ited b& resetting t!e
!i#)
In diagnosis $ode' t!e o(t#(t driver stages are a"so disab"ed) In t!eir #"ae'
!ig!8o!$i (rrent so(res are ativated t!at an be #rogra$$ed via t!e seria"
interfae in order to !e% t!e oi" onnetion "ines for fai"(res) T!is $ode an be
e6ited b& an a##ro#riate SBI o$$and or b& resetting t!e !i#)
3.>.$. Coil +ri(er Stage
T!e driver stage for ea! oi" onsists of t*o N8!anne" DMOS transistors)
T!e "o*8side transistor is in Dar"ington onfig(ration to $aintain a so(re8fo""o*er
!arateristi)
FIG 1)2)9 Coi" Driver Stage
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
In t!e gra#!i above' t!e na$es of interna" #ins !ave a gre& s!aded
ba%gro(nd' and t!e !at!ed area is not #art of t!e driver stage itse"f b(t on"& (sed in
diagnosti $ode +#"ease refer to t!e Diagnosis 7"o% desri#tion for f(rt!er
infor$ation on t!is to#i,)
T!e driver stages are s(##"ied b& t!e t!ree HDS #ins' *!i! are tied toget!er inside
t!e !i#) A ?(iesene (rrent reg("ation ens(res "o* ross (rrent *!i"e in id"e state)
T!e o(t#(t transistors are $onitored for (rrent and te$#erat(re to #rotet t!e$ fro$
da$age a(sed b& irreg("ar "oad onditions or too !ig! a$bient te$#erat(res)
T!e driving stage is o#ti$i:ed for signa" ?(a"it& to ens(re "o* !ar$oni
distortions) T*o gro(#s of driver stages are integratedD t!e first gro(# is intended for
!ig!8(rrent oi"s' *!ereas t!e seond gro(# drives "o*8(rrent oi"s) Note t!at t!ere
are ertain oi" i$#edane ranges for ea! driver gro(#) If t!e onneted "oad e6eeds
t!is range' #ro#er (rrent reg("ation and-or data $od("ation is not g(aranteed) W!i"e
in id"e $ode and es#eia""& d(ring a trans$ission' t!e driver stages of t!e five
inative +i)e)' not se"eted, oi"s are s*it!ed to !ig!8side o(t#(ts' i)e)' t!e #ositive
oi" onnetion "ines are tied to t!e HDS #otentia") T!e sa$e a##"ies to t!e ret(rn "ine
in#(ts A6N) T!ese $eas(res ens(re $ini$($ #arasiti (rrents in t!e disab"ed oi"s
*!i"e t!e se"eted oi" is o#erating)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
3.>.&. Control Logic
T!e interna" ontro" "ogi !and"es a"" infor$ation o$ing fro$ t!e SBI and
ontro"s t!e #o*er stages) Diagnosti infor$ation is a"so o""eted and eva"(ated !ere)
3.>.:. Modulator Stage
T!e $od("ator stage ontro"s t!e oi" drivers) It gets a"" neessar& infor$ation
fro$ t!e o$$and b(ffer) T!at isD
> W!i! oi" to drive
> W!i! (rrent to $aintain in t!is oi"-*!i! diagnosis s*it! to "ose +in
diagnosis $ode,
> W!i! ba(d rate to (se for LF data trans$ission
> W!at %ind of trans$ission +i)e)' data or arrier,
> LF data itse"f +res#etive"& t!e on8ti$e *!en a arrier is to be trans$itted,
W!en a $od("ator o#eration is started b& an SBI o$$and' t!e data in t!e b(ffer is
#roessed in t!e order it arrives via SBI' o$$and b& o$$and) T!e ti$e for t!is
data #roessing de#ends on t!e o$$and itse"f and' if LF trans$issions are invo"ved'
t!e a$o(nt and "engt! of t!e data bits)
Tab"e8
CHAPTER @
SERIAL C'MM=,ICATI',
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
@.1 SERIAL +ATA TRA,SMISSI',
-ig @.1A"erial communication circuit
Mode 08888 S!ift register $ode
Mode .8888 Standard GART $ode
Mode 98888 M("ti#roessor $ode
In t!is #ro5et $ode . is (sed t!at standard GART $ode) It is .0 bit f(""
d(#"e6 trans$it and reeive $ode) Trans$itted data is sent as a start bit' eig!t data
bits and a sto# bit )
7AGD RATED
SKSVMACET DEPT. OF E&C Page
2
SMART TICKETING FOR INDIAN RAILWAYS
If standard ba(d rate are desired' t!en an ..)01;9 $ega!ert: r&sta" o("d be
se"eted) To get standard ba(d rate of ;<00 !ert: t!en' t!e setting of TE . $a& be
fo(nd as fo""o*s)
TE.K 91<d8 +9-39 6..)01;96.0
<
-.96 ;<00d,
K913)000d
K OFD!)
S'-T;ARE
F). E$bedded C
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
E$bedded C an be t!e bod& of a sri#t f(ntion) Instead en"osing t!e f(ntion bod&
state$ents in UandV' (se 4U and 4V) An& en"osed C ode is "itera""& transribed into
t!e %erne" $od("eD it is (# to &o( to $a%e it safe and orret) In order to ta%e
#ara$eters and ret(rn a va"(e' a #ointer $aro TEIS is avai"ab"e) F(ntion #ara$eters
and a #"ae for t!e ret(rn va"(e are avai"ab"e as fie"ds of t!at #ointer) T!e fa$i"iar
data8gat!ering f(ntions #id+,' e6eTna$e+,' and t!eir neig!bors are a"" e$bedded C
f(ntions)
Sine s&ste$ ta# annot e6a$ine t!e C ode to infer t!ese t&#es' o#tiona" annotation
s&nta6 is avai"ab"e to assist t!e t&#e inferene #roess) Si$#"& s(ffi6 #ara$eter na$es
and-or t!e f(ntion na$e *it!D string orD "ong to designate t!e string or n($eri t&#e)
In addition' t!e sri#t $a& in"(de a 4U 4V b"o% at t!e o(ter$ost "eve" of t!e sri#t'
in order to transribe de"arative ode "i%e Win"(de Xreg1.)!Y) T!ese enab"e t!e
e$bedded C f(ntions to refer to genera" %erne" t&#es)
T!ere are a n($ber of safet&8re"ated onstraints t!at s!o("d be observed b&
deve"o#ers of e$bedded C ode)
.) Do not dereferene #ointers t!at are not %no*n or testab"e va"id)
9) Do not a"" an& %erne" ro(tine t!at $a& a(se a s"ee# or fa("t)
3) Consider #ossib"e (ndesirab"e re(rsion' *!ere &o(r e$bedded C f(ntion
a""s a ro(tine t!at $a& be t!e s(b5et of a #robe) If t!at #robe !and"er a""s
&o(r e$bedded C f(ntion' &o( $a& s(ffer infinite regress) Si$i"ar #rob"e$s
$a& arise *it! res#et to non8reentrant "o%s)
/) If "o%ing of a data str(t(re is neessar&' (se a tr& "o% t&#e a"" to atte$#t to
ta%e t!e "o%) If t!at fai"s' give (#' do not b"o%)
7efore *e *rite C ode' *e need to deve"o# a soft*are #"an) Soft*are deve"o#$ent is
an iterative #roess) Even t!o(g! *e "ist ste#s t!e deve"o#$ent #roess in a .' 9' 3)))
Order' in rea"it& *e iterative t!ese ste#s over and over)
., We begin *it! a "ist of t!e in#(ts and o(t#(ts) We s#eif& t!e range of va"(es and
t!eir signifiane) For e6a$#"e in BORTA bits <80 *i"" be in#(ts) T!e 2 in#(t signa"s
re#resent an (nsigned integer fro$ 0 to .92) Bort A bit 2 *i"" be an o(t#(t) If BA2 is .
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
t!en t!e $otor *i"" ativate and t!e door *i"" be (n"o%ed) In asse$b"& "ang(age' *e
(se Wdefine MACROS to assign a s&$bo"i na$es' BORTA DDRA' to t!e
orres#onding addresses of t!e #orts' W0000 W0009
)
Wdefine BORTA Z+(nsigned !ar vo"ati"e Z,+060000,
Wdefine DDRA Z+(nsigned !ar vo"ati"e Z,+060009,
9, Ne6t' *e $a%e a "ist of t!e re?(ired data str(t(res) Data str(t(res are (sed to save
infor$ation) If t!e data needs to be #er$anent' t!en it is a""oates in g"oba" s#ae) If
t!e soft*are *i"" !ange its va"(e t!en it *i"" be a""oated in RAM) In t!is e6a$#"e
*e need a .<8bit (nsigned o(nter) EgD (nsigned int ntQ
If data str(t(re an be defined at o$#i"e ti$e and *i"" re$ain fi6ed' t!en it an be
a""oated in EEBROM) In t!is e6a$#"e *e *i"" define an F bit fi6ed onstant to !o"d
t!e %e& ode' *!i! t!e o#erator needs to set to (n"o% t!e door) T!e o$#i"er *i""
#"ae t!ese "ines *it! t!e #rogra$ so t!at t!e& *i"" be defined in ROM or EEBROM
$e$or&)
onst (nsigned !ar %e&K0693Q -- %e& ode
It is not rea" "ear at t!is #oint e6at"& *!ere in EEBROM t!is onstant *i"" be' b(t
"(%i"& for (s' t!e o$#i"er *i"" a"("ate t!e e6at address a(to$atia""&) After t!e
#rogra$ is o$#i"ed' *e an "oo% in t!e "isting fi"e or in t!e $a# fi"e to see *!ere in
$e$or& ea! str(t(re is a""oated)
3, Ne6t *e deve"o# t!e soft*are a"gorit!$' *!i! is a se?(ene of o#erations *e
*is! to e6e(te) T!ere are $an& a##roa!es to desribing t!e #"an) E6#eriened
#rogra$$ers an deve"o# t!e a"gorit!$ diret"& in C "ang(age) On t!e ot!er !and'
$ost of (s need an abstrative $et!od to do($ent t!e desired se?(ene of ations)
F"o*!arts and #se(do ode are t*o o$$on desri#tive for$ats) T!ere are no
for$a" r("es regarding #se(do ode' rat!er it is s!ort!and for desribing *!at to do
and *!en to do it) We an #"ae o(r #se(do ode as do($entation into t!e o$$ent
fie"ds of o(r #rogra$) Nor$a""& *e #"ae t!e #rogra$s in ROM or EEBROM)
T&#ia""&' t!e o$#i"er *i"" initia"i:e t!e sta% #ointer to t!e "ast "oation of RAM)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
A to%en in C an be a (ser defined na$e +e)g)' t!e variab"e Info and f(ntion O#en
SCI, or a #redefined o#eration +e)g)' Z (nsigned *!i"e,) Ea! to%en $(st be ontained
on a sing"e "ine) We see in t!e above e6a$#"e t!at to%ens an be se#arated b& *!ite
s#aes +s#ae' tab' "ine brea%, or b& t!e s#eia" !araters' *!i! *e an s(bdivide
into #(nt(ation $ar%s and o#erations B(nt(ation $ar%s are ver& i$#ortant in C) It
is one of t!e $ost fre?(ent so(res of errors for bot! t!e beginning and e6#eriened
#rogra$$ers)
F)9 KEIL IDE
T!e [Hision3 IDE fro$ Kei" o$bines #ro5et $anage$ent' $a%e fai"ities'
so(re ode editing' #rogra$ deb(gging' and o$#"ete si$("ation in one #o*erf("
environ$ent) T!e [Hision deve"o#$ent #"atfor$ is eas&8to8(se and it !e"#s &o(
?(i%"& reate e$bedded #rogra$s t!at *or%) T!e [Hision editor and deb(gger are
integrated in a sing"e a##"iation t!at #rovides a sea$"ess e$bedded #ro5et
deve"o#$ent environ$ent)
>.$. -lo C9art
Terminal de(ice)
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
TC +e(ice)
SKSVMACET DEPT. OF E&C Page
STA&T
%nitiali:e /CD &
dis"la; title
%nitiali:e <c int!
7A&T m!de =it>
(-22 ?a@d rate.
%s
stati!
n
e+it
Send
details
%s ne=
stati!n
.
&ead &F%D and
c>ecA sens!r.
C!@nt & @"date
t>e data
;es
n!
n!
;es
SMART TICKETING FOR INDIAN RAILWAYS
Circuit +iagram")
Fig F)9. Ter$ina" DevieD
SKSVMACET DEPT. OF E&C Page
STA&T
%nitiali:e /CD &
dis"la; title
%nitiali:e <c int!
7A&T m!de =it>
(-22 ?a@d rate.
%s data
received
r!m
?!gie 1
Dis"la;
in!rmati!n
%s data
received
r!m
?!gie$
Dis"la;
in!rmati!n
;es
;es
n!
n!
SMART TICKETING FOR INDIAN RAILWAYS
S W 1 7
S W P U S H B U T T O N
1 2
3
1 4 7
C 2
C A P N P
C 1
C A P N P
2
Y 1
C R Y S T A L
1
2
U 1
A T 8 9 C 5 1
9
1 8
1 9
2
0
2 9
3 0
3
1
4
0
1
2
3
4
5
6
7
8
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
3 9
3 8
3 7
3 6
3 5
3 4
3 3
3 2
R S T
X T A L 2
X T A L 1
G
N
D
P S E N
A L E / P R O G
E
A
/
V
P
P
V
C
C
P 1 0
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 1 6
P 1 7
P 2 0 / A 8
P 2 1 / A 9
P 2 2 / A 1 0
P 2 3 / A 1 1
P 2 4 / A 1 2
P 2 5 / A 1 3
P 2 6 / A 1 4
P 2 7 / A 1 5
P 3 0 / R X D
P 3 1 / T X D
P 3 2 / ! N T 0
P 3 3 / ! N T 1
P 3 4 / T 0
P 3 5 / T 1
P 3 6 / W R
P 3 7 / R D
P 0 0 / A D 0
P 0 1 / A D 1
P 0 2 / A D 2
P 0 3 / A D 3
P 0 4 / A D 4
P 0 5 / A D 5
P 0 6 / A D 6
P 0 7 / A D 7
V " " # 5 $
1
1 6 X 2
9 1 2
L C D
# 5 V
# 5 V
C 3
C A P A C ! T O R
1 1
R 3
R
8 1 0
m a x 2 3 2
R 2
R
V C C # 5 $
5
R F I D R e a d e r
I R s e n s o r
R 1 R
4 1 3 6
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
-ig 1.$$ TC +e(ice)
d a t a b u s
1 2
C 2
C A P N P
L C D
8
3
9
# 5 V
U 1
A T 8 9 C 5 1
9
1 8
1 9
2
0
2 9
3 0
3
1
4
0
1
2
3
4
5
6
7
8
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
3 9
3 8
3 7
3 6
3 5
3 4
3 3
3 2
R S T
X T A L 2
X T A L 1
G
N
D
P S E N
A L E / P R O G
E
A
/
V
P
P
V
C
C
P 1 0
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 1 6
P 1 7
P 2 0 / A 8
P 2 1 / A 9
P 2 2 / A 1 0
P 2 3 / A 1 1
P 2 4 / A 1 2
P 2 5 / A 1 3
P 2 6 / A 1 4
P 2 7 / A 1 5
P 3 0 / R X D
P 3 1 / T X D
P 3 2 / ! N T 0
P 3 3 / ! N T 1
P 3 4 / T 0
P 3 5 / T 1
P 3 6 / W R
P 3 7 / R D
P 0 0 / A D 0
P 0 1 / A D 1
P 0 2 / A D 2
P 0 3 / A D 3
P 0 4 / A D 4
P 0 5 / A D 5
P 0 6 / A D 6
P 0 7 / A D 7
1 1
C 3
C A P A C ! T O R
Y 1
C R Y S T A L
1
2
# 5 V
V " " # 5 $ 1 6 X 2
1 3
V C C # 5 $
C 1
C A P N P
5
1
S W 1 7
S W P U S H B U T T O N
1 2
R 1 R
1 4 R 2
R
6 1 0
R 3
R
2
7 4
C',CL=SI',
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
In dense"& #o#("ated \ orr(#ted o(ntr& "i%e INDIA it is ver& essentia" to
!ave *e"" advaned se(rit& s&ste$s in ea! fie"d )So t!at even offiia"s s!o("d be
fored b& t!e advaned s&ste$s to *or% #ro$#t"& to !is d(ties \ o(ntr&) T!is an
a!ieved *it! #ro#er i$#"e$entation of e6isting te!no"og& to a re?(ired $anner in
t!eir res#etive fie"ds) O(r #ro5et is t!e one of t!e e6a$#"e for (sage of te!no"og&
to good effet to red(e fra(d and orr(#tion in t!e fie"d of rai"*a& trans#ort s&ste$)
7& t!is *e on"(de t!at if *e (se te!no"og& to its best effet t!en *e an a!ieve
t!e t!ings *!i! even *e annot drea$ of)
-uture Im/ro(ement" < A//lication"
Gse 7arode ti%ets instead of RFID *i"" be ost effetive
Gse of !idden a$eras *i"" #(t *eig!t in detetion of (na(t!orised trave""ers)
T!is s&ste$ an be i$#"e$ented to a"" $ass trans#ort s&ste$s)
T!e sa$e s&ste$ an be i$#"e$ented in S!o##ing Ma""s for a(to$ated bi""ing
s&ste$
SKSVMACET DEPT. OF E&C Page
SMART TICKETING FOR INDIAN RAILWAYS
SKSVMACET DEPT. OF E&C Page