GSM NOTICE BOARD WITH EEPROM

Remote notice board means, displaying messages on the notice board using some wireless techniques. In this project we use The GSM technique to display the messages remotely using the SMS services. The main aim of the project is to develop a system which can be used for real time application. The main feature of the project is to receive a message from a remote place using some wireless technology and display that message on notice board. In this project we are using GSM technology. 8051 Microcontroller has been programmed to send messages to the notice board which it is receiving from a remote place through GSM modem. GSM modem has been used for communication with the owner of the product. Owner and users can control the operation of the notice board connected to the product from a far away place. It is possible by sending a text message in the predefined format to the GSM modem. SIM card is used in the modem. Whenever owner sends a valid SMS to the GSM modem (Mobile number of this SIM card), the message is read and verified for password and valid command. If the text message is in the predefined format and the password matches with that of the stored password, then appropriate action will be taken by the microcontroller based on the request made. Similarly when ever a security problem occurs, it will be informed to the owner of the product, by sending an SMS to his/her mobile. GSM modem can be controlled by standard set of AT (Attention) commands. These commands can be used to control majority of the functions of GSM modem.

1

The GSM modem mainly has a SIM card .This SIM card has a number. For e.g. you have taken a AIRTEL SIM card .when you take a SIM card you get the Number of the SIM card .This number is the mobile number. Now if you are using this SIM card for the GSM modem of the NOTICE BOARD .Then this number becomes the notice board number (e.g. AIRTEL 9845296225).So now if you want to display any message on the notice board you have to send SMS to this NOTICE BOARD number.

PREAMBLE 2.1 General introduction
In today’s world it is said that, world is shrinking day by day. It is due to the fact that people from different parts of the world are able to communicate easily with each other within fractions of seconds. All these advantages are possible due to the advances in digital communication techniques. With the advent of cellular technology the use of mobile phones has increased drastically over the years. In today’s world of technological advancements communication and control is necessary in any part of the world. The novel idea of this project is to receive message through mobile phones and send it to notice board for display. This project is basically a microcontroller-based design used to control remote notice board. AT89S51 is the heart of this project. Here, we use mobile phone as a message sender, sending messages to the notice board by sending appropriate SMS. And receiving SMS when ever there is a problem. The mobile used is the GSM (Global System for Mobile Communication) technology. The key strength of GSM is its international roaming capability giving consumers a seamless service, superior speech quality, universal and inexpensive mobile phones, digital convenience, new services (call waiting, call forwarding, SMS). SMS is a GSM service by

2

which you can send and receive data, to and from another GSM handset. The messages can be comprised of words or numbers or an alphanumeric combination. The main advantages of SMS service are it’s an available communication tool for those with speech or hearing difficulties. And if you get an SMS and you are outside of the GSM coverage area, SMS will be stored and you will receive it as soon as you enter the network coverage area. This will always keep you aware of the security situation of your home/office. Using “Attention Commands” (AT Commands) GSM modem operations can be controlled.

2.2 Statement of the problem
To design and develop a system, which receives message from a remote place using GSM modem and displays it on the notice board.. The GSM modem to display the messages remotely using the SMS services. The GSM modem mainly has a SIM card. This SIM card has a number. For e.g. you have taken a AIRTEL SIM card. When you take a SIM card you get the Number of the SIM card .This number is the mobile number. Now if you are using this SIM card for the GSM modem of the notice board .Then this number becomes the notice board number (e.g. AIRTEL 9845296225). So now if you want to display any message on the notice board you have to send SMS to this NOTICE BOARD number.

3

2.3 Objectives of the study
The main objective of selecting this project is to gain knowledge and experience in developing a real time application. Apart from this, to gain the knowledge of AT89S51 microcontroller, GSM modem and the way in which these can be used to receive messages an display on notice board.. 8051 is a popular microcontroller. There are number of 8051 applications. Microcontroller can be programmed to run only one specific application. It can be programmed to accomplish the specific job faster. GSM modems are widely used in mobile phones. The working of the modem can be controlled by “AT” commands. There are many “AT” commands like “AT+CMGR” to read a message etc.

2.4 Scope of literature
System using GSM includes only three applications. Notice board are connected to the system just to show that, it is possible to control various notice board using microcontroller. In this project, the software has been written to send and receive messages. When a message has to be sent, a command is sent to the GSM modem. But, this project would not guarantee, that the message sent would reach the destination. This is not in the scope of this project. .

4

2.6 Review of literature
Many books have provided valuable information that was very useful for this project. One such book authored by Muhammad Ali Mazidi and Janice Gillipse Mazidi, titled “The 8051 Microcontroller and Embedded Systems”. Chapter 10, 8051 Serial communication, was very much helpful. This project is divided in to 9 chapters. Chapter 1 Synopsis of the project. Chapter 2 Preamble provides a brief idea of the project. Chapter 3 Analysis, this chapter explains how analysis has been carried out and requirements are identified. Chapter 4 Design explains about the use of dataflow diagrams and flowchart, to design the system. Chapter 5 Implementation gives the pseudo code for the functions of this project. Chapter 6 Testing, explain the how to test this project. Chapter 7 Interpretation of results and observations, explains how to check the responses given by the project are correct or not. Chapter 8 Conclusion Chapter 9 Bibliography

5

which produced a software product. Spiral model and Evolutionary model. And this process model is more visible. Analysis Design Implementation Testing Figure 2. This process is best only when all the requirements are known in advance.6 Methodology Software Process: The software process is the set of activities and associated results.1 Waterfall process model 6 . Example: Waterfall process model. This process is easy to understand by system developers as well as users.2. The “Waterfall” process model has been followed for the development of this project. Visibility is one of the process characteristics that are looked for by project managers while selecting a process model for any project. as it produces deliverables at the end of end phase. This model is the one of the best process models. There are several variations of this model.

constraints and goals are established by consultation with system users. 2. 1.The waterfall process model has five phases. Testing The individual program units or programs are tested. This will help to know the status of the project at any time. Analysis The system’s services. deliverables are produced after each phase. i. Implementation During this stage. Advantages: 1) The development process is more visible. 4. Disadvantages: 1) It is not possible to go to previous phase to accommodate any changes in it. It establishes overall system architecture. After testing. Design The systems design process partitions the requirements to either hardware or software systems. Software design involves representing the software system functions in a form that may be transformed into one or more executable programs. the software system is delivered to the customer.e. Then they are integrated and tested as a complete system to ensure that the software requirements have been met. the software design is realized as a set of programs or program units. They are as given below. 3. 7 . 2) This is best suitable for projects in which all the requirements are known in advance and projects changes are not required.

the efficient operation of our project depends on the signal of the service provider.  This project is a microcontroller-based project. The main limitation is the size of ROM available on the chip for programming. which will affect the performance of the System.  Another major limitation is the congestion in the network.7 Limitations of the study As there are advantages.  Since we are using wireless technology for communication.2. there are some limitations of this project. 8 . Due to congestion in the network the message sending and receiving will be delayed.

Standard libraries are altered or enhanced to address the peculiarities of an embedded target processor.    Software requirements Hardware requirements Functional Requirements Analysis has been carried out with interaction with the user/client. 2. This may involves developing one or more different system models. 3. which includes many aspects of the ANSI (American National Standard Institute) C programming language.1 Software requirements: 1. Keil µVision2 IDE: Keil µVision2 IDE (Integrated Development Environment) is a Windows based front end for the C Compiler and assembler. 9 . Keil µVision2 is used for writing embedded C programs. Following requirements have been identified after analysis process. discussions with potential user. Embedded C is a high level language.ANALYSIS Analysis is the process of deriving the system requirements through observation of existing system. These C programs are referred as Embedded C programs. These help the analyst understand the system to be specified. Cx51 cross compiler: Cx51 is a cross compiler to compile C programs for your target 8051 environment and provides several extensions to ANSI Standard C to support the elements of the 8051 architecture.

3. Microcontroller (AT89S51): This chip is required in the project. This chip is 100% compatible with 8051 microcontroller. 3. In this project the components are 1) Microcontroller PHILIPS 89c51rd2 2) LCD 16 *2 with back light 3) RS 232 driver 4) Memory 24c04 6) GSM module (Wave COM make) 7) Moving message display (10 character) 8) Discrete components 10 . 4. of the system.2. Line driver (MAX232): Since the RS232 is not compatible with toady’s microprocessors and microcontrollers we need a line driver (voltage converter) to convert the RS 232 signal to TTL voltage levels that will be acceptable to the 8051’s TXD and RXD pins. GSM Modem: GSM modem is similar to standard modems except that instead of using telephone lines they use GSM mobile network.2 Hardware requirements: 1. 3.1 CONNECTIONS DETAILS The microcontroller is the main heart of the circuit. 2. You need to insert active SIM from your GSM service provider to activate and start using GSM modem. EEPROM (24C04): This chip is required to store the message to be displayed on notice board and password of the owner.

i) Architectural design ii) iii) Function oriented design Detail design 11 . It establishes an overall system architecture. how the system reacts to particular inputs and how the system should behave in particular situations. The design process is divided into software design and hardware design.1 Design process Hardware Design 4. The design process involves developing several models of the system at different levels of abstraction. The software design is divided in to following sub processes. Software design involves representing the software system functions in a form that may be transformed into one or more executable programs.3 Functional requirements: These are the statements of the services the system should provide. Sometimes it may also state what the system should not do. Design Process Software Design Figure 4. DESIGN The systems design process partitions the requirements to either hardware or software systems.1 Software Design Software design involves representing the software system functions in a form that may be transformed into one or more executable programs.3.

The microcontroller has been programmed to control various notice board connected to it.2 Function oriented design 12 .1 Architectural design The initial design process of identifying the sub systems and establishing a framework for sub systems control and communication is called Architectural design.1. 4. GSM modem Microcontr oller SAVE SMS IN EEPROM Display unit Figure 4. sub systems must be controlled as that their services are delivered to the right place at the right time. The system structuring of this project is as follows. Centralized control model has been used to control various sub systems. following activities had been carried out.   System structuring Control model 4.1 System structuring System structuring deals with decomposing a system into a set of interacting sub systems.4.2 Control model To work as a system.1. As part of architectural design process.1. The outputs of the architectural design process are number of graphical representations of the system models along with associated text. Control models are concerned with control flow between sub systems.2: System structuring of system using GSM 4.1. It describes how the system is structured in to sub systems and how each sub system is structured into modules. Centralized control model is easy to understand and implement.1.1.

Functions also maintain local state information but only for the duration of their execution. the message is copied to microcontroller. Then the password in the message is checked. the message is copied to microcontroller. Data flow diagrams Describes how the data flows through the system and how the output is derived from the input through a sequence of functional transformations. If the password is correct then that message is displayed on the notice board. Then the microcontroller checks if the message is in valid format. A system described in this way might be implemented as a single program using functions to implement each transformation. This activity involves drawing and analyzing Data flow diagrams.5 Message display Message on notice board When the new message is received. Data flow diagrams show functional transformations but do not suggest how these might be implemented.Function oriented design strategy relies on decomposing the system into a set of interacting functions with a centralized system state shared by these functions. Copy message to microcontroller message Check if valid message to display New message display Figure 4. If not it sends an error message 13 . When the new message is received.

When the new message is received. 14 . then it reads the new phone number from the message and the old phone number will be replaced with the new phone number. Then the microcontroller checks if the message is in valid format. If the message is in valid format then it checks the password given in the new message is correct. If the message is in valid format then it checks the password given in the new message is correct. by comparing with that of the stored password. If the password is correct. If the password is correct. the message is copied to microcontroller. then it reads the new password and the new password will be stored. by comparing with that of the stored password.to owner. If not it sends an error message to owner.

6/AD6 32 P0.0/AD0 38 P0.2/INT0 13 P3.5/AD5 33 P0.7/RD R1 10k C1 1uF C2 1uF 29 PSEN 30 ALE 31 EA 1 2 3 4 5 6 7 8 9 10 11 12 13 14 D0 D1 D2 D3 D4 D5 D6 D7 J1 5 9 4 8 3 7 2 6 1 3 C114 T1OUT 13 R1IN 7 T2OUT 8 R2IN 2 VS+ 6 VSC2+ 4 C25 1uF MAX232 R4 10k 1 2 3 4 5 6 7 8 P1.2/AD2 36 P0.6/CEX3 P1.7/A15 10 P3.5/A13 27 P2.7/CEX4 AT89C51RD2 C4 1uF 1 C1+ 11 T1IN 12 R1OUT 10 T2IN 9 R2OUT R2 10k U2 6 1 SCK A0 5 2 SDA A1 7 3 WP A2 24C02C U3 CONN-D9M R3 10k C6 C5 1uF Figure 4.1/A9 23 P2.4.4/CEX1 P1.0/RXD 11 P3.1/TXD 12 P3.3/INT1 14 P3.6/A14 28 P2.2 Hardware design: LCD1 LM016L VSS VDD VEE RS RW E U1 X1 C3 10UF 11.4/AD4 34 P0.3/A11 25 P2.5/CEX2 P1.0/T2 P1.8: Circuit diagram of notice board system.3/AD3 10K POT 35 P0. 15 .4/T0 15 P3.0/A8 22 P2.1/T2EX P1.1/AD1 37 P0.5/T1 16 P3.6/WR 17 P3.7/AD7 21 P2.2/ECI P1.059MHZ 9 RST 19 18 XTAL1 XTAL2 39 P0.4/A12 26 P2.2/A10 24 P2.3/CEX0 P1.

2.The instruction set is 100% compatible with the 80C51 instruction set. The block diagram shows all of the features unique to micro controllers:  80C51 Central Processing Unit  On-chip Flash Program Memory with In-System Programming (ISP) and In-Application Programming (IAP) capability  RAM expandable externally to 64 Kbytes  Four interrupt priority levels  Seven interrupt sources  Four 8-bit I/O ports  Full-duplex enhanced UART  Power control modes    Clock can be stopped and resumed Idle mode Power down mode 16 . The device also has four 8-bit I/O ports. three 16-bit timer/event Counters.1 Microcontroller AT89S51: General description: This device is a Single-Chip 8-Bit Microcontroller manufactured in an advanced CMOS process and is a derivative of the 80C51microcontroller family. an enhanced UART and on-chip oscillator and timing circuits. nested interrupt structure. four-priority-level. a multi-source. The microcontroller AT89S51 housed in a 40-pin DIP.Components used: 1) Microcontroller AT89S51 2) RS232 standards 3) MAX 232 4) Wave com GSM modem 5) LCD 16*2 6) EEPROM 24c04 4.

Figure 4. 17 .12: Internal block diagram of 8051.

18 .Figure 4.1 (Pin 11): This pin is used for transmitting data serially during serial communication. This pin is connected to RxD (Pin 12) of MAX 232. This pin is connected to TxD (Pin 11) of MAX 232.2.0 (Pin 10): This pin is used for receiving data serially during serial communication.13: Pin diagram of 8051 4. TxD / P 3.2 Descriptions of the pins used: RxD / P 3.

__ 19 .2. These pins are connected to 1. P 3. XTAL1 and XTAL2 (Pin 19 and Pin 18): These two pins are used to connect external quartz crystal to microcontroller.3 (Pin 21 .2 (Pin 12): This pin is used to receive infrared signal. P 2. P 2.4 – P 3.3.6 (Pin 27): This pin is used to provide clock for EEPROM 24c04.7 (Pin 14 – 17): These pins are used to send data sequence to rotate the stepper motor in clock wise and anti clock wise direction.____ INT0 / P 3. from / to EEPROM 24c04. This pin is connected to pin 6 of EEPROM 24c04. Infrared transmitter is connected to this pin. Infrared receiver is connected to this pin. ____ INT1 / P 3.0 – P 2.4 pins of ULN 2803A. Vss (Pin 20): This pin is connected to ground.3 (Pin 13): This pin is used to send infrared signal.24): These pins are used to control the relays.7 (Pin 28): This pin is used to read / write data. P 2. This pin is connected to pin 5 of EEPROM 24c04.

P 0. These pins are connected to Pins 11 –14 of LCD 16 * 2. P 0.2. This pin is connected to pin 4 of LCD 16 * 2.3 Oscillator and Clock: The heart of the 8051 is the circuitry that generates the clock pulses by which all internal operations are synchronized.EA / Vpp (Pin 31): This pin is connected to Vcc. because the chip contains internal ROM. LCD is used to display the data and MAX232 is used to communicate serially with GSM modem. Typically. Microcontroller is interfaced with external notice board like.5 (Pin 34 – 37): These pins are used to transfer data from microcontroller to LCD 16 * 2. Microcontroller AT89S51 is the heart of this project. 4.7 (Pin 32): This pin is used to make the buzzer produce audible sound. Vcc (Pin 40): This pin is used to provide power supply for microcontroller. Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an oscillator. This pin is connected to pin 6 of LCD 16 * 2. The developed code is burned on to the internal ROM and the code is executed by the microcontroller. P 0. This pin is connected to buzzer.1 (Pin 38): This pin is used to enable LCD 16 * 2. EEPROM is used to store data as well as read data by microcontroller. LCD and MAX 232. This pin is connected to +5 volts. EEPROM.2 – P0. a quartz crystal and capacitors are 20 . P 0.0 (Pin 39): This pin is used to select the register of LCD 16 * 2.

Therefore MAX232 is used to convert the voltage levels of microcontroller to that of RS232 while sending data and the other way while receiving data.employed as shown in figure. Microcontroller has built in UART (Universal Asynchronous Receiver Transmitter).0592 MHz crystal is connected to XTAL1 and XTAL2 to yield a cycle frequency of 921. are not compatible as the voltage levels to represent a bit are different for both.2. 21 .6 KHz. c. The crystal frequency is the basic internal clock frequency of the micro controller. Microcontroller interacts with GSM modem serially. the time to execute that instruction is then found by multiplying c by 12 and dividing the product by the crystal frequency: T inst = (C*12d)/(crystal frequency) An 11.2400. and 300 Hz. 4800. which will help in asynchronous serial communication with GSM modem. 1200.4 Microcontroller and MAX232 interactions: Microcontroller interacts with GSM modem for sending and receiving SMS. RS232 and microcontroller. find the number of cycle. 4. 9600. To calculate the time any particular instruction will take t be executed. Serial communication takes place over RS232 cable. which can be divided evenly by standard communication rates of 19200.

Regulator IC (LM 7805) Figure:Pins of LM7805 The LM7805 monolithic 3-terminal positive voltage regulators employ internal current-limiting.3 POWER SUPPLY: The power supply section is the important one. +12V IC 1 C1 1 LM7805 3 C2 47u F /16V +5V D1 L1 230V AC 230/0-12V D4 1N 4007 D2 1N 4007 1N 4007 D3 1N4007 2 1000u F /25V Figure : Power Supply Unit 3. which is further regulated to +5v. They are intended as fixed voltage regulators in a wide range of applications including local (on-card) regulation for elimination of noise and distribution problems associated with single-point regulation. A 0-5V Vcc is used for our purpose.0A output current. The secondary is connected to the diodes convert from 12V AC to 12V DC voltage. It should deliver constant output regulated power supply for successful working of the project. In addition to use as 22 . they can deliver over 1. the primary of this power is connected in to main supply through on/off switch & fuse for protecting from overload and short circuit protection. by using IC 7805. If adequate heat sinking is provided. thermal shutdown and safe-area compensation.4. making them essentially indestructible.

One is write only and is used to hold data to be transmitted out of 8051 via TXD. SCON: Serial Port Control Register (Bit –Addressable) One cost effective way to communicate is to send and receive bits serially. Input bypassing is needed only if the regulator is located far from the filter capacitor of the power supply. although this does improve transient response. PCON controls data rates. register SUBF is used to hold data to be transmitted / received. It is not necessary to bypass the output. Considerable effort was expended to make the entire series of regulators easy to use and minimize the number of external components.fixed voltage regulators. SBUF is physically two registers. respectively). the data is placed in between a start bit and one or two stop bits. During serial data communication.4 Serial communication: To communicate serially. Both mutually exclusive registers use address 99H. A register called SCON at address 98H controls the serial port of microcontroller.1 (pin 11) and P3. SCON register controls data communication. Asynchronous serial communication is widely used for character-oriented transmission.14 : Framing ASCII “A” (41H) 23 . the baud rate has to be set. these devices can be used with external components to obtain adjustable output voltages and currents. The serial port pins TXD and RXD (P3. In Asynchronous serial communication. Configuring the special function registers (SCON and TMOD) of the microcontroller can set this. 0 d7 goes out last Space stop bit 1 0 0 0 0 0 1 d0 start bit mark goes out first Figure 4. 4.0 (pin 10). Start bit is always 0 (low) and stop bit is 1 (high). This is called Framing. The other is read only and holds received data from external sources via RXD.

the timer 1 is used as a timer for time delay generation. The UART circuitry divides the machine cycle frequency of 921. i. imer Mode Control (TMOD) This register is used to select the timer to use and the mode of its operation.>|< -----------------Timer 0 ---------------> GATE C/T M1 M0 GATE C/T M1 M0 0 0 1 0 0 0 0 0 Timer 1 is used in this project.5 Microcontroller and EEPROM interactions: 24 .LSB is sent out first.e.0592 MHz = 921. the signal is 1 (high) which is referred to as MARK.0 (low) is referred tom as space.6 kHz = 1. 8-bit UART..085 µ s.6 kHz. auto reload mode. Microcontroller can communicate serially at different baud rates. When there is no transfer. And then Timer 1 should be started by making TR1 = 1. SM0 0 SM1 1 SM2 0 REN 1 TB8 0 RB8 0 TI 0 RI 0 SM0 = 0 and SM1 = 1. To generate a baud rate of 9600 bps. 1 Stop bit and 1 Start bit. REN = 1. Now. C/T = 0. The crystal frequency is divided by 12 to get the machine cycle time i.e. < ----------------Timer 1 ----------------. the microcontroller operates in mode 1 i.6 kHz by 32 once more before timer 1 is used to set the baud rate. timer1 is used in mode 2 i. (1/12) * 11. Since M1 = 1 and M0 = 0. it is possible for serial communication at 9600 baud rate.e. the TH1 is loaded with 0xfd (decimal value: -3).e. Therefore clock tick T = 1/921. microcontroller is enabled to send and receive data serially. 4.

The LCD to latch information presented on its data pins uses the enable pin.e. instruction command code register is selected. If P 0. And I2C communication protocol has been implemented to interact with EEPROM.e. If P 0.2: is connected to Data pin bit 0 (LSB) pin i.6 Microcontroller and LCD interactions: Microcontroller interacts with LCD to display data on it.1: is connected to Enable (EN) pin i.Microcontroller interacts with EEPROM to read data as well as to store data. Port 0 pins are used to interact with the LCD. EEPROM 24C04 is used.0 and P 1. This 2-wire interface is popularly known as I2C bus interface.0 = 0.1 of microcontroller are connected to two control lines SCL and SDA pins of EEPROM. since data can be read and stored on board. 25 . allowing the user to send a command such as clear display.e.0 = 1. P 0. P 0. a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. Port 1 pins P 1.0: is connected to Register Select (RS) pin i. EEPROM 24C04 is used in this circuit to store the mobile phone numbers and passwords. 4. Pin 6 of LCD.e. This pulse must be a minimum of 450ns wide. It is a non-volatile memory i. cursor at home etc. data stored in memory is retained even after power failure. allowing the user to send data to be displayed on to the LCD. Pin 11 of LCD. the data register is selected. When data is supplied to data pins. Pin 4 of LCD. P 0.

5: is connected to Data pin bit 3 (LSB) pin i. Pin 12 of LCD. 4. Infrared transmitter is connected to this pin as shown in the circuit diagram.3 (Pin 13): This pin is used to transmit infrared signal. This pin transmits the infrared signal.7 Microcontroller and Relay interactions: 26 . P 0.2 (Pin 12): This pin is used to receive infrared signal. The software checks P 3. which means there is an object in between infrared transmitter and receiver. P 3.3: is connected to Data pin bit 1 (LSB) pin i. P 0. if this pin is low.e. Pin 14 of LCD.e. . These LED’s are used to give burglar signal.2 – P 0.2.5 pins to LCD. The microcontroller provides data on P 0. P 3. These LED’s are placed in such a way that transmitter and receiver are facing one another. Infrared receiver is connected to this pin as shown in the circuit diagram. This indicates there is a burglar in the house.e.3 pin is made high always.P 0. Pin 13 of LCD.4: is connected to Data pin bit 2 (LSB) pin i. P 3. Microcontroller and Infra Red LED’s interactions: The microcontroller is connected to two infrared LED’s.

9 RS 232 standards To allow compatibility among data communication equipment made by various manufacturers. 3 to –25 V represent a 1. If this pin made high. If any of these pins are made low. ULN2803a is a relay driver. Description of pins used: The port pins P 3.7 (Pin 32) of microcontroller. respectively.7 are connected to 1 – 4 pins of ULN2003. an interfacing standard called RS232 was set by the Electronics Industries Association (EIA) in 1960. fan etc.D of stepper motor.4 – P 3. RS232B and RS232C were issued in 1965 and 1969. And pins 13 – 16 are connected to A. If any of these pins are made high. The Port 2 pins are P 2.0 – P2. 4. to connect any RS232 to a microcontroller system we must use voltage converter such as MAX232 IC chips to covert TTL logic levels to the RS232 voltage levels and vice versa. There are 4 relays attached to this relay driver.8 Microcontroller and Buzzer interactions: The microcontroller is connected to a 5v buzzer. the notice board connected to the corresponding relays are switched ON. an audible sound is produced. For this reason. The microcontroller can switch ON or OFF notice board connected to these relays like bulb. while a 0 bit is +3 to +25 V making –3 to +3 undefined. its input and output voltage levels are not compatible TTL compatible.3.C. Buzzer is connected to P 0. These pins act as input to control the relays connected at the other end of ULN2803a. 27 . In 1963 it was modified and called RS232A.B.The microcontroller is connected to the ULN2803a. Port 2 pins are connected to ULN2803a. the notice board connected to the corresponding relays are switched OFF. However since the standards were set a long before the advent of TTL logic family. 4. If this pin is made low no sound is produced. In RS232.

which is the same as the source voltage for the 8051. while the line drivers for RxD are designated as R1 and R2.9. we need a line driver to convert the RS232’s signals to TTL voltage levels that will be acceptable to the 8051’s TxD and RxD pins. Figure 4. One example of such a converter is MAX232 from Maxim Corp. The MAX232 converts the RS232 voltage levels to TTL voltage levels. and Max 232. with no need for the dual power supplies that are common in many older systems.1 MAX 232: Since the RS232 is not compatible with today’s microprocessor and microcontroller. T1 and R1 are used together to TxD and RxD of 8051. One advantage of the MAX232 chip is that it uses a +5V power source.4. The line drivers used for TxD are called T1 and T2. In many applications only one of each is used.15: Pin diagram of MAX232 The MAX232 has two sets of line drivers for transferring and receiving data. and vice versa. For example. 28 . and the second set is left unused.

R1 OUT (Pin 12): This is an output pin.Description of pins used: T1 IN (Pin 11): This is an input pin. R1 IN (Pin 13): This is an input pin. This pin is connected to RxD (Pin 12) of microcontroller. This pin is connected to RxD (Pin 2) of RS232. This pin transmits sends the data received from microcontroller serially to RS232. This pin receives data to be transmitted to microcontroller. T1 OUT (Pin 14): This is an output pin.10 Wavecom GSM modem 29 . This pin is connected to TxD (Pin 3) of RS232. GND (Pin 15): This pin is connected to ground. Vcc (Pin 16): This pin is connected to +5v supply. TxD of microcontroller is connected to this pin. This pin sends the data received on R1 IN pin to microcontroller. The data to be sent to GSM modem is transmitted serially on this pin. 4.

The AT commands set of the most GSM mobile phones are same. DSR. DTR. Modem can communicate serially by RS232. TX. CTS. The output of voltage regulator 7805 is given to this pin. lightweight and easy to integrate. otherwise the GSM module is switched OFF. The GSM module offers the advantages as below  Small.10. The AT command set is the industry standard set of commands used for setting up and communicating with a modem. It can be interfaced to an external antenna for better signal reception and transmission. Power supply to the modem is given through this pin. serial data communication requires a modem to modulate (convert 0s and 1s to signals like audio tones) and demodulate (convert from audio tones to 0s and 1s). 4. Data and/or commands are received serially through this pin.  High performance on low price. 30 . The internal antenna is embedded in the modem. For long distance data transfers using communication lines such as a telephone.    Low power consumption Internal SIM card reader and option for external SIM card reader. Rx (Pin 32): This pin is used for serial RS232 receive. Full RS232 on CMOS level with flow control (RX. The modem operates at +5v DC. GSM modem is used for wireless data transfer.Modem stands for Modulation and demodulation. RTS. DCD. The GSM Terminal is ideal for embedded applications. CTS. RI). The GSM module is switched ON when this pin is given the +5v DC.1 Descriptions of the pins used: Power ON / OFF control (Pin 6): This is an input pin.

P 0. Of course.0 D7 D6 D5 D4 LCD EN RS 31 Microcontroller . This is the standard set by Electronics Industries Association (EIA) for compatibility between data terminal equipment and data transmitting equipment. It coverts from RS 232 voltage levels to TTL voltage levels and vice versa. through Tx and Rx pins of GSM modem. GSM modem is used in this project to send and receive text messages. There are two rows and 16 columns. Data and/or commands are transmitted serially through this pin. It is possible to display 16 characters on each of the 2 rows. GSM modem communicates serially with microcontroller.11LCD 16*2 Liquid crystal displays (LCDs) offer several advantages over traditional cathode-ray tube displays that make them ideal for several applications. There are several tradeoffs as well. not to mention high manufacturing cost. command register and data register. 4. 16x2 LCD is used in this project to display data to user. GSM modem communicates with micontroller through MAX232.2 P 0. Since the RS232 is not compatible with toady’s microprocessors and microcontrollers we need a line driver (voltage converter) to convert the RS 232 signal to TTL voltage levels that will be acceptable to the 8051’s TXD and RXD pins. They are easier to read and more pleasant to work with for long periods of time than most ordinary video monitors. and contrast.3 P 0. brightness. It has two registers.4 P 0. One such converter is MAX 232. The baud rate is set before transferring data or receiving data.1 P 0. such as limited view angle.Tx (Pin 39): This pin is used for serial RS232 transmit.5 P 0. The GSM modem is connected to MAX232 through RS232 cable. LCDs are flat and they use only a fraction of the power required by cathode-ray tubes. These two pins are connected to Pin 13 and Pin 14 of the MAX232. New message indications are also given to the microcontroller.

a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. the data register is selected.16: 8051 and LCD interface. etc. This pulse must be a minimum of 450ns wide. If RS =1. If RS=0. Description of pins used: RS. allowing the user to send data to be displayed on the LCD. Register Select (Pin 4): This pin is used to select command register and data register.Figure 4. D4 – D7 (Pin 11 – Pin 14): 32 . When data is supplied to data pins. cursor at home. EN Enable (Pin 6): The LCD to latch information presented to its data pins uses the enable pin. Read/Write (Pin 5): This pin is connected to ground. __ _____ R / W. as LCD is used only to display data. allowing the user to send a command such as clear display. instruction command register is selected.

The AT24C04 is accessed via a 2-wire serial interface.Data to be displayed is sent to LCD on these pins. Vss (Pin 1): This pin is connected to ground. as they are not used to display data.5V).5V to 5.5V).18: Internal pin connection of EEPROM 24c04 33 . this device is available in 5.8V (1. followed by LSB. Vcc (Pin 2): This pin is connected to +5v power supply.7V (2. The device’s cascadable feature allows up to eight notice board to share a common 2-wire bus. The device is optimized for use in many industrial and commercial applications where low power and low voltage operation are essential.0V (4.5V to 5. D0 – D3 (Pin 7 – Pin 10): These pins are connected to ground. 2.5V) and 1. Figure 4.8V to 5. In addition.7V to 5. First MSB is sent.5V) versions. 4.5V (2.12 EEPROM 24c04 The AT24C04 provides 4096 bits of serial electrically erasable and programmable read only memory (EEPROM) organized as 2048 words of 8 bits each. 2.

These inputs allow the selection for one of eight possible notice board sharing a common bus. to read data out of device. A1 and A0 pins are device address inputs that may be hardwired or actively driven to VDD or VSS.1Description of the pins used: Serial Clock (SCL): This is an input pin. A read operation is selected if this bit is high or a 34 . when tied low to GND. A1.1 of the microcontroller. to write data into each EEPROM device and negative edge. Device Select (A2. This pin is used to provide clock for EEPROM. This pin is connected to Port pin 1. Write Protect (WP): This pin is connected to ground. allows normal write operations. A1 and A0 device select bits. The eighth bit of the device address is the read/write select bit. Device Addressing: The AT24C04 requires an 8-bit device address word following a start condition to enable the chip for read or write operations.4. The SCL input is positive edge. The most significant bit must be a one followed by the A2. The next 3 bits are used for memory block addressing and select one of the eight 256 x 8 memory blocks. The write protect input. The SDA pin is used for bidirectional serial data transfer. These bits should be considered the three most significant bits of the data word address. A0): These pins are connected to ground.0 of microcontroller.12. The A2. GND (Pin 4): This pin is connected to ground. Serial Data (SDA): This pin is connected to Port pin P1.

Upon receipt of this address. such as a microcontroller.19: EEPROM device address format Write Operations: Byte Write: A write operation requires an 8-bit data word address following the device address word and acknowledgment. Following receipt of the 8-bit data word. must terminate the write sequence with a stop condition. Figure 4.write operation is selected if this bit is low. the EEPROM will output a zero. Upon a compare of the device address. There are three read operations: current address read. random address read and sequential read. to the nonvolatile memory. If a compare is not made. Device Address: Figure 4. the EEPROM will output a zero and the addressing device. the EEPROM will again respond with a zero and then clock in the first 8-bit data word. All inputs are disabled during this write cycle and the EEPROM will not respond until the write is complete. the chip will return to a standby state.20: EEPROM Write byte format Read Operations: Read operations are initiated the same way as write operations with the exception that the read/write select bit in the device address word is set to one. WR. At this time the EEPROM enters an internally timed write cycle. 35 .

The microcontroller does not respond with an input zero but does generate a following stop condition. VCR's and audio equipment this is not acceptable..13 INTRODUCTION TO I2C PROTOCOL History of the I2C Bus The I2C bus was developed in the early 1980's by Philips semiconductors. And a component less means more money for the producer and cheaper products for the customer. 36 . incremented by one. 4. In these appliances every component counts. The address “roll over” during read is from the last byte of the last memory page to the first byte of the first page.Current Address Read: The internal data word address counter maintains the last address accessed during the last read or write operation. the current address data word is serially clocked out. Figure 4. Its purpose was to provide an easy way to connect a CPU to peripheral chips in a TV-set. The address “roll over” during write is from the last byte of the current page to first byte of the same page. Not to mention a bunch of address decoders and glue logic to connect everything. In mass production items such as TV-sets. This results in lots of copper tracks on PCB's to route the Address and data lines. Normal Computer systems use Byte Wide buses to accomplish this task.21: EEPROM Read byte format EEPROM has been used in this project to store the mobile phone numbers and passwords of owner and user of this system. Once the device address with the read/write select bit set to one is clocked in and acknowledged by the EEPROM. This address stays valid between operations as long as the chip power is maintained.

I2C is an acronym for Inter-IC bus. The BUS MASTER is the chip issuing the commands on the BUS. TI. The active wires. LCD. The I2C Bus’s has been adopted by several leading chip manufacturers like Xicor. Every component hooked up to the bus has its own unique address whether it is a CPU. The I2C Bus Protocol The BUS physically consists of 2 active wires and a ground connection. In the I2C protocol specification it is stated that the IC that initiates a data transfer on the bus is considered the BUS MASTER. Furthermore there may be one or more BUS Master’s. Where SDA is the Serial Data line and SCL is the Serial Clock line. Obviously an LCD driver is only a receiver.The bus is generally accepted in industry. SGS-Thomson. while a memory or I/O chip can both be transmitter and receiver. Its name literally explains its purpose: to provide a communication link between Integrated Circuits. 37 .Furthermore lots of control lines imply that the system is more susceptible to disturbances by EMC and ESD. mice. are both bi-directional. SDA and SCL. driver. monitors. The research done by Philips Labs in Eindhoven (The Netherlands) resulted in a 2-wire communication bus called the I2C bus. Nowadays the extent of the bus goes much further than Audio and Video equipments . Siemens. At that time all the others are regarded to as the BUS SLAVE. Maxim. Each of these chips can act as a receiver and/or transmitter depending on its functionality. printers. memory or complex function chip. Atmel. etc. Intel. Offspring’s like D2B and ACCESS bus find their ways into computer peripherals like keyboards. Analog Notice board and lots of others.

We have had several states on the BUS right now: START. At this moment in time all IC's will compare this address with their own. As MASTERs are generally microcomputers let's take a look at a general 'inter-IC chat' on the bus.As mentioned before. This is a signal that the bus has transmission to start any moment.22: EEPROM Internal block diagram Lets consider the following setup: Case: The CPU wants to talk to one of its slaves. If the CPU gets this ACKNOWLEDGE then it can start transmitting or receiving data. When all is done the CPU will issue a STOP condition. DATA. This means that more than one IC capable of initiating data transfer can be connected to it. the IC bus is a Multi-MASTER BUS. If the address matches however the chip will produce a response called the ACKNOWLEDGE signal. In our case the CPU will transmit data. address. ACKNOWLEDGE. 38 been released and that the IC's may expect another . If it doesn't match they simply do nothing and wait until the bus is released by the STOP condition. STOP. This takes 8 clock pulses. All IC's on the bus will listen to the bus for incoming data. Then the CPU sends the address of the device he wants to access. The CPU will issue a START condition (see further on for description of all these conditions) this acts as and ’ATTENTION’ signal to all of the connected IC's. Figure 4.

and SCL is the Serial Clock line. memory or ASIC. let's take a look at a general 'inter-IC chat' on the bus. along with an indication whether the access is a Read or Write operation (Write in our example). Consequently. SDA is the Serial Data line. no matter whether it is an MCU. Then the MCU sends the ADDRESS of the device it wants to access. called SDA and SCL. The I2C protocol specification states that the IC that initiates a data transfer on the bus is considered the Bus Master. an LCD driver is only a while a memory or I/O chip can be both transmitter and receiver. the MCU will issue a START condition.These are all unique conditions on the BUS. The I2C bus is a multi-master bus. The Bus MASTER first releases the STOP Table 1: Start and stop conditions First. Every device hooked up to the bus has its own unique address. All ICs on the bus will listen to the bus for incoming data. all the other ICs are regarded to be Bus Slaves. This acts as an ‘Attention’ signal to all of the connected notice board. LCD driver. The active wires. receiver.and /or transmitter. This means that more than one IC capable of initiating a data transfer can be connected to it. Table 1: Start and stop conditions The chip issuing the Start condition START first pulls the SDA (data) line low and next pull the SCL (clock) line low. Before we take a closer look into these bus conditions we need to understand a bit about the physical structure and hardware of the bus The I2C bus physically consists of 2 active wires and a ground connection. at that time. Each of these chips can act as a receiver. are both bi-directional. Obviously. . As bus masters are generally microcontrollers. depending on the functionality. click here for information on how to receive data from a slave). Lets consider the following setup and assume the MCU wants to send Data to one of its slaves (also see here for more information. 39 SCL and then the SDA line.

These are all unique conditions on the bus. the microcontroller sends AT command “AT” serially to the modem. ACKNOWLEDGE. This is a signal that the bus has been released and that the connected ICs may expect another transmission to start any moment. If the address matches. Since the transfer of information between microcontroller and the modem is achieved by asynchronous serial communication. Before we take a closer look at these bus conditions we need to understand a bit about the physical structure and hardware of the bus. DATA. all IC's will compare it with their own address. the GSM modem is initialized through AT commands by the microcontroller. ADDRESS. Once the MCU receives the acknowledgement. it can start transmitting or receiving DATA. the MCU will transmit data. The baud rate is set to 9600kbps by programming the Timer1 of microcontroller. e. Working of system using GSM: When the hardware is powered ON. If it doesn’t match. Similarly 40 . the LCD display displays as follows “System installing “ Similarly it is used to display other messages at appropriate instances. if the modem is ready it responds by sending the 5th character of acknowledge (to the microcontroller) as “K” and the message is displayed on LCD as “test OK”. when the system power module is switched on. STOP. however. When all is done. the serial communication interface is initialized. To remove echo character the AT command “ATE0” is send by the controller . they simply wait until the bus is released by the stop condition (see below).Having received the address. the chip will produce a response called the ACKNOWLEDGE signal. the MCU will issue the STOP condition. Firstly. Then. The LCD displays the series of events going on in the process control. In our case.If the 4th bit of acknowledgement bit is “K” then the modem is initializing properly with echo off and the message “Echo ok” is displayed on the LCD. the LCD display is initialized by the microcontroller by writing the appropriate command word into the instruction command register of LCD module.g. We have had several states on the bus in our example: START.

the SMS is reached through air interface to the modem and stored in the SIM inserted in the modem. 5. the SMS is deleted through AT command “AT+CMGD” followed by the SMS index.e write new phone number or password in the EEPROM location. After processing the data and performing the appropriate operation. When the owner or sender sends SMS.is set in text command mode and new message is indicated to the TE and appropriate message displayed on LCD. After receiving SMS from modem the microcontroller first checks for the password stored by the owner in the EEPROM with that received. Implementation: 41 . “AT+CMGF=1” and “AT+CNMI=1” the modems checks for the SIM insertion. The microcontroller reads the SMS form the modem through AT commands ”AT+CMGR” followed by the modem SMS index. If the password is incorrect the error message is displayed.through the AT commands “AT+CPIN?” . After this the modem is ready to receive any other SMS and the process is repeated. After initialization modem is ready to accept the SMS. only if they match it accepts the further SMS data and processes it and operates the appropriate device or change the owner’s phone number or change the password i. the corresponding error message is displayed and modem is initialized overall again. If any of the appropriate acknowledge is not received. password pppp is the new password. The SMS should be in the format “*pppp* message#” where pppp is the 4 letter password and the message is the message to be displayed on the notice board .

The software used to program is Keil µVision2. Large systems are built out of sub systems. which includes many aspects of the ANSI (American National Standard Institute) C programming language. Standard libraries are altered or enhanced to address the peculiarities of an embedded target processor. The testing process should therefore proceed in stages where testing is carried out in conjunction with system Implementation. TESTING Figure 5.1: Testing process Systems should not be tested as single monolithic systems. The Cx51 is a cross compiler to compile C programs for your target 8051 environment and provides several extensions to ANSI Standard C to support the elements of the 8051 architecture. The most widely used testing process consists of the following five stages: The Testing Process: Unit Testing: 42 . which are composed of procedure and functions. These C programs are referred as Embedded C programs. Bottom up testing strategy has been followed to test this project. Embedded C is a high level language.

Sub-system Testing: This phase involves testing collection of modules. Each component is tested independently. Module Testing: A module is a collection of dependent component such as procedures and functions. The testing process is concerned with finding errors. which have been integrated into sub systems.h> 43 . Acceptance Testing: This is the final stage of testing process before the system is accepted for operational use. System Testing: The sub systems are integrated to make up the entire system. The system is tested with the data supplied from the system procurer rather than simulated data. Sub systems may be independently designed and implemented. A module encapsulates related component related components so can be tested without other system modules.Individual component are tested to ensure that they operate correctly. without other system component. PROJECT CODE: //INCLUDE DEFINITION OF HEADER FILE #include<at89x51. The sub system test process concentrates only on detection of interface errors by rigorously exercising this interface. which result from unanticipated interaction between sub systems and system components.

bit SendSMSNumber(void). #endif //DEFINE CONSTANT #define LOW 0 #define HIGH 1 #define OUTPUTPIN 0 //DEFINES PORT/PINS #define LCDEnablePin #define LCDRegisterSelectPin #define LCDDataPort P3_7 P3_6 P1 //DEFINE MACROS #define LCDClear() LCDWriteCommand(0x01) /* Clear display LCD */ #define LCDRow1() LCDWriteCommand(0x80) /* Begin at Line 1 */ #define LCDRow2() LCDWriteCommand(0xC0) /* Begin at Line 2 */ //USERDEFINE DATA TYPES typedef unsigned char LCDubyte. bit ReceiveResponse(void). bit SendTextCode(void). static void SendToEEPROM(void). 44 .//DEFINE CONSTANT #define INPUT_PIN #define PRESSED #define DEVICE_add 1 0 0xa0 //FUNCTION PROTOTYPES void main(void). bit SendMessageSettingsCode(void). static void MainErrorInModem(void). static void MainSystemInitialize(void). void ReceiveACknowledgment(void). static void ReceiveSMS(void). static void SerialISR (void). static bit MainInitializeGSMModem(void). static void SendMessageToPhone(void).

void LCDWriteString(LCDubyte *lcd_string). ubyte sub_add).//DEFINE PROTOTYPES static void LCDEnable(void). void LCDWriteCommand(LCDubyte command). bit CheckEEPROM(void). //FUNCTION PROTOTYPE void Delay(unsigned int time). unsigned char recv_data(ubyte slave_add. void SendStringSerially(unsigned char *StringData). unsigned char MessageLength = 0. //DEFINE CONSTANT #define Baud_rate 0xFD // BAUD RATE 9600 //DEFINE PROTOTYPES void SerialCommunicationInitialize(void). 45 . void LCDDisplayInitializing(void). sbit SCL = P3^7. //DEFINE GLOBAL VARIABLE unsigned char Message[80]. //DEFINE PORTS/PINS sbit SDA = P3^6. //DEFINE MACRO #define HOLD Delay(1) //FUNCTION PROTOTYPES void send_stop(). void send_data(ubyte slave_add. ubyte *data_in). ubyte sub_add. void SendByteSerially(unsigned char ascii). void master(ubyte slave_addr). unsigned char ReceiveByteSerially(void). ubyte bytes. void send_byte(ubyte i2c_data). ubyte recv_byte(ubyte cnt). void LCDWriteData(LCDubyte ascii). void LCDInitialize(void). static void LCDWriteByte(LCDubyte LCDData). LCDubyte Value). void LCDDisplayByte(LCDubyte LCDAdress.

'C'. Count <10. code SMSText[10] = {'A'. code SMSSettings[18]={'A'. 46 .'.'T'.'0'. Message[Count] = ReceiveByteSerially(). unsigned char TemporaryVariable.'.'T'.'N'.) { Back: do { Count = ReceiveByteSerially().'2'. code ATCommand[3] = {'A'.1. for(Count =PreviousCount.Count.'F'.0x0D}. Count++) Number Message[Count] = ReceiveByteSerially().'. Count < MessageLength. MainSystemInitialize(). if(MainInitializeGSMModem()) { for(. //MAIN PROGRAM BEGINS void main(void) { unsigned char Count. for(Count = 0.'1'.'M'. do { Count++.'T'.'0'. MessageLength += Count.'='. }while(Message[Count] != '>').unsigned char PreviousCount = 0..'.&Message[CountPreviousCount]).'G'.'+'.0x0D}.'.'='. MESSAGE NOT REQUIRED }while(Count != '1').0x0D}.'.'2'. // //Phone Count = 9.'.'.'C'.'I'.'2'.'M'. Count++) //SAVE TO EEPROM send_data(DEVICE_add.'+'.

) { for(Count = 0. } } } } else MainErrorInModem(). } static bit MainInitializeGSMModem(void) { bit Flag = 0. for(.).PreviousCount = MessageLength. LCDInitialize().Count)). LCDInitialize(). } static void MainErrorInModem(void) { LCDWriteString("Error COMM with GSM Modem"). return Flag.. if(ReceiveResponse()) if(SendTextCode()) if(SendMessageSettingsCode()) return Flag = 1. 47 . RI = 0.. } bit ReceiveResponse() { bit Flag = 0. Count++) { LCDWriteData(recv_data(DEVICE_add. for(. } static void MainSystemInitialize(void) { SerialCommunicationInitialize(). if(RI) goto Back. Count < MessageLength. LCDWriteString("GSM NOTICE BOARD HAVE A NICE DAY").

} bit SendTextCode(void) { bit Flag = 0. if(Count != 'K' ) return Flag. Count < 10. //Not Eual to > for(Count = 0. unsigned char Count. return Flag = 1. unsigned char Count. do { Count = ReceiveByteSerially().for(Count = 0. Count++) SendByteSerially(ATCommand[Count]). do { Count = ReceiveByteSerially(). }while(Count != 'k'). 48 . return Flag = 1. }while(Count != 'K'). if(Count != 'K' ) return Flag. Count++) SendByteSerially(SMSSettings[Count]). Count++) SendByteSerially(SMSText[Count]). } bit SendMessageSettingsCode(void) { bit Flag = 0. Count < 18. do { Count = ReceiveByteSerially(). Count < 3. //Not Eual to > for(Count = 0.

}while(Count != 'K'). time--. while( time > ) { pause = 150. } //Not Eual to > #include "delay. LCDEnablePin = LOW. LCDDataPort = LCDData . } } void LCDWriteCommand(LCDubyte LCDData) { LCDRegisterSelectPin = LOW. Delay(500). // if(Count != 'K' ) return Flag.h" void Delay(unsigned int time) { unsigned char pause. } void LCDWriteData(LCDubyte LCDData) 49 . LCDEnablePin = HIGH. Delay(3). while(pause). return Flag = 1.

LCDWriteCommand(0x01). LCDEnablePin = HIGH. } //FUNCTIONS void SerialCommunicationInitialize(void) { // INITIALIZE SERIAL PORT 50 . } } void LCDInitialize(void) { LCDEnablePin = OUTPUTPIN. LCDDataPort = 0x00. LCDWriteCommand(0x8f). LCDWriteCommand(0x30).{ LCDRegisterSelectPin = HIGH. LCDEnablePin = LOW. Delay(3). LCDWriteCommand(0x30). Delay(150). LCDRegisterSelectPin = OUTPUTPIN. LCDDataPort = LCDData . LCDWriteCommand(0x07). } void LCDWriteString(LCDubyte *lcd_string) { while (*lcd_string) { LCDWriteData(lcd_string). LCDWriteCommand(0x0f).

no_ack. /************************************ * Sending Stop Condition *************************************/ void send_stop() { SDA = 0. // START TIMER EA = 1. // WAIT UNTIL TRANSMISSION TO COMPLETE TI = 0. // SERIAL MODE 1. HOLD. // RETURN SERIAL DATA } /* i2c routines*/ //DEFINE GLOABAL VARIABLES unsigned char bdata temp_data. // CLEAR TRANSMISSION INTERRUPT FLAG } unsigned char ReceiveByteSerially(void) { while(RI == 0). //GLOABL ENABLE INTERRUPT } void SendByteSerially(unsigned char serialdata) { SBUF = serialdata. i2c_busy = 0. 8-DATA BIT 1START BIT. // Timer 1 IN MODE 2 -AUTO RELOAD TO GENERATE BAUD RATE SCON = 0x50. bus_fault. sbit MSB = temp_data^7. 51 . // WAIT UNTIL DATA IS RECEIVED RI = 0. //GLOABL VARIABLES bit i2c_busy. // LOAD DATA TO SERIAL BUFFER REGISTER while(TI == 0). // CLEAR FLAG return SBUF. SCL = 1. 1-STOP BIT.TMOD = (( TMOD & 0x0F) | 0x20). // LOAD BAUDRATE TO TIMER REGISTER TR1 = 1. sbit LSB = temp_data^0. SDA = 1. REN ENABLED TH1 = Baud_rate.

} } /************************************* * Sending a byte on I2C Bus *************************************/ void send_byte(ubyte i2c_data) { ubyte i. { SDA = 0. SCL = 0. ************************************/ void master(ubyte slave_addr) { i2c_busy = 1. temp_data<<=1. HOLD. for(i=0. SCL = 1. temp_data = i2c_data. HOLD.} /************************************ * I2C Start Condition * * NOTE: need to use it. Delay(1). SDA=MSB.i++) { SCL=0. HOLD. SCL=0. /***************************************************** * Sending data on I2C bus * * Usage: 52 . HOLD. bus_fault = 0. send_byte(slave_addr). SCL=1.i<8. no_ack = 0. HOLD. } SDA = 1.

0x10. else { for(bytes. ***********************************************/ ubyte recv_byte(ubyte cnt) { ubyte i. for(i=0. ubyte bytes. ubyte sub_add. send_byte(sub_add). or sub-address * 0x20: number of bytes to send * send_buffer: adress of the buffer pointer * ******************************************************/ void send_data(ubyte slave_add. if(no_ack) break. Must me with write bit * 0x10: Starting address. } Delay(100). LSB = SDA. if(i < 7) temp_data<<=1.bytes--) { send_byte(*data_in++). HOLD.* send_data(0xD0.i++) { SDA = 1. } /********************************************** * Recieve a single byte from I2C Bus * * Note: if you are going to recieve * a single byte then the passing * argument should be 1.i<8. if(no_ack) send_stop(). ubyte *data_in) { master(slave_add). SCL = 1. } send_stop(). HOLD. 53 .bytes>0. send_buffer) * * 0XD0: Slave address. 0x20.rcv_data.

} */ void recv_data(ubyte slave_add. } i = recv_byte(1). ubyte *recv_buf) { ubyte i. ubyte byte_cnt. slave_add += 1. 0x20. if(no_ack) { send_stop(). goto exit. send_byte(sub_add). or sub-address * 0x20: number of bytes to recieve * send_buffer: adress of the recieve buffer * pointer * ******************************************************/ /*unsigned char recv_data(ubyte slave_add. HOLD. send_stop(). SCL = SDA = 1. ubyte sub_add) { ubyte i. send_buffer) * * 0XD0: Slave address.0x10. } rcv_data = temp_data. return rcv_data. ubyte sub_add. } /***************************************************** * Recieving bulk data on I2C bus * * Usage: * recv_data(0xD0. Must me with write bit * 0x10: Starting address. master(slave_add). master(slave_add). exit: return i. SCL = SDA = 1.SCL = 0. master(slave_add). SCL = SDA = 1. Delay(75). 54 .

goto exit. SCL = SDA = 1.i<byte_cnt. } 6. slave_add += 1. CONCLUSION 55 .i++) recv_buf[i]=recv_byte(byte_cnt-i). } for(i=0. exit:.send_byte(sub_add). master(slave_add). send_stop(). if(no_ack) { send_stop().

And its possible to control the notice board connected only when the client operates in the service provider’s network coverage area. 56 . The only prerequisite is that. he can’t control notice board. which could be located remotely or in hostile environment. If the user is out of network coverage area. Using this application the client can operate notice board. System should be placed in the service provider’s network coverage area. but will receive any messages from the System as soon he is in network coverage area. from remote place without him being present at the location of the display.System using GSM is an embedded application. Thus this application enables the user to send messages to be displayed . thus making the whole process efficient and time saving.

.7. second edition.atmel.philips.keil.com www.com www.com www.com www. programming and applications” by Kenneth J Ayala. Sixth edition.microchip. Bibliography Literature references: 1 2 “The 8051 Microcontroller and embedded systems” by Muhammad Ali Mazidi and Janice Gillispie Mazidi.com 57 .jungo.wavecom. Web sites: 1 2 3 4 5 6 www. Penram International Publishing. Pearson Education “The 8051 Microcontroller architecture.com www.

Sign up to vote on this title
UsefulNot useful