Aircraft Flying Project (PRINT OUT)
Aircraft Flying Project (PRINT OUT)
Aircraft Flying Project (PRINT OUT)
The purpose of this report is to present the concept and necessary information regarding the project Remote Display and
Analysis of Atmospheric Datas for Aircraft Flying. The project involves the development of data acquisition system to
acquire and display atmospheric parameters from different sensors.
The transmitter module consists of various sensors, pic microcontroller, LCD display. Emphasis is made in this report on
analog to digital data conversion, data processing and display of the atmospheric parameters. RF communication is used for
the transmission of the atmospheric datas from the transmitter to the receiver.
The first chapter of the report gives introduction and requirement of carrying out this work in a ground based station for ATC.
The second and third chapters deal with the basic system model and various parts of the system. The fourth and fifth
chapters give detailed hardware description and software description with source codes. The sixth chapter provides the
result analysis and the seventh, eighth and ninth gives the advantages, disadvantages, concluding remarks and future scope
of the project.
CHAPTER 1
INTRODUCTION
Air traffic control (ATC) is a service provided by ground-based controllers who direct aircraft on the ground and in the air. The
primary purpose of ATC systems worldwide is to separate aircraft to prevent collisions, to organize and expedite the flow of
traffic, and to provide information and other support for pilots when able. In some countries, ATC may also play a security or
defense role or be run entirely by the military.
Preventing collisions is referred to as separation, which is a term used to prevent aircraft from coming too close to each
other by use of lateral, vertical and longitudinal separation minima; many aircraft now have collision avoidance systems
installed to act as a backup to ATC observation and instructions. In addition to its primary function, the ATC can provide
additional services such as providing information to pilots, weather and navigation information and Notice to Air Mens.
In many countries, ATC services are provided throughout the majority of airspace, and its services are available to all users
(private, military, and commercial). When controllers are responsible for separating some or all aircraft, such airspace is
called "controlled airspace" in contrast to "uncontrolled airspace" where aircraft may fly without the use of the air traffic
control system. Depending on the type of flight and the class of airspace, ATC may issue instructions that pilots are required
to follow, or merely flight information to assist pilots operating in the airspace. In all cases, however, the pilot in command
has final responsibility for the safety of the flight, and may deviate from ATC instructions in an emergency.
Air traffic control basically depends on atmospheric datas such as wind speed, temperature, pressure, humidity, rain,
altitude, light etc. These atmospheric parameters must be monitored by the ground-based controller and when there is any
variation in the values of the monitored parameters from the acceptable range, a warning signal should be given to the pilot
in the form of audio output (buzzer sound) and a LED flash light for facilitating aircraft flying.
CHAPTER 2
BASIC MODEL OF THE SYSTEM
Page 1
TRANSDUCERS: A sensor is a device that measures a physical quantity and converts it into a signal which can be read by
an observer or by an instrument. This part of the system consists of various sensors, namely Wind speed, humidity,
pressure, light, rain, altitude and temperature sensors. These sensors sense respective parameters which are analogous
and send them to the Pic Microcontroller for processing.
PIC MICROCONTROLLER: The Pic Microcontroller is the heart of the proposed embedded system. It consists of an inbuilt
analog to digital convertor. It constantly monitors the digitized parameters of the various sensors and verifies them
with the predefined threshold values and checks if any corrective action is to be taken for the condition at that
instant of time. In case such a situation arises, it activates the actuators to perform a controlled operation.
AT89S52 MICROCONTROLLER: AT89S52 microcontroller is a great family compatible with Intel MCS-51 . Atmel AT89S52
is indicated by the initials "AT". This is a low power microcontroller, but the 8-bit CMOS gives high performance with an 8K
Bytes of internal flash memory. It is compatible with standard 80C51. Flash memory chip allows internal or scheduled to be
reprogrammed by a non-volatile memory. Atmel AT89S52 microcontroller is very powerful, has great flexibility and is thus the
perfect solution for many embedded applications.
ACTUATORS: An array of actuators can be used in the system such as relays, contactors, and change over switches etc.
They are used to turn on AC devices such as motors, coolers, pumps, fogging machines, sprayers. For the purpose of
demonstration relays have been used to drive AC bulbs to simulate actuators and AC devices. A complete working system
can be realized by simply replacing these simulation devices by the actual devices.
DISPLAY UNIT: A Liquid crystal display is used to indicate the present status of parameters. The information is displayed in
real time. Any display can be interfaced to the system with respective changes in driver circuitry and code.
LED FLASH LIGHTS: A flashlight is a hand-held electric-powered light source. Usually the light source is a small
incandescent light bulb or light-emitting diode (LED). Any variation in the values of the parameter from the acceptable
range will be indicated by the LED flash lights.
Page 2
BUZZER: A buzzer or beeper is an audio signaling device, which may be mechanical, electromechanical, or piezoelectric.
Typical uses of buzzers and beepers include alarms, timers and confirmation of user input such as a mouse click or
keystroke. Any variation in the values of the parameter from the acceptable range will be indicated by an alarm of the
buzzer.
CHAPTER 4 HARDWARE DESCRIPTION
TRANSDUCERS: A transducer is a device which measures a physical quantity and converts it into a signal which can be
read by an observer or by an instrument. Monitoring and controlling of atmospheric datas involves sensing the changes
occurring in environment. The parameters which are of importance are the temperature humidity, wind speed etc. Since all
these parameters are interlinked, a closed loop (feedback) control system is employed in monitoring it. The sensors
used in this system are:
1. Temperature Sensor (LM35)
2. Wind speed Sensor using motor.
3. Humidity Sensor (HY-SS 220).
TEMPERATURE SENSOR: National Semiconductors LM35 IC has been used for sensing the temperature. It is an integrated
circuit sensor that can be used to measure temperature with an electrical output proportional to the temperature. The
temperature can be measured more accurately with it than using a thermistor. The sensor circuitry is sealed and not subject
to oxidation, etc.
Features:
Page 3
Functional description:
The output of LM35 is amplified using a LM324 single power supply (+5V) op-amp.
The output voltage is converted to temperature by a simple conversion factor. The general equation used
to convert output voltage to temperature is: Temperature ( oC) = (Vout * 100) / 5 oC
. So if Vout is 5V, then,
Temperature = 100 oC.
HUMIDITY SENSOR
The humidity sensor HY-SS 220, manufactured by Honeywell is used for sensing the humidity. It delivers instrumentation
quality RH (Relative Humidity) sensing performance in a low cost. Relative humidity is a measure, in percentage, of the
vapour in the air compared to the total amount of vapour that could be held in the air at a given temperature.
Features:
High accuracy
Chemically resistant
The
RH
sensor
is
a
laser
trimmed,
thermoset
polymer
capacitive
sensing
element
with
on-chip
integrated
signal
conditioning.
The
sensing
element's
multilayer construction provides excellent resistance to most application hazards such as wetting, dust,
dirt, oils and common environmental chemicals.
Page 4
LIGHT SENSOR: Light Dependent Resistor (LDR) also known as photoconductor or photocell, is a device which has a
resistance which varies according to the amount of light falling on its surface. Since LDR is extremely sensitive in visible light
range, it is well suited for the proposed application.
The
Light
Dependent
CadmiumSulphide (CdS).
Resistor
(LDR)
is
made
using
the
semiconductor
The light falling on the brown zigzag lines on the sensor causes the resistance of the device to fall. This is
known as a negative co-efficient. There are some LDRs that work in the opposite way i.e. their resistance
increases with light (called positive co- efficient).
he resistance of the LDR decreases as the intensity of the light falling on it increases. Incident photons
drive electrons from the valence band into the conduction band.
Conduction
band
Valence
Cadmiu
m
sulphide
band
Fig 4.6 Structure of a Light Dependent Resistor, showing Cadmium Sulphide track and an atom to illustrate
electrons in the valence and conduction bands
Functional description:
An LDR and a normal resistor are wired in series across a voltage, as shown in the circuit below. Depending
on which is tied to the 5V and which to 0V, the voltage at the point between them, call it the sensor node,
will either rise or fall with increasing light. If the LDR is the component tied directly to the 5V, the sensor
node will increase in voltage with increasing light
The LDR's resistance can reach 10 k ohms in dark conditions and about 100 ohms in full brightness.
The circuit used for sensing light in our system uses a 10 k fixed resistor which is tied to +5V. Hence the
voltage value in this case decreases with increase in light intensity.
VCC
10k
ADC IN4
LDR
GND
Page 5
The sensor node voltage is compared with the threshold voltages for different levels of light intensity
corresponding to the four conditions- Optimum, dim, dark and night.
The relationship between the resistance RL and light intensity Lux for a typical LDR is:
RL = 500 / Lux k
MICROCONTROLLER (AT89S52
CRITERIA FOR CHOOSING A MICROCONTROLLER:
The basic criteria for choosing a microcontroller suitable for the application are:
1) The first and foremost criterion is that it must meet the task at hand efficiently and cost effectively. In analyzing the needs
of a microcontroller-based project, it is seen whether an 8- bit, 16-bit or 32-bit microcontroller can best handle the computing
needs of the task most effectively. Among the other considerations in this category are:
(a) Speed: The highest speed that the microcontroller supports.
(b)
Packaging:
It
may
be
a
40-pin
DIP
(dual
inline
package)
or
package), or some other packaging format. This is important
assembling, and prototyping the end product.
a
in
QFP
(quad
flat
terms of space,
is
important
in
terms
of
the
final
cost
of
the
product
in
which
2) The second criterion in choosing a microcontroller is how easy it is to develop products around it. Key considerations
include the availability of an assembler, debugger, compiler, technical support.
3) The third criterion in choosing a microcontroller is its ready availability in needed quantities both now and in the
future. Currently of the leading 8-bit microcontrollers, the 8051 family has the largest number of diversified suppliers. By
supplier is meant a producer besides the originator of the microcontroller. In the case of the 8051, this has originated by
Intel several companies also currently producing the 8051. Thus the microcontroller AT89S52, satisfying the criterion
necessary for the proposed application is chosen for the task.
DESCRIPTION: The 8051 family of microcontrollers is based on an architecture which is highly optimized for
embedded control systems. It is used in a wide variety of applications from military equipment to automobiles to the
keyboard. Second only to the Motorola 68HC11 in eight bit processors sales, the 8051 family of microcontrollers is
available in a wide array of variations from manufacturers such as Intel, Philips, and Siemens. These manufacturers have
added numerous features and peripherals to the 8051 such as I2C interfaces, analog to digital converters, watchdog
timers, and pulse width modulated outputs. Variations of the 8051 with clock speeds up to 40MHz and voltage
requirements down to 1.5 volts are available. This wide range of parts based on one core makes the 8051 family an
excellent choice as the base architecture for a company's entire line of products since it can perform many functions and
developers will only have to learn this one platform.
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable
Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible
with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with
in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller 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 con-tents but freezes the oscillator, disabling all other chip functions until the next
interrupt or hardware reset.
Page 6
Mode)
PIN CONFIGURATION:
Page 7
PIN DESCRIPTION:
GND: Ground.
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, Port1 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/counter2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in
the following table.
Port 2: 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, Port2 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 use 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.
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, Port3 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.
RST: 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.
ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for
external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to
external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With
the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high.
Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN: Program Store Enable (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: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from
external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1
is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program
Page 8
executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash
programming.
XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
30pF
C1
XTAL1
30pF
GN D
The A (accumulator) register or accumulator is used for most ALU operations and Boolean Bit
manipulations.
Register B is used for multiplication & division and can also be used for general purpose storage.
PC or program counter is a special 16-bit register. It is not part of SFR. Program instruction bytes are
fetched from locations in memory that are addressed by the PC.
Stack Pointer (SP) register is eight bits wide. It is incremented before data is stored during PUSH and CALL
executions. While the stack may reside anywhere in on-chip RAM, the Stack Pointer is initialized to 07H
after a reset. This causes the stack to begin at location 08H.
DPTR or data pointer is a special 16-bit register that is accessible as two 8- bit
registers: DPL and DPH, which are used to used to furnish memory addresses for internal and external
code access and external data access.
Control Registers: Special Function Registers IP, IE, TMOD, TCON, SCON, and PCON contain control and
status bits for the interrupt system, the Timer/Counters, and the serial port.
Timer Registers: Register pairs (TH0, TL0) and (TH1, TL1) are the 16-bit Counter registers for
Timer/Counters 0 and 1, respectively.
MEMORY ORGANIZATION:
MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program
and Data Memory can be addressed.
Program Memory: If the EA pin is connected to GND, all program fetches are directed to external
memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through
1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external
memory.
Data Memory: The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a
parallel address space to the Special Function Registers. This means that the upper 128 bytes have the
same addresses as the SFR space but are physically separate from SFR space. When an instruction
Page 9
accesses an internal location above address 7FH, the address mode used in the instruction specifies
whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct
addressing access the SFR space. The lower 128bytes of RAM can be divided into three segments:
1.
Register Banks 0-3: locations 00H through 1FH (32 bytes). The device after reset defaults to register bank 0. To
use the other register banks, the user must select them in software. Each register bank contains eight 1-byte
registers R0-R7. Reset initializes the stack point to location 07H, and is incremented once to start from 08H, which is
the first register of the second register bank.
2. Bit Addressable Area: 16 bytes have been assigned for this segment 20H-2FH. Eachone of the 128 bits of this
segment can be directly addressed (0-7FH). Each of the 16 bytes in this segment can also be addressed as a byte.
3. Scratch Pad Area: 30H-7FH are available to the user as data RAM. However, if the data pointer has been initialized
to this area, enough bytes should be left aside to prevent SP data destruction.
Page 10
TIMER MODE-3: In mode-3, timer-1 simply hold its count, where as timer 0 registers TL0 and TH0 are used as two separate
8-bit counters. TL0 uses the Timer-0 control bits. TH0 counts machine cycles and takes over the use of TR1 and TF1 from
Timer-1.
INTERRUPTS A computer has only two ways to determine the conditions that exist in internal and external circuits. One
method uses software instructions that jump to subroutines on the states of flags and port pins. The second method
responds to hardware signals, called interrupts that force the program to call a subroutine.
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1,
and 2), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or
clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once.
Each interrupt forces the processor to jump at the interrupt location in the memory. The interrupted program must resume
operation at the instruction where the interrupt took place. Program resumption is done by storing the interrupted PC
address on to stack. RETI instruction at the end of ISR will restore the PC address.
MICROCONTROLLER CONFIGURATION USED IN THE SET-UP The microcontroller is interfaced with the ADC in polling
mode. INT0 is used for the LCD mode selection switch in order to switch between two modes of display:
1) Sensor output display
2) Actuator status display
Port details:
Port 2: Interfaced with the LCD Control lines and AC Interface control
PIC16F877A MICROCONTROLLER: PIC is a family of Harvard architecture microcontrollers made by Microchip Technology,
derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially
referred to "Peripheral Interface Controller".
PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base,
extensive collection of application notes, availability of low cost or free development tools, and serial programming (and reprogramming with flash memory) capability.
CORE ARCHITECTURE: The PIC architecture is characterized by its multiple attributes:
Separate code and data spaces (Harvard architecture) for devices other than PIC32, which has a Von Neumann
architecture.
A small number of fixed length instructions. Most instructions are single cycle execution (2 clock cycles), with
one delay cycle on branches and skips.
One accumulator (W0), the use of which (as source operand) is implied (i.e. is not encoded in the opcode).
All RAM locations function as registers as both source and/or destination of math and other functions.
A fairly small amount of addressable data space (typically 256 bytes), extended through banking.
The program counter is also mapped into the data space and writable (this is used to implement indirect
jumps).
There is no distinction between memory space and register space because the RAM serves the job of both memory and
registers, and the RAM is usually just referred to as the register file or simply as the registers.
DATA SPACE (RAM): PICs have a set of registers that function as general purpose RAM. Special purpose control registers
for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on
device series, and all PIC devices have some banking mechanism to extend addressing to additional memory. Later series of
devices feature move instructions which can cover the whole addressable space, independent of the selected bank. In earlier
devices, any register move had to be achieved via the accumulator.
To implement indirect addressing, a "file select register" (FSR) and "indirect register" (INDF) are used. A register number is
written to the FSR, after which reads from or writes to INDF will actually be to or from the register pointed to by FSR. Later
devices extended this concept with post- and pre- increment/decrement for greater efficiency in accessing sequentially
stored data. This also allows FSR to be treated almost like a stack pointer (SP).
CODE SPACE: The code space is generally implemented as ROM, EPROM or flash ROM. In general, external code memory is
not directly addressable due to the lack of an external memory interface. The exceptions are PIC17 and select high pin count
PIC18 devices.
WORD SIZE: All PICs handle (and address) data in 8-bit chunks. However, the unit of addressability of the code space is not
generally the same as the data space. For example, PICs in the baseline and mid-range families have program memory
addressable in the same word size as the instruction width, i.e. 12 or 14 bits respectively. In contrast, in the PIC18 series, the
Page 11
program memory is addressed in 8-bit increments (bytes), which differs from the instruction width of 16 bits. In order to be
clear, the program memory capacity is usually stated in number of (single word) instructions, rather than in bytes.
STACKS: PICs have a hardware call stack, which is used to save return addresses. The hardware stack is not software
accessible on earlier devices, but this changed with the 18 series devices. Hardware support for a general purpose
parameter stack was lacking in early series, but this greatly improved in the 18 series, making the 18 series architecture
more friendly to high level language compilers.
INSTRUCTION SET: A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80 instructions for the
high-end PICs. The instruction set includes instructions to perform a variety of operations on registers directly, the
accumulator and a literal constant or the accumulator and a register, as well as for conditional execution, and program
branching.
Some operations, such as bit setting and testing, can be performed on any numbered register, but bi-operand arithmetic
operations always involve W (the accumulator), writing the result back to either W or the other operand register. To load a
constant, it is necessary to load it into W before it can be moved into another register. On the older cores, all register moves
needed to pass through W, but this changed on the "high end" cores.
PIC cores have skip instructions which are used for conditional execution and branching. The skip instructions are 'skip if bit
set' and 'skip if bit not set'. Because cores before PIC18 had only unconditional branch instructions, conditional jumps are
implemented by a conditional skip (with the opposite condition) followed by an unconditional branch. Skips are also of utility
for conditional execution of any immediate single following instruction.
The 18 series implemented shadow registers which save several important registers during an interrupt, providing
hardware support for automatically saving processor state when servicing interrupts.
In general, PIC instructions fall into 5 classes:
1.
Operation on working register (WREG) with 8-bit immediate ("literal") operand. E.g. movlw (move literal to WREG),
andlw (AND literal with WREG). One instruction peculiar to the PIC is retlw, load immediate into WREG and return,
which is used with computed branches to produce lookup tables.
2.
Operation with WREG and indexed register. The result can be written to either the Working register (e.g. addwf
reg,w). or the selected register (e.g. addwf reg,f).
3.
Bit operations. These take a register number and a bit number, and perform one of 4 actions: set or clear a bit, and
test and skip on set/clear. The latter are used to perform conditional branches. The usual ALU status flags are
available in a numbered register so operations such as "branch on carry clear" are possible.
4.
Control transfers. Other than the skip instructions previously mentioned, there are only two: goto and call.
5.
A few miscellaneous zero-operand instructions, such as return from subroutine, and sleep to enter low-power mode.
RISC architecture
Inexpensive microcontrollers
Wide range of interfaces including I2C, SPI, USB, USART, A/D, programmable Comparators, PWM, LIN, CAN, PSP, and
Ethernet.
One accumulator.
Register-bank switching is required to access the entire RAM of many devices.
Operations and registers are not orthogonal; some instructions can address RAM and/or immediate constants, while
others can only use the accumulator.
The following limitations have been addressed in the PIC18 series, but still apply to earlier cores:
Stack:
The hardware call stack is not addressable, so preemptive task switching cannot be implemented
Software-implemented stacks are not efficient, so it is difficult to generate reentrant code and support local variables
With paged program memory, there are two page sizes to worry about: one for CALL and GOTO and another for computed
GOTO (typically used for table lookups). For example, on PIC16, CALL and GOTO have 11 bits of addressing, so the page size
is 2048 instruction words. For computed GOTOs, where you add to PCL, the page size is 256 instruction words. In both cases,
Page 12
the upper address bits are provided by the PCLATH register. This register must be changed every time control transfers
between pages. PCLATH must also be preserved by any interrupt handler.
Architecturally, although they share the PIC moniker, they are very different from the 8-bit PICs. The most notable
differences are:[10]
They fully support a stack in RAM, and do not have a hardware stack
Data stored in program memory can be accessed directly using a feature called Program Space Visibility
Interrupt sources may be assigned to distinct handlers using an interrupt vector table
Barrel shifting
Bit reversal
LIQUID CRYSTAL DISPLAY A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or
monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a column of liquid crystal molecules
suspended between two transparent electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to
each other. Without the liquid crystals between them, light passing through one would be blocked by the other. The liquid
crystal twists the polarization of light entering one filter to allow it to pass through the other. Many microcontroller devices
use 'smart LCD' displays to output visual information. LCD displays designed around Hitachi's LCD HD44780 module, are
inexpensive, easy to use, and it is even possible to produce a readout using the 8x80 pixels of the display. They have a
standard ASCII set of characters and mathematical symbols.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines
plus seven extra lines. When the LCD display is not enabled, data lines are tri-state and they do not interfere with the
operation of the microcontroller.
Data can be placed at any location on the LCD. For 162 LCD, the address locations are:
First line
80
81
82
83
84
85
86
through
8F
Second line
C0
C1
C2
C3
C4
C5
C6
through CF
3) Register select (RS): With the help of this line, the LCD interprets the type of data on
data lines. When it is low, an
instruction is being written to the LCD. When it is high, a character is being written to the LCD.
Logic status on control lines:
Page 13
RS - 0 Instruction- 1 Character
Page 14
A buzzer or beeper is a signaling device, usually electronic, typically used in automobiles, household appliances
such as a microwave oven.
Page 15
SPST - Single Pole Single Throw: These have two terminals which can be connected or disconnected.
Including two for the coil, such a relay has four terminals in total. It is ambiguous whether the pole is
normally open or normally closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the
ambiguity.
SPDT - Single Pole Double Throw: A common terminal connects to either of two others. Including two for
the coil, such a relay has five terminals in total.
DPST - Double Pole Single Throw: These have two pairs of terminals. Equivalent to two SPST switches or
relays actuated by a single coil. Including two for the coil, such a relay has six terminals in total. It is
ambiguous whether the poles are normally open, normally closed, or one of each.
DPDT - Double Pole Double Throw: These have two rows of change-over terminals. Equivalent to two
SPDT switches or relays actuated by a single coil. Such a relay has eight terminals, including the coil.
QPDT - Quadruple Pole Double Throw: Often referred to as Quad Pole Double Throw, or 4PDT. These have
four rows of change-over terminals. Equivalent to four SPDT switches or relays actuated by a single coil, or
two DPDT relays. In total, fourteen terminals including the coil.
Page 16
As can be seen from the above circuit diagrams, the rectified voltage from the 4 diodes is given to pin 1 of the respective
regulators. Pin 2 of the regulators is connected to ground and pin 3 to Vcc. With adequate heat sinking the regulator can
deliver 1A output current. If internal power dissipation becomes too high for the heat sinking provided, the thermal shutdown
circuit takes over preventing the IC from overheating.
780
Page 17
#include <hybrid_string.c>
// INCLUDE FUNCTION TO PREPARE STRINGS FOR SD
CARD AND UART DATA TRANSIMISSION
#include <string.h>
void adc_read(unsigned char channel);
unsigned int gadcv (int i,int j);
unsigned int adcch(unsigned char cha);
unsigned char adcchanno;
void main (void)
{
unsigned char ii;
unsigned long adc_val=0;
unsigned char adc_val1;
TRISC=0X00;
TRISB=0X00;
lcd_init();
lcd_clear();
lcd_goto(0x00);
lcd_puts("DATA LOGGER");
while(1)
{
adc_val=0;
for(ii=0;ii<10;ii++)
{
adc_val=adc_val+adcch(0);
}
adc_val1=adc_val;
lcd_clear();
lcd_goto(0x00);
lcd_puts("T:");
displaynos(adc_val,2);
lcd_puts("C");
PORTB=0XFF;
DelayS(1);
PORTB=adc_val1;
DelayS(1);
adc_val=0;
for(ii=0;ii<10;ii++)
{
adc_val=adc_val+adcch(1);
}
lcd_goto(0x05);
lcd_puts("H:");
displaynos(adc_val,2);
lcd_puts("RH:");
PORTB=0XFE;
DelayS(1);
PORTB=adc_val1;
DelayS(1);
adc_val=0;
for(ii=0;ii<10;ii++)
{
adc_val=adc_val+adcch(2);
}
adc_val=adc_val/10;
adc_val1=adc_val;
lcd_goto(0x40);
lcd_puts("S:");
lcd_puts("MPH:");
PORTB=0XFD;
DelayS(1);
PORTB=adc_val1;
DelayS(1);
}
}
//--------------------------------------------- END OF INTRO ----------------------------------------------------------------------//-------------------------------------------------------------------------------------------------------------------// FUNCTIONT TO PREPARE STRING TO BE TRANSMITTED BY UART AND TRANSMIT IT;uart_transfer_data(),
//-------------------------------------------------------------------------------------------------------------------// THIS FUNCTION WHEN CALLED WILL PREPARE STRING TO BE TRANSMITTED BY UART AND TRANSMIT IT,
// INPUTS = NIL
// OUTPUT = NIL
// INTERUPTS = NIL
// GLOBAL VARIABLEs =
// OTHER FUCTIONS = NIL
void init_ports(void)
Page 18
//
//
TRISA0=1;
TRISA1=1;
TRISA2=0;
TRISA3=0;
TRISA4=1;
TRISA5=0;
PSPMODE=0;
PSPMODE=0;
TRISE0=0;
TRISE1=0;
TRISE2=0;
TRISB0=0;
TRISB1=0;
TRISB2=0;
TRISB3=0;
TRISB4=0;
TRISB5=0;
TRISB6=0;
TRISB7=0;
TRISC0=0;
TRISC1=0;
TRISC2=0;
TRISC3=0;
TRISC4=0;
TRISC5=0;
TRISC6=0;
TRISC7=0;
TRISD0=0;
TRISD1=0;
TRISD2=0;
TRISD3=0;
TRISD4=1;
TRISD5=1;
TRISD6=1;
TRISD7=1;
PSPMODE=0;
ADCON1=0b10000010;
//
//
//
//
//
//
NOT USED
NOT USED
CONFIGURED AS OUTPUT, LED 6
CONFIGURED AS OUTPUT, LED 5
NOT USED
CONFIGURED AS OUTPUT, LED 4
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
AS
AS
AS
AS
INPUT
INPUT
INPUT
INPUT
PORT
PORT
PORT
PORT
FOR
FOR
FOR
FOR
INPUT
INPUT
INPUT
INPUT
KEY
KEY
KEY
KEY
}
// ANALOG TO DIGITAL CONVERTON
// THIS FUNCTION WHEN CALLED WILL CONVERT THE ANALOG VALUE OF THE PASSED CHANNEL TO ITS EQUVIVALENT VALUE
// INPUTS = CHANNEL NO
// OUTPUT = DIGIAL VALUE
// INTERUPTS = NIL
// GLOBAL VARIABLEs = NIL
// OTHER FUCTIONS = adc_read(),gadcv(),adcch().
//-------------------------------------------------------------------------------------------------------------------unsigned int gadcv (int i,int j)
// FUNCTION TO COMBINE LOWER AND HIGHER BITS
{
unsigned int xadcv;
CLRWDT();
xadcv=i*256+j;
CLRWDT();
return xadcv;
}
unsigned int adcch(unsigned char cha)
// HERE ADC PORT IS READ TWICE, WHICH HAS TO BE DONE
WHEN READING CHANNEL IS CHANGED
{
unsigned int adcv;
CLRWDT();
ADRESH=0;
// CLEAR HIGHER BIT
ADRESL=0;
// CLEAR LOWER BIT
adc_read(cha);
// CALL FUNCTION FOR A TO D CONVERSION
CLRWDT();
ADRESH=0;
// CLEAR HIGHER BIT
ADRESL=0;
// CLEAR LOWER BIT
adc_read(cha);
// CALL FUNCTION FOR A TO D CONVERSION
adcv=gadcv(ADRESH,ADRESL);
// CALL FUNCTION TO COMBINE LOWER AND HIGHER BIT
CLRWDT();
return adcv;
}
//--------------------------------------------- END OF ADC FUNCTIONS ----------------------------------------------------
Page 19
//
Page 20
}
//--------------------------------------------- END OF INTRO ----------------------------------------------------------------------//-------------------------------------------------------------------------------------------------------------------// FUNCTIONT TO PREPARE STRING TO BE TRANSMITTED BY UART AND TRANSMIT IT;uart_transfer_data(),
//-------------------------------------------------------------------------------------------------------------------// THIS FUNCTION WHEN CALLED WILL PREPARE STRING TO BE TRANSMITTED BY UART AND TRANSMIT IT,
// INPUTS = NIL
// OUTPUT = NIL
// INTERUPTS = NIL
// GLOBAL VARIABLEs =
// OTHER FUCTIONS = NIL
void init_ports(void)
{
TRISA0=1;
// NOT USED
TRISA1=1;
// NOT USED
TRISA2=0;
// CONFIGURED AS OUTPUT, LED 6
TRISA3=0;
// CONFIGURED AS OUTPUT, LED 5
TRISA4=1;
// NOT USED
TRISA5=0;
// CONFIGURED AS OUTPUT, LED 4
//
PSPMODE=0;
//
PSPMODE=0;
TRISE0=0;
// CONFIGURED AS OUTPUT, LED 3
TRISE1=0;
// CONFIGURED AS OUTPUT, LED 2
TRISE2=0;
// CONFIGURED AS OUTPUT, LED 1
TRISB0=0;
// RELAY 3
TRISB1=0;
// RELAY 2
TRISB2=0;
// RELAY 1
TRISB3=0;
// NOT USED
TRISB4=0;
// NOT USED
TRISB5=0;
// NOT USED
TRISB6=0;
// NOT USED
TRISB7=0;
// NOT USED
TRISC0=0;
// LCD RS, CONFIGURED AS OUTPUT
TRISC1=0;
// LCD E, CONFIGURED AS OUTPUT
TRISC2=0;
// NOT USED
TRISC3=0;
// RELAY 6
TRISC4=0;
// RELAY 5
TRISC5=0;
// RELAY 4
TRISC6=0;
// CONFIGURED AS OUTPUT FOR UART TX
TRISC7=0;
// CONFIGURED AS INPUT FOR UART RX
TRISD0=0;
//
TRISD1=0;
//
LCD DATA LINES
TRISD2=0;
//
CONFIGURED AS OUTPUT
TRISD3=0;
//
TRISD4=1;
// CONFIGURED AS INPUT PORT FOR INPUT KEY
TRISD5=1;
// CONFIGURED AS INPUT PORT FOR INPUT KEY
TRISD6=1;
// CONFIGURED AS INPUT PORT FOR INPUT KEY
TRISD7=1;
// CONFIGURED AS INPUT PORT FOR INPUT KEY
PSPMODE=0;
ADCON1=0b10000010;
////////////////////
}
//-------------------------------------------------------------------------------------------------------------------// ANALOG TO DIGITAL CONVERTON
//-------------------------------------------------------------------------------------------------------------------// THIS FUNCTION WHEN CALLED WILL CONVERT THE ANALOG VALUE OF THE PASSED CHANNEL TO ITS EQUVIVALENT VALUE
// INPUTS = CHANNEL NO
// OUTPUT = DIGIAL VALUE
// INTERUPTS = NIL
// GLOBAL VARIABLEs = NIL
// OTHER FUCTIONS = adc_read(),gadcv(),adcch().
//-------------------------------------------------------------------------------------------------------------------void adc_read(unsigned char channel)
// THS FUNCTINS SETSUP ANALOG PORT AND READS THE ADC VALUE
{
ADCON0 = (channel << 3) + 0x01;
// ENABLE ADC, SET CHANNEL,
ADFM=1;
ADGO = 1;
// START CONVERSION
CLRWDT();
while(ADGO)
// WAIT TILL END OF CONVERSION
CLRWDT();
// wait for conversion complete
}
unsigned int gadcv (int i,int j)
{
unsigned int xadcv;
CLRWDT();
xadcv=i*256+j;
Page 21
CLRWDT();
return xadcv;
}
unsigned int adcch(unsigned char cha)
// HERE ADC PORT IS READ TWICE, WHICH HAS TO BE DONE
WHEN READING CHANNEL IS CHANGED
{
unsigned int adcv;
CLRWDT();
ADRESH=0;
// CLEAR HIGHER BIT
ADRESL=0;
// CLEAR LOWER BIT
adc_read(cha);
// CALL FUNCTION FOR A TO D CONVERSION
CLRWDT();
ADRESH=0;
// CLEAR HIGHER BIT
ADRESL=0;
// CLEAR LOWER BIT
adc_read(cha);
// CALL FUNCTION FOR A TO D CONVERSION
adcv=gadcv(ADRESH,ADRESL);
// CALL FUNCTION TO COMBINE LOWER AND HIGHER BIT
CLRWDT();
return adcv;
}
//--------------------------------------------- END OF ADC FUNCTIONS ----------------------------------------------------
CHAPTER 6
RESULT ANALYSIS The readings are taken at room temperature 27
C.
TEMPERATURE SENSOR
FORMULA:
Temperature (
C ) = (Vout/5) *100(
C/V)
Temperature range in
degree Celsius
10
0
Temperature sensor
output(Vout)
0.5V
to 200 C
0.75-1.0V
0
20 to 250 C
1.0-1.25V
15
0
C
1.25-1.5V
0
0
30 to 35 C
1.5-1.75V
25
35
to 40
0
C
0
0
45 to 50 C
40
to 30
2.0-2.25V
2.25-2.5V
0
C
2.5-2.75V
0
0
55 to 60 C
0
0
60 to 65 C
0
0
65 to 70 C
2.75-3.0V
50
to 45
1.75-2.0V
to 55
0
0
70 to 75 C
3.0-3.25V
3.25-3.5V
3.5-3.75V
Page 22
Percentage RH
(RELATIVE HUMIDITY)
0%
0-0.8V
0% to 9.81%
0.8-1.1V
12.9% to 20.1%
1.2-1.45V
22.7% to 30.06%
1.5-1.725V
30.8% to 40.5%
1.75-2.05V
41.3%to50.3%
2.075-2.35V
51%to 60.02%
2.375-2.65
61.6%to70.5%
2.7-2.975V
71%to80.2%
3-3.275V
81.1%to 90%
3.3-3.6V
91%to 100%
3.6-3.9V
Fig 6.2 Humidity sensor readings
CHAPTER 7
ADVANTAGES AND DISADVANTAGES
ADVANTAGES:
1.
DISADVANTAGES:
1. Complete automation in terms of pest and insect detection and eradication cannot be achieved.
2. No self-test system to detect malfunction of sensors.
3. Requires uninterrupted power supply.
CHAPTER 8
CONCLUDING REMARKS
Remote analysis and display of atmospheric datas is an important function for safe and efficient air traffic control. This
project designs a simple, easy to install, microcontroller-based circuit to monitor and record the values of temperature,
humidity, and wind speed of the natural environment that are continuously modified and controlled in order optimize them
to achieve safe aircraft take-off and landing. The controller used is a low power, cost efficient chip manufactured by ATMEL.
The buzzer circuitry used provide warning alarm and flash light is used to indicate it. This helps the controller to take
necessary actions such as passing on the information to the pilot. The pic microcontroller used is highly resistant to noise
interference and gives accurate results.
Page 23
A step-by-step approach in designing the microcontroller based system for measurement and control of the four essential
parameters i.e. temperature, humidity, soil moisture, and light intensity, has been followed. The results obtained from the
measurement have shown that the system performance is quite reliable and accurate.
The system has successfully overcome quite a few shortcomings of the existing systems by reducing the power
consumption, maintenance and complexity, at the same time providing a flexible and precise form of maintaining the
environment.
CHAPTER 9
FUTURE SCOPE DEVELOPMENT
1) The performance of the system can be further improved in terms of the operating speed, memory capacity and instruction
cycle period of the microcontroller by using other controllers such as AVRs and PICs. The number of channels can be
increased to interface more number of sensors which is possible by using advanced versions of microcontrollers.
2) The system can be modified with the use of a data logger and a graphical LCD panel showing the measured sensor data
over a period of time.
3) A speaking voice alarm could be used instead of the normal buzzer.
4) This system can be connected to communication devices such as modems, cellular phones or satellite terminal to enable
the remote collection of recorded data or alarming of certain parameters.
5) The device can be made to perform better by providing the power supply with the help of battery source which can be
rechargeable or non-rechargeable, to reduce the requirement of main AC power.
REFERENCES
Myke Predko, Programming and Customizing the 8051 Microcontroller, TMH, 1999.
Kenneth J Ayala, the 8051 Microcontroller Architecture, Programming & Applications, Penram International, 2
Edition, 1996.
SENSORS- The Journal of Applied Sensing Technology, Advanced Communications Inc
Yeshwant kanetkar- Advanced concepts in C
http://freewebs.com/maheshwankede
http://www.faludi.com
http://www.electro-tech-online.com
http://www.8051projects.net/forum
http://www.datasheetdirect.com
http://www.google.com
Page 24
nd