You are on page 1of 78

Table of contents Executive Summary............................................................... .............................................. 2 Introduction .................. ................................................................................ ...................... 3 Part one .............................................. ................................................................................ 5 Hardware ....................................................................

........................................................ 5 Infrared Transmitter ................................................................................ ....................... 5 Infrared receiver .................................... ......................................................................... 6 Inve rter gate (SN54/74LS04) ........................................................ .................................. 7 Microcontroller ........................... ................................................................................ .... 7 A Brief Introduction to 8051 Microcontroller............................. ................................ 7 Pin Description of the AT89C55WD microcontrol ler: ............................................... 10 Interrupt .............. ................................................................................ ...................... 12 Level-triggered interrupts ........................... .......................................................... 12 Enabling and disab ling an interrupt .............................................................. .... 13 Serial Interrupt ....................................................... ............................................... 14 Serial data cable ........... ................................................................................ ................. 17 An Introduction to Nokia F-Bus ............................ .................................................... 18 The difference between F (Fast) bus and M (master) bus .................................... 18 Introduct ion to serial data cable (DB-9) ................................................ ................... 18 AT command supporting GSM mobile phone. ................. ............................................ 20 The phone we used for the projec t is an AT command supporting. At commands will be explained in later topics lat er ............................................................................. ..... 20 Part two .............................................................. .............................................................. 21 Software ..... ................................................................................ ...................................... 21 Theory of Operation................... ................................................................................ ... 21 Assembly Language ....................................................... ................................................ 23 Advantages of Assembly langu age .......................................................................... 2 3 ASM (assembly) form........................................................... ................................ 25 HEX (the program in hexadecimal values) form .................................................. 25 LST (list) form ......... ................................................................................ ............. 27 AT-Command set overview ....................................... ................................................ 30 Table 3: AT command set .... ................................................................................ ..... 30 AT command formats .................................................... ........................................... 30 The text mode ................... ................................................................................ .... 30 PDU (protocol data unit) mode .......................................... .................................. 31 Coding 7-bit data (septets) into octets .. ............................................................ 31 ASCII Character Chart with Decimal, Binary and Hexadecimal Conversions .... 31 Sending a message in the PDU mode ............................................................... ........ 33 Serial Communication ............................................... .................................................... 35 Setting the Serial Port Mode............................................................................ ......... 36 Setting the Baud rate ............................................. ................................................... 37

Application and future development ............................................. .................................. 38 Conclusion ............................... ................................................................................ .......... 39 Recommendation.................................................... .......................................................... 40 Reference material s .............................................................................. ............................ 41

Executive Summary In today's world, where the issue of security is of paramount im portance, people, institutions, government and non-government offices are concer ned about it. And also the field is growing with a very high pace. This project, GSM BASED HOME SECURITY SYSTEM, is a system which works by using Infrared senso rs, Microcontroller, mobile transmitter and receiver units to alarm the user of the system up on the intrusion of any unauthorized person or material in any app lication area by sending text SMS to the user. The GSM (Global system for Mobile communication) network, which we use in our daily life for mobile communication s, is utilized for different purposes other than simple voice call services. And Security is one of the areas where GSM technology applies. To make the microcon troller send SMS and make voice calls, the project exploited the F/M protocol wh ich applies in every mobile phone that supports AT commands. A more specific blo ck diagram representation of the project would be given in the following form. I nverter IR Transmitter IR Receiver Gate AT89C55 WD Microcont roller Serial Inter face Transmitte r mobile unit Fig.1 block diagram representation of the project And in practical ways we can view the system as the following diagram. Receiver mobile unit SMS PORT1 IR Sensor AT89C55 WD Serial Connec tion Fig.2 practical view of the block Diagram

Introduction There is a growing interest in intelligent home network as a way to offer a comfortable, convenient and safe environment for occupants. In order to enhance the occupants' convenience and safety, home security system is indispensa ble in the field of intelligent home network. The requirements of a home securit y system include low cost, low power consumption, easy installation and rapid re sponse to alarm incidents. How to inform user in real time when alarm incidents occur has become a crucial feature of home security system. This can be done via internet or GSM. GSM is more convenient than internet. The main reason is that the GSM network has wide spread coverage making the whole system available for a lmost all the time. Furthermore, GSM network has high security infrastructure wh ich makes sure that the information sent or received cannot be monitored The pro ject is aimed at developing the security of Home against Intruders. In this case , while you are out of your home and a place is intruded then the device sends S MS to the emergency number provided to it. The report consists of a background i nto the area of 8051 microcontroller and mobile communication, how they are inte rfaced to each other and AT (Attention) command sets used in communication. The project can be effectively applied to the following areas: Home security- to moni tor intrusion In monitoring restricted area, military areas In monitoring cash l ockers Furthermore by changing the sensors, signal conditioning elements and by applyin g some changes on the microcontroller program it can also be applied for Fire al arm Sound level monitoring

Pressure, water level, humidity monitoring etc Such security and also microcontroller based projects has not been made previous ly in our department, and hence the project is not a continuation or based on pr evious works.

Part one Hardware The following materials are the hard ware components employed for this project. 1. 2. 3. 4. 5. 6. Infrared Transmitter Infrared receiver Inverter gate (SN54/74LS04) AT89C55WD Mic rocontroller Serial cable AT command supporting GSM mobile phone. Infrared Transmitter Infra-Red actually is normal light with a particular colour. Humans cant see th is colour because its wave length of 950nm is below the visible spectrum. Thats one of the reasons why IR is chosen for remote control purposes or for detectin g intrusion in our case. The infrared transmitter (LED) usually is a battery pow ered component. It should consume as little power as possible, and the IR signal should also be as strong as possible to achieve an acceptable control distance. Preferably it should be shock proof as well. The current through the LED (or LE Ds) can vary from 100mA to well over 1A. In order to get an acceptable control d istance the LED currents have to be as high as possible. A trade-off should be m ade between LED parameters, battery lifetime and maximum control distance. LED c urrents can be that high because the pulses driving the LEDs are very short. Ave rage power dissipation of the LED should not exceed the maximum value though. Yo u should also see to it that the maximum peek current for the LED is not exceede d. All these parameters can be found in the LEDs data sheet. A simple transisto r circuit can be used to drive the LED. A transistor with a suitable HFE (transi stor current gain) and switching speed should be selected for this purpose. The resistor values can simply be calculated using Ohms law. The nominal voltage dr op over an IR LED is approximately 1.1V. R R

The normal driver, described above, has one disadvantage. As the battery voltage drops, the current through the LED will decrease as well. This will result in a shorter control distance that can be covered. fig.3 I/R transmitters An emitter follower circuit can avoid this. The 2 diodes in series will limit the pulses o n the base of the transistor to 1.2V. The base-emitter voltage of the transistor subtracts 0.6V from that, resulting in constant amplitude of 0.6V at the emitte r. This constant amplitude across a constant resistor results in current pulses of a constant magnitude. Calculating the current through the LED is simply apply ing Ohms law again. Infrared receiver In the picture below we can see a typical block diagram of an IR receiver. The r eceived IR signal is picked up by the IR detection diode on the left side of the diagram. This signal is amplified and limited by the first 2 stages. The limite r acts as an AGC circuit to get a constant pulse level, regardless of the distan ce to the transmitter. Fig.4 I/R receiver As we can see only the AC signal is sent to the Band Pass Filter. The Band Pass Filter is tuned to the modulation frequency of the transmitter unit. Common freq uencies range from 30 KHz to 60 KHz in consumer electronics. The next stages are a detector (demodulator), integrator and comparator. The purpose of these three blocks is to detect the presence of the modulation frequency. If this modulatio n frequency is present the output of the comparator will be pulled low. All thes e blocks are integrated into a single electronic component. There are many diffe rent manufacturers of these components on the market. And most devices are avail able in several versions each of which are tuned to a particular modulation freq uency. Fig.5 integrated I/R receiver

Inverter gate (SN54/74LS04) In digital logic, an inverter or NOT gate is a logic gate which implements logic al negation. The truth table is shown below INPUT A 0 Fig.6: Typical inverter ga te 1 OUTPUT NOT A 1 0 Table 1: Truth table for Inverter Gate In our case we used the SN54/74LS04 which is a group of 6 inverters found in an IC form. The purpose of this inverter gate in our case is to invert the signal f rom the receiver unit so that it changes the normally high state of the receiver (low state at the output of the inverter) to high state, so that the intrusion (low state at the receiver) is detected. Vcc 14 13 12 11 10 9 8 Fig. 7: SN54/74LS04 inverter gate 1 2 3 4 5 6 7 GND Microcontroller A Brief Introduction to 8051 Microcontroller When we have to learn about a new computer we have to familiarize about the mach ine capability we are using, and we can do it by studying the internal hardware design (devices architecture), and also to know about the size, number and the s ize of the registers.

A microcontroller is a single chip that contains the processor (the CPU), nonvol atile memory for the program (ROM or flash), volatile memory for input and outpu t (RAM), a clock and an I/O control unit. Also called a "computer on a chip," bi llions of microcontroller units (MCUs) are embedded each year in a myriad of pro ducts from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers. The following picture describes a general block diagram of microcontroller. Fig.8: Block diagram of microcontroller The following are some of the capabilities of 8051 microcontroller. Internal ROM and RAM I/O ports with programmable pins Timers and counters Serial data commun ication The 8051 architecture consists of these specific features: 16 bit PC &da ta pointer (DPTR)

8 bit program status word (PSW) 8 bit stack pointer (SP) Internal ROM 4k Interna l RAM of 128 bytes. 4 register banks, each containing 8 registers 80 bits of gen eral purpose data memory 32 input/output pins arranged as four 8 bit ports: P0-P 3 Two 16 bit timer/counters: T0-T1 Two external and three internal interrupt sou rces Oscillator and clock circuits. The microcontroller used in this project is Atmel's AT89C55WD. The AT89C55WD is a low-power; high-performance CMOS 8-bit microcomputer with 20K bytes of Flash pro grammable read only memory and 256 bytes of RAM. The device is manufactured usin g Atmel's high-density nonvolatile memory technology and is compatible with the in dustry standard 80C51 and 80C52 instruction set and pin out. The on-chip Flash a llows the program memory to be user programmed by a conventional nonvolatile mem ory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic ch ip, the Atmel AT89C55WD is a powerful microcomputer which provides a highly flex ible and cost effective solution to many embedded control applications. The AT89 C55WD provides the following standard features: 20K bytes of flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector, two-level interru pt architecture, a full-duplex serial port, on-chip oscillator, and clock circui try. In addition, the AT89C55WD is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down Mode saves the RAM con tents but freezes the oscillator, disabling all other chip functions until the n ext external interrupt or hardware reset. The pin diagram of the 8051 shows all of the input/output pins unique to microco ntrollers:

Fig. 9: 8051 family microcontroller chip Pin Description of the AT89C55WD microcontroller: VCC: Supply voltage. GND: Ground. Port 0: Port 0 is an 8-bit open-drain bi-direc tional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode P0 has internal pull -ups. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pull-ups are required durin g program verification Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The P ort 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As

inputs, Port 1 pins that are externally being pulled low will source current (II L) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The P ort 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (I IL) because of the internal pull-ups. Port 2 emits the high-order address byte d uring fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, it uses st rong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Spec ial Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 ou tput buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inp uts, Port 3 pins that are externally being pulled low will source current becaus e of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51 as listed below: Table 2: pin description of port 3 Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (extern al data memory write strobe) RD (external data memory read strobe)

Interrupt As the name implies, an interrupt is some event which interrupts normal program execution. Program flow is always sequential, being altered only by those instru ctions which expressly cause program flow to deviate in some way. However, inter rupts give us a mechanism to "put on hold" the normal program flow, execute a su broutine, and then resume normal program flow as if we had never left it. This s ubroutine, called an interrupt handler, is only executed when a certain event (i nterrupt) occurs. The event may be one of the timers "overflowing," receiving a character via the serial port, transmitting a character via the serial port, or one of two "external events."(INT0, INT1) The 8051 may be configured so that whe n any of these events occur the main program is temporarily suspended and contro l passed to a special section of code which presumably would execute some functi on related to the event that occurred. Once complete, control would be returned to the original program. The main program never even knows it was interrupted. T he ability to interrupt normal program execution when certain events occur makes it much easier and much more efficient to handle certain conditions. If it were not for interrupts we would have to manually check in our main program whether the timers had overblown, whether we had received another character via the seri al port, or if some external event had occurred. Interrupts can be triggered ext ernally in two ways. Edge triggered and Level triggered Level-triggered interrupts INT0 and INT1 pins are normally high if low-level signal is applied, it triggers the interrupt microcontroller stops whatever it is doing and jumps to the inter rupt vector table to service the interrupt the low level signal must be removed before the execution of the last instruction of the interrupt service routine, R ETI otherwise, another interrupt will be generated

Edge triggered interrupt is a class of interrupts that are signaled by a level transition on the interrup t line, either a falling edge (1 to 0) or a rising edge (0 to 1). A device wishi ng to signal an interrupt drives a pulse onto the line and then releases the lin e to its quiescent state. If the pulse is too short to be detected by polled I/O then special hardware may be required to detect the edge. Enabling and disabling an interrupt upon reset all interrupts are disabled interrupts must be enabled by software IE register (interrupt enable) is responsible for enabling and disabling the inter rupts

IE is a bit-addressable register Steps in enabling an interrupt EA must be set to 1 set the relevant bits in IE register to high EA = 0, no inte rrupt will be responded to, even if the relevant bit in the IE register is high In this project external interrupt 1 (INT1) is used. This interrupt is falling e dge interrupt (i.e. it is triggered when the input signal changes from logic 1 ( HIGH) to logic 0 (LOW).) For instance, the following program line shows how exte rnal interrupt 1 is enabled for the falling edge trigger. MOV IE, #84H ; ENABLE EXTERNAL INTERRUPT 1 84H is 10000100 in binary and loading 84H to the Interrupt enable (IE) register 84H IE bits 1 EA 0 -0 ET2 0 ES 0 ET1 1 EX1 0 ET0 0 EX0 Serial Interrupt Serial Interrupts are slightly different than the rest of the interrupts. This i s due to the fact that there are two interrupt flags: RI and TI. If either flag is set, a serial interrupt is triggered. The RI bit is set when a byte is receiv ed by the serial port and the TI bit is set when a byte has been sent. This mean s that when your serial interrupt is executed, it may have been triggered becaus e the RI flag was set or because the TI flag was set--or because both flags were set. Thus, your routine must check the status of these flags to determine what action is appropriate. Also, since the 8051 does not automatically clear the RI and TI flags you must clear these bits in your interrupt handler.

Example, MOV SBUF, #'A' ; Character A is sent through the serial interface CLR Ti ; Clear the TI bit before we send another character CHECK: JNB TI, CHECK ; if the TI flag is not set, we jump to the exit point CLR TI; Clear the TI bit before we send another character MOV SBUF, #'T' ; Send another character to the serial port RST Reset input. A high on this pin for two machine cycles while the oscillator is r unning resets the device. ALE/PROG Address Latch Enable output pulse for latching the low byte of the address durin g accesses to external memory. This pin is also the program pulse input (PROG) d uring Flash Programming. In normal operation ALE is emitted at a constant rate o f 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to ext ernal Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC in struction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external program memory. When the AT8 9C51 is executing code from external program memory, PSEN is activated twice eac h machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP External Access Enable (EA) must be strapped to GND in order to enable the devic e to fetch code from external program memory locations starting at 0000H up to F FFFH. Note, however, that if lock bit 1 is programmed, EA will be internally lat ched on reset. EA should be strapped to VCC for internal program executions. Thi s pin also receives the 12-volt programming enable voltage (VPP) during Flash pr ogramming, for parts that require 12-volt VPP. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock oper ating circuit. XTAL2 It is the output from the inverting oscillator amplifier. Unconnected while XTAL 1 is driven as shown in Figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry i s through a divide-by-two flip-flop, but minimum and maximum voltage high and lo w time specifications must be observed. Idle Mode In idle mode, the CPU puts itself to sleep while all the on chip peripherals rem ain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It shoul d be noted that when idle is terminated by a hard ware reset, the device normall y resumes program execution, from where it left off, up to two machine cycles be fore The internal reset algorithm takes control. On-chip hardware inhibits acces s to internal RAM in this event, but access to the port pins is not inhibited. T o eliminate the possibility of an unexpected write to a port pin when Idle is te rminated by reset, the instruction following the one that invokes Idle should no t be one that writes to a port pin or to external memory.

Serial data cable Is a data transfer cable to connect the phone with a PC and to a Microcontroller in our case. There are many different types of such cables depending on their m anufacturers, architecture, protocols, number of pins, time of manufacturing. So me of these cables. . . Serial data cable USB data cable RJ-45 data cable POP po rt data cable This project uses an F/M bus serial data cable. This data cable ha s one end an F/M bus to connect to the mobile f/M pins and other end a serial to directly connect with the microcontroller. We use this cable because the microc ontrollers have no any other ports than the serial port with nine pins (DB-9). Fig 10: F/M bus serial data cable for Nokia 3310 fig.11: Nokia 3310

Fig.12: F/M bus pins for Nokia 3310 (Under the back cover) An Introduction to Nokia F-Bus Most Nokia phones have F-Bus and M-Bus connections that can be used to connect a phone to a PC or in our case a microcontroller. The connection can be used for controlling just about all functions of the phone, as well as uploading new firm ware etc. This bus will allow us to send and receive SMS messages. The cable con tains electronics to level convert 3V signals (of the F/M bus) to RS232 (of the serial port) type signals. There are also M and F bus switching in most cables. The difference between F (Fast) bus and M (master) bus M-Bus is a one pin bi-directional bus for both transmitting and receiving data f rom the phone. It is slow (9600bps) and only half-duplex. Only two pins on the p hone are used. One ground and one data. M-Bus runs at 9600bps, 8 data bits, odd parity, and one stop bit. The data terminal ready (DTR) pin must be cleared with the request to send (RTS). This powers the electronics in the cable. F-Bus is t he later high-speed full-duplex bus. It uses one pin for transmitting data and o ne pin for receiving data plus the ground pin. Very much like a standard serial port. It is fast 115,200bps, 8 data bits, no parity, and one stop bit. For F-Bus the data terminal ready (DTR) pin must be set and the request to send (RTS) pin cleared. Introduction to serial data cable (DB-9) In telecommunications, RS-232 (Recommended Standard 232) is a 9 pin standard for serial binary single-ended data and control signals connecting between a DTE (D ata Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is co mmonly used in computer serial ports. In RS-232, user data is sent as a time-ser ies of bits.

Both synchronous and asynchronous transmissions are supported by the standard. I n addition to the data circuits, the standard defines a number of control circui ts used to manage the connection between the DTE and DCE. Each data or control c ircuit only operates in one direction, which is, signaling from a DTE to the att ached DCE or the reverse. Since transmit data and receive data are separate circ uits, the interface can operate in a full duplex manner, supporting concurrent d ata flow in both directions. The standard does not define character framing with in the data stream, or character encoding. Fig. 13: DB-9 female connector Synchronous serial transmission requires that the sender and receiver share a cl ock with one another, or that the sender provide a strobe or other timing signal so that the receiver knows when to read the next bit of the data. Asynchronous transmission allows data to be transmitted without the sender havin g to send a clock signal to the receiver. Instead, the sender and receiver must agree on timing parameters in advance and special bits are added to each word wh ich are used to synchronize the sending and receiving units.

AT command supporting GSM mobile phone. The phone we used for the project is an AT command supporting. At commands will be explained in later topics later Introduction to GSM network GSM (Global System for Mobile Communications): is the most popular standard for mobile telephony systems in the world. It is estimated that 80% of the global mo bile market uses the standard. Its ubiquity enables international roaming arrang ements between mobile phone operators, providing subscribers the use of their ph ones in many parts of the world. GSM differs from its predecessor technologies i n that both signaling and speech channels are digital, and thus GSM is considere d a second generation (2G) mobile phone system. This also facilitates the wide-s pread implementation of data communication applications into the system. GSM als o pioneered low-cost implementation of the short message service (SMS), also cal led text messaging, which has since been supported on other mobile phone standar ds as well. The GSM network works in the spectral range of 900MHz-1800MHz. Our c ountry also uses this GSM network for mobile communication and to the benefit of the network we use a GSM phone, found widely in the market too.

Part two Software Theory of Operation In this project we interfaced the AT89C55WD microcontroller with Nokia GSM mobil e phone through an F/M bus serial data cable to send SMS message automatically u pon intrusion which is detected by the use of an infrared sensor as discussed ab ove. The protocol used for the communication between the microcontroller and the GSM phone is called AT command. When the interrupt fed to the microcontroller i s triggered (i.e. when there is an intruder in the house), the microcontroller s ends a predefined AT commands for a predefined mobile numbers. Any microcontroll er can be programmed using C language or assembly language programming. In the p roject the assembly is applied because it uses very small memory space and also more compact than other languages such as C. Flow Chart of the microcontroller p rogram to accomplish the required task is give below and description about the a ssembly programming and AT command sets will follow.

START Select six cycle machine mode Select external interrupt as edge trigger NO Check interrupt Yes Select baud rate of 115200 bps Give the sms command to mobile for first number Delay of 4 sec Give the SMS command to mobile for the second number Delay of 4 sec Label Give dialing command to mobile for first number Give dialing command to mobile for second number Jump on label Fig. 14: flow diagram of the program Reset Stop

Assembly Language Assembly languages are a type of low-level languages for programming computers, microprocessors, microcontrollers, and other (usually) integrated circuits. They implement a symbolic representation of the numeric machine codes and other cons tants needed to program a particular CPU architecture. This representation is us ually defined by the hardware manufacturer, and is based on abbreviations (calle d mnemonics) that help the programmer remember individual instructions, register s, etc. An assembly language family is thus specific to certain physical (or vir tual) computer architecture. This is in contrast to most high-level languages, w hich are (ideally) portable. A utility program called an assembler is used to tr anslate assembly language statements into the target computers machine code. Th e assembler performs a more or less isomorphic translation (a one-to-one mapping ) from mnemonic statements into machine instructions and data. This is in contra st with high-level languages, in which a single statement generally results in m any machine instructions. Many sophisticated assemblers offer additional mechani sms to facilitate program development, control the assembly process, and aid deb ugging. In particular, most modern assemblers include a macro facility (describe d below), and are called macro assemblers. Advantages of Assembly language It is possible to program a microcontroller by using either assembly language or C programming language. We chose assembly language because of the following rea sons. Assembly language is compact (i.e. it takes small memory space compared to C) Assembly code has fine control that it allows over the code. An advantage of assembly language over high level languages is the fine control that it allows over the code. Since assembly language directly correlates which machine instructions, the only way to get closer to the machine is to write in b inary or hex code. Another advantage is that you can invoke specialized instruct ions to do I/O, or manipulate hardware, such as page descriptor tables in the ke rnel.

The fine control advantage is, however, illusive. Modern compilers do a very goo d job of optimizing, and assembly language is very verbose, requiring you to spe cify "everything", and to keep track of "everything". The project uses an assemb ler environment called MIDE-51 studio. The snap shot and some explanation is giv en below of the assembler. Fig. 15: snapshot Of MIDE-51 studio Features of the MIDE-51 studio: Syntax highlighter on ASEM-51 reserved word & ad dition register on selected device (devices listed on ASEM51/MCU folder) Support standard editor feature and shortcut key such as Cut , Copy, Paste, Find, Repla ce and Windows tile & cascade Save recent file(s) opened in list Report assemble r & compiler message The MIDE-51 studio saves the microcontroller program we written on it is three d ifferent formats. ASM (assembly) form, HEX (the program in hexadecimal values) f orm, and the LST (list) file formats.

ASM (assembly) form Program written in assembly language, a low level programming language that can be converted to machine language; may be edited with a text editor and run using an assembler program, such as MIDE-51 studio.This format is the type we call th e source code for the microcontroller. Example of .ASM file ORG 807FH HERE1: MOV PCON, #80H; TO SET SMOD BIT FOR DOUBLE BAUD RATE MOV TMOD, #20H; TIMER 1 MODE 2 (AUTORELOAD) MOV TH1, #0FFH; 115200 BAUD RATE MOV SCON, #40 H; 8 BIT, 1 STOP BIT SETB TR1 CLR TI MOV SBUF, #'A'; COMMAND AAAA: JNB TI, AAAA CLR TI MOV SBUF,'# ; START TIMER 1 HEX (the program in hexadecimal values) form The format is a text file, with eac h line containing hexadecimal values encoding a sequence of data and their starting offset or absolute address. There are three types of HEX: 8-bit, 16-bit, and 32-bit. They are distinguished by their byte or der. Each line of HEX file consists of six parts: 1. Start code, one character, an ASCII colon :. 2. Byte count, two hex digits, a number of bytes (hex digit pairs) in the data f ield. 16 (0x10) or 32 (0x20) bytes of data are the usual compromise values betwe en line length and address overhead.

3. Address, four hex digits, a 16-bit address of the beginning of the memory pos ition for the data. Limited to 64 kilobytes, the limit is worked around by speci fying higher bits via additional record types. 4. Record type, two hex digits, 0 0 to 05, defining the type of the data field. 5. Data, a sequence of n bytes of the data themselves, represented by 2n hex digits. 6. Checksum, two hex digits the least significant byte of the twos complement of the sum of the values of all fields except fields 1 and 6 (Start code ":" byte and two hex digits of the Checksum). Example of .HEX file Following is a typical Hex-record module consist ing of four data records and a termination record. : : : : : 10010000214601360121470136007EFE09D2190140 100110002146017EB7C20001FF5 F16002148011988 10012000194E79234623965778239EDA3F01B2CAA7 100130003F0156702B5E7 12B722B732146013421C7 00000001FF The first data record is explained as follows: : Start code. 10 Hex 10 (decimal 16), indicating 16 data character pairs, 16 bytes of binary data, in this record . Four-character 2-byte address field: hex address 0100, indicates location wher e the following data is to be loaded. Record types indicating a data record. 01 00 00 The next 16 character pairs are the ASCII bytes of the actual program data. 40 C hecksum of the first Hex-record. The termination record is explained as follows: : 00 00 00 01 FF Start code. Byt e count is zero, no data in termination record. Four-character 2-byte address fi elds, zeros. Record type 01 is termination. Checksum of termination record.

LST (list) form Is the machine language equivalent of the .ASM file formats. In this case each o f the .ASM commands has their respective representation on the machine code, the .LST representation. Below is the .LST equivalent for the section of source cod e we wrote above. 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 807F 8082 8085 8088 808B 808D 808F 8 092 8095 8097 N 807F ORG 807FH HERE1: MOV PCON,#80H ;TO SET SMOD BIT FOR DOUBLE BAUD RATE MOV TMOD,#20H ;TIMER 1 MODE 2 (AUTORELOAD) MOV TH1,#0FFH ;115200 BAUD RATE MOV SCON,#40H ;8 BIT,1 STOP BIT SETB TR1 CLR TI MOV SBUF,#A ;COMMAND AAAA : JNB TI,AAAA CLR TI MOV SBUF,#T ;START TIMER 1 75 87 80 75 89 20 75 8D FF 75 98 40 D2 8E C2 99 75 99 41 30 99 FD C2 99 75 99 54 List form Source code AT-Command set AT commands are instructions used to control a modem. AT is the a bbreviation of Attention. Every command line starts with "AT" or "at". Thats wh y modem commands are called AT commands. Many of the commands that are used to c ontrol wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control ) and ATO (Return to online data state), are also supported by GSM modems and mo bile phones. Besides this

common AT command set, GSM modems and mobile phones support an AT command set th at is specific to the GSM technology, which includes SMS-related commands like A T+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (Lis t SMS messages) and AT+CMGR (Read SMS messages). Note that the starting "AT" is the prefix that informs the modem about the start of a command line. It is not p art of the AT command name. For example, D is the actual AT command name in ATD and +CMGS is the actual AT command name in AT+CMGS. However, some books and web sites use them interchangeably as the name of an AT command. Here are some of th e tasks that can be done using AT commands with a GSM modem or mobile phone: Get basic information about the mobile phone or GSM/GPRS modem. For example, nam e of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR). Get basic i nformation about the subscriber. For example, MSISDN (AT+CNUM) and IMSI number ( International Mobile Subscriber Identity) (AT+CIMI). Get the current status of t he mobile phone or GSM/GPRS modem. For example, mobile phone activity status (AT +CPAS), mobile network registration status (AT+CREG), radio signal strength (AT+ CSQ), battery charge level and battery charging status (AT+CBC). Establish a dat a connection or voice connection to a remote modem (ATD, ATA, etc). Send and rec eive fax (ATD, ATA, AT+F*). Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), wr ite (AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS messages (AT+CNMI). Read (AT+CPBR), write (AT+CPBW) or search (AT+ CPBF) phonebook entries. Perform security-related tasks, such as opening or clos ing facility locks (AT+CLCK), checking whether a facility is locked (AT+CLCK) an d changing passwords (AT+CPWD). (Facility lock examples: SIM lock [a password mu st be given to the SIM card every time the mobile phone is switched on] and PH-S IM lock [a certain SIM card is associated with the mobile phone. To use other SI M cards with the mobile phone, a password must be entered.])

Control the presentation of result codes / error messages of AT commands. For ex ample, you can control whether to enable certain error messages (AT+CMEE) and wh ether 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 G SM/GPRS modem. For example, change the GSM network (AT+COPS), bearer service typ e (AT+CBST), radio link protocol parameters (AT+CRLP), SMS center address (AT+CS CA) and storage of SMS messages (AT+CPMS). Save and restore configurations of th e mobile phone or GSM modem. For example, save (AT+CSAS) and restore (AT+CRES) s ettings related to SMS messaging such as the SMS center address. Note that mobile phone manufacturers usually do not implement all AT commands, c ommand parameters and parameter values in their mobile phones. Also, the behavio r of the implemented AT commands may be different from that defined in the stand ard. In general, GSM modems designed for wireless applications have better suppo rt of AT commands than ordinary mobile phones. In addition, some AT commands req uire the support of mobile network operators. For example, SMS over GPRS can be enabled on some GPRS mobile phones and GPRS modems with the +CGSMS command (comm and name in text: Select Service for MO SMS Messages). But if the mobile network operator does not support the transmission of SMS over GPRS, you cannot use thi s feature. The commands can be tried out by connecting a GSM modem to one of the PC's COM ports. Type in the test-command, adding CR + LF (Carriage return + Line feed = \r\n) before executing. Table gives an overview of the implemented AT-Com mands in this application. The use of the commands is described in the later sec tions.

AT-Command set overview Command AT ATE0 AT+CNMI AT+CPMS AT+CMGF AT+CMGR AT+CMGS AT+CMGD Description Chec k if serial interface and GSM modem is working. Turn echo off, less traffic on s erial line. Display of new incoming SMS. Selection of SMS memory. SMS string for mat, how they are compressed. Read new message from a given memory location. Sen d message to a given recipient. Delete message. Table 3: AT command set AT command formats There are two ways of sending and receiving SMS messages by using a PC or microcontroller. Text mode and PDU (protocol description unit) mode. The text mode (unavailable on some phones) is just an encoding of the bit stream represented by the PDU mode. This mode simply uses the above explained AT comma nds directly to send SMS and for dialing. Alphabets may differ and there are sev eral encoding alternatives when displaying an SMS message. The most common optio ns are "PCCP437", "PCDN", "8859-1", "IRA" and "GSM". These are all set by the at -command AT+CSCS, when you read the message in a computer application. If you re ad the message on your phone, the phone will choose a proper encoding. An applic ation capable of reading incoming SMS messages can thus use text mode or PDU mod e. If text mode is used, the application is bound to (or limited by) the set of preset encoding options. In some cases, thats just not good enough. If PDU mode is used, any encoding can be implemented. When selecting from text mode and PDU mode AT+CMGF=1 will select us the TEXT mode and AT+CMGF=0 will select us the PD U mode. E.g. ATI Returns general modem identification

ATD<phone number> Dials the phone number you supplied (don't enter the <> brackets ) ATH Hang-up the phone (useful after the previous command). PDU (protocol data unit) mode The formatting of these PDU's is a little more complicated and requires some bit m anipulations that are hard to do by hand. The GSM modem is put into PDU mode wit h the command `AT+CMGF=0'. Once in PDU mode a PDU can be sent using the `AT+CMGS' comman d: AT+CMGS=<length><CR> > <here goes your PDU><Crtl-Z> The actual PDU consists of a number of octets (bytes). In the command the <lengt h> field represents the number of octets and the PDU is given in the hexadecimal representation of those octets. The `> `on the second line is a prompt that is writ ten by the GSM modem to indicate that it is ready to accept the PDU. Coding 7-bit data (septets) into octets The message "hello GSM" consists of 10 characters, called septets when represent ed by 7 bits each. These septets need to be transformed into octets for the SMS transfer. text Deci. 7.bit binary(septate) 7.bit binary(septate) h 104 1101000 e 101 1100101 l 108 1101100 l 108 1101100 o 111 1101111 Space 32 0100000 G 71 1000111 S 83 1010011 M 77 1001101 1101000 110010 1 11011 00

1101 100 110 1111 0100000 1 000111 1010011 1001101 octate 1 1101000 00 110010 100 11011 1111 1101 00000 110 000111 01 1010011 1 1001101 Hex. E8 32 9B FD 06 1D A7 4D Table 4: coding 7 bit data into octates ASCII Character Chart with Decimal, Binary and Hexadecimal Conversions

ASCII stands for "American Standard Code for Information Interchange". It is the character set that is used in PCs and most other small computers. The table bel ow lists all of the alphanumeric characters in the character set, along with the ir decimal, 7 bit septet(7 bit binary) and hexadecimal number equivalents, so yo u can also use it as a conversion chart: Table5: ASCII HEX Binary conversion cha rt Instead of using the above time taking and boring method It's also possible to use an application to change the 7-bit data (septets) into octets. This application which can be downloaded easily from the internet is called SMS packer.

Fig. 16: snap shot of SMS packer By using this application we can easily convert any message type in to its hexad ecimal equivalent. Sending a message in the PDU mode The following example shows how to send the message "hello GSM" in the PDU mode from a Cell phone. AT+CMGF=0 //Set PDU mode AT+CSMS=0 //Check if modem supports SMS commands AT+CMG S=21 //Send message, 21 octets (excluding the two initial zeros) >0011000A819021 2000120000AA08E8329BFD061DA74D <ctrl-z> There are 23 octets in this message (46 characters). The first octet ("00") do esnt count, it is only an indicator of the length of the SMSC information suppl ied (0). The PDU string consists of the following:

Octet(s) Description Length of SMSC information. Here the length is 0, which means that t he SMSC stored in the phone should be used. Note: This octet is optional. On som e phones this octet should be omitted! (Using the SMSC stored in phone is thus i mplicit) First octet of the SMS-SUBMIT message. TP-Message-Reference. The "00" v alue here lets the phone set the message reference number itself. Address-Length . Length of phone number (10) Type-of-Address. (81 indicates unknown phone forma t of the phone number). This is used when the user or network has no a priori in formation about the numbering plan. In this case, the Address-Value field is org anized according to the network dialing plan. The phone number in semi octets (0 912020021). The length of the phone number is even (10), therefore a trailing F is not added. TP-PID. Protocol identifier TP-DCS. Data coding scheme. This messa ge is coded according to the 7bit default alphabet. Having "04" instead of "00" here, would indicate that the TP-User-Data field of this message should be inter preted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc). TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see b its 4 and 3 of the first octet TP-User-Data-Length. Length of message. The TP-DC S field indicated 7-bit data, so the length here is the number of septets (8). I f the TP-DCS field were set to 8-bit data or Unicode, the length would be the nu mber of octets. 00 11 00 0A 81 9021200012 00 00 AA 08 E8329BFD061DA74D TP-User-Data. These octets represent the message "hello GSM". T able 6: parts of the PDU string

Serial Communication Serial communication is often used either to control or to receive data from an embedded microprocessor. In serial communication the bits are transmitted at spe cific time intervals determined by the baud rate of the serial signal. Each byte is preceded by a start bit and followed by one stop bit as shown in the figure below. The start and stop bits are used to synchronize the serial receivers. The data byte is always transmitted least-significant-bit first. For error checking it is possible to include a parity bit as well, just prior to the stop bit. Fig.17: Serial Waveform One of the 8051's many powerful features is its integrated UART, otherwise known a s a serial port. The fact that the 8051 has an integrated serial port means that you may very easily read and write values to the serial port. If it were not fo r the integrated serial port, writing a byte to a serial line would be a rather tedious process requiring turning on and off one of the I/O lines in rapid succe ssion to properly "clock out" each individual bit, including start bits, stop bi ts, and parity bits.

However, we do not have to do this. Instead, we simply need to configure: The se rial ports operation mode and Baud rate Once configured, all we have to do is wr ite to an SFR (special function register) to write a value to the serial port or read the same SFR to read a value from the serial port. The 8051 will automatic ally let us know when it has finished sending the character we wrote and will al so let us know whenever it has received a byte so that we can process it. We do not have to worry about transmission at the bit level--which saves us quite a bi t of coding and processing time. Setting the Serial Port Mode First, let's present the "Serial Control" (SCON) SFR and define what each bit of t he SFR represents: Table 7: bit description of SCON Bit Name 7 6 5 4 3 2 1 0 SM0 SM1 SM2 REN TB8 RB8 TI RI Bit Address 9Fh 9Eh 9Dh 9 Ch 9Bh 9Ah 99h 98h Explanation of Function Serial port mode bit 0 Serial port mode bit 1. Multiprocessor Communications Ena ble (explained later) Receiver Enable. This bit must be set in order to receive characters. Transmit bit 8. The 9th bit to transmit in mode 2 and 3. Receive bit 8. The 9th bit received in mode 2 and 3. Transmit Flag. Set when a byte has bee n completely transmitted. Receive Flag. Set when a byte has been completely rece ived. Additionally, it is necessary to define the function of SM0 and SM1 by an additi onal table:

SM0 SM1 Serial Mode 0 0 1 1 0 1 0 1 0 1 2 3 Explanation 8-bit Shift Register 8-bit UART 9-bit UART 9-bit UART Baud Rate Oscillator / 12 Set by Timer 1 (*) Oscillator / 64 (*) Set by Timer 1 (*) Note: The baud rate indicated in this table is doubled if PCON.7 (SMOD) is set. In the program, for sending the AT command to the serial port the program line u sed is:MOV SCON, #40H; 8 BIT, 1 STOP BIT The Special function register SCON (ser ial control) is loaded with #40H which has binary equivalent of 01000000. 40H SC ON bits 0 SM0 1 SM1 0 SM2 0 REN 0 TB8 0 RB8 0 TI 0 RI The combination of SM0 and SM1 for 40H is 0, 1 which is defined as 8-bit UART an d baud rate set by timer 1 (*) in the additional table above. Setting the Baud r ate The baud rate is the reciprocal of the time to send 1 bit. Error-free serial communication requires that the baud rate, number of data bits, number of stop bits, and presence or absence of a parity bit be the same at the transmitter and at the receiver. In mode 1, the baud rate is determined by how frequently timer 1 overflows. The more frequently timer 1 overflows, the higher the baud rate. T here are many ways one can cause timer 1 to overflow at a rate that determines a baud rate, but the most common method is to put timer 1 in 8-bit auto-reload mo de (timer mode 2) and set a reload value (TH1) that causes Timer 1 to overflow a t a frequency appropriate to generate a baud rate. The baud rate of 115200 bps i s used in this project. This was set by the program line: MOV TMOD, #20H; TIMER 1 MODE 2 (AUTORELOAD) MOV TH1, #0FFH; 115200 BAUD RATE

Application and future development The project can be applied to areas of maximum security concern like: Banks, trea sury and jewelry It can be used for the military purpose for security of restric ted zones It can also be used the reverse way. i.e. controlling appliances by us ing SMS messages like switching fan, freezers and other on/off controlled device s.

Conclusion Assembly language programming is a very good choice for designing embedded syste ms. It may have some discomforts compared with high-level languages but have goo d flexibility and is compact, can be applied with in very low memory spaces As S MS is much cheaper in today time it is economical to exploit such technology for application like our system. The system gives real time alert to the user. The system uses the reliability of the existing cellular network The total system is hidden and can be made very small in size so that is cannot be exposed to or de tected by thief. The system can be made more faithful and reliable by increasing authorized security personnel or user, and if there is network problem for one authorized user or security personnel then the call goes to other user or securi ty persons. The total system cost and power consumption is very low. The system is very flexible so that by changing the sensors adding signal conditioning circ uits and by modifying the assembly program it can be applied to respond for many different situations.

Recommendation The system, as explained earlier, is very important in many areas and we recommend our campus, MU, to be one of the beneficiaries of such systems . As we've tried to express before, such microcontroller projects had not been mad e before in our department so we recommend our department staff take the initiat ive to support such projects and give the required support so that such projects could perform well students could share their knowledge for the benefit of the society. We recommend our department have very good record of all its resources which is available for students and can serve as a good standing point for prosp ective projects in the future. We highly recommend the establishment of technolo gy research centers so that many different professional and beginner technologis ts could apply their knowledge and contribute for the development of our country .

Reference materials http://www.wikipedia.com/ http://www.gsmforum.com/ http://www.sonsivri.com/ http ://www.freebsd.org/ http://www.activeexperts.com/ http://www.dreamfabric.com/sms / http://www.8052.com http://www.embedtronics.com/nokia/fbus.html

Appendix a: source code for GSM based security system ; SOFTWARE ORG 8000H MOV 8FH,#01H ;SELECT 6 MACHINE CYCLE MODE LJMP MAIN COMMENT S ORG 9400H; MAIN PROGRAM MAIN: SETB IT1; SELECT EXTERNAL INTERRUPT 1 AS EDGE TRI MOV IE, #84H; ENABLE EXTERNAL INTERRUPT 1 HERE: SJMP HERE; ISR OF INTERRUPT ORG 0013H LJMP HERE1; long jump to HERE1 RETI ORG 807FH HERE1: MOV PCON, #80H; TO SET SMOD BIT FOR DOUBLE BAUD RATE MOV TMOD, #20H; TIMER 1 MODE 2 (AUTORELOAD) MOV TH1, #0FFH; 115200 BAUD RATE MOV SCON, #40 H; 8 BIT, 1 STOP BIT SETB TR1 ; START TIMER 1

CLR TI , AAAB , #T DELAY

MOV SBUF, #'A'; COMMAND AAAA: JNB TI, AAAA CLR TI MOV SBUF, #T AAAB: JNB TI CLR TI LCALL ENTER MOV SBUF, #'A'; COMMAND AAAC: JNB TI, AAAC CLR TI MOV SBUF AAAD: JNB TI, AAAD CLR TI LCALL ENTER LCALL MODESEL LCALL PDUFORMAT LCALL LCALL DELAY MOV SBUF, #'A'; COMMAND AAAE: JNB TI, AAAE CLR TI

MOV SBUF, #T AAAF: JNB TI, AAAF CLR TI LCALL ENTER MOV SBUF, #'A'; COMMAND AAAG: J NB TI, AAAG CLR TI MOV SBUF, #T AAAH: JNB TI, AAAH CLR TI LCALL ENTER LCALL MO DESEL LCALL PDUFORMAT1 LCALL DELAY LCALL DELAY LCALL CONTINEOUSDIALLING ORG 8500H MODESEL: MOV SBUF, #'A'; COMMAND FOR PDU MODE SELECTION AAAI: JNB TI, AAAI CLR TI MOV SBUF, #T

AAAJ: JNB TI, AAAJ CLR TI MOV SBUF, #+ AAAK: JNB TI, AAAK CLR TI MOV SBUF, #C AAAL: JNB TI, AAAL CLR TI MOV SBUF, #M AAAM: JNB TI, AAAM CLR TI MOV SBUF, # G AAAN: JNB TI, AAAN CLR TI MOV SBUF, #F AAAO: JNB TI, AAAO CLR TI MOV SBUF, #= AAAP: JNB TI, AAAP CLR TI MOV SBUF, #0 AAAQ: JNB TI, AAAQ

CLR TI LCALL ENTER RET ORG 8700H PDUFORMAT: MOV SBUF, #'A'; COMMAND FOR PDU FORMAT AAAR: JNB TI, AAAR CLR T I MOV SBUF, #T AAAS: JNB TI, AAAS CLR TI MOV SBUF, #+ AAAT: JNB TI, AAAT CLR TI MOV SBUF, #C AAAU: JNB TI, AAAU CLR TI MOV SBUF, #M AAAV: JNB TI, AAAV C LR TI MOV SBUF, #G AAAW: JNB TI, AAAW

CLR TI MOV SBUF, #S AAAX: JNB TI, AAAX CLR TI MOV SBUF, #= AAAY: JNB TI, AAA Y CLR TI MOV SBUF, #3 AAAZ: JNB TI, AAAZ CLR TI MOV SBUF, #3 AZZQ: JNB TI, A ZZQ CLR TI LCALL ENTER LCALL DELAY MOV SBUF, #0 AABB: JNB TI, AABB CLR TI MOV SBUF, #0 AABC: JNB TI, AABC CLR TI MOV SBUF, #1

AABD: JNB TI, AABD CLR TI MOV SBUF, #1 AABE: JNB TI, AABE CLR TI MOV SBUF, #0 AABF: JNB TI, AABF CLR TI MOV SBUF, #0 AABG: JNB TI, AABG CLR TI MOV SBUF, # 0 AABH: JNB TI, AABH CLR TI MOV SBUF, #A AABI: JNB TI, AABI CLR TI MOV SBUF, #8 AABJ: JNB TI, AABJ CLR TI MOV SBUF, #1 AABK: JNB TI, AABK

CLR TI MOV SBUF, #9 AABL: JNB TI, AABL CLR TI MOV SBUF, #0 AABM: JNB TI, AAB M CLR TI MOV SBUF, #4 AABN: JNB TI, AABN CLR TI MOV SBUF, #1 AABO: JNB TI, A ABO CLR TI MOV SBUF, #4 AABP: JNB TI, AABP CLR TI MOV SBUF, #7 AABQ: JNB TI, AABQ CLR TI MOV SBUF, #5 AABR: JNB TI, AABR CLR TI

MOV SBUF, #0 AABS: JNB TI, AABS CLR TI MOV SBUF, #6 AABT: JNB TI, AABT CLR T I MOV SBUF, #4 AAFA: JNB TI, AAFA CLR TI MOV SBUF, #0 AABV: JNB TI, AABV CLR TI MOV SBUF, #0 AABW: JNB TI, AABW CLR TI MOV SBUF, #0 AABX: JNB TI, AABX C LR TI MOV SBUF, #0 AABY: JNB TI, AABY CLR TI MOV SBUF, #A

AABZ: JNB TI, AABZ CLR TI MOV SBUF, #A AACA: JNB TI, AACA CLR TI MOV SBUF, #1 AACB: JNB TI, AACB CLR TI MOV SBUF, #6 AACC: JNB TI, AACC CLR TI MOV SBUF, # D AACD: JNB TI, AACD CLR TI MOV SBUF, #7 AACE: JNB TI, AACE CLR TI MOV SBUF, #A AACF: JNB TI, AACF CLR TI MOV SBUF, #0 AACG: JNB TI, AACG

CLR TI MOV SBUF, #D AACH: JNB TI, AACH CLR TI MOV SBUF, #4 AACI: JNB TI, AAC I CLR TI MOV SBUF, #9 AACJ: JNB TI, AACJ CLR TI MOV SBUF, #9 AACK: JNB TI, A ACK CLR TI MOV SBUF, #7 AACL: JNB TI, AACL CLR TI MOV SBUF, #4 AACM: JNB TI, AACM CLR TI MOV SBUF, #1 AAFB: JNB TI, AAFB CLR TI

MOV SBUF, #E AAFC: JNB TI, AAFC CLR TI MOV SBUF, #4 AAFD: JNB TI, AAFD CLR T I MOV SBUF, #3 AAFE: JNB TI, AAFE CLR TI MOV SBUF, #A AAFF: JNB TI, AAFF CLR TI MOV SBUF, #0 AAFG: JNB TI, AAFG CLR TI MOV SBUF, #6 AAFH: JNB TI, AAFH C LR TI MOV SBUF, #3 AAFI: JNB TI, AAFI CLR TI MOV SBUF, #9

AAFJ: JNB TI, AAFJ CLR TI MOV SBUF, #0 AAFK: JNB TI, AAFK CLR TI MOV SBUF, #5 AAFL: JNB TI, AAFL CLR TI MOV SBUF, #A AAFM: JNB TI, AAFM CLR TI MOV SBUF, # 0 AAFN: JNB TI, AAFN CLR TI MOV SBUF, #4 AAFO: JNB TI, AAFO CLR TI MOV SBUF, #2 AAFP: JNB TI, AAFP CLR TI MOV SBUF, #5 AAFQ: JNB TI, AAFQ

CLR TI MOV SBUF, #9 AAFR: JNB TI, AAFR CLR TI MOV SBUF, #D AAFS: JNB TI, AAF S CLR TI MOV SBUF, #5 AAFT: JNB TI, AAFT CLR TI MOV SBUF, #4 AAFU: JNB TI, A AFU CLR TI MOV SBUF, #6 AAFV: JNB TI, AAFV CLR TI MOV SBUF, #9 AAFX: JNB TI, AAFX CLR TI MOV SBUF, #9 AAFY: JNB TI, AAFY CLR TI

MOV SBUF, #5 AAFZ: JNB TI, AAFZ CLR TI MOV SBUF, #5 AAGA: JNB TI, AAGA CLR T I MOV SBUF, #8 AAGB: JNB TI, AAGB CLR TI MOV SBUF, #2 AAGC: JNB TI, AAGC CLR TI MOV SBUF, #4 AAGD: JNB TI, AAGD CLR TI MOV SBUF, #0 AAGE: JNB TI, AAGE C LR TI MOV SBUF, #2 AACN: JNB TI, AACN CLR TI MOV SBUF, #1AH

AACO: JNB TI, AACO CLR TI RET ORG 8B00H PDUFORMAT1: MOV SBUF, #'A'; COMMAND FOR PDU FORMAT AACP: JNB TI, AACP CLR TI MOV SBUF, #T AACQ: JNB TI, AACQ CLR TI MOV SBUF, #+ AACR: JNB TI, AACR CL R TI MOV SBUF, #C AACS: JNB TI, AACS CLR TI MOV SBUF, #M AACT: JNB TI, AACT CLR TI MOV SBUF, #G AACU: JNB TI, AACU

CLR TI MOV SBUF, #S AACV: JNB TI, AACV CLR TI MOV SBUF, #= AACW: JNB TI, AAC W CLR TI MOV SBUF, #3 AACX: JNB TI, AACX CLR TI MOV SBUF, #3 AACY: JNB TI, A ACY CLR TI LCALL ENTER LCALL DELAY MOV SBUF, #0 AAKY: JNB TI, AAKY CLR TI MOV SBUF, #0 AACZ: JNB TI, AACZ CLR TI MOV SBUF, #1

AADA: JNB TI, AADA CLR TI MOV SBU, #1 AADB: JNB TI, AADB CLR TI MOV SBUF, #0 AADC: JNB TI, AADC CLR TI MOV SBUF, #0 AADD: JNB TI, AADD CLR TI MOV SBUF, # 0 AADE: JNB TI, AADE CLR TI MOV SBUF, #A AADF: JNB TI, AADF CLR TI MOV SBUF, #8 AADG: JNB TI, AADG CLR TI MOV SBUF, #1 AADH: JNB TI, AADH

CLR TI MOV SBUF, #9 AADJ: JNB TI, AADJ CLR TI MOV SBUF, #0 AADK: JNB TI, AAD K CLR TI MOV SBUF, #2 AADL: JNB TI, AADL CLR TI MOV SBUF, #1 AADM: JNB TI, A ADM CLR TI MOV SBUF, #2 AADN: JNB TI, AADN CLR TI MOV SBUF, #0 AADO: JNB TI, AADO CLR TI MOV SBUF, #3 AADP: JNB TI, AADP CLR TI

MOV SBUF, #3 AADQ: JNB TI, AADQ CLR TI MOV SBUF, #6 AAGF: JNB TI, AAGF CLR T I MOV SBUF, #3 AADR: JNB TI, AADR CLR TI MOV SBUF, #1 AADS: JNB TI, AADS CLR TI MOV SBUF, #0 AADT: JNB TI, AADT CLR TI MOV SBUF, #0 AADU: JNB TI, AADU C LR TI MOV SBUF, #0 AADV: JNB TI, AADV CLR TI MOV SBUF, #0

AADW: JNB TI, AADW CLR TI MOV SBUF, #A AADX: JNB TI, AADX CLR TI MOV SBUF, #A AADY: JNB TI, AADY CLR TI MOV SBUF, #1 AADZ: JNB TI, AADZ CLR TI MOV SBUF, # 6 AAHA: JNB TI, AAHA CLR TI MOV SBUF, #D AAHB: JNB TI, AAHB CLR TI MOV SBUF, #7 AAHC: JNB TI, AAHC CLR TI MOV SBUF, #A AAHD: JNB TI, AAHD

CLR TI MOV SBUF, #0 AAHE: JNB TI, AAHE CLR TI MOV SBUF, #D AAHF: JNB TI, AAH F CLR TI MOV SBUF, #4 AAHG: JNB TI, AAHG CLR TI MOV SBUF, #9 AAHH: JNB TI, A AHH CLR TI MOV SBUF, #9 AAHI: JNB TI, AAHI CLR TI MOV SBUF, #7 AAHJ: JNB TI, AAHJ CLR TI MOV SBUF, #4 AAHK: JNB TI, AAHK CLR TI

MOV SBUF, #1 AAHL: JNB TI, AAHL CLR TI MOV SBUF, #E AAHM: JNB TI, AAHM CLR T I MOV SBUF, #4 AAHN: JNB TI, AAHN CLR TI MOV SBUF, #3 AAHO: JNB TI, AAHO CLR TI MOV SBUF, #A AAHP: JNB TI, AAHP CLR TI MOV SBUF, #0 AAHQ: JNB TI, AAHQ C LR TI MOV SBUF, #6 AAHR: JNB TI, AAHR CLR TI MOV SBUF, #3

AAHS: JNB TI, AAHS CLR TI MOV SBUF, #9 AAHT: JNB TI, AAHT CLR TI MOV SBUF, #0 AAHU: JNB TI, AAHU CLR TI MOV SBUF, #5 AAHV: JNB TI, AAHV CLR TI MOV SBUF, # A AAHX: JNB TI, AAHX CLR TI MOV SBUF, #0 AAHY: JNB TI, AAHY CLR TI MOV SBUF, #4 AAHZ: JNB TI, AAHZ CLR TI MOV SBUF, #2 AAIA: JNB TI, AAIA

CLR TI MOV SBUF, #5 AAIB: JNB TI, AAIB CLR TI MOV SBUF, #9 AAIC: JNB TI, AAI C CLR TI MOV SBUF, #D AAID: JNB TI, AAID CLR TI MOV SBUF, #5 AAIE: JNB TI, A AIE CLR TI MOV SBUF, #4 AAIF: JNB TI, AAIF CLR TI MOV SBUF, #6 AAIG: JNB TI, AAIG CLR TI MOV SBUF, #9 AAIH: JNB TI, AAIH CLR TI

MOV SBUF, #9 AAII: JNB TI, AAII CLR TI MOV SBUF, #5 AAIJ: JNB TI, AAIJ CLR T I MOV SBUF, #5 AAIK: JNB TI, AAIK CLR TI MOV SBUF, #8 AAIL: JNB TI, AAIL CLR TI MOV SBUF, #2 AAIM: JNB TI, AAIM CLR TI MOV SBUF, #4 AAIN: JNB TI, AAIN C LR TI MOV SBUF, #0 AAIO: JNB TI, AAIO CLR TI MOV SBUF, #2

AAEK: JNB TI, AAEK CLR TI MOV SBUF, #1AH AAEL: JNB TI, AAEL CLR TI RET ORG 9000H ENTER: MOV SBUF, #0DH; THIS IS CARRIAGE RETURNS i.e. CR AAEM: JNB TI, AAEM CLR TI MOV SBUF, #0AH ; THIS IS LINE FEED i.e. LF AAEN: JNB TI, AAEN CLR TI RET ORG 9100H DELAY: MOV R0, #0FFH MOV R1, #0FFH MOV R2, #3FH BBB: DJNZ R0, BBB; 5 S EC DELAYS DJNZ R1, BBB

DJNZ R2, BBB RET ORG 9200H CONTINEOUSDIALLING: HERE22: MOV SBUF, #A; COMMAND F OR ANOTHER NUMBER DIALLING BBC: JNB TI, BBC CLR TI MOV SBUF, #T BBD: JNB TI, B BD CLR TI MOV SBUF, #D BBE: JNB TI, BBE CLR TI MOV SBUF, #= BBF: JNB TI, BBF CLR TI MOV SBUF, #9 BBG: JNB TI, BBG CLR TI MOV SBUF, #1 BBH: JNB TI, BBH C LR TI

MOV SBUF, #4 BBI: JNB TI, BBI CLR TI MOV SBUF, #7 BBJ: JNB TI, BBJ CLR TI MO V SBUF, #4 BBK: JNB TI, BBK CLR TI MOV SBUF, #0 BBL: JNB TI, BBL CLR TI MOV SBUF, #5 BBM: JNB TI, BBM CLR TI MOV SBUF, #4 BBN: JNB TI, BBN CLR TI MOV SB UF, #6 BBP: JNB TI, BBP CLR TI MOV SBUF, #;

BBQ: JNB TI, BBQ CLR TI MOV SBUF, #0DH; THIS IS CARRIAGE RETURN I.E CR BBR: JNB TI, BBR CLR TI MOV SBUF, #0AH; THIS IS LINE FEED I.E LF BBS: JNB TI, BBS CLR TI MOV SBUF, #'A'; COMMAND FOR DIALLING MOBILE BBT: JNB TI, BBT CLR TI MOV SBUF, #T B BU: JNB TI, BBU CLR TI MOV SBUF, #D BBV: JNB TI, BBV CLR TI MOV SBUF, #= BBW : JNB TI, BBW CLR TI MOV SBUF, #9 BBX: JNB TI, BBX

CLR TI MOV SBUF, #1 BBY: JNB TI, BBY CLR TI MOV SBUF, #3 BBZ: JNB TI, BBZ CL R TI MOV SBUF, #8 BCC: JNB TI, BCC CLR TI MOV SBUF, #2 BCD: JNB TI, BCD CLR TI MOV SBUF, #6 BCE: JNB TI, BCE CLR TI MOV SBUF, #8 BCF: JNB TI, BCF CLR TI MOV SBUF, #8 BCG: JNB TI, BCG CLR TI

MOV SBUF, #2 BCI: JNB TI,BCI CLR TI MOV SBUF, #; BCJ: JNB TI, BCJ CLR TI MOV SBUF, #0DH ; THIS IS CARRIAGE RETURN I.E CR TO EXECUTE COMMAND BCK: JNB TI, BCK CLR TI MOV SBUF, #0AH; THIS IS LINE FEED I.E LF TO EXECUTE COMMAND BCL: JNB TI, BCL CLR TI LJMP HERE22 END

You might also like