Академический Документы
Профессиональный Документы
Культура Документы
Dhapakhel, Lalitpur
(Affiliated to Tribhuvan University)
Sandee
p Paudel
Signatur
e Not
Verified
Digitally
signed by
Sandeep
Paudel
DN:
cn=Sandeep
Paudel,
o=KEC, c=NP
Date:
2006.12.29
03:29:18 Z
LALITPUR,NEPAL
DECMBER 2006
A PROJECT REPORT
SUBMITTED TO THE DEPARTMENT OF ELECTRONICS AND COMPUTER
ENGINEERING IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
FOR THE DEGREE OF BACHELOR OF ENGINEERING
COPYRIGHT
The authors have agreed that the library, Kantipur Engineering College (KEC), may
make this report freely available for inspection. Moreover, the authors have agreed that
permission for extensive copying of this project report for scholarly purpose may be
granted by the lectures who supervised the project works recorded herein or, in their
absence, by the Head of Department wherein the project report was done. It is
understood that the recognition will be given to the authors of the report and to the
Department of Computer and Electronics, KEC in any use of the material of this project
report. Copying or publication or other use of this report for financial gain without
approval of the Department and the authors written permission is prohibited.
Request for permission to copy or to make any other use of the material in this report in
whole or in part should be addressed to:
Head
Department of Computer and Electronics
Kantipur Engineering College
Dhapakhel, Lalitpur
Nepal
APPROVAL LETTER
The undersigned certify that they have read and recommended to the Institute of
Engineering for acceptance, a project report entitled "Vehicle Tracking and
Navigation System" submitted by Abhishek Dangol, Karuna Pokhrel, Sandeep Paudel,
Suman Dhimal and Sushil Bajracharya in partial fulfillment for the degree of Bachelor
of Engineering in Electronics and Communication Engineering.
---------------------------------------------Supervisor
Title:
Name of the supervisor
Name of Department/Organization
-----------------------------------------------External Examiner
Name :
Title:
Name of Organization
------------------------------------------------Committee Chairperson
Name: Er.Sachin Sharma Bhandari
Title: Head of Department
Computer and Electronics Engineering Department
----------------------Date
ABSTRACT
The project entitled Vehicle Tracking System is a data logging system based on the
concept of connectivity during mobility. This is a solution to the vehicle tracking
problem with the tactful combination of different fields such as communication
technologies, software development and hardware integration.
Based on the growing M2M communication systems, this project uses existing proven
technologies (GPS,GSM/GPRS and Internet) for the purpose of tracking vehicles and
for navigation. The embedded system encompassing the GPS receiver (sensor),
processing unit, GSM/GPRS (telemetry) module sends the position information over to
the internet (recording and analysis of data) which can be accessed from anywhere to
ascertain the whereabouts of the vehicle to be tracked.
The information about the vehicle can be obtained through either a HTML page
(internet) or as a response to the SMS request. The LCD in the system helps in the
navigation purpose.
iii
ACKNOWLEDGEMENT
First of all we would like to thank our HOD Er. Sachin Sharma Bhandari for his coordination and co-operation right from the commencement of this project. The help in
terms of resources from the department was invaluable.
We would also like to extend our gratitude towards our project supervisor Er.
Purusottam Sigdel for helping and guiding us. He made us work harder right from the
start which helped us to make a head-start in the project.
We cannot be at ease without mentioning the help of Real Time Solutions,
Bhotebahal. Their selfless support made this project possible.
We would also like to thank Mr. Nipin Shah for providing the necessary tools and
equipments as and when required.
It would be harsh not to mention the support and from our colleagues and teachers. We
would also like to thank all those who were directly and indirectly involved to make
this project a success story.
Finally, we would like to thank all our family members for their continuous support and
motivation.
iv
TABLE OF CONTENTS
COPYRIGHT.................................................................................................................. I
APPROVAL LETTER ..................................................................................................II
ABSTRACT.................................................................................................................. III
ACKNOWLEDGEMENT........................................................................................... IV
TABLE OF CONTENTS .............................................................................................. V
LIST OF TABLES ......................................................................................................VII
LIST OF FIGURES .................................................................................................. VIII
LIST OF SYMBOLS AND ABBREVITIONS.......................................................... IX
1
INTRODUCTION ..................................................................................................1
1.1
1.2
Literature review...............................................................................................3
1.3
2
Background.......................................................................................................2
Objectives .........................................................................................................4
2.2
2.3
2.4
GPS sensor........................................................................................................7
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
3
Introduction.....................................................................................................15
3.1.1
3.1.2
3.1.3
3.2
3.2.1
Features...................................................................................................20
3.2.2
3.3
3.4
3.5
MICRO-CONTROLLER ....................................................................................27
4.1
Introduction.....................................................................................................27
4.2
4.2.1
4.2.2
4.3
4.4
4.5
4.6
Interrupt Handling...........................................................................................30
5.2
5.3
7.2
JAVA ..............................................................................................................43
7.2.1
Applets ....................................................................................................44
7.2.2
7.2.3
FINAL WORDS....................................................................................................50
9.1
9.2
9.3
Future Enhancements......................................................................................51
9.4
Applications ....................................................................................................51
9.5
Discussion.......................................................................................................52
10
Limitations ......................................................................................................50
REFERENCES .................................................................................................53
LIST OF TABLES
vii
LIST OF FIGURES
viii
API
APN
AT
CBS
CMOS
CSD
DCD
DGPS
DNS
DTE
ETSI
GGSN
GND
GPRS
GPS
GSM
GSN
GTP
HLR
HSCSD
HTML
HTTP
IE
IMSI
INT
IP
ISDN
ISP
Interrupt Enable
International Mobile Subscriber Identity
Interrupt
Internet protocol
Integrated Service Digital Network
Internet Service Provider
JIT
JVM
Just In Time
Java Virtual Machine
LCD
M2M
MCU
MO
Machine to Machine
Microcontroller Unit
Mobile Oriented
ix
MSC
MT
NMEA
PCON
PDP
PDU
PHP
PLMN
PPP
PPS
Power Control
Packet Data Protocol
Packet Data Unit
Hypertext preprocessor
Public Land Mobile Network
Point to Point Protocol
Pulse Per Second
RFC1661
RFC1945
RFC990
RI
SCON
SGSN
SIM
SMG
SMOD
SMS
SMSC
Serial Control
Special Function Register
Serving GPRS Support Node
Subscriber Identity Module
Special Mobile Group
Serial Mode
Short Message Service
Short Message Service Center
TCON
TI
TTL
Time Control
Transmitting Interrupt
Transistor Transistor Logic
UART
UTC
WASS
WWW
SFR
INTRODUCTION
Measuring the vehicle parameters such as position, time, and velocity and
so on by the help of sensors. The sensor in this system is GPS sensor.
There will be two terminals namely the Mobile Station (e.g. Vehicle) and the user
terminal. With the help of constant communication with the user terminal and the
Mobile Station, the vehicle can be tracked with information it sends to the server.
Users terminal may either be the HTML page or an SMS response from the system.
For the navigation purpose the LCD in the system displays the current location of the
vehicle.
The system invokes a PHP code in the web server using the standard HTTP request
along with the position information. The code in turn stores the information in a text
file. The user can interpret the data with the help of points plotted in the map. This has
been performed with the help of JAVA applet and HTML code stationed at the web
server .General concept of the project is illustrated with the help of Figure 1.1 below.
INTERNET
GPS SALTELLITES
VEHICLE
HANDSET
GSM/GPRS TOWER
TERMINAL EQUIPMENT
(INTERNET ENABLED)
1.1
Background
These days the normal view of the communication is broadening. These days it is not
only the people who use telecommunication and Internet technologies to communicate
but the machines around us also have started to communicate with each other. This is
the concept of new emerging M2M communications.
M2M communications is all about letting the machines to talk. It is a system that enable
machines to communicate with information systems or with other machines and provide
real-time data. A wireless data link is used for monitoring and control, with data
transfer occurring either by request or at predetermined intervals.
The evolution of GSM has provided considerable benefits compared to other
technologies. The widespread use of GSM means that the M2M product developed will
be an international product. Advanced data services, security features and several
bearers such as GPRS, SMS, HSCSD make GSM an attractive option.
GPS originally developed by the U.S. army for obtaining a tactical edge over the
enemies by striking a position based attack have been recently accessible to the
civilians. After it was opened for the general public, the GPS system has been exploited
for several position based services.
The removal of selective availability by the U.S. government in 2001 provided more
accurate positioning and since it has been used for many position based services. People
around the globe can use this service free of cost which encourages GPS based
positioning systems.
Internet on the other had is a widespread communication topology. Originally
developed by the DoD as ARPANET in 1969 for information exchange, Internet now
has become the most used technology. This present time is also referred to as the age
of the Internet. The concept of the WWW has bloomed and provided user friendly
interface to the general people. It is a cost effective means of wide area communication.
With the dawn of the modernization of the world, development of transportation system
has also evolved highly. Each day, new vehicles with different luxurious features are
being launched in the market. And as a result, the countless vehicles are being added on
the street everyday. So, the rate of the vehicles on the street is definitely increasing
tremendously.
With the increase in number of the vehicles plying in the street, the problems of traffic
management, theft of the vehicles and trouble in navigation have increased in enormous
fashion. These problems have been rocketing with time. To get rid of these problems,
the idea of The Vehicle Tracking and Navigation System was conceived. The use of
cost effective technologies such as GPS, GPRS and Internet for the tracking of vehicles
or for other M2M communication system is quite justifiable.
1.2
Literature review
Although the M2M communication concept is quite a recent term, it is growing fast. In
the context of foreign countries M2M solutions are created for increasing the profits
and competitiveness of a company through more efficient processes, better customer
service or new ways of doing things.
In foreign countries it has found its use in widespread areas such as-monitoring
elevators in shopping centers, checking the temperatures of swimming pools,
downloading new games into amusement machines, locating vehicles on the highways
to name just a few.
The concept of position or location based-customized services is also in the rise these
days. The use of GPS has been widespread in areas such as recreational boating,
commercial fishing, and professional mariners, surveying, hiking etc. It has also been used
in the emergency management.
In the context of Nepal there are no such location based services. The concept of M2M
communication is little or non existent. So this project combines the M2M
communication concept with the position based system for the purpose of vehicle
tracking and navigation.
Although some vendors abroad have combined the GPS and the GPRS technologies for
the similar purpose, this project provides more flexibility of reporting the end data to its
users.
1.3
Objectives
The main objective of the project is foremost building a vehicle tracking and navigating
device that would be used in a real world. The device could be used for wide purposes
such as tracking, navigation, fleet and traffic management etc.
Also the project helps us to get more familiar with existing GPS and GSM/GPRS
networks. So far we have only been able to view the theoretical side of the system but
after the project completion we are sure to get familiar with practical side of it.
The GPS and GSM/GPRS services have not been fully exploited yet. Therefore we
wish to build a base upon which more advanced application of the vehicle tracking and
navigation systems are built in future. Therefore we can say that our project is both
research and application based. To be more specific the objectives of the project can be
listed as follows.
To shed light about how new technologies can be exploited for the benefit
of human beings.
2.1
GPS Introduction
2.2
GPS satellites circle the earth twice a day in a very precise orbit and transmit signal
information to earth. GPS receivers take this information and use triangulation to
calculate the user's exact location. Essentially, the GPS receiver compares the time a
signal was transmitted by a satellite with the time it was received. The time difference
tells the GPS receiver how far away the satellite is. Now, with distance measurements
from a few more satellites, the receiver can determine the user's position and display it
on the unit's electronic map.
A GPS receiver must be locked on to the signal of at least three satellites to calculate a
2D position (latitude and longitude) and track movement. With four or more satellites in
view, the receiver can determine the user's 3D position (latitude, longitude and altitude).
Once the user's position has been determined, the GPS unit can calculate other
information, such as speed, distance to destination, sunrise and sunset time and more.
Recent development in GPS like DGPS have made the positioning even more accurate.
The USCG beacons and the WAAS systems are the kinds of DGPS which correct the
data from the satellites with appropriate environmental error models.
2.3
The 24 satellites that make up the GPS space segment are orbiting the earth about
12,000 miles above us. They are constantly moving, making two complete orbits in less
than 24 hours. These satellites are traveling at speeds of roughly 7,000 miles an hour.
GPS satellites are powered by solar energy. They have backup batteries onboard to keep
them running in the event of a solar eclipse, when there's no solar power. Small rocket
boosters on each satellite keep them flying in the correct path.
2.4
GPS sensor
The GPS receiver used for our purpose is the GARMIN 15L GPS receiver. The sensor
first has to be initialized according to the formats in which we required the data. There
are certain NMEA (National Marine Electronics Association) sentences that help us to
communicate with the receiver. These sentences are the Garmin proprietary NMEA
sentences.
2.4.1
Sensor Features
Technical Specifications
It requires an 8-pinJSTconnector and 1-milimeterpitch.Mating wire harness
A MCX male antenna has to be connected with the female MCX connector
in the sensor
Required voltage range is 3.3 VDC to 5.4VDC(must have less than 100mV
peak-to-peak ripple)
Input current is 100 mA peak, 85 mA nominal at 3.3 to 5.0 VDC.
2.4.3
Pin#
Wire
Description
Color
1
BACKUP POWER
WHITE
NOT USED
GROUND
BLACK
POWER RETURN
POWER
RED
PORT 1
YELLOW
DATA OUT
5
PORT 1
BLUE
DATA IN
RF BIAS
ORANGE
NOT USED
PPS
GRAY
ONE-PULSE-PER-SECOND
OUTPUT.
PORT 2-DATA IN
GREEN
NOT USED
2.4.4
The input output data format for the GPS sensors are the NMEA 0183 sentences.
NMEA is an international standard or protocol for the communication with GPS
devices. The baud rate defined by the NMEA is 4800 however it can be changed
according to our requirement in the GPS-15L sensor.
Eg. $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
It is a NMEA GGA sentence which provides essential fix which provide 3D location
and accuracy data. The sentence is followed by * and then the XOR sum of the output
data.
Garmin Proprietary NMEA sentences are designed for use with Garmin GPS sensors
and GPS units in order to interface with external devices for data interpretation and
recording. The proprietary NMEA sentences start with $PGRMxx.
a) Input Sentences
The sensor first has to be initialized with the necessary sensor initialization
information. There are certain NMEA sentences that help us to input information to the
sensor. These sentences are the Garmin proprietary NMEA sentences.
For conveying these sentences the GPS receiver was first connected to the
computer with the following connection scheme. The free IO Commander software
was used for the communication with 8N1, 4800 baud asynchronous RS-232 standard.
Figure 2-2 Computer Serial Port Interconnection with the GPS Sensor
10
The $PGRMI sentence provides information used to initialize the GPS sensors,
set position and time used for satellite acquisition. Receipt of this sentence by the GPS
sensor causes the software within the GPS receiver to restart the satellite acquisition
process. If there are no errors in the sentence, it will be echoed upon receipt. If an error
is detected, the echoed PGRMI sentence contains the current default values. The
initialized PGRMI sentence is
$PGRMI,8520.2345,N,2739.5678,E,270706,105901,A*hh<CR><LF>
2) Sensor Configuration Information (PGRMC)
The $PGRMC sentence provides information used to configure a GPS sensors
operation. Configuration parameters are stored in non-volatile memory. The GPS sensor
will echo this sentence upon its receipt if no errors are detected. If an error is detected,
the echoed PGRMC sentence will contain the current default values. The initialized
PGRMC sentence is:
$PGRMC,A,4440,37,,,,,,A,4,A,1,,30*hh<CR><LF>
3) Output Sentence Enable/Disable (PGRMO)
The $PGRMO sentence provides the ability to enable and disable specific
output sentences. In this project we only require one sentence that is PGRMF. So the
input sentence was.
$PGRMO,PGRMF,1*hh<CR><LF>
b) Output Sentences
Out of many output sentences we only require the PGRMF. It is as follows:
$PGRMF,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,<12>,<13>,<14>,<15>
*hh<CR><LF>
The fields are described in the following table.
11
<1>
<2>
<3>
<4>
<5>
<6>
<7>
Latitude hemisphere, N or S
<8>
<9>
Longitude hemisphere, E or W
<10>
<11>
<12>
<13>
<14>
<15>
2.4.5
The interfacing between the GPS receiver and the microcontroller is the RS-232
interface i.e. the GPS receiver and the microcontroller communicate serially. The GPS
receiver is connected to a microcontroller which reads the GPS output sentence. The
connection scheme is as follows.
12
DATA OUT
MicroController
DATA IN
GPS
Sensor
PPS OUT
The baud rate of the output data from the GPS receiver has already been set to 4800
bauds. Therefore the microcontroller receives the data at a baud rate of 4800 bauds.
These data's are read serially and stored in the internal memories of the microcontroller
before further transmission. The data is sent as a sequence of 8 bits as well as the parity
bits for error detection during transmission. The GPS receiver outputs valid output data
at an interval of 5 seconds.
The GPS receiver outputs data with a voltage level between 0V and +5V i.e. TTL logic.
While serial communication works with voltage levels -15V to -3V for high and +5V to
+15V for low. So in order to receive serial data from an RS-232 interface the voltage
level has to be converted. This is done with the help of an IC, the MAX232.
The MAX232 IC performs the following conversions.
TTL
+2V to +5V
0V to +0.8V
RS-232
Logic
-15V to -3V
high
+3V to +15V
low
13
The PPS output of the GPS Sensor has been used for the handshaking purpose. The
sensor outputs a pulse in one second with the output of the GPS Sensor data. The
complete connection of the GPS sensor is shown in the schematics of the project in the
later section.
2.4.6
The GPS Sensor has been powered with the common power of the system. The 6V 4.5
Ah Lead Acid Battery is used for the system and 7805 regulator is used to convert the
voltage level to 5 Volts.
14
3.1
Introduction
General Packet Radio Service (GPRS) is a mobile data service available to users of
GSM mobile phones. It is often described as "2.5G, a technology between the second
(2G) and third (3G) generations of mobile telephony. It provides data transfer by using
unused TDMA channels in the GSM network. Thus it is the data network for GSM
technology however; its architecture and protocols are slightly different. Technology
for GMS has evolved rapidly since the introduction of its data services, however in
order to support such services GSM adapted a new solution called GPRS (General
Packet Radio Service), which is intended to provide actual packet radio services for
GSM and TDMA users with corresponding enhanced architecture adjustments. The
main set of GPRS specification was approved by SMG-25 (Special Mobile Group) in
1997, and was completed by 1999. The purpose of GPRS is to accommodate efficiently
data sources as well as to obtain high data rate, flexibility and efficient utilization of
bandwidth across the air interface. That is why GPRS reuses the same infrastructure in
order to provide end-to-end packet switched services.
A typical GPRS network is shown below.
HLR
MSC
Gr
The internet
Gs
Gi
Gb
GGSN
SGSN
PCU
Gn
Some other
company
network
Gi
GSM network
15
GPRS requires hardware and software changes in the GSM networks. It reuses a large
degree of existing GSM infrastructure. But its architecture will not contain any MSC,
VLR or AUC applications of GSM architecture, but instead encloses two new network
GSN (GPRS Support Node) elements: a Gateway GPRS Support Node (GGSN) and a
Serving GPRS Support Node (SGSN). The gateway GPRS Support Node (GGSN)
serves as the gateway between the GPRS network and other packet networks. GGSN is
also responsible for routing data to the mobile stations at their current points of
attachments to the network. In other words, GGSN acts as a logical interface to external
packet data networks. On the other hand, the Serving GPRS Support Node (SGSN) is
responsible for the delivery of packets to the Mobile Systems (MSs) within its
particular geographical service area. Within the GPRS network, Protocol Data Units
(PDUs) are encapsulated at the originating GSN and decapsulated at the destination
GSN. In between the GSNs, the Internet protocol (IP) is used as the backbone to
transfer PDUs. This process is known as GPRS tunneling (GTP).
The GSNs that make up a GPRS PLMN are interconnected via an IP backbone. The
standards IP routers are employed to help the SGSN to perform the routing and data
transfer functionality that is needed concerning the user related data. The user related
data are constantly stored within the network Home Location Register (HLR). The
GPRS Public Land Mobile Network (PLMN) is made up of a number of network
elements and communications links whose connections are based on the Internet
Protocol (IP) standard stack. On the interface the resources are assigned mobile-tomobile stations only temporarily on a per-packet basis thus radio resources are only
assigned for the duration of one or few IP packets.
3.1.1 CSD vs. GPRS
The General Packet Radio Services (GPRS) standard permits data transfers in a
completely different way with respect to previous point to point communications made
with Circuit Switch data (CSD) modems. In CSD operations the modem establishes a
connection with the other party (another modem) in such a way that all the Network in
between is transparent to the data exchanged. In a real point to point connection, the
two parties are directly connected by the controlling application of the modem. The
other party can be either an Internet Service Provider (ISP) or a private server, but in
16
any case the arrival point must have a modem to connect to Landline, ISDN or GSM
CSD.
The connection establishment procedure defines a particular path where all the
information exchanged between the two peers flows and this path is reserved for
exclusive use of these two peers. This approach has the drawbacks of a long time to setup the link between the two peers (up to a minute); furthermore the speed of the data
transfer is limited to 14400 bps.
In GPRS operations instead, the connection is made directly towards internet as if the
GPRS modem is a network UDP/TCP/IP socket. There is no data path reserved for the
data exchange between the two peers, instead the resources are allocated dynamically
on demand and the data exchanged is organized into UDP/TCP/IP packets. Furthermore
the maximum transfer speed is up to 171.2 kbps (theoretically), about ten times faster
than GSM CSD.
A GPRS connection is shown in the following figure, where the GPRS connection is
between the GPRS modem and the internet.
GPRS
Network
Internet
Mobile with GPRS
(or a GPRS modem)
Due to this kind of connection, when activating the GPRS connection we must provide
the network parameters and not the phone number to be dialed. Therefore it is not
17
possible to establish a direct point to point GPRS connection between two GPRS
modems; instead an internet TCP/IP connection is required to achieve a point to point
connection between two peers. This approach as the immediate advantage of projecting
the controlling application of the GPRS modem directly on the internet, ready to access
the server virtually from anywhere in the world.
There are few considerations that must be done on the GPRS connections:
The controlling application must relay on some APN (Access Point Name)
that may be the one of the Network Operator of the SIM to gain access to the
internet through the GPRS connection. It's the same thing as the Internet
provider number for CSD internet access.
18
Application
Application
UDP/TCP
UDP/TCP
IP
IP
PPP
PPP
Remote
host
server
GPRS device
Internet
UDP/TCP/IP
Local host
Modem
Modem
Internet provider
access authentication
server
When the PPP between the localhost and the GPRS device (this is done in such a way
that keeps the GPRS procedure exactly the same as for a CSD internet provider call) is
established the localhost can exchange the TCP/IP packets through the PPP.
3.1.3
GPRS Protocols
On the network level, GPRS supports IP and X.25 protocols to be used by an end-toend application. The GPRS packet delivery to the MS terminal constantly faces packet
traffic as it travels to its destination such traffic is referred as the transport of data which
consists on flow control, error detection, error correction and error recovery are all
included under the same suite of protocols.
19
3.2
3.2.1
Features
The GSM/GPRS device that we are using is Telit GM862 The GM862-GPRS with its
EASY GPRS feature is a special device. It embeds and controls the PPP/ (UDP) TCP/IP
protocol stack inside itself. In this way the local-host sees a "virtual serial line"
connection with the application software on the server machine. Differently from other
GPRS devices that embed the TCP/IP protocol stack; an EASY GPRS device, such as
the GM862-GPRS, does not provide a set of API functions to interface with the
protocol stack but it automatically manages it internally as specified when starting the
connection. It also includes all the features of a standard GSM device.
Specifications of the device are:
Quad-band 900 / 1800 MHz or 850 / 1900 MHz GSM / GPRS Modem
Internet, Data, SMS, Voice, Fax, TCP/IP Services and EASY GPRS
Commands
SIM Interface 3V / 5 V
20
Weight125 gram
Interface:
3.2.2
Input/Output format
AT command
Mobile phone or GSM/GPRS modem are controlled and instructed through commands
called AT commands. The AT is an attention commands and is use as a prefix to other
parameter in a string. The AT command combine with other parameters can be set up in
the communication package or typed in manually as a command line instruction A
terminal program's function is like this: It sends the characters you typed to the mobile
phone or GSM/GPRS modem. It then displays the response it receives from the mobile
phone or GSM/GPRS modem on the screen. The terminal program on Microsoft
Windows is called HyperTerminal which was used for the required setting of the GPRS
device.
The Telit GM862 wireless module can be driven via the serial interface using
the standard AT commands. The Telit GM862 wireless module is complaint with Hayes
standard AT command set (to maintain compatibility with existing programs), GSM
specific AT commands and GPRS specific commands. This module also supports
proprietary AT commands for special purposes.
The carriage return<CR> and line feed <LF> after every command is implied.
21
PDU mode
text mode
Test command:
AT+CMGF=?
For example:
AT+CMGF=1
The above command will select the SMS format as text mode.
For example:
AT+CMGF=1[Enter]
AT+CMGS="+491711234567"[Enter]
>Please call office ^Z
Here +CMGF=1 will set the modem in text mode. After the +CMGS you enter
the number the message is intended to in between quotation signs. The message in our
case Please call office is written in the next line and terminated by ctrl+Z (^Z equals
ctrl+Z).
22
AT+CNMI=<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]
The MCU does not require any new message indication. Hence the indications are
disabled with the command:
AT+CNMI=0,0,0,0,0
The above command will indicate the first 0 as buffer unsolicited result codes
buffering option buffer is full. Second 0- no SMS-deliver indications are reported to the
TE. Third 0- Cell broadcast message are not send to the DTE. Forth 0- Status report
receiving is not reported to the DTE.
And last 0- TA buffer of unsolicited result codes define within this commands is
flushed to the TE.
AT+CMGR:Read message
AT+CMGR=<index>
Example:
AT+CMGR=4
AT+CMGD:Delete message
AT+CMGD=<index>[,<deflag>]
<index>-message position index in the selected storage
<deflag> delete mode selection flag
0
Example:
AT+CMGD=1,0
This command will deleted the message of stored location no.1
23
AT+IPR=4800
This command sets the baud rate of the GPRS device to 4800.
3.3
24
The server replies with a response line containing the HTTP version, status code, and
description, such as
HTTP/1.0 200 OK
3.4
The communication protocol of the device is the asynchronous standard RS232 serial
communication with D9 connectors and RS-232 voltage levels. The serial data format is
8N1 with 4800 baud rate. Since the MCU only operates on TTL or CMOS voltage
25
levels some level conversion has to be done for the interfacing purpose which will be
described later.
The following block diagram shows the connection of the GPRS device with the MCU.
TX
MCU
RX
GPRS Device
DTR
DCD
Figure 3-5: Signal lines to interface the GPRS Terminal with the MCU
Since the serial communication is full-duplex the other handshaking signals such as RTS, CTS are
not required.
3.5
The GPRS device runs on a separate power source other than that used by other
components. It uses a 12 V regulated DC supply at peak 1.5 A current.
26
MICRO-CONTROLLER
4.1
Introduction
Intel introduced their microcontroller family MCS 8051 to the market during the 80s.
Although this family had quite limited capabilities by today's notions, it quickly
captivated the world and became the standard for what is today understood as
'microcontroller'. The most significant cause for such a success can be found in the
cleverly chosen configuration which can satisfy a diversity of needs, yet allowing for
continuous upgrades (in form of new controllers). In a brief period of time, a decent
amount of software has been developed for 8051, making further changes of the
hardware core simply uneconomical. Consequently, there is a variety of MCUs
available today, basically just the upgraded 8051 models. The microcontroller that we
are using in our project is an 89c52 microcontroller which is based on the 8051
architecture. It is a cost effective and easy solution for simple as well as complex
embedded systems. The four output ports, integration of UART, timing circuits,
interrupt handling makes AT89c52 a perfect choice for this project. Its features can be
summarized as:
256 bytes of RAM (SFR registers included) can satisfy the basic needs.
4 ports totaling 32 I/O lines are usually sufficient for connecting to the
external cirtuits.
4.2
Serial Communication
The serial communication is possible with the help of the in-built UART in the MCU.
We just have to run the timers and select the appropriate serial communication mode
and then place the character to be transmitted in the SBUF( special function register).
The timing is required for the UART for receiving and transmitting purpose. Similarly
for the receiving purpose we have to set receive enable flag and then the received
character is stored in the SBUF register. The end of transmission or reception is
indicated by separate interrupt flags called TI and RI respectively.
27
SM0
SM1
SM2
PCON
SMOD
REN
TB8
RB8
TI
RI
GF1
GFO
PD
IDL
We have used the mode 2 for the serial communication. Hence SM0=0 AND SM1=1.
SM2 is set to 0 since it is required only in modes 2 and 3. REN is set to 0 for
transmitting and set to 1 for receiving purposes. TB8 and RB8 has been cleared to
indicate the 8th bit as 0. TI and RI is set by the MCU upon transmission or reception of
a character. While receiving the REN is set to 1.
Hence SCON=0x40
For the PCON register only the SMOD bit is set or reset. In our case SMOD=0.
Function for transmitting is shown in the figure below:
void transmit(char val)
{
SCON=0x40;
PCON=(PCON&0x7f);
SBUF=val;
while(!TI);
}
28
4.2.2
For the purpose of serial communication the UART of the MCU has to be input with
the clock signals. The frequency of the clock signals can be set by setting the bits of
SFRs TCON and TMOD. Their bit fields are shown below:
TF1
TR1
TF0
TR0
IE1
IT1
IE0
IT0
TMOD Gate
C/T
M1
M0
Gate
C/T
M1
M0
TCON
Since we have used the timer1 in mode 2(auto reload 8 bit counter) we have set M1 as 1
and M0 as 0.the Gate of the timer 1 is set to 1 to start the timer. C/T of timer 1 is set to
0 to make it act as a timer instead of counter.
Hence TMOD= 0xA0. Bits 0 to 3 are for timer 1 operation hence not used
TR1 is set to run the timer. TF1 indicates the overflow of the timer which provides the
timing functions. TR0 and TF0 are not used. Other bits which are used for interrupt
purpose are not used. Hence we only have set TR1=1 to start the timer.
The baud rate frequency is determined by the formula
2SMOD
F = X TIMER 1 overflow frequency
32
Oscillator frequency
Timer 1 overflow frequency =
12 x [256-TH1]
For the baud rate of 4800 with the oscillator frequency 11.0592 MHz the value of TH1
came out to be 250. Hence TH1( Higher byte of 16 bit counter) was initialized with
250.
29
void init()
{
TMOD=0XA0;
TH1=250;
TR1=1;
}
4.3
Interrupt Handling
EA
----
ET2
ES
ET1
EX1
ET0
EXO
To enable the interrupt EA should be set to 1 and to use external interrupts EX1 and
EX0 should be set to 1. Hence IE.7,IE.2 and IE.0 are all set to 1.
30
Initially the output of the circuit is high in the INT1 pin of the MCU but when the user
pushes the push button the pin becomes low so that an interrupt is triggered.
4.4
The connection in and out of the microcontroller is shown with the help of the figure
below:
31
Pins 40 and 20 are used for VCC and GND respectively. Pin 9 which is RESET pin has
a RC circuit which provides high to the pin 9 for required amount of time. The push
button with the reset circuit helps external reset at any time. The crystal oscillator is
connected with the pins 18 and 19. LED indicator is used to know about the working
state of the MCU. Pins 10 and 11 are used for RxD and TxD respectively. Pins 12 and
13 are used for the external interrupts. Other pins and ports are connected as shown in
the Figure 3-4 which will be described later in the report.
4.5
4.6
LCD is a device where we can display not just numbers, but also letters, words and all
manner of symbols, makes them a good deal more versatile than the familiar 7-segment
light emitting diode (LED.) displays. LCD modules are effective, economically,
powered by batteries and less power consumers too. LCD modules conform to a
standard interface specification. A 14-pin access is provided (14 holes for solder pin
insertion or for an IDC connector) having eight data lines, three control lines and three
32
power lines. The connections are laid out in one of two common configurations, either
two rows of seven pins, or a single row of 14 pins.
Pins 1 and 2 are the power supply lines, Vss and Vdd. The Vdd in should be connected
to the positive supply, and Vss to the 0V supply or ground. Although the LCD. module
data sheets specify a 5Vd.c. supply (at only a few milliamps), supplies of 6V and 4.5V
both work well.
Pin 3 is a control pin Vee, which is used to alter the contrast of the display. Pin 4 is the
Register Select (RS) line, the first of the three command control inputs. When this line
is low, data bytes transferred to the display are treated as commands, and data bytes
read from the display indicate its status. By setting the RS line high, character data can
be transferred to and from the module. Pin 5 is the Read/Write (R/W) line. This line is
pulled low in order to write commands or character data to the module, or pulled high
to read character data or status information from its registers. Pin 6 is the Enable (E)
line. This input is used to initiate the actual transfer of commands or character data
between the module and the data lines. When writing to the display, data is transferred
only on the high to low transition of this signal. Pins 7 to 14 are the eight data bus lines
(D0 to D7).
The timing diagram provides the information for both read and write cycles, fig .1.
33
In the above timing diagram once line E is high, it must not be brought low again until
at least 450ns has elapsed, as is indicated by the tEH (time -- enable high). Also, all
eight data lines appropriate logic levels and allowed to stabilize for at least the tDS
(time data setup) period of 200ns before bringing line E low again, the LCD. allows the
data lines to be set up after line E is taken high. When line E is returned to a low level,
there are also two hold times that must be taken into account. The tAH (time address
hold) parameter indicates that the RS and R/W lines must not be altered for at least
10ns, and tDH' (time data hold) shows that none of the data lines must change for at
least 20ns. One further restriction exists. The E line must not be taken high again (for
the next command that is) for another 500ns (tEL: time enable low). This means that
the total cycle time of the E line is 450ns plus 500ns. Allowing for the rise and fall
times, indicated by tRF, which should be no longer than 25ns each, an approximate
value of 1ns can be calculated. This means that no more than one million commands (or
one million characters) per second should be sent to the display.
The microcontroller is be programmed to start by first setting the LCD.'s RS line to its
correct logic level. This is the line that determines whether the LCD. should regard data
as control instructions or character information. In cases where data needs to be read
back from the LCD., the microcontroller must also have control over the R/W line
(read/write).The microcontroller can set up these two signals at the same time, or it may
do one before the other, it doesn't really matter. What is important, is that they are both
valid or stable for a minimum period of time before the level on the E (Enable)
line is raised to a logic 1.
Now let us deal with the time required for the instruction execution. Most commands
tie-up the LCD. for 40ns, during which time it is said to be busy. The Clear Display
and Cursor Home commands, can take a lot longer. Much longer delays are required to
enable the LCD. to process commands and data. The practical implication of the
instruction times is just a case of having to insert a delay between one instruction and
the next. Example the two commands, Clear Display and Cursor Home, have variable
execution times that depend upon several factors.
34
The interfacing of the LCD with the MCU is shown with the figure below:-
We see that the data lines of the LCD are connected to the Port 0. Port 0 does not have
internal pull up. Hence we have to provide external pull up which is done by the 10k
resistor as the current requirement of the LCD data lines are very small. The RS, RW
and the E registers are respectively connected to the P1.0, P1.1 and P1.2
35
The serial communication is the backbone of this system and the devices communicate
with this standard. While the mode of communication between the different
components of the system is same there are logical differences between them. The
MCU operates in the TTL or CMOS voltage ranges, the GPS sensor and the GPRS
device operate on true RS232 voltage levels. Hence some conversion is required before
the interfacing is done. The voltage levels can be seen from the table below.
TTL
+2V to +5V
0V to +0.8V
RS-232
Logic
-15V to -3V
high
+3V to +15V
low
For this purpose we have used the hugely popular MAX 232 IC which provides an easy
solution to the logic level problems. There are two drivers and receivers in TTL as well
as RS-232 sides. The circuit provided in the datasheet is used in this project for our
purpose. We have used two such ICs for the voltage level conversions which can be
seen in the figures below:
36
5.2
In this system there are two serial communication devices but the MCU has only one
UART. So here arises the need for the line multiplexing. The line multiplexing is done
with the arrangement of logic gates which selects a particular device and making only
the logical connection between the selected device for the transmission and reception
purpose while the transmission and reception lines of the other device remains floating.
37
The IC 74LS00 has been used for the serial line multiplexing purpose. It is a quad
NAND gate IC. Two such ICs were sufficient for this design as we only require 7
NAND gates for this purpose. The design is shown in the figure below:
The pins of the IC are shown in the design. Pins not shown are the VCC and the GND.
The circuit has been designed with hit and trial basis. Necessary arrangement of the
NAND gates were laid out and the lines interconnected until we got the desired output.
The pins Micro TX and Micro RX connects to the microcontroller directly. The pins
TO GPRS and TO GPS connects to the GPRS and GPS device after the voltage level
conversion circuits. The FROM GPRS and FROM GPS pins come from the devices
after the voltage level have been converted into TTL levels. The MICRO RX is the
receiving pin ie pin 10 of the MCU.
38
The SRL_SLCT pin connects directly to the MCU. The selection of devices is shown in
the table below:SRL_SLCT
0 (LOGIC LOW)
GPS
1(LOGIC HIGH)
GPRS
In this design the input output to only one of the device is possible at a time.
5.3
In the block diagram, the general interconnection between the devices is as below:-
PPS
DCD
Tx
DTR
GPS sensor
Tx
MCU
Rx
Rx
Serial
Multiplexing
Circuit
Voltage
level
translation
Rx
DCD
GPRS terminal
Tx
39
START
Set time as
global variable
Is GPS
flag set?
Extract sender
information
Delete SMS
Connect to webserver
Any
error?
Is DCD
set?
D
Figure 6-1 Main Program Flow
40
Is
time>1s
Is
time>1s
D
C
Interrupt handler
Set the
gps flag
Is time=5?
Reset time
Return
41
The MCU with the help of the GPRS device connects to the remote server to upload the
GPS data. For this we have used the PHP script to collect the data send from the MCU
and JAVA applet to provide the information to the user about the location of the
vehicle.
7.1
PHP script
42
In our PHP program arguments are passed to the script. These argument are stored in a
file named data.txt in the form of ASCII. The file size of the data.txt file is checked to
limit its size to 500 bytes only. The stored data in file name data.txt is used as the
source for JAVA-operation. The web-server used for this project much be a PHP
powered web-server.
We can pass arguments to the PHP script with the following address line:http://xyz.com/abc.php?THIS IS THE DATA TO BE PASSED
7.2
JAVA
The JAVATM platform is based on the concept write once, run anywhere. The idea is
that the same software should run on different kinds of computers, consumer gadgets,
and other devices. The JAVA platform is being built into next generation consumer and
business devices like telephone, smart cards etc.
Java is a programming language popularly used to build programs that can work on the
Internet. Its primary features also include being object-oriented in addition to being a
cross platform language. By cross platform, we mean that its programs can run across
several platforms such as Microsoft Windows, Apple Macintosh etc. Java is not only
used for stand-alone applications or Net based programs but also to program consumer
devices and accessories such as cellular phones, palm pilots and other gadgets.
43
Programs on the internet can be either static or dynamic. Static programs though easy to
maintain are limited in scope and application. Prior to Java, there were very few means
of executing dynamic programs on the Internet. Through its special category of
programs called Applets, Java provides a powerful feature to address the issues. Applets
are Java programs that run through a Java enabled web browser. Though there are
numerous dynamic programs on the Internet such as animations or media files, applets
are intelligent programs as compared to these. An applet can react and respond to user
input and actions.
An applet has to be downloaded on the user's system before it can work. This could
mean a huge potential risk for the user's system in terms of malicious programs or
viruses. However, Java was designed in such a way that this issue was automatically
taken care of. A Java applet is designed to work in a pre-defined "sandbox". The Java
"Sandbox" theory states that the areas, which a program can access, are restricted and
controlled such that no potential damage can be caused to a user's system. This control
is exercised by the JVM or the Java Virtual Machine.
Unlike most programming languages that generate executable code after compilation,
the JVM generates byte codes as a result of compilation. Java byte codes are a form of
instructions understood by the Java Virtual Machine and usually generated as a result of
compiling Java language source code.
It is the byte codes that are downloaded every time a user wishes to run an applet on his
system. These byte codes cannot be executed without the JVM and thus they always
remain within the control of the JVM.
7.2.1
Applets
Applets are Java programs that are created specially to work on the Internet. They
run through a Java enabled browser such as Netscape or Internet Explorer. An
applet can be created using any Java development editing tool. It must be contained
or embedded within Web page or HTML file. When the Web page or HTML file is
displayed on a browser, the applet is loaded and executed.
44
7.2.2
Java Implementation
We have used Java for the translation of the coordinate points of the vehicle into a map.
The position tracked by the GPS receiver is uploaded into a Web server with the help of
a GPRS modem. These positions can be viewed by the user in an applet which runs on a
Web page.
The Java program reads the data which has been uploaded into a Web server file. These
data's are in the following format
$PGRMF,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,<12>,<13>,<14>,<15>
*hh<CR><LF>
45
<1>
<2>
<3>
<4>
<5>
<6>
<7>
Latitude hemisphere, N or S
<8>
<9>
Longitude hemisphere, E or W
<10>
<11>
<12>
<13>
<14>
<15>
*Not required
Here the only information we require are the time of position, Latitude, Longitude and
the Speed.
For example the received sentence is as follows
$PGRMF,,,12102006,061025,,2737.6476,N,8519.5555,E,A,,0.1,,,,
Our Java program first separates the useful data's such as the Latitude, Longitude,
Speed and Time and stores them in separate variables. The Longitude and Latitude
values are then plotted into a Map loaded onto an applet. The applet first loads the Map
that the latitude and longitude values confirm to. Then the positions conveyed by the
Latitude and Longitude values are plot on the Map along with the speed of the vehicle
and time of the position. These applets are run with the help of an HTML page and can
46
be viewed from any computer with an internet access and a JVM installed. The HTML
page automatically refreshes plotting the position at that time onto the MAP applet. As
our GPS receiver is initialized to receive the positional values at every 5 seconds, the
positions on the MAP applet will change every 5 seconds.
The maps images used have been obtained using the Google Earth software. The maps
images have been taken from the height of 6535 feet's from the surface of the earth. The
map images of 25 areas around the Kathmandu Valley have been used. The selection of
an appropriate map is done if the incoming latitude and longitude data lie on the
positional range of any of the 25 map image. If the incoming latitude and longitude data
does not lie on any of the 25 available map images then a blank applet is loaded and the
positional information is displayed numerically i.e. only the Latitude and Longitude
values are displayed.
One such map of the Dhapakhel area of Lalitpur is given below.
The positions have been plotted into the map with respect to the applet size which has
been set up as height=450 and width=700.
47
Start
Read the sentence
from the file
No
Yes
Select a blank
image
Stop
48
S.No
Week No
Duration
Job
1.
1-2
2.
3.
4-7
4.
8-11
5.
12
6.
13-14
7.
15
49
FINAL WORDS
9.1
Limitations
a) The main limitation of the system is that it incorporates costly devices. The
unavailability such devices inside the country has helped to raise the cost of the
devices.
b) The accuracy of the positioning system is totally based on the accuracy of the
GPS sensor. Hence accurate and costly devices required.
c) The power consumption of the components of the system are somewhat greater.
Hence frequent recharging of the battery necessary.
d) The navigation display at the vehicle shows only the latitude and longitude of
the vehicle. Hence the navigation is time consuming while translating the
coordinated to the place name.
e) The SMS response also contains the geographical information only. Hence
causes difficulty to the user.
f) Only maps of certain locations will be displayed by the Applet.
9.2
Problems Encountered
We have faced many problems and glitches during the course of our project
development. Some of the problems were solved immediately, while others used a lot
of our time. These major problems are listed below.
a) The first problem we faced was collecting the equipments required for the
project. The equipments such as the GPS receiver and the GPRS modem were
not available in the country. So they had to be acquired from abroad.
b) There were some programming problems with the MCU. Some of the results in
the programming phase were completely opposite of the expected output.
c) Secondly we experienced some problem while displaying a map applet on the
HTML page.
d) The PCB Design was a very hard-work demanding task. We had to design and
redesign the PCB for the manufacturing purpose.
50
9.3
Future Enhancements
The final output we've achieved is what we had set for. But still there is room for lots
more enhancements and additional facilities. Some of these enhancements are listed
below.
a) Currently our system is able to detect and display the positions of the vehicles
only at the 25 major areas of the Kathmandu Valley. The system can be
extended internationally after interfacing with a digital map.
b) The system provides only the current position of the vehicle but it can be
enhanced to keep track of past vehicle positions as well.
c) The SMS response could be made more meaningful than just the long-lat
information.
d) For navigation, currently we have only installed a LCD display on the vehicle.
But this can be enhanced in order to provide a digital graphical display (map) on
the vehicle itself.
e) The whole system can be made more secure to ensure that the data is only
available to the authorized person.
f) The system can be modified for remote access to any system. The monitoring
and control can also be possible.
g) The vehicles could be inter-networked and used for some automatic specialized
jobs.
9.4
Applications
Our vehicle tracking and navigation device has wide spread application. These
applications are
Vehicle Tracking
Vehicle Navigation
Fleet Management
Traffic management
Emergency abatement
51
9.5
Discussion
During the course of our project development we made ourselves familiar with different
existing technologies such as the GPS and the GPRS. We have combined the
application of both the GPS ,GPRS and the internet technology to build a vehicle
tracking and navigation system.
The GPS and GPRS devices were tested and initial settings were initialized with the
help of a PC extensively. Some of the software used were Advance Serial Port Monitor,
Hyper Terminal, Residient I/O Commander, Ethereal etc We used GARMINS
proprietary NMEA sentences to communicate with the GPS receiver, whereas used the
AT commands for the GPRS modem. The intermediate results of the portion of designs
were tested with the help of the PC and with the LCD interfaced with the system.
We have implemented the whole design in a PCB. This makes the system robust and
free from interconnection errors. Also the design can be made compact. The designed
PCB contains two layers. The ground and the supply lines are wider since they carry a
larger amount of current than that of other tracks.
Our system is able to track vehicle in 25 areas around the Kathmandu Valley. The
positions are displayed in a MAP along with the speed of the vehicle and the time of
that position. With this system it becomes easy for the users to keep track of their
vehicles. In case of the theft of the vehicles the lost vehicles can easily be traced out if
the vehicle resides in any one of our 25 maps, otherwise the positional data in terms of
latitude and longitude is provided. Also the system can be used by the Army and the
Police for Fleet Management.
With this project we have become able to implement and demonstrate a M2M
communications based system. While this undertaking has equipped us with lots of
practical knowledge and interpersonal skills we hope that it will also be a precursor to
other great applications.
52
10
REFERENCES
Books
E-books
Websites
www.garmin.com
www.gsm-modem.de
www.roundsolutoins.com
www.datasheets4u.com
www.phpit.net/article/php-on-command-line/1/
www.8051.com
www.en.wikipedia.org)
53
54
Power input
42
JP1
DS1
R2
680
LED1
41
P89C51X2BN
osc.
C15
33pf
C1
R1
10uF
+
8.2k
MAX232ACPE
33pf
C2
IC232_B
LM7805CT
XTAL
C13
+ 1uF
S1
ON
AT89C51
C3
10k
1uF
C4
1uF 1uF +
+
SW-PB
1uF
C14
R3
C11
0.1uF
C10 C12
RESET
SW-PB
C8
1uF
CHANGE
C9
C6
C5
1uF + 1uF + 1uF+ 1uF
7400_2
DM74LS00N
7400_1
DM74LS00N
44
C7
GPS
MAX232ACPE
43
COMPONENTS LAYOUT
IC232_A
APPENDIX B: DATASHEETS
58
Features
Description
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K
bytes of Flash programmable and erasable read only memory (PEROM). The device
is manufactured using Atmels high density nonvolatile memory technology and is
compatible with the industry standard 80C51 and 80C52 instruction set and pinout.
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 AT89C52 is a powerful microcomputer
which provides a highly flexible and cost effective solution to many embedded control
applications.
(continued)
Pin Configurations
P1.4
P1.3
P1.2
P1.1 (T2 EX)
P1.0 (T2)
NC
VCC
P0.0 (AD0)
P0.1 (AD1)
P0.2 (AD2)
P0.3 (AD3)
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
P0.4 (AD4)
P0.5 (AD5)
P0.6 (AD6)
P0.7 (AD7)
EA/VPP
NC
ALE/PROG
PSEN
P2.7 (A15)
P2.6 (A14)
P2.5 (A13)
(T2) P1.0
(T2 EX) P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
RST
(RXD) P3.0
(TXD) P3.1
(INT0) P3.2
(INT1) P3.3
(T0) P3.4
(T1) P3.5
(WR) P3.6
(RD) P3.7
XTAL2
XTAL1
GND
(WR) P3.6
(RD) P3.7
XTAL2
XTAL1
GND
NC
(A8) P2.0
(A9) P2.1
(A10) P2.2
(A11) P2.3
(A12) P2.4
12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
10
11
AT89C52
PDIP
PQFP/TQFP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
VCC
P0.0 (AD0)
P0.1 (AD1)
P0.2 (AD2)
P0.3 (AD3)
P0.4 (AD4)
P0.5 (AD5)
P0.6 (AD6)
P0.7 (AD7)
EA/VPP
ALE/PROG
PSEN
P2.7 (A15)
P2.6 (A14)
P2.5 (A13)
P2.4 (A12)
P2.3 (A11)
P2.2 (A10)
P2.1 (A9)
P2.0 (A8)
7
8
9
10
11
12
13
14
15
16
17
39
38
37
36
35
34
33
32
31
30
29
18
19
20
21
22
23
24
25
26
27
28
P1.5
P1.6
P1.7
RST
(RXD) P3.0
NC
(TXD) P3.1
(INT0) P3.2
(INT1) P3.3
(T0) P3.4
(T1) P3.5
6
5
4
3
2
1
44
43
42
41
40
P1.4
P1.3
P1.2
P1.1 (T2 EX)
P1.0 (T2)
NC
VCC
P0.0 (AD0)
P0.1 (AD1)
P0.2 (AD2)
P0.3 (AD3)
PLCC
(WR) P3.6
(RD) P3.7
XTAL 2
XTAL1
GND
NC
(A8) P2.0
(A9) P2.1
(A10) P2.2
(A11) P2.3
(A12) P2.4
P1.5
P1.6
P1.7
RST
(RXD) P3.0
NC
(TXD) P3.1
(INT0) P3.2
(INT1) P3.3
(T0) P3.4
iT1) P3.5
8-bit
Microcontroller
with 8K Bytes
Flash
P0.4 (AD4)
P0.5 (AD5)
P0.6 (AD6)
P0.7 (AD7)
EA/VPP
NC
ALE/PROG
PSEN
P2.7 (A15)
P2.6 (A14)
P2.5 (A13)
Rev. 0313G04/99
Block Diagram
P0.0 - P0.7
P2.0 - P2.7
PORT 0 DRIVERS
PORT 2 DRIVERS
VCC
GND
RAM ADDR.
REGISTER
B
REGISTER
PORT 0
LATCH
RAM
QUICK
FLASH
PORT 2
LATCH
STACK
POINTER
ACC
BUFFER
TMP1
TMP2
PROGRAM
ADDRESS
REGISTER
PC
INCREMENTER
ALU
INTERRUPT, SERIAL PORT,
AND TIMER BLOCKS
PROGRAM
COUNTER
PSW
PSEN
ALE/PROG
EA / VPP
TIMING
AND
CONTROL
INSTRUCTION
REGISTER
DPTR
RST
PORT 1
LATCH
PORT 3
LATCH
PORT 1 DRIVERS
PORT 3 DRIVERS
OSC
P1.0 - P1.7
AT89C52
P3.0 - P3.7
AT89C52
The AT89C52 provides the following standard features: 8K
bytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit
timer/counters, a six-vector two-level interrupt architecture,
a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89C52 is designed with static logic
for operation down to zero frequency and supports two
software selectable power saving modes. The Idle Mode
stops the CPU while allowing the RAM, timer/counters,
serial port, and interrupt system to continue functioning.
The Power Down Mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until
the next hardware reset.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups.
The Port 2 output buffers can sink/source four TTL inputs.
When 1s are written to Port 2 pins, they are pulled high by
the internal pullups 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 pullups.
Pin Description
VCC
Supply voltage.
GND
Ground.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups.
The Port 3 output buffers can sink/source four TTL inputs.
When 1s are written to Port 3 pins, they are pulled high by
the internal pullups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source
current (IIL) because of the pullups.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O 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 highimpedance inputs.
Port 0 can also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. In this mode, P0 has internal
pullups.
Port 0 also receives the code bytes during Flash programmi ng an d ou tpu ts the c o de b y tes du r in g pr o gr a m
verification. External pullups are required during program
verification.
Port Pin
Alternate Functions
P3.0
P3.1
Port 1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7
Alternate Functions
P1.0
P1.1
RST
Reset input. A high on this pin for two machine cycles while
the oscillator is running resets the device.
ALE/PROG
Address Latch Enable is an 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 1/6
the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE
3
EA/VPP
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 V C C for internal program
executions.
PSEN
Program Store Enable is the read strobe to external program memory.
This pin also receives the 12-volt programming enable voltage (V P P ) during Flash programming when 12-volt
programming is selected.
When the AT89C52 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.
XTAL1
Input to the inverting oscillator amplifier and input to the
internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
0F0H
0FFH
B
00000000
0F7H
0E8H
0E0H
0EFH
ACC
00000000
0E7H
0D8H
0DFH
0D0H
PSW
00000000
0C8H
T2CON
00000000
0D7H
T2MOD
XXXXXX00
RCAP2L
00000000
RCAP2H
00000000
TL2
00000000
TH2
00000000
0CFH
0C0H
0C7H
0B8H
0BFH
0B0H
P3
11111111
0B7H
0A8H
IE
0X000000
0AFH
0A0H
P2
11111111
0A7H
98H
SCON
00000000
90H
P1
11111111
88H
TCON
00000000
TMOD
00000000
TL0
00000000
TL1
00000000
80H
IP
XX000000
P0
11111111
SP
00000111
DPL
00000000
DPH
00000000
SBUF
XXXXXXXX
9FH
97H
AT89C52
TH0
00000000
TH1
00000000
8FH
PCON
0XXX0000
87H
AT89C52
Special Function Registers
A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1.
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
Bit Addressable
Bit
TF2
EXF2
RCLK
TCLK
EXEN2
TR2
C/T2
CP/RL2
Symbol
Function
TF2
Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. TF2 will not be set when either
RCLK = 1 or TCLK = 1.
EXF2
Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and EXEN2 =
1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine. EXF2
must be cleared by software. EXF2 does not cause an interrupt in up/down counter mode (DCEN = 1).
RCLK
Receive clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its receive clock in serial
port Modes 1 and 3. RCLK = 0 causes Timer 1 overflow to be used for the receive clock.
TCLK
Transmit clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its transmit clock in serial
port Modes 1 and 3. TCLK = 0 causes Timer 1 overflows to be used for the transmit clock.
EXEN2
Timer 2 external enable. When set, allows a capture or reload to occur as a result of a negative transition on T2EX
if Timer 2 is not being used to clock the serial port. EXEN2 = 0 causes Timer 2 to ignore events at T2EX.
TR2
C/T2
Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 = 1 for external event counter (falling edge
triggered).
CP/RL2
Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX if EXEN2 = 1. CP/RL2
= 0 causes automatic reloads to occur when Timer 2 overflows or negative transitions occur at T2EX when EXEN2
= 1. When either RCLK or TCLK = 1, this bit is ignored and the timer is forced to auto-reload on Timer 2 overflow.
Data Memory
The AT89C52 implements 256 bytes of on-chip RAM. The
upper 128 bytes occupy a parallel address space to the
Special Function Registers. That means the upper 128
bytes have the same addresses as the SFR space but are
physically separate from SFR space.
When an instruction accesses an internal location above
address 7FH, the address mode used in the instruction
specifies whether the CPU accesses the upper 128 bytes
of RAM or the SFR space. Instructions that use direct
addressing access SFR space.
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.
Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either
a timer or an event counter. The type of operation is
selected by bit C/T2 in the SFR T2CON (shown in Table 2).
Timer 2 has three operating modes: capture, auto-reload
(up or 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 1/12 of the oscillator
frequency.
Table 3. Timer 2 Operating Modes
MODE
Capture Mode
In the capture mode, two options are selected by bit
EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer
or counter which upon overflow sets bit TF2 in T2CON.
This bit can then be used to generate an interrupt. If
EXEN2 = 1, Timer 2 performs the same operation, but a 1to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and
RCAP2L, respectively. In addition, the transition at T2EX
causes bit EXF2 in T2CON to be set. The EXF2 bit, like
TF2, can generate an interrupt. The capture mode is illustrated in Figure 1.
RCLK +TCLK
CP/RL2
TR2
16-bit Auto-Reload
16-bit Capture
(Off)
OSC
C/T2 = 0
TH2
TL2
OVERFLOW
CONTROL
C/T2 = 1
TF2
TR2
CAPTURE
T2 PIN
RCAP2H RCAP2L
TRANSITION
DETECTOR
TIMER 2
INTERRUPT
T2EX PIN
EXF2
CONTROL
EXEN2
AT89C52
AT89C52
Figure 2 shows Timer 2 automatically counting up when
DCEN = 0. In this mode, two options are selected by bit
EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to
0FFFFH and then sets the TF2 bit upon overflow. The
overflow also causes the timer registers to be reloaded with
the 16-bit value in RCAP2H and RCAP2L. The values in
Timer in Capture ModeRCAP2H and RCAP2L are preset
by software. If EXEN2 = 1, a 16-bit reload can be triggered
either by an overflow or by a 1-to-0 transition at external
input T2EX. This transition also sets the EXF2 bit. Both the
TF2 and EXF2 bits can generate an interrupt if enabled.
Setting the DCEN bit enables Timer 2 to count up or down,
as shown in Figure 3. In this mode, the T2EX pin controls
OSC
C/T2 = 0
TH2
TL2
OVERFLOW
CONTROL
TR2
C/T2 = 1
RELOAD
TIMER 2
INTERRUPT
T2 PIN
RCAP2H RCAP2L
TF2
TRANSITION
DETECTOR
EXF2
T2EX PIN
CONTROL
EXEN2
Bit
T2OE
DCEN
Symbol
Function
T2OE
DCEN
12
OSC
TOGGLE
0FFH
EXF2
OVERFLOW
C/T2 = 0
TH2
TL2
TF2
CONTROL
TR2
C/T2 = 1
TIMER 2
INTERRUPT
T2 PIN
RCAP2H RCAP2L
COUNT
DIRECTION
1=UP
0=DOWN
T2EX PIN
2
"0"
"1"
C/T2 = 0
"1"
TH2
"0"
TL2
RCLK
CONTROL
TR2
16
Rx
CLOCK
C/T2 = 1
"1"
"0"
T2 PIN
TCLK
RCAP2H RCAP2L
TRANSITION
DETECTOR
16
T2EX PIN
EXF2
CONTROL
EXEN2
AT89C52
TIMER 2
INTERRUPT
Tx
CLOCK
AT89C52
Baud Rate Generator
Timer 2 is selected as the baud rate generator by setting
TCLK and/or RCLK in T2CON (Table 2). Note that the
baud rates for transmit and receive can be different if Timer
2 is used for the receiver or transmitter and Timer 1 is used
for the other function. Setting RCLK and/or TCLK puts
Timer 2 into its baud rate generator mode, as shown in Figure 4.
The baud rate generator mode is similar to the auto-reload
mode, in that a rollover in TH2 causes the Timer 2 registers
to be reloaded with the 16-bit value in registers RCAP2H
and RCAP2L, which are preset by software.
The baud rates in Modes 1 and 3 are determined by Timer
2s overflow rate according to the following equation.
Timer 2 Overflow Rate
Modes 1 and 3 Baud Rates = ----------------------------------------------------------16
increments every state time (at 1/2 the oscillator frequency). The baud rate formula is given below.
Modes 1 and 3
Oscillator Frequency
-------------------------------------- = --------------------------------------------------------------------------------------------Baud Rate
32 [ 65536 (RCAP2H,RCAP2L) ]
TH2
(8-BITS)
RCAP2L
OSC
RCAP2H
TR2
C/T2 BIT
P1.0
(T2)
T2OE (T2MOD.1)
TRANSITION
DETECTOR
P1.1
(T2EX)
EXF2
TIMER 2
INTERRUPT
EXEN2
EA
(LSB)
ET2
UART
The UART in the AT89C52 operates the same way as the
UART in the AT89C51.
ET1
EX1
Symbol
Position
Function
EA
IE.7
IE.6
Reserved.
ET2
IE.5
ES
IE.4
ET1
IE.3
EX1
IE.2
ET0
IE.1
EX0
IE.0
AT89C52
EX0
Interrupts
The AT89C52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts
(Timers 0, 1, and 2), and the serial port interrupt. These
interrupts are all shown in Figure 6.
ET0
The clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers
(RCAP2H, RCAP2L), as shown in the following equation.
Oscillator Fequency
Clock-Out Frequency = ----------------------------------------------------------------------------------------4 [ 65536 (RCAP2H,RCAP2L) ]
ES
0
INT0
IE0
1
TF0
0
INT1
IE1
1
TF1
TI
RI
TF2
EXF2
AT89C52
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively,
of an inverting amplifier that can be configured for use as
an on-chip oscillator, as shown in Figure 7. Either a quartz
crystal or ceramic resonator may be used. To drive the
device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in Figure 8.
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.
C1
XTAL1
Idle Mode
In idle mode, the CPU puts itself to sleep while all the onchip peripherals remain active. The mode is invoked by
software. The content of the on-chip RAM and all the special functions registers remain unchanged during this
mode. The idle mode can be terminated by any enabled
interrupt or by a hardware reset.
Note that when idle mode is terminated by a hardware
reset, the device normally resumes program execution
from where it left off, up to two machine cycles before the
internal reset algorithm takes control. On-chip hardware
inhibits access to internal RAM in this event, but access to
the port pins is not inhibited. To eliminate the possibility of
an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that
invokes idle mode should not write to a port pin or to external memory.
GND
Note:
EXTERNAL
OSCILLATOR
SIGNAL
XTAL2
XTAL1
GND
Program Memory
ALE
PSEN
PORT0
PORT1
PORT2
PORT3
Idle
Internal
Data
Data
Data
Data
Idle
External
Float
Data
Address
Data
Power Down
Internal
Data
Data
Data
Data
Power Down
External
Float
Data
Data
Data
11
*NOTICE:
DC Characteristics
The values shown in this table are valid for TA = -40C to 85C and VCC = 5.0V 20%, unless otherwise noted.
Symbol
Parameter
Condition
Min
Max
Units
VIL
(Except EA)
-0.5
0.2 VCC-0.1
VIL1
-0.5
0.2 VCC-0.3
VIH
0.2 VCC+0.9
VCC+0.5
VIH1
0.7 VCC
VCC+0.5
IOL = 1.6 mA
0.45
0.45
VOL
(1)
(Ports 1,2,3)
(1)
VOL1
IOL = 3.2 mA
VOH
0.75 VCC
0.9 VCC
2.4
IOH = -300 A
0.75 VCC
IOH = -80 A
IOH = -10 A
VOH1
2.4
0.9 VCC
IIL
VIN = 0.45V
-50
ITL
-650
ILI
10
RRST
300
CIO
Pin Capacitance
10
pF
ICC
50
Notes:
16
mA
VCC = 6V
100
VCC = 3V
mA
25
6.5
40
1. Under steady state (non-transient) conditions, IOL must be externally limited as follows:
Maximum IOL per port pin: 10 mA
Maximum IOL per 8-bit port:
Port 0: 26 mA
Ports 1, 2, 3: 15 mA
Maximum total IOL for all output pins: 71 mA
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test conditions.
2. Minimum VCC for Power Down is 2V.
AT89C52
Variable Oscillator
Symbol
Parameter
Min
Max
Min
Max
tXLXL
1.0
12tCLCL
tQVXH
700
10tCLCL-133
ns
tXHQX
50
2tCLCL-117
ns
tXHDX
ns
tXHDV
700
Units
10tCLCL-133
ns
tXLXL
CLOCK
tQVXH
WRITE TO SBUF
tXHQX
0
CLEAR RI
VALID
tXHDX
tXHDV
OUTPUT DATA
VALID
SET TI
VALID
VALID
VALID
VALID
VALID
Note:
20
Float Waveforms(1)
V LOAD+
0.45V
VALID
SET RI
INPUT DATA
VCC - 0.5V
AT89C52
V LOAD -
Note:
0.1V
V OL +
0.1V
Timing Reference
Points
V LOAD
V OL -
0.1V
0.1V
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
D
D
D
D
D
D
D
D
D
C1+
VS+
C1
C2+
C2
VS
T2OUT
R2IN
16
15
14
13
12
11
10
VCC
GND
T1OUT
R1IN
R1OUT
T1IN
T2IN
R2OUT
description/ordering information
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply EIA-232 voltage
levels from a single 5-V supply. Each receiver converts EIA-232 inputs to 5-V TTL/CMOS levels. These
receivers have a typical threshold of 1.3 V and a typical hysteresis of 0.5 V, and can accept 30-V inputs. Each
driver converts TTL/CMOS input levels into EIA-232 levels. The driver, receiver, and voltage-generator
functions are available as cells in the Texas Instruments LinASIC library.
ORDERING INFORMATION
ORDERABLE
PART NUMBER
PACKAGE
TA
PDIP (N)
TOP-SIDE
MARKING
Tube
MAX232N
Tube
MAX232D
MAX232DR
Tube
MAX232DW
MAX232DWR
SOP (NS)
MAX232NSR
MAX232
PDIP (N)
Tube
MAX232IN
MAX232IN
Tube
MAX232ID
MAX232IDR
Tube
MAX232IDW
MAX232IDWR
SOIC (D)
0C to 70C
SOIC (DW)
40C to 85C
SOIC (D)
SOIC (DW)
MAX232N
MAX232
MAX232
MAX232I
MAX232I
Package drawings, standard packing quantities, thermal data, symbolization, and PCB design
guidelines are available at www.ti.com/sc/package.
Please be aware that an important notice concerning availability, standard warranty, and use in critical applications of
Texas Instruments semiconductor products and disclaimers thereto appears at the end of this data sheet.
LinASIC is a trademark of Texas Instruments.
Copyright 2002, Texas Instruments Incorporated
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
Function Tables
EACH DRIVER
INPUT
TIN
OUTPUT
TOUT
OUTPUT
ROUT
14
T1IN
T1OUT
10
T2IN
T2OUT
12
13
R1OUT
R1IN
9
R2OUT
8
R2IN
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
absolute maximum ratings over operating free-air temperature range (unless otherwise noted)
Input supply voltage range, VCC (see Note 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to 6 V
Positive output supply voltage range, VS+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VCC 0.3 V to 15 V
Negative output supply voltage range, VS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to 15 V
Input voltage range, VI: Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to VCC + 0.3 V
Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 V
Output voltage range, VO: T1OUT, T2OUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VS 0.3 V to VS+ + 0.3 V
R1OUT, R2OUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to VCC + 0.3 V
Short-circuit duration: T1OUT, T2OUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Unlimited
Package thermal impedance, JA (see Note 2): D package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73C/W
DW package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57C/W
N package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67C/W
NS package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64C/W
Lead temperature 1,6 mm (1/16 inch) from case for 10 seconds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260C
Storage temperature range, Tstg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65C to 150C
Stresses beyond those listed under absolute maximum ratings may cause permanent damage to the device. These are stress ratings only, and
functional operation of the device at these or any other conditions beyond those indicated under recommended operating conditions is not
implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
NOTE 1: All voltage values are with respect to network ground terminal.
2. The package thermal impedance is calculated in accordance with JESD 51-7.
VIL
R1IN, R2IN
NOM
MAX
4.5
VCC
VIH
5.5
TA
UNIT
V
V
0.8
30
V
V
MAX232
70
MAX232I
0
40
85
electrical characteristics over recommended ranges of supply voltage and operating free-air
temperature (unless otherwise noted) (see Note 3 and Figure 4)
PARAMETER
ICC
TEST CONDITIONS
VCC = 5.5 V,
TA = 25C
Supply current
MIN
TYP
MAX
10
UNIT
mA
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
DRIVER SECTION
electrical characteristics over recommended ranges of supply voltage and operating free-air
temperature range (see Note 3)
PARAMETER
High-level output voltage
T1OUT, T2OUT
RL = 3 k to GND
VOL
T1OUT, T2OUT
MIN
TYP
TEST CONDITIONS
VOH
RL = 3 k to GND
MAX
UNIT
V
Output resistance
T1OUT, T2OUT
VS+ = VS = 0,
VO = 2 V
300
TEST CONDITIONS
SR
SR(t)
TYP
MAX
UNIT
30
See Figure 3
Data rate
MIN
RL = 3 k to 7 k,
See Figure 2
V/s
V/s
120
kbit/s
RECEIVER SECTION
electrical characteristics over recommended ranges of supply voltage and operating free-air
temperature range (see Note 3)
PARAMETER
TEST CONDITIONS
VOH
R1OUT, R2OUT
IOH = 1 mA
VOL
R1OUT, R2OUT
R1IN, R2IN
VCC = 5 V,
TA = 25C
VIT
R1IN, R2IN
VCC = 5 V,
TA = 25C
TYP
IOL = 3.2 mA
VIT+
MIN
MAX
3.5
UNIT
V
0.4
1.7
0.8
2.4
1.2
TYP
UNIT
500
ns
500
ns
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
Pulse
Generator
(see Note A)
RL = 1.3 k
R1OUT
or
R2OUT
R1IN
or
R2IN
See Note C
CL = 50 pF
(see Note B)
TEST CIRCUIT
10 ns
10 ns
Input
10%
90%
50%
90%
50%
3V
10%
0V
500 ns
tPLH
tPHL
VOH
Output
1.5 V
1.5 V
VOL
WAVEFORMS
NOTES: A. The pulse generator has the following characteristics: ZO = 50 , duty cycle 50%.
B. CL includes probe and jig capacitance.
C. All diodes are 1N3064 or equivalent.
Figure 1. Receiver Test Circuit and Waveforms for tPHL and tPLH Measurements
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
Pulse
Generator
(see Note A)
T1OUT or T2OUT
EIA-232 Output
CL = 10 pF
(see Note B)
RL
TEST CIRCUIT
10 ns
10 ns
90%
50%
Input
10%
3V
90%
50%
10%
0V
5 s
tPLH
tPHL
90%
Output
10%
10%
VOL
tTLH
tTHL
SR
VOH
90%
0.8 (V
V )
0.8 (V
V
)
OH
OL
OL
OH
or
t
t
TLH
THL
WAVEFORMS
NOTES: A. The pulse generator has the following characteristics: ZO = 50 , duty cycle 50%.
B. CL includes probe and jig capacitance.
Figure 2. Driver Test Circuit and Waveforms for tPHL and tPLH Measurements (5-s Input)
Pulse
Generator
(see Note A)
EIA-232 Output
3 k
CL = 2.5 nF
TEST CIRCUIT
10 ns
10 ns
Input
90%
1.5 V
10%
90%
1.5 V
10%
20 s
tTLH
tTHL
Output
3V
3V
3 V
3 V
SR
+t
THL
6 V
or t
VOH
VOL
TLH
WAVEFORMS
NOTE A:
The pulse generator has the following characteristics: ZO = 50 , duty cycle 50%.
Figure 3. Test Circuit and Waveforms for tTHL and tTLH Measurements (20-s Input)
MAX232, MAX232I
DUAL EIA-232 DRIVERS/RECEIVERS
SLLS047I FEBRUARY 1989 REVISED OCTOBER 2002
APPLICATION INFORMATION
5V
CBYPASS = 1 F
16
C1
C1+
1 F 3
8.5 V
1 F 5
VS
C2+
C4
+
C2
11
To CMOS or TTL
14
10
12
1 F
2
VS+
C1
4
C2
C3
VCC
13
8
9
0V
8.5 V
1 F
EIA-232 Output
EIA-232 Output
EIA-232 Input
EIA-232 Input
15
GND
C3 can be connected to VCC or GND.