Professional Documents
Culture Documents
Chapter 1: INTRODUCTION 04
1.1: EMBEDDED SYSTEM 06
1.2: MICROCONTROLLER 19
1.3: PIC MICROCONTROLLER 16F877A 23
Chapter 4: CONCLUSION 51
BIBLOGRAPHY 52
CODING 53
1
FIGURE CONTENTS PAGE NO.
FIG 1.1: THE EMBEDDED SYSTEM DESIGN CYCLE 07
2
ABSTRACT
Aim of this project is to implement class room attendance system with indoor
temperature and information display using embedded systems.
This system is a Hi-TECH and contemporary one for class rooms in colleges and schools.
Now a day the systems were get into digital form under this concept, information from the
department head can be displayed on the LCD screen using RF technology. Five things are
getting important they are counter unit, the information display unit through wireless technology
last one is Micro- controller unit and RF wireless unit.
The counterpart counts the number of students present in the class at when they entering
inside the class room; this is done by using IR sensors,. The details from the above send to
controller, then controller display it on the LCD.
In between this, if any information from head of the department means it will take as an
interrupt by the controller and receive the information through RF wireless communication.
When it is completed, the message will be displayed on the LCD screen. The message will be
displayed for a particular time period. After that it will again continue to display the presents of
students and room temperature.
In the transmitter side the three keys are assigned to type the message. The keys assigned
are as follows, one for alphabetic, second one for numeric, another one for enter button. When
the message entered it will transmitted through RF wireless unit.
CHAPTER-1
3
INTRODUCTION
The project report describes the design Development and Fabrication of One demo unit of the
Microcontrollers, all the activities in our daily living have become a part of Information
technology and we find microcontrollers in each and every application. Thus, trend is directing
towards Microcontrollers based project works. The microcontroller block is playing a major role
in this project work. The micro controller chip used in this project work is PIC 16F877A and this
is like heart of the project work. The PIC 16F877A microcontroller is a 40-pin IC.
The entire project was developed in embedded systems. A system is something that
maintains its existence and functions as a whole through the interaction of its parts. E.g. Body,
Mankind, Access Control, etc A system is a part of the world that a person or group of persons
during some time interval and for some purpose choose to regard as a whole, consisting of
interrelated components, each component characterized by properties that are selected as being
2) Embedded systems are computer systems that monitor, respond to, or control an
external environment.
interfaces.
4
4) Embedded system must meet timing & other constraints imposed on it by
environment.
physical variables and in diverse environments and sold into a competitive and cost
conscious market.
An embedded system is not a computer system that is used primarily for processing, not a
embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit
Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc. Lower
end embedded systems - Generally 8, 16 Bit Controllers used with a minimal operating systems
and hardware layout designed for the specific purpose. Examples Small controllers and devices
in our everyday life like Washing Machine, Microwave Ovens, where they are embedded in.
Microcontrollers are embedded inside some other device so that they can control the
features or actions of the project. Another name for a microcontroller therefore is “Embedded
Controller”. Microcontrollers are dedicated to one task and run one specific program. The
program is stored in ROM (read only memory) and generally does not change. Microcontrollers
5
Embedded System is a combination of hardware and software used to achieve a single specific
and in diverse environments and sold into a competitive and cost conscious market.
An embedded system is not a computer system that is used primarily for processing, not a
embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit
Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower
end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems
and hardware layout designed for the specific purpose. Examples Small controllers and devices
in our everyday life like Washing Machine, Microwave Ovens, where they are embedded in.
6
FIG 1.1: THE EMBEDDED SYSTEM DESIGN CYCLE
7
Characteristics of Embedded System:
• An embedded system is any computer system hidden inside a product other than a
computer
• There will encounter a number of difficulties when writing embedded system software in
– Throughput – Our system may need to handle a lot of data in a short period of
time.
human intervention
– Memory space – Memory is limited on embedded systems, and you must make
the software and the data fit into whatever memory exists
– Program installation – you will need special tools to get your software into
embedded systems
– Power consumption – Portable systems must run on battery power, and the
8
– Processor hogs – computing that requires large amounts of CPU time can
– Cost – Reducing the cost of the hardware is a concern in many embedded system
projects; software often operates on hardware that is barely adequate for the job.
serial port or a network connection. They usually do not have keyboards, screens or disk
drives.
Applications:
2 . C o mm un ic a ti on A p pl ic at io ns
3 . I n d u s tr ia l a ut om at i on an d pr oc es s co nt ro l s of tw ar e
CLASSIFICATION
RTS CLASSIFICATION
9
1. "Hard" real-time systems have very narrow response time.
1. "Soft" real-time systems have reduced constrains on "lateness" but still must operate very
2. Example: Railway reservation system – takes a few extra seconds the data remains valid.
LANGUAGES USED
1. C
2. C++
3. Java
4. Linux
5. Ada
6. Assembly
10
FIG 1.3: BLOCK DIAGRAM OF TRANSMITTER
11
FIG 1.4: BLOCK DIAGRAM OF XBEE RECEIVER
The AC main Block is the power supply which is of single phase 230V ac. This should
be given to step down transformer to reduce the 230V ac voltage to low voltage. i.e., to 6V or
12V ac this value depends on the transformer inner winding. The output of the transformer is
given to the rectifier circuit. This rectifier converts ac voltage to dc voltage. But the voltage may
To avoid these ripples the output of the rectifier is connected to filter. The filter thus
removes the harmonics. This is the exact dc voltage of the given specification. But the controller
operates at 5V dc and the relays and driver operates at 12V dc voltage. So we need a regulator to
12
The 7805 regulator produces 5V dc and this voltage is given to PIC micro controller,
KEYPAD unit, transmitter, receiver and LCD. The transmitter used here is TWS-434, Receiver
is RWS434, and also the circuit uses two potentio meters. These potentio meters acts as load.
The output of the microcontroller is given to the receiver. The receiver receives the signal
13
FIG 1.5: CIRCUIT DIAGRAM OF CLASS MONITORING SYSTEM TRANSMITTER
14
FIG 1.6: CIRCUIT DIAGRAM OF CLASS MONITORING SYSTEM RECEIVER
CIRCUIT DESCRIPTION
15
POWER SUPPLY:
Power supply unit consists of Step down transformer, Rectifier, Input filter, Regulator
The Step down Transformer is used to step down the main supply voltage from 230V AC
to lower value. This 230 AC voltage cannot be used directly, thus it is stepped down. The
Transformer consists of primary and secondary coils. To reduce or step down the voltage, the
transformer is designed to contain less number of turns in its secondary core. The output from
the secondary coil is also AC waveform. Thus the conversion from AC to DC is essential. This
The Rectifier circuit is used to convert the AC voltage into its corresponding DC voltage.
There are Half-Wave, Full-Wave and bridge Rectifiers available for this specific function. The
most important and simple device used in Rectifier circuit is the diode. The simple function of
the diode is to conduct when forward biased and not to conduct in reverse bias.
The Forward Bias is achieved by connecting the diode’s positive with positive of the
battery and negative with battery’s negative. The efficient circuit used is the Full wave Bridge
rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the
obtained DC voltage are removed using other circuits available. The circuit used for removing
Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC
voltage is obtained. And also these capacitors are used to reduce the harmonics of the input
voltage. The primary action performed by capacitor is charging and discharging. It charges in
positive half cycle of the AC voltage and it will discharge in negative half cycle. Here we used
16
1000µF capacitor. So it allows only AC voltage and does not allow the DC voltage. This filter is
fixed before the regulator. Thus the output is free from ripples.
Regulator regulates the output voltage to be always constant. The output voltage is
maintained irrespective of the fluctuations in the input AC voltage. As and then the AC voltage
changes, the DC voltage also changes. Thus to avoid this Regulators are used. Also when the
internal resistance of the power supply is greater than 30 ohms, the output gets affected. Thus
this can be successfully reduced here. The regulators are mainly classified for low voltage and
for high voltage. Here we used 7805 positive regulator. It reduces the 6V dc voltage to 5V dc
Voltage.
The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often used
as filter. The principle of the capacitor is to charge and discharge. It charges during the positive
half cycle of the AC voltage and discharges during the negative half cycle. So it allows only AC
voltage and does not allow the DC voltage. This filter is fixed after the Regulator circuit to filter
any of the possibly found ripples in the output received finally. Here we used 0.1µF capacitor.
The output at this stage is 5V and is given to the Microcontroller. The output of the 7805
CONTROLLER CIRCUIT
The controller used in the circuit is the PIC 16f877A micro controller. The circuit
consists of LCD, Transmitter and Receiver. Transmitter used in the circuit is TWS-434. It is
having 4 pins. 1st pin is grounded and 2nd pin is given to the 25th pin of the PIC. 3rd pin is
connected to the +5v dc supply. 4th pin is given to the antenna. The +5v power supply given to
the 1st pin of the PIC. LCD is connected to the PIC as shown in the circuit.
17
The RB4, RB5, RB6, RB7 pins of the PIC are connected from the keypad unit. The
receiver used here is RWS 434. It consists of 7 pins. 7th pin is taken from the antenna. 1st, 6th and
7th pins are grounded. 2nd pin is connected to the 26th pin of the PIC micro controller. Two
potentio meters are connected to the receiver side PIC controller via RA0 pin. One more potentio
meter connected to LCD. For the two controllers two 4 MHz crystal oscillators are used to
Transmitter side LCD displays the message what the user or head typed through keypad.
And the receiver side LCD displays the message which was sent from transmitter, the number of
students presented in the class and temperature of the class room. Two sensors are used in the
circuit. One for counting the members presented in the class room and another is the temperature
CIRCUIT OPERATION
The input of the circuit is taken from the main. It is a single phase 230V ac voltage. This
230 AC voltage cannot be used directly, thus it is stepped down. The Step down Transformer is
used to step down the main supply voltage from 230V AC to lower value. Because the
microcontroller and sensors are operated at +5V dc voltage and relays and drivers will be operate
at +12V dc voltage. So first this 230C AC voltage should be stepped down and then it should be
converted to dc. After converting to dc it is applied to controller, sensors, relays and drivers. In
In this circuit we used two regulators. 7805 regulator for producing 5V dc, and 7812
regulator for 12V dc voltage. The output of 7805 regulator is given to PIC microcontroller and
18
three sensors. The output of the 7812 regulator is connected to three driver ICs and 12 Relays.
The main parts of this project are sensors and PIC micro controller. The sensors are connected to
The transmitter was fixed in the HOD room and the receiver is fixed in the classrooms.
When the HOD wants to send any message to the class rooms then he will type the message
through keypad unit. This message displayed on the transmitter side LCD. Then the message sent
to the controller. The controller then decodes the data and sent it to the transmitter antenna. The
At the receiver section the receiver antenna receives the signals from the transmitter
antenna. The Receiver then sends these signals to PIC controller. The PIC controller also
receives the data from the sensors. In this project we used two sensors. One is object detecting
sensor and the other is temperature sensor. The object detecting sensor is used for counting. And
the temperature sensor is used to measure the temperature in the class room. Then the LCD
which was fixed in the classroom thus displays the message from HOD, number of students
presented in the class and the temperature of the class room. By this way The HOD can send the
1.2 MICROCONTROLLER
core (CPU), some memory, and I/O (input/output) lines, all on one chip. The computer-on-a-chip
is called the microcomputer whose proper meaning is a computer using a (number of)
19
microprocessor(s) as its CPUs, while the concept of the microcomputer is known to be a
single silicon chip. This chip is used for only specific applications.
Most microcontrollers do not require a substantial amount of time to learn how to efficiently
program them, although many of them, which have quirks, which you will have to understand
Along with microcontrollers getting faster, smaller and more power efficient they are also
getting more and more features. Often, the first version of microcontroller will just have memory
and digital I/O, but as the device family matures, more and more pat numbers with varying
In this project we used PIC 16f877A microcontroller. For most applications, we will be
able to find a device within the family that meets our specifications with a minimum of external
devices, or an external but which will make attaching external devices easier, both in terms of
For many microcontrollers, programmers can built very cheaply, or even built in to the
final application circuit eliminating the need for a separate circuit. Also simplifying this
requirement is the availability of micro-controllers wit SRAM and EEPROM for control store,
which will allow program development without having to remove the micro controller for the
application circuit.
20
2) Only 35 single word instructions to learn.
3) All single cycle instructions except for program branches which are two cycle.
12) Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
21
24) Commercial and Industrial temperature ranges.
In this project we used PIC 16f877A microcontroller. PIC means Peripheral Interface
Controller. The PIC family having different series, the series are 12- Series, 14- Series, 16-
Series, 18- Series, and 24- Series. We used 16 Series PIC microcontrollers.
MICROPROCESSOR
Examples
1.2.4 APPLICATIONS:
1) Cell phones.
2) Computers.
22
3) Robots.
The PIC 16f877A microcontroller is a 40-pin IC. The first pin of the controller is MCLR
pin and the 5V dc supply is given to this pin through 10KΩ resistor. This supply is also given to
11th pin directly. The 12th pin of the controller is grounded. A tank circuit consists of a 4 MHZ
crystal oscillator and two 22pf capacitors is connected to 13th and 14th pins of the PIC.
5) Interrupts: 15
6) I/o ports: A, B, C, D, E
7) Timers: 3
8) Analog comparators: 2
9) Instructions: 35
23
1.3.3 PIN DIAGRAM OF PIC 16 F874A/877A
24
1.3.4 FUNCTIONAL BLOCK DIAGRAM OF PIC 16F877A
25
CHAPTER -2
HARDWARE REQUIREMENTS
CIRCUIT DIAGRAM
2) Rectifier unit
3) Input filter
4) Regulator unit
5) Output filter
to lower value. This 230 AC voltage cannot be used directly, thus it is stepped down. The
Transformer consists of primary and secondary coils. To reduce or step down the voltage, the
transformer is designed to contain less number of turns in its secondary core. The output from
the secondary coil is also AC waveform. Thus the conversion from AC to DC is essential. This
Step down transformers can step down incoming voltage, which enables you to have the
correct voltage input for your electrical needs. For example, if our equipment has been specified
for input voltage of 12 volts, and the main power supply is 230 volts, we will need a step down
transformer, which decreases the incoming electrical voltage to be compatible with your 12 volt
equipment.
The Rectifier circuit is used to convert the AC voltage into its corresponding DC voltage.
There are Half-Wave, Full-Wave and bridge Rectifiers available for this specific function. The
most important and simple device used in Rectifier circuit is the diode. The simple function of
the diode is to conduct when forward biased and not to conduct in reverse bias.
Bridge rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve
full-wave rectification. This is a widely used configuration, both with individual diodes wired as
shown and with single component bridges where the diode bridge is wired internally.
27
FIG : Bridge rectifier
A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that
provides the same polarity of output voltage for either polarity of input voltage. When used in its
most common application, for conversion of alternating current (AC) input into direct current
(DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification
from a two-wire AC input, resulting in lower cost and weight as compared to a center-tapped
transformer design.
The Forward Bias is achieved by connecting the diode’s positive with positive of the
battery and negative with battery’s negative. The efficient circuit used is the Full wave Bridge
rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the
obtained DC voltage are removed using other circuits available. The circuit used for removing
Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC
voltage is obtained. And also these capacitors are used to reduce the harmonics of the input
voltage. The primary action performed by capacitor is charging and discharging. It charges in
28
positive half cycle of the AC voltage and it will discharge in negative half cycle. So it allows
only AC voltage and does not allow the DC voltage. The 1000µf capacitor serves as a "reservoir"
which maintains a reasonable input voltage to the 7805 throughout the entire cycle of the ac line
voltage. The four rectifier diodes keep recharging the reservoir capacitor on alternate half-cycles
of the line voltage, and the capacitor is quite capable of sustaining any reasonable load in
between charging pulses. This filter is fixed before the regulator. Thus the output is free from
ripples. Input side the low pass filter has been used
One simple electrical circuit that will serve as a low-pass filter consists of a resistor in
series with a load, and a capacitor in parallel with the load. The capacitor exhibits reactance, and
blocks low-frequency signals, causing them to go through the load instead. At higher frequencies
the reactance drops, and the capacitor effectively functions as a short circuit. The combination of
resistance and capacitance gives you the time constant of the filter τ = RC (represented by the
Greek letter tau). The break frequency, also called the turnover frequency or cutoff frequency (in
hertz), is determined by the time constant: or equivalently (in radians per second):
29
One way to understand this circuit is to focus on the time the capacitor takes to charge. It
At low frequencies, there is plenty of time for the capacitor to charge up to practically the
At high frequencies, the capacitor only has time to charge up a small amount before the
input switches direction. The output goes up and down only a small fraction of the
amount the input goes up and down. At double the frequency, there's only time for it to
Regulator regulates the output voltage to be always constant. The output voltage is
maintained irrespective of the fluctuations in the input AC voltage. As and then the AC voltage
changes, the DC voltage also changes. Thus to avoid this Regulators are used. Also when the
internal resistance of the power supply is greater than 30 ohms, the output gets affected. Thus
this can be successfully reduced here. Meanwhile it also contains current-limiting circuitry and
thermal overload protection, so that the IC won't be damaged in case of excessive load current; it
will reduce its output voltage instead. The regulators are mainly classified for low voltage and
1) Positive regulator
30
• Input pin
• Ground pin
• Output pin
2) Negative regulator
• Ground pin
• Input pin
• Output pin
The 7805 provides circuit designers with an easy way to regulate DC voltages to 5v.
Encapsulated in a single chip/package (IC), the 7805 is a positive voltage DC regulator that has
The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often used as
filter. The principle of the capacitor is to charge and discharge. It charges during the positive half
cycle of the AC voltage and discharges during the negative half cycle. The 10µf and .01µf
capacitors serve to help keep the power supply output voltage constant when load conditions
31
change. The electrolytic capacitor smooth’s out any long-term or low frequency variations.
However, at high frequencies this capacitor is not very efficient. Therefore, the .01µf is included
The TWS-434 and RWS-434 are extremely small, and are excellent for applications
requiring short-range RF remote controls. The transmitter module is only 1/3 the size of a
standard postage stamp, and can easily be placed inside a small plastic enclosure.
approximately 400 foot (open area) outdoors. Indoors, the range is approximately 200 foot, and
The TWS-434 transmitter accepts both linear and digital inputs can operate from 1.5 to 12 Volts-
DC, and makes building a miniature hand-held RF transmitter very easy. The TWS-434 is
32
2.4 RECEIVER DETAILS
RWS-434: The receiver also operates at 433.92MHz, and has a sensitivity of 3uV. The RWS-
434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear and digital outputs.
Note: For maximum range, the recommended antenna should be approximately 35cm long. To
convert from centimeters to inches -- multiply by 0.3937. For 35cm, the length in inches will be
approximately 35cm x 0.3937 = 13.7795 inches long. We tested these modules using a 14",
solid, 24 gauge hobby type wire, and reached a range of over 400 foot. Your results may vary
33
FIG 2.7: RWS-434 Pin Diagram
Liquid crystal display (LCD) has material which combines the properties of both liquid
and crystals. They have a temperature range within which the molecules are almost as mobile as
they would be in a liquid, but are grouped together in an order form similar to a crystal.
LCD DISPLAY:
34
FIG 2.8: LCD DISPLAY
More microcontroller devices are using 'smart LCD' displays to output visual information. The
following discussion covers the connection of a Hitachi LCD display to a PIC microcontroller.
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 8 x 80 pixels of the display. Hitachi LCD
displays have a standard ASCII set of characters plus Japanese, Greek 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 which means they are in a state of high impedance (as though they are
disconnected) and this means they do not interfere with the operation of the microcontroller
35
Enable (E) This line allows access to the display through R/W and RS lines. When this
line is low, the LCD is disabled and ignores signals from R/W and RS. When
(E) line is high, the LCD checks the state of the two control lines and responds
accordingly.
Read/Write (R/W) This line determines the direction of data between the LCD and
(RS) When it is low, an instruction is being written to the LCD. When it is high, a
RS 0 Instruction
1 Character
36
Set E line to low
Before we access DD RAM after defining a special character, the program must set the DD
RAM address. Writing and reading data from any LCD memory is done from the last address
which was set up using set-address instruction. Once the address of DD RAM is set, a new
written character will be displayed at the appropriate place on the screen. Until now we discussed
the operation of writing and reading to an LCD as if it were an ordinary memory. But this is not
so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading.
37
2.6 INTERFACING PIC MICROCONTROLLER TO LCD:
1 40
2 39
3 38
4 37
5 36
6 35
PIC I6f877A
7 34
8 33
9 32
10 31
11 30
12 29
13 28
14 27
15 26
16 25
17 24
18 23
10k 19 22
20 21
4MHz
22pf
22pf
1N4007
1 2
VIN VOUT
1N4007
GND
+ 103
5v
1N4007
step down +5v 1 2 3 4 5 6 7 8 9 10111213141516
transformer
1 78122
+12v
3 OUTPUT
+5v
38
CHAPTER-3
SOFTWARE REQUIREMENTS
SOFTWARE REQUIREMENTS
3.1SOFTWARE TOOLS
1) MPLAB
2) Protel
3) Propic
MPLAB Integrated Development Environment (IDE) is a free, integrated toolset for the
microcontrollers. MPLAB IDE runs as a 32-bit application on MS Windows, is easy to use and
includes a host of free software components for fast application development and super-charged
debugging. MPLAB IDE also serves as a single, unified graphical user interface for additional
Microchip and third party software and hardware development tools. Moving between tools is a
snap, and upgrading from the free simulator to MPLAB ICD 2 or the MPLAB ICE emulator is
done in a flash because MPLAB IDE has the same user interface for all tools.
Choose MPLAB C18, the highly optimized compiler for the PIC18 series
microcontrollers, or try the newest Microchip's language tools compiler, MPLAB C30, targeted
at the high performance PIC24 and dsPIC digital signal controllers. Or, use one of the many
39
products from third party language tools vendors. They integrate into MPLAB IDE to function
compilers that help software developers write compact, efficient embedded processor code.
For over two decades HI-TECH Software has delivered the industry's most reliable
embedded software development tools and compilers for writing efficient and compact code to
run on the most popular embedded processors. Used by tens of thousands of customers including
General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's reliable
development tools and C compilers, combined with world-class support have helped serious
Whichever embedded processor family you are targeting with your software, whether it is
the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code
compiler - not a subset implementation like some other PIC compilers. The PICC compiler
implements full ISO/ANSI C, with the exception of recursion. All data types are supported
including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes full use of specific
PIC features and using an intelligent optimizer, can generate high-quality code easily rivaling
40
hand-written assembler. Automatic handling of page and bank selection frees the programmer
4) An optimizing assembler
7) Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types
11) Compatible - integrates into the MPLAB IDE, MPLAB ICD and most 3rd-party
development tools
This environment allows you to manage all of your PIC projects. You can compile,
41
Optionally, the compiler may be run directly from the command line, allowing you to
compile, assemble and link using one command. This enables the compiler to be integrated into
3.6.1 ASSEMBLER
mnemonic representation of machine language — into object code. A cross assembler (see cross
compiler) produces code for one type of processor, but runs on another. The computational step
mnemonics into opcodes, assemblers provide the ability to use symbolic names for memory
locations (saving tedious calculations and manually updating addresses when a program is
slightly modified), and macro facilities for performing textual substitution — typically used to
Assemblers are far simpler to write than compilers for high-level languages.
Speed: Assembly language programs are generally the fastest programs around.
Capability: You can do things in assembly which are difficult or impossible in High
level languages.
42
Knowledge: Your knowledge of assembly language will help you write better programs,
even when using High level languages. An example of an assembler we use in our project is
RAD 51.
3.6.3 SIMULATOR
3.6.4 COMPILER
A compiler is a program that reads a program in one language, the source language and
translates into an equivalent program in another language, the target language. The translation
process should also report the presence of errors in the source program.
There are two parts of compilation. The analysis part breaks up the source program into
constant piece and creates an intermediate representation of the source program. The synthesis
part constructs the desired target program from the intermediate representation.
43
4.6.5 COUSINS OF THE COMPILER ARE
1. Preprocessor.
2. Assembler.
A naive approach to that front end might run the phases serially.
1. Lexical analyzer takes the source program as an input and produces a long string of
tokens.
2. Syntax Analyzer takes an out of lexical analyzer and produces a large tree.
Semantic analyzer takes the output of syntax analyzer and produces another tree.
Similarly, intermediate code generator takes a tree as an input produced by semantic analyzer
The compiler has a number of phases plus symbol table manager and an error handler.
44
45
FABRICATION DETAILS
The fabrication of one demonstration unit is carried out in the following sequence.
1) Finalizing the total circuit diagram, listing out the components and sources of
procurement.
2) Procuring the components, testing the components and screening the components.
3) Making layout, repairing the interconnection diagram as per the circuit diagram.
4) Assembling the components as per the component layout and circuit diagram and
soldering components.
5) Integrating the total unit, interwiring the unit and final testing the unit.
Like every other system development design cycle embedded system too have a design cycle.
The flow of the system will be like as given below. For any design cycle these will be the
implementation steps. From the initial state of the project to the final fabrication the design
considerations will be taken like the software consideration and the hardware components,
sensor, input and output. The electronics usually uses either a microprocessor or a
minicomputers.
USER INTERFACES
User interfaces for embedded systems vary widely, and thus deserve some special comment.
User interface is the ultimate aim for an embedded module as to the user to check the output with
complete convenience. One standard interface, widely used in embedded systems, uses two
46
buttons (the absolute minimum) to control a menu system (just to be clear, one button should be
"next menu entry" the other button should be "select this menu entry").
Another basic trick is to minimize and simplify the type of output. Designs sometimes
use a status light for each interface plug, or failure condition, to tell what failed. A cheap
variation is to have two light bars with a printed matrix of errors that they select- the user can
glue on the labels for the language that he speaks. For example, most small computer printers use
lights labeled with stick-on labels that can be printed in any language. In some markets, these are
delivered with several sets of labels, so customers can pick the most comfortable language.
PLATFORM
There are many different CPU architectures used in embedded designs such as ARM,
MIPS, Coldfire/68k, PowerPC, X86, PIC, 8051, Atmel AVR, H8, SH, V850, FR-V, M32R etc.
This in contrast to the desktop computer market, which as of this writing (2003) is limited
to just a few competing architectures, mainly the Intel/AMD x86, and the Apple/Motorola/IBM
PowerPC, used in the Apple Macintosh. With the growing acceptance of Java in this field, there
is a tendency to even further eliminate the dependency on specific CPU/hardware (and OS)
requirements.
Standard PC/104 is a typical base for small, low-volume embedded and ruggedized system
design. These often use DOS, Linux or an embedded real-time operating system such as QNX or
Inferno.
chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual
property to add to the IC's design. A related common scheme is to use a field-programmable gate
47
array, and program it with all the logic, including the CPU. Most modern FPGAs are designed
TOOLS
assemblers, and debuggers to develop embedded system software. However, they also use a few
Sometimes, development tools for a personal computer can be used if the embedded
processor is a close relative to a common PC processor. Embedded system designers also use a
One common tool is an "in-circuit emulator" (ICE) or, in more modern designs, an
embedded debugger. This debugging tool is the fundamental trick used to develop embedded
code. It replaces or plugs into the microprocessor, and provides facilities to quickly load and
debug experimental code in the system. A small pod usually provides the special electronics to
plug into the system. Often a personal computer with special software attaches to the pod to
CRC to a program, so it can check its program data before executing it.
48
An embedded programmer that develops software for digital signal processing often has a
Less common are utility programs to turn data files into code, so one can include any
kind of data in a program. A few projects use Synchronous programming languages for extra
DEBUGGING
that can interrupt the microcontroller's internal microcode. The microcode interrupt lets the
debugger operate in hardware in which only the CPU works. The CPU-based debugger can be
used to test and debug the electronics of the computer from the viewpoint of the CPU. This
As the complexity of embedded systems grows, higher level tools and operating systems
are migrating into machinery where it makes sense. For example, cell phones, personal digital
assistants and other consumer computers often need significant software that is purchased or
provided by a person other than the manufacturer of the electronics. In these systems, an open
programming environment such as Linux, OSGi or Embedded Java is required so that the third-
2. Diodes :(1N4007) – 8 No
49
3. Capacitors :1000µF – 2 No, 22pF- 4Nos
:1 KΩ – 4Nos
9. LCD :2 Nos
CHAPTER 4
50
CONCLUSION
The System was operated successfully. The HOD has successfully sent the message to
class rooms. Temperature sensor senses the signals in the class room and given exact
temperature of the class room. And object detecting sensor operated and the controller counts the
number of students presented in the class room. Finally the LCD fixed in the class room
displayed the message (which was sent by HOD), number of students presented in the class and
This project aims at reducing the human strains and to increase the quality of work by the
The usage of RF Module decreases the manual work by sending a circular to every class
FUTURE ENHANCEMENTS
Fitted with a wireless camera it can be used for surveillance purposes. It can also
be enhanced to count the students by using a smart card reader and also by
APPLICATIONS
• In industries departments
51
BIBLIOGRAPHY
Bibliography:
BOOKS:
R. Alami et al., The International Journal of Robotics Research 17, 315 (1998).
Web sites:
• www.Microchips.com
• http://www.mikroelektronika.co.yu/english/product/books/PICbook/0Uvod.htm
52
CODING
Transmitter side:
#include<pic.h>
#include<lcd.h>
#define fn RB4
#define cur RB5
#define inc RB6
#define set RB7
void main()
{
while (1)
{
if(fn==1)
{
fninc++;
if(fninc==1)
{
cursor_loc(0x80);
display_string("MSG=");
}
if(fninc==1)
{
if(cur==1)
{
53
for(i=0;i<=25000;i++);
cur1++;
if(cur1==13)
cur1=0;
}
if(cur1==1)
{
cursor_loc(0x84);
display_data(a1);
cursor_loc(0x84);
if(inc==1)
{
if(a1<=-1)
a1=-1;
for(i=0;i<=25000;i++);
a1++;
if(a1>=43)
a1=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
a1=0x20-0x30;
}
}
if(cur1==2)
{
cursor_loc(0x85);
display_data(a2);
cursor_loc(0x85);
if(inc==1)
{
if(a2<=-1)
a2=-1;
for(i=0;i<=25000;i++);
a2++;
if(a2>=43)
a2=0;
}
if(set==1)
{
54
for(i=0;i<=25000;i++);
a2=-16;
}
}
if(cur1==3)
{
cursor_loc(0x86);
display_data(a3);
cursor_loc(0x86);
if(inc==1)
{
if(a3<=-1)
a3=-1;
for(i=0;i<=25000;i++);
a3++;
if(a3>=43)
a3=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
a3=-16;
}
}
if(cur1==4)
{
cursor_loc(0x87);
display_data(a4);
cursor_loc(0x87);
if(inc==1)
{
if(a4<=-1)
a4=-1;
for(i=0;i<=25000;i++);
a4++;
if(a4>=43)
a4=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
a4=-16;
}
}
if(cur1==5)
55
{
temp=a5;
cursor_loc(0x88);
display_data(temp);
cursor_loc(0x88);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
a5=temp;
}
if(cur1==6)
{
temp=a6;
cursor_loc(0x89);
display_data(temp);
cursor_loc(0x89);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
a6=temp;
}
if(cur1==7)
56
{
temp=a7;
cursor_loc(0x8A);
display_data(temp);
cursor_loc(0x8A);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
a7=temp;
}
if(cur1==8)
{
temp=a8;
cursor_loc(0x8B);
display_data(temp);
cursor_loc(0x8B);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
a8=temp;
}
if(cur1==9)
57
{
temp=a9;
cursor_loc(0x8C);
display_data(temp);
cursor_loc(0x8C);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
a9=temp;
}
if(cur1==10)
{
temp=aa;
cursor_loc(0x8D);
display_data(temp);
cursor_loc(0x8D);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
aa=temp;
}
if(cur1==11)
58
{
temp=ab;
cursor_loc(0x8E);
display_data(temp);
cursor_loc(0x8E);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
ab=temp;
}
if(cur1==12)
{
temp=ac;
cursor_loc(0x8F);
display_data(temp);
cursor_loc(0x8F);
if(inc==1)
{
if(temp<=-1)
temp=-1;
for(i=0;i<=25000;i++);
temp++;
if(temp>=43)
temp=0;
}
if(set==1)
{
for(i=0;i<=25000;i++);
temp=-16;
}
ac=temp;
}
}
59
if(fninc==2)
{
TXREG=0x30+a1;
while(!TRMT);
cursor_loc(0xC0);
display_data(a1);
delay();
TXREG=0x30+a2;
while(!TRMT);
display_data(a2);
delay();
TXREG=0x30+a3;
while(!TRMT);
display_data(a3);
delay();
TXREG=0x30+a4;
while(!TRMT);
display_data(a4);
delay();
TXREG=0x30+a5;
while(!TRMT);
display_data(a5);
delay();
TXREG=0x30+a6;
while(!TRMT);
display_data(a6);
delay();
TXREG=0x30+a7;
while(!TRMT);
display_data(a7);
delay();
60
TXREG=0x30+a8;
while(!TRMT);
display_data(a8);
delay();
TXREG=0x30+a9;
while(!TRMT);
display_data(a9);
delay();
TXREG=0x30+aa;
while(!TRMT);
display_data(aa);
delay();
TXREG=0x30+ab;
while(!TRMT);
display_data(ab);
delay();
TXREG=0x30+ac;
while(!TRMT);
display_data(ac);
delay();
}
/**********************************************************/
}
}
void delay()
{
for(j=0;j<=400;j++);
}
Receiver Side:
#include<pic.h>
#include<lcd.h>
while(1)
{
if(ir1==1)
{
student++;
delay2();
}
if(student>=1)
{
if(ir2==1)
{
student--;
delay2();
}
}
if(student>=1000)
{
a=0;
}
a=student;
a1=a/100;
a=a%100;
a2=a/10;
a=a%10;
a3=a;
cursor_loc(0xC0);
display_string("COUNT:");
display_data(a1);
display_data(a2);
display_data(a3);
if(count>=1)
{
cursor_loc(cursor);
display_data(RX);
}
62
}
}
void interrupt isr()
{
if(RCIF==1)
{
RCIF=0;
RX=RCREG-0x30;
cursor++;
count++;
void delay()
{
for(i=0;i<=400;i++);
}
void delay2()
{
for(i=0;i<=50000;i++);
}
5. Then click on Micro controller Micro Systems PIC Flash Software Icon on the desktop.
6. It displays on dialog box. Then select open and select the program which we already
saved as *.c.
10. In that put WDT -- > Disabled, WRT-- > Enabled, Oscillator-- > XT then click on OK.
12. Then Remove the IC from the PIC Flash and it is ready for used into the project or circuit
operation.
64