p 0011 rf based station name display

58
CHAPTER 1 INTRODUCTION One of the main form of communication that has been in use since 19 th century is Radio Wave communication. Radio Waves have found its place in each and every field whether it be medical, electronics or space. In general it exists in every system in one or the other form. The use of Radio Waves had made life much simpler and safer. A heart patient can be monitored by a doctor remotely sitting in his chamber is because of the use of Radio Waves. Radio Waves have made communication through telephone, internet etc easier and cheaper. Our project demonstrate one such example were Radio Wave is employed in a way which is helpful to us. This project is designed and developed for helping the passengers traveling in train and bus especially during night. The people who are not aware of the station on which one should get down will find this very helpful. Here the station name is displayed and announced simultaneously when the station is about to reach which can assist both literate and illiterate. The RF technology is used in the project to communicate between the transmitter and receiver. Each transmitter has a unique binary code which is transmitted continuously to space in a particular range. This signal is captured by the receiver when it reaches in its range. So in the case of a train, the transmitter placed in the station is detected by the receiver in the train and the binary code is processed to give out the station name display and audio corresponding to the binary code in the receiver. A LCD unit is used for displaying the station name and a speaker is used for the announcement. 1

Upload: arjun-peringali-aredath

Post on 05-Aug-2015

25 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: p 0011 RF Based Station Name Display

CHAPTER 1

INTRODUCTION

One of the main form of communication that has been in use since 19th

century is Radio Wave communication Radio Waves have found its place in each

and every field whether it be medical electronics or space In general it exists in

every system in one or the other form

The use of Radio Waves had made life much simpler and safer A heart

patient can be monitored by a doctor remotely sitting in his chamber is because of

the use of Radio Waves Radio Waves have made communication through

telephone internet etc easier and cheaper

Our project demonstrate one such example were Radio Wave is employed in

a way which is helpful to us This project is designed and developed for helping the

passengers traveling in train and bus especially during night The people who are

not aware of the station on which one should get down will find this very helpful

Here the station name is displayed and announced simultaneously when the station

is about to reach which can assist both literate and illiterate

The RF technology is used in the project to communicate between the

transmitter and receiver Each transmitter has a unique binary code which is

transmitted continuously to space in a particular range This signal is captured by

the receiver when it reaches in its range So in the case of a train the transmitter

placed in the station is detected by the receiver in the train and the binary code is

processed to give out the station name display and audio corresponding to the

binary code in the receiver A LCD unit is used for displaying the station name and

a speaker is used for the announcement

1

11 BLOCK DIAGRAM

The block diagram consists of the transmitter and receiver section They can

be represented as the following block diagrams

111 Transmitter

Fig 11 Block Diagram of Transmitter Module

The block diagram of the transmitter is given in fig 11 The main parts in

the transmitter are

1 Power Supply

The power supply section is the section which provide +5V for the

transmitter section to work IC LM7805 is used for providing a constant

power of +5V

2 Encoder

This section contains the identity of the transmitter An encoder can be a

device used to change a signal (such as a bit stream) or data into a code

The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding

redundancies to the input code etc

2

3 RF Transmitter

This section transmits the binary data to space in a particular range based

on the antenna used This signal is received by the receiver and it

compares the binary code to find the corresponding station name from

the database

112 Receiver

Fig 12 Block Diagram of Receiver Module

1 Power Supply

The power supply section is the section which provide +5V for the

transmitter section to work IC LM7805 is used for providing a constant

power of +5V

3

2 Decoder

A decoder is a device which does the reverse of the encoder undoing the

encoding so that the original information can be retrieved

3 Microcontroller

Unlike microprocessors microcontrollers are generally optimized for

specific applications As a result the peripherals can be simplified and

reduced which cuts down the production cost

4 RF Receiver

The RF signal transmitted by the transmitter is detected and received by

this section of the receiver This binary encoder data is sent to the

decoder for decoding the original data

5 LCD

This is the output unit in the receiver section The station name is

displayed on this display unit when the receiver comes in the range of the

transmitter

6 Voice Alert

This is another output unit in the receiver This gives the voice alert of the

station reached based on the RF transmitter signal received

4

CHAPTER 2

PROJECT DESCRIPTION

21 INTRODUCTION

RF based station name intimation is based traditionally on RF signal RF

signal at the frequency range 434 MHz is employed for communication between

transmitter unit and receiver unit in our project

Each station is identified by a unique binary code for example 001 for

Chennai and 100 for Nagerkoil This binary code is transmitted by transmitter

module continuously at a frequency range of 434 MHz within a distance of 400

foot outdoor and 200 foot indoor This distance can be enhanced by using

additional RF antenna

When the receiver comes within the range of transmitter it receives the data

from the transmitter in the form of RF signal which is further decoded to collect

the binary code and display the station name along with the voice play back

22 TRANSMITTER MODULE

Transmitter section is the smallest section having few components which

include

1 RF transmitter TWS-434 A

2 Encoded HT-12 E

3 Voltage Regulator LM7805

LM7805 assures a constant supply of +5 V for the transmitter module This

voltage of +5 V is used to drive transmitter and encoder

5

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 2: p 0011 RF Based Station Name Display

11 BLOCK DIAGRAM

The block diagram consists of the transmitter and receiver section They can

be represented as the following block diagrams

111 Transmitter

Fig 11 Block Diagram of Transmitter Module

The block diagram of the transmitter is given in fig 11 The main parts in

the transmitter are

1 Power Supply

The power supply section is the section which provide +5V for the

transmitter section to work IC LM7805 is used for providing a constant

power of +5V

2 Encoder

This section contains the identity of the transmitter An encoder can be a

device used to change a signal (such as a bit stream) or data into a code

The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding

redundancies to the input code etc

2

3 RF Transmitter

This section transmits the binary data to space in a particular range based

on the antenna used This signal is received by the receiver and it

compares the binary code to find the corresponding station name from

the database

112 Receiver

Fig 12 Block Diagram of Receiver Module

1 Power Supply

The power supply section is the section which provide +5V for the

transmitter section to work IC LM7805 is used for providing a constant

power of +5V

3

2 Decoder

A decoder is a device which does the reverse of the encoder undoing the

encoding so that the original information can be retrieved

3 Microcontroller

Unlike microprocessors microcontrollers are generally optimized for

specific applications As a result the peripherals can be simplified and

reduced which cuts down the production cost

4 RF Receiver

The RF signal transmitted by the transmitter is detected and received by

this section of the receiver This binary encoder data is sent to the

decoder for decoding the original data

5 LCD

This is the output unit in the receiver section The station name is

displayed on this display unit when the receiver comes in the range of the

transmitter

6 Voice Alert

This is another output unit in the receiver This gives the voice alert of the

station reached based on the RF transmitter signal received

4

CHAPTER 2

PROJECT DESCRIPTION

21 INTRODUCTION

RF based station name intimation is based traditionally on RF signal RF

signal at the frequency range 434 MHz is employed for communication between

transmitter unit and receiver unit in our project

Each station is identified by a unique binary code for example 001 for

Chennai and 100 for Nagerkoil This binary code is transmitted by transmitter

module continuously at a frequency range of 434 MHz within a distance of 400

foot outdoor and 200 foot indoor This distance can be enhanced by using

additional RF antenna

When the receiver comes within the range of transmitter it receives the data

from the transmitter in the form of RF signal which is further decoded to collect

the binary code and display the station name along with the voice play back

22 TRANSMITTER MODULE

Transmitter section is the smallest section having few components which

include

1 RF transmitter TWS-434 A

2 Encoded HT-12 E

3 Voltage Regulator LM7805

LM7805 assures a constant supply of +5 V for the transmitter module This

voltage of +5 V is used to drive transmitter and encoder

5

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 3: p 0011 RF Based Station Name Display

3 RF Transmitter

This section transmits the binary data to space in a particular range based

on the antenna used This signal is received by the receiver and it

compares the binary code to find the corresponding station name from

the database

112 Receiver

Fig 12 Block Diagram of Receiver Module

1 Power Supply

The power supply section is the section which provide +5V for the

transmitter section to work IC LM7805 is used for providing a constant

power of +5V

3

2 Decoder

A decoder is a device which does the reverse of the encoder undoing the

encoding so that the original information can be retrieved

3 Microcontroller

Unlike microprocessors microcontrollers are generally optimized for

specific applications As a result the peripherals can be simplified and

reduced which cuts down the production cost

4 RF Receiver

The RF signal transmitted by the transmitter is detected and received by

this section of the receiver This binary encoder data is sent to the

decoder for decoding the original data

5 LCD

This is the output unit in the receiver section The station name is

displayed on this display unit when the receiver comes in the range of the

transmitter

6 Voice Alert

This is another output unit in the receiver This gives the voice alert of the

station reached based on the RF transmitter signal received

4

CHAPTER 2

PROJECT DESCRIPTION

21 INTRODUCTION

RF based station name intimation is based traditionally on RF signal RF

signal at the frequency range 434 MHz is employed for communication between

transmitter unit and receiver unit in our project

Each station is identified by a unique binary code for example 001 for

Chennai and 100 for Nagerkoil This binary code is transmitted by transmitter

module continuously at a frequency range of 434 MHz within a distance of 400

foot outdoor and 200 foot indoor This distance can be enhanced by using

additional RF antenna

When the receiver comes within the range of transmitter it receives the data

from the transmitter in the form of RF signal which is further decoded to collect

the binary code and display the station name along with the voice play back

22 TRANSMITTER MODULE

Transmitter section is the smallest section having few components which

include

1 RF transmitter TWS-434 A

2 Encoded HT-12 E

3 Voltage Regulator LM7805

LM7805 assures a constant supply of +5 V for the transmitter module This

voltage of +5 V is used to drive transmitter and encoder

5

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 4: p 0011 RF Based Station Name Display

2 Decoder

A decoder is a device which does the reverse of the encoder undoing the

encoding so that the original information can be retrieved

3 Microcontroller

Unlike microprocessors microcontrollers are generally optimized for

specific applications As a result the peripherals can be simplified and

reduced which cuts down the production cost

4 RF Receiver

The RF signal transmitted by the transmitter is detected and received by

this section of the receiver This binary encoder data is sent to the

decoder for decoding the original data

5 LCD

This is the output unit in the receiver section The station name is

displayed on this display unit when the receiver comes in the range of the

transmitter

6 Voice Alert

This is another output unit in the receiver This gives the voice alert of the

station reached based on the RF transmitter signal received

4

CHAPTER 2

PROJECT DESCRIPTION

21 INTRODUCTION

RF based station name intimation is based traditionally on RF signal RF

signal at the frequency range 434 MHz is employed for communication between

transmitter unit and receiver unit in our project

Each station is identified by a unique binary code for example 001 for

Chennai and 100 for Nagerkoil This binary code is transmitted by transmitter

module continuously at a frequency range of 434 MHz within a distance of 400

foot outdoor and 200 foot indoor This distance can be enhanced by using

additional RF antenna

When the receiver comes within the range of transmitter it receives the data

from the transmitter in the form of RF signal which is further decoded to collect

the binary code and display the station name along with the voice play back

22 TRANSMITTER MODULE

Transmitter section is the smallest section having few components which

include

1 RF transmitter TWS-434 A

2 Encoded HT-12 E

3 Voltage Regulator LM7805

LM7805 assures a constant supply of +5 V for the transmitter module This

voltage of +5 V is used to drive transmitter and encoder

5

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 5: p 0011 RF Based Station Name Display

CHAPTER 2

PROJECT DESCRIPTION

21 INTRODUCTION

RF based station name intimation is based traditionally on RF signal RF

signal at the frequency range 434 MHz is employed for communication between

transmitter unit and receiver unit in our project

Each station is identified by a unique binary code for example 001 for

Chennai and 100 for Nagerkoil This binary code is transmitted by transmitter

module continuously at a frequency range of 434 MHz within a distance of 400

foot outdoor and 200 foot indoor This distance can be enhanced by using

additional RF antenna

When the receiver comes within the range of transmitter it receives the data

from the transmitter in the form of RF signal which is further decoded to collect

the binary code and display the station name along with the voice play back

22 TRANSMITTER MODULE

Transmitter section is the smallest section having few components which

include

1 RF transmitter TWS-434 A

2 Encoded HT-12 E

3 Voltage Regulator LM7805

LM7805 assures a constant supply of +5 V for the transmitter module This

voltage of +5 V is used to drive transmitter and encoder

5

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 6: p 0011 RF Based Station Name Display

221 Circuit Description

The third pin of TWS-434 A RF transmitter and 18th pin of Encoder HT-12

E is connected to the output pin of Voltage Regulator LM7805 which drive the

circuit with a constant voltage of 5V

The first pin of TWS-434 A and all the address bus are connected to second pin of

LM7805 which represent ground The first pin of voltage regulator receives a

voltage of 9V from a battery source

The other connection include a connection between the Dout (7th pin) of HT-

12 E and the data pin (2nd pin) of TWS-434 A

222 Working Principle

The binary values unique to each station are assigned by the encoder HT-12

E Each addressdata input can be set to the logic state 0 or 1

Grounding the pin is taken as 0 while 1 can be achieved by giving 5V or

leaving the pins open (No connection) So in order to get a binary value of 0001

only one pin is pulled high ie 13th pin (D11) is pulled high while pins 10 11 and

12 are grounded to represent logical zero

On receipt of transmit enable ie TE-active (14th pin) is pulled low The data

which is here is the binary value is fed as input to the transmitter TWS-434 A from

Dout (17th pin) along with header bits

Received data from HT-12 E encoder is amplitude modulated and

transmitted at a frequency range of 43392 MHz

6

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 7: p 0011 RF Based Station Name Display

Fig 21 Transmitter Module

7

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 8: p 0011 RF Based Station Name Display

23 RECEIVER MODULE

Receiver is the output section of the project Receiver module includes the

following components

1 RF Receiver RWS-434 A

2 Microcontroller 89C51 which is regarded as the brain of the circuit

3 LCD module for display the station name

4 Audio playback IC APR 9600

5 Power supply section which contains transformer rectifier filter regulator

which ensures a constant +5V

Main function of the receiver unit is to detect the RF signal transmitted by

the TWS-434A and give the response according to the received data from the

receiver Varies components of the receiver unit has its own functionRWS-434

receives the RF signal AT 89C51 processes the input data and produces a

corresponding response LCD module considered as the output unit displays the

processed data from the microprocessor APR 9600 gives the output in the form of

audio playback which is stored in the internal memory of the IC

8

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 9: p 0011 RF Based Station Name Display

9

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 10: p 0011 RF Based Station Name Display

231 Circuit Description

A constant voltage of +5V is applied to the 4th and 5th pin of the receiver 2nd

pin of the LCD module 40th pin of Microcontroller 89C51 18th pin of the decoded

IC HT-12D and various pins of APR 9600 as shown in figure below through

voltage regulator LM7805 It derives its input voltage from bridge rectifier The 8

bit data pins D0 - D7 are used to send information from port 2 of the

microcontroller to the LCD RS (register select) is one of the important registers

inside the LCD The RS pin is used for their selection as follows If RS=0 the

instruction code register is selected allowing the user to send a command such as

clear display cursor at home etc if RS=1 the data register is selected allowing the

user to send data to be displayed on the LCDRW input pin of LCD allows the

user to write information to the LCD or read information from it RW=1 when

reading RW=0 when writing E (enable) the enable pin is used by the LCD to

latch information presented on its data pins When data is supplied to data pins a

high to low pulse must be applied to this pin in order for the LCD to latch in the

data present at the data pins These 3 pins (RS RW and E) of LCD are connected

to the 89C51 through port 0 The communication between AT 89C51 and audio IC

APR 9600 is through addressdata bus of port 0 of 89C51 and pin 1 and pin 2

namely M1 and M2 of APR 9600 Microcontroller receives data from decoder HT-

12 D through port 1 which is an 8 bit bidirectional IO port from the output data

pins D8-D11 of HT-12 D

The receiver RWS-434 is connected to decoder such that the received RF

signal is fed as input to the data input pin Din (pin 14) of the decoder from 2nd pin

of the receiver

10

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 11: p 0011 RF Based Station Name Display

232 Working Principle

When the receiver unit comes in the range of transmitter unit which

continuously transmit RF signal the whole receiver unit gets activated The

receiver unit receives the RF signal at a frequency range of 434 MHz which

actually is a digital data which includes the binary code assigned to the particular

transmitter which denotes a station and a carrier signal Digital output is taken

from pin 2 of RWS-434 and received by decoder HT-12 D through data input pin

(18th pin) The received serial input data are compared three times continuously

with the local address If no error or unmatched codes are found the input codes

are decoded and then transferred to the output pins The VT (Valid Transmission)

pin (12th pin) gives high to indicate a valid transmission

The decoded signal is given as data input to AT 89C51 at port 1 On receipt

of the binary code microcontroller which act as a database of station name

compares the received binary code with its stored binary code on no error or

unmatched code the station name corresponding to the binary code is displayed on

the LCD screen along with a voice alert from APR 9600

The whole cycle will be repeated when the receiver receives a new set of

binary code transmitted by some other transmitter denoting a different station The

display will be active only for pre defined duration after which the LCD return to

its ideal state The data to be displayed on the LCD screen is available at port 2 and

control of the register of the LCD is through port 3

11

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 12: p 0011 RF Based Station Name Display

CHAPTER 3

HARDWARE DESCRIPTION

31 RF TRANSMITTER

The function of a radio frequency (RF) transmitter is to modulate up

convert and amplify signals for transmission into free space An RF transmitter

generally includes a modulator that modulates an input signal and a radio

frequency power amplifier that is coupled to the modulator to amplify the

modulated input signal The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal

The RF transmitter used in our project is TWS-434A This RF transmitter

transmits data in the frequency range of 43392 MHz with a range of

approximately 400 foot (open area) outdoors Indoors the range is approximately

200 foot and will go through most walls TWS-434A has features which includes

small in size low power consumption ie 8mW and operate from 15 to 12 Volts-

DC excellent for applications requiring short-range RF signal Data to be send is

Amplitude modulation with the carrier RF signal

Fig 31 RF Transmitter

12

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 13: p 0011 RF Based Station Name Display

311 Pin Description of Transmitter

PIN 1 GROUND (-5V)

PIN2 INPUT PIN FOR DATA FROM ENCODER

PIN3 SUPPLY (+5V)

PIN 4 PIN FOR EXTERNAL RF ANTENNA

32 RF RECEIVER

The RF receiver receives an RF signal converts the RF signal to an IF

signal and then converts the IF signal to a base band signal which it then provides

to the base band processor As is also known RF transceivers typically include

sensitive components susceptible to noise and interference with one another and

with external sources The RF receiver is coupled to the antenna and includes a low

noise amplifier one or more intermediate frequency stages a filtering stage and a

data recovery stage The low noise amplifier receives an inbound RF signal via the

antenna and amplifies it

The RF receiver used is RWS-434 This RF receiver receives RF signal

which is in the frequency of 43492 MHz and has a sensitivity of 3uV The RWS-

434 receiver operates from 45 to 55 volts-DC and has both linear and digital

outputs and its tunable to match the frequency of the transmitter unit

13

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 14: p 0011 RF Based Station Name Display

Fig 32 RF Receiver

321 Pin Description of Receiver

PIN1 GROUND (-5V)

PIN2 OUTPUT PIN FOR DIGITAL DATA RECIEVED

PIN 3 OUTPUT PIN FOR ANALOG DATA RECIEVED

PIN4 SUPPLY (+5V)

PIN5 SUPPLY (+5V)

PIN6 GROUND (-5V)

PIN7 GROUND (-5V)

PIN 8 PIN FOR EXTERNAL RF ANTENNA

14

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 15: p 0011 RF Based Station Name Display

33 ENCODER

An encoder can be a device used to change a signal (such as a bit stream) or

data into a code The code serves any of a number of purposes such as compressing

information for transmission or storage encrypting or adding redundancies to the

input code or translating from one code to another This is usually done by means

of a programmed algorithm especially if any part is digital while most analog

encoding is done with analog circuitry Encoder used here is HT 12E The HT12E

encoder is a CMOS IC It is capable of encoding 8 bits of address (A0-A7) and 4-

bits of data (AD8-AD11) information Each addressdata input can be set to one of

the two logic states 0 or 1 Grounding the pins is taken as a 0 while a high can be

given by giving +5V or leaving the pins open (no connection) Upon reception of

transmit enable (TE-active low) the programmed addressdata are transmitted

together with the header bits via an RF medium

Fig 33 Encoder

15

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 16: p 0011 RF Based Station Name Display

331 Pin Description of Encoder

Table 31 Pin Description of Encoder

Pin

Name

IO

Internal

Connection Description

A0~A7 I

CMOS IN

Pull-high

(HT12A)NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for address A0~A7 setting

These pins can be externally set to VSS or

left open

AD8~A

D11

I

NMOS

TRANSMISSI

ON GATE

PROTECTION

DIODE

(HT12E)

Input pins for addressdata AD8~AD11

setting

These pins can be externally set to VSS or

left open

D8~D11 I

CMOS IN

Pull-High

Input pins for data D8~D11 setting and

transmission en- able active low

These pins should be externally set to VSS

or left open

(see Note)DOUT O CMOS OUT Encoder data serial transmission output

16

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 17: p 0011 RF Based Station Name Display

LMB I CMOS IN

Pull-high

LatchMomentary transmission format

selection pin Latch Floating or VDD

Momentary VSS

TE I

CMOS IN

Pull-high Transmission enable active low (see Note)

OSC1 I OSCILLATOR

1

Oscillator input pin

OSC2 O OSCILLATOR

1

Oscillator output pin

X1 I OSCILLATOR

2

455kHz resonator oscillator input

X2 O OSCILLATOR

2

455kHz resonator oscillator output

VSS I Negative power supply grounds

VDD I Positive power supply

34 DECODER

A decoder is a device which does the reverse of an encoder undoing the

encoding so that the original information can be retrieved The same method used

to encode is usually just reversed in order to decode In digital electronics this

would mean that a decoder is a multiple-input multiple-output logic circuit that

converts coded inputs into coded outputs Enable inputs must be on for the decoder

to function otherwise its outputs assume a single disabled output code word

17

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 18: p 0011 RF Based Station Name Display

Decoding is necessary in applications such as data multiplexing 7 segment display

and memory address decoding The decoder used here is HT 12D The HT12D is a

decoder IC made especially to pair with the HT 12E encoder It is a CMOS IC The

decoder is capable of decoding 8 bits of address (A0 - A7) and 4 bits of data (AD8

- AD11) information For proper operation a pair of encoderdecoder with the

same number of addresses and data format should be chosen The decoders receive

serial addresses and data from programmed encoders that are transmitted by a

carrier using an RF or an IR transmission medium They compare the serial input

data three times continuously with their local addresses If no error or unmatched

codes are found the input data codes are decoded and then transferred to the output

pins The VT pin also goes high to indicate a valid transmission The decoders are

capable of decoding information that consists of N bits of address and 12_N bits of

data Of this series the HT 12D is arranged to provide 8 address bits and 4 data

bits

18

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 19: p 0011 RF Based Station Name Display

Fig 34 Decoder

341 Pin Description of Decoder

Table 32 Pin Description of Decoder

Pin

Name

IO

Internal

Connection Description

A0~A7

(HT12D)

NMOS

Transmission

Gate

Input pins for address A0~A7 setting

These pins can be externally set to VSS

or left open

19

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 20: p 0011 RF Based Station Name Display

D8~D11

(HT12D)

O CMOS OUT Output data pins power-on state is low

DIN I CMOS IN Serial data input pin

VT O CMOS OUT Valid transmission active high

OSC1 I Oscillator Oscillator input pin

OSC2 O Oscillator Oscillator output pin

VSS Negative power supply ground

VDD Positive power supply

35 LCD MODULE

A liquid crystal display (LCD) is an electronically-modulated optical device

shaped into a thin flat panel made up of any number of color or monochrome

pixels filled with liquid crystals and arrayed in front of a light source (backlight) or

reflector It is often utilized in battery-powered electronic devices because it uses

very small amounts of electric power LCD has material which combines the

properties of both liquids and crystals Rather than having a melting point they

have a temperature range within which the molecules are almost as mobile as they

would be in a liquid but are grouped together in an ordered form similar to a

crystal

20

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 21: p 0011 RF Based Station Name Display

LCD consists of two glass panels with the liquid crystal materials

sandwiched in between them The inner surface of the glass plates is coated with

transparent electrodes which define in between the electrodes and the crystal

which makes the liquid crystal molecules to maintain a defined orientation angle

When a potential is applied across the cell charge carriers flowing through the

liquid will disrupt the molecular alignment and produce turbulence When the

liquid is not activated it is transparent When the liquid is activated the molecular

turbulence causes light to be scattered in all directions and the cell appears to be

bright Thus the required message is displayed

When the LCD is in the off state the two polarizers and the liquid crystal

rotate the light rays such that they come out of the LCD without any orientation

and hence the LCD appears transparent When sufficient voltage is applied to the

electrodes the liquid crystal molecules would be aligned in a specific direction The

light rays passing through the LCD would be rotated by the polarizer which would

result in activatinghighlighting the desired characters The power supply should be

of +5v with maximum allowable transients of 10mv

To achieve a bettersuitable contrast for the display the voltage (VL) at pin 3

should be adjusted properly A module should not be removed from a live circuit

The ground terminal of the power supply must be isolated properly so that voltage

is induced in it The module should be isolated properly so that stray voltages are

not induced which could cause a flicking display LCD is lightweight with only a

few millimeters thickness since the LCD consumes less power they are

compatible with low power electronic circuits and can be powered for long

durations LCD does not generate light and so light is needed to read the display

By using backlighting reading is possible in the dark LCDs have long life and a

wide operating temperature range Before LCD is used for displaying proper

initialization should be done

21

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 22: p 0011 RF Based Station Name Display

LCDs with a small number of segments such as those used in digital

watches and pocket calculators have individual electrical contacts for each

segment An external dedicated circuit supplies an electric charge to control each

segment This display structure is unwieldy for more than a few display elements

Small monochrome displays such as those found in personal organizers or older

laptop screens have a passive-matrix structure employing super-twisted nematic

(STN) or double-layer STN (DSTN) technologymdashthe latter of which addresses a

color-shifting problem with the formermdashand color-STN (CSTN)mdashwherein color is

added by using an internal filter

Each row or column of the display has a single electrical circuit The pixels

are addressed one at a time by row and column addresses This type of display is

called passive-matrix addressed because the pixel must retain its state between

refreshes without the benefit of a steady electrical charge As the number of pixels

(and correspondingly columns and rows) increases this type of display becomes

less feasible Very slow response times and poor contrast are typical of passive

matrix addressed LCDs

High-resolution color displays such as modern LCD computer monitors and

televisions use an active matrix structure A matrix of thin-film transistors (TFTs)

is added to the polarizing and color filters Each pixel has its own dedicated

transistor allowing each column line to access one pixel When a row line is

activated all of the column lines are connected to a row of pixels and the correct

voltage is driven onto all of the column lines The row line is then deactivated and

the next row line is activated All of the row lines are activated in sequence during

a refresh operation Active-matrix addressed displays look brighter and sharper

than passive-matrix addressed displays of the same size and generally have

quicker response times producing much better images

22

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 23: p 0011 RF Based Station Name Display

A general purpose alphanumeric LCD with two lines of 16 characters So

the type of LCD used in this project is16 characters 2 lines with 57 dots with

cursor built in controller +5v power supply 116 duty cycle

351 LCD Layout

Fig 35 LCD Layout

352 Pin Description of LCD Module

Table 33 Pin Description of LCD Module

23

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 24: p 0011 RF Based Station Name Display

36 VOICE MODULE

APR9600 device to reproduce voice signals in their natural form It

eliminates the need for encoding and compression which often introduce

distortion The APR9600 device offers true single-chip voice recording non-

volatile storage and playback capability for 40 to 60 seconds The device supports

both random and sequential access of multiple messages Sample rates are user-

selectable allowing designers to customize their design for unique quality and

storage time needs Integrated output amplifier microphone amplifier and AGC

circuits greatly simplify system design The device is ideal for use in portable voice

recorders toys and many other consumer and industrial applications APLUS

integrated achieves these high levels of storage capability by using its proprietary

analogmultilevel storage technology implemented in an advanced Flash non-

volatile memory process where each memory cell can store 256 voltage levels

This technology enables the APR9600 device to reproduce voice signals in their

natural form It eliminates the need for encoding and compression which often

introduce distortion

24

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 25: p 0011 RF Based Station Name Display

361 Pin Diagram of APR 9600

Fig 36 Pin Diagram of APR 9600

362 Pin Description of APR 9600

Table 34 Pin Description of APR 9600

Pin Name Functions Pin Mane Functions1 -M1 Select 1st section of sound

or serial

15 SP- Speaker negative end

2 -M2 Select 2nd section or fast

forward control in serial

mode (low active)

16 VCCA Analogue circuit power

supply

25

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 26: p 0011 RF Based Station Name Display

3 -M3 Select 3 rd section of sound 17 MICIN Microphone input

(electret type

microphone)4 -M4 Select 4th section of sound 18 MICREF Microphone reference

input

5 -M5 Select 5th section of sound 19 AGC AGC control

6 -M6 Select 6th section of sound 20 ANA-IN Audio input (accept a

signal of

100 mV p-to-p)

7 OSCR Resistor to set clock

frequency See

Table 3 for details

21 ANA-OUT Audio output from the

microphone amplifier

8 -M7 Select 7th section of

sound or IC

overflow indication

22 STROBE During recording and

replaying it produces a

strobe signal

9 -M8 Select 8th section of sound

or select mode (see Table 2)

23 CE Reset sound track

counter to zero Stop or

Start Stop

10 -BUSY Busy (low active) 24 MSEL1 Mode selection 1 (see

Table 2)

11 BE =1 beep when a key is

pressed

=0 do not beep

25 MSEL2 Mode selection 2 (see

Table 2)

12 VSSD Digital circuit ground 26 EXTCLK External clock input

26

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 27: p 0011 RF Based Station Name Display

13 VSSA Analogue circuit ground 27 -RE =0 to record =1 to replay

14 SP+ Speaker positive end 28 VCCD Digital circuit power

supply

37 POWER SUPPLY

The ac voltage typically 220V is connected to a transformer which steps

down that ac voltage down to the level of the desired dc output A diode rectifier

then provides a full-wave rectified voltage that is initially filtered by a simple

capacitor filter to produce a dc voltage This resulting dc voltage usually has some

ripple or ac voltage variation

A regulator circuit removes the ripples and also retains the same dc value

even if the input dc voltage varies or the load connected to the output dc voltage

changes This voltage regulation is usually obtained using one of the popular

voltage regulator IC units

Fig 37 Block Diagram of Power Supply

27

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 28: p 0011 RF Based Station Name Display

371 Transformer

Transformers convert AC electricity from one voltage to another with little

loss of power Transformers work only with AC and this is one of the reasons why

mains electricity is AC

Step-up transformers increase voltage step-down transformers reduce

voltage Most power supplies use a step-down transformer to reduce the

dangerously high mains voltage (230V in India) to a safer low voltage

The input coil is called the primary and the output coil is called the

secondary There is no electrical connection between the two coils instead they are

linked by an alternating magnetic field created in the soft-iron core of the

transformer Transformers waste very little power so the power out is (almost)

equal to the power in Note that as voltage is stepped down current is stepped up

The transformer will step down the power supply voltage (0-230V) to (0-

6V) level Then the secondary of the potential transformer will be connected to the

bridge rectifier which is constructed with the help of PN junction diodes The

advantages of using bridge rectifier are it will give peak voltage output as DC

372 Rectifier

There are several ways of connecting diodes to make a rectifier to convert

AC to DC The bridge rectifier is the most important and it produces full-wave

varying DC A full-wave rectifier can also be made from just two diodes if a

centre-tap transformer is used but this method is rarely used now that diodes are

cheaper A single diode can be used as a rectifier but it only uses the positive (+)

parts of the AC wave to produce half-wave varying DC

28

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 29: p 0011 RF Based Station Name Display

3721 Single Diode Rectifier

A single diode can be used as a rectifier but this produces half-wave varying

DC which has gaps when the AC is negative It is hard to smooth this sufficiently

well to supply electronic circuits unless they require a very small current so the

smoothing capacitor does not significantly discharge during the gaps

Fig 38 Single Diode Rectifier

Fig 39 Output waveform of Single Diode Rectifier

3722 Bridge Rectifier

When four diodes are connected as shown in figure the circuit is called as

bridge rectifier The input to the circuit is applied to the diagonally opposite

corners of the network and the output is taken from the remaining two corners Let

29

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 30: p 0011 RF Based Station Name Display

us assume that the transformer is working properly and there is a positive potential

at point A and a negative potential at point B the positive potential at point A will

forward bias D3 and reverse bias D4

The negative potential at point B will forward bias D1 and reverse D2 At

this time D3 and D1 are forward biased and will allow current flow to pass through

them D4 and D2 are reverse biased and will block current flow

One advantage of a bridge rectifier over a conventional full-wave rectifier is

that with a given transformer the bridge rectifier produces a voltage output that is

nearly twice that of the conventional full-wave circuit

Assume that the same transformer is used in both circuits The peak voltage

developed between points X and y is 1000 volts in both circuits In the

conventional full-wave circuit the peak voltage from the center tap to either X or

Y is 500 volts Since only one diode can conduct at any instant the maximum

voltage that can be rectified at any instant is 500 volts

The maximum voltage that appears across the load resistor is nearly-but

never exceeds-500 v0lts as result of the small voltage drop across the diode In the

bridge rectifier shown in view B the maximum voltage that can be rectified is the

full secondary voltage which is 1000 volts Therefore the peak output voltage

across the load resistor is nearly 1000 volts With both circuits using the same

transformer the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit

30

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 31: p 0011 RF Based Station Name Display

Fig 310 Bridge Rectifier

Fig 311 Output waveform of Bridge Rectifier

31

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 32: p 0011 RF Based Station Name Display

373 Smoothing

Smoothing is performed by a large value electrolytic capacitor connected

across the DC supply to act as a reservoir supplying current to the output when the

varying DC voltage from the rectifier is falling The diagram shows the

unsmoothed varying DC (dotted line) and the smoothed DC (solid line) The

capacitor charges quickly near the peak of the varying DC and then discharges as

it supplies current to the output

Note that smoothing significantly increases the average DC voltage to

almost the peak value (14 times RMS value) For example 6V RMS AC is rectified to

full wave DC of about 46V RMS (14V is lost in the bridge rectifier) with

smoothing this increases to almost the peak value giving 14 times 46 = 64V smooth

DC

32

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 33: p 0011 RF Based Station Name Display

Fig 312 Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it

discharges giving a small ripple voltage For many circuits a ripple which is 10

of the supply voltage is satisfactory A larger capacitor will give fewer ripples The

capacitor value must be doubled when smoothing half-wave DC

374 Voltage Regulators

Voltage regulators comprise a class of widely used ICs Regulator IC units

contain the circuitry for reference source comparator amplifier control device and

overload protection all in a single IC IC units provide regulation of either a fixed

positive voltage a fixed negative voltage or an adjustably set voltage The

regulators can be selected for operation with load currents from hundreds of milli

amperes to tens of amperes corresponding to power ratings from milli watts to

tens of watts

A fixed three-terminal voltage regulator has an unregulated dc input voltage

Vi applied to one input terminal a regulated dc output voltage Vo from a second

terminal with the third terminal connected to ground

33

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 34: p 0011 RF Based Station Name Display

The series 78 regulators provide fixed positive regulated voltages from 5 to

24 volts Similarly the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts

3741 IC Voltage Regulators

Voltage regulator ICs are available with fixed (typically 5 12 and 15V) or

variable output voltages They are also rated by the maximum current they can

pass Negative voltage regulators are available mainly for use in dual supplies

Most regulators include some automatic protection from excessive current

(overload protection) and overheating (thermal protection)

Many of the fixed voltage regulator ICs has 3 leads and look like power transistors

such as the 7805 +5V 1Amp regulator They include a hole for attaching a heat

sink if necessary

Fig 313 IC Voltage Regulator

34

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 35: p 0011 RF Based Station Name Display

3742 Zener Diode Regulator

For low current power supplies a simple voltage regulator can be made with

a resistor and a zener diode connected in reverse as shown in the diagram Zener

diodes are rated by their breakdown voltage and maximum power (typically

400mW or 13W)

The resistor limits the current (like an LED resistor) The current through the

resistor is constant so when there are no output current all the current flows

through the zener diode and its power rating must be large enough to withstand

this

Fig 314 Zener Diode Regulator

35

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 36: p 0011 RF Based Station Name Display

Fig 315 Circuit diagram of Power Supply

CHAPTER 4

MICROCONTROLLER

Basically a microcontroller is a device which integrates a number of the

components of a microprocessor system onto a single microchip So a

microcontroller combines onto the same microchip The following components

CPU Core

Memory (Both RAM and ROM)

Some Parallel Digital IOs

36

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 37: p 0011 RF Based Station Name Display

The microprocessor is the integration of a number of useful functions into a

single IC package Has the ability to execute a stored set of instructions to carry

out user defined tasks also has ability to access external memory chips to both

read and write data from and to the memory

Essentially a microcontroller is obtained by integrating the key components

of microprocessor RAM ROM and Digital IO onto the same chip die Modern

microcontrollers also contain a wealth of other modules such as Serial IO Timers

and Analogue to Digital Converters There are a large number of specialized

devices with additional modules for specific needs Eg CAN controllers

41 ATMEL 89C51

In our project we are using microprocessor from Atmel namely AT89C51 is

a low-power high-performance CMOS 8-bit Microcomputer with 4K bytes of

Flash programmable and erasable read only memory (PEROM) The device is

manufactured using Atmelrsquos high-density nonvolatile memory technology and is

compatible with the industry-standard MCS-51 instruction set and pin out The on-

chip Flash allows the program memory to be reprogrammed in-system or by a

conventional nonvolatile memory programmer By combining a versatile 8-bit

CPU with Flash on a monolithic chip the Atmel AT89C51 is a powerful

microcomputer which provides a highly-flexible and cost-effective solution to

many embedded control applications

411 Block Diagram of ATMEL 89C51

37

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 38: p 0011 RF Based Station Name Display

Fig 41 Block Diagram of ATMEL 89C51

412 Pin Configuration of AT89C51

38

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 39: p 0011 RF Based Station Name Display

Fig 42 Pin Configuration of AT89C51

413 Pin Description of AT89C51

VCC - Supply voltage

GND - Ground

PORT 0

39

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 40: p 0011 RF Based Station Name Display

Port 0 is an 8-bit open-drain bi-directional IO port As an output port each

pin can sink eight TTL inputs When 1s are written to port 0 pins the pins can be

used as high impedance inputs Port 0 may also be configured to be the

multiplexed low order addressdata bus during accesses to external program and

data memory In this mode P0 has internal pull-ups Port 0 also receives the code

bytes during Flash programming and outputs the code bytes during program

verification External pull-ups are required during program verification

PORT 1

Port 1 is an 8-bit bi-directional IO port with internal pull-ups The Port 1

output buffers can sinksource four TTL inputs When 1s are written to Port 1 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 1 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 1 also receives the low-order address bytes during Flash

programming and verification

PORT 2

Port 2 is an 8-bit bi-directional IO port with internal pull-ups The Port 2

output buffers can sinksource four TTL inputs When 1s are written to Port 2 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 2 pins that are externally being pulled low will source current (IIL) because of

the internal pull-ups Port 2 emits the high-order address byte during fetches from

external program memory and during accesses to external data memory that uses

16-bit addresses (MOVX DPTR) In this application it uses strong internal pull-

ups when emitting 1s During accesses to external data memory that uses 8-bit

addresses (MOVX RI) Port 2 emits the contents of the P2 Special Function

40

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 41: p 0011 RF Based Station Name Display

Register Port 2 also receives the high-order address bits and some control signals

during Flash programming and verification

PORT 3

Port 3 is an 8-bit bi-directional IO port with internal pull-ups The Port 3

output buffers can sinksource four TTL inputs When 1s are written to Port 3 pins

they are pulled high by the internal pull-ups and can be used as inputs As inputs

Port 3 pins that are externally being pulled low will source current (IIL) because of

the pull-ups Port 3 also serves the functions of various special features of the

AT89C51 as listed below Port 3 also receives some control signals for Flash

programming and verification

Table 41 Port 3 Pins

RST

Reset input A high on this pin for two machine cycles while the oscillator is

running resets the device

41

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 42: p 0011 RF Based Station Name Display

ALEPROG

Address Latch Enable output pulse for latching the low byte of the address

during accesses to external memory This pin is also the program pulse input

(PROG) during Flash programming In normal operation ALE is emitted at a

constant rate of 16 the oscillator frequency and may be used for external timing or

clocking purposes Note however that one ALE pulse is skipped during each

access to external Data Memory If desired ALE operation can be disabled by

setting bit 0 of SFR location 8EH With the bit set ALE is active only during a

MOVX or MOVC instruction Otherwise the pin is weakly pulled high Setting the

ALE-disable bit has no effect if the microcontroller is in external execution mode

PSEN

Program Store Enable is the read strobe to external program memory When

the AT89C51 is executing code from external program memory PSEN is activated

twice each machine cycle except that two PSEN activations are skipped during

each access to external data memory

EAVPP

External Access Enable EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up

to FFFFH Note however that if lock bit 1 is programmed EA will be internally

latched on reset EA should be strapped to VCC for internal program executions

This pin also receives the 12-volt programming enable voltage (VPP) during Flash

programming for parts that require 12-volt VPP

42

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 43: p 0011 RF Based Station Name Display

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock

operating circuit

XTAL2

Output from the inverting oscillator amplifier

42 OSCILLATOR CHARACTERISTICS

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

amplifier which can be configured for use as an on-chip oscillator as shown in

Figure 1 Either quartz crystal or ceramic resonator may be used To drive the

device from an external clock source XTAL2 should be left unconnected while

XTAL1 is driven as shown in Figure 2 There are no requirements on the duty

cycle of the external clock signal since the input to the internal clocking circuitry

is through a divide-by-two flip-flop but minimum and maximum voltage high and

low time specifications must be observed

43

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 44: p 0011 RF Based Station Name Display

421 Oscillator Connections

Fig 43 Oscillator Connections

43 SPECIAL FUNCTION REGISTERS

A map of the on-chip memory area called the Special Function Register

(SFR) Note that not all of the addresses are occupied and unoccupied addresses

may not be implemented on the chip Read accesses to these addresses will in

general return random data and write accesses will have an indeterminate effect

User software should not write 1s to these unlisted locations since they may be

used in future products to invoke new features In that case the reset or inactive

values of the new bits will always be 0

431 SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring

microcontrollerrsquos operating Each of these registers even each bit they include has

its name address in the scope of RAM and clearly defined purpose ( for example

44

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 45: p 0011 RF Based Station Name Display

timer control interrupt serial connection etc) Even though there are 128 free

memory locations intended for their storage the basic core shared by all types of

8051 controllers has only 21 such registers Rests of locations are intentionally left

free in order to enable the producers to further improved models keeping at the

same time compatibility with the previous versions It also enables the use of

programs written a long time ago for the microcontrollers which are out of

production now

432 Timer 2 Registers

Control and status bits are contained in registers T2CON and T2MOD for Timer 2

The register pair (RCAP2H RCAP2L) is the CaptureReload registers for Timer 2

in 16-bit capture mode or 16-bit auto-reload mode

433 Interrupt Registers

The individual interrupt enable bits are in the IE register Two priorities can

be set for each of the six interrupt sources in the IP register

44 DATA MEMORY

The Internal Data memory is divided into three blocks namely

The lower 128 Bytes of Internal RAM

The Upper 128 Bytes of Internal RAM

Special Function Register

Internal Data memory Addresses are always 1 byte wide which implies an

address space of only 256 bytes However the addressing modes for internal RAM

can accommodate 384 bytes Direct addresses higher than 7Fh access one memory

space and indirect addresses higher than 7Fh access a different memory space

45

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 46: p 0011 RF Based Station Name Display

The lowest 32 bytes are grouped into 4 banks of 8 registers Program

instructions call out these registers as R0 through R7 Two bits in the

program status Word (PSW) select which register bank is in use This architecture

allows more efficient use of code space since register instructions are shorter than

instructions that use direct addressing

The next 16-bytes above the register banks form a block of bit addressable

memory space The micro controller instruction set includes a wide selection of

single - bit instructions and this instruction can directly address the 128 bytes in

this area These bit addresses are 00h through 7Fh

The Special Function Register includes Port latches timers peripheral controls

etc direct addressing can only access these register In general all

Atmel micro controllers have the same SFRs at the same addresses However

upgrades to the AT89C51 have additional SFRs Sixteen addresses in SFR space

are both byte and bit Addressable The bit Addressable SFRs are those whose

address ends in 000B The bit addresses in this area are 80h through FFh

45 TIMERS

451 Timer 0 And 1

Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and

Timer 1 in the AT89C51

452 Timer 2

Timer 2 is a 16-bit TimerCounter that can operate as either a timer or an

event counter The type of operation is selected by bit CT2 in the SFR T2CON

(shown in Table 2) Timer 2 has three operating modes capture auto-reload (up or

46

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 47: p 0011 RF Based Station Name Display

down counting) and baud rate generator The modes are selected by bits in

T2CON as shown in Table 3 Timer 2 consists of two 8-bit registers TH2 and

TL2 In the Timer function the TL2 register is incremented every machine cycle

Since a machine cycle consists of 12 oscillator periods the count rate is 112 of the

oscillator frequency In the Counter function the register is incremented in

response to a 1-to-0 transition at its corresponding external input pin T2 In this

function the external input is sampled during S5P2 of every machine cycle When

the samples show a high in one cycle and a low in the next cycle the count is

incremented The new count value appears in the register during S3P1 of the cycle

following the one in which the transition was detected Since two machine cycles

(24 oscillator periods) are required to recognize a 1-to-0 transition the maximum

count rate is 124 of the oscillator frequency To ensure that a given level is

sampled at least once before it changes the level should be held for at least one full

machine cycle

47

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 48: p 0011 RF Based Station Name Display

CHAPTER 5

SOFTWARE DESCRIPITION

51 EMBEDDED LANGUAGE

Embedded software is in almost every electronic device designed today

There is software hidden away inside our watches microwave Music system

cellular phones etc military uses embedded software to guide smart missiles and

detect enemy aircraft communication satellites space probes and modern

medicine could be nearly impossible without it Embedded softwares are

developed using a different version of c called embedded c which is a different

version of c to suit the programming of microcontroller

52 INTRODUCTION TO KEIL COMPILER

When the Keil microVision is used the project development cycle is roughly the

same as it is for any other software development project

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

53 micro VISION IDE

The microvision IDE combines project managements a rich featured editor with

interactive error correction option setup make facility and online help Use

microvision to create source files and organize them into a project that defines your

target applicationmicro vision automatically compiles assembles and links your

48

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 49: p 0011 RF Based Station Name Display

embedded application and provides a single focal point for your development

efforts

54 C51 COMPILER AND A51 MACRO ASSEMBLER

Source file created by micro vision IDE and passed to the C51 compiler macro

assembler The compiler and assembler process source files and create relocatable

object files The keil C51 compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language

55 LIB51 LIBRARY MANAGER

The LIB 51 lib manager allows you to create object library from the object

file created by the compiler and assembler Libraries are specially ordered

collection of object modules that may be used by the linker at a later time When

the linker processes a library only those object modules in the library that are

necessary to create the program are used

56 BL 51 LINKERLOCATOR

The BL 51 linkerlocator creates an absolute ELFDWARF files using the

object module extracted from libraries and those created by the compilers and

assembler An absolute object file or module contains no relocatable code and data

reside at a fixed memory location The absolute ELFDWARF file used

To program ad flash ROM or other memory devices with microVision debugger

for simulation and target debugging

With an in-circuit emulator for the program testing

49

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 50: p 0011 RF Based Station Name Display

57 microVISION DEBUGGER

microVision symbolic source level debugger is ideally suited for fast reliable

program debugging The debugger includes a high-speed simulator that can

simulate an entire 8051 system including on-chip peripherals and external

hardwares The attributes of the chip used are automatically configured when

device is selected from device database

The microVision debugger provides several ways for testing programs on real

target hardware

Install the Mon51 target monitor on the target system and download

the program using the Monitor51 interface built into the microVision

Debugger

Use the advanced GDI interface to attach use the microVision Debugger

front end with the target system

50

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 51: p 0011 RF Based Station Name Display

CHAPTER 6

CONCLUSION

The design and development of RF based station name intimation inside

train compartment have been successfully designed fabricated and tested With the

implementation of low cost and flexibility in design this kit can reduce our tension

in journey to unknown place This project demonstrates how RF signal along with

embedded system can make our life simpler without causing any ill effect or

affecting other devices There are plenty of such examples showing how embedded

system makes our life simpler and tension free Our project has plenty of rooms for

expansion like the use of GPS system instead of RF signal interfacing with pc for

different forms of output harness of solar energy as the unit consumes very low

power etc Its use is not limited to bus stand or railway station with suitable

modification the system can be used to serve other purposes like providing

assistance to blind in their homes providing security for valuable items etc

51

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 52: p 0011 RF Based Station Name Display

APPENDIX

1 MICROCONTROLLER PROGRAM

11 Main Coding

include ltREGX51Hgt

include ltintrinsHgt

void wrt_lcd(unsigned char)

void lcd_init(void)

void cmd(unsigned int)

bit station1station2

void delay(unsigned int)

sbit v1=P2^2

sbit v2=P2^3

void main()

lcd_init()

P2=0xFF

P2_0=0

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

52

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 53: p 0011 RF Based Station Name Display

wrt_lcd( Name Display )

delay(65000)

delay(65000)

delay(65000)

P2_0=1

while(P2_0ampampP2_1)

while(1)

if((P2_0==0)ampampstation1)

P2_3=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Nagerkoil)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

53

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 54: p 0011 RF Based Station Name Display

cmd(0xC0)

wrt_lcd( Name Display )

station1=1

station2=0

P2_3=1

if((P2_1==0)ampampstation2)

P2_2=0

cmd(0x01)

cmd(0x80)

wrt_lcd(Chennai)

delay(65000)

delay(65000)

delay(65000)delay(65000)delay(65000)

cmd(0x01)

cmd(0x80)

wrt_lcd(RF Base station)

cmd(0xC0)

wrt_lcd( Name Display )

P2_2=1

station1=0

station2=1

54

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 55: p 0011 RF Based Station Name Display

12 LCD Coding

includeltregx51hgt

includeltintrinshgt

sbit busy=P2^7

sbit RS=P3^5

sbit RW=P3^6

sbit EN=P3^7

void delay(unsigned int x)

unsigned int i

for(i=0ilt=xi++)

_nop_()

void check()

55

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 56: p 0011 RF Based Station Name Display

busy=1

RS=0

RW=1

EN=0

delay(3)

EN=1

while(busy==1)

void cmd(unsigned char x)

P1=x

RS=0

RW=0

EN=1

delay(3)

EN=0

delay(100)

void lcd_init()

cmd(0x38)

cmd(0x0e)

56

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 57: p 0011 RF Based Station Name Display

cmd(0x01)

cmd(0x80)

delay(100)

void dat(unsigned char y)

P1=y

RS=1

RW=0

EN=1

delay(3)

EN=0

delay(100)

void wrt_lcd(unsigned char p)

while(p=0)

dat(p)

p++

57

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)
Page 58: p 0011 RF Based Station Name Display

REFERENCES

1 Ajay V Deshmukh (2008) lsquoMicrocontrollers (Theory and Applications)rsquo

Tata McGraw Hill Publishing Limited

2 Muhammad Ali Mazidi and Janice Mazidi F (2000) lsquo051 microcontroller

and embedded systemrsquo Pearson education

3 Ray and Bhuruchandi (2000) lsquoAdvanced Microprocessor and Peripheralsrsquo

Tata McGraw Hill Publishing Company Limited

4 Websites

wwwatmelcom

wwwrentroncom

wwwkeilcomacechip3611htm

wwwwikipediacom

58

  • 3721 Single Diode Rectifier
  • 3742 Zener Diode Regulator
  • 431 SFRs (Special Function Registers)