P. 1
An Embedded Systems and Rfid Solution for Transport Related Issues

An Embedded Systems and Rfid Solution for Transport Related Issues

3.0

|Views: 507|Likes:
Published by balu54
for accident detection
for accident detection

More info:

Categories:Types, School Work
Published by: balu54 on May 01, 2011
Copyright:Attribution Non-commercial
List Price: $4.99 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
See more
See less

07/06/2015

$4.99

USD

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES

CHAPTER -1 INTRODUCTION TO EMBEDDED SYSTEMS
1.1 WHAT IS AN EMBEDDED SYSTEM?
An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called “firm ware”. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed. 1.1.1 HISTORY In the earliest years of computers in the 1940s, computers were sometimes dedicated to a single task, but were too large to be considered "embedded". Over time however, the concept of programmable controllers developed from a mix of computer technology, solid state devices, and traditional electromechanical sequences. The first recognizably modern embedded system was the Apollo Guidance Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo project. The use of the then new monolithic integrated circuits, to reduce the size and weight, increased this risk. The first mass-produced embedded system was the Autonetics D-17 guidance computer for the Minuteman (missile), released in 1961. It was built from transistor logic and had a hard disk for main memory. When the Minuteman II went into production in 1966, the D-17 was

DEPT OF ECE, SSNEC

Page 1

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES

replaced with a new computer that was the first high-volume use of integrated circuits. This program alone reduced prices on quad nand gate ICs from $1000/each to $3/each, permitting their use in commercial products. Since these early applications in the 1960s, embedded systems have come down in price. There has also been an enormous rise in processing power and functionality. For example the first microprocessor was the Intel 4004, which found its way into calculators and other small systems, but required external memory and support chips. In 1978 National Engineering Manufacturers Association released the standard for a programmable microcontroller. The definition was an almost any computer-based controller. They included single board computers, numerical controllers, and sequential controllers in order to perform event-based instructions. By the mid-1980s, many of the previously external system components had been integrated into the same chip as the processor, resulting in integrated circuits called microcontrollers, and widespread use of embedded systems became feasible. As the cost of a microcontroller fell below $1, it became feasible to replace expensive knob-based analog components such as potentiometers and variable capacitors with digital electronics controlled by a small microcontroller with up/down buttons or knobs. By the end of the 80s, embedded systems were the norm rather than the exception for almost all electronics devices, a trend which has continued since.

1.2 EMBEDDED SYSTEMS ARE CHARACTERIZED BY SOME SPECIAL FEATURES LISTED BELOW
 Embedded systems do a very specific task; they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the C DROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called realDEPT OF ECE, SSNEC Page 2

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES

time systems, the deadlines are stringent. Missing a deadline may cause a catastropheloss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low.  Embedded systems need to be highly reliable. Once in a while, pressing ALT-CTRLOEL is OK on your desktop, but you cannot afford to reset your embedded system.  Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.  Embedded systems that address the consumer market (for exam-ple, electronic toys) are very cost-sensitive: Even a reduction of $0.1 is lot of cost saving, because thousands or millions systems may be sold.  Unlike desktop computers in which the hardware platform is dominated by Intel and the operating system is dominated by Microsoft, there is a wide variety of processors and operating systems for the embedded systems. So, choosing the right plat-form is the most complex task. 1.2.1 APPLICATION AREAS Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very market segment- consumer electronics, office automation, industrial automation, biomedical engineering, wireless communication, data communication, telecommunications, transportation, military and so on. 1.2.2 CONSUMER APPLIANCES At home we use a number of embedded systems which include digital camera, digital DEPT OF ECE, SSNEC Page 3

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES diary. air-conditioning. navigation etc. and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station. where human presence has to be avoided. robots are used. engine spark control. electricity generation and transmission.3 CATEGORIES OF EMBEDDED SYSTEMS Based on functionality and performance requirements. embedded systems can be categorized as: • • • • Stand-alone embedded systems Real-time systems Networked information appliances Mobile devices DEPT OF ECE. electronic toys. These include pharmaceutical. VCO player. cement. 1. voltage.3 OFFICE AUTOMATION The office automation products using embedded systems are copying machine. oil exploration. remote controls for TV and airconditioner. video recorders etc.2. microwave oven. printer. DVD player. The robots are now becoming very powerful and carry out many interesting and complicated tasks such as hardware assembly.. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature. modem. The palmtops are powerful embedded systems using which we can carry out many general-purpose tasks such as playing games and word processing. nuclear energy. key telephone. humidity. video game consoles. Industrial automation: Today a lot of industries use embedded systems for process control. pressure. which are programmed to do specific jobs. current etc. fax machine. Today’s high-tech car has about 20 embedded systems for transmission control. Even wristwatches are now becoming embedded systems. 1. SSNEC Page 4 . In hazardous industrial environment. sugar. scanner etc.

1 STAND ALONE EMBEDDED SYSTEMS As the name implies. automobiles. consider a DVD player. an LED display or LCD display for displaying of information to the users. If the valve is not opened within 30 milliseconds. you give a command to the DVD player from are mote control. fall into this category. process them and produce the desired output. deadlines are imposed. Embedded systems used in process co~1’rol. consumer electronic items etc.2 REAL TIME SYSTEMS Embedded systems in which some specific work has to be done in a specific time period are called real-time systems. Such systems with strict deadlines are called hard real-time systems.3.3. In some embedded systems. the inputs are from sensors that convert a physical entity such as temperature or pressure into its equivalent electrical signal. stand-alone systems work in stand-alone mode. They take inputs. The output can be electrical signals to drive another system. Suppose. A few embedded systems used at home are shown in fig Figure1-1 stand alone embedded systems at home 1. and there is a DEPT OF ECE. but not adhering to them once in a while may not lead to a catastrophe. For example: consider a system that has to open a valve within 30milliseconds when the humidity crosses a particular threshold. The input can be electrical signals from transducers or commands from a human being such as the pressing of a button. SSNEC Page 5 . a catastrophe may occur. For example.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 1. These electrical signals are processed by the system and the appropriate electrical signals are produced using which an action is taken such as opening a valve. In a process control system.

typically a network running TCP/IP (Transmission Control Protocol! Internet Protocol) protocol suite. SSNEC Page 6 . Here are some examples of such systems: Figure 1-3 Networked Information Appliance DEPT OF ECE. such as the Internet or a company’s Intranet. Figure 1-2 Hard Real Time embedded Systems 1.3 NETWORKED INFORMATION APPLIANCES Embedded systems that are provided with network interfaces and accessed by networks such as Local Area Network or the Internet are called networked information appliances. Such embedded systems are connected to a network. Such systems are called soft real-time systems.3.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES delay of a few milliseconds in executing that command. this delay won’t lead to a serious simplification. These systems have emerged in recent years These systems run the protocol TCP/IP stack and get connected either through PPP or Ethernet to a network and communicate with other nodes in the network. But.

and small character.4 MOBILE DEVICES Mobile devices such as mobile phones. with touch sensing or screen-edge buttons provides flexibility while minimizing space used: the meaning of the buttons can change with the screen. Handheld systems often have a screen with a "joystick button" for a pointing device. Though the PDAs do many general purpose tasks. In More Complex Systems A full graphical screen. games. mobile devices are considered as embedded systems. lack of good user interfaces such as full-fledged keyboard and display etc. and selection involves the natural behavior of pointing at what's desired. This avoids the cost of a sophisticated display. In particular.3. routers take advantage of this ability. SSNEC Page 7 .-are same as those found in the embedded systems discussed above. etc. are a special category of embedded systems.or digit-only displays. This is successful for remote. Personal Digital Assistants (PDAs). However. yet provides complex input and display capabilities when needed. often with a simple menu system.to full user interfaces similar to desktop operating systems in devices such as PDAs. permanently installed equipment. LEDs.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 1. Hence. they need to be designed just like the ‘conventional’ embedded systems. The rise of the World Wide Web has given embedded designers another quite different option: providing a web page interface over a network connection.memory constraints. small size. on another computer. The limitations of –the mobile devices. Simple Systems Simple embedded devices use buttons. DEPT OF ECE. the PDAs are now capable of supporting general-purpose application software such as word processors.dedicated only to one task . smart phones etc. User Interfaces Embedded systems range from no user interface at all .

PowerPC. V850. for which the CPU core was purchased and added as part of the chip design. RS-422. Z80. such as:       Serial Communication Interfaces (SCI): RS-232. they may also use some more specific tools:  An in-circuit emulator (ICE) is a hardware device that replaces or plugs into the microprocessor. There are many different CPU architectures used in embedded designs such as ARM. embedded system designers use compilers. A related scheme is to use a field-programmable gate array (FPGA). including the CPU. SSC and ESSI Universal Serial Bus (USB) Networks: Controller Area Network. FR-V. However. assemblers. an application-specific integrated circuit (ASIC).4. 1. x86. etc Timers: PLL(s). etc. Z8. RS-485 etc Synchronous Serial Communication Interface: I2C. Coldfire/68k.4 PERIPHERALS Embedded Systems talk with the outside world via peripherals. 8051.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES CPU Platform Embedded processors can be broken into two distinct categories: microprocessors (μP) and micro controllers (μC). reducing size of the system. SH. and debuggers to develop embedded system software. JTAG. Lan Works. M32R. Renesas H8. Atmel AVR. PIC. and provides facilities to quickly load and debug experimental code in the system. Micro controllers have built-in peripherals on the chip.1 TOOLS As for other software. A common configuration for very-high-volume embedded systems is the system on a chip (SoC). MIPS. Capture/Compare and Time Processing Units Discrete IO: aka General Purpose Input Output (GPIO) 1. SSNEC Page 8 . SPI. DEPT OF ECE. and program it with all the logic.

development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor DEPT OF ECE. An embedded system may have its own special language or design tool. For systems using digital signal processing. so the embedded system can check if the program is valid. Custom compilers and linkers may be used to improve optimization for the particular hardware.    Software tools can come from several sources:    Software companies that specialize in the embedded market Ported from the GNU software development tools Sometimes. or add enhancements to an existing language. developers may use a math workbench such as MathCAD or Mathematic to simulate the mathematics.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES  Utilities to add a checksum or CRC to a program. SSNEC Page 9 .

single chip microcontroller (µC) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s. I/O ports and a timer embedded all on a single chip. 8051 is available in different memory types such as UV-EPROM. RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. Microcontroller is a programmable device. The fixed amount of on-chip ROM. Infineon Technologies and Maxim Integrated Products. meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. but today it has largely been superseded by a vast range of enhanced devices with 8051-compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel. The Intel 8051 is Harvard architecture. SSNEC Page 10 . Flash and NV-RAM. DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES CHAPTER -2 INTRODUCTION TO MICROCONTROLLERS 2. ROM. A microcontroller has a CPU in addition to a fixed amount of RAM. 8051 is an 8-bit processor.1 MICROCONTROLLER Microprocessors and microcontrollers are widely used in embedded systems products.

2 FEATURES OF AT89S52 8K Bytes of Re-programmable Flash Memory. SSNEC Page 11 . 256 x 8-bit Internal RAM. Full Duplex UART Serial Channel. Three 16-bit Timer/Counters. Interrupt recovery from power down mode. the Atmel AT89s52 is a powerful microcomputer. Fully Static Operation: 0 Hz to 33 MHz’s Three-level Program Memory Lock. 32 Programmable I/O Lines. DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 2. Eight Interrupt Sources.5V Operating Range. Flexible ISP programming (byte and page mode). which provides a highly flexible and cost-effective solution to many embedded control applications. RAM is 256 bytes.0V to 5. 2. Dual data pointer. By combining a versatile 8-bit CPU with Flash on a monolithic chip. The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on chip flash allows the program memory to be reprogrammed in system or by a conventional non volatile memory programmer. high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable memory.3 DESCRIPTION OF MICROCONTROLLER The AT89s52 is a low-voltage. Low-power Idle and Power-down Modes. Fast programming time. Watchdog timer. Power-off flag. 4.

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES In addition. SSNEC Page 12 . Figure 2-1 Pin Diagram DEPT OF ECE. The Idle Mode stops the CPU while allowing the RAM. The power-down mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. the AT89s52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. timer/counters. serial port and interrupt system to continue functioning.

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Figure 2-2 Block Diagram DEPT OF ECE. SSNEC Page 13 .

Table 2-1 Description Of Port 1 Pins DEPT OF ECE.3 PIN DESCRIPTION VCC Pin 40 provides supply voltage to the chip.1/T2EX).AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 2. the pins can be used as high impedance inputs. In addition.0 and P1. each pin can sink eight TTL inputs. as shown in the following table. P1. In this mode. Port 1 also receives the low-order address bytes during Flash programming and verification. they are pulled high by the internal pull-ups and can be used as inputs. External pull-ups are required during program verification. P0 has internal pull-ups. The voltage source is +5V. Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. As an output port. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during Program verification. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. PORT 0 Port 0 is an 8-bit open drain bidirectional I/O port. The Port 1 output buffers can sink/source four TTL inputs.1 can be configured to be the timer/counter 2 external count input (P1. As inputs. GND Pin 20 is the ground. PORT 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. When 1s are written to Port 1 pins. When 1s are written to port 0 pins.0/T2) and the timer/counter 2 trigger input (P1. respectively. SSNEC Page 14 .

When 1s are written to Port 3 pins. Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. they are pulled high by the internal pull-ups and can be used as inputs. Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In this application. they are pulled high by the internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). Table 2-2 Description of Port 3 Pins DEPT OF ECE. The Port 2 output buffers can sink/source four TTL inputs. SSNEC Page 15 . As inputs. Port 2 emits the contents of the P2 Special Function Register. The port also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI). The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins. as shown in the following table. Port 2 uses strong internal pull-ups when emitting 1s. As inputs.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES PORT 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 receives some control signals for Flash programming and verification. PORT 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups.

This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. PSEN is activated twice each machine cycle. however. ALE / PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. PSEN Program Store Enable (PSEN) is the read strobe to external program memory. In normal operation. that one ALE pulse is skipped during each access to external data memory. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. SSNEC Page 16 . This pin is also the program pulse input (PROG) during Flash programming. DEPT OF ECE. 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. that if lock bit 1 is programmed. however. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. This pin drives high for 98 oscillator periods after the Watchdog times out. the RESET HIGH out feature is enabled. ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. In the default state of bit DISRTO. When the AT89S52 is executing code from external program memory. Note.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES RST Reset input A high on this pin for two machine cycles while the oscillator is running resets the device. Note. except that two PSEN activations are skipped during each access to external data memory. XTAL2 Output from the inverting oscillator amplifier.

To drive the device from an external clock source. It should be noted that not all of the addresses are occupied and unoccupied addresses may not be implemented on the chip. since the input to the internal clocking circuitry is through a divide-bytwo flip-flop. XTAL2 should be left unconnected while XTAL1 is driven. respectively. but minimum and maximum voltage high and low time specifications must be observed. SSNEC Page 17 . 2. of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used.4 SPECIAL FUNCTION REGISTERS A map of the on-chip memory area called the Special Function Register (SFR) space is shown in the following table. C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators External Clock Drive Configuration XTAL1 and XTAL2 are the input and output.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Oscillator Connections C1. Read accesses to these DEPT OF ECE. There are no requirements on the duty cycle of the external clock signal.

since they may be used in future products to invoke new features. SSNEC Page 18 . Table 2-3 AT89S52 SFR Map and Reset Values DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES addresses will in general return random data. User software should not write 1s to these unlisted locations. and write accesses will have an indeterminate effect. In that case. the reset or inactive values of the new bits will always be 0.

if EA is connected to VCC. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. the following indirect addressing instruction.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Power off Flag The Power Off Flag (POF) is located at bit 4 (PCON. accesses the data byte at address 0A0H. For example. Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. Instructions which use direct addressing access the SFR space. the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Program Memory If the EA pin is connected to GND. The upper 128 bytes occupy a parallel address space to the Special Function Registers. program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory.4) in the PCON SFR. #data The instructions that use indirect addressing access the upper 128 bytes of RAM. MOV @R0. When an instruction accesses an internal location above address 7FH. It can be set and rest under software control and is not affected by reset. For example. the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). #data DEPT OF ECE. all program fetches are directed to external memory. SSNEC Page 19 . rather than P2 (whose address is 0A0H). MOV 0A0H. Up to 64K bytes each of external Program and Data Memory can be addressed. On the AT89S52. POF is set to “1” during power up. where R0 contains 0A0H.

For timer operation (C/Tx# = 0).AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES It should be noted that stack operations are examples of indirect addressing.e. They can be read at any time but TRx bit must be cleared to preset their values. when THx overflows it sets the timer overflow flag(TFx) in TCON register. Setting the run control bit (TRx) in TCON register turns the timer on by allowing the selected input to increment TLx. When operating as a timer. They are identified as Timer 0. After a preset number of counts. The timer clock rate is FPER / 6. The timer register is incremented once every peripheral cycle (6 peripheral clock periods). otherwise the behavior of the timer/counter is unpredictable. otherwise the behavior of the timer/counter is unpredictable. 1) connected in cascade to form a 16-bit timer. When operating as a counter. The external input is sampled every peripheral cycle. Timer registers can be accessed to obtain the current count or to enter preset values. FOSC / 12 in standard mode or FOSC / 6 inX2 mode For counter operation (C/Tx# = 1). i. the timer register counts the divided-down peripheral clock. SSNEC Page 20 . by selecting the divided-down peripheral clock or external pin Tx as the source for the counted signal. TRx bit must be cleared when changing the mode of operation. the timer/counter runs for a programmed length of time and then issues an interrupt request. A basic operation consists of timer registers THx and TLx (x= 0. Setting the TRx does not clear the THx and TLx timer registers. the timer register counts the negative transitions on the Tx external input pin. The C/T control bit (in TCON register) selects timer operation or counter operation. The various operating modes of each timer/counter are described in the following sections. the counter issues an interrupt request. When the sample is high in one cycle and low in the next one. UART The Atmel 8051 Microcontrollers implement three general purpose. so the upper 128 bytes of data RAM are available as stack space. 16-bit timers/ counters. When TLx overflows it increments THx. the timer/counter counts negative transitions on an external pin. the counter is incremented. DEPT OF ECE. Timer 1 and Timer 2 and can be independently configured to operate in a variety of modes as a timer or as an event counter.

TIMER 0 Timer 0 functions as either a timer or event counter in four modes of operation. generating an interrupt request. 4 and 5 of the TCON register. There are no restrictions on the duty cycle of the external input signal. but to ensure that a given level is sampled at least once before it changes. Timer 2. The four operating modes are described below. has three modes of operation: ‘capture’. the maximum count rate is FPER / 12. Mode 3 is different. setting TR0 allows TL0 to be incremented by the selected input. Timer 0 overflow(count rolls over from all 1s to all 0s) sets TF0 flag. interrupt flag (IE0) and interrupt type control bit (IT0). Timer 0 and Timer 1 have four operating modes from which to select which are selected by bit-pairs (M1.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Since it takes 2 cycles (12 peripheral clock periods) to recognize a negative transition. In addition to the “timer” or “counter” selection. The upper three bits of TL0 register are indeterminate and should be ignored. ‘auto-reload’ and ‘baud rate generator’. FOSC / 24 in standard mode or FOSC / 12 in X2mode. timer or counter operation (T/C0#) and mode of operation (M10and M00). Timer 0 is controlled by the four lower bits of the TMOD register and bits0. i. It is important to stop timer/counter before changing mode. 1and 2 are the same for both timer/counters. Prescaler overflow increments the TH0 register. it should be held forat least one full peripheral cycle. 1. M0) in TMOD. For normal timer operation (GATE0= 0). Modes 0.e. The TCON register provides timer 0 control functions: overflow flag (TF0). run control bit (TR0). TMOD register selects the method of timer gating (GATE0). Setting GATE0 and TR0 allows external pin INT0# to control timer operation. SSNEC Page 21 . Mode 0 (13-bit timer) Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0 register)with a modulo-32 prescaler implemented with the lower five bits of the TL0 register. DEPT OF ECE.

The selected input increments the TL0 register.3).Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers connected in cascade. except that the Timer register is being run with all 16bits. GATE is in TMOD. Setting the run flag (TR0) does not clear the registers. There are two different GATE bits.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES As the count rolls over from all 1’s to all 0’s.(Setting GATE = 1 allows the Timer to be controlled by external input INT0. it sets the timer interrupt flag TF0. The upper 3bits of TL0 are indeterminate and should be ignored. TR0 is a control bit in the Special Function register TCON. to facilitate pulse width measurements). The 13-bit register consists of all 8 bits of TH0 and the lower 5 bits of TL0. DEPT OF ECE. one for Timer 1 (TMOD. The counted input is enabled to the Timer when TR0 = 1 and either GATE = 0 or INT0 = 1.7) and one for Timer 0 (TMOD. SSNEC Page 22 . Mode 0 operation is the same for Timer 0 as for Timer 1. Timer/Counter x (x = 0 or 1) in Mode 0 Figure 2-4 Timer/Counter in Mode 0 Mode 1 (16-bitTimer) Mode 1 is the same as Mode 0.

DEPT OF ECE.Mode 2 operation is the same for Timer/Counter 1. SSNEC Page 23 . The next reload value may be changed at any time by writing it to the TH0register. TL0 overflow sets TF0 flag in the TCON register and reloads TL0 with the contents of TH0. Timer/Counter x (x = 0 or 1) in Mode 2 Figure 2-6 Timer/Counter in mode2 Mode 3 (Two 8-bitTimers) Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. which is preset by software. When the interrupt request is serviced.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Timer/Counter x (x = 0 or 1) in Mode 1 Figure 2-5 Timer/counter in mode1 Mode 2 (8-bit Timer with Auto-Reload) Mode 2 configures timer 0 as an 8-bit timer (TL0 register) that automatically reloads from the TH0 register. This mode is provided for applications requiring an additional 8-bittimer or counter. The reload leaves TH0unchanged. hardware clears TF0.

Timer1’s mode 3 is a hold-count mode. except for mode 3. The following comments help to understand the differences:  • Timer 1 functions as either a timer or event counter in three modes of operation.  For normal timer operation (GATE1 = 0). Thus.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES TL0 uses the timer 0 control bits C/T0# and GATE0 in the TMOD register. Timer/Counter 0 in Mode 3: Two 8-bit Counters Figure 2-7 Timer/Counter in Mode 3 Timer 1: Timer 1 is identical to timer 0. setting TR1 allows TL1 to be incremented by the selected input. 3. and TR0 and TF0 in the TCON register in the normal manner. Setting GATE1 and TR1 allows external pin INT1# to control timer operation. run control bit (TR1). TH0 is locked into a timer function (counting FPER /6) and takes over use of the timer 1 interrupt (TF1) and run control (TR1) bits. SSNEC Page 24 . DEPT OF ECE. interrupt flag (IE1) and interrupt type control bit (IT1). The TMOD register selects the method of timer gating (GATE1). The TCON register provides timer 1 control functions: overflow flag (TF1). timer or counter operation (C/T1#) and mode of operation (M11 and M01). Mode 2 is best suited for this purpose.  • Timer 1 is controlled by the four high-order bits of the TMOD register and bits 2. which is a hold-count mode.  Timer 1 can serve as the baud rate generator for the serial port. 6 and 7 of the TCON register. operation of timer 1 is restricted when timer 0 is in mode 3.

which is set up as an 8-bit timer (TH1 register)with a modulo-32 prescaler implemented with the lower 5 bits of the TL1 register. use timer 1 only for applications that do not require an interrupt (such as a baud rate generator for the serial port) and switch timer 1 in and out of mode 3 to turn it off and on. TL1 overflow sets the TF1 flag in the TCON register and reloads TL1 with the contents of TH1.. which is preset by software. The reload leaves TH1 unchanged. Mode 3 (Halt) Placing Timer 1 in mode 3 causes it to halt and hold its count.e. it uses timer 1’s overflow flag (TF1) and run control bit (TR1). The selected input increments the TL1 register.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES  Timers 1 overflow (count rolls over from all 1s to all 0s) sets the TF1 flag generating an interrupt request. Mode 0 (13-bitTimer) Mode 0 configures Timer 1 as a 13-bit timer. This can be used to halt Timer 1 when TR1 run control bit is not available i. SSNEC Page 25 . Prescaler overflowincrements the TH1 register.  When timer 0 is in mode 3. when Timer 0 is in mode 3. Mode 1 (16-bitTimer) Mode 1 configures Timer 1 as a 16-bit timer with the TH1 and TL1 registers connected in cascade. The upper 3 bits of the TL1 register are ignored. Mode 2 (8-bit Timer with Auto Reload) Mode 2 configures Timer 1 as an 8-bit timer (TL1 register) with automatic reload from the TH1 register on overflow.  It is important to stop timer/counter before changing modes. For this situation. DEPT OF ECE.

To ensure that a given level is sampled at least once before it changes. In the Timer function.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. In this function. Timer 2 consists of two 8-bit registers. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. When the samples show a high in one cycle and a low in the next cycle. Since a machine cycle consists of 12 oscillator periods. the register is incremented in response to a 1-to-0 transition at its corresponding external input pin. The type of operation is selected by bit C/T2 in the SFR T2CON. the TL2 register is incremented every machine cycle. TH2 and TL2. and baud rate generator. DEPT OF ECE. T2. Timer 2 has three operating modes: capture. Table 2-4 Timer 2 Operating Modes In the Counter function. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition. The modes are selected by bits in T2CON. the count is incremented. auto-reload (up or down counting). SSNEC Page 26 . the external input is sampled during S5P2 of every machine cycle. the maximum count rate is 1/24 of the oscillator frequency. the count rate is 1/12 of the oscillator frequency. the level should be held for at least one full machine cycle.

SSNEC Page 27 .AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES CHAPTER -3 DESCRIPTION OF MODULES 3.1 BLOCK DIAGRAM gsm 8051 rfid DEPT OF ECE.

each of which performs a particular function. Smoothing .2 POWER SUPPLY There are many types of power supply. SSNEC Page 28 .converts AC to DC.smoothes the DC from varying greatly to a small ripple. Power supplies made from these blocks are described below with a circuit diagram and a graph of their output: • • • • Transformer only Transformer + Rectifier Transformer + Rectifier + Smoothing Transformer + Rectifier + Smoothing + Regulator DEPT OF ECE. Most are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. but the DC output is varying.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 3.steps down high voltage AC mains to low voltage AC. Rectifier .eliminates ripple by setting DC output to a fixed voltage. For example a 5V regulated supply: Figure 3-1 Block Diagram of a Regulated power Supply System Each of the blocks is described in more detail below: • • • • Transformer . A power supply can by broken down into a series of blocks. Regulator .

This is called a 'dual supply' because it is like two ordinary supplies connected together as shown in the diagram. DEPT OF ECE.2. Dual supplies have three outputs. heaters and standard motors.1 DUAL SUPPLIES Some electronic circuits require a power supply with positive and negative outputs as well as zero volts (0V). for example a ±9V supply has +9V.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 3. Transformer + Rectifier The varying DC output is suitable for lamps. 0V and -9V outputs TRANSFORMER ONLY The low voltage AC output is suitable for lamps. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor. SSNEC Page 29 . It is not suitable for electronic circuits unless they include a smoothing capacitor. heaters and special AC motors.

step-down transformers reduce voltage. The input coil is called the primary and the output coil is called the secondary.2 TRANSFORMER Transformers convert AC electricity from one voltage to another with little loss of power. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage. DEPT OF ECE. It is suitable for all electronic circuits.2.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Transformer + Rectifier + Smoothing The smooth DC output has a small ripple. instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. Transformers work only with AC and this is one of the reasons why mains electricity is AC. 3. It is suitable for most electronic circuits. SSNEC Page 30 . The two lines in the middle of the circuit symbol represent the core. TRANSFORMER + RECTIFIER + SMOOTHING + REGULATOR The Regulated DC output is very smooth with no ripple. There is no electrical connection between the two coils. Step-up transformers increase voltage.

turns ratio = Vp Vs = Np Ns and power out = power in Vs × Is = Vp × Ip Vp = primary (input) voltage Vs = secondary (output) voltage Np = number of turns on primary coil Ip = primary (input) current Ns = number of turns on secondary coil Is = secondary (output) current Figure 3-2 Transformer circuit symbol 3.3 RECTIFIER DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Transformers waste very little power so the power out is (almost) equal to the power in. determines the ratio of the voltages. and a small number of turns on its secondary (output) coil to give a low output voltage. Note that as voltage is stepped down current is stepped up. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply. SSNEC Page 31 . The ratio of the number of turns on each coil.2. called the turns ratio.

1. but it is also available in special packages containing the four diodes required. but this method is rarely used now that diodes are cheaper. SSNEC Page 32 . It is hard to smooth this sufficiently well to supply DEPT OF ECE.7V when conducting and there are always two diodes conducting. Output: full-wave varying DC Figure 3-3 Bridge rectifier 3.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES There are several ways of connecting diodes to make a rectifier to convert AC to DC. It is called a full-wave rectifier because it uses all the AC wave (both positive and negative sections). as shown in the diagram below. 3. including pictures of bridge rectifiers.2.4 BRIDGE RECTIFIER A bridge rectifier can be made using four individual diodes. A full-wave rectifier can also be made from just two diodes if a centre-tap transformer is used. The bridge rectifier is the most important and it produces full-wave varying DC.4V is used up in the bridge rectifier because each diode uses 0. Please see the Diodes page for more details.2. A single diode can be used as a rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave varying DC.5 SINGLE DIODE RECTIFIER A single diode can be used as a rectifier but this produces half-wave varying DC which has gaps when the AC is negative. Bridge rectifiers are rated by the maximum current they can pass and the maximum reverse voltage they can withstand (this must be at least three times the supply RMS voltage so the rectifier can withstand the peak voltages).

4V smooth DC. Note that smoothing significantly increases the average DC voltage to almost the peak value (1. The capacitor charges quickly near the peak of the varying DC.2. The capacitor value must be doubled when smoothing half-wave DC.4 × RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES electronic circuits unless they require a very small current so the smoothing capacitor does not significantly discharge during the gaps. Smoothing is not perfect due to the capacitor voltage falling a little as it discharges. Single diode rectifier Output: half-wave varying DC (using only half the AC wave) Figure 3-4 Single diode rectifier 3.4 × 4. and then discharges as it supplies current to the output.6V RMS (1. with smoothing this increases to almost the peak value giving 1.4V is lost in the bridge rectifier). DEPT OF ECE.6 SMOOTHING Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). supplying current to the output when the varying DC voltage from the rectifier is falling. A larger capacitor will give less ripple.6 = 6. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. SSNEC Page 33 . Please see the Diodes page for some examples of rectifier diodes. giving a small ripple voltage.

Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). 50Hz in the UK 5 × Io Vs × f 3. Negative voltage regulators are available. this is the peak value of the unsmoothed DC f = frequency of the AC supply in hertz (Hz). such as the 7805 +5V 1A regulator shown on the right. They are also rated by the maximum current they can pass. SSNEC Page 34 . They include a hole for attaching a heat sink if necessary.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Figure 3-5 Smoothing circuit diagram Smoothing capacitor for 10% ripple. C = C = smoothing capacitance in farads (F) Io = output current from the supply in amps (A) Vs = supply voltage in volts (V). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors. mainly for use in dual supplies. 12 and 15V) or variable output voltages. DEPT OF ECE.7 REGULATORS Voltage regulator ICs are available with fixed (typically 5.2.

e. And if operated in 4-bit mode then 4 data lines + 3 control lines i. How do we decide which mode to use? It’s simple if you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i. SSNEC Page 35 . display should be faster then we have to use 8-bit mode because basically 4-bit mode takes twice as more time as compared to 8-bit mode.e. If operated in 8-bit mode then 8 data lines + 3 control lines i.3 LCD DISPLAY Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Figure 3-6 Regulator circuit 3. The LCD requires 3 control lines (RS. total 11 lines are required. The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters). The number on data lines depends on the mode of operation.e. The most common type of LCD controller is HITACHI 44780 which provides a simple interface between the controller & an LCD. Most projects you create with the 8051 CPU require some form of display. 7 lines are required. 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line). DEPT OF ECE. LCDs have become a cheap and easy way to get text display for embedded system Common displays are set up as 16 to 20 characters by 1 to 4 lines. R/W & EN) & 8 (or 4) data lines. The most common way to accomplish this is with the LCD (Liquid Crystal Display). These LCD's are very simple to interface with the controller as well as are cost effective.

When RW is high (1). When R/W is low (0). Alphanumeric characters are sent in ASCII format. the data is to be treated as a command. the information on the data bus is being written to the LCD.LOW signal is required to latch the data.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES When RS is low (0). your instruction will never be executed. The ENABLE pin is used to latch the data present on the data pins. When RS is high (1). the program is effectively reading from the LCD. The LCD interprets and executes our command at the instant the EN line is brought low. If you never bring EN low. • R/W: Read or Write RS = 0 -> Command Register is selected RS = 1 -> Data Register is selected DEPT OF ECE. A HIGH . the data being sent is considered as text data which should be displayed on the screen. SSNEC Page 36 . Most of the times there is no need to read from the LCD so this line can directly be connected to Gnd thus saving one controller line. Figure 3-7 Pindiagram of LCD UNDERSTANDING LCD Pin outline • RS: Register Select • 8 data pins D7:D0 Bi-directional data/command pins.

2 Character Generator RAM (CGRAM)-User defined character RAM In the character generator RAM.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 0 -> Write. 3.allowing for eight 5*8 pixel. we require to manipulate address and then to set cursor position accordingly . But for second line address of first character is 40h and so on up to 4Fh for the 16th character. we can define our own character patterns by program. However. So I will not talk any more about CGRAM DEPT OF ECE. when reading from the display. Its capacity is 80 characters (bytes). the area shaded in black is the visible display (For 16x2 displays). data is transferred only on the high to low transition of this signal.3. A high-to-low edge is needed to latch the data. 3. character patterns to be defined. So if you want to display the text at specific positions of LCD . SSNEC Page 37 . However how to define this and use it is out of scope of this tutorial. • VEE: contrast control NOTE: When writing to the display. data will become available shortly after the low to high transition and remain available until the signal falls low again.3. CG RAM is 64 bytes . It stores display data represented in 8-bit character codes. 1 -> Read • E: Enable (Latch data) Used to latch the data present on the data pins.1 Display Data RAM (DDRAM) Display data RAM (DDRAM) is where you send the characters (ASCII code) you want to see on the LCD screen. In the above memory map. For first line addresses for first 15 characters is from 00h to 0Fh. Below you see DD RAM address layout of a 2*16 LCD.

3.3. See the table below: Register Selection RS R/WOperation 0 0 IR write as an internal operation (display clear. an instruction register (IR) and a data register (DR). the busy flag is output to DB7 (MSB of LCD data bus). .3.3 Registers The HD44780 has two 8-bit registers. etc. Data written into the DR is automatically written into DDRAM or CGRAM by an internal operation. The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily stores data to be read from DDRAM or CGRAM. SSNEC Page 38 . and the next instruction will not be accepted.4 LCD Commands DEPT OF ECE.) 0 1 Read busy flag (DB7) and address counter (DB0 to DB6) 1 0 DR write as an internal operation (DR to DDRAM or CGRAM) 1 1 DR read as an internal operation (DDRAM or CGRAM to DR) Table 3-1 Register selection Busy Flag (BF) When the busy flag is 1. The IR stores instruction codes. The next instruction must be written after ensuring that the busy flag is 0. These two registers can be selected by the register selector (RS) signal. When RS = 0 and R/W = 1 (see the table above). the LCD is in the internal operation mode.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES 3.

AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES The LCD’s internal controller accept several commands and modify the display accordingly. 1 line. 5*7 Pixels) Function set (4-bit interface. 5*7 Pixels) Function set (8-bit interface. 2 lines. These commands would be things like: – Clear screen – Return home – Shift display right/left Instruction Function set (8-bit interface. SSNEC Page 39 .3. 5*7 Pixels) Entry mode set Scroll display one character right (all lines) Scroll display one character left (all lines) Home (move cursor to top/left character position) Move cursor one character left Move cursor one character right Turn on visible underline cursor Turn on visible blinking-block cursor Make cursor invisible Blank the display (without clearing) Restore the display (with cursor hidden) Clear Screen Set cursor position (DDRAM address) Set pointer in character-generator RAM (CG RAM address) Table 3-1 Instructions Decimal 56 48 40 32 See Below 28 24 2 16 20 14 15 12 8 12 1 128 + addr 64 + addr HEX 38 30 28 20 See Below 1E 18 2 10 14 0E 0F 0C 08 0C 01 80+ addr 40+ addr 3.5 INTERFACING LCD TO 8051 DEPT OF ECE. 5*7 Pixels) Function set (4-bit interface. 2 lines. 1 line.

the LCD will require a total of 11 data lines. SSNEC Page 40 . If a 4-bit data bus is used.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Figure 3-8 Interfacing LCD to 8051 Figure 3-9 Interfacing HD44780 LCD to 8051 The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. the LCD will require a total of 7 data lines. RS. DEPT OF ECE. If an 8-bit data bus is used. and RW. The three control lines are EN. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus.

Enable the LCD by Setting the enable pin HIGH 4.0=ready to accept instructions/data). If the LCD never come out from "busy" status because of some problems .The program will "hang. CODE EXAMPLE DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES Note that the EN line must be raised/lowered before/after each instruction sent to the LCD regardless of whether that instruction is read or write.3." waiting for DB7 to go low. 1. In short. The most significant bit of the LCD data bus is the state of the busy flag(1=Busy. Set R/W Pin of the LCD HIGH(read from the LCD) 2. the LCD doesn't know you're talking to it on the other lines. you must always manipulate EN when communicating with the LCD. text or instruction. This would guarantee that even if the LCD hardware fails. SSNEC Page 41 . EN is the LCD's way of knowing that you are talking to it. If you don't raise/lower EN. a maximum of 100 attempts to wait for the busy signal to go low.6 CHECKING THE BUSY FLAG You can use subroutine for checking busy flag or just a big (and safe) delay. So in a real applications it would be wise to put some kind of time limit on the delay--for example. the program would not lock up. The other bits hold the current value of the address counter. 3. Select the instruction register by setting RS pin LOW 3.

#01H . #38H .7 .7 .H->L pulse on E clr P3. Shift cursor right lcall Command clr P3.6 . 5X7 matrix.RW=0 for write setb P3.7 .7.7 jb P1. SSNEC Page 42 clear: setb p3.RS=0 for cmd DEPT OF ECE.disable EN lcall ready Display clear Initialization mov A.7 . mov DATA.5 . lcall Command mov A.move acc.6 .7 lcall ready ret .H->L pulse on E clr P3. 2-lines. A .AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES It is easy (and clean tech.6 . Clear LCD Screen lcall Command mov A.RS=0 for cmd.RS=1 data clr P3.RW=1 for read again: setb P3.H->L pulse on E clr P3. data to port setb P3.6 . ) to make different subroutines and then call them as we need.7 . data to port clr P3.enable EN clr 3.move acc.7 .7 lcall ready ret Command write Routine command: mov P1. LCD on.5 . Busy flag checking ready: setb P1.#01h clr p3. again ret Data write Routine data: mov P1.RS=0 cmd setb P3.RW=0 for write setb P3. #0EH . #06H .D7 as input clr P3. A .5 . cursor on lcall Command mov A. Initialize.

#'M' lcall data mov a.#'E' Page 43 . it is better to use this routine separately.As we need to clear the LCD frequently and not the whole initialisation . ASSEMBLY LANGUAGE lcall Initialization lcall clear mov a.#8ah DEPT OF ECE.AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES RET Note. So referring to table 80h+0Ah= 8Ah.#'A' lcall data mov a.#'I' lcall data Let's now try code for displaying text at specific positions.#'I' lcall data mov a. So below is code and I don's think that you will need explanation comments. I want to display "MAHESH" in message "Hi MAHESH" at the right corner of first line then I should start from 10th character.#'H' lcall data mov a. Displaying "HI" lcall initialization lcall clear mov A.#'H' acall data mov A. SSNEC lcall command mov a.#'H' lcall data mov a.

SSNEC Page 44 .AN EMBEDDED SYSTEMS AND RFID SOLUTION FOR TRANSPORT RELATED ISSUES lcall data mov a.#'S' lcall data mov a.#'H' lcall data DEPT OF ECE.

The newer MAX3232 is also backwards compatible.3.0 μF capacitors used with the original device.5 V. The MAX232 is a dual driver/receiver and typically converts the RX.5V.4.3 V. but operates at a broader voltage range.1VOLTAGE LEVELS . The receivers reduce RS-232 inputs (which may be as high as ± 25 V). ± 7.4 MAX232 The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. and a typical hysteresis of 0. CTS and RTS signals. TX. from 3 to 5. 3. to standard 5 V TTL levels. as power supply design does not need to be made more complicated just for driving the RS-232 in this case.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. These receivers have a typical threshold of 1.1 μF in place of the 1. The drivers provide RS-232 voltage level outputs (approx. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors – 0.

Figure 3-10 Pin diagram of MAX232 APPLICATIONS  Portable Computers  Low-Power Modems  Interface Translation  Battery-Powered RS-232 Systems  Multi drop RS-232 Networks 3. and vice versa for converting from RS232 to TTL.5 INTERFACING THE SERIAL / RS232 PORT . This can be confusing when you realize that the RS232 Data Transmission voltages at a certain logic state are opposite from the RS232 Control Line voltages at the same logic state.It is helpful to understand what occurs to the voltage levels. it changes a TTL Logic 0 to between +3 and +15V. and changes TTL Logic 1 to between -3 to -15V. When a MAX232 IC receives a TTL level to convert.

Transmit Data (TXD) and Receive Data (RXD) compared with at least 8 pins if you use a 8 bit Parallel method Devices which use serial cables for their communication are split into two categories. plotter etc while Data Terminal Equipment is your Computer or Terminal. 2. These are DCE (Data Communications Equipment) and DTE (Data Terminal Equipment. 4. If your device needs to be mounted a far distance away from the computer then 3 core cable (Null Modem Configuration) is going to be a lot cheaper that running 19 or 25 core cable. In most cases. Therefore the serial port can have a maximum swing of 50V compared to the parallel port which has a maximum swing of 5 Volts. (SPP) So what are the advantages of using serial data transfer rather than parallel? 1. Microcontrollers have also proven to be quite popular recently.The Serial Port is harder to interface than the Parallel Port. However could you imagine transmitting 8 bits of data at the one time across the room and being able to (from the devices point of view) decipher which bits are which? Therefore serial transmission is used where one bit is sent at a time.) Data Communications Equipment are devices such as your modem. IrDA-1 (The first infra red specifications) was capable of 115. The electrical specification of . The pulse length however was cut down to 3/16th of a RS232 bit length to conserve power considering these devices are mainly used on diaries. there are many more registers that you have to attend to than on a Standard Parallel Port. You may of seen many electronic diaries and palmtop computers which have infra red capabilities build in. Serial Communication reduces the pin count of these MPU's. This can be done using a UART. Only two pins are commonly used. laptops and palmtops.2k baud and was interfaced into a UART. Infra Red devices have proven quite popular recently. any device you connect to the serial port will need the serial transmission converted back to parallel so that it can be used. You don't need as many wires than parallel transmission. The serial port transmits a '1' as -3 to -25 volts and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1' as 5v. TA adapter. Serial Cables can be longer than Parallel cables. On the software side of things. 3. However you must take into account the cost of the interfacing at each end. Therefore cable loss is not going to be as much of a problem for serial cables than they are for parallel. Many of these have in built SCI (Serial Communications Interfaces) which can be used to talk to the outside world.

Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors. 3. TA adapter. . An open circuit voltage should never exceed 25 volts. 4. A new standard. plotter etc while Data Terminal Equipment is your Computer or Terminal. The region between +3 and -3 volts is undefined. Line Capacitance. A "Mark" (Logic 1) will be between -3 and -25 Volts.1 HARDWARE PROPERTIES Devices which use serial cables for their communication are split into two categories. The driver should be able to handle this without damage.5.the serial port is contained in the EIA (Electronics Industry Association) RS232C standard. A short circuit current should not exceed 500mA. which is rather slow by today's standards. 2. It is interesting to note however. Maximum Baud Rates etc are also included.) Data Communications Equipment are devices such as your modem. It states many parameters such as – 1. There are the D-Type 25 pin connector and the DType 9 pin connector both of which are male on the back of the PC. 3. RS-232D has been recently released. Serial Ports come in two "sizes".000 BPS!. that the RS232C standard specifies a maximum baud rate of 20. These are DCE (Data Communications Equipment) and DTE (Data Terminal Equipment. (Take note of this one!) Above is no where near a complete list of the EIA standard. thus you will require a female connector on your device. A "Space" (logic 0) will be between +3 and +25 Volts. For more information please consult the EIA RS232-C standard. (In Reference to GND) 5.

(In Reference to GND) A short circuit current should not exceed 500mA. Maximum Baud Rates etc are also included. which is rather slow by today's standards. A "Mark" (Logic 1) will be between -3 and -25 Volts. 2.5. The region between +3 and -3 volts is undefined. A "Space" (logic 0) will be between +3 and +25 Volts. For more information please consult the EIA RS232-C standard. DB9 CONNECTOR . RS-232D has been recently released. 5. 4. thus you will require a female connector on your device.000 BPS!. It is interesting to note however. that the RS232C standard specifies a maximum baud rate of 20.2 DB9 CONNECTOR 1.Serial Ports come in two "sizes". There are the D-Type 25 pin connector and the D-Type 9 pin connector both of which are male on the back of the PC.The electrical specifications of the serial port is contained in the EIA (Electronics Industry Association) RS232C standard.Above is no where near a complete list of the EIA standard. An open circuit voltage should never exceed 25 volts. A new standard. 3. Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors 3. Line Capacitance. It states many parameters such as . The driver should be able to handle this without damage.

3. It is called as Second Generation (2G) standard because communications occur in an entirely digital mode.6 GSM Technology: 3. . unlike the first generation of portable telephones. the most commonly used mobile telephony standard in Europe.1 INTRODUCTION TO THE GSM STANDARD The GSM (Global System for Mobile communications) network is at the start of the 21st century.6.Figure 3-11 RS232 DB9Connector Pin out DB-9M Function Abbreviation Pin #1 Data Carrier Detect CD Pin #2 Receive Data RD or RX or RXD Pin #3 Transmitted Data TD or TX or TXD Pin #4 Data Terminal Ready DTR Pin #5 Signal Ground GND Pin #6 Data Set Ready DSR Pin #7 Request to Send RTS Pin #8 Clear To Send CTS Pin #9 Ring Indicator RI.

6 kbps which allows transmission of voice and low-volume digital data like text messages (SMS. Here. the GSM standard uses the 900 MHz and 1800 MHz frequency bands. and CDMA (Code Division Multiple Access).When it was first standardized in 1982. But the two competing technologies differ in the way user sharing the common resource. FDMA (Frequency Division Multiple Access). DEFINITION OF GSM GSM (Global System for Mobile communications) is an open. the frequency band used is the 1900 MHz band. GSM STANDARDS GSM uses narrowband TDMA. TDMA allows the users to share the same frequency channel by dividing the signal into different time slots. All three principles allow multiple users to share the same physical channel. For this reason. portable telephones that are able to operate in both Europe and the United States are called tri-band while those that operate only in Europe are called bi-band. users can only transmit in their respective time slot. in CDMA several users can transmit over the channel at the same time. GSM (Global System for Mobile communication) is a digital mobile telephone system that is widely used in Europe . for Multimedia Message Service). which allows eight simultaneous calls on the same radio frequency. Unlike TDMA. TDMA (Time Division Multiple Access). Each user takes turn in a round robin fashion for transmitting and receiving over the channel. it became an international standard called "Global System for Mobile communications" in 1991. however. In the United States. In Europe. The GSM standard allows a maximum throughput of 9. for Short Message Service) or multimedia messages (MMS. digital cellular technology used for transmitting mobile voice and data services. it was called as Group Special Mobile and later. CDMA uses a spread spectrum technology that is it spreads the information contained in a particular signal of interest over a much greater bandwidth than the original signal. There are three basic principles in multiple access.

6 kbit/s.and other parts of the world. As of the end of 1997. It supports voice calls and data transfer speeds of up to 9. GSM service was available in more than 100 countries and has become the de facto standard in Europe and Asia. Most 2G GSM networks operate in the 900 MHz or 1800 MHz bands. In 1989. GSM digitizes and compresses data. and CDMA). each in its own time slot. It operates at either the 900 MHz or 1. Some countries in the Americas (including Canada and the United States) use the 850 MHz and 1900 MHz bands because the 900 and 1800 MHz frequency bands were already allocated. then sends it down a channel with two other streams of user data. The rarer 400 and 450 MHz frequency bands are . The first GSM network was launched in 1991 by Radiolinja in Finland with joint technical infrastructure maintenance from Ericsson. HISTORY In 1982. GSM FREQUENCIES GSM networks operate in a number of different frequency ranges (separated into GSM frequency ranges for 2G and UMTS frequency bands for 3G).800 MHz frequency band. 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 responsibility was transferred to the European Telecommunications Standards Institute (ETSI) and phase I of the GSM specifications were published in 1990. Most 3G GSM networks in Europe operate in the 2100 MHz frequency band. together with the transmission of SMS (Short Message Service). the European Conference of Postal and Telecommunications Administrations (ECPT) created the Group Special Mobile (GSM) to develop a standard for a mobile telephone system that could be used across Europe. GSM. In 1987. By the end of 1993. over a million subscribers were using GSM phone networks being operated by 70 carriers across 48 countries. a memorandum of understanding was signed by 13 countries to develop a common cellular telephone system across Europe. Finally the system created by SINTEF lead by Torleiv Maseng was selected.

615 ms.6 kbps 9.8GHz bands in Europe and the 1.assigned in some countries where these frequencies were previously used for first-generation systems.833 Kbit/s. The transmission power in the handset is limited to a maximum of 2 watts in GSM850/900 and 1 watt in GSM1800/1900. adding 50 channels (channel numbers 975 to 1023 and 0) to the original GSM-900 band. Duplex spacing of 45 MHz is used. GSM operates in the 900MHz and 1. Half rate channels use alternate frames in the same timeslot. This 'extended GSM'. and the frame duration is 4. uses 880–915 MHz (uplink) and 925–960 MHz (downlink). By having harmonized spectrum across most of the globe. GSM’s international roaming capability allows users to access the same services when travelling abroad as at home. The 850MHz band is also used for GSM and 3G in Australia. GSM-900 uses 890–915 MHz to send information from the mobile station to the base station (uplink) and 935–960 MHz for the other direction (downlink). In some countries the GSM-900 band has been extended to cover a larger frequency range. Canada and many South American countries. E-GSM. Throughput 9. Time division multiplexing is used to allow eight full-rate or sixteen half-rate speech channels per radio frequency channel. GSM satellite roaming has also extended service access to areas where terrestrial coverage is not available. Terrestrial GSM networks now cover more than 80% of the world’s population.6 kbps . Mobile Telephony Standards Standard Generation GSM 2G Frequency band Allows transfer of voice or lowvolume digital data. The channel data rate for all 8 channels is 270. This gives consumers seamless and same number connectivity in more than 218 countries. There are eight radio timeslots (giving eight burst periods) grouped into what is called a TDMA frame.9GHz and 850MHz bands in the US. providing 124 RF channels (channel numbers 1 to 124) spaced at 200 kHz.

5G 2. this system was largely used in England and then in Asia (Hong-Kong and Japan).144-2 Mbps kbps Table 3-3 Mobile telephony standards 3.2 kbps 43. Allows simultaneous transfer of voice and digital data. Russia and Asia.6.4-171.GPRS EDGE UMTS 2. • TACS (Total Access Communication System) is the European version of the AMPS model. 3. Using the 900 MHz frequency band. It used primarily the following standards: • AMPS (Advanced Mobile Phone System). was the first cellular network standard. • ETACS (Extended Total Access Communication System) is an improved version of the TACS standard developed in the United Kingdom that uses a larger number of communication channels.75G 3G Allows transfer of voice or moderate-volume digital data. 21. This first-generation analogue network had weak security mechanisms which allowed hacking of telephones lines.3 SECOND GENERATION OF MOBILE NETWORKS (2G) .2-345.2 1G The first generation of mobile telephony (written 1G) operated using analogue communications and portable devices that were relatively large.6. Allows simultaneous transfer of voice and high-speed digital data. It was used primarily in the Americas. which appeared in 1976 in the United States.6 kbps 48 kbps 171 kbps 384 0. The first-generation cellular networks were made obsolete by the appearance of an entirely digital second generation.

One of these is the GPRS (General Packet Radio System) service which allows theoretical data rates on the order of 114 Kbit/s but with throughput closer to 40 Kbit/s in practice. In the United States. the EDGE standard allows maximum theoretical data rates of 473 Kbit/s. TDMA technology is primarily used on the American continent. but it has been limited in order to comply with .75G. billed as 2.5G The EDGE (Enhanced Data Rates for Global Evolution) standard. The main 2G mobile telephony standards are: • GSM (Global System for Mobile communications) is the most commonly used standard in Europe at the end of the 20th century and supported in the United States.The second generation of mobile networks marked a break with the first generation of cellular telephones by switching from analogue to digital. the frequency band used is the 1900 MHz band. thereby allowing the access for multimedia applications. As this technology does not fit within the "3G" category. for example text messages (SMS. With the 2G networks. This standard uses the 900 MHz and 1800 MHz frequency bands in Europe. however. • CDMA (Code Division Multiple Access) uses a spread spectrum technique that allows a radio signal to be broadcast over a large frequency range. it is often referred to as 2. quadruples the throughput improvements of GPRS with its theoretical data rate of 384 Kbps. Portable telephones that are able to operate in Europe and the United States are therefore called tri-band. Extensions have been made to the GSM standard to improve throughput. it is possible to transmit voice and low volume digital data. for Short Message Service) or multimedia messages (MMS. • TDMA (Time Division Multiple Access) uses a technique of time division of communication channels to increase the volume of data transmitted simultaneously. The GSM standard allows a maximum data rate of 9. In reality. in New Zealand and in the Asia-Pacific region. for Multimedia Message Service).6 kbps.

2.5G"). 3. THE CONCEPT OF CELLULAR NETWORK . 4. UMTS technology uses 5 MHz bands for transferring voice and data. 3. The main 3G standard used in Europe is called UMTS (Universal Mobile Telecommunications System) and uses WCDMA (Wideband Code Division Multiple Access) encoding. which is able to reach data rates on the order of 8 to 10 Mbps.4 3G The IMT-2000 (International Mobile Telecommunications for the year 2000) specifications from the International Telecommunications Union (ITU) defined the characteristics of 3G (third generation of mobile telephony). 144 Kbps with total coverage for mobile use. (considered as "3. 5. HSDPA technology uses the 5 GHz frequency band and uses WCDMA encoding. HSDPA (High Speed Downlink Packet Access) is a third generation mobile telephony protocol. Compatibility of 3rd generation mobile services with second generation networks. High transmission data rate. 6. 384 Kbps with medium coverage for pedestrian use. thereby allowing the access to multimedia uses such as video transmission.6. 3G offers data rates of more than 144 Kbit/s. video-conferencing or high-speed internet access. 2 Mbps with reduced coverage area for stationary use. 3G networks use different frequency bands than the previous networks: 1885-2025 MHz and 2110-2200 MHz. World compatibility.the IMT-2000(International Mobile Telecommunications-2000) specifications from the ITU (International Telecommunications Union). with data rates that can range from 384 Kbps to 2 Mbps. The most important of these characteristics are: 1.

In practice. In a cellular network.6. Each SIM card also has a unique (and secret) identification number called IMSI (International Mobile Subscriber Identity). adjacent cells cannot use the same frequency. called a "base station" (or Base Transceiver Station. To avoid interference.5 ARCHITECTURE OF THE GSM NETWORK In a GSM network. . The smaller the radius of a cell. the higher is the available bandwidth. The terminals (devices) are identified by a unique 15-digit identification number called IMEI (International Mobile Equipment Identity). each cell is surrounded by 6 neighbouring cells (thus a cell is generally drawn as a hexagon). circular zones that overlap to cover a geographical area. 3. while huge cells of up to 30 kilometers provide coverage in rural areas. there are cells with a radius of a few hundred meters. This code can be protected using a 4-digit key called a PIN code. A mobile station is made up of a SIM (Subscriber Identity Module) card allowing the user to be uniquely identified and a mobile terminal. So. Communications occur through a radio link (air interface) between a mobile station and a base station. the user terminal is called a mobile station. in highly populated urban areas. written BTS).Mobile telephone networks are based on the concept of cells. Figure 3-12 Cellular Network Cellular networks are based on the use of a central transmitter-receiver in each cell. two cells using the same frequency range must be separated by a distance of two to three times the diameter of the cell. The SIM card therefore allows each user to be identified independently of the terminal used during communication with a base station.

) of the subscribers registered in the area of the switch (MSC). Finally. which is responsible for managing user identities.Figure 3-13 Architecture of the GSM Network All the base stations of a cellular network are connected to a base station controller (BSC) which is responsible for managing distribution of the resources. managed by the telephone network operator. the base station controllers are themselves physically connected to the Mobile Switching Centre (MSC). The VLR retrieves the data of a new user from the HLR of the user's subscriber zone. The Visitor Location Register (VLR) is a database containing information of users other than the local subscribers. administrative information etc. their location and establishment of communications with other subscribers. which connects them to the public telephone network and the Internet. The Home Location Register (HLR) is a database containing information (geographic position. The MSC is generally connected to databases that provide additional functions: 1. 2. The system consisting of the base station controller and its connected base stations is called the Base Station Subsystem (BSS). The data is maintained as long as the user is in the . The MSC belongs to a Network Station Subsystem (NSS).

Figure 3-14 GSM Modem A GSM modem can be an external device or a PC Card / PCMCIA Card.e. Like a GSM mobile phone. GSM networks support the concept of roaming i. 3. The Equipment Identify Register (EIR) is a database listing the mobile terminals. a GSM modem requires a SIM card from a wireless carrier in order to operate. an external GSM modem is connected to a computer through a serial cable or a USB cable. A SIM card contains the following information: . Typically. 4.. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. 5. The cellular network formed in this way is designed to support mobility via management of handovers (movements from one cell to another). Finally. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer.zone and is deleted when the user leaves or after a long period of inactivity (terminal off). movement from one operator network to another. The Authentication Centre (AUC) is responsible for verifying user identities.

writing and deleting SMS messages. International Mobile Subscriber Identity) State of the SIM card Service code (operator) Authentication key PIN (Personal Identification Code) PUK (Personal Unlock Code) Computers use AT commands to control modems. . the following operations can be performed: • • • • • Reading. GSM modems support an extended set of AT commands. In addition to the standard AT commands. With the extended AT commands. Monitoring the charging status and charge level of the battery. Sending SMS messages. These extended AT commands are defined in the GSM standards. Monitoring the signal strength. writing and searching phone book entries.• • • • • • • Subscriber telephone number (MSISDN) International subscriber number (IMSI. Both GSM modems and dial-up modems support a common set of standard AT commands. Reading.

That's the reason. AT+CMSS (Send SMS message from storage). AT is the abbreviation of ATtention. Besides this common AT command set. ATA (Answer).6 Introduction to AT Commands AT commands are instructions used to control a modem. AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages). modem commands are called AT commands.Figure 3-15 Connection between PC and GSM Modem The number of SMS messages that can be processed by a GSM modem per minute is very low i. Many of the commands that are used to control wired dial-up modems. which includes SMS-related commands like AT+CMGS (Send SMS message). 3.e. about 6 to 10 SMS messages per minute. . such as ATD (Dial). ATH (Hook control) and ATO (Return to online data state) are also supported by GSM modems and mobile phones. Every command line starts with "AT" or "at". GSM modems and mobile phones support an AT command set that is specific to the GSM technology..6.

name of manufacturer (AT+CGMI). (Facility lock examples: SIM lock [a password must be given to the SIM card every time the mobile phone is switched on] and PH-SIM lock [a certain SIM card is .  Get the current status of the mobile phone or GSM/GPRS modem. checking whether a facility is locked (AT+CLCK) and changing passwords(AT+CPWD).It should be noted that the starting "AT" is the prefix that informs the modem about the start of a command line. ATA.  Read (AT+CPBR). battery charge level and battery charging status (AT+CBC).  Get basic information about the subscriber. ATA. MSISDN (AT+CNUM) and IMSI number (International Mobile Subscriber Identity) (AT+CIMI). such as opening or closing facility locks (AT+CLCK). IMEI number (International Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR). read (AT+CMGR.  Send and receive fax (ATD. For example. radio signal strength (AT+CSQ). write (AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS messages (AT+CNMI). Some of the tasks that can be done using AT commands with a GSM modem or mobile phone are listed below:  Get basic information about the mobile phone or GSM modem. mobile phone activity status (AT+CPAS). For example. etc). It is not part of the AT command name. D is the actual AT command name in ATD and +CMGS is the actual AT command name in AT+CMGS.  Send (AT+CMGS.  Establish a data connection or voice connection to a remote modem (ATD. For example. For example. AT+CMSS). write (AT+CPBW) or search (AT+CPBF) phonebook entries. mobile network registration status (AT+CREG). model number (AT+CGMM). AT+F*). AT+CMGL).  Perform security-related tasks.

associated with the mobile phone. To use other SIM cards with the mobile phone, a password must be entered.])  Control the presentation of result codes / error messages of AT commands. For example, the user can control whether to enable certain error messages (AT+CMEE) and whether error messages should be displayed in numeric format or verbose format (AT+CMEE=1 or AT+CMEE=2).  Get or change the configurations of the mobile phone or GSM/GPRS modem. For example, change the GSM network (AT+COPS), bearer service type (AT+CBST), radio link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of SMS messages (AT+CPMS).  Save and restore configurations of the mobile phone or GSM/GPRS modem. For example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the SMS center address. It should be noted that the mobile phone manufacturers usually do not implement all AT commands, command parameters and parameter values in their mobile phones. Also, the behavior of the implemented AT commands may be different from that defined in the standard. In general, GSM modems, designed for wireless applications, have better support of AT commands than ordinary mobile phones.

3.6.7 BASIC CONCEPTS OF SMS TECHNOLOGY 1. Validity Period of an SMS Message An SMS message is stored temporarily in the SMS center if the recipient mobile phone is offline. It is possible to specify the period after which the SMS message will be deleted from the SMS center so that the SMS message will not be forwarded to the recipient mobile phone when it becomes online. This period is called the validity period. A mobile phone should have a menu option that can be used to set the validity period. After setting it, the mobile phone will include the validity period in the outbound SMS messages automatically. 2. Message Status Reports

Sometimes the user may want to know whether an SMS message has reached the recipient mobile phone successfully. To get this information, you need to set a flag in the SMS message to notify the SMS center that a status report is required about the delivery of this SMS message. The status report is sent to the user mobile in the form of an SMS message. A mobile phone should have a menu option that can be used to set whether the status report feature is on or off. After setting it, the mobile phone will set the corresponding flag in the outbound SMS messages for you automatically. The status report feature is turned off by default on most mobile phones and GSM modems. 3. Message Submission Reports After leaving the mobile phone, an SMS message goes to the SMS center. When it reaches the SMS center, the SMS center will send back a message submission report to the mobile phone to inform whether there are any errors or failures (e.g. incorrect SMS message format, busy SMS center, etc). If there is no error or failure, the SMS center sends back a positive submission report to the mobile phone. Otherwise it sends back a negative submission report to the mobile phone. The mobile phone may then notify the user that the message submission was failed and what caused the failure. If the mobile phone does not receive the message submission report after a period of time, it concludes that the message submission report has been lost. The mobile phone may then send the SMS message again to the SMS center. A flag will be set in the new SMS message to inform the SMS center that this SMS message has been sent before. If the previous message submission was successful, the SMS center will ignore the new SMS message but send back a message submission report to the mobile phone. This mechanism prevents the sending of the same SMS message to the recipient multiple times. Sometimes the message submission report mechanism is not used and the acknowledgement of message submission is done in a lower layer. 4. Message Delivery Reports After receiving an SMS message, the recipient mobile phone will send back a message delivery report to the SMS center to inform whether there are any errors or failures (example causes: unsupported SMS message format, not enough storage space, etc). This process is transparent to the mobile user. If there is no error or failure, the recipient mobile phone sends back a positive delivery report to the SMS center. Otherwise it sends back a negative delivery

report to the SMS center. If the sender requested a status report earlier, the SMS center sends a status report to the sender when it receives the message delivery report from the recipient. If the SMS center does not receive the message delivery report after a period of time, it concludes that the message delivery report has been lost. The SMS center then ends the SMS message to the recipient for the second time. Sometimes the message delivery report mechanism is not used and the acknowledgement of message delivery is done in a lower layer.

3.7 RFID READER & TAG
3.7.1 What is RFID? RFID stands for Radio-Frequency Identification. The acronym refers to small electronic devices that consist of a small chip and an antenna. The chip typically is capable of carrying 2,000 bytes of data or less. The RFID device serves the same purpose as a bar code or a magnetic strip on the back of a credit card or ATM card; it provides a unique identifier for that object. And, just as a bar code or magnetic strip must be scanned to get the information, the RFID device must be scanned to retrieve the identifying information.

“RFID Works Better Than Barcodes”
A significant advantage of RFID devices over the others mentioned above is that the RFID device does not need to be positioned precisely relative to the scanner. We're all familiar with the difficulty that store checkout clerks sometimes have in making sure that a barcode can be read. And obviously, credit cards and ATM cards must be swiped through a special reader. In contrast, RFID devices will work within a few feet (up to 20 feet for high-frequency devices) of the scanner. For example, you could just put all of your groceries or purchases in a

bag.the RFID tag . Tag collision occurs when many tags are present in a small area. but since the read time is very fast. . Systems must be carefully set up to avoid this problem. Reader collision occurs when the signals from two or more readers overlap.7. Alien Technologies recently sold 500 million RFID tags to Gillette at a cost of about ten cents per tag. One reason that it has taken so long for RFID to come into common use is the lack of standards in the industry. The RF radiation does two things: It provides a means of communicating with the transponder (the RFID tag) AND it provides the RFID tag with the energy to communicate (in the case of passive RFID tags). 3. (Read a more detailed article on RFID compared to barcodes. It would be able to query all of the RFID devices and total your purchase immediately.that has been programmed with information. The scanning antenna puts out radio-frequency signals in a relatively short range. it is easier for vendors to develop systems that ensure that tags respond one at a time. The tag is unable to respond to simultaneous queries.2 How does RFID work? A Radio-Frequency Identification system has three parts:  A scanning antenna  A transceiver with a decoder to interpret the data  A transponder . many of the benefits of RFID come when items are tracked from company to company or from country to country. Most companies invested in RFID technology only use the tags to track items within their control.) RFID technology has been available for more than fifty years. “Common Problems with RFID’ Some common problems with RFID are reader collision and tag collision. and set the bag on the scanner. It has only been recently that the ability to manufacture the RFID devices has fallen to the point where they can be used as a "throwaway" inventory or control device.

you could build them into a door frame to accept data from persons or objects passing through. Passive RFID tags. An appropriate RF field will cause the RFID chip in the badge to "spill the beans" to .7. The tag need not be on the surface of the object (and is therefore not subject to wear) The read time is typically less than 100 milliseconds Large numbers of tags can be read at once rather than item by item. RFID tags can be read in a wide variety of circumstances. the RFID tag may be of one of two types. and targeting accordingly. If someone walks by your bag of books from the bookstore with a 13. The scanning antennas can be permanently affixed to a surface. Active RFID tags have their own power source. and can be much smaller and have a virtually unlimited life span. and it transmits the information on its microchip to be picked up by the scanning antenna. 3. Another scenario involves a military situation in which the other side scans vehicles going by. that person can get a complete list of what you just bought. They can take whatever shape you need. Companies are more concerned with the increasing use of RFID devices in company badges.56 Mhz "sniffer" with an RF field that will activate the RFID devices in the books you bought. That's certainly an invasion of your privacy. they have limited life spans.This is an absolutely key part of the technology. Obviously. for example. do not require batteries. but it could be worse. where barcodes or other optically read technologies are useless. Even though some of these devices are built to have up to a 10 year life span. handheld antennas are also available. Anyone with an appropriately equipped scanner and close access to the RFID device can activate it and read its contents. it detects the activation signal from the antenna. looking for tags that are associated with items that only high-ranking officers can have. That "wakes up" the RFID chip. some concerns are greater than others. RFID tags do not need to contain batteries. In addition. When an RFID tag passes through the field of the scanning antenna.3 Is RFID Technology Secure and Private? Unfortunately. however. not very often in the systems to which consumers are likely to be exposed. and can therefore remain usable for very long periods of time (maybe decades). the advantage of these tags is that the reader can be much farther away and still get the signal.

to ensure that the meat was properly kept cool. Eventually. This can cause problems for companies. For example. It should be noted that some RFID devices are never meant to leave their network (as in the case of RFID tags used for inventory control within a company). The most they can do is PINstyle or password-based protection. This would allow the tag to report not simply the same information over and over.4 Next-Generation Uses of RFID? Some vendors have been combining RFID tags with sensors of different kinds. but identifying information along with current data picked up by the sensor.7. For example. The smallest tags that will likely be used for consumer items don't have enough computing power to do data encryption to protect your privacy. an RFID tag attached to a leg of lamb could report on the temperature readings of the past 24 hours. ExxonMobil's Speed Pass system is a proprietary RFID system. the proportion of "scan-it-yourself" aisles in retail stores will increase. This information can then be stored and replayed to company scanners. 3. 3. Over time. Consumers may also have problems with RFID standards.whomever activates it. we may wind up with stores that have mostly "scan-it-yourself" aisles and only a few checkout stations for people who are disabled or unwilling.7. if another company wanted to use the . allowing the thief access .5 Problems with RFID RFID problems can be divided into several categories:  Technical problems with RFID  Privacy and ethics problems with RFID  Technical problems with RFID  Problems with RFID Standards RFID has been implemented in different ways by different manufacturers.and your badge is the one that is "credited" with the access. global standards are still being worked on.

An RFID tag cannot tell the difference between one reader and another. The tag is unable to respond to simultaneous queries. On the other hand. The following problems with RFID tags and readers have been reported. Also.6 RFID systems can be easily disrupted Since RFID systems make use of the electromagnetic spectrum (like Wi-Fi networks or cell phones). (Learn more about RFID tag collision. Systems must be carefully set up to avoid this problem.) 3.8 RFID Tag Collision Tag collision occurs when many tags are present in a small area. they are relatively easy to jam using energy at the right frequency. it could be disastrous in other environments where RFID is increasingly used. The contents of an RFID tag can be read after the item leaves the supply chain. RFID scanners are very . many systems use an anti-collision protocol (also called a singulation protocol. (Learn more about RFID reader collision.7.7.7 RFID Reader Collision Reader collision occurs when the signals from two or more readers overlap. 3.) Security. Anti-collision protocols enable the tags to take turns in transmitting to a reader. active RFID tags (those that use a battery to increase the range of the system) can be repeatedly interrogated to wear the battery down. it is easier for vendors to develop systems that ensure that tags respond one at a time.7. a consumer would need to carry many different devices with them. if every company had their own "Speed Pass" system. disrupting the system. but since the read time is very fast. privacy and ethics problems with RFID.an unlikely scenario.convenient Speed Pass (say. like hospitals or in the military in the field. Although this would only be an inconvenience for consumers in stores (longer waits at the checkout). at the drive-in window of your favorite fast food restaurant) they would have to pay to access it . 3.

you could be scanned before you enter the store. RFID reader/tag systems are designed so that distance between the tag and the reader is kept to a minimum (see the material on tag collision above). see zombie RFID tags.7. leading to privacy problems.9 RFID tags are difficult to remove RFID tags are difficult to for consumers to remove. However. some are very small (less than a half-millimeter square. Some tags can be turned off when the item has left the supply chain. 3. RFID tags with unique serial numbers could be linked to an individual credit card number At present.others may be hidden or embedded inside a product where consumers cannot see them. the Universal Product Code (UPC) implemented with barcodes allows each product sold in a store to have a unique number that identifies that product. from a few inches to a few yards. Work is proceeding on a global system of product identification that would allow each individual item . 3.7. anyone with an RFID tag reader can read the tags embedded in your clothes and other consumer products without your knowledge. a high-gain antenna can be used to read the tags from much further away. and as thin as a sheet of paper) .11 RFID tags can be read greater distances with a high-gain antenna For various reasons.10 RFID tags can be read without your knowledge Since the tags can be read without being swiped or obviously scanned (as is the case with magnetic strips or barcodes). New technologies allow RFID tags to be "printed" right on a product and may not be removable at all (see Printing RFID Tags With Magic Ink). 3. You might then be approached by a clerk who knows what you have in your backpack or purse. and can suggest accessories or other items.7. RFID tags can be read from a distance. just to see what you are carrying. For example. This allows anyone to see the contents of your purse or pocket as you walk down the street.portable.

Line of sight requirements also limit the ruggedness of barcodes as well as the reusability of barcodes.  RFID tags can be read at much greater distances. RFID readers do not require a direct line of sight to either active RFID tags or passive RFID tags. However. RFID tags can also be implanted within the product itself.  RFID readers can interrogate. there are important differences between these two technologies:  Barcode readers require a direct line of sight to the printed barcode. can be read/write devices. read rates of forty or more tags per second are possible.) RFID tags are typically more rugged. the RFID tag number for a particular item can be associated with a credit card number. since the electronic components are better protected in a plastic cover.to have its own number. The range to read a barcode is much less. or read. the RFID reader can . if the items are not properly oriented to the reader it may take seconds to read an individual tag. (Since line of sight is required for barcodes. however. guaranteeing greater ruggedness and reusability. typically no more than fifteen feet. RFID tags. When the item is scanned for purchase and is paid for. Reading barcodes is much more time-consuming. the printed barcode must be exposed on the outside of the product.8 Advantages of RFID versus Barcodes RFID tags and barcodes both carry information about products. that is. RFID tags much faster. Barcodes have no read/write capability. 3. an RFID reader can pull information from a tag at distances up to 300 feet. Barcode readers usually take a half-second or more to successfully complete a read. you cannot add to the information written on a printed barcode. where it is subject to greater wear and tear. due to the fact that a direct line of sight is required.

If you want to look at the numbers. the RFID reader that sits on the merchant's counter may use some sort of special signal.and goes on his way. that would be difficult for a thief with an off-the-shelf reader to duplicate. much more so. 128-bit and triple DES encryptions make it nearly impossible for thieves to steal your data. For example. and alter as much of the information as the tag design will allow. The contactless card never transmits your card number Instead. here is where this technology is taking us in our need for speed (average transaction speeds):  Contactless credit card transaction: 15 seconds  Magnetic strip card transaction: 25 seconds  Cash transaction: 34 seconds The contactless cards use highly secure data transmission standards. Contactless cards probably use other measures although this is just speculation. To make a purchase. the RFID chip within the card creates a unique number for the transaction. Contactless cards make use of the most secure encryption standards practical with current technology. 3. waits for the acceptance indicator . if a criminal intercepted the number. RFID tags are typically more expensive than barcodes. or offer a special set of frequencies. the card owner just waves his card over the RFID reader.communicate with the tag. in some cases. it would be useless even if successfully decrypted. Visa and MasterCard have all agreed to waive the signature requirement for contactless credit card transactions under $25. . there are certainly other ways to secure the data on the card.9 Contactless Credit Card Advantages Credit card companies are claiming the following advantages for contactless credit cards: The card is faster to use. American Express.

been carefully noted by credit card companies. it is feared that having this muchc information available "in the open air" will lead inevitably to problems. However. or just behind you.consumers may feel otherwise. thieves would have absolutely no way to even know if you have a credit card. Consumers. a regular credit card transaction is fairly secure. The RFID chip in the contactless credit card responds to the merchant reader with a unique number used for that transaction only. with contactless credit cards. you could keep it safely in an enclosed wallet or purse.  It is easier to spend. the average number of transactions at a retail location rose by about one percent. In a 2004 study.10 Contactless Credit Card Disadvantages The following disadvantages have been noted with contactless credit cards:  Contactless cards are more exposed than regular credit cards. a thief with a suitable reader could monitor your contactless card transaction while standing at the counter with you. Privacy advocates are particularly concerned about this technology. and will spend more frequently. and the average "spend" rose fifteen percent for all contactless credit card users. within a few feet of you. Studies have demonstrated that consumers will be more likely to spend. This number is also encrypted. it appears that there is a correlation between ease of use and total spending. the magnetic strip is swiped at very close range (less than a millimeter). . So.  Also.  These concerns have. a thief armed with a suitable reader. of course.One additional fact that is known about contactless cards is definitely an advantage for merchants . would be able to interrogate all of the cards in your wallet or purse without your knowledge. However. it does not simply transmit the consumer's account number. take note! 3. If you want to keep your credit card secure.

so we need to convert the written code in the sets of zero n one. either logic zero or one). The KEIL environment provide us the facility to convert the code written in C or ALP to sets of zero n one (i. called hex code).CHAPTER -4 SOFTWARE USAGE 4.1 KEIL This software is used to write the microcontroller code and to simulate it on the computer itself. User Vs machine (microcontroller): as the microcontroller know only about the digital value (i.e.e. . Keil µ Vision2 Open the Keil µ Vision2 Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it. It is also used to generate the hex code for the code written in ALP or C.

Go to Project – Select Device for Target ‘Target1’ Select 8052(all variants) and click OK .

Now we need to check the oscillator frequency: Go to project – Options for Target ‘Target1’ .

Building the Target Build the target as illustrated in the figure below RUNNING THE SIMULATION .Make sure that the oscillator frequency is 12MHz.

Having successfully built the target. We therefore want to observe the activity on this port . we are now ready to start the debug session and run the simulator. First start a debug session The flashing LED we will view will be connected to Port 1.

To ensure that the port activity is visible. we need to start the ‘periodic window update’ flag .

.Go to Debug – Go While the simulation is running. view the performance analyzer to check the delay durations.

Go to Debug – Performance Analyzer and click on it .

Here fill the frequency of crystal which we are going to use.Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button  Here we need to change the ‘Xtal (MHz): ‘. For the microcontroller which we are using the crystal that we are .

2 Flash magic Flash Magic is Windows software from that microcontroller is easyly programmed using In-System Programming technology to all the ISP feature empowered devices. After that we can translate the current file n built target will generate the HEX code automatically.then click the option ‘Output’ where we have to select the option ‘Create HEX File’.using is having crystal frequency 12MHz. .and click the option for ‘Use On-chip ROM(0x0-0xFFFF)’. 4.

After installing the software when we click on the icon of the software the window will open on the screen as shown in figure. Programming of device After loading the file next step is dumping of code in microcontroller.. For that we first connect the computer’s serial port to your controller board through serial cable. Loading of hex file: After selecting device we load the hex file in the given block by using the ‘browse’ option on the ‘FLASH MAGIC’ window. If we need to verify the proper dumping of the program in the microcontroller then we need to set the ‘verify after program’ option. Press the start option on your flash magic window. and then we set to ‘erase all flash’ option on the flash magic window. Then after give the power supply to the controller board. Now its time to dump the code in controller. Then your microcontroller will be programmed in few seconds. We need to change the device and have to select the device 89V51RD2.... CHAPTER-5 .

.1CIRCUIT DIAGRAM 5.2 CODE #include<reg51.CIRCUIT DIAGRAM AND CODE 5.h> void UART_init(void).

void send_to_modem (unsigned char s[]); void enter (void); void ch_send_to_modem (unsigned char single_char); void UART_init(void) { TMOD=0x20; TH1=0xFD; SCON=0x50; TR1=1; } void send_to_modem (unsigned char s[]) { unsigned char r; for(r=0;s[r]!='\0';r++) // to send the command to GSM modem to avoid echo signal { // the command is "ate0", SBUF=s[r]; while(TI==0); TI=0; delay(20); } // enter(); } void enter (void) { SBUF=13; while(TI==0); ASC values. TI=0; SBUF=10; while(TI==0); TI=0; }

// Enter ASC values are 13 and 10, // After sending commands to GSM modem you must be send Enter's

void ch_send_to_modem (unsigned char single_char) { SBUF=single_char; while(TI==0); TI=0; delay(10); } //#include<reg51.h>

#define lcd_data P1 #define lcd_cont() ((lcd_en=1),(delay(3)),(lcd_en=0)) sbit lcd_rs = P1^2; // Here we are using LCD in four bit mode that's why LCD's Data pins and control sbit lcd_en = P1^3; void lcd_init (void); void lcdcmd (unsigned char value); void lcddata (unsigned char value); void msgdisplay (unsigned char b[]); void delay (unsigned int value); void lcd_init (void) { lcdcmd(0x02); lcdcmd(0x02); lcdcmd(0x02); lcdcmd(0x28); lcdcmd(0x28); lcdcmd(0x28); lcdcmd(0x0e); lcdcmd(0x06); lcdcmd(0x01); } void lcdcmd (unsigned char value) { lcd_data=value&(0xf0); lcd_rs=0; lcd_cont(); lcd_data=((value<<4)&(0xf0)); lcd_rs=0; lcd_cont(); } // LCD COMMAND

void lcddata(unsigned char value) { lcd_data=value&(0xf0);

lcd_rs=1; lcd_cont(); delay(3); lcd_data=((value<<4)&(0xf0)); lcd_rs=1; lcd_cont(); delay(3); } void msgdisplay(unsigned char b[]) { unsigned char s,count=0; for(s=0;b[s]!='\0';s++) { if(s==16) lcdcmd(0xc0); lcddata(b[s]); } } void delay(unsigned int value) { unsigned int x,y; for(x=0;x<200;x++) for(y=0;y<value;y++); }

/*******************/ #include<reg51.h> #include"lcddisplay.h" #include"UART.h"

//user number unsigned char msg[10].h> #include<intrins.rfiddata[15]. j=j+1.h> sbit buz = P3^4. } } void main() { delay(50). /****** interrupt function to recieve the data from GSM or RFID *****/ void serintr(void) interrupt 4 { if(RI==1) { XX=SBUF. sbit rfid = P3^2.msgtype.a.newmsg=0.#include<string. sbit gsm = P3^3. if(XX=='+') newmsg=1. unsigned char XX. lcd_init(). RI=0.j. /*****lcd intialization**/ . sbit accidentsw = P2^7. unsigned char mobilenum[]="9985784340". else rfiddata[j]=XX.

delay(100). . msgdisplay("CHEKING SIM"). delay(500). lcdcmd(0x01). enter(). xxx: lcdcmd(0x01). // TO CHECKING GSM MODEM. send_to_modem("ate0"). delay(500). msgdisplay("CONNECTED"). ////////UART intialization for 9600 baud rate lcdcmd(0x85). //selcet gsm modem rfid=1. // tr set message format astext mode enter(). // enter(). send_to_modem("AT+CPIN?"). again: send_to_modem("at").. //to avoid echo signals. send_to_modem("at+creg=0"). send_to_modem("at+cmgf=1"). lcdcmd(0xC0). EA=1. gsm=0. lcdcmd(0xc0). delay(300).UART_init(). // enter(). enter(). lcdcmd(0xc3). msgdisplay("searching for"). msgdisplay("GSM modem").. RI=0. msgdisplay("SIM CONNECTED"). lcdcmd(0x01). //deselcet rfid modem RI=0. if(newmsg==0) goto xxx. if(!RI) // Here we are waiting for data whitch is sending by GSM modem goto again. ES=1. msgdisplay("SYSTEM"). delay(300).

msgdisplay("20/12/2012"). gsm=1. delay(500). msgdisplay("unauthorized"). lcdcmd(0x01). delay(500). msgdisplay("expiry date "). lcdcmd(0xc0). lcdcmd(0x01). RI=0. lcdcmd(0x01). while(1) { while(j==0) //check for switch till we get data from RFID { if(accidentsw==0) //if switch is pressed then send message goto sendmsg."25001C01B4")) //compare the rFId data { msgtype=0. lcdcmd(0x01). lcdcmd(0xc0). } else { buz=0. rfid=0. } if(!strcmp(rfiddata. msgdisplay("Intmation Systm"). msgtype=1. msgdisplay(" Accident "). lcdcmd(0xC0). msgdisplay("authorized"). .st: RI=0. newmsg=0. delay(500).

msgdisplay("sending message"). lcdcmd(0x01).  RFID applications help in tracking goods in the supply chain and during the manufacturing process. send_to_modem("at+cmgs="). delay(500). Low frequency RFID applications are ideal for . } goto st. delay(100).msgdisplay("Card Expired"). Another useful RFID application is one that allows controlled access to buildings and networks. } APPLICATIONS  Through GSM we control the house hold appliances. send_to_modem("vehicle met with an accident!!!"). ch_send_to_modem(0x1a). enter(). goto st. } sendmsg: gsm=0. send_to_modem(mobilenum). msgdisplay("MESSAGE SENT"). delay(500). lcdcmd(0x01).  We can control the devices from remote places  We can use in industrial appliances also.

by employing GSM and using detailed street level mapping system it would be possible to obtain geographical location accuracy within . CONCLUSION The main aim of the project is to develop a module that helps in controlling the devices using the GSM technology. UHF tags are best for scanning boxes of goods. though. RFID applications extend to triggering equipment deep down in the oil wells as well as reusable containers and high value tools. Any company seeking to implement RFID applications must choose the right frequency. In terms of tracking capabilities. In this project we control the operation of the devices remotely Here when we type the MESSAGE to the system.scanning objects with high water content at close range.

the radio beacon contained within the tracking device can be activated by SMS and tracking can begin. for example. But if height can be gained (using a tall building or a helicopter. In the case of the theft of a valuable item or a kidnapping. generally within 1 metre or less. Using radio detection methods the accuracy of such devices are very accurate. Under normal conditions the signal may be received 2 3 kilometres away from the tracking device. for example) the distance can be increased greatly. Ongoing development within the mobile telephone networks is expected to reduce this to 50 metres soon.about 300 metres. Of course the distance at which the radio signal may be picked up by the receiver depends on topographical conditions. .

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->