An Industry-oriented Mini-Project Report on Implementing of GSM Modem for Industrial Automation applications. Submitted to JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY Hyderabad (A.P.) in partial fulfillment of the Requirement for the award of Degree of BACHELOR OF TECHNOLOGY in Electronics & Instrumentation Engineering By Sireesh.Y (07891A1043) R. Karthik Reddy. (07891A1053) Chandu Gopi. (07891A1023)

Department of Electronics and Instrumentation Engineering VIGNAN INSTITUTE OF TECHNOLOGY & SCIENCE Deshmukhi, Nalgonda Dist – 508 284 2009 -2010



This is to certify that the Mini-project report entitled……..……………….………is being submitted by Mr./Ms ………………………………………. in partial fulfillment for the award of Degree of Bachelor of Technology in Electronics and Communication Engineering to the Jawaharlal Nehru Technological University is a bonafide record of work carried out by him/her/them under our supervision. The results embodied in this mini-project report have not been submitted to any other University or Institute for the award of any degree or diploma.

Signature of Supervisor Name and Designation

Signature of Head of the Department Name and Designation (With Seal)



Index 1. Introduction
1.1Introduction to Project background 1.2 Why Industrial Automation 1.2.1 Importance of Automation 1.2.2 Context of the project 1.3 Existing Systems 1.4 Proposed Architecture 1.4.1 Basic Principle 1.5 What is GSM? 1.6 A Brief Introduction to PSoC 1.6.1 PSoC architecture 1.6.2 Characteristics of PSoC microcontrollers 1.6.3 Relevance and use of PSoC in the project 1.7 Tools and Hardware

Page .No

2. PSoC
2.1 About Microcontroller 2.2 Introduction to PSoC Microcontroller 2.3 System Overview 2.4 CPU 2.5 Frequency Generator 2.6 Microcontroller Power Consumption 2.7 Reset 2.8 Digital Inputs and Outputs 2.9 Analog Inputs and Outputs 2.10 Accessing Programmable Digital Blocks 2.11 Digital Programmable Blocks 2.12 Analog Programmable Blocks 2.13 Referent Voltage Generators

17 Interrupt Controller 2.7 Digital Components Interconnection 2.5 Component Parameters 2.19.1 WHAT ARE USER MODULES? 3.14 Switch Mode Pump 2.4 ONE WIRE SOFTWARE USER MODULE .18 Address Space 2.8 Analog Components Interconnection PSoC Designer 2.2 LCD 3. PSoC User Module Blocks 3.19.16 I2C Controller 2.3 Interconnection View 2.19.1 Introduction 2.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 4 2.6 Pin Parameters 2.2 Programmable Component Selection 2.9 Application Editor MAC 2.19.4 Global Parameters 2.19.3 TX8 USER MODULE 3.

1 GSM Architecture 4.1.2 GSM Modem 4.1 All about GSM 4.1.2 AT COMMANDS 4. Future Scope 7. Hardware Design 4. Conclusion 6. Bibliography INTRODUCTION .3 DS18S20 Temperature Sensor 5.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 5 4.

Engineers strive to combine automated devices with mathematical and organizational tools to create complex systems for a rapidly expanding range of applications and human activities. language recognition. referred to as programmable logic controllers (PLCs). are frequently used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events. automation is a step beyond mechanization. the use of humans is more cost-effective than mechanical approaches even where automation of industrial tasks is possible. This leads to precisely controlled actions that permit a tight control of almost any industrial process. In many cases. such as scents and sounds. Processes and systems can also be automated. Tasks requiring subjective assessment or synthesis of complex sensory data. as well as high-level tasks such as strategic planning. and language production ability are well beyond the capabilities of modern mechanical and computer systems. reducing the need for human intervention. automation greatly reduces the need for human sensory and mental requirements as well. Human-level pattern recognition. Automation plays an increasingly important role in the global economy and in daily experience. are usually employed to communicate with PLCs and other . formerly known as man-machine interfaces.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 6 1. In the scope of industrialization. Many roles for humans in industrial processes presently lie beyond the scope of automation. Whereas mechanization provided human operators with machinery to assist them with the physical requirements of work.1 Introduction to Project background WHAT IS INDUSTRIAL AUTOMATION? Automation or industrial automation or numerical control is the use of control systems such as computers to control industrial machinery and processes. Human-machine interfaces (HMI) or computer human interfaces (CHI). Specialized hardened computers. currently require human expertise.

Service personnel who monitor and control these interfaces are often referred to as stationary engineers. • • System monitoring showed that unit costs varied by as much as 50 percent over the three daily shifts.2 WHY INDUSTRIAL AUTOMATION 1. Its various data templates can be configured to address management and executive information needs. improves product quality. such as entering and monitoring temperatures or pressures for further automated control or emergency response. . Technology is used in so many ways and for so many different ends that it is almost impossible to have a single definition that includes all the solutions factory automation delivers. and of course. more functional and ubiquitous. In order to receive these benefits. The operation and control of the modern industrial equipment and process needs lot of sensors to monitor various parameters of the systems.1 Importance of Automation Automation can improve productivity and quality. • • • • MVI's RPM system.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 7 computers. • As factory automation technology becomes more capable. educating the workers on the machinery is necessary.2. Process and systems with less of the human intervention. It presents real-time data that will help hem to do something with the information and make an informed decision. in effect. documents the way a company manages its people. its meaning and purpose take on many interpretations. Industrial automation is process of controlling and guiding the industrial equipment. Companies must contemplate their objectives of automating before incorporating any machinery. Factory automation delivers increased product and process information. 1.

It can also lead to decreased factory power outages and improve uptime. consider your risk before you take action. They have been forced to change from basic suppliers of parts.2. The sensor information should be available at various locations simultaneously to take accurate decisions. components or equipment to a take position where they help customers realize greater productivity. As with any powerful technology. • Most of the systems require features which are given by web server kind of architecture – – Authentication (of the person commanding) Port numbers for each connecting application on wireless . This job should be done with at most accuracy and reliably. While increased productivity is the clarion call for the OEM. quality and a competitive edge from OEM purchases. end users must contend with a growing list of factory automation opportunities. or TIP.2 Context of the project • Monitoring of the Critical sensor monitoring is very important in several industries (Nuclear plants. to better manage energy costs and save money. Make sure you have a solid set of goals and objectives that meet your company's operating needs. • • • 1. This kind of requirement can be met by using the central servers and connecting the sensor networks through the controllers to the central servers. a challenge for implementing successful factory automation. power plants. Factory automation's capabilities are multi-faceted and provide answers to the questions asked of it. • • Among the initiatives that Siemens has started is one called Totally Integrated Power. • • • Because there are fewer mechanical components. petroleum and gas).IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 8 • Providing proper training to the operators led to increased productivity and a more consistent unit cost. the OEM can deliver the press at a lower initial cost to the printer or publisher.

The availability of information at various nodes simultaneously is not achieved.Requires costly equipment setup. Except few large industries majority of the companies cannot afford to invest huge amount of money in the existing costly setups to meet the requirements of Industrial Automation.4 .15.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 9 • • • • but the deployment of web server is costly and complex to maintain Maintaining the wireless network has issues GSM network is readily available wireless secured network Growing technological research towards 3G suggests this alternative 1.3 EXISTING SYSTEMS Majority of the companies in INDIA have not implemented Automation practices in industry. Existing methods widely use the following technologies to communicate the information from one end to the other end of the company.High cost and high power consumption All the methods discussed above are quite expensive and complex to implement and not very reliable. .Range is up to only few Kms maximum • Using Wi-Fi . • Using Bluetooth -but it is limited to short range • Using Zigbee/ IEEE802. .

Remotely. the system allows the various authorities monitoring and controlling the critical parameters via the mobile phone set by sending commands in the form of SMS messages and receiving the process status. The system software driver is also developed using an interactive C programming language platform. designed.4 PROPOSED ARCHITECTURE In this Project an attempt has been made to develop a GSM (Global System for Mobil communication) based industrial Automation system. implemented and tested. The GSM modem provides the communication media between the Authority and the system by means of SMS messages.1 Block diagram . Using the public GSM networks. The design of a stand-alone embedded system that can monitor and control various process and equipment and critical systems locally using built-in input and output peripherals is presented.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 10 1. Fig 1. an industrial automation system has been proposed.

and CDMA). GSM uses a variation of Time Division Multiple Access (TDMA) and is the most widely used of the three digital wireless telephone technologies (TDMA. For example monitoring the boiler performance in a thermal / Nuclear power plant can be done by using Temperature of the boiler.4. After receiving the corrective command. GSM is the de facto wireless telephone standard in Europe. each in its own time slot. GSM digitizes and compresses data. At the initial phase the controller will send an SMS to the authorised user. In the above case the temperature can be brought down by controlling the heat input. 1. PSoC controller is programmed with the default control algorithm. then sends it down a channel with two other streams of user data. The sensor information processed by the controller can be rooted to the users by power on controllers sends status SMS to predefined numbers • • User can get the status by SMS.5 WHAT IS GSM GSM (Global System for Mobile communication) is a digital mobile telephone system that is widely used in Europe and other parts of the world.800 MHz frequency band. Based on the information received the user can initiate the corrective action. If any increase in the temperature of the system beyond the threshold has been recorded. The same instruction will be initiated by the user. GSM has over one billion users worldwide and is available in 190 countries. Modem performs the operation and gives acknowledgment message to the user.1 Basic Principle • • Micro controller is interfaced with sensor and with GSM modem. the controller will activate the necessary modules to reduce the heat input. It operates at either the 900 MHz or 1. the controller is instructed to initiate a corrective action. Since many GSM network operators have . GSM. Micro controller is interfaced with sensors like Temperature. The basic idea of these sensors is to monitor the parameters of various systems.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 11 1.

require additional attention during production of a printed circuit board.. such as operational and instrument amplifiers. All of these factors can significantly affect the price and development cycle of the project. timers. As a general rule. implementation of the extra peripherals brings in additional difficulties: new components take space.833Kb Table-1 GSM characteristics 1. users can often continue to use their mobile phones when they travel to other countries.6. TX: 880-915 TDMA/FDM FDD 124 (8 users per channel) 200kHz GMSK (0. digital logic circuits. filters. In addition to all the standard elements of 8- . The introduction of PSoC microcontrollers has made many engineers’ dream come true of having all their project needs covered in one chip.6 A Brief Introduction to PSoC WHAT IS PSOC MICRO CONTROLLER? When developing more complex projects.3 Gaussian Filter) 270. Mobile Frequency Range Multiple Access Method Duplex Method Number of Channels Channel Spacing Modulation Channel Bit Rate RX: 925-960. there is often a need for additional peripheral units. AD and DA converters. and increase power consumption. etc..1 PSoC architecture Programmable System on Chip PSoC (Programmable System on Chip) represents a whole new concept in microcontroller development.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 12 roaming agreements with foreign operators. 1.

Basic difference between PSoC families is the number of available programmable blocks and the number of input/output pins. comparators. instrumentational and non-inverting amplifiers. PSoC chips feature digital and analog programmable blocks. PSoC chips have 4–16 digital blocks. and 3–12 analog programmable blocks. Analog blocks are used for development of analog elements. Fig 1. such as analog filters. depending on the project requirements. which themselves allow implementation of large number of peripherals. There are a number of different PSoC families you can base your project upon.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 13 bit microcontrollers. as well as AD and DA converters. Depending on the microcontroller family. Number of components that can be devised is primarily a function of the available programmable blocks.2 28 pin PSOC microcontroller . Digital blocks consist of smaller programmable blocks that can be configured to allow different development options.

256 bytes of RAM. 3.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 14 Fig 1.2 Characteristics of PSoC microcontrollers Some of the most prominent features of PSoC microcontrollers are: • • • • MAC unit. Programmable voltage amplifier. DA converters with maximum resolution of 9 bits.3V or 5V. Changeable working voltage. hardware 8x8 multiplication. Programmable filters and comparators. to 1V.3 Configuration of analog and digital blocks 1. .6. Possibility of small voltage supply. with result stored in 32-bit accumulator. Programmable blocks allow you to devise: • • • • • • 16K bytes of programmable memory. AD converters with maximum resolution of 14 bits. Programmable frequency choice.

1.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 15 • • • • • • • • • • • • Timers and counters of 8. Strong.3 Relevance and use of PSoC in the project Perhaps the best way to recognize the true value of PSoC microcontrollers is through comparison with other options. Option for connection on all output pins.  Hardware generators of pseudorandom and CRC code. High Z. Major advantages of PSoC microcontroller include the following: There is no other microcontroller that has programmable voltage. and 32 bits. 16. Multiple SPI devices. Pseudorandom sequences and CRC code generators. I2C Slave or Master and Multi-Master up to speed of 400 KHz. It’s worth noting that hardware accumulator multiplication is not a common feature of 8-bit microcontrollers. modulators. Two Full-Duplex UARTs. are unique to PSoC families. as well as analog MAC (Multiply-accumulate) is an essential part of digital signal processors. .  instrumentational. and non-inverting amplifiers. Pull down. Option for programming only the specified memory regions and write protection. For every pin there is an option of Pull up. Built-in precise voltage reference. or Open pin state. Integrated Supervisory Circuit.6. inverting. Possibility of interrupt generation during change of state on any input/output pin. Option for block combining.  which allows implementation of digital signal processing algorithms.

 implementation. while voltages below AGND are taken as negative. and PWM units are more flexible than the usual Automatic code writing for accessing all the peripherals in use. In this way. In this case. there is an option for dynamic operated systems.  Option for low voltage supply (~1V) is a tremendous advantage in battery Timers. allowing you to change peripherals during run-time. In case you need a larger array of components. it’s possible to minimize the processor workload at a time. 1. This feature is particularly important for development of new devices as it eliminates the need for redesigning the PCB and implementing the level translator. For example. counters. zero voltage for inverting amplifiers is taken to be the analog ground AGND (usually 2. All voltages above AGND are taken as positive.  Most PSoC microcontrollers have 256 bytes of RAM.  On the other hand. you should analyze if speed of AD converters and offset/noise of analog amplifiers are able to satisfy the project demands. there are certain limitations of PSoC that could influence the In systems which require highly precise or fast measurement.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 16  Having the advantage of changeable working voltage doesn’t really need a comment.  Analog components do not have the ability to work with usual negative supply voltage. problems may occur choice of microcontroller for the design. which could prove to be insufficient for some projects.5V).   reconfiguration. .7 TOOLS AND HARDWARE The following are the software tools used in the project.  with analog device characteristics. leaving the largest part of the job to the specialized hardware.

PSoC programmer. Relays Different consumer devices GSM Modem PSOC MICROCONTOLLER-PIN DIAGRAM . • • • • • • • PSoC microcontroller Temperature sensors IR Sensors Smoke sensors.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 17 PSoC Designer suite. to dump the code on the Micro controller. is used for building and configuring the required blocks and to develop the code. from Cypress Semiconductors. The following are the hardware modules used in the project development.

Replacement of electromechanical components in products such as washing machines and traffic light controllers was a popular application initially. 27 I/O pins and an 8 bit timer. In 1971 Intel corporation introduced the 8080. Other precuts where microcontroller can be . These SBCs of which SDK-85 by Intel etc are the most memorable.1 ABOUT MICROCONTROLLER This section provides an introduction to most common word in the embedded system “microcontroller”. soon become an industry standard in control oriented applications. Within a single integrated circuit containing over 17. the first successful microprocessor. Shortly thereafter. Alone these integrated circuits (ICs) were rather helpless (and they remain so). A Device similar to the microprocessor is the microcontroller. 1801. quickly found their way into design labs at colleges. It’s hard to imagine the present world of electronic tools and toys without the microprocessor or Microcontroller. and other MCS-48 devices that followed. It is written to familiarize you with microcontroller terminology and basic microcontroller architecture. This IC. the 8748 delivered a CPU. 64bytes of RAM. Motorola.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 18 PSOC MICROCONTROLLER 2.000 transistors. In 1976 Intel introduced the 8748. universities and electronics companies. 1K byte of EPROM. the first device in the MCS-48TM family of the microcontrollers. and remains so. RCA and then MOS technology and Zilog introduced similar devices: the 6800. 6502 and Z80 respectively. but as a part of a single board computer (SBC) they become the central component in useful products for learning and designing with microprocessors. Yet this single chip wonder has barely reached thirtieth birthday.

NOTE A microcontroller is not the same as a microprocessor. The pins presented by a microcontroller are used for power. A microcontroller is a single chip. 32 I/O lines.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 19 found include automobiles. In functional terms. Microcontrollers are typically used as embedded controllers where they control part of a larger system such as an appliance. 128 bytes of RAM. the first device in the MCS-51 TM family of microcontrollers.000 transistors. Microcontrollers are often referred to as single chip devices or single chip computers. usually personal or workstation computers. Microprocessors depend upon a variety of subsidiary chips and devices to provide the resources not available on the microprocessor. the pins exposed by a microprocessor are most often memory bus signals (rather than I/O ports). In contrast. Development computers. The main consequence of the microcontroller’s small size is that its resources are far more limited than those of a desktop personal computer. I/O ports. a microcontroller is an integrated circuit with pins along each side. Phillips P89C51RD2 etc. automobile. self-contained computer which incorporates all the basic components of a personal computer on a much smaller scale. industrial equipment. Size and complexity of microcontrollers advanced an order of magnitude in 1980 with Intel’s announcement of the 8051. So many companies are manufacturing enhanced 8051 like Atmel AT89C52. Physically. this device contains over 60. interrupt request signals. New members have been added to the MCS-51 family. oscillator. A microprocessor is a single chip CPU used within other computer systems. In comparison to the 8748.. consumer entertainer products and computer peripherals. 4K bytes of ROM. and today variations exist virtually doubling these specifications. a microcontroller is a programmable single chip which controls a process or system. use a microprocessor as their principle computing engine. scientific instrument or a computer peripheral. ground. a serial port and two 16 bit timers—a remarkable amount of circuitry for a single IC. The Power. Additional chips required . Personal computers are used as development platforms for microcontroller projects. A microcontroller is itself a single chip computer system. therefore using them can drastically reduce part and design costs for a project. Microcontrollers are designed to be low cost solutions. reset and control.

v. editors and simulators which require the processing power and memory capabilities of a desktop personal computer or workstation.1 The micro controller . iv. For example. A development platform is required to run embedded system development software such as assemblers. The developer writes. edits. A microcontroller has seven main components: i. input/output control and specialized processing. compilers. vi. Central processing unit (CPU) ROM RAM Input and Output Timer Interrupt circuitry Buses Fig 2.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 20 with microprocessor support memory storage. consider a developer who is creating a program for a 8051microcontroller. When the program is ready it is programmed in the target platform. and tests the program on a Pentium personal computer: the development platform. The target platform is the platform on which the finished program will be run. ii. the 8051. The developer will use software which runs on a Pentium but whose target device is the 8051. vii. iii.

2 INTRODUCTION TO PSOC MICROCONTROLLER When developing more complex projects.. Analog blocks are used for development of analog elements. For example. AD and DA converters. increase power consumption. For example. such as operational and instrument amplifiers. 2. If the switch is pressed the microcontroller can be instructed to illuminate the LED. The microcontroller is often part of a larger system. etc. As their name suggests they are designed to control other devices. comparators. covered in one chip. timers. as well as AD and DA converters.. All of these factors can significantly affect the price and development cycle of the project.inverting) amplifiers. The introduction of PSoC microcontrollers has made many engineers’ dream come true of having all their project needs PSoC: Programmable System on Chip PSoC (Programmable System on Chip) represents a whole new concept in microcontroller development.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 21 Microcontrollers do not function in isolation. a microcontroller may accept input from a switch and may send output to an LED. which themselves allow implementation of large number of peripherals. When a microcontroller is part of a larger system it is often referred to as an embedded controller because it is embedded within the larger system. there is often a need for additional peripheral units. such as analog filters. . require additional attention during production of a printed circuit board. Digital blocks consist of smaller programmable blocks that can be configured to allow different development options. In addition to all the standard elements of 8-bit microcontrollers. intrumentational (non. PSoC chips feature digital and analog programmable blocks. the switch and LED may be part of a compact disc player in a car stereo system. The microcontroller can accept inputs from some devices and provide outputs to other devices within any given system. digital logic circuits. As a general rule. filters. implementation of the extra peripherals brings in additional difficulties: new components take space.

3 SYSTEM OVERVIEW PSoC microcontrollers are based on 8-bit CISC architecture. Basic difference between PSoC families is the number of available programmable blocks and the number of input/output pins. and 3–12 analog programmable blocks. PSoC chips have 4–16 digital blocks. .2 General structure of PSOC CPU unit is the main part of a microcontroller whose purpose is to execute program instructions and control workflow of other blocks. Their general structure with basic blocks is presented in the following image: Fig 2. Number of components that can be devised is primarily a function of the available programmable blocks.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 22 There are a number of different PSoC families you can base your project upon. depending on the project requirements. Depending on the microcontroller family. 2.

it is possible to supply power to a PSoC microcontroller from a single 1. . Voltage reference is vital for the work of analog components that reside inside of analog programmable blocks. For example. non-inverting and operational amplifiers. instrumental. Interrupt controller handles necessary operations in the case of interrupts. Sleep timer can periodically wake up microcontroller from power saving modes. DTMF receivers. It could be also used as a regular timer.5V battery. Watch Dog timer is used to detect software dead-loops. I2C controller Enables hardware realization of an I2C communication. filters. Input-Output pins enable communication between the CPU unit. digital and analog programmable blocks and outside world. programmable. inverting. Digital programmable blocks are used to configure digital programmable components which are selected by user. SMP is a system which can be used as a part of a voltage regulator. Reset controller enables microcontroller start action and brings a microcontroller to regular state in the case of irregular events. MAC unit is used for operations of hardware signed multiplication of 8-bit numbers. like AD and DA converters.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 23 Frequency generator facilitates signals necessary for CPU to work. as well as an array of frequencies that are used by programmable blocks. These signals could be based on internal or external referent oscillator. Analog programmable blocks are used to configure analog components.

decodes it and executes appropriate operations.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 24 2. Fig 2. as well as ALU unit and instruction decoding unit. With each new instruction value of program counter is being set to point on the next instruction in program memory. When these instructions occur value stored in SP is internally incremented or decremented. Also. . which is going to be decoded and executed. A.3 CPU Overview Internal Registers of CPU Program counter (PC) is used as a pointer to the next program instruction that should be executed.4 CPU During the programming. CPU fetches one instruction at a time from program memory. instructions are stored in program (FLASH) memory in a way which is familiar to microcontroller. SP. logical or data transfer operations. X and F. Stack pointer (SP) points to the address of SRAM memory where data is written to or read from in case of PUSH and POP instructions respectively. Index register (X) could behave as register A in large number of instructions. CPU unit has internal registers PC. register X is used in the case of index addressing. that are associated to instruction execution process. Accumulator register (A) is the main register which handles all arithmetical.

It also has a role during selection of a RAM memory page in case when PSoC microcontroller has more than 256 bytes of RAM. PSoC microcontrollers have a system for generation of different frequency signals. which is used for arithmetic operations like addition. . Arithmetic logic unit (ALU) is a standard part of a CPU. which is done by graphically selecting appropriate parameters. as well as logic operations.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 25 Flag register (F) contains bits which describe result of a previously executed instruction. while Carry (C) marks that there has been carrying during arithmetic or logic operations. as well as programmable blocks. subtracting and shifting (left or right). Each of programmable components has certain demands regarding speed.5 FREQUENCY GENERATOR Frequency generator is vital to CPU unit functioning. Bit Flag Zero (Z) marks that accumulator stores a zero. 2.

It is used as a reference clock for most of other signals. SYSCLKx2 is a clock signal with double frequency (48MHz) of SYSCLK signal. with a frequency from 1. 24V1 frequency equals SYSCLK/N1.5MHz (N1=16) to 24MHz (N1=1).IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 26 Fig 2. .4 Frequency generator SYSCLK is the main internal clock signal with a speed of 24MHz. 24V1 is a signal derived by dividing frequency SYSCLK with parameter N1. which varies in range from 1 to 16.

or more precise external 32 kHz oscillator.Fault tolerance of 2. is the limit factor in a precise timing applications. program executes approximately twice faster. Frequency 24V1. On the other hand. 2. CPU_CLK can have any of eight frequencies that are in range from 93. with number N.6 MICROCONTROLLER POWER CONSUMPTION Processor signal frequency CPUCLK is directly connected with the instruction execution speed of the microcontroller.. External frequency ranges from 1 to 24MHz.75MHz to 24MHz. while CLK32K signal is acquired through internal local oscillator (ILO). In such case external SYSCLK clock reference should be used. Main disadvantage in rising the frequency is its unwanted effect on . CLK32K is a slow signal with a frequency of 32 kHz. Signal SYSCLK can be acquired using internal main oscillator (IMO).5% in the case of internal frequency generation.75 kHz (N1. N2=1). which also can be generated by internal local oscillator (ILO). Doubling the frequency. In the both cases microcontroller starts with internal frequency generators. CPU_CLK is used as a CPU unit frequency which has a direct impact on instruction execution speed. by setting appropriate parameters in Device Editor or during program runtime by selecting three lower bits of OSCCR0 register. after which is necessary to satisfy appropriate procedure. as said before.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 27 24V2 is a signal derived by dividing 24MHz frequency with parameter N1. which varies in range between 1 and 16. It connects to PSoC through pin P1 [4]. 24V3 signal is derived by dividing frequency of one of the signals 24V2. 24V2. It can also be used for Sleep timer wake-up operation in the case when other SYSCLK derived signals are inactive. Similar situation is in the case of CLK32K. It can be used as a programmable component input. SYSCLK or SYSCLKx2. 24V1. N2=16) to 24MHz (N1. which means that possible frequency ranges from 93. 24V3 and CPUCLK selection is done easily. in the range from 1 to 256. higher frequency doesn’t necessary always mean better overall performances. 24V2 signal frequency equals SYSCLK/N1N2.

Default value of PSoC microcontroller signal frequency is 3MHz. which may affect on surrounding devices. It is very dangerous if voltage drops beneath certain limit.5 CPU active and sleep states 2. . Fig 2. Other disadvantage of higher frequency is more intensive generation of electromagnetic interference. XRES External reset allows user to bring microcontroller to start state by switching a button. which is one of the main problems it the case of battery supply.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 28 microcontroller power consumption. Because of these problems general rule should be applied. supply voltage variations occur. because microcontroller can make some unpredictable actions. Simplest reset circuit can be made with pulldown resistor and one switch. microcontroller is switched into Power on Reset mode in which it remains until voltage stabilizes above critical limit which is defined by Trip Voltage parameter. In the case of such voltage drop detection.7 RESET POR During the work of microcontroller. which says that lowest possible satisfactory frequency should be used. which is a compromise between speed and consumption. Reset is achieved when XRES pin reads logic ONE.

PRT4DR or PRT5DR. 2. But. after which appropriate subprograms are executed. write and read operations are done in the same way in any case. it is watch dog timer (WDT) is periodically restarted inside of a main program. PRT3DR. Although port number differs from the type of the microcontroller.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 29 Fig 2. In normal mode after certain time WDT is being restarted once again and subprogram cycle continues. bringing the system in the start state. Using WDR. PRT2DR. and WDR occurs. . Port access registers are stored inside of register address space noted as PRT0DR. Eight pin groups which could be accessed simultaneously are parts of one port. if program blocks in one of the subprograms WDT is not reset.8 DIGITAL INPUTS AND OUTPUTS Connection between a PSoC microcontroller with an outside world is achieved over input-output pins. PRT1DR.6 XRES WDR Watch dog reset (WDR) is used for avoiding software dead-loops or other irregularities.

over pull-up or pulldown resistors or through open drain output. Beside that.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 30 Fig 2.7 Port operation Writing to port Writing value to PRTxDR initializes register which through init circuit drives the state of pins. read value could differ from voltage on PRTxDR register. there is a possibility to isolate value of register from pin state (Hi-Z). In case that voltage is dictated by some external device. . Init circuit can pass the signal from PRTxDR register directly (strong). Reading port Reading value from address PRTxDR digital state of voltage on pins is stored to register A.

PRTxDM1 and PRTxDM0. DM2 bit 0 0 0 0 1 1 1 1 DM1 bit 0 0 1 1 0 0 1 1 DM0 bit 0 1 0 1 0 1 0 1 Mode Resistive Pull Down Strong Drive High Impedance Resistive Pull Up Open Drain. Pin work modes are defined according to the following table depending on contents of appropriate bit from registers DM2. This way of connection is applied when pin is used as an input. Fig 2. which enables connection to different types of devices. Drives Low Data = 0 Resistive Strong Hi-Z Strong Hi-Z Strong (Slow) Hi-Z Strong (Slow) Data = 1 Strong Strong Hi-Z Resistive Strong (Slow) Strong (Slow) Hi-Z Hi-Z Table-2 Pin work modes Strong mode is used when it is needed to connect the state on PRTxDR register directly to pins. DM1 and DM0.8 Strong mode input to port pins .IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 31 Drive Mode Selection of the way in which init register PRTxDR is connected to pins can be set inside of Device Editor or during runtime initializing registers PRTxDM2. There is eight methods to initialize pins in total. with considerate smaller amount of external components. Drives High Slow Strong Drive High Impedance Analog Open Drain.

when signal changes. For example. This mode is convenient for realization of a line which signals if there has been a mistake to one of the microcontrollers.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 32 Analog Hi-Z mode is used when connecting analog signals.10 Open drain input to port pins . These resistors are defining the state on input when button is not pushed.9 Analog high-z input to port pins Pull-up or pull-down resistors are used when connecting with buttons or some other devices which demand this type of components. or on signal rising or falling edge. Pins on PSoC microcontroller allow user to generate interrupt on any pin. Fig 2. Fig 2. so not to interfere with value of brought voltage. when used pull-up resistor version when zero (error) occurs on any of output pins state of this line will be zero. when it is needed to add one external pull-up or pull-down resistor. In this case. like AD converter input. Open drain mode is used when it is needed to bring several devices to the same line. all internal connections between PRTxDR register and pin are disconnected.

which are stored inside of programmable blocks.P0[4] and P0[5] pins. which are connected to P0[2]. Pins P2 [4] and P2 [6] can serve as external referent voltage inputs. two or four digital programmable block groups like this one depending on their family. It is done in a way shown on following picture. PSoC microcontrollers can have one.11 Analog IO 2.10 ACCESSING PROGRAMMABLE DIGITAL BLOCKS Digital components. Any pin of port P0 as well as lower four pins of port P2 can be used as analog input. aren’t connected directly to input or output pins. Outputs from analog blocks can be connected to 4 output buffers. Fig 2. while in case of port P2 they are connected directly to programmable SC blocks. . As it could be seen. which depicts group of four digital programmable blocks. beside their standard use can perform analog input or output operation. Inputs of port P0 are connected to analog blocks over analog multiplexers. pin connection is established using global connection lines.P0[3]. multiplexer and lines of programmable blocks.9 ANALOG INPUTS AND OUTPUTS Some of input-output pins.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 33 2.

IrDA and UART communication. which enables custom hardware adjustment of the system for specific uses.13 Configuring digital blocks The number of necessary blocks which are used for component configuration shown in the table: . counters. Most components. The process of setting and connecting using PSoC Designer is very simple to understand. PRS. Tx. On the other side.11 DIGITAL PROGRAMMABLE BLOCKS Inside of digital programmable blocks user can configure components like timers. CRC generators and devices for SPI. Fig 2. PRS and CRC generators can be stored inside of any free block.12 Digital block 2. communication components like Rx. PWM. UART and SPI can be set on the right side of the programmable blocks.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 34 Fig 2. but at first is necessary to understand the way those components function. like counters.

Timer16. one frequency line. PWMDB16 4 Counter32. PRS8.14 Configuring analog blocks . Fig 2. Depending on family of microcontroller. PWM16. PWMDB8. there could be 1. 2.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 35 Number of blocks Components 1 Counter8. SPIM/SPIS Counter16. 2 IrDARx/IrDATx 3 Counter24. UART. Each column has input multiplexer. output analog and a comparator line. PWM8. Timer32 Table-3 Different digital blocks CRC16. PRS16. Timer24. 2 or 4 analog columns.12 ANALOG PROGRAMMABLE BLOCKS Analog programmable blocks are grouped in columns of three programmable blocks. RX8/TX8. Timer8.

AGND value is selected by user.13 REFERENT VOLTAGE GENERATORS There are three stable voltage generators in PSoC microcontroller: • • • AGND RefH RefLo AGND is ground voltage for analog components. Its operation is based on principle of BOOSTDC/DC converter. Voltage values higher than AGND are considered as positive. beside battery. For SMP to function properly. inductivity and a capacitive. Fig 2.14 SWITCH MODE PUMP In the case of battery supply Switch Mode Pump (SMP) system can be used. which makes possible power supply with 1.5V battery. a diode. so value of analog ground is somewhere in between GND and VDD.15 Analog Voltages 2. . PSoC microcontrollers have one-side power supply. while less is negative.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 36 2. This type of converter gives voltage supply value higher than battery voltage. it is necessary to connect.

16 Switched_Mode_Pump 2.15 MAC MAC unit is a device that implements operation of hardware multiplication of 8-bit signed numbers. Fig2. but all of the work is done by writing to and reading from certain registers. and reading output from 16-bit result from registers MUL_DH and MUL_DL. For execution of these operations there is no special instruction.17 Mac Unit .IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 37 Fig 2. as well as sum of product. Hardware multiplication Multiplication operation is done by writing 8-bit inputs X and Y into registers MUL_X and MUL_Y.

17 INTERRUPT CONTROLLER Interrupts are mechanisms inside of a microcontroller that allow responding to some event immediately after its detection. sending or receiving data Byte level data processing Connected to CPU over interrupts or polling mode. end of AD conversion) or external (character receiving over serial connection.18 Interrupt sequence . Events could be internal (timer overrun.16 I2C CONTROLLER I2C controller implements hardware serial I2C communication. Upon ending of that routine program continues from place in program where interruption took place. When interrupt occurs program execution is interrupted (hence the name) by jumping to part of the program that is called interrupt routine. and in that way minimizes usage of CPU units resources. Fig 2.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 38 2. pin state change). Transfer speed: 50K. 100K and 400K Frequency synching in case of larger number of masters 7or 10-bit addressing of I2C unit 2. Most important operations of I2C controller are: • • • • • • Master or Slave.

Program memory is implemented in FLASH technology.19 Address Space Program memory Program memory is the part of ROM. . Fig 2. which allows simple development time change of the program inside of microcontroller. Program memory size depends on the family of PSoC microcontrollers and is 2. which is used for storing program code.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 39 2. so microcontroller is able to acquire instructions and access data at the same time. 16 and 32 kB.18 ADDRESS SPACE PSoC microcontrollers have three address spaces: • • • ROM RAM registers As in all Harvard architecture processors access to ROM memory is done with special lines. 4. which is written in this part of memory written by programming hardware. 8.

2. which are grouped in two 256 bytes banks. because differences are shown only in addition of new programmable components and some minor improvements. beside stating its name.19 PSOC DESIGNER 2. Version discussed here will be 4.1 Introduction PSoC Designer is program package that leads user through all stages of developing project. memory is organized in 256 byte pages. user apart from 8-bit address must state appropriate page. Access to certain bank is done by using macros M8C_SetBank0 and M8C_SetBank1. Size of RAM. what is needed is to also state the name of the bank in which resides wanted register. When microcontrollers have more than 256 bytes of RAM (series CY8C29xx and CY8C21x34).19. Register Register address space contains registers used for peripheral's global parameters and programmable blocks of a PSoC microcontroller. with stack residing on the last page. which delete or set bit XIO in CPU_F register. To access some register. RAM RAM enables storing of variables and stack which are used during work of microcontroller. is 256 bytes. but this book will still remain competent in case of newer versions. . To access some variable. in most PSoC microcontrollers. With special instruction SSC. as well as for calibration of components. PSoC microcontrollers have 512 registers.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 40 Supervisory ROM Supervisory ROM is part of ROM which is used during start of PSoC microcontroller. 2. it is possible access this part of memory.

Fig 2. After group selection. or right-click on select. appropriate graphical symbol would be shown in selected components slot.20 Device editor . necessary component for project should be selected with double-click. amplifiers. etc.19. In the case of successful selection.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 41 The most important for user is to get familiar with two main parts of PSoC Designer: • • Device Editor Application Editor 2. Components sorted in several groups. like AD converters. counters.2 Programmable Component Selection Most important part of the programmable component selection window is placed on the left side. analog communications.

19.22 Inter connect view .21 resource meter 2. and until appropriate parameters are set. For example. This important part of work can be done in Interconnection View window.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 42 The rest of the window offers some other useful information. so it is possible to place 4 counters like this one altogether. Fig 2. 16-bit counter takes two programmable blocks. until they are placed in digital or analog programmable blocks.3 Interconnection View Previously selected components are still unusable. Resource Meter shows how much space is left for new programmable blocks. Fig 2.

5 Component Parameters Central window on the left side is designated as User Module Parameters. Click on any of the parameters opens pull-down menu with given options. Also. Table-4 Global parameters 2. Such parameters are component specific. but with more versatility. .4 Global Parameters On the upper left side can be found Global Resources window. It is used for general parameters selection.19. so it is required to set the way of their operation.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 43 2.19. connecting it with some other blocks and internal connection lines. Peripherals in PSoC microcontroller are very flexible. component specific parameters can be set. This method of setting is similar to configuration words on other microcontrollers. Typically this is done by selecting frequency of the signal.

Digital blocks are grouped in two entireties of four blocks. Pin drive mode selection can be done graphically by selecting appropriate parameters in column Drive or software by setting appropriate registers. . default pin state of PSoC microcontrollers is Analog Hi-Z. as shown on picture. in which microcontroller cannot change pin states.6 Pin Parameters Lower left side holds pin parameter options.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 44 Table-5 Component parameters 2.7 Digital Components Interconnection For start. the most important thing is to get to know the basic elements of programmable blocks.19.19. In order to protect external devices from unexpected signals. Table-6 Pin parameters 2.

24 Interconnection of analog blocks .8 Analog Components Interconnection Analog blocks are placed on lower side of the graphic part of the window.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 45 Fig 2. In every of columns.23 Interconnection of digital blocks 2. while lower two are used for AD and DA convertors. Fig 2. by connecting frequency signal.19. Routing is done graphically. upper block ACB is used for analog amplifiers realization. and input signal to the same analog column. Four analog columns and several multiplexers can be noticed.

25 Application editor window . Most important file for users is called main. Fig 2.19. Left side window holds list of files that are contained in current project. . Application Editor itself.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 46 2. bears much resemblance to IDE-s of other standard 8-bit microcontrollers. which can be done using assembly or C.9 Application Editor Application Editor is used for writing programs.

IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 47 PSOC USER MODULE BLOCKS 3. Thus instead of having a microcontroller portfolio that probably reads: 4 ADCs. can become a filter or an ADC or even a comparator. PSoC is a family of mixed-signal arrays made by Cypress Semiconductor that integrate a microcontroller and the components that typically surround it into a single package. after the smoke causes a reduction in voltage output from the ionization chamber. A microcontroller will need to have both. among many possibilities. the PSoC is built around the concept of doing exactly that. an ADC and a PWM to allow the smoke detector to scream at the appropriate time. Cypress Semiconductor makes PSoCs ranging from 16 digital and 12 analog blocks down to some only four of each type. Also. The PSoC architecture includes configurable blocks of analog circuits and digital logic. While. 3 timers.. The PSoC’s feature of using the same hardware to realize different modules provides it with the ability of Dynamic Reconfiguration. 2 DACs etc. a certain set of modules are used only . For example in the case of a smoke detector. the idea of changing the ADC block to become a PWM block is equivalent to alchemy for a microcontroller. various features present on the microcontroller are seldom or never used. as well as a programmable interconnect that allows the user to create customized peripheral configuration to match the requirements of each individual application. a digital block can either be a timer. For instance. In some other designs.1 WHAT ARE USER MODULES? Over the years. a microcontroller might be using an ADC to monitor the ionization chamber but resources like timers and communication interfaces are not being used. the microcontroller does not need to use the ADC resource anymore but instead requires a PWM output to the speaker system to issue an alarm. microcontrollers have become highly integrated and have begun to offer a large portfolio of peripherals. in the event of a fire. User modules are an abstraction of register settings that enable a high level function. Each of the blocks is controlled by a set of latch-based registers. a PWM source or even a UART module. but is only using one or the other and wasting many more. Similarly an analog block. the PSoC needs to only list the number of analog and digital blocks. among the many available options. In many implementations.

Finally. different versions of counters. Some of the important user modules that are present in the PSoC are different types of ADC. digital to analog converters. .pulse width modulators. the modules responsible for charging the battery take the shape of modules that deliver the right amount of current to the LEDs. using the character graphics feature of these LCD modules. A controller residing in a portable weather station can use different types of modules but yet the same blocks to measure temperature. 3.different versions of amplifiers. internal temperature sensor. The controller in an emergency lighting system needs modules to run routines to charge the battery.or four-line LCD module.multiplexers.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 48 when an exception occurs. there can be situations where all modules are required for routine performance of the device. while constantly monitoring to see if a power failure occurred.filters. Once the power failure does occur. Vertical and horizontal bar graphs are supported. timers. wind speed and amount of rain. humidity. This library uses the 4-bit interface mode to limit the number of I/O pins required.2 LCD Features and Overview • • • • • • Uses the industry standard Hitachi HD44780 LCD display driver chip protocol Requires only seven I/O pins Routines provided to print RAM or ROM strings Routines provided to print numbers Routines provided to display horizontal and vertical bar graphs Uses a single I/O port The LCD Tool Box User Module is a set of library routines that writes text strings and formatted numbers to a common two.

Table-7 LCD to PSOC interconnect . register select "RS. read/write (R/W).1 LCD to PSOC block diagram Functional Description The LCD User Module uses a single I/O port to interface to an industry standard Hitachi HD44780A LCD controller." and an enable "E" signal.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 49 Fig 3. This type of display has a simple interface consisting of 8 data bits.

For a two-line by 16 character display.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 50 A cursor position function places the cursor at any location. Assembly: Call LCD_Start LCD_Position Description: Moves cursor to a location specified by the parameters.0) and the lower right corner is position (1. The upper left character is row 0. This function should be called prior to all other LCD functions. C Prototype: void LCD_Start (void). the lower right character is row 1. If disabled. the upper left corner is position (0. This section specifies the interface to each function together with related constants provided by the "include" files. the bargraph code is not generated. column 15. The following are the API programming routines provided for the LCD User Module: Basic LCD Tool Box Functions LCD_Start Description: Initializes LCD to use the multi-line 4-bit interface. saving ROM space.15). Parameters and Resources LCDPort Selects which PSoC I/O port is used to interface to the LCD display module. . Application Programming Interface The Application Programming Interface (API) routines are provided as part of the user module to allow the designer to deal with the module at a higher level. For two-line by 16 character displays. column 0. Bargraph Selects whether the bargraph functions are enabled.

BYTE bCol). Call function to display string at current. . terminated string. Parameters: sRamString: A pointer to a null-terminated string located in RAM. LCD_PrCString Description: Prints a null terminated ROM-based character string to the LCD at the present cursor location. Load Column Call LCD_Position Parameters: bRow: The row number at which to position the cursor. Zero specifies the first row. bCol: The column number at which to position the cursor. C Prototype: Void LCD_PrString (CHAR * sRamString). 02h. 01h. Load LSB part of pointer to RAM-based null . Load Row Mov X. Load MSB part of pointer to RAM-based null. LCD_PrString Description: Prints a null terminated RAM-based character string to the LCD at the present cursor location. Mov X. Assembly: Mov A. Assembly: Mov A. Zero specifies the first (left most) column.>sRamString.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 51 C Prototype: void LCD_Position (BYTE bRow.<sRamString . LCD cursor position. Call LCD_PrString. terminated string.

Call function to display string at current . // Position cursor @ row 0. call LCD_PrCString . Load LSB part of pointer to ROM-based null . terminated string.>sRomString . mov X. 2). Load MSB part of pointer to ROM-based null . col 4 LCD_PrCString ("PsoC LCD").2 LCD .<sRomString .IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 52 C Prototype: void LCD_PrCString(const char * sRomString). // Print a constant "ROM" string LCD_Position (1. LCD cursor position. col 2 LCD_PrString (str). Assembly: mov A. terminated string. // Define "RAM" based string LCD_Start (). 4). Example String Printing Code Char str [ ] = "User Module". Fig 3. // Initialize LCD hardware LCD_Position (0. // Position cursor @ row 1. // Print "RAM" based string.

and stop bits •RS-232 serial-data compliant format with even. It uses the Buffer.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 53 3. read status. optional parity. stop.3 Tx8 user module Functional Description The TX8 User Module implements a serial transmitter. or no parity •Optional interrupt on transmit buffer empty condition The TX8 User Module is an 8-bit RS-232 data-format compliant serial transmitter with programmable clocking and selectable interrupt or polling style operation. Shift. and a stop bit. The Control register is initialized and configured.3 TX8 USER MODULE Features and Overview •8-bit serial transmitter with selectable clocking to 48 MHz. Fig 3. yielding maximum 6 Mbit data rate •Data framing consists of start. an optional parity bit. and write data to the TX8. The data transmitted is framed with a leading start bit. using the TX8 User Module firmware Application Programming Interface (API) . odd. and Control registers of a digital communications type PSoC block. Transmitter firmware is used to initialize. start.

The Global I/O busses may be used to connect the clock input to an external pin or a clock function generated by a different PSoC block. an optional parity bit. or another PSoC block output can be specified as the TX8 clock input. so that upon completion of transmission of the current data byte. Parameters and Resources Clock TX8 is clocked by one of 16 possible sources. the CPU_32 kHz clock. The 48 MHz clock. an interrupt will betriggered. The clock rate must be set to eight times the desired bit transmit rate.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 54 routines. This bit will remain valid until read. Successive bit clocks shift a serial bit stream to the output. If a new data byte has been written to the Buffer register. . When the Enable bit in the Control register is set. The rising edge of the next bit clock transfers the data to the Shift register and sets the Buffer Empty bit of the Control register. and a final stop bit. One data bit is transmitted out every 10 input clocks. Upon completion of transmission of the stop bit. 24V1 or 24V2. the Control register's Tx Complete status bit is set. the data byte will be transferred to the Shift register and transmission of the data will begin on the next rising edge of the bit clock. If the interrupt enable mask is enabled. the new byte will be transmitted on the next available transmit clock. This interrupt enables the queuing of the next byte to transmit. clearing the Buffer Empty status bit in the Control register. This parameter is set using the Device Editor in PSoC Designer. A data byte to transmit is written by an API routine into the Buffer register. The start bit is transmitted at the same time that the data byte is transferred from the Buffer register to the Shift register. least significant bit first. one of the divided clocks. an internal divide-by-eight bit clock is generated. This status bit can be used to detect and prevent transmit overrun errors. The stream is composed of each bit of the data byte.

TX Interrupt Mode This option determines when an interrupt will be generated for the TX block Clock Sync In the PSoC devices. This introduces skew with respect to the system clocks. This clock is active only during the data bits of the transmit and will be held high all other times. Digital clock sources may even be chained in ripple fashion. The rising edge of the clock corresponds to the time when the data is stable and should be sampled. The Global Output Bus can then be connected to an external pin or to another PSoC block for further processing. . The Data Clock Out signal can be used to facilitate data checking functions such as Cyclical Redundancy Checks. digital blocks may provide clock sources in addition to the system clocks. Table-8 Clock sync values and their uses Data Clock Out The Data Clock Out signal is a clock signal that corresponds to the Clock input divided by 8.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 55 Output The output of the transmitter can be routed to the Global Output Bus.

Placement The TX8 User Module uses a single block block. Properly selecting whether an Interrupt API is to be generated is recommended particularly with projects that have multiple overlays where a single block resource is used by the different overlays. Interrupt API The Interrupt API parameter allows conditional generation of a User Module’s interrupt handler and interrupts vector table entry. Select "Disable" to bypass the generation of the interrupt handler and interrupt vector table entry.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 56 Interrupt Generation Control The following two parameters Interrupt API and Int Dispatch Mode are only accessible by setting the Enable Interrupt Generation Control check box in PSoC Designer.. . thereby reducing overhead. > Device Editor. which can map freely onto any of the Digital Communication PSoC blocks. Application Programming Interface The Application Programming Interface (API) routines are provided as part of the user module to allow the designer to deal with the module at a higher level.. This section specifies the interface to each function together with related constants provided by the "include" files. By selecting Interrupt API generation only when it is necessary the need to generate an interrupt dispatch code might be eliminated. designated "TX". Select "Enable" to generate the interrupt handler and interrupt vector table entry. This is available under Project > Settings. If the Receive Command Buffer is to be used then the Interrupt API parameter should be set to "Enable".



the wiring. A 1-Wire master may communicate with one or many slave devices using only one signal wire and a ground. The 1-Wire specification allows an unlimited amount of time between bits. The I/O pin is configured to provide the resistive pull-up. A CPU clock of 12 MHz is needed for correct timing. Both master and slave devices are open drain. The CPU is 100% utilized during data transfers. A 1-Wire network consists of a master. . However.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 59 3. Features and Benefits       Requires only one I/O pin to interface multiple slave devices Uses no PSoC Blocks Functions provided support reading and writing of both bits and bytes Function provided for CRC-8 data integrity checking Optional CRC-16 function for iButton data integrity checking Optional functions provided for performing 1-Wire search for handling multiple devices Functional Description The 1-Wire User Module uses a single I/O pin to interface to 1-Wire components over twistedpair cable. and one or more slave devices. the bit and byte transfer functions do not alter the interrupt masks.4 ONE WIRE SOFTWARE USER MODULE The 1-Wire Master User Module is a set of library routines that write and read data as master using the Dallas Semiconductor 1-Wire protocol. The master initiates all data transfers.

6 PSOC to 1-wire schematic Parameters and Resources DQ IO Port Selects which PSoC I/O port is used for the 1-Wire DQ signal below.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 60 1-Wire System 1-Wire Data GND 1-Wire Master 1-Wire Slave 1 1-Wire Slave 2 1-Wire Slave 3 Fig 3. . DQ Pin Selects which pin of DQIOPort is used for the 1-Wire interface. the search code is not generated to save ROM space. the “OW” is used for the INSTANCE_NAME. Placement and Resources The 1-Wire User Module only uses one I/O pin of one port and does not use any digital or analog blocks. There are no placement restrictions. If disabled. This function should be called once before the other 1-Wire functions. OW_Start Description: Initializes OW I/O pin to have a resistive pull-up. Application Programming Interface In all examples. Search Selects whether the 1-Wire search functions are enabled.

Call function Assembler: mov call Parameters: bData: Byte to be written to the 1-Wire devices. OW_ReadByte Description: Reads a byte from a 1-Wire device. C Prototype: void OW_WriteByte (BYTE bData). . A. Byte returned in A Sample Firmware Source Code //---------------------------------------------------------------------------// C main line //---------------------------------------------------------------------------#include <m8c. C Prototype: BYTE OW_ReadByte (void).h> // part specific constants and macros .IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 61 C Prototype: Void OW_Start (void). CCh OW_WriteByte . Assembler: call OW_Start OW_Write Byte Description: Writes a byte to the 1-Wire devices. Load byte Assembler: call OW_ReadByte .

// Skip ROM command. // Wait 900 ms for the temperature conversion. // Convert Temperature command. OneWireSW_1_Start (). // Reset the 1-Wire device. LCD_1_Position(0. OneWireSW_1_WriteByte (0xBE).h> char TextBuff [5]. // PSoC API definitions for all User Modules Unsigned char TLSB.h" #include <stdlib. OneWireSW_1_WriteByte (0xCC). //OW_1_Start (). . // Read Scratch Pad command.0). OneWireSW_1_Delay10mTimes (90).IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 62 #include "PSoCAPI. // Skip ROM command. OneWireSW_1_WriteByte (0x44). TempI. while(1) { OneWireSW_1_Reset (). j. void main () { LCD_1_Start (). OneWireSW_1_WriteByte (0xCC). TMSB. OneWireSW_1_Reset (). // Initialize 1-Wire pin. int TempP. // Reset the 1-Wire device.

iota (TextBuff.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 63 TLSB = OneWireSW_1_ReadByte (). // Convert data to decimal point for display. else LCD_1_PrCString (". } } .0"). TempP = (TMSB << 4) &0xF0. TMSB = OneWireSW_1_ReadByte (). if (TempP < 1000) LCD_1_PrCString (". TempP = (TempP & 0x000f)* 625. 10). // Temperature in integer format TempP = TLSB & 0x0F. iota (TextBuff. TempP."). LCD_1_PrString (TextBuff). LCD_1_PrCString ("TEMP = "). 0).10). // Display decimal point. TempI = (TLSB >> 4) & 0x0F. LCD_1_PrString (TextBuff). // Convert data to ASCII. TempI. TempI = TempI | TempP. // Read LSB data. // Binary point of temperature. LCD_1_Position (1. // Integer number. // Read MSB data. LCD_1_PrCString (" C ").




4.1 All about GSM
Global System for Mobile Communications GSM is a digital wireless network standard designed by standardization committees from major European telecommunications operators and manufacturers. The GSM standard provides a common set of compatible services and capabilities to all mobile users across Europe and several million customers worldwide. The basic requirements of GSM have been described in five aspects.

The system shall provide service portability, i.e., mobile stations or mobile phones can be used in all participating countries. The system shall offer services that exist in the wire line network as well as services specific to mobile communications. In addition to vehicle- mounted stations, the system shall provide service to Mss used by pedestrians and /or on board ships.

Quality of Services and Security
The quality for voice telephony of GSM shall beat least as good as the previous analog systems over the practical operating range. The system shall be capable of offering information encryption without significantly affecting the costs to users who do not require such facility.

Radio Frequency Utilization
The system shall permit a high level of spectrum efficiency and state-of-the-art subscriber facilities. The system shall be capable of operating in the entire allocated frequency band, and coexist with the earlier systems in the same frequency band.



The identification and numbering plans shall be based on relevant ITU recommendations. An international standardized signaling system shall be used for switching and mobility management. The existing fixed public networks should not be significantly modified.

The system parameters shall be chosen with a view to limiting the cost of the complete system, in particular the Mss.

4.1.1 GSM Architecture
In this architecture, a mobile station (MS) communicates with a base station system (BSS) through the radio interface. The BSS is connected to the network and switching subsystem (NSS) by communicating with a mobile switching center (MSC) using the A interface.

Mobile Station
The (MS) consists of two parts: the subscriber identity module (SIM) and the mobile equipment (ME). In a border definition, the MS also includes a third part called terminal equipment (TE), which can be a PDA or Pc connected to the ME. In this case, the first two parts i.e., ME and SIM are called the mobile terminal (MT). A SIM can be    A smart card that usually has the size of a credit card. A smaller sized “plug-in SIM". A smart card that can be performed, which contains a plug-in SIM that can be broken out of it. The SIM is protected by a personal identity number (PIN) of length between four to eight digits. The PIN is loaded by the network operator at the subscription time. This PIN can be deactivated or changed by the user. To use the MS, the user is asked to enter the PIN. If the number is not correctly entered in three consecutive times, the SIM is blocked and therefore the MS cannot be



used. To unblock the SIM, the user is asked to enter the 8-digit PIN Unblocking Key (PUK). A SIM contains the subscriber-related information including the PIN and PUK codes. The subscriber- related data also include a list of abbreviated and customized dialing numbers, short messages received when the subscriber is not present, and names of preferred network stop provide service, and soon. Parts of the SIM information can be modified by the subscriber either by using the keypad of an MS or a personal computer using an RS232 connection.

4.1.2 GSM Modem Introduction SIM300

Fig 4.1 EVB top view

Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS 1900 MHz. SIM300 features GPRS multi-slot class 10/ class 8 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4.With a

such as smart phone. such as keypad port. PDA phone and other mobile devices. main and debug serial port. display port I: MAIN serial port for downloading. data exchanging J: DEBUG serial port K: hole for fixing the antenna L: source adapter interface M: light N: buzzer O: headphones interface P: hole for fixing the SIM300 . switch the voltage source from the adaptor or external battery F: PWRKEY key. turn on or off download function E: VBAT switch.0V SIM Tray Antenna with LED indications. AT command transmitting. A: SIM300 module interface B: SIM card interface C: headset interface D: Download switch. SIM300 can fit almost all the space requirements in our applications. In this hardware SIM300 is only interfaced with RS232.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 68 tiny configuration of 40mm x 33mm x 2. turn on or turn off SIM300 G: RESET key H: expand port. Regulated power Supply 4.85mm .

. A command line has a prefix.2 SIM card interface 4. a body. Missing decimal parameters are evaluated as 0.. or single characters proceeded by a prefix character (e. Characters within the command line are parsed as commands with associated parameter values. “&” or “+”). The command line interpretation begins upon receipt of the ENTER key character. Commands entered in upper case or lower cases are accepted.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 69 Fig: 4.2 AT COMMANDS AT Command Format A command line is a string of characters sent from a DTE to the modem (DCE) while the modem is in a command state. Each command line (with the exception of the A/ command) must begin with the character sequence AT and must be terminated by a carriage return. . “AT or “at.g. i. and a terminator. The basic commands consist of single ASCII characters. but both the A and T must be of the same case. The default terminator is the ENTER key <CR> character. followed by a decimal parameter.e. Characters that precede the AT prefix are ignored.

. Software flow control (XON/XOFF flow control) Software flow control sends different characters to stop (XOFF. Hyper terminal or Win Fax Pro) uses software flow control. the sending device is transferring data faster than the receiving side is ready to accept.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 70 Flow control Flow control is very important for correct communication between the GSM engine and DTE. AT+IFC=1. When the receiving buffer reaches its capacity. When the receiving buffer is ok to receive more data. When the data transfer should be suspended.g. For in the case such as a data or fax call. the CTS line is set inactive until the transfer from the receiving buffer has completed. for use after restart. to enable software flow control in the DTE interface and within GSM engine. Ensure that any communications software package (e. 1 This setting is stored volatile. Hardware flow control (RTS/CTS flow control) Hardware flow control achieves the data flow control by controlling the RTS/CTS line. the receiving device should be capable to cause the sending device to pause until it catches up. ensure that the RTS/CTS lines are present on your application platform. The default flow control approach of SIM300 is hardware flow control (RTS/CTS flow control). It is quite useful in some applications that only use three wires on the serial interface. To achieve hardware flow control. 1 should be stored to the user profile with AT&W. CTS goes active once again. type the following AT command: AT+IFC=1. decimal 19) and resume (XON. ProComm Plus. decimal 17) data flow.




Thus. equipment. The DS18S20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. In addition.6 DS18S20 Block diagram .5°C over the range of –10°C to +85°C. eliminating the need for an external power supply. It has an operating temperature range of –55°C to +125°C and is accurate to ±0. which allows multiple DS18S20s to function on the same 1-Wire bus. it is simple to use one microprocessor to control many DS18S20s distributed over a large area. Fig 4. or machinery. the DS18S20 can derive power directly from the data line (“parasite power”).IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 74 Description The DS18S20 digital thermometer provides 9-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. and process monitoring and control systems. temperature monitoring systems inside buildings. Applications that can benefit from this feature include HVAC environmental controls. Each DS18S20 has a unique 64-bit serial code.

The DS18S20 uses Maxim’s exclusive 1-Wire bus protocol that implements bus communication using one control signal. the scratchpad provides access to the 1-byte upper and lower alarm trigger registers (TH and TL). If the DS18S20 . the resulting thermal data is stored in the 2-byte temperature register in the scratchpad memory and the DS18S20 returns to its idle state. the number of devices that can be addressed on one bus is virtually unlimited. so they will retain data when the device is powered down. OPERATION—MEASURING TEMPERATURE The core functionality of the DS18S20 is its direct-to-digital temperature sensor. including detailed explanations of the commands and “time slots.” is covered in the 1-Wire Bus System section.” As an alternative. the microprocessor (the master device) identifies and addresses devices on the bus using each device’s unique 64-bit code. The 1-Wire bus protocol. to initiate a temperature measurement and A-to-D conversion. Because each device has a unique code.5°C steps. the DS18S20 may also be powered by an external supply on VDD. which corresponds to 0. The TH and TL registers are nonvolatile (EEPROM). The temperature sensor output has 9-bit resolution. The 64-bit ROM stores the device’s unique serial code. The scratchpad memory contains the 2byte temperature register that stores the digital output from the temperature sensor. which then supplies power to the device when the bus is low. This method of deriving power from the 1-Wire bus is referred to as “parasite power. and pin descriptions are given in the Pin Description table. In this bus system. Following the conversion.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 75 OVERVIEW A block diagram of the DS18S20. The DS18S20 powers-up in a low-power idle state. Power is instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. the master must issue a Convert T [44h] command. The high bus signal also charges an internal capacitor (CPP). Another feature of the DS18S20 is the ability to operate without an external power supply. In addition. The control line requires a weak pullup resistor since all devices are linked to the bus via a 3-state or open-drain port (the DQ pin in the case of the DS18S20).

The temperature data is stored as a 16-bit signextended two’s complement number in the temperature register. the master can issue “read-time slots” (see the 1-Wire Bus System section) after the Convert T command and the DS18S20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done. this notification technique cannot be used since the bus must be pulled high by a strong pullup during the entire temperature conversion. After reading the scratchpad.5°C bit (bit 0) from the temperature data. The extended resolution temperature can then be calculated using the following equation: SOURCE CODE 5. The DS18S20 output data is calibrated in degrees centigrade. Resolutions greater than 9 bits can be calculated using the data from the temperature. for Fahrenheit applications.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 76 is powered by an external supply. If the DS18S20 is powered with parasite power. COUNT REMAIN and COUNT PER °C registers in the scratchpad. The sign bits (S) indicate if the temperature is positive or negative: for positive numbers S = 0 and for negative numbers S = 1. the TEMP_READ value is obtained by truncating the 0. Note that the COUNT PER °C register is hard-wired to 16 (10h). a lookup table or conversion routine must be used. CONCLUSION . The bus requirements for parasite power are explained in detail in the Powering the DS18S20 section.

IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 77 Critical sensor monitoring. The GSM network used helps in controlling the system from a distant area. The one wire protocol used for the temperature sensor helps for sensing temperature over a large area. 6. inverting and non inverting amplifiers. FUTURE SCOPE The future scope includes connecting the different control systems to relays for controlling the environment. The microcontroller used helps in interfacing many input/output devices at a time. The PSoC microcontroller can be used for implementation of more complex systems for complex tasks like controlling different systems like nuclear plants and reactors in the industry. authentication is commanding the system and wireless network are the challenges faced by the industries such as nuclear plants and power plants. As the user operates the system by a secret code the authorization problem has been solved. It can also be used in the system where there is a need of instrumentational. . .W. book review by Kostas Pentikousis WEBSITES Design and Implementation of Home Automation System 3. 6. www. www. 2000 3) The C programming language. www.jsp?arnumber=1362503 Kernighan. BIBLIOGRAPHY 1) Designer's guide to PSoC by Robert Ashby 2) The 8051 Microcontroller and Embedded systems-Mazid and Mazidi.IMPLEMENTATION OF GSM MODEM FOR INDUSTRIAL AUTOMATION APPLICATIONS 78 4. B. Dennis 5. PH/Pearson Education 4) Hand book of Mobile Radio Networks. 2.


Sign up to vote on this title
UsefulNot useful