The project deals with the design and development of hardware and software for eight channel weather monitoring system. A weather monitoring (also data logger or data recorder) is an electronic device that records data over time or in relation to location either with a built in instrument or sensor or by using external instruments and sensors. One of the primary advantages of using these data loggers is the ability to automatically and continuously collect data on a 24-hour basis.
The data which are recorded continuously in this project are Temperature, Intensity. These analog quantities are taken and converted into corresponding digital values using an eight channel ADC. These converted digital values are transmitted from the microcontroller using RF transmitter and an encoder. These same values are received at the receiver end using RF receiver and a decoder. The RF modules used here are STT-433 MHz Transmitter, STR-433 MHz Receiver, HT640 RF Encoder and HT648 RF Decoder. The processed data from ADC is sent to microcontroller. The microcontroller passes this data to the RF transmitter through RF Encoder. The encoder continuously receives the data from the microcontroller, passes the data to the RF transmitter and the transmitter transmits the data. The encoder encodes the 8-bit data into a single data and then presents it to RF transmitter. At the receiving end, the RF receiver receives this data, gives it to RF decoder. This decoder converts the single bit data into 8-bit data and presents it to the microcontroller. Now, it is the job of the controller to read the data and display the same data on LCD.
CHAPTER 1
1
INTRODUCTION
The project deals with the design and development of hardware and software for eight channel weather monitoring system. A weather monitoring (also data logger or data recorder) is an electronic device that records data over time or in relation to location either with a built in instrument or sensor or by using external instruments and sensors. One of the primary advantages of using these data loggers is the ability to automatically and continuously collect data on a 24-hour basis. The data which are recorded continuously in this project are Temperature, Intensity. These analog quantities are taken and converted into corresponding digital values using an eight channel ADC. These converted digital values are transmitted from the microcontroller using RF transmitter and an encoder. These same values are received at the receiver end using RF receiver and a decoder. The RF modules used here are STT-433 MHz Transmitter, STR-433 MHz Receiver, HT640 RF Encoder and HT648 RF Decoder. The processed data from ADC is sent to microcontroller. The microcontroller passes this data to the RF transmitter through RF Encoder. The encoder continuously receives the data from the microcontroller, passes the data to the RF transmitter and the transmitter transmits the data. The encoder encodes the 8-bit data into a single data and then presents it to RF transmitter. At the receiving end, the RF receiver receives this data, gives it to RF decoder. This decoder converts the single bit data into 8-bit data and presents it to the microcontroller. Now, it is the job of the controller to read the data and display the same data on LCD.
CHAPTER2
EMBEDDED SYSTEMS
2
An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below:
Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low.
air-conditioner, VCO player, video game consoles, video recorders etc. Todays high-tech car has about 20 embedded systems for transmission control, engine spark control, airconditioning, navigation etc. Even wristwatches are now becoming embedded systems.
2.1.2Office automation
The office automation products using em embedded systems are copying machine, fax machine, key telephone, modem, printer, scanner etc.
2.1.3Industrial automation
Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station.
2.1.4Medical electronics
Almost every medical equipment in the hospital is an embedded system. These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners; equipment used in blood analysis, radiation, colonoscopy, endoscopy etc. Developments in medical electronics have paved way for more accurate diagnosis of diseases.
example, a router interconnects two networks. The two networks may be running different protocol stacks. The routers function is to obtain the data packets from incoming pores, analyze the packets and send them towards the destination after doing necessary protocol conversion. Most networking equipments, other than the end systems (desktop computers) we use to access the networks, are embedded systems
2.1.6 Telecommunications
In the field of telecommunications, the embedded systems can be categorized as subscriber terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice communication over the Internet.
Every embedded system consists of custom-built hardware built around a Central Processing Unit (CPU). This hardware also contains memory chips onto which the
Fig2.2 (a): layered Architecture of Embedded system Software is loaded. The software residing on the memory chip is also called the firm ware The embedded system architecture can be represented as a layered architecture as shown in Fig. The operating system runs above the hardware, and the application software runs above the operating system. The same architecture is applicable to any computer including a desktop computer. However, there are significant differences. It is not compulsory to have an operating system in every embedded system. For small appliances such as remote control units, air conditioners, toys etc., there is no need for an operating system and you can write only the software specific to that application. Once the software is transferred
to the memory chip, the software will continue to run for a long time you dont need to reload new software. Now, let us see the details of the various building blocks of the hardware of an embedded system. As shown in Fig. the building blocks are; Central Processing Unit (CPU) Memory (Read-only Memory and Random Access Memory) Input Devices Output devices Communication interface Application-specific circuitry Fig2.2 (b): building blocks of the hardware of an embedded system
The Central Processing Unit (processor, in short) can be any of the following: microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor. Its main attraction is that on the chip itself, there will be many other components such as memory, serial communication interface, analog-to digital converter etc. So, for small applications, a micro-controller is the best choice as the number of external components required will be very less. On the other hand, microprocessors are more powerful, but you need to use many external components with them. D5P is used mainly for applications in which signal processing is involved such as audio and video processing.
2.2.2 Memory
The memory is categorized as Random Access 11emory (RAM) and Read Only Memory (ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas ROM retains the contents even if the power is switched off. So, the firmware is stored in the ROM. When power is switched on, the processor reads the ROM; the program is program is executed.
Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be used to display some important parameters.
2.2.5Communication interfaces
The embedded systems may need to, interact with other embedded systems at they may have to transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc.
CHAPTER 3
This chapter briefly explains about the Hardware Implementation of the project. It discusses the design and working of the design with the help of block diagram and circuit diagram and explanation of circuit diagram in detail. It explains the features, timer programming, serial communication, interrupts of AT89S52 microcontroller. It also explains the various modules used in this project.
Hardware implementation deals in drawing the schematic on the plane paper according to the application, testing the schematic design over the breadboard using the various ICs to find if the design meets the objective, carrying out the PCB layout of the schematic tested on breadboard, finally preparing the board and testing the designed hardware. The firmware part deals in programming the microcontroller so that it can control the operation of the ICs used in the implementation. In the present work, we have used the Orcad design software for PCB circuit design, the Keil v3 software development tool to write and compile the source code, which has been written in the C language. The Proload programmer has been used to write this compile code into the microcontroller. The firmware implementation is explained in the next chapter. The project design and principle are explained in this chapter using the block diagram and circuit diagram. The block diagram discusses about the required components of the design and working condition is explained using circuit diagram and system wiring diagram.
10
Based on the Processor side Embedded Systems is mainly divided into 3 types
1. Micro Processor : - are for general purpose eg: our personal computer 2. Micro Controller:- are for specific applications, because of cheaper cost we will go
for these
3. DSP (Digital Signal Processor):- are for high and sensitive application purpose 3.3 MICROCONTROLLER VERSUS MICROPROCESSOR
A system designer using a general-purpose microprocessor such as the Pentium or the 68040 must add RAM, ROM, I/O ports, and timers externally to make them functional. Although the addition of external RAM, ROM, and I/O ports makes these systems bulkier and much more expensive, A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM, I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add any external memory, I/O ports, or timer to it.
11
Fifffffffff
MICRO CONTROLLER: is a chip through which we can connect many other devices and also those are controlled by the program the program which burn into that chip
13
Transmitter section
14
Receiver section
15
3.4.3 Rectifier
16
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification.
3.4.4 Filter
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.
3.4.6 Microcontrollers
The Intel 8051 is Harvard architecture, single chip microcontroller (C) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8051-compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by th
CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NV-
3.4.8 Description
The AT89S52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable memory. The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry-standard MCS51 instruction set. The on chip flash allows the program memory to be reprogrammed in system or by a conventional non volatile memory programmer. By combining a versatile 8bit CPU with Flash on a monolithic chip, the Atmel AT89s52 is a powerful microcomputer, which provides a highly flexible and cost-effective solution to many embedded control applications. In addition, the AT89S52 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.
19
20
Port 0
Port 0 is an 8-bit open drain bidirectional 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 can 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 1 Port 1 is an 8-bit bidirectional 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. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table.
Table
Port 2
22
Port 2 is an 8-bit bidirectional 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 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, Port 2 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. The port also receives the high-order address bits and some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional 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 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table.
Reset input A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.
PSEN Program Store Enable: (PSEN) is the read strobe to external program memory.
When the AT89S52 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 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.
XTAL1:Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2:
Output from the inverting oscillator amplifier
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
26
3.5.6 UART
The Atmel 8051 Microcontrollers implement three general purpose, 16-bit timers/ counters. They are identified as Timer 0, Timer 1 and Timer 2 and can be independently configured to operate in a variety of modes as a timer or as an event counter. When operating as a timer, the timer/counter runs for a programmed length of time and then issues an interrupt request. A basic operation consists of timer registers THx and TLx (x= 0, 1) connected in cascade to form a 16-bit timer. Setting the run control bit (TRx) in TCON register turns the timer on by allowing the selected input to increment TLx. When TLx overflows it increments THx; when THx overflows it sets the timer overflow flag (TFx) in TCON register. Setting the TRx does not clear the THx and TLx timer registers. Timer registers
27
can be accessed to obtain the current count or to enter preset values. They can be read at any time but TRx bit must be cleared to preset their values, otherwise the behavior of the timer/counter is unpredictable. The C/T control bit (in TCON register) selects timer operation or counter operation, by selecting the divided-down peripheral clock or external pin Tx as the source for the counted signal. TRx bit must be cleared when changing the mode of operation, otherwise the behavior of the timer/counter is unpredictable. For timer operation (C/Tx# = 0), the timer register counts the divided-down peripheral clock. The timer register is incremented once every peripheral cycle (6 peripheral clock periods). The timer clock rate is FPER / 6, i.e. FOSC / 12 in standard mode or FOSC / 6 in X2 mode. For counter operation (C/Tx# = 1), Since it takes 2 cycles (12 peripheral clock periods) to recognize a negative transition, the maximum count rate is FPER / 12, i.e. FOSC / 24 in standard mode or FOSC / 12 in X2 mode. There are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it should be held for at least one full peripheral cycle. In addition to the timer or counter selection, Timer 0 and Timer 1 have four operating modes from which to select which are selected by bitpairs (M1, M0) in TMOD. Modes 0, 1and 2 are the same for both timer/counters. Mode 3 is different. The four operating modes are described below. Timer 2, has three modes of operation: capture, auto-reload and baud rate generator.
28
connected to pins 18 and 19 with stabilizing capacitors. 12 MHz (11.059MHz) crystal is often used and the capacitance ranges from 20pF to 40pF. A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since we know the we can calculate how many instruction cycles the 8051 can execute per second: 11,059,000 / 12 = 921,583 11.0592 MHz crystals are often used because it can be divided to give you exact clock rates for most of the common baud rates for the UART, especially for the higher speeds (9600, 19200).
29
30
Fig3.8.1(a):STT-433 MHz TRANSMITTER 3.8.1.1 FACTORS INFLUENCED TO CHOOSE STT-433MHz ABOUT THE TRANSMITTER The STT-433 is ideal for remote control applications where low cost and longer range is required. The transmitter operates from a1.5-12V supply, making it ideal for battery-powered applications. The transmitter employs a SAW-stabilized oscillator, ensuring accurate frequency control for best range performance. The manufacturing-friendly SIP style package and low-cost make the STT-433 suitable for high volume applications.
3.8.1.2 Features
433.92 MHz Frequency Low Cost
31
GND: Transmitter ground: Connect to ground plane DATA: Digital data input. This input is CMOS compatible and should be driven with
CMOS level inputs.
VCC: Operating voltage for the transmitter. VCC should be bypassed with a .01uF
ceramic capacitor and filtered with a 4.7uF tantalum capacitor. Noise on the power supply will degrade transmitter noise performance.
ANT: 50 ohm antenna output. The antenna port impedance affects output power and
harmonic emissions. Antenna can be single core wire of approximately 17cm length or PCB trace antenna.
3.8.3 APPLICATION
32
PIN DESCRIPTION:
Table (3)
Fig3.8.5 (a): Bock diagram of Transmission circuit The data sent from the microcontroller is encoded and sent to RF transmitter. The
data is transmitted on the antenna pin. Thus, this data should be received on the destination i.e, on RF receiver.
Fig3.8.6 (a): RF RECEIVER STR-433 MHz The data is received by the RF receiver from the antenna pin and this data is available on the datpins . Two Data pins are provided in the receiver module.
35
Fig3.9 (a): flow chart of the decoder work 3.9.1 BASIC APPLICATION CIRCUIT OF HT648L DECODER
37
3.10.1 Features
Calibrated directly in Celsius (Centigrade) Linear + 10.0 mV/C scale factor 0.5C accuracy guaranteed (at +25C) Rated for full 55 to +150C range Suitable for remote applications Low cost due to wafer-level trimming Operates from 4 to 30 volts Less than 60 A current drain Low self-heating, 0.08C in still air Nonlinearity only 14C typical
39
Fig3.11 (a): diagrams of LM35 3.11.1 The characteristic of this LM35 sensor is
For each degree of centigrade temperature it outputs 10milli volts
ADC0808
The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device with an 8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8-bit A/D converter uses successive approximation as the conversion technique.
Total Unadjusted Error 12 LSB and 1 LSB Single Supply 5 VDC Low Power 15 m
3.11.3 Features
Easy interface to all microprocessors Operates ratio metrically or with 5 VDC or analog span adjusted voltage reference No zero or full-scale adjust required 8-channel multiplexer with address logic 0V to 5V input range with single 5V power supply Outputs meet TTL voltage level specifications Standard hermetic or molded 28-pin DIP package 28-pin molded chip carrier package ADC0808 equivalent to MM74C949 ADC0809 equivalent to MM74C949-1
41
42
FIG3.11.5 (a): Block and Pin Diagram of LM35 3.12 CONVERTER CHARACTERISTICS 3.12.1 The Converter
The heart of this single chip data acquisition system is its 8-bit analog-to-digital converter. The converter is designed to give fast, accurate, and repeatable conversions over a wide range of temperatures. The converter is partitioned into 3 major sections: the 256R ladder network, the successive approximation register, and the comparator. The converters digital outputs are positive true. The 256R ladder network approach (Figure 1) was chosen over the conventional R/2R ladder because of its inherent monotonicity. The A/D converters successive approximation register (SAR) is reset on the positive edge of the start conversion (SC) pulse. The conversion is begun on the falling edge of the start conversion pulse. A conversion in process will be interrupted by receipt of a new start conversion pulse. Continuous conversion may be accomplished by tying the end of conversion (EOC) output to the SC input. If used in this mode, an external start conversion pulse should be applied after power up. End-of-conversion will go low between 0 and 8 clock pulses after the rising edge of start conversion. influence on the repeatability of the device.
43
I/O Pins
Table (4)
ADDRESS LINE A, B, C: The device contains 8-channels. A particular channel is selected by using the address decoder line. The above table shows the input states for address lines to select any channel. Address Latch Enable ALE: The address is latched on the Low High transition of ALE. START: The ADCs Successive Approximation Register (SAR) is reset on the positive edge i.e. Low- High of the Start Conversion pulse.
Output Enable: Whenever data has to be read from the ADC, Output Enable pin has to
be pulled high thus enabling the TRI-STATE outputs, allowing data to be read from the data pins D0-D7.
End of Conversion (EOC): This Pin becomes high when the conversion has ended,
so the controller comes to know that the data can now be read from the data pins.
Clock: External clock pulses are to be given to the ADC; this can be given either from
LM 555 in Astable mode or the controller can also be used to give the pulses.
44
Fig3.12.2 (a): ADC interface with the Microcontrollers 3.13 LIQUID CRYSTAL DIS PLAY
LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons: 1. The declining prices of LCDs. 2. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. 3. Incorporation of a refreshing controller into the LCD,
4.
These components are specialized for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.
A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each. It displays all alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics.
Pin Number 1 2 3
Logic State 0 1
Description 0V +5V 0 Vdd D0 D7 are interpreted as commands D0 D7 are interpreted as data D0 D7 are interpreted as commands D0 D7 are interpreted as data Write data (from controller to LCD) Read data (from LCD to controller) Access to LCD disabled Normal operating Data/commands are transferred to LCD Bit 0 LSB Bit 1 46
RS
RS
Control of operating
R/W
Data / commands
7 8
D0 D1
9 10 11 12 13 14
D2 D3 D4 D5 D6 D7
Table (8)
47
RS RW D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0 0 1
Cursor home Entry mode set Display on/off control Cursor/Display Shift Function set Set CGRAM address Set DDRAM address Read BUSY flag (BF) Write to CGRAM or DDRAM
0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1 0 1
0 0 0 0 0 0 1 BF
0 0 0 0 0 1
0 0 0 0
0 0 0
0 0 1
1 I/D S D U B x x
1 D/C R/L x F x
1 DL N
D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
Table (9)
I/D 1 = Increment (by 1) 0 = Decrement (by 1) S 1 = Display shift on 0 = Display shift off D 1 = Display on 0 = Display off U 1 = Cursor on 0 = Cursor off B 1 = Cursor blink on 0 = Cursor blink off
R/L 1 = Shift right 0 = Shift left DL 1 = 8-bit interface 0 = 4-bit interface N 1 = Display in two lines 0 = Display in one line F 1 = Character format 5x10 dots 0 = Character format 5x7 dot D/C 1 = Display shift 0 = Cursor shift
Once the power supply is turned on, LCD is automatically cleared. This process lasts for approximately 15mS. After that, display is ready to operate. The mode of operating is set by default. This means that: 1. Display is cleared 2. Mode DL = 1 Communication through 8-bit interface N = 0 Messages are displayed in one line F = 0 Character font 5 x 8 dots 3. Display/Cursor on/off D = 0 Display off U = 0 Cursor off B = 0 Cursor blink off 4. Character entry ID = 1 Addresses on display are automatically incremented by 1 S = 0 Display shift off Automatic reset is mainly performed without any problems. If for any reason power supply voltage does not reach full value in the course of 10mS, display will start perform completely unpredictably. If voltage supply unit cannot meet this condition or if it is needed to provide completely safe operating, the process of initialization by which a new reset enabling display to operate normally must be applied. Algorithm according to the initialization is being performed depends on whether connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after that is to give basic commands and of course- to display messages.
50
CHAPTER 4
51
To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.
HELLO is a simple program that prints the string "Hello World" using the Serial Interface.
Creating Your Own Application in Vision2 To create a new project in Vision2, you must:
1. Select Project - New Project. 2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8052, 251, or C16x/ST10 device from
the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files, Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications.
7. Select Project - Rebuild all target files or Build target.
Debug your program using standard options like Step, Go, Break, and so on.
Project New Project. This opens a standard Windows dialog that asks you for the
new project file name.
53
Database selection
You have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.
Start Debugging
You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session.
Disassembly Window
The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands.
54
1. 2. 3. 4.
Click on the Keil uVision Icon on Desktop The following fig will appear. Click on the Project menu from the title bar Then Click on New Project
5. 6. 7. 8.
Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\ Then Click on save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel
55
9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.
Select AT89C51 Then Click on OK The Following fig will appear Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 Click on the file option from menu bar and select new The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder. Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C Now right click on Source group 1 and click on Add files to Group Source
56
Now you will get another window, on which by default C files will appear. Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.
If the file contains no error, then press Control+F5 simultaneously. The new window is as follows Then Click OK
57
Now Click on the Peripherals from menu bar, and check your required port. Drag the port a side and click in the program file. Now keep Pressing function key F11 slowly and observe. You are running your program successfully
4.3 PROLOAD
Proload is software which accepts only hex files. Once the machine code is converted into hex code, that hex code has to be dumped into the microcontroller and this is done by the Proload. Proload is a programmer which itself contains a microcontroller in it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the Keil compiler and dumps this hex file into the microcontroller which is to be programmed. As the Proload programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply,
4.4 Features
Supports major Atmel 89 series devices Auto Identify connected hardware and devices Error checking and verification in-built Lock of programs in chip supported to prevent program copying 20 and 40 pin ZIF socket on-board Auto Erase before writing and Auto Verify after writing Informative status bar and access to latest programmed file
58
4.5 Description
It is simple to use and low cost, yet powerful flash microcontroller programmer for the Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and Blank Check. All fuse and lock bits are programmable. This programmer has intelligent onboard firmware and connects to the serial port. It can be used with any type of computer and requires no special hardware. All that is needed is a serial communication ports which all computers have.
59
CHAPTER 5
RESULTS
Assemble the circuit on the PCB as shown in Fig below. After assembling the circuit on the PCB, check it for proper connections before switching on the power supply.
The above fig shows the overall view of the kit. We have two sensors light dependent resister and temperature sensor(LM35).The LM35 converts temp value into electrical signal and LDRs senses intensity of light.555 Timer generates the pulse and given to ADC which converts analog signal into digital signal and provides to microcontroller. We have the arc input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a step down transformer. The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. Power supply of 5V is required. In order to obtain the voltage level, 7805 voltage regulators is to be used. The microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. It controls the kit. The microcontroller provides the converted digital values to HT640 RF Encoder. STT-433 MHz RF transmitter transmits the digital values using transmitting antenna.
These same values received at the STR-433 MHz Receiver and a HT648 RF Decoder .this decoder converts signal bit data into 8.bit data and presents it to the microcontroller. Now it is the job of the controller to read the data and display the same data on LCD
62
CHAPTER 6
CONCLUSION
The implementation of weather monitoring system using RF is done successfully. The communication is properly done without any interference between different modules in the design. Design is done to meet all the specifications and requirements. Software tools like Keil Uvision Simulator, Proload to dump the source code into the microcontroller, Orcad Lite for the schematic diagram have been used to develop the software code before realizing the hardware.
Circuit is implemented in Orcad and implemented on the microcontroller board. The performance has been verified both in software simulator and hardware design. The total circuit is completely verified functionally and is following the application software. It can be concluded that the design implemented in the present work provide portability, flexibility and the data transmission is also done with low power consumption
63
CHAPTER 7
REFERENCES
1. Muhammad Ali Mazidi, Janice Gillispie Mazidi, and Rolin D.McKinla, The 8051 Microcontroller and Embedded Systems Using Assembly and C; Pearson Education Inc.., 2006. 2. Kenneth J.Ayala , The 8051 Microcontroller Architecture, Programming, and Application; West Publishing Company, USA.,1991 3. B.Ram, Computer Fundamentals Architecture and Organization; New Age International (P) Ltd., Publishers, 2000. 4. Horn, and Delton T, Electronic Components A Complete Reference for Project Builders; McGraw-Hill/Tab Electronics, 1991. 5. E Balagurusamy , Programming In ANSI C;Tata McGraw-Hill Publishing Company Ltd,2008. Websites 1. http://www.google.com 2. http://books.google.com 3. http://www.atmel.com
64
4. http://www.datasheets4u.com
10. http://www.8051projects.net
65