• No results found

A Project report On. Submitted towards the partial fulfillment Of the requirement for the diploma of Of engineering In INDUSTRIAL ELECTRONICS

N/A
N/A
Protected

Academic year: 2021

Share "A Project report On. Submitted towards the partial fulfillment Of the requirement for the diploma of Of engineering In INDUSTRIAL ELECTRONICS"

Copied!
86
0
0

Loading.... (view fulltext now)

Full text

(1)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

A

Project report

On

S

S

M

M

S

S

b

b

a

a

s

s

e

e

d

d

d

d

e

e

v

v

i

i

c

c

e

e

s

s

w

w

i

i

t

t

c

c

h

h

i

i

n

n

g

g

a

a

n

n

d

d

s

s

t

t

a

a

t

t

u

u

s

s

m

m

o

o

n

n

i

i

t

t

o

o

r

r

i

i

n

n

g

g

Submitted towards the partial fulfillment

Of the requirement for the diploma of

Of engineering

In

INDUSTRIAL ELECTRONICS

BY

Yash doshi

Vaibhav doshi

Aniket khedekar

Kaushal joshi

Under Guidance Of

Mrs. Radha sivadas

VIVEKANAND EDUCATION SOCIETY’S

POLYTECHNIC,

CHEMBUR, MUMBAI-71

(2)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING It is great pleasure in presenting our multipurpose multifunctional project on security system “

SMS based device switching and status

monitoring”

which is of great importance in the present world. This project was completed because of the hard work and efforts taken by all the group members and our project guide.

We take this opportunity to express our deep indebtness to the faculty of “VIVEKANAND INSTITUTE OF TECHNOLOGY”.

Amongst the panorama of people who provided us with inspiring guidance and encouragement, we wish to take an opportunity to convey our thanks to people who guided us at every stage and gave their valuable time and knowledge during our project.

From the core of our heart we give special thanks to our project guide who has been a teacher to us in the real sense of the ward. We all pay deep gratitude to her for having been a constant source of inspiration and for helping us in our difficulties.

We pay special thanks to our processors for helping us to make this project a grand success. We thank our staff and colleagues for being with us during this long span for providing us with information and challenging opportunities to prove ourselves in our respective fields.

The last but not the least we favor the lab assistants and workshop staff for devoting their precious time as well as for giving their support.

We end this acknowledgement anticipating getting all encouragement and support from the staff and students to have an enlightened future.

(3)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Introductory

--- Introduction Technology Used Features

Overview

---

Development Stages & Process

System Overview

---Connector Details Brief Explanation

Circuit Diagram

---Circuit Diagram Circuit Basics Explanation

Software---

---Flowchart Coding

Section V

Section IV

Section III

Section II

Section I

Table of Contents

(4)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Basics of Microcontroller---

Introduction to Microcontrollers The 89V51 Microcontroller Features of 89V51

Pin diagram & Explanation Architecture of 89V51

Memory Organization of 89V51

Development Tools---

The Keil (µVision2) The Eagle 4.11

PCB design---

Manufacturing process PCB Fabrication

Conclusion---

Operational Basics Inbuilt Commands

Bibliography ---

Section VIII

Section IX

Section VI

Section VII

Table of Contents Continue…

(5)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

he microcontroller is an exiting, challenging, and growing field; it will pervade industry for decades to come. To meet the challenges of this growing technology, we will have to conversant with the programmable aspect of the microcontroller. Programming is a process of problem solving and communicating in a strange language of mnemonics. The projects could be developed significantly faster and much easily using a microcontroller.

The mobile communication has expanded to a large extent such that it can be applied even for controlling of electrical devices. In our project we make use of this capability of mobile phones. However to enable this we need to connect the mobile phone to a microcontroller and to enable this we make use of embedded technology .Apart from controlling it also does the sensing of the devices. Thus we are also able to know of the status of the devices. Here we are controlling eight electrical devices and sensing the status of eight devices. According to the user need both of this can be expanded.

In our project the micro controller is controlled by the SMS send from the mobile phones. The user controls the eight electrical devices connected to the device. The status of the devices is made known to the user by the micro controller. The micro controller polls each device and sends their status to user mobile phone. This enables the user to understand the status of each device either in his office or house hold.

Preface

T

SMS based device switching

and status monitoring

(6)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING We find our project as one which can be easily perceived by any one. Also the SMS commands for controlling the devices are simple plain English text messages which can be send with ease. Also the project can be used for both industrial and household applications .Thus we find that our project proves to be a very beneficial one.

The purpose of this project is to implement the various concepts of microcontroller and embedded designing environment. An embedded microcontroller is a chip which has a computer processor with all its support functions (clock & reset), memory (both program and data), and I/O (including bus interface) built into the device. These built in functions minimize the need for external circuits and devices to be designed in the final application.

The ―SMS based device switching and status monitoring‖ fully utilizes microcontroller futures & embedded technology concepts to minimize the complications of digital gates, size and cost too.

(7)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(8)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Introduction

Technology Used

Features

Introduction

This Project is a very good example of embedded system as all its operations are controlled by intelligent software inside the microcontroller.

The aim of this project is to control i.e. to ON/OFF the electrical or electronic appliances connected to this system from anywhere in the world. For this purpose user can use any type of Mobile. This way it overcomes the limited range of infrared and radio remote controls.

Using the convenience of SMS, this project lets you remotely control equipment by sending plain text messages, such as "abcdn1", "abcdnaf3", "abcdf57n142"– all of which can be pre-programmed into the controller and easily remembered later. It can control up to eight external devices.

Short Message Service (SMS) is defined as a text-based service that enables up to 160 characters to be sent from one mobile phone to another. In a similar vein to email, messages are stored and forwarded at an SMS centre, allowing messages to be retrieved later if you are not immediately available to receive them. Unlike voice calls, SMS messages travel over the mobile network‘s low-speed control channel.

Section-I

(9)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING "Texting", as its also known, is a fast and convenient way of communicating. In fact, SMS has taken on a life of its own, spawning a whole new shorthand language that‘s rapidly being adopted as the norm.

Many industries have been quick to make use of this technology, with millions of handsets currently in use. As new models with "must have" features hit the market, older models become virtually worthless and if not recycled, end up in landfill. With this in mind, we‘ve designed the project to work with 3310 & 3315 Nokia models.

SHORT MESSAGE SERVICE:

Short Message Service is a service available on most digital mobile phone that permits the sending of short messages also known as text messages between mobile phone other handheld devices and even landline telephones. Other uses of text messaging can be for ordering ringtones, wallpapers and entering competitions Messages are sent via a store-and-forward mechanism to a short message service centre, which will attempt to sent the recipient and possibly retry if the user is not reachable at a given moment. Both mobile terminated, for messages sent to a mobile handset, and mobile originating, for those that are sent from the mobile handset, operations are supported. Messages delivery is best effort, so, there are no guarantees that a message will actually be delivered to its recipient and delay or complete loss of a message is not uncommon, particularly when sending between networks. Users may choose to request delivery reports, which can provide positive confirmation that the message has reached the intended recipient, but notifications for failed deliveries are unreliable at best SMS would be used as a means for sending text messages from a mobile user to another. One factor in the slow take-up of SMS was that operators were slow to eliminate billing fraud which was possible by changing SMSC settings on individual handsets to the SMSCs of other operators. Over time, this issue was eliminated by switch-billing instead of billing at the SMSC and by new features within SMSCs to allow blocking of foreign mobile users sending messages through it.SMS was considered in the main GSM group as a possible service for the new digital cellular system. In GSM document 'Services and Facilities to be provided in the GSM System both mobile originated and mobile terminated, including point-to-point and point-to-multipoint, short messages appear on the table of GSM tele -services. Larger content known as long SMS or concatenated SMS can be sent segmented over multiple messages, in which case each message will start with a user data header (UDH) containing segmentation information.

(10)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Short messages can also be used to send binary content such as ring tones or logos, as well as OTA programming or configuration data. Some service providers offer the ability to send messages to land line telephones regardless of their capability of receiving text messages by automatically phoning the recipient and reading the message aloud using a speech synthesizer along with the number of the sender. Short message services are developing very rapidly throughout the world.

Technology Used

As microcontrollers are the core of the today‘s digital circuit design in industry, this system uses it for the centralized operation and digital processing.

Mobile phones and the network they operate under vary significantly from provider to provider, and even from nation to nation. However, all of them communicate through electromagnetic radio waves with a cell site base station, the antennas of which are usually mounted on a tower, pole, or building.

The phones have a low-power transceiver that transmits voice and data to the nearest cell sited, usually .5 to 10 miles away. When the cellular phone or data device is turned on, it registers with the mobile telephone exchange, or switch, with its unique identifiers, and will then be altered by the mobile switch when there is an incoming telephone call. The handset constantly listens for the strongest signal being received from the surrounding base stations. As the user moves around the network, the mobile device will ―hand off‖ to new cell sites.

Cell sites have relatively low-power radio transmitters which broadcast their presence and relay communications between the mobile handsets and the switch. The switch in turn connects the call to another subscriber of the same wireless service provider or to the public telephone network, which includes the networks of other wireless carriers.

The dialogue between the handset and the cell site is a stream of digital data that includes digitized audio. The technology that achieves this depends on the system which the mobile phone operator has adopted. Some technologies include AMPS for analog, and TDMA, CDMA, GSM, GPS, EV-DO, and UMTS for digital communications. Each network operator has a unique radio frequency. The mobile phone used in this project is 5110, 3310 or 3315 may be used.

(11)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING The technology used here is embedded technology which is the future of today‘s modern electronics.

Here we have used a very high speed Microcontroller i.e. P89V51RD2BN. This runs on 6-clk cycle period instead of 12-clk cycle. This makes the communication rate faster at 115200bps. Since we are using F-Bus protocol with the mobile, a full duplex communication with the above baud rate is required.

Features

The following are the prominent features of “SMS based device switching and status monitoring”

 Works with Nokia 3310,3315 phones,

 Can control up to 8-devices,

 User-programmable plain text message control,

 Communicate from any other mobile,

 Password protected,

 Ideal for alarm control panels,

 Can be used in vehicles,

 Can be controlled from anywhere, anytime,

 In-system programmable i.e. we can modify the code of the Controller at anytime depending upon our requirement without taking out the controller from the board.

(12)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(13)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Development Stages & Process

The complete development of this system can be divided into the following

stages

 Problem definition stage  Designing block diagram

 Implementing circuits and components  Developing flowchart for software  Writing actual code for Microcontroller  Compiling the code

 Burning the hex file into microcontroller with programmer  Testing

 Running

Problem definition stage

This is the very first stage to develop any project. It actually defines the aim and the concept of the project. The aim of “SMS based device switching and status monitoring” is to design a top class access control system that can be controlled from anywhere in the world & will reutilize the rejected or old mobile phones.

Designing block diagram

At this stage we have categorized the whole system into different individual modules. These modules (block diagrams) will be helpful in understanding the concept and working of the integrated system.

Section-II

(14)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Implementing circuits and components

This is the actual implementation of circuit of each block. At this stage we have actually designed each block separately and finally integrated them into the complete working system.

Developing Flowchart for software

To get the logical flow of the software, the development of flowchart is having a prominent role. So that we have analyzed the complete system and organized the flowchart in such a manner that one can understand the complete working of the software.

Writing actual code for Microcontroller

After the development of the algorithm and flowchart we have actually translated them in C language for P89V51RD2BN Microcontroller so that it can understand the instructions and run as per our requirement. The instructions are in ANSII C Language.

Compiling the code

The hand written code on paper was then transferred into computer. For that we have used Keil pre-install on PC. The Keil is a Computer Aided Program to simulate the working of Microcontroller in real time without burning the software into actual IC. We simulated and compiled our program for error checking. After removing several compiling errors the program was converted into machine language i.e. Intel hex format.

Burning the hex file into microcontroller with Programmer

In this stage the compiled hex format file was downloaded or burned into Philips P89V51RD2BN flash Microcontroller. This was done by using the Philips in-system programming software provided by the manufacturer itself.

Testing

This time we tested our project for actual working, after loading the software into the microcontroller. Any errors found were removed successfully.

(15)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING This is the last and final stage of development of our project. In this stage a user flowchart was made so that any one can use this system without any difficulty.

B

B

L

L

O

O

C

C

K

K

D

D

I

I

A

A

G

G

R

R

A

A

M

M

MOBILE 2 F -B US C ABLE MOBILE INTERFACING CIRCUIT UC P89V51 RD2BN LCD DISPLAY RELAY 1 RELAY 2 SERIAL EEPROM 93C46 DEVICE 1 DEVICE 2 MULTI P LE RELA YS RELAY N DEVICE N MULTI P LE D EVI C E S MOBILE 1

(16)
(17)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

SYSTEM

OVERVIEW

(18)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

A Introduction to Nokia F-Bus

How to connect microcontrollers to Nokia 3310 & 3315

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 firmware etc. This bus will allow us to send and receive SMS messages.

The very popular Nokia 3310/3315 has the F/M Bus connection under the battery holder. This is a bit of a pain to get to and requires a special cable to make the connection. The left picture above shows the 4 gold pads used for the F and M Bus. The right picture shows the F-Bus cable connected to Nokia 3310.

Section-III

(19)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Nokia download cables are available from most mobile phone shops and some electronics stores. The cable contains electronics to level convert 3V signals to RS232 type signals. There are also M and F bus switching in most cables.

The differences of M-Bus and F-Bus

M-Bus is a one pin bi-directional bus for both transmitting and receiving data from the phone. It is slow (9600bps) and only half-duplex. Only two pins on the phone 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).

F-Bus is the later high-speed full-duplex bus. It uses one pin for transmitting data and one 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.

(20)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

The F-Bus Protocol and Commands

The F-Bus is bi-directional serial type bus running at 115,200bps, 8 data bits. The serial cable contains electronics for level conversion and therefore requires power. The first thing to do is supply power to the cable electronics and this is done by setting the DTR (Data Terminal Ready) pin and clearing the RTS (Request to Send) pin.

Connect the DTR pin to a +3 to 12 Volt supply and RTS to a -3 to -12Volt supply. The easy way to achieve this is by using a Max232 or similar transceiver for the RS232 TX and RX pins and then connecting the DTR pin on the serial cable to the V+ pin on the Max232. Do the same for the RTS; however connect it to the V- pin on the Max232. The V+ and V- pins are derived from internal charge pumps that double the input voltage. i.e. for a 5V Max232, the V+ will +10V and the V- will be -10V.

The next step is to synchronize the UART in the phone with microcontroller. This is done by sending a string of 0x55 or 'U' 128 times. The bus is now ready to be used for sending frames.

The Nokia protocol has a series of commands that allow the user to make calls, send and get SMS messages and lots more.

Sample frame sent to Nokia 3310 (showed as a Hex dump)

B 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 1E 00 0C D1 00 07 00 01 00 03 00 01 60 00 72 D5

This sample frame is used to get the hardware and software version from a Nokia phone.

Byte 0: All frames sent by cable will start with the character 0x1E first. This is the F-Bus Frame ID. Cable is 0x1E and InfraRed is 0x1C.

Byte 1: This is the destination address. When sending data, it's the phone's device ID byte. In our case it's always 00 for the phone.

Byte 2: This is the source address. When sending data, it's the PC's device ID byte. In our case it's always 0x0C (Terminal).

(21)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Byte 3: This is the message type or 'command'. 0xD1 is Get HW & SW version.

Byte 4 & 5: Byte 4 & 5 is the message length. In our case it is 7 bytes long. Byte 4 is the MSB and byte 5 is the LSB.

Byte 6: The data segment starts here and goes for 7 bytes in our case. As The Nokia is a 16 bit phone and therefore requires an even number of bytes. As ours is odd the last byte will be a padding byte and the message will end at location 13. The last byte in the data segment (Byte 12 above) is the sequence number. The last 3 bits of this byte increment from 0 to 7 for each frame. This part needs to be sent back to the phone in the acknowledge frame.

Bytes 14 & 15: The second to last byte is always the odd checksum byte and the last byte is the even checksum byte. The checksum is calculated by XORing all the odd bytes and placing the result in the odd Checksum location and then XORing the even bytes and then placing the result in the even byte.

If the phone received it, the reply is shown in the following data:

1E 0C 00 7F 00 02 D1 00 CF 71

1E 0C 00 D2 00 26 01 00 00 03 56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D 2D 35 0A 28 63 29 20 4E 4D

50 2E 00 01 41 3F A4

The first line is an Acknowledge command frame. Notice how the destination and source addresses are now swapped. This is because the Nokia phone is now talking. This message is two bytes long with the two bytes representing the message type received (0xD1) and the sequence number (0x00). The last two bytes are the checksum and should be checked to make sure the data is correct. The 3310 will be waiting for an acknowledge frame after these two frames were sent. If the acknowledge frame is not sent the 3310 will retry sending the data. The 3310 will only send the data 3 times and then gives up.

(22)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING The second frame from the Nokia 3310 is the data we requested. The message type is 0xD2. This is 'receive Get HW&SW version'. This 38-byte (0x26) message should show 0x0003 "V ‖ "firmware\n" "firmware date\n" "model\n" "(c)NMP." The last byte in the data is the sequence number. As with standard F-bus frames, the last two bytes in the frame are checksum bytes.

The received data without f-bus frame

01 00 00 03 56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D 2D 35 0A 28 63 29 20 4E 4D 50 2E 00 01 41

0003 V 0 4 . 4 5 \n 2 1 / 0 6 / 0 1 \n N H M - 5 \n ( c ) N M P . Sequence no.

All that is required now is to send a acknowledge frame back to the phone to say 'I got it!'

1E 00 0C 7F 00 02 D2 01 C0 7C

0x7F is the acknowledge frame's command. We are only required to send a two-byte message so length is set to 0x02. The message contains the acknowledged message type (0xD2) and the sequence no. (0x01). The sequence number is made from the last 3 bits of the sequence number in the previous frame. The checksum needs to be calculated and sent.

How to send a SMS message with F-Bus?

Now that we know how to send frames on the bus, we should look at sending an SMS message.

SMS Point-to-Point Character Packing

The first thing we have to refer ―GSM 03.38 - Alphabets and language-specific information‖ from appendix. This is the Technical Specification that describes the packing of 7-bit characters and shows the standard character map.

(23)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Example:

Let's say we want to decode the string 'hello'. First we have displayed 'hello' in hexadecimal using the character map provided in GSM 03.38. For A to Z and numbers it‘s just the standard ASCII conversion.

h e l l o (ASCII characters) 68 65 6C 6C 6F (In hexadecimal) 1101000 1100101 1101100 1101100 1101111 (In Binary)

The first byte in the string is on the right. The least significant bit is then displayed on the left with the most significant bit on the left. Shown below is the same string of 'hello' just displayed backwards.Then it's just a matter to dividing the binary values into bytes starting with the first character in the string. (Start from right and go to left.) The first decoded byte is simply the first 7 bits of the first character with the first bit of the second character added to the end as shown below. The next decoded byte in then the remaining 6 bits from the second character with two bits of the third byte added to the end. This process just keeps going until all characters are decoded. The last decoded byte is the remaining bits from the last character with the most significant bits packed with zeros.

6F 6C 6C 65 68

1101111 1101100 1101100 1100101 1101000 (The ASCII characters shown in binary)

110 11111101 10011011 00110010 11101000 (The above binary just split into 8 bit segments)

06 FD 9B 32 E8

(The 8 bit segments decoded into hex)

(24)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

How to receive a SMS message with F-Bus?

This part is really quite simple. When the phone gets SMS message, it sends a 'SMS Message Received Frame' with the message attached to the F-Bus. All we have to do is decode it!

The SMS send example above sends a SMS message back to phone (The same phone sending the message). Therefore below is the SMS message that was sent above, but now getting received by the phone.

Byte: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Data: 1E 0C 00 02 00 59 01 08 00 10 02 10 00 07 91 16 14 91 09 10 F0 00 10 19 38 04 00 00 33 0B 91 16 04 73 08 70 Byte: 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 Data: F4 70 40 32 25 30 30 82 22 74 45 4C 25 30 30 82 22 74 45 4C 74 7A 0E 6A 97 E7 F3 F0 B9 0C BA 87 E7 A0 79 D9 Byte: 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 Data: 4D 07 D1 D1 F2 77 FD 8C 06 19 5B C2 FA DC 05 1A BE DF EC 50 08 01 45 00 4A 5C Byte 03: Message Type = 0x02 - SMS Handing

Byte 04 & 05: Message Length = 0x0059 - 89 Bytes long Byte 09: 0x10 = SMS Message received

Byte 10: 0x02 = Memory Type = SIM

Byte 11: 0x10 = Location where SMS message stored - required to delete SMS message

(TPDU) Transfer Protocol Data Unit Byte 24: 0x38

Byte 25: 0x04 Byte 26: Protocol ID

Byte 27: Data Coding Scheme

(25)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Serial Interface

The Nokia phones mentioned earlier incorporate two proprietary serial interfaces known as "MBUS" and "FBUS". MBUS is half-duplex, meaning that it provides just one signal line for both sending and receiving data. Data is exchanged over the MBUS at 9600bps (bits per second). This interface is intended primarily for factory test and adjustment, so we won‘t be using it here.

FBUS, on the other hand, provides separate send and receive lines and operates at the much higher speed of 115.2kbps. Nokia designed FBUS for connection to external accessories, such as their PC Data Suite. However, not all models work with this particular software. Nevertheless, the FBUS interface is present on all these models and ready to do duty in this project.

(26)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

CIRCUIT

DIAGRAM

(27)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Section-IV

(28)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

MOBILE PHONE:

 A mobile phone is an electronic telecommunications device. Most current mobile phone connects to the network using a wireless radio wave transmission technology. These mobile phones communicate via a cellular network of base stations, which is in turn linked to the conventional telephone network.

 Most mobile phones were sufficiently large that they often permanently installed in vehicles as car phones. With the advance of miniaturization, currently the vast majority of mobile phones are handled. In addition to the standard voice function of a telephone, a mobile phone can support many additional services such as SMS for text messaging, packet switching for access to the internet, and MMS for sending and receiving photos and video.  There is also specialist communication systems related to, but distinct from mobile

phones, such as Professional Mobile Radio. Mobile phones are also distinct from cordless telephones, which generally operate only within a limited range of a specific base station. Technically, the term mobile phone includes such devices as satellite phones and pre cellular mobile phones such as those operating via MTS which do not have a cellular network, whereas the related term cell phone does not. In practice, the two terms are used nearly interchangeably; with the preferred term varying by location. The mobile phone has become ubiquitous because of the interoperability of mobile phones across different networks and countries.

(29)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Nokia 3310 CHARACTERISTICS

General Network

GSM900

Introduced

1998

SAR Value

0.69 W/Kg

Size Weight

170 g (including battery)

Dimensions

132 x 47.5 x 31 mm

Display Type

Alphanumeric

Size

5 lines

Memory Outgoing Calls 8

Received Calls

5

Lost Calls

5

Ringtones Number

30

Networking Modem

Yes, 9600

Features Vibration

Yes

SMS

Send / Receive

Games

Yes (3): Memory, Snake, Logic

Clock

Yes

Alarm

Yes

Standard Battery Type

Li-Po

Amperage

600 mAh

Standby Time

40-180 hours

Talk Time

3 hours

Extended Battery Type

Li-Po

(30)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Circuit Diagram

Explanation

PCB Layout

This section provides the complete design details and circuit description of all the units used in the project.

Main Controlling Unit

Explanation

This circuit is the heart of the complete project. This is the actual unit which controls all the external peripherals & does the communication with the mobile.

The Port0 is connected to the Relay unit to control the devices connected on the relay pins. We can control up to 8-devices. As port0 is used for controlling the relay section, it is pulled up with the help of 10K resistor network.

(31)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING The Port1 & some pins of Port3 are used for LCD display interfacing. Port1 is used for 8-bit

data line. The controller sends various messages on the LCD indicating the current status of the system.

The Pin Rx & Tx are used for serial communication with the mobile. The baud rate is 115200bps.

The crystal 11.0592 MHz is the standard for serial communication. The external circuit connected to the Reset Pin of microcontroller is the R-C Network. This is used to auto-reset the controller whenever the power is switched on.

(32)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Power Supply Unit

Explanation

This power supply circuit is divided into the following different part: 1. The transformer

2. The rectifier 3. The filter 4. The regulator

The transformer

This is used to step down the voltage level of the A.C. input from 230 V to 12 V A.C.

The current rating of the transformer is 500mA. This is more than enough to supply the current to the relay unit & to all the other circuits.

(33)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING The rectifier

The rectifier used here is bridge rectifier. This is more efficient than the center tap. Here the A.C. signal coming from the transformer is rectified & converted into the pulsating D.C. this is further fed to the filter circuit.

The filter

This unit is nothing but a capacitor of high value which can charge & supply its charge to the circuitry in the falling edge of the input signal. This way it continuously maintains the direct cycle voltage across the circuit.

The regulator

The regulator is used to give constant output whatever is its input voltage. The input to this unit is nearly 15 V D.C. & its output voltage is constant to 5 V. & 12 V. since we are using two different types of regulators 7805 & 7812.

(34)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Max Unit

Explanation

Almost all digital devices which we use require either TTL or CMOS logic levels. Therefore the first step to connecting a device to the RS-232 port is to transform the RS-232 levels back into 0 and 5 Volts. This is done by RS-232 Level Converters.

Two common RS-232 Level Converters are the 1488 RS-232 Driver and the 1489 RS-232 Receiver. Each package contains 4 inverters of the one type, either Drivers or Receivers. The driver requires two supply rails, +7.5 to +15v and -7.5 to -15v. This may pose a problem in many instances where only a single supply of +5V is present.

(35)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Another device is the MAX232. It includes a Charge Pump, which generates +10V and

-10V from a single 5v supply. This I.C. also includes two receivers and two transmitters in the same package. This is handy in many cases when we only want to use the Transmit and Receive data Lines. We don't need to use two chips, one for the receive line and one for the transmitting. There are also many variations of these devices. The large value of capacitors are not only bulky, but also expensive. Therefore other devices are available which use smaller capacitors and even some with inbuilt capacitors. However the MAX-232 is the most common, and thus we will use this RS-232 Level Converter.

Dual Charge-Pump Voltage Converter

The first converter uses capacitor C1 to double the +5V input to +10V on C3 at the V+ output. The second converter uses capacitor C2 to invert +10V to -10V on C4 at the V- output.

(36)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Relay Unit

R

R

E

E

L

L

A

A

Y

Y

S

S

The stepper motor drive is used to drive the stepper motor since the stepper motor needs 12v and 350 mA for its operation. The ULN 2803 relay driver consists of 8 Darlington pair which produces an output voltage of 50v and output current of 500 mA .Darlington arrays are ideally suited for interfacing between low level logic circuitry and multiple peripheral power loads. Typical power loads totaling over 260w can be controlled at an appropriate duty cycle depending on the ambient temperature and number of drivers turned on simultaneously. Typical loads include relays, solenoids, stepping motors, magnetic print hammers, multiplexed LED and

(37)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING incandescent displays, and heaters. All devices feature open-collector outputs with integral clamp diodes. The ULx2803A, ULx2803LW, ULx2823A, and ULN2823LWhave series input resistors selected for operation directly with 5 V TTLor CMOS. These devices will handle numerous interface needs —particularly those beyond the capabilities of standard logic buffers. The ULx2804A, ULx2804LW, ULx2824A, and ULN2824LWhave series input resistors for operation directly from 6 V to 15 VCMOS or PMOS logic outputs. The ULx2803A/LW and ULx2804A/LW are the standard Darlington arrays. The outputs are capable of sinking 500 mA and will withstand at least 50 V in the off state. Outputs may be paralleled for higher load current capability. The ULx2823A/LW and ULx2824A/LW will withstand 95 V in the off state. These Darlington arrays are furnished in 18-pin dual in-line plastic packages (suffix ‗A‘) or 18-lead small-outline plastic packages (suffix ‗LW‘). All devices are pinned with outputs opposite inputs to facilitate ease of circuit board layout. Prefix ‗ULN‘ devices are rated for operation over the temperature range of -20C to +85C; prefix ‗ULQ‘ devices are rated for operation to -40C.

FEATURES OF ULN2803

 TTL, DTL, PMOS, or CMOS Compatible Inputs  Output Current to 500 mA

 Output Voltage to 95 V  Transient-Protected Outputs

 Dual In-Line Package or Wide-Body Small-Outline Package

ABSOLUTE MAXIMUM RATINGS

 Output Voltage, VCE

(X2803x and x2804x) 50 V

(X2823x and x2824x) 95 V  Input Voltage, VIN 30 V  Continuous Output Current, IC 500 mA  Continuous Input Current, IIN 25 mA  Power Dissipation, PD

(One Darlington pair) 1.0 W  Operating Temperature Range, TA

(38)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Prefix ‗ULQ‘ -40C to +85C

Storage Temperature Range, TS -55C to +150C .

(39)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING RELAYS:

A relays is an electrically operated switch current flowing through the coil of the relay create a magnetic field which attracts a lever and changes the switch contacts. The coil current can on or off so relays have two switch positions and they are double throw switches. Relays allow one circuit to switch a second circuit which can be completely separate from the first.

Relays are usually SPDT or DPDT but they can have many more sets of switch contacts. In our projects the relays have a coil, which works on 12v dc power supply and provide DPDT action as an output. The coil of the relay passes a relatively large current, typically 30mA for a 12v relay Most chips can not provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil. The maximum output current for the popular 555 timer IC is 200mA.so these devices can supply relay coils directly with out amplifications. Relay coils produce brief high voltage ‗spikes‘ ,when they are switched off and this can destroy transistor and ICs in the circuits to prevent the image protection diode is connected across the relay coil.Soild state relays is used which has a Darlington transistor. These relays would be ideal for applications where many relays are needed and power requirements are low. Due to their small size, a large number of relays could be mounted on single printed circuit board. The current required to operate these relays is significantly less than for mechanical relay types also these devices may be less expensive than mechanical relays.

CHOOSING A RELAY:

When choosing a relay we need to consider the following features. 1. Physical size and pin arrangement.

2. Coil voltage. 3. Coil resistances 4. Switch ratings

5. Switch contact arrangement.

ADVANTAGES OF RELAYS:

 Relays can switch AC and DC, transistors can only switch DC.  Relays can switch high voltages, transistors cannot.

 Relays are a better choice for switching large current (>5A).  Relays can switch many contacts at once.

(40)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING DISADVANTAGES OF RELAYS:

 Relays are bulkier than transistors for switching small current.

 Relays cannot switch rapidly, transistors can switch many times per seconds  Relays use more power due to the current following through their coil.

 Relays require more current than many chips can provide, so a low power transistor may be needed to switch the current for the relay‘s coil.

Output switching

Eight outputs are provided for controlling external devices. Each output line is driven by one open-collector transistor pair in a ULN2803 (IC4). Fig.4 shows the equivalent circuit for one channel of the ULN2803.

(41)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Reproduced from the datasheet, this graph shows the maximum current per channel for

1-8 simultaneously conducting outputs. For most controller applications, a duty cycle of 100% should be assumed.

One ULN2803 output can switch a maximum load current of 500mA. However, when more than one output is used, this must be dreaded according to the graph in Fig. For example, with four outputs in use, the maximum current per channel is slightly less than 300mA.

Relay Switching

This unit provides actual switching of external device connected to the pin of relay. The voltage of the coil of the relay is 6V. That means it will energies at minimum of 6 volts across it. After energizing of the coil the mechanical key present inside the relay switches to its other position and vice versa. This gives a heavy induced e.m.f. which can cost the rest of circuit to burn out but this is prevented by using a diode in parallel with the coil in opposite direction which is in-built in ULN2803.

(42)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

PCB LAYOUTS

Main Controlling Unit

(43)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Power Supply Unit

(44)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(45)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(46)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(47)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(48)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

The Flowchart

Software Instruction

The Flowchart

Section-V

Software

Y If pass

Change Change pass

Send SMS Pass changed

Decode SMS & S/W devices

Send SMS ―success‖

X

(49)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING START

Initialize All System Variables

OFF all Devices

Greeting on LCD

IF RST PASS ?

Reload default password Send F-Bus Initialization Command

Delete SMS Check Password Initialize LCD, Serial Port X If SMS found Check for IR If IR Check for SW If SW Send IR msg Send SW msg IF match found

Print Invalid pass

X Y

X

(50)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

S

S

O

O

F

F

T

T

W

W

A

A

R

R

E

E

#include <stdio.h> #include "P89V51.h" #include "Delay.h" #include "LCD.h" #include "Serial.h" #include "FBus.h" #include "Mem93CXX.h" #define Buzzer P3_7 #define RstPass P3_3 #define IR P2_4 #define SW P2_5 #define WA P2_6 #define TE P2_7 #define TI P3_2

void Beep(unsigned char No, unsigned int Delay);

//Mobile Variables/////////////////////////////////////////////////////////////

unsigned char xdata ToMN2[6]={0x19,0x99,0x96,0x06,0x77,0x95}; unsigned char xdata ToMN1[6]={0x19,0x99,0x76,0x86,0x27,0x68};

unsigned char xdata SrCN[6]={0x00,0x00,0x00,0x00,0x00,0x00};

unsigned char xdata MyCN[6]={0x19,0x89,0x02,0x00,0x45,0x44}; //Orange unsigned char xdata SrMN[6];

unsigned char xdata Msg[20],LenMsg,MEM;

//Mobile Variables\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

unsigned char idata Status[8]; unsigned char xdata Temp[50]; unsigned char i,j,NF;

(51)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING void main(void) //execution starts here

{

P0=0;//initially off all the devices

Beep(3,30000); SetSerial115200(); SetLCD(); SetMem93CXX(); for(i=0;i<8;i++)Status[i]='0'; LCD(1); printf(" Welcome to "); LCD(2); printf(" V.E.S.P. "); DelayL(80000); LCD(1);

printf("SMS Based Device"); LCD(2); printf("Switching and..."); DelayL(80000); LCD(1); printf("Monitoring Sys. "); LCD(2); printf("Project Done By "); DelayL(80000); LCD(1); printf("Yash Doshi "); LCD(2); printf("Vaibhav Doshi "); DelayL(80000); LCD(1);

(52)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING printf("Aniket Khedekar "); LCD(2); printf("Kaushal Joshi "); DelayL(80000); LCD(1); printf("Under guidance.."); LCD(2);

printf(" Radha Sivadas "); // DelayL(80000); if(RstPass==0) { WriteMem93CXX(0,'v'); WriteMem93CXX(1,'e'); WriteMem93CXX(2,'s'); WriteMem93CXX(3,'p'); WriteMem93CXX(4,' '); DelayL(40000); LCD(0); LCD(1); printf("Pass Resetted..."); LCD(2); printf("%c%c%c%c%c",ReadMem93CXX(0),ReadMem93CXX(1),ReadMem93CXX( 2),ReadMem93CXX(3),ReadMem93CXX(4)); } SetFBus(); while(1) { LCD(1);

(53)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING LCD(2); printf("Waiting for SMS."); if(!(LenMsg=GetSMS(Msg,SrMN,SrCN,&MEM,1000))) { if(IR==0) { LCD(1); printf("IR Breaked..."); LCD(2); printf("Sending SMS..."); sprintf(Temp,"%c%c%c%c%c%c%c%c IR Breaked!IR Breaked!IR Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[ 7]); SendSMS(Temp,50,MyCN,ToMN1); DelayL(60000); continue; } if(SW==0) { LCD(1); printf("SW Breaked..."); LCD(2); printf("Sending SMS..."); sprintf(Temp,"%c%c%c%c%c%c%c%c SW Breaked!SW Breaked!SW Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[ 7]); SendSMS(Temp,50,MyCN,ToMN1); DelayL(60000); sprintf(Temp,"%c%c%c%c%c%c%c%c SW Breaked!SW Breaked!SW

(54)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Brealed!!!!!!!!.",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[ 7]); SendSMS(Temp,50,MyCN,ToMN2); DelayL(60000); continue; } if(WA==0) { LCD(1);

printf("Water Set Level "); LCD(2);

printf("Reached. ");

sprintf(Temp,"%c%c%c%c%c%c%c%c Water Set Level Reached. ",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]); SendSMS(Temp,50,MyCN,ToMN1); DelayL(60000); continue; } if(TE==0) { LCD(1);

printf("Temp. Set Level "); LCD(2);

printf("Reached. ");

sprintf(Temp,"%c%c%c%c%c%c%c%c Temp. Set Level Reached. ",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]); SendSMS(Temp,50,MyCN,ToMN1); DelayL(60000); continue; } if(TI==0)

(55)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING { LCD(1); printf("Timer Count "); LCD(2); printf("Completed. ");

sprintf(Temp,"%c%c%c%c%c%c%c%c Timer Count Completed. ",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6],Status[7]); SendSMS(Temp,50,MyCN,ToMN1); DelayL(60000); continue; } continue; } LCD(0); LCD(1); printf("Got SMS!!!!!!!!!"); LCD(2); for(i=5;i<LenMsg;i++)printf("%c",Msg[i]); Beep(2,60000); DeleteSMS(MEM);

///////////////////////////////////////////start processing on device if(Msg[0]==ReadMem93CXX(0)&&Msg[1]==ReadMem93CXX(1)&&Msg[2]==ReadMem9 3CXX(2)&&Msg[3]==ReadMem93CXX(3)&&Msg[4]==ReadMem93CXX(4)) { if(Msg[5]=='p') { WriteMem93CXX(0,Msg[6]); WriteMem93CXX(1,Msg[7]); WriteMem93CXX(2,Msg[8]); WriteMem93CXX(3,Msg[9]);

(56)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING WriteMem93CXX(4,Msg[10]); LCD(1); printf("Password Changed"); LCD(2); printf("Successfully....");

sprintf(Temp,"%c%c%c%c%c%c%c%c Password Changed Successfully...",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6], Status[7]); SendSMS(Temp,50,MyCN,SrMN); DelayL(60000); } else { NF=0; for(i=5;i<LenMsg;i++) { if(Msg[i]=='n')NF=0xff; if(Msg[i]=='f')NF=0x00; if(Msg[i]=='a') { P0=NF; if(NF==0)for(j=0;j<8;j++)Status[j]='0';else for(j=0;j<8;j++)Status[j]='1'; } switch(Msg[i]) { case '1':P0_0=NF;if(NF==0)Status[0]='0';else Status[0]='1';break; case '2':P0_1=NF;if(NF==0)Status[1]='0';else Status[1]='1';break;

(57)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING case '3':P0_2=NF;if(NF==0)Status[2]='0';else Status[2]='1';break; case '4':P0_3=NF;if(NF==0)Status[3]='0';else Status[3]='1';break; case '5':P0_4=NF;if(NF==0)Status[4]='0';else Status[4]='1';break; case '6':P0_5=NF;if(NF==0)Status[5]='0';else Status[5]='1';break; case '7':P0_6=NF;if(NF==0)Status[6]='0';else Status[6]='1';break; case '8':P0_7=NF;if(NF==0)Status[7]='0';else Status[7]='1';break; } } LCD(1); printf("Command Executed"); LCD(2); printf("Successfully....");

sprintf(Temp,"%c%c%c%c%c%c%c%c Command Executed Successfully...",Status[0],Status[1],Status[2],Status[3],Status[4],Status[5],Status[6], Status[7]); SendSMS(Temp,50,MyCN,SrMN); DelayL(60000); } } else { LCD(1); printf("Invalid Password"); LCD(2); printf("Request Denied!!"); DelayL(60000);

(58)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING }

///////////////////////////////////////////stoped processing on device }// end of while 1

}//end of main

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

void Beep(unsigned char No, unsigned int Delay) {

unsigned char tNo;

for(tNo=1;tNo<=No;tNo++) { Buzzer=0; DelayI(Delay); Buzzer=1; DelayI(Delay); } } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

(59)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

BASICS

OF

(60)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Introduction to Microcontrollers

The 8

9V51 Microcontroller

Features of 8

9V51

Pin Diagram & Explanation

Architecture of 8

9V51

Memory Organization of 8

9V51

Introduction to Microcontrollers

Definition

An embedded microcontroller is a chip which has a computer processor with all its support functions (clock & reset), memory (both program and data), and I/O (including bus interface) built into the device. These built in functions minimize the need for external circuits and devices to be designed in the final application.

Types of Microcontroller

Creating applications for microcontrollers is completely different than any other development job in computing and electronics. In most other applications one probably have a number of subsystem and interfaces already available for his/her use. This is not the case with a microcontroller where one is responsible for –

 Power distribution  System clocking

 Interface design and wiring  System programming  Application programming

Section-VI

(61)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING  Device programming

Before selecting a particular device for an application, it‘ s important to understand what the different options and features are and what they can mean with regard to developing application.

Embedded Microcontroller

When all the hardware required to run the application is provided on the chip, it is refer to as an Embedded Microcontroller. All that is typically required to operate the device is power, reset, and a clock. Digital I/O pins are provided to allow interfacing with external devices.

External Memory Microcontroller

Sometimes, the program memory is insufficient for an application or, during debug; a separate ROM (or even RAM) would make the work easier. Some microcontrollers including the 8051 allow the connection of external memory.

An external memory microcontroller seems to primarily differ from a microprocessor in the areas of built-in-peripheral features. These features could include memory device selection (avoiding the need for external address decoders or DRAM address multiplexers), timers, interrupt controllers, DMA, and I/O devices like serial ports.

Microcontroller Memory Types

There are number of different types of control store (Program Memory) that are available in different versions and different manufacturers‘ 8051s. There is a fairly simple convention that is used to identify what type of control store a device has.

The following is the list of conventions used for 8X51-

“X” value Control Store Type

0 None

3 Mask ROM

7 EPROM

(62)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

The P89V51 microcontroller

The P89V51 is a low-power, high-performance CMOS 8-bit microcomputer with 64Kbytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Phillips‘s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Phillips P89V51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

The P89V51 is designed with static logic for operation down to zero frequency and supports two Software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next Hardware reset.

(63)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Features of P89V51RD2BN

Following is the features of 89V51 microcontroller as per the datasheet given by Phillips-

80C51 Central Processing Unit

On-chip Flash Program Memory with In-System Programming (ISP) and In-Application Programming (IAP) capability

Boot ROM contains low level Flash programming routines for downloading via the UART

Can be programmed by the end-user application (IAP)

Parallel programming with 87C51 compatible hardware interface to programmer

Six clocks per machine cycle operation (standard) 12 clocks per machine cycle operation (optional)

Speed up to 20 MHz with 6 clock cycles per machine cycle (40 MHz equivalent performance); up to 33 MHz with 12 clocks per machine cycle

Fully static operation

RAM expandable externally to 64 kbytes Four interrupt priority levels

Seven interrupt sources Four 8-bit I/O ports

Full-duplex enhanced UART  Framing error detection

 Automatic address recognition Power control modes

 Clock can be stopped and resumed  Idle mode

 Power down mode Programmable clock out Second DPTR register Asynchronous port reset Low EMI (inhibit ALE)

Programmable Counter Array (PCA)  PWM

(64)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

(65)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Architecture of P89V51

(66)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING

Brief Description

The P89V51 is a low-power, high-performance CMOS 8-bit microcomputer with 64K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Phillips‘s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Phillips P89V51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

Pin Description

VCC Supply voltage.

GND Ground.  Port 0

Port 0 is an 8-bit open-drain bi-directional 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 during program verification.

 Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 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 (IIL) 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 Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are

(67)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, it uses strong 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 Special 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 output 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 inputs, Port 3 pins that are externally being pulled low will source Current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the P89V51 as listed below:

o Port Pin Alternate Functions –

 P3.0 RXD (serial input port)  P3.1 TXD (serial output port)  P3.2 INT0 (external interrupt 0)  P3.3 INT1 (external interrupt 1)  P3.4 T0 (timer 0 external input)  P3.5 T1 (timer 1 external input)

 P3.6 WR (external data memory write strobe)  P3.7 RD (external data memory read strobe)

o Port 3 also receives some control signals for Flash programming and verification.

 RST

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

(68)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING  ALE/PROG

Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external 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 instruction. 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 P89V51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

 EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP.

 XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

 XTAL2

(69)

SMS BASED DEVICE SWITCHING AND STATUS MONITORING Memory Organization

Program Memory

The TEMIC C51 Microcontroller Family has separate address spaces for program Memory and Data Memory. The program memory can be up to 64 K bytes long. The lower 4 K for the 80C51 (8 K for the 80C52, 16 K for the 83 C154 and 32 K for the 83C154D) may reside on chip.

Data Memory

The C51 Microcontroller Family can address up to 64 K bytes of Data Memory to the chip. The ―MOVX‖ instruction is used to access the external data memory (refer to the C51 instruction set, in this chapter, for detailed description of instructions). The 80C51 has 128 bytes of on-chip-RAM (256 bytes in the 80C52, 83C154 and 83C154D) plus a number of Special Function Registers (SFR). The lower 128 bytes of RAM can be accessed either by direct addressing (MOV data addr). or by indirect addressing (MOV @Ri).

Internal Data Memory Organization

Internal data memory is shown in Figure. The memory space is divided into three blocks, which are generally referred to as the Lower 128, the Upper 128, and SFR space.

References

Related documents