Faculty Class Alert Using Gsm

105
CHAPTER 1 INTRODUCTION

Transcript of Faculty Class Alert Using Gsm

Page 1: Faculty Class Alert Using Gsm

CHAPTER 1

INTRODUCTION

Page 2: Faculty Class Alert Using Gsm

1.1 OVERVIEW:-

The main aim of this project is to intimate staff about their class. In this system we use

GSM modem to communicate the staff. This is a wireless technology, which shows the

improvement in technology in a right way’s .GSM (global system for mobile communication)

normally the data required is been loaded in microcontroller’s ram and the total schedule of the

college is considered here. This is an emerging technology which is regularly in use, but data

must be loaded. normally staff check’s the time table for every class, by using these system we

can over come these types of problems.

Normally these are placed near HEAD OF THE DEPARTMENT or any person who

assign time table. He can also change the schedule when a sudden change occurs. By this system,

staff - no need to check the time tables every time. Simply they are been intimated through sms

before 10 or 20 minutes as required.

1.2 What is Embedded Systems?

Embedded systems are designed to do some specific task, rather than be a general-

purpose computer for multiple tasks. Some also have real time performance constraints that must

be met, for reason such as safety and usability; others may have low or no performance

requirements, allowing the system hardware to be simplified to reduce costs.

An embedded system is not always a separate block - very often it is physically built-in

to the device it is controlling. The software written for embedded systems is often called

firmware, and is stored in read-only memory or flash convector chips rather than a disk drive. It

often runs with limited computer hardware resources: small or no keyboard, screen, and little

memory.

Wireless communication has become an important feature for commercial products and a

popular research topic within the last ten years. There are now more mobile phone subscriptions

than wired-line subscriptions. Lately, one area of commercial interest has been low-cost, low-

power, and short-distance wireless communication used for \personal wireless networks."

Technology advancements are providing smaller and more cost effective devices for integrating

computational processing, wireless communication, and a host of other functionalities. These

Page 3: Faculty Class Alert Using Gsm

embedded communications devices will be integrated into applications ranging from homeland

security to industry automation and monitoring. They will also enable custom tailored

engineering solutions, creating a revolutionary way of disseminating and processing information.

With new technologies and devices come new business activities, and the need for employees in

these technological areas. Engineers who have knowledge of embedded systems and wireless

communications will be in high demand. Unfortunately, there are few adorable environments

available for development and classroom use, so students often do not learn about these

technologies during hands-on lab exercises. The communication mediums were twisted pair,

optical fiber, infrared, and generally wireless radio.

1.3 Characteristics of Embedded Systems:-

Low cost and Less Power consumption

Programs on an embedded system must run with real-time constraints with limited

hardware resources.

Embedded systems are routinely expected to maintain 100% reliability while running

continuously for long periods, sometimes measured in years

1.4 Applications of Embedded System:-

We are living in the Embedded World. You are surrounded with many embedded

products and your daily life largely depends on the proper functioning of these gadgets.

Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in

your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to

do many of your tasks very effectively. Apart from all these, many controllers embedded in your

car take care of car operations between the bumpers and most of the times you tend to ignore all

these controllers.

In the 8 bit segment, the most popular and used architecture is Intel's 8031. Market

acceptance of this particular family has driven many semiconductor manufacturers to develop

something new based on this particular architecture. Even after 25 years of existence,

semiconductor manufacturers still come out with some kind of device using this 8031 core.

Page 4: Faculty Class Alert Using Gsm

1.4.1Military and aerospace software applications:-

From in-orbit embedded systems to jumbo jets to vital battlefield networks, designers of

mission-critical aerospace and defense systems requiring real-time performance, scalability, and

high-availability facilities consistently turn to the Linux OS® RTOS and the LynxOS-178 RTOS

for software certification to DO-178B.

1.4.2Communications applications:-

"Five-nine" availability, Compact PCI hot swap support, and hard real-time response

Linux OS delivers on these key requirements and more for today's carrier-class systems. Scalable

kernel configurations, distributed computing capabilities, integrated communications stacks, and

fault-management facilities make Linux OS the ideal choice for companies looking for a single

operating system for all embedded telecommunications applications—from complex central

controllers to simple line/trunk cards.

1.4.3 Electronics applications and consumer devices:-

As the number of powerful embedded processors in consumer devices continues to rise,

the BlueCat® Linux® operating system provides a highly reliable and royalty-free option for

systems designers. And as the wireless appliance revolution rolls on, web-enabled navigation

systems, radios, personal communication devices, phones and PDAs all benefit from the cost-

effective dependability, proven stability and full product life-cycle support opportunities

associated with Blue Cat embedded Linux. Blue Cat has teamed up with industry leaders to make

it easier to build Linux mobile phones with Java integration.

1.4.4 Industrial automation and process control software :-

Designers of industrial and process control systems know from experience that Linux

Work’s operating systems provide the security and reliability that their industrial applications

require.

From ISO 9001 certification to fault-tolerance, POSIX conformance, secure partitioning

and high availability, we've got it all. Take advantage of our 20 years of experience.

Page 5: Faculty Class Alert Using Gsm

CHAPTER 2

Page 6: Faculty Class Alert Using Gsm

2.1 OBJECTIVE OF THE PROJECT:-

The objective of this project is to inform the faculty, about their class. These is most

frequently used system in educational system, office& hospitals .these can alert the working

people in any instates .these type of technologies shows the change (improve) of

generation .Faculty class allot using gsm is an embedded based project.

2.2 Block Diagram:-

fi

Fig 2.1.1 block diagram of faculty class alert using gsm

Page 7: Faculty Class Alert Using Gsm

2.3 Block Diagram Description:-

In order to demonstrate how a faculty class alert system works we use different

components like a Microcontroller, Power supply ,LCD display,kepad,GSM Modem and a

Mobile phone

A brief description of components in the system is discussed here and a detailed focus is

given in later sections

2.3.1Microcontroller:

Microcontroller is the major component of the system also called as a computer on chip

which has features of a Microprocessor like CPU, ALU, PC, SP and Registers. It also had added

the other features needed to make complete computer like ROM, RAM, Serial and Parallel I/O,

counters and Clock circuit.

Like the Microprocessor, a Microcontroller is a general-purpose device, but one that is

mean to read data, performs limited calculation on that data, and control its environment based

on those calculations. The prime use of Microcontroller is to control the operation of a machine

using a fixed program that is stored on ROM and that does not change over the life time of the

system.

2.3.2 LCD Display:

A Liquid Crystal Display is used in the system to display welcome messages like

“welcome to electronic society” and faculty class alert system other kind of messages like phone

number ,subject, year etc..

An LCD connector is interfaced with Microcontroller through Port0 and Port3. The

Power supply of 5V is given to LCD connector through a Power supply Module on the system.

Page 8: Faculty Class Alert Using Gsm

2.3.3 Power Supply:

The Power supply circuit are built using Transformer, Rectifiers, Filters and then Voltage

regulators starting with a AC voltage, a steady DC voltage is obtained by rectifying the AC

voltage, then filtering to DC level, and finally regulating to obtain a desired fixed DC voltage.

The Regulation is usually obtain from an IC voltage regulator unit, which takes a DC voltage and

provides a some what lower DC voltage, which remains the same even if the input DC voltage

varies, or output load connected to DC voltage changes.

2.3.4 MAX 232:

The MAX 232 from Maxim was the first IC which in one package contains the necessary

drivers (two) and Receivers (also two), to adapt the RS232 signal voltage levels to TTL logic. It

became popular, because it just needs one voltage (+5V) and generates the necessary RS232

voltage levels (approx -10v and +10v) internally. This greatly simplified the design of circuitry.

Circuitry designers no longer need to design and build a power supply with three voltages (eg.-

12v,+5v and +12v)but could just provide one +5v power supply.

2.3.5 RTC DS1307:

DS1307 is one devices that used widely in microcontroller applications. It provide Serial

Real Time Clock is a low–power, full BCD clock/calendar plus 56 bytes of nonvolatile

SRAM.Address and data are transferred serially via the 2–wire bi–directional bus. The

clock/calendar provides seconds, minutes, hours, day, date, month, and year information.

The end of the month date is automatically adjusted for months with less than 31 days,

including corrections for leap year. The clock operates in either the 24–hour or 12–hour format

with AM/PM indicator. The DS1307 has a built–in power sense circuit which detects power

failures and automatically switches to the battery supply.

Page 9: Faculty Class Alert Using Gsm

2.3.6 GSM Modem:

A GSM Modem is used to get the status of security of home. When anyone breaks

through the door, a message “Gate is opened” is sent to the mobile of the house owner. This is

done by inserting any working SIM card in the GSM Modem and it works like mobile using

some commands and send messages which are sent by the Microcontroller to receiver mobile.

GSM Modem is a wireless modem that works with a GSM wireless network. A wireless

modem behaves like a dial-up modem. The main difference between them is that dial-up

modems sends and receives data through a fixed telephone line via wireless modem sends and

receives data through radio waves.

A GSM Modem can be an external device or PC Card / PCMCIA Card. Typically, an

external GSM Modem is connected to a computer through a serial cable or USB cable. A GSM

Modem is a form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It

should be inserted into one of the PC Card /PCMCIA Card slots of a laptop computer.

Like a GSM mobile phone, a GSM Modem requires a SIM card from a wireless carrier in

order to operate

Page 10: Faculty Class Alert Using Gsm

CHAPTER 3

GSM

Page 11: Faculty Class Alert Using Gsm

3.1 WHAT IS GSM?

GSM stands for Global System for Mobile Communications. It was introduced in 1991.

Normally the radio spectrum can be shared by different users accessing the same frequency band

without causing interference. The techniques used for this are TDMA (Time division multiple

access), FDMA (Frequency division multiple access) and CDMA (Code division multiple

access).

GSM is a form of multiplexing, which divides the available bandwidth among the

different channels. GSM is a combination of Time and Frequency-Division Multiple Access

(TDMA/FDMA). The FDMA part involves the division by frequency of the (maximum) 25 MHz

bandwidth into 124 carrier frequencies spaced 200 kHz apart. Each of these carrier frequencies is

then divided in time, using a TDMA scheme. The fundamental unit of time in this TDMA

scheme is called a burst period and it lasts 15/26 ms (or approx. 0.577 ms). Eight burst periods

are grouped into a TDMA frame (120/26 ms, or approx. 4.615 ms), which forms the basic unit

for the definition of logical channels. One physical channel is one burst period per TDMA frame.

Thus GSM allows eight simultaneous calls on the same radio frequency.

3.2 WHY GSM?

Digital Transmission

Nationwide Coverage

Future-proof

Cheap

Mobile

Voice Channel Transmission

GPRS Transmission

SMS Transmission

Page 12: Faculty Class Alert Using Gsm

3.3 GSM Call Routing:-

3.3.1 Mobile Subscriber Roaming:-

When a mobile subscriber roams into a new location area (new VLR), the VLR

automatically determines that it must update the HLR with the new location information, which

it does using an SS7 Location Update Request Message. The Location Update Message is routed

to the HLR through the SS7 network, based on the global title translation of the IMSI that is

stored within the SCCP Called Party Address portion of the message. The HLR responds with a

message that informs the VLR whether the subscriber should be provided service in the new

location.

3.3.2Mobile Subscriber ISDN Number (MSISDN) Call Routing:-

When a user dials a GSM mobile subscriber's MSISDN, the PSTN routes the call to the

Home MSC based on the dialed telephone number. The MSC must then query the HLR based on

the MSISDN, to attain routing information required to route the call to the subscribers' current

location.

The MSC stores global title translation tables that are used to determine the HLR

associated with the MSISDN. When only one HLR exists, the translation tables are trivial. When

more than one HLR is used however, the translations become extremely challenging; with one

translation record per subscriber (see the example below). Having determined the appropriate

HLR address, the MSC sends a Routing Information Request to it.

When the HLR receives the Routing Information Request, it maps the MSISDN to the

IMSI, and ascertains the subscribers' profile including the current VLR at which the subscriber is

registered. The HLR then queries the VLR for a Mobile Station Roaming Number (MSRN). The

MSRN is essentially an ISDN telephone number at which the mobile subscriber can currently be

reached. The MSRN is a temporary number that is valid only for the duration of a single call.

Page 13: Faculty Class Alert Using Gsm

The HLR generates a response message, which includes the MSRN, and sends it back

across the SS7 network to the MSC. Finally, the MSC attempts to complete the call using the

MSRN provided

GSM (Global System for Mobile communication) is a digital mobile telephone system

that is widely used in many parts of the world. GSM uses a variation of Time Division Multiple

Access (TDMA) and is the most widely used of the three digital wireless telephone technologies

(TDMA, GSM, and CDMA). GSM digitizes and compresses data, then sends it down a channel

with two other streams of user data, each in its own time slot. GSM operates in the 900MHz,

1800MHz, or 1900 MHz frequency bands.

The ranges of appliances that can be controlled through tele remote systems are many in

numbers. Some of them are as follows and this depends upon the usage priority of the appliances

i.e. parking Lights, Music System or other electrical / electronic appliances.

GSM has been the backbone of the phenomenal success in mobile telecoms over the last

decade. Now, at the dawn of the era of true broadband services, GSM continues to evolve to

meet new demands. One of GSM's great strengths is its international roaming capability, giving

consumers a seamless service. This has been a vital driver in growth, with around 300 million. In

the Americas, today's 7 million subscribers are set to grow rapidly, with market potential of 500

million in population, due to the introduction of GSM 800, which allows operators using the 800

MHz band to have access to GSM technology too.

GSM together with other technologies is part of an evolution of wireless mobile

telecommunication that includes High-Speed Circuit-Switched Data (HCSD), General Packet

Radio System (GPRS), Enhanced Data GSM Environment (EDGE), and Universal Mobile

Telecommunications Service (UMTS).

GSM security issues such as theft of service, privacy, and legal interception continue to

raise significant interest in the GSM community. The purpose of this portal is to raise awareness

of these issues with GSM security.

Page 14: Faculty Class Alert Using Gsm

The mobile communications has become one of the driving forces of the digital

revolution. Everyday, millions of people are making phone calls by pressing a few buttons. Little

is known about how one person's voice reaches the other person's phone that is thousands of

miles away. Even less is known about the security measures and protection behind the system.

The complexity of the cell phone is increasing as people begin sending text messages and digital

pictures to their friends and family. The cell phone is slowly turning into a handheld computer.

All the features and advancements in cell phone technology require a backbone to support it. The

system has to provide security and the capability for growth to accommodate future

enhancements. General System for Mobile Communications, GSM, is one of the many solutions

out there. GSM has been dubbed the "Wireless Revolution" and it doesn't take much to realize

why GSM provides a secure and confidential method of communication.

Digital containers offer an alternative way of securely delivering content to consumers.

They can offer many advantages, particularly for content delivery over mobile phone networks:

Scalability

Microtransactions/Micropayments compatibility

Content channel neutrality (heterogeneous networks, nicast/multicast/broadcast etc)

Possibility of DRM

Consumer anonymity .Etc.

The GSM standard was designed to be a secure mobile phone system with strong

subscriber authentication and over-the-air transmission encryption. The security model and

algorithms were developed in secrecy and were never published. Eventually some of the

algorithms and specifications have leaked out. The algorithms have been studied since and

critical errors have been found. Thus, after a closer look at the GSM standard, one can see that

the security model is not all that good. An attacker can go through the security model or even

around it, and attack other parts of a GSM network, instead of the actual phone call. Although

the GSM standard was supposed to prevent phone cloning and over-the-air eavesdropping, both

of these are possible with little additional work compared to the analog mobile phone systems

Page 15: Faculty Class Alert Using Gsm

and can be implemented through various attacks. One should not send anything confidential over

a GSM network without additional encryption if the data is supposed to stay confidential.

3.4 AT-Commands:-

This protocol defines a set of AT-commands by which a mobile phone can be used and

controlled as a modem for fax and data transfers. AT (short form of attention) commands are

used from a computer or DTE (Data Terminal Equipment) to control a modem or DCE (Data

Circuit terminating Equipment).

Commands always start with AT (which means Attention) and finish with a <CR>

character. Responses start and end with <CR><LF> (except for the ATVO DCE response

format) and the ATQ1 (result code suppression) commands.

If the command syntax is incorrect, the “ERROR” string is returned.

If command syntax is correct but transmitted with wrong parameters, the +CME ERROR:

<Err> or +CMS ERROR: <SmsErr> Strings is returned with adequate error codes.

If the command line has been executed successfully, and “OK” string is returned.

To display the time and date, we need to give <date and time string>.

3.5 SMS (SHORT MESSAGE SERVICES):-

SMS is a service that allows subscribers to send short messages (up to 160

characters) to other mobile subscribers. Rather than having to set up a call on a traffic channel,

SMS uses spare capacity on the Standalone Dedicated Control Channel (SDCCH).

Short Message Service ((SMS))

• Categorized under GSM as a Teleservice

• Text-based messaging

• Uses GSM signaling channels (SDCCH) .

• 160-character messages

• Uses store-and-forward packet switching protocol

• Three SMS Teleservice types defined:

• TS 21 – Mobile terminated point-to-point messaging

• TS 22 – Mobile originated point-to-point messaging

• TS 23 – Short Message cell broadcast (SMSCB)

Page 16: Faculty Class Alert Using Gsm

CHAPTER 4

MICROCONTROLLER

Page 17: Faculty Class Alert Using Gsm

4.1 INTRODUCTION:-

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O

interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition

interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single

silicon chip. If a system is developed with a microprocessor, the designer has to go for external

memory such as RAM, ROM, EPROM and peripherals.

But controller is provided all these facilities on a single chip. Development of a Micro

controller reduces PCB size and cost of design. One of the major differences between a

Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the

real world application.

Intel has introduced a family of Micro controllers called the MCS-51.The microcontroller

plays the major role in any embedded project. In this my project we use two microcontrollers

they are made by the ATMEL Company. That is AT89S52.

4.2 NECESSITY OF MICROCONTROLLERS:-

Microprocessors brought the concept of programmable devices and made many

applications of intelligent equipment. Most applications, which do not need large amount of data

and program memory, tended to be costly.

The microprocessor system had to satisfy the data and program requirements so,

sufficient RAM and ROM are used to satisfy most applications .The peripheral control

equipment also had to be satisfied. Therefore, almost all-peripheral chips were used in the

design. Because of these additional peripherals cost will be comparatively high.

An example:

8085 chip needs:

Page 18: Faculty Class Alert Using Gsm

An Address latch for separating address from multiplex address and data.32-KB RAM

and 32-KB ROM to be able to satisfy most applications. As also Timer / Counter, Parallel

programmable port, Serial port, and Interrupt controller are needed for its efficient applications.

In comparison a typical Micro controller 8051 chip has all that the 8051 board has

except a reduced memory as follows.

4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to 32-KB.

Bulky:

On comparing a board full of chips (Microprocessors) with one chip with all components

in it (Micro controller).

Debugging:

Lots of Microprocessor circuitry and program to debug. In Micro controller there is no

Microprocessor circuitry to debug.

Slower Development time: As we have observed Microprocessors need a lot of debugging at

board level and at program level, where as, Micro controller do not have the excessive circuitry

and the built-in peripheral chips are easier to program for operation.

So peripheral devices like Timer/Counter, Parallel programmable port, Serial

Communication Port, Interrupt controller and so on, which were most often used were integrated

with the Microprocessor to present the Micro controller .RAM and ROM also were integrated in

the same chip. The ROM size was anything from 256 bytes to 32Kb or more. RAM was

optimized to minimum of 64 bytes to 256 bytes or more.

Page 19: Faculty Class Alert Using Gsm

4.3 Typical Micro controller has all the following features:-

8/16/32 CPU

Instruction set rich in I/O & bit operations.

One or more I/O ports.

One or more timer/counters.

One or more interrupt inputs and an interrupt controller

One or more serial communication ports.

Analog to Digital /Digital to Analog converter

One or more PWM output

Network controlled interface

4.4 ADVANTAGES OF MICRO CONTROLLERS:-

1. If system is developed with a microprocessor, the designer has to go for external memory such

as RAM, ROM or EPROM and peripherals and hence the size of PCB will be large enough to

hold all the required peripherals. But, the micro controller has got all these peripheral facility on

a single chip o development of a similar system with a micro controller reduces PCB size and

cost of the design.

2. One of the major differences between a micro controller and a microprocessor is that a

controller often deals with bits, not bytes as in the real world application, for example switch

contacts can only be open or close, indicators should be lit or dark and motors can be either

turned on or off and so forth.

Page 20: Faculty Class Alert Using Gsm

4.5 Why AT 89C51? : -

The system requirements and control specifications clearly rule out the use of 16, 32 or

64 bit micro controllers or microprocessors. Systems using these may be earlier to implement

due to large number of internal features. They are also faster and more reliable but, the above

application is satisfactorily served by 8-bit micro controller. Using an inexpensive 8-bit

Microcontroller will doom the 32-bit product failure in any competitive market place.

Coming to the question of why to use P89V51RD2 of all the 8-bit Microcontroller

available in the market the main answer would be because it has 64 kB Flash and 1024 bytes of

data RAM. . The Flash program memory supports both parallel programming and in serial In-

System Programming (ISP). The P89V51RD2 is also In-Application Programmable (IAP),

allowing the Flash program memory to be reconfigured even while the application is running.

The generic 8051 architecture supports a Harvard architecture, which contains

two separate buses for both program and data. So, it has two distinctive memory spaces of

64K X 8 size for both programmed and data.

It is based on an 8 bit central processing unit with an 8 bit Accumulator and

another 8 bit B register as main processing blocks. Other portions of the architecture

include few 8 bit and 16 bit registers and 8 bit memory locations.

4.6 FEATURES OF 8051 ARCHITECTURE:-

Optimized 8 bit CPU for control applications and extensive Boolean processing

capabilities.

64K Program Memory address space.

64K Data Memory address space.

Page 21: Faculty Class Alert Using Gsm

128 bytes of on chip Data Memory.

32 Bi-directional and individually addressable I/O lines.

Two 16 bit timer/counters.

Full Duplex UART.

6-source / 5-vector interrupt structure with priority levels.

On chip clock oscillator

.

Now we may be wondering about the non-mentioning of memory space meant for

the program storage, the most important part of any embedded controller. Originally this

8051 architecture was introduced with on-chip, ‘one time programmable’ version of

Program Memory of size 4K X 8.

Intel delivered all these microcontrollers (8051) with user’s program fused inside

the device. The memory portion was mapped at the lower end of the Program Memory

area. But, after getting devices, customers couldn’t change any thing in their program

code, which was already made available inside during device fabrication.

4.7 8051 micro controller architecture:-

The 8051 architecture consists of these specific features:

Eight –bit CPU with registers A (the accumulator) and B

Sixteen-bit program counter (PC) and data pointer (DPTR)

Eight- bit stack pointer (PSW)

Eight-bit stack pointer (Sp)

Internal ROM or EPROM (8751) of 0(8031) to 4K (8051)

Internal RAM of 128 bytes:

1. Four register banks, each containing eight registers

2. Sixteen bytes, which maybe addressed at the bit level

3. Eighty bytes of general- purpose data memory

Page 22: Faculty Class Alert Using Gsm

Thirty –two input/output pins arranged as four 8-bit ports:p0-p3

Two 16-bit timer/counters: T0 and T1

Full duplex serial data receiver/transmitter: SBUF

Control registers: TCON, TMOD, SCON, PCON, IP, and IE

Two external and three internal interrupts sources.

Oscillator and clock circuits.

4.8 PIN DIAGRAM:-

FIG-4.8.1 PIN DIAGRAM OF 89C51 IC

Page 23: Faculty Class Alert Using Gsm

4.9 FUNCTIONAL BLOCK DIAGRAM OF MICROCONTROLLER:-

FIG-4.9.1 Functional block diagram of micro controller

Port Pin Alternate Function:-

P3.0- RxD (serial input port)

P3.1 -TxD (serial output port)

P3.2 -INT0 (external interrupt 0)

P3.3- INT1 (external interrupt 1)

Page 24: Faculty Class Alert Using Gsm

P3.4 -T0 (timer 0 external input)

P3.5 -T1 (timer 1 external input)

P3.6 -WR (external data memory write strobe)

P3.7 -RD (external data memory read strobe)

VCC: -Supply voltage

VSS: -Circuit ground potential

All four ports in the 89C51 are bidirectional. Each consists of a latch (Special

Function Registers P0 through P3), an output driver, and an input buffer. The output

drivers of Ports 0 and 2, and the input buffers of Port 0, are used in accesses to

external memory. In this application, Port 0 outputs the low byte of the external

memory address, time-multiplexed with the byte being written or read. Port 2 outputs

the high byte of the external memory address when the address is 16 bits wide.

Otherwise, the Port 2 pins continue to emit the P2 SFR content.

All the Port 3 pins are multifunctional. They are not only port pins, but also

serve the functions of various special features as listed below:

Port Pin Alternate Function

P3.0 RxD (serial input port)

P3.1 TxD (serial output port)

P3.2 INT0 (external interrupt)

P3.3 INT1 (external interrupt)

P3.4 T0 (Timer/Counter 0 external input)

P3.5 T1 (Timer/Counter 1 external input)

P3.6 WR (external Data Memory write strobe)

Page 25: Faculty Class Alert Using Gsm

P3.7 RD (external Data Memory read strobe)

4.10 The 8051 Oscillator and Clock:-

The heart of the 8051 circuitry that generates the clock pulses by which all the internal all

internal operations are synchronized. Pins XTAL1 And XTAL2 is provided for connecting a

resonant network to form an oscillator. Typically a quartz crystal and capacitors are employed.

The crystal frequency is the basic internal clock frequency of the microcontroller. The

manufacturers make 8051 designs that run at specific minimum and maximum frequencies

typically 1 to 16 MHz.

Fig-4.10.1 Oscillator and timing circuit

Page 26: Faculty Class Alert Using Gsm

4.11 Types of memory:-

The 8051 have three general types of memory. They are on-chip memory, external Code

memory and external Ram. On-Chip memory refers to physically existing memory on the micro

controller itself. External code memory is the code memory that resides off chip. This is often in

the form of an external EPROM. External RAM is the Ram that resides off chip. This often is in

the form of standard static RAM or flash RAM.

4.11.1 Code memory

Code memory is the memory that holds the actual 8051 programs that is to be run. This

memory is limited to 64K. Code memory may be found on-chip or off-chip. It is possible to have

4K of code memory on-chip and 60K off chip memory simultaneously. If only off-chip memory

is available then there can be 64K of off chip ROM. This is controlled by pin provided as EA

4.11.2 Internal RAM

The 8051 have a bank of 128 bytes of internal RAM. The internal RAM is found on-chip.

So it is the fastest Ram available. And also it is most flexible in terms of reading and writing.

Internal Ram is volatile, so when 8051 is reset, this memory is cleared. 128 bytes of internal

memory are subdivided. The first 32 bytes are divided into 4 register banks. Each bank contains

8 registers. Internal RAM also contains 128 bits, which are addressed from 20h to 2Fh. These

bits are bit addressed i.e. each individual bit of a byte can be addressed by the user. They are

numbered 00h to 7Fh. The user may make use of these variables with commands such as SETB

and CLR.

4.12 Special Function registered memory:

Special function registers are the areas of memory that control specific functionality of

the 8051 micro controller.

4.12.1 Accumulator (0E0h)

Page 27: Faculty Class Alert Using Gsm

As its name suggests, it is used to accumulate the results of large no of instructions. It can

hold 8 bit values.

4.12.2 B register (0F0h)

The B register is very similar to accumulator. It may hold 8-bit value. The b register is

only used by MUL AB and DIV AB instructions. In MUL AB the higher byte of the product gets

stored in B register. In div AB the quotient gets stored in B with the remainder in A.

4.12.3 Stack pointer (81h)

The stack pointer holds 8-bit value. This is used to indicate where the next value to be

removed from the stack should be taken from. When a value is to be pushed onto the stack, the

8051 first store the value of SP and then store the value at the resulting memory location. When

a value is to be popped from the stack, the 8051 returns the value from the memory location

indicated by SP and then decrements the value of SP.

4.12.4 Data pointer

The SFRs DPL and DPH work together work together to represent a 16-bit value called

the data pointer. The data pointer is used in operations regarding external RAM and some

instructions code memory. It is a 16-bit SFR and also an addressable SFR.

4.12.5 Program counter

The program counter is a 16 bit register, which contains the 2 byte address, which tells

the 8051 where the next instruction to execute to be found in memory. When the 8051 is

initialized PC starts at 0000h. And is incremented each time an instruction is executes. It is not

addressable SFR.

4.12.6 PCON (power control, 87h)

The power control SFR is used to control the 8051’s power control modes. Certain

operation modes of the 8051 allow the 8051 to go into a type of “sleep mode ” which consume

much lee power.

Page 28: Faculty Class Alert Using Gsm

fig 4.12.6 (a): PCON REGISTER

4.12.7 TCON (timer control, 88h)

The timer control SFR is used to configure and modify the way in which the 8051’s two

timers operate. This SFR controls whether each of the two timers is running or stopped and

contains a flag to indicate that each timer has overflowed. Additionally, some non-timer related

bits are located in TCON SFR. These bits are used to configure the way in which the external

interrupt flags are activated, which are set when an external interrupt occurs.

FIG 4.12.7 (a):TCON REGISTRES

4.12.8 TMOD (Timer Mode, 89h)

The timer mode SFR is used to configure the mode of operation of each of the two

timers. Using this SFR your program may configure each timer to be a 16-bit timer, or 13 bit

timer, 8-bit auto reload timer, or two separate timers. Additionally you may configure the timers

to only count when an external pin is activated or to count “events ” that are indicated on an

external pin.

FIG 4.12.8(a): TMOD

4.12.9 TO (Timer 0 low/high, address 8A/8C h)

Page 29: Faculty Class Alert Using Gsm

These two SFRs taken together represent timer 0. Their exact behavior depends on how

the timer is configured in the TMOD SFR; however, these timers always count up. What is

configurable is how and when they increment in value.

4.12.10 T1 (Timer 1 Low/High, address 8B/ 8D h)

These two SFRs, taken together, represent timer 1. Their exact behavior depends on how

the timer is configured in the TMOD SFR; however, these timers always count up.

4.12.11 P0 (Port 0, address 90h, bit addressable)

This is port 0 latch. Each bit of this SFR corresponds to one of the pins on a micro

controller. Any data to be outputted to port 0 is first written on P0 register. For e.g., bit 0 of port

0 is pin P0.0, bit 7 is pin p0.7. Writing a value of 1 to a bit of this SFR will send a high level on

the corresponding I/O pin whereas a value of 0 will bring it to low level.

4.12.12 P1 (port 1, address 90h, bit addressable)

This is port latch1. Each bit of this SFR corresponds to one of the pins on a micro

controller. Any data to be outputted to port 0 is first written on P0 register. For e.g., bit 0 of port

0 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this SFR will send a high level on

the corresponding I/O pin whereas a value of 0 will bring it to low level

4.12.13 P2 (port 2, address 0A0h, bit addressable) :

This is a port latch2. Each bit of this SFR corresponds to one of the pins on a micro

controller. Any data to be outputted to port 0 is first written on P0 register. For e.g., bit 0 of port

0 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to a bit of this SFR will send a high level on

the corresponding I/O pin whereas a value of 0 will bring it to low level.

4.12.14 P3 (port 3,address B0h, bit addressable) :

This is a port latch3. Each bit of this SFR corresponds to one of the pins on a micro

controller. Any data to be outputted to port 0 is first written on P0 register. For e.g., bit 0 of port

Page 30: Faculty Class Alert Using Gsm

0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this SFR will send a high level on

the corresponding I/O pin whereas a value of 0 will bring it to low level

4.12.15 IE (interrupt enable, 0A8h):

The Interrupt Enable SFR is used to enable and disable specific interrupts. The low 7 bits

of the SFR are used to enable/disable the specific interrupts, where the MSB bit is used to enable

or disable all the interrupts. Thus, if the high bit of IE is 0 all interrupts are disabled regardless of

whether an individual interrupt is enabled by setting a lower bit.

FIG 4.12.15 A: IE Registers

4.12.16 IP (Interrupt Priority, 0B8h)

The interrupt priority SFR is used to specify the relative priority of each interrupt. On

8051, an interrupt maybe either low or high priority. An interrupt may interrupt interrupts. For

e.g., if we configure all interrupts as low priority other than serial interrupt. The serial interrupt

always interrupts the system, even if another interrupt is currently executing. However, if a serial

interrupt is executing no other interrupt will be able to interrupt the serial interrupt routine since

the serial interrupt routine has the highest priority.

FIG:4.12.16(a):IP registers

4.12.17 PSW (Program Status Word, 0D0h)

The program Status Word is used to store a number of important bits that are set and

cleared by 8051 instructions. The PSW SFR contains the carry flag, the auxiliary carry flag, the

parity flag and the overflow flag. Additionally, it also contains the register bank select flags,

which are used to select, which of the “R” register banks currently in use.

Page 31: Faculty Class Alert Using Gsm

Fig 4.12.17 a: psw registers

4.12.18 SBUF (Serial Buffer, 99h)

SBUF is used to hold data in serial communication. It is physically two registers. One is

writing only and is used to hold data to be transmitted out of 8051 via TXD. The other is read

only and holds received data from external sources via RXD. Both mutually exclusive registers

use address 99h.

4.13 I/O ports:

One major feature of a microcontroller is the versatility built into the input/output

(I/O) circuits that connect the 8051 to the outside world. The main constraint that limits

numerous functions is the number of pins available in the 8051 circuit. The DIP had 40 pins and

the success of the design depends on the flexibility incorporated into use of these pins. For this

reason, 24 of the pins may each used for one of the two entirely different functions which

depend, first, on what is physically connected to it and, then, on what software programs are used

to “program” the pins.

PORT 0

Port 0 pins may serve as inputs, outputs, or, when used together, as a bi directional low-

order address and data bus for external memory. To configure a pin as input, 1 must be written

into the corresponding port 0 latch by the program. When used for interfacing with the external

memory, the lower byte of address is first sent via PORT0, latched using Address latch enable

(ALE) pulse and then the bus is turned around to become the data bus for external memory.

PORT 1

Page 32: Faculty Class Alert Using Gsm

Port 1 is exclusively used for input/output operations. PORT 1 pins have no dual

function. When a pin is to be configured as input, 1 is to be written into the corresponding Port 1

latch.

PORT 2

Port 2 maybe used as an input/output port. It may also be used to supply a high –order

address byte in conjunction with Port 0 low-order byte to address external memory. Port 2 pins

are momentarily changed by the address control signals when supplying the high byte a 16-bit

address. Port 2 latches remain stable when external memory is addressed, as they do not have to

be turned around (set to 1) for data input as in the case for Port 0.

PORT 3

Port 3 may be used to input /output port. The input and output functions can be

programmed under the control of the P3 latches or under the control of various special function

registers. Unlike Port 0 and Port 2, which can have external addressing functions and change all

eight-port b se, each pin of port 3 maybe individually programmed to be used as I/O or as one of

the alternate functions. The Port 3 alternate uses are:

Table-4.14.1: Port 3 Alternate Uses

Pin (SFR) Alternate Use

P3.0-RXD (SBUF) Serial data input

P3.1-TXD (SBUF) Serial data output

P3.2-INTO 0 (TCON.1) External interrupt 0

P3.3 - INTO 1 (TCON.3) External interrupt 1

P3.4 - T0 (TMOD) External Timer 0 input

P3.5 – T1 (TMOD) External timer 1 input

P3.6 - WR External memory write pulse

P3.7 - RD External memory read pulse

Page 33: Faculty Class Alert Using Gsm

4.14 INTERRUPTS:

Interrupts are hardware signals that are used to determine conditions that exist in external

and internal circuits. Any interrupt can cause the 8051 to perform a hardware call to an interrupt

–handling subroutine that is located at a predetermined absolute address in the program memory.

Five interrupts are provided in the 8051. Three of these are generated automatically by the

internal operations: Timer flag 0, Timer Flag 1, and the serial port interrupt (RI or TI) Two

interrupts are triggered by external signals provided by the circuitry that is connected to the pins

INTO 0 and INTO1. The interrupts maybe enable or disabled, given priority or otherwise

controlled by altering the bits in the Interrupt Enabled (IE) register, Interrupt Priority (IP)

register, and the Timer Control (TCON) register. . These interrupts are mask able i.e. they can be

disabled. Reset is a non maskable interrupt which has the highest priority. It is generated when a

high is applied to the reset pin. Upon reset, the registers are loaded with the default values.

Each interrupt source causes the program to do store the address in PC onto the stack and

causes a hardware call to one of the dedicated addresses in the program memory. The appropriate

memory locations for each for each interrupt are as follows:

Table-4.15.1: Interrupts

Interrupt Address

RESET 0000

IE0 (External interrupt

0)

0003

TF0 (Timer 0 interrupt) 000B

IE1 (External interrupt

1)

0013

TF1 (Timer 1 interrupt) 001B

SERIAL 0023

Page 34: Faculty Class Alert Using Gsm

CHAPTER 5

RTC DS1307

Page 35: Faculty Class Alert Using Gsm

5.1 INTRODUCTION:-

DS1307 is a Real Time Clock one devices that used widely in micrcontroller

applications. It provide Serial Real Time Clock is a low–power, full BCD clock/calendar plus 56

bytes of nonvolatile SRAM.Address and data are transferred serially via the 2–wire bi–

directional bus.The clock/calendar provides seconds, minutes, hours, day, date, month, and year

information. The end of the month date is automatically adjusted for months with less than 31

days, including corrections for leap year.The clock operates in either the 24–hour or 12–hour

format with AM/PM indicator. The DS1307 has a built–in power sense circuit which detects

power failures and automatically switches to the battery supply.

Page 36: Faculty Class Alert Using Gsm

Figure 5.1(A). DS1307 PIN OUT

It 's importance to have some knownledge about I2C when we want to interface with

DS1307because the DS1307 operates as a I2C slave device on the serial bus. Access is obtained

by(see fig. 3)implementing a START condition and providing a device identification code

followed by a register address. Subsequent registers can be accessed sequentially until a STOP

condition is executed. The START and STOP conditions are generated using the low level

drives, SEND_START and SEND_STOP found in the attached microcontroller code. Also the

subroutines SEND_BYTE and READ_BYTE provide the 2–wire handshaking required for

writing and reading 8–bit words to and from the DS1307.For more informatio about I2C see at

phillips web site.

Figure 5.1 B:. I2C BUS CONFIGURATION

Page 37: Faculty Class Alert Using Gsm

Figure 5.1 C: DATA TRANSFER ON 2–WIRE SERIAL BUS

5.2 2-Wire Timing Interface:-

5.2.1 Start data transfer:-A change in the state of the data line from high to low, while the

clock line is high, defines a START condition.

5.2.2 Stop data transfer:- A change in the state of the data line from low to high, while the

clock line is high, defines the STOP condition.

Data valid:- The state of the data line represents valid data when, after a START condition, the

data line is stable for the duration of the high period of the clock signal. The data on the line

must be changed during the low period of the clock signal. There is one clock pulse per bit of

data. Each data transfer is initiated with a START condition and terminated with a STOP

condition. The number of data bytes transferred between the START and the STOP conditions is

not limited, and is determined by the master device. The information is transferred byte–wise and

each receiver acknowledges with a ninth bit.

5.2.3 Acknowledge:- Each receiving device, when addressed, is obliged to generate an

acknowledge after the reception of each byte. The master device must generate an extra clock

Page 38: Faculty Class Alert Using Gsm

pulse which is associated with this acknowledge bit. A device that acknowledges must pull down

the SDA line during the acknowledge clock pulse in such a way that the SDA line is stable low

during the high period of the acknowledge related clock pulse. Of course, setup and hold times

must be taken into account. A master must signal an end of data to the slave by not generating an

acknowledge bit on the last byte that has been clocked out of the slave. In this case, the slave

must leave the data line high to enable the master to generate the STOP condition.

5.3 Interfacing with PIC:-

There are two method to programming to interface I2C devices with PICMicro: Software

I2C and Hardware I2C interface.But, here is only software I2C which programming with CCS.

The DS1307 signal pin must pulled up with external resistor about 10K to ensure logic level.

The software will reads all data from RTC then send to PC via RS232 interface with baud

rate 9600,8,N,1. In main loop just read and send data every 500 mS to refresh Hyper terminal

program.

Page 39: Faculty Class Alert Using Gsm

Figure5.3 A:.Connecting DS1307 with PIC for this example

In this example I use Hyper terminal software to show all data received from DS1307 and

you can use other terminal programs that you can find.

5.4 Real Time Clock IC: DS1307

Although the PIC16F88 has a built in oscillator for a 32 kHz watch crystal a DS1307 is

easier to use on a bread board. This is because you can control the layout of the circuit more

easily.

The RTC also makes the software easier as it takes care of all calendar functions;

accounting for leap years etc.

Page 40: Faculty Class Alert Using Gsm

The DS1307 (RTC) Real Time Clock IC (an I2C real time clock) is an 8 pin device

using an I2C interface (although the data sheet does not mention I2C to avoid royalty

payments!). It has 8 read/write registers that store the following information:

Address Register function

0 Seconds 0-59

1 Minutes 0-59

2 Hours 0-24,1-12

3 Day 1-7

4 Date 1-31

5 Month 1-12

6 Year 0-99

7 Control

Note: Addresses 0x08 to 0xf3 are user RAM and if you use a backup battery these are then non

volatile ram i.e. they will save their contents after the power is off - so you have an extra 56

bytes of ram to play with!

The last address 0x08 is the CONTROL address and it determines what is generated at

the SQW/OUT pin. You can control the level directly via I2C or set it to 1Hz, 4096Hz, 8192Hz,

or 32768 kHz.

In the same way as the I2C pins you need to add a pull-up to V+ at the SQW/OUT pin to

see any output signal as it is an open drain output!

5.5 Real Time Clock IC: Embedded control bits:-

There are two specific 'gotcha' type controls embedded in the addresses which make

using the chip slightly more complicated.

5.6 Real Time Clock IC DS1307: Clock halt:-

Page 41: Faculty Class Alert Using Gsm

The most important is the Clock Halt Bit (CH) which is bit 7 of address 0. This is the

register that controls 'seconds' and the CH bit has to be preserved otherwise the chip stops the

clock. Writing zero to this bit resets the CH bit so that the clock runs.

You have to reset the CH bit to zero to let the chip operate!

5.7 Real Time Clock IC DS1307: 24/12 Hour control

The second is the 24/12 hour control which is bit 6 of address 2. It is set high for 12 hour

mode and low for 24 hour mode.

The problem with these two bits is that you have to preserve them when accessing the

registers to write data and ignore them when reading out values for display. Its not a big problem

and you can see how it's done when you look at the code.

5.8 Real Time Clock IC : 32 kHz oscillator

Surprisingly making an accurate 32 kHz oscillator is a difficult task (much more than a

high speed oscillator e.g. a MHz crystal oscillator). This is because low speed oscillator drivers

are designed for low power operation. That means high impedance and therefore low current

which makes the driver extremely sensitive to noise (or any nearby signals which can

capacitively couple to the crystal wire).

Using the DS1307 lets you put the crystal in the least noisy part of the board. In addition

it sets the crystal load capacitance which is critical in making the crystal oscillate at exactly 32

kHz - controlling its initial error i.e. for the specified ppm error value the load capacitance must

be exact.

Note: A common way of calibrating a crystal (not in this project) is crystal pulling or changing

the capacitance at one crystal pin relative to the other - so load capacitance is crucial.

The DS1307 loads the crystal with 12.7pF so you need to buy a crystal that is defined to

use this load capacitance. Circuit layout also affects the capacitance at the crystal pins so you

must keep the crystal as close as possible to the chip and the tracks from crystal to chip must be

short.

To ensure the crystal oscillates correctly you must ensure that :

Page 42: Faculty Class Alert Using Gsm

• Crystal uses 12.7pf load capacitance (correct crystal type).

• The crystal is close to the IC.

• The tracks are short.

• The chip supply has lots of decoupling (capacitors from +5V to GND). e.g. A 100n and a

10n

• There are no signal tracks near to the crystal.

• For a pcb: It has a guard ring and a ground plane and away from digital signals.

If you are doing a board layout there is good advice in the PIC 16F88 datasheet (Timer 1

section) on crystal pcb guard rings. Dallas recommends Application note 58 which I have not

read yet.

5.9 Real Time Clock IC : Power failure.

The DS1307 detects a power failure if its input voltage (Vcc) falls below (VBat) and

automatically switches to the Vbat supply input (you should use a lithium 3V battery here as the

backup battery). It also inhibits I2C control signals until Vcc is 1.25 x Vbat so you won't be able

to put bad data into the chip as the power is failing!

5.10 Input keys:-

To save microcontroller pins there are four input keys which are all connected to a single

analogue input pin. This pin also drives one of the seven segment display LEDs so it has to be

switched between input (to read the analogue voltage) and output (to drive the led).

Each key pulls the analogue input to a different voltage level which you can easily read

using the ADC (RA0).

Page 43: Faculty Class Alert Using Gsm

5.11Using the Real time Clock IC project:-

When the system powers up the ram location 0x3f is checked for value 0x20. If this

exists then it means that the backup battery has saved contents of the RAM and all the registers

have therefore been initialized. So the software skips the initialization sequence.

If 0x20 is not found then the Real Time Clock IC is initialized to the following values:

Address Initialization value

0 Seconds 0x59 (bit 7 cleared).

1 Minutes 0x59

2 Hours 0x24 (bit 6 cleared).

3 Day 0x07

4 Date 0x31

5 Month 0x12

6 Year 0x99

These are all Binary Coded Decimal numbers which the Real Time Clock IC works with.

Note that the initialization values have been chosen so you can easily understand what the

display is showing.

5.12 Mode button:-

Pressing mode button cycles the display showing different data after each button press.

The following display sequence is followed:

1. Minutes, Secs.

2. Hours, Minutes.

Page 44: Faculty Class Alert Using Gsm

3. Date, Month.

4. '20', Year.

Edit, Up and Down buttons

To change a value the Edit button must be pressed. When it is the left hand two digits are

flashed on and off and the Up and Down buttons now let you edit the value. Hitting Edit again

flashes the two right hand digits and you can change the value as before. Hitting the Edit button

or the Mode button exits the edit mode.

The clock is only stopped when editing the Minutes/Seconds display and restarted at the

end of the edit sequence or when the Mode button is hit. This lets you set the seconds accurately

but does not disturb the clock in other modes.

Real Time Clock IC hardware

Real Time Clock IC project

FIG5.12 A: REAL TIME CLOCK DS1307

Page 45: Faculty Class Alert Using Gsm

CHAPTER 6

MAX 232

6.1 INTRODUCTION:-

In order to connect microcontroller to a modem or a PC to modem a serial port is used.

Serial is a very common protocol for device communication that is standard on almost every

PC.Most computers include two RS-232 based serial ports .Serial is also a common

communication protocol that is used by many devices for instrumentation numerous GPIB-

Page 46: Faculty Class Alert Using Gsm

compatible devices also come with an RS-232 port. Furthermore, serial communication is used

for data acquisition in conjunction with a remote sampling device.

The concept of serial communication is simple. The serial port sends and receives bytes

of information one bit at a time. Although this is slower than parallel communication, which

allows the transmission of an entire byte at once, it is simpler and can be used over long

distances. For example, the IEEE 488 specifications for parallel communication state that the

cabling between equipment can be no more than 20 meters total, with no more than 2 meters

between any two devices. Serial, however, can extend as much as 1200 meters.

Typically, serial is used to transmit ASCII data. Communication is completed using three

transmission lines:

1. Ground

2. Transmit

3. Receive

Since serial is asynchronous, the port is able to transmit data on one line while receiving

data on another. Other lines are available for handshaking, but are not required. The important

serial characteristics are Baud rate, Data bits, Stop bits, and Parity.

6.2 WHAT IS RS-232?

RS-232(ANSI / EIA-232 Standard) is serial connection found on IBM-compatible PC’s.It

is used for many purposes, such as connecting a mouse, printer, or modem, aswellas industrial

instrumentation. Because of improvements in line drivers and cables, applications often increase

the performance of RS-232 beyond the distance and speed listed in the standard. RS-232 is

Page 47: Faculty Class Alert Using Gsm

limited to point-to-point connections between PC serial ports and devices.RS-232 hardware can

be used for serial communication up to distance of 50 feet.

DB-9pin connector

Fig.6.2 A: Pin Description of RS-232

Pin Functions:

Data: TxD on pin-3, RxD on pin-2

Handshake : RTS on pin-7, CTS on pin-8, DSR on pin-6, CD on pin-1

Page 48: Faculty Class Alert Using Gsm

DTR on pin-4

Common : common pin-5(ground)

Other: RI on pin-9

The method used by RS-232 for communication allows for a simple connection of three

lines:

Tx, Rx, and Ground. The three essential signals for two ways RS-232

Communications are these:

TXD: carries data from DTE to DCE

RXD: carries data from DCE to DTE

SG: signal ground

6.3 MAX 232(Full duplex):-

The circuit below use MAX232 which is the Maxim’s devices. This circuit is very stable

and use for professional design. This device is inexpensive and it can provide 2 channel for

RS232.

Page 49: Faculty Class Alert Using Gsm

The MAX232 line drivers/receivers are designed for RS-232 and V.28 communications

in harsh environments. Each transmitter output and receiver input is protected against? 15kV

electrostatic discharge (ESD) shocks, without latchup.It can operate from a Single +5V Power

Supply.

Fig 6.3 A:. Use MAX232 for RS232 transceiver

Page 50: Faculty Class Alert Using Gsm

CHAPTER 7

LCDDISPLAY

7.1 INTRODUCTION:-

The alphanumeric 16character X 2line LCD requires 8data lines and also 3 control

signals and they are interfaced to 3664.By using 2 ports, port 0&3 data pins are connected to

Page 51: Faculty Class Alert Using Gsm

LCD as data bus. Port0 can be basically used as I/O port i.e. it can be programmed as an input or

as an output port.

That means if it is programmed as output port, suppose if it is required to read data from

LCD immediately it is not possible. Before reading the data it is required to make the port as an

input port. Data reading from LCD gives an erroneous reading & should not be implemented.

Because of this port5 is made as input / output port depending on the situation. The control

signals are connected to port 3 pins. They are EN bar & RS bar, RW bar. At different instance

such as data write / command write / data read etc. Various signals are to be provided as

indicated by the by the LCD manufacturers.

To interface the LCD, to the Micro controller it require an 8 bit and also three control

signals differentiate the data from the control words send to the LCD. The Micro controller has

to send the necessary control words followed by the data to be displayed.

Depending on the operation to be performed the control words are selected and passes to

the LCD. The data to be displayed on the LCD is to be sent in the ASCII format. Thus all the

character to be displayed are converted into ASCII form and then sent to the LCD along with

different control words. The control word differentiated the various operations and are executed.

It is also possible to read the LCD data if required.

The control signals to the LCD are also provided by the Micro controller. This is also

done through pins 3.5,3.6&3.7.Through program necessary control signals are passed to the LCD

by using the bits of the port. The remaining can be used for some other purpose if there is a need.

The software controls the necessary ports and performs the task it is designed for. The soft ware

and associated hardware perform the LCD interface.

LCD DISPLAY

Page 52: Faculty Class Alert Using Gsm

FIG:7.1 A: LCD PINS ASSIGMNMENT

A liquid crystal is a material (normally organic for LCDs) that will flow like a liquid but

whose molecular structure has some properties normally associated with solids. The Liquid

Crystal Display (LCD) is a low power device. The power requirement is typically in the order of

microwatts for the LCD. However, an LCD requires an external or internal light source. It is

limited to a temperature range of about 0C to 60C and lifetime is an area of concern, because

LCDs can chemically degrade.

There are two major types of LCD s which are:

1) Dynamic-scattering LCD s

2) Field-effect LCD s

Field-effect LCD s are normally used in such applications where source of energy is a

prime factor (e.g., watches, portable instrumentation etc.).They absorb considerably less power

than the light-scattering type. However, the cost for field-effect units is typically higher, and

their height is limited to 2 inches. On the other hand, light-scattering units are available up to 8

inches in height. Field-effect LCD is used in the project for displaying the appropriate

information. The turn-on and turn-off time is an important consideration in all displays. The

response time of LCD s is in the range of 100 to 300ms.The lifetime of LCD s is steadily

increasing beyond 10,000+hours limit. Since the color generated by LCD units is dependent on

the source of illumination, there is a wide range of color choice.

LCD:-

Gnd vcc preset rs rw en d0 d1 d2 d3 d4 d5 d6 d7 vcc gnd

Page 53: Faculty Class Alert Using Gsm

To send any of the commands from given table to the led, make pin RS =0.For data, make

RS=1.then send a high to low pulse to the E pin to enable the internal latch of the LCD. As FIG

7.1 A: LCD CONNECTIONS

Table .7.1 B:, Pin assignment for <= 80 character displays

Pin

numberSymbol  Level   I/O Function

1 Vss - - Power supply (GND)

2 Vcc - - Power supply (+5V)

3 Vee - - Contrast adjust

4 RS 0/1 I0 = Instruction input

1 = Data input

5 R/W 0/1 I0 = Write to LCD module

1 = Read from LCD module

6 E 1, 1->0 I Enable signal

7 DB0 0/1 I/O Data bus line 0 (LSB)

8 DB1 0/1 I/O Data bus line 1

9 DB2 0/1 I/O Data bus line 2

10 DB3 0/1 I/O Data bus line 3

11 DB4 0/1 I/O Data bus line 4

Page 54: Faculty Class Alert Using Gsm

Table .7.1 B:, Pin assignment for <= 80 character displays

Pin

numberSymbol  Level   I/O Function

12 DB5 0/1 I/O Data bus line 5

13 DB6 0/1 I/O Data bus line 6

14 DB7 0/1 I/O Data bus line 7 (MSB)

15 E2 1, 1->0 I Enable signal row 2 & 3 (2ndcontroller)

16 n.c.      

CHAPTER 8

Page 55: Faculty Class Alert Using Gsm

POWER SUPPLY

8.1 INTRODUCTION:-

There are many types of power supply. Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other devices. A

power supply can by broken down into a series of blocks, each of which performs a particular

function.

For example a 5V regulated supply can be shown as below

Fig8.1 A:: Block Diagram of a Regulated Power Supply System

Page 56: Faculty Class Alert Using Gsm

Similarly, 12v regulated supply can also be produced by suitable selection of the

individual elements. Each of the blocks is described in detail below and the power supplies made

from these blocks are described below with a circuit diagram and a graph of their output:

8.2 Transformer:-

A transformer steps down high voltage AC mains to low voltage AC. Here we are using a

center-tap transformer whose output will be sinusoidal with 36volts peak to peak value.

Fig 8.2 A: Output Waveform of transformer

Page 57: Faculty Class Alert Using Gsm

The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor. The

transformer output is given to the rectifier circuit.

8.3 Rectifier:-

A rectifier converts AC to DC, but the DC output is varying. There are several types of

rectifiers; here we use a bridge rectifier.

The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using both

half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure. The circuit

has four diodes connected to form a bridge. The ac input voltage is applied to the diagonally

opposite ends of the bridge. The load resistance is connected between the other two ends of the

bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas

diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with the load

resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct whereas,

D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load

resistance RL and hence the current flows through RL in the same direction as in the previous half

cycle. Thus a bi-directional wave is converted into unidirectional.

Fig8.3 A: the output waveform of the rectifier is shown as below

Page 58: Faculty Class Alert Using Gsm

The varying DC output is suitable for lamps, heaters and standard motors. It is not

suitable for electronic circuits unless they include a smoothing capacitor.

8.4 Smoothing:-

The smoothing block smoothes the DC from varying greatly to a small ripple. The ripple

voltage is defined as the deviation of the load voltage from its DC value. Smoothing is also

named as filtering.

Filtering is frequently effected by shunting the load with a capacitor. The action of this

system depends on the fact that the capacitor stores energy during the conduction period and

delivers this energy to the loads during the no conducting period. In this way, the time during

which the current passes through the load is prolongated, and the ripple is considerably

decreased. The action of the capacitor is shown with the help of waveform.

Page 59: Faculty Class Alert Using Gsm

Fig8.4 A: The waveform showing the action of capacitor

Fig 8.4 b: rectifier with capacitor & o/p wave form of regulated dc

8.5 Regulator:-

Regulator eliminates ripple by setting DC output to a fixed voltage. Voltage regulator ICs

are available with fixed (typically 5, 12 and 15V) or variable output voltages. Negative voltage

regulators are also available

Many of the fixed voltage regulator ICs has 3 leads (input, output and high impedance).

They include a hole for attaching a heat sink if necessary. Zener diode is an example of fixed

regulator which is shown here.

Page 60: Faculty Class Alert Using Gsm

Fig 8.5 a: REGULATOR

CHAPTER 9

Page 61: Faculty Class Alert Using Gsm

SOFTWARE DESCRIPTION

In our project we used software that is Keil micro vision for the simulation of the

program.

9.1 Keil Software:-

Keil development tools for the 8051 Microcontroller Architecture support every level of

software developer from the professional applications engineer to the student just learning about

embedded software.

The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-time

Kernels, Single-board Computers, and Emulators support all 8051 derivatives and help you get

your projects completed on schedule.

9.2 program code

#include<facltyhdr.c>

// store the mobile nos in this array

Page 62: Faculty Class Alert Using Gsm

uc xdata mobilenos[9]

[12]={"9010077520","9951230577","9052967720","9440349092","9966153324","9440222283"

,"9959320757","9949023909"};

//maintain a data base of year and subjects

uc xdata EC1[8][5]={"NTA","EDC","PHY","MAT","ENG","CDSL","EDCL"};

uc xdata EC2[8][5]={"PDC","PTSP","ECA","AC","STLD","PDCL","ECAL"};

uc xdata EC3[8][5]={"DC","AWP","MWE","DSP","MPI","MPL","DCL"};

uc xdata EC4[8][5]={"CMC","DIP","WN","CN","TVE","DSPL","MWL"};

int chk_time(); // to check the period timings

void alert(ui ); // to generate messages to the lecturers as per the period timings

void init(); //

void getmobile();//

void ldval();//

volatile uc mblenoid,yr,sub;

uc mnoflag=0;

void main()

{

uc mdfy=0;

init();

lprintf("welcome to ES",1,1);

write_rtc(0x00,0x12); // WRITE THE VALUES TO SEC REG OF RTC

delay(10);

write_rtc(0x01,0x39); // WRITE THE VALUES TO MNS REG OF RTC

delay(10);

write_rtc(0x02,0x69); // WRITE THE VALUES TO HRS REG OF RTC

delay(10);

ClrLCD();

lprintf("FACULTY ALERT SYSTEM",1,1);

Delay(75);

ClrLCD();

Page 63: Faculty Class Alert Using Gsm

while(1)

{

EA=0;

get_time(); // read the RTC

lprintf(dt_tm,1,1);

Delay(25);

EA=1;

alert(chk_time()); // check the time for period no and generate messages as per period

nos

if(mnoflag) // if new data is entered

{

ldval();// to generate msg to the newly entered mobileno with subject and year

Delay(50);

mnoflag=0;

}

}

}

// function to check time for the period number

int chk_time()

{

ui pc=0;

if(dt_tm[0]=='0' && dt_tm[1]=='9' && dt_tm[3]=='4' && dt_tm[4]=='0' && dt_tm[6]=='0' &&

dt_tm[7]<='0')

{

pc=1; // 9.40 am - 10.30 am

return pc;

}

else if(dt_tm[0]=='1' && dt_tm[1]=='0' && dt_tm[3]=='3' && dt_tm[4]=='0' && dt_tm[6]=='0'

&& dt_tm[7]<='0')

Page 64: Faculty Class Alert Using Gsm

{

pc=2; // 10.30 am - 11.20 am

return pc;

}

else if (dt_tm[0]=='1' && dt_tm[1]=='1' && dt_tm[3]=='2' && dt_tm[4]=='0' && dt_tm[6]=='0'

&& dt_tm[7]<='0')

{

pc=3; // 11.20 am - 12.10 pm

return pc;

}

else if(dt_tm[0]=='1' && dt_tm[1]=='2' && dt_tm[3]=='1' && dt_tm[4]=='0' && dt_tm[6]=='0'

&& dt_tm[7]<='0')

{

pc=4; // 12.10 pm - 01.00 pm

return pc;

}

else if(dt_tm[0]=='0' && dt_tm[1]=='1' && dt_tm[3]=='4' && dt_tm[4]=='0' && dt_tm[6]=='0'

&& dt_tm[7]<='0')

{

pc=5; // 01.40 pm - 04.10 pm lab

return pc;

}

else return 0;

}

// function to generate messages to the corresponding mobile nos from data base

void alert(ui prd)

{

Page 65: Faculty Class Alert Using Gsm

ui period;

period=prd;

switch(period)

{

case 0:

_nop_();

break;

case 1:

TxMsg(EC1[0],mobilenos[0],period+0x30);// to generate msg, it takes

year,subject,mobile no and period no

Delay(250);

TxMsg(EC2[0],mobilenos[3],period+0x30);

Delay(250);

TxMsg(EC3[0],mobilenos[1],period+0x30);

Delay(250);

TxMsg(EC4[0],mobilenos[2],period+0x30);

Delay(250);

break;

case 2:

TxMsg(EC1[1],mobilenos[2],period+0x30);

Delay(250);

TxMsg(EC2[1],mobilenos[1],period+0x30);

Delay(250);

TxMsg(EC3[1],mobilenos[3],period+0x30);

Delay(250);

TxMsg(EC4[1],mobilenos[0],period+0x30);

Delay(250);

break;

case 3:

TxMsg(EC1[2],mobilenos[1],period+0x30);

Page 66: Faculty Class Alert Using Gsm

Delay(250);

TxMsg(EC2[2],mobilenos[0],period+0x30);

Delay(250);

TxMsg(EC3[2],mobilenos[2],period+0x30);

Delay(250);

TxMsg(EC4[2],mobilenos[3],period+0x30);

Delay(250);

break;

case 4:

TxMsg(EC1[3],mobilenos[3],period+0x30);

Delay(250);

TxMsg(EC2[3],mobilenos[2],period+0x30);

Delay(250);

TxMsg(EC3[3],mobilenos[0],period+0x30);

Delay(250);

TxMsg(EC4[3],mobilenos[1],period+0x30);

Delay(250);

break;

case 5:

TxMsg(EC1[5],mobilenos[6],period+0x30);

Delay(250);

TxMsg(EC2[5],mobilenos[4],period+0x30);

Delay(250);

TxMsg(EC3[5],mobilenos[7],period+0x30);

Delay(250);

TxMsg(EC4[5],mobilenos[5],period+0x30);

Delay(250);

break;

}

Page 67: Faculty Class Alert Using Gsm

}

// to initialize different modules used in this project(LCD,Keypad,UART(serial),external

interrupt)

Void init ()

{

Sconfig(); // set baud rate(9600)

LCD_Init (); // initialize LCD

Delay(25);

Keypad=0xff; // initialize keypad

EA=1; // enable interrupt

EX0=1;

}

// function for reading the mobile no id, subject id, and year

Void ext_int0 () interrupt 0 using 1

{

EA=0;

getmobile(); // to read mobile no id, subject id, year

EA=1;

}

// function to read data from keypad (mobile no id, subject id, year)

void getmobile()

{

uc exkey,nmno=0;

EA=0;

lprintf("enter mobile no:",2,1);

Delay(25);

lprintf(" ",3,1);

Delay(10);

Page 68: Faculty Class Alert Using Gsm

mblenoid=key_get(); // to read mobile no id

Delay(50);

if((exkey=key_get())=='#') // to read pass code

nmno=1;

ClrLCD();

Delay(10);

if(nmno) // if mobile no id is entered with pass code successfully

{

lprintf("enter year:",3,1);

yr=key_get(); // to read year

Delay(50);

lprintf("enter subject code:",3,1);

sub=key_get(); // to read subject code

Delay(50);

mnoflag=1;

}

nmno=0;

ClrLCD();

Delay(10);

}

// function to generate msgs to the newly entered values

void ldval()

{

uc subj,mblno;

subj=sub-0x30;

mblno=mblenoid-0x30;

Page 69: Faculty Class Alert Using Gsm

if(yr=='1') {

TxMsg(EC1[subj],mobilenos[mblno],' ');

Delay(50); }

else if(yr=='2'){

TxMsg(EC2[subj],mobilenos[mblno],' ');

Delay(50); }

else if(yr=='3'){

TxMsg(EC3[subj],mobilenos[mblno],' ');

Delay(50); }

else if(yr=='4'){

TxMsg(EC4[subj],mobilenos[mblno],' ');

Delay(50); }}

9.3. Simulation:-

The µVision Simulator allows you to debug programs using only your PC using

simulation drivers provided by Keil and various third-party developers. A good simulation

environment, like µVision, does much more than simply simulate the instruction set of a

microcontroller — it simulates your entire target system including interrupts, startup code, on-

chip peripherals, external signals, and I/O.

9.3.1 Use of software for execution of microcontroller programs:-

Keil development tools for the MC architecture support every level of software developer

from the professional applications engineer to the student just learning about embedded software

development.

The industry-standard Keil-C compilers, macro assemblers, debuggers, real, time

Kernels, Single-board computers and emulators support all microcontroller derivatives and help

you to get more projects completed on schedule. The Keil software development tools are

Page 70: Faculty Class Alert Using Gsm

designed to solve the complex Problems facing embedded software developers. Those are listed

below.

9.3.2 Problems facing embedded software developers:-

When starting a new project, simply select the microcontroller you the device

database and the µvision IDE sets all compiler, assembler, linker, and memory

options for you.

The Keil µ Vision debugger accurately simulates on-chip peripherals

(PC, CAN, UART, SPI,Interrupts,I/O ports, A/D converter, D/A converter and

PWM modules)of your aver device.

Simulation helps you understand h/w configurations and avoids time wasted on

setup problems. Additionally, with simulation, you can write and test applications

before target h/w is available.

When you are ready to begin testing your s/w application with target h/w,

use the MON51, MON390, MONADI, or flash MON51 target monitors, the

ISD51 In-System Debugger, or the ULINK USB-JTAG adapter to download and

test program code on your target system.

9.3.3 Source Code:-

1. Click on the Keil uVision Icon on Desktop

2. The following fig will appear

Page 71: Faculty Class Alert Using Gsm

3. Click on the Project menu from the title bar

4. Then Click on New Project

5. Save the Project by typing suitable project name with no extension in u r own folder

sited in either C:\ or D:\

Page 72: Faculty Class Alert Using Gsm

6. Then Click on save button above.

7. Select the component for u r project. i.e. Atmel……

8. Click on the + Symbol beside of Atmel

9. Select AT89S51 as shown below

Page 73: Faculty Class Alert Using Gsm

10. Then Click on “OK”

11. The Following fig will appear

12. Then Click either YES or NO………mostly “NO”

13. Now your project is ready to USE

Page 74: Faculty Class Alert Using Gsm

14. Now double click on the Target1, you would get another option “Source

group 1” as shown in next page.

15. Click on the file option from menu bar and select “new”

16. The next screen will be as shown below, and just maximize it by double

clicking on its blue boarder.

Page 75: Faculty Class Alert Using Gsm

17. Now start writing program in either in “C” or “ASM”

18. For a program written in Assembly, then save it with extension “. asm” and for

“C” based program save it with extension “ .C”

19. Now right click on Source group 1 and click on “Add files to Group Source”

Page 76: Faculty Class Alert Using Gsm

20. Now you will get another window, on which by default “C” files will appear.

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

Page 77: Faculty Class Alert Using Gsm

24. If the file contains no error, then press Control+F5 simultaneously.

25. The new window is as follows

26. Then Click “OK”

27. Now Click on the Peripherals from menu bar, and check your required port as

shown in fig below

Page 78: Faculty Class Alert Using Gsm

28. Drag the port a side and click in the program file.

29. Now keep Pressing function key “F11” slowly and observe.

30. You are running your program successfully

Page 79: Faculty Class Alert Using Gsm

CONCLUSION &FUTURE SCOPE

In this project a low cost, flexible, solution to the automation of alerting the faculty about

their class is introduced. The novel approach in this project discusses the migration of the

automation of alerting the faculty through sms which has not been discussed at this level before.

Page 80: Faculty Class Alert Using Gsm

The system is simple to use and the head of department/principal can send to another faculty

when a faculty is absent.

As technology brings the world closer together, our college becomes the focus for

working and learning. FACULTY CLASS ALERT USING GSM allows the head/principal to

intimate the faculty with out calling the attainder and saying him to call the required faculty.

This project can also be added to smart card attendance system so that the controller gets

the detail of absentee of a faculty and also can send the message to hod/principal about the

absence of the faculty and the controller it self sends the message to another faculty to take the

class of the absented faculty.

BIBLIOGRAPHY

Page 81: Faculty Class Alert Using Gsm

1 WWW.MITEL.DATABOOK.COM

2 WWW.ATMEL.DATABOOK.COM

3 WWW.FRANKLIN.COM

4 WWW.KEIL.COM

REFERENCES:-

1 8051-MICROCONTROLLER AND EMBEDDED SYSTEM.

Mohd. Mazidi.

2 EMBEDDED SOFTWARE PRIMER.

David .E. Simon.