Beruflich Dokumente
Kultur Dokumente
SUBMITTED IN
PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD OF
DEGREE
OF
BACHELOR OF TECHNOLOGY
Submitted to :-
Submitted by:-
Ashish (1510168)
ACKNOWLEDGEMENT
I want to express my sincere gratitude and thanks to Mr. Nitin Sharma (H.O.D., ECE Department), N.
C. College of Engineering, Israna (Panipat) for granting me permission for my industrial training in
the field of Embedded Systems. I express my sincere thanks to Mr. Naveen, CEO, EMTECH
Foundation for his cooperative attitude and consistent guidance, due to which I was able to complete my
training successfully. Finally, I pay my regards and gratitude to the team members and technicians of N.
C. College of Engineering, Israna (Panipat) and EMTECH Foundation, New Delhi for their
valuable help, support and guidance.
INDEX
Content
Page no.
Chapter 1
1.1 EMTECH Foundation
1.3.1
1.3.2
1.3.3
PCB Designing
1.3.4
1.3.5
1.3.6
Chapter2
2.1 Basics of Embedded Systems
10
10
10
10
11
11
12
13
13
2.5.2 Features
14
2.6 Conclusion
16
3
CHAPTER-3
3.1 Block Diagram
17
3.1.1
Reset Circuit
17
3.1.2
Power Supply
18
3.1.3
Oscillator circuit
19
3.1.4
19
19
21
3.6 CODING
28
3.7 APPLICATIONS
48
CHAPTER-4
4.1 Conclusion
49
49
REFRENCES
50
CHAPTER-1
1.1 EMTECH Foundation
EMTECH Foundation is an ISO certified Embedded Systems/ Microcontroller Training and
Consultancy Company, powered by a passion to provide the best of services in the industry. Being in IT
business for a couple of years, today it is a leading solution provider for embedded system designs across
the globe. With the enthusiastic team of highly skilled engineers, it is headquartered in New Delhi, the
capital of India. It is serving to a large number of professionals. It offers solutions to corporate clients,
train budding engineers and recruit skilled professionals. For a corporate client, it converts ideas to
technological realities, and for a professional, it converts dreams to realities. For an engineer seeking
professional degree, it helps them to attain guaranteed success by offering support and guidance.
EMTECH Foundation has been able to make a name for itself in a short span of time because of its
commitment to ensure customer satisfaction by rewarding quality work in all spheres.
PCB Designing: The connections on the PCB should be identical to the circuit diagram, but
while the circuit diagram is arranged to be readable, the PCB layout is arranged to be functional,
so there is rarely any visible correlation between the circuit diagram and the layout. PCB layout
can be performed manually (using CAD) or in combination with an auto router.
Robotics: For many people, it is a machine that imitates a human-like the androids in Star Wars,
Terminator and Star Trek: The Next Generation. However these robots capture our imagination,
such robots still only inhabit Science Fiction. People still haven't been able to give a robot enough
common reliably interact with a dynamic world.
This training is the one of its kind robotics intended to facilitate students, professionals and hobbyists
with a concrete platform for their foray into the exciting world of robotics and artificial intelligence. The
training includes basic concepts of electrical, electronics, mechanical and computer engineering, with an
elaborate learning manual, and detailed projects that will enable users to gain valuable insights into these
disciplines. The programming is based on Microchip High range (PIC18Fxxxx) 8-bit Microcontroller.
1.3.3
PCB Designing
The connections on the PCB should be identical to the circuit diagram, but while the circuit diagram is
arranged to be readable, the PCB layout is arranged to be functional, so there is rarely any visible
correlation between the circuit diagram and the layout. PCB layout can be performed manually
(using CAD) or in combination with an Auto router. The best results are usually still achieved using at
least some manual routing - simply because the design engineer has a far better judgment of how to
arrange circuitry. Surprisingly, many auto routed boards are often completely illogical in their track
routing - the program has optimized the connections, and sacrificed any small amount of order that may
have been put in place by manual routing.
1.3.4
Career Foundation Program (CFP) in Embedded Systems Design is a job oriented full time training
program for engineering graduates. It has been designed and formed by industry experts to groom young
engineers to meet the requirements of the todays industry.
1.3.5
As per AICTE norms, summer training is a part of curriculum for all engineering students of 2nd/3rd
year. The objective of training curriculum gets them the understanding of engineering fundamentals and
experiencing of its happening at industry level. STEP is a professionally designed training program to
fulfill the need with achieving utmost satisfaction of being an ENGINEER, among others.
7
1.3.6
The WRAP is a 15 days training meant for final year engineering students. This program offers best
approach towards embedded system and project design. The program comes with good reasons to
upgrade skills of engineering students for latest trends in the industry with utilization.
the
systems
controlling nuclear
power
plants.
Complexity
varies
from
low,
with
single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a
large chassis or enclosure. Embedded systems are designed to do some specific task, rather than be a
general-purpose computer for multiple tasks. Some also have real-time performance constraints that must
be met, for reasons such as safety and usability. Others may have low or no performance requirements,
allowing the system hardware to be simplified to reduce costs.
CHAPTER-2
2.1 Basics of Embedded Systems
An embedded system is a combination of computer hardware and software, either fixed in capability or
programmable, that is specifically designed for a particular function within a time constraint.
An embedded system is a computer system designed for specific control functions within a larger system,
often with real-time computing constraints. It is embedded as a part of a complete device, often including
hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal
computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems
control many devices in common use today.
Embedded systems contain processing cores that are typically either microcontrollers or digital signal
processors (DSP). The key characteristic, however, is being dedicated to handle a particular task. Since
the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size
and cost of the product and increase the reliability and performance. Some embedded systems are massproduced, benefiting from economies of scale.
Physically embedded systems range from portable devices such as digital watches and MP3 players, to
large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear
power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple
units, peripherals and networks mounted inside a large chassis or enclosure. Industrial machines,
automobiles, medical equipments, cameras, household appliances, airplanes, vending machines and toys
are among possible hosts of an embedded system.
Embedded systems that are programmable are provided with programming interfaces, and embedded
systems programming is a specialized occupation. Certain operating systems or language platforms are
tailored for the embedded market, such as Embedded Java and Windows XP Embedded.
2.2 Concept of Embedded Systems in C
An embedded system is a system that connects the preprogrammed software on a controlled embedded in
the computer hardware. The software is installed on the controller, the brains of the electronic device.
Each embedded system is used for one specific function. A complex device like a smart phone may have
embedded devices that can control several functions. However, embedded systems are not as complex or
9
programmable as a personal computer. C is one of the most commonly used programming languages in
embedded devices. Embedded systems are used to control electronic devices such as DVD players, cell
phones, watches and medical devices. Video cards and network switches are embedded systems used in
computer peripherals. The cruise control and anti-lock brakes in a car are also embedded systems.
Embedded systems are cheaper than complex processors due to their simplicity and frequent mass
production. Software written in a language like C is used to control the mechanical devices within the
embedded system.
2.2.1 C is Common in Embedded Systems
C is one of the most commonly used software languages used on embedded device controllers. One
reason is because it is one of the few software languages that operates on both 8 bit controllers and 64 bit
PCs, meaning that many computer programmers can write C software for both personal computers and
embedded devices. The C language can also use very simple commands to control the device, freeing up
the limited memory of the device to hold many commands or parameters. C can be written for both
microcontrollers and digital signal processors.
2.2.2 C Languages Used in Embedded Systems
C and C++ are the most frequently used languages in the creation of embedded systems. Embedded
systems are rarely programmed using the C++ because embedded systems rarely have the memory space
for the complex programming used in C++. It is occasionally used on embedded Linux systems.
2.2.3 How C Programs are Created and Installed on Embedded Systems
Code is written in C on a programmers PC. Code is run through a compiler on the programmers PC to
create a software program. The embedded system software may be run through a simulator on the
programmers computer. The software program is copied onto the controller using a programmer. The
controller is then tested on a test bed to ensure that it works properly.
2.2.4 Common Embedded Systems that Use C
Bluetooth devices are programmed in C. PIC microcontrollers such as those used in web cameras are
frequently programmed in C. PIC microcontrollers programmed in C have also been used in LED (Light
Emitting Diodes) devices and LCD (Liquid Crystal Display) monitors. USB devices are embedded
devices frequently coded in C.
10
It is easier and less time consuming to write in C language than an assembly language.
Assembly is the fastest, however, it is difficult to find or train assembly experts. Then if a new
processor is required, a start over is required!
C is mid-level, lots of good C programmers are available, C compilers are available. C can be
used on 8-, 16-, 32-, and 64-bits processors.
11
An embedded system is typically a design making use of the power of a small microcontroller, like the
Microchip PICmicro MCU or dsPIC Digital Signal Controller (DSCs). These microcontrollers combine a
microprocessor unit (like the CPU in a desktop PC) with some additional circuits called peripherals,
plus some additional circuits on the same chip to make a small control module requiring few other
external devices. This single device can then be embedded into other electronic and mechanical devices
for low-cost digital control.
MPLAB IDE (Integrated Development Environment) is used for editing, compiling codes as well as
simulating them using an inbuilt simulator. It is a software program that runs on a PC to develop
applications for Microchip microcontrollers. It is called an Integrated Development Environment, or IDE,
because it provides a single integrated environment to develop code for embedded microcontrollers.
The following steps are followed to program the PIC16F877A
MCLR/VPP - Master Clear (input) or programming voltage (output).Master Clear (reset) input.
This pin is an active low reset to the device. VPP is programming voltage input.
PORTB- It is a bi-directional I/O port. PORTB can be software programmed for internal weak
pull-up on all inputs.
PORTD- It is a bi-directional I/O port or parallel slave port when interfacing to a microprocessor
bus.
OSC1/CLK1- It is oscillator crystal input or external clock source input. CLK1 is external clock
source input and is always associated with pin function OSC1.
2.5.2 Features
High Performance RISC CPU
All single cycle instructions except for program branches, which are two-cycle
Harvard Architecture
Instruction pipelining
Peripheral Features
Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via external
crystal/clock
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
CMOS Technology
2.6 Conclusion
An embedded system is a combination of computer hardware and software, either fixed in capability or
programmable. C remains a very popular language for micro-controller developers due to the code
efficiency and reduced overhead and development time. C offers low-level control and is considered
more readable than assembly. Many free C compilers are available for a wide variety of development
platforms. The compilers are a part of an IDEs with ICD support, breakpoints, single-stepping and an
assembly window. The performance of C compilers has improved considerably in recent years, and they
are claimed to be more or less as good as assembly, depending on who you ask. Most tools now offer
options for customizing the compiler optimization. Additionally, using C increases portability, since C
code can be compiled for different types of processors.
16
CHAPTER-3
3.1 BLOCK DIAGRAM
Reset Circuit
It is MCLR - Master Clear Reset at Pin number 1. If PIC reads 0V at MCLR pin, it will reset the program, so if the
MCLR pin is not connected with 5V, PIC will remain reset and the program will not execute. The MCLR pin can
be connected directly with 5V (series with resistor likes picture below) but you will unable to reset if your system
goes wrong. So, a switch is used. But simply a switch between the 5V and the reset pin cannot be added. So a Pull
up Resistor is used. The correct way to add up a switch in order to create the logic condition is shown below.
When the switch is not pushed, current will flow trough 10K resistor and MCLR Pin. As a result, MCLR Pin will
receive 5V and PIC will read it as logic 1. But when switch is pushed, current will flow through 10K resistor,
switch and directly to ground. There is no voltage will receive at MCLR Pin. This gives logic 0 at MCLR Pin.
17
3.1.1
Power Supply
18
The supply pin of PIC16F877A IC is the most important. The ideal voltage for PIC16F887A is 5V
3.1.2
Oscillator circuit
There are two pins named as OSC1 and OSC2. You can connect the crystal oscillator from various frequencies.
Pulse generated from the oscillator will some time have noise. To reduce the noise, two capacitors in Pico farad
values are needed. The value of capacitor depends on the speed of oscillator that is used. Here a crystal oscillator at
4MHz is used for its efficient operation.
19
3.1.3
The LCD is used to display some message or data. There are two types of LCD graphical and character.
Graphical LCD are used to display some image or message. This consists of small crystal pixels. And
character LCD is used to display symbol, character and numbers. The character LCD takes the ASCII
values as input. The diagram shows the 16X2 LCD which means 16 columns and 2 rows to display
character and data. The IC used for the LCD is HD44780. This IC consist of the 8 bit processor and 2
RAMS, i.e. 1 DDRAM( data display RAM) and CGRAM(character generator RAM ).
20
C2
C3
RV1
LCD1
1k
LM016L
D0
D1
D2
D3
D4
D5
D6
D7
7
8
9
10
11
12
13
14
RS
RW
E
4
5
6
1
2
3
VSS
VDD
VEE
68%
R1
10k
C1
1uF
22pF
X1
CRYSTAL
22pF
U1
1
2
3
4
5
6
7
14
13
33
34
35
36
37
38
39
40
10k R11
10k 10k
10kR10
RE3/MCLR/VPP
RC0/T1OSO/T1CKI
RC1/T1OSI/CCP2
RA0/AN0/ULPW U/C12IN0RC2/P1A/CCP1
RA1/AN1/C12IN1RC3/SCK/SCL
RA2/AN2/VREF-/CVREF/C2IN+ RC4/SDI/SDA
RA3/AN3/VREF+/C1IN+
RC5/SDO
RA4/T0CKI/C1OUT
RC6/TX/CK
RA5/AN4/SS/C2OUT
RC7/RX/DT
RA6/OSC2/CLKOUT
RA7/OSC1/CLKIN
RD0
RD1
RB0/AN12/INT
RD2
RB1/AN10/C12IN3RD3
RB2/AN8
RD4
RB3/AN9/PGM/C12IN2RD5/P1B
RB4/AN11
RD6/P1C
RB5/AN13/T1G
RD7/P1D
RB6/ICSPCLK
RB7/ICSPDAT
RE0/AN5
RE1/AN6
RE2/AN7
15
16
17
18
23
24
25
26
19
20
21
22
27
28
29
30
8
9
10
D1
LED-RED
PIC16F887
D2
R13
R12
LED-RED
21
where I is the current through the conductor in units of amperes, V is the potential difference
measured across the conductor in units of volts, and R is the resistance of the conductor in units of
ohms.
The ratio of the voltage applied across a resistor's terminals to the intensity of current in the
circuit is called its resistance, and this can be assumed to be a constant (independent of the
voltage) for ordinary resistors working within their ratings.
Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in
electronic equipment. Practical resistors can be made of various compounds and films, as well as
resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are also
implemented within integrated circuits, particularly analog devices, and can also be integrated
into hybrid and printed circuits.
fig.3.5 resistor
The ohm (symbol: ) is the SI unit of electrical resistance, named after Georg Simon Ohm. An
ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured over a very
large range of values, the derived units of milliohm (1 m = 10 3 ), Kohm (1 k = 103 ), and
mega ohm (1 M = 106 ) are also in common usage.
22
23
diode (now rarely used except in some high-power technologies) is a vacuum tube with two
electrodes a plate and a cathode.
The most common function of a diode is to allow an electric current to pass in one direction
(called the diode's forward direction), while blocking current in the opposite direction (the reverse
direction). Thus, the diode can be thought of as an electronic version of a check value. This
unidirectional behavior is called rectification and is used to convert electric current to direct
current, and to extract modulation from radio signals in radio receivers.
However, diodes can have more complicated behavior than this simple onoff action.
Semiconductor diodes do not begin conducting electricity until a certain threshold voltage is
present in the forward direction (a state in which the diode is said to be forward biased). The
voltage drop across a forward biased diode varies only a little with the current, and is a function
of temperature; this effect can be used as a temperature sensor or voltage reference.
Semiconductor diodes have nonlinear electrical characteristics, which can be tailored by varying
the construction of their PN junction. These are exploited in special purpose diodes that perform
many different functions. For example, diodes are used to regulate voltage (zener diodes) to
protect circuits from high voltage surges to electronically tune radio and TV receivers (varactor
diodes)
to generate radio frequency oscillations and to produce light (light emitting diodes)
Tunnel diodes exhibit negative resistance which makes them useful in some types of circuits.
Diodes were the first semiconductor electronic device. The first semiconductor diodes, called
cats whisker diodes developed around 1906, were made of mineral crystals such as galena
Today most diodes are made of silicon , but other semiconductors such as are germanium
sometimes used.
24
LED: A light-emitting diode (LED) is a semiconductor light source. Leds are used as indicator
lamps in many devices and are increasingly used for other lighting Introduced as a practical
electronic component in 1962, early Leds emitted low-intensity red light, but modern versions
are available across the visible, ultraviolet and infrared wavelengths, with very high brightness.
When a light-emitting diodes is forward biased (switched on), electrons are able to recombine
with electron holes within the device, releasing energy in the form of photons This effect is
called electroluminescence and the color of the light (corresponding to the energy of the photon)
is determined by the energy gap of the semiconductor. Leds are often small in area (less than
1 mm2), and integrated optical components may be used to shape its radiation pattern. Leds
present many advantages over incandescent light sources including lower energy consumption,
longer lifetime.
25
Fixe three-terminal linear regulators are commonly available to generate fixed voltages of plus 3
V, and plus or minus 5 V, 6V, 9 V, 12 V, or 15 V when the load is less than 1.5 amperes.
The "78 xx" series (7805, 7812, etc.) regulate positive voltages while the 79xx series (7905, 7912,
etc.) regulate negative voltages. Often, the last two digits of the device number are the output
voltage; e.g., a 7805 is a +5 V regulator, while a 7915 is a -15 V regulator. There are variants on
the 78xx series ICs, such as 78L and 78S, some of which can supply up to 1.5 Amps. Adjusting
fixed regulators several ways are used to make fixed IC regulators adjustable. A zener diode or
resistor is added between the IC's ground terminal and ground. Resistors are acceptable where
ground current is constant, but are ill-suited to regulators with varying ground current. Switching
in different zeners, diodes or resistors can be used to obtain stepwise adjustment.
26
fig.3.10 pic16f887
There are 5 ports in the pic microcontroller named port A, B, C, D and E. Port A has 5 pins, Port
B,C & D has 8 pins and Port E has 3 pins. Pin 1 is for reset circuit. Pin 13 and 14 is for the
oscillatory circuit that produces the desirable frequency. Pins 11 and 32 are for the ground and
Pins 12 and 31 is used for the Vcc.
LCD: The LCD is used to display some message or data. There are two types of LCD graphical
fig.3.11 LCD
and character. Graphical LCD are used to display some image or message. This consists of
smallcrystal pixels. And character LCD is used to display symbol, character and numbers. The
character LCD takes the ASCII values as input. The diagram shows the 16X2 LCD which means 16
columns and 2 rows to display character and data. The IC used for the LCD is HD44780. This IC
27
consist of the 8 bit processor and 2 RAMS, i.e. 1 DDRAM( data display RAM) and
CGRAM(character generator RAM ).
The 16x2 LCD used here has 16 pins out of which 8 pins are data lines, they are directly connected to
the controller. The third pin is connected to the potentiometer for the brightness. Three pins 1, 5 and
16 are connected to ground. Pins 2 and 15 are connected to power supply.
pins are EN and RS. EN stands for Enable which latches (accepts) the data or the command given to
the LCD and RS stands for Register Select. It is used for selecting command or data registers.
Crystal Oscillator: A crystal oscillator is an electronic oscillator circuit that uses the
mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with
a very precise frequency. This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize
frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator
used is the quartz crystal, so oscillator circuits designed around them became known as "crystal
oscillators."
28
conveniently related to some other desired frequency, so hundreds of standard crystal frequencies are
made in large quantities and stocked by electronics distributors.
Switch: It is a momentary or non-latching switch which causes a temporary change in the state
of an electrical circuit only while the switch is physically actuated. An automatic mechanism (a
spring) returns the switch to its default position immediately afterwards, restoring the initial
circuit condition. There are two types:
A push to make switch allows electricity to flow between its two contacts when held in. When the
button is released, the circuit is broken.
A push to break switch does the opposite, i.e., when the button is not pressed, electricity can flow,
but when it is pressed the circuit is broken.
3.6 CODING
#include <pic.h>
#define LCD PORTB
#define RS RD6
#define EN RD7
int lnum,a,b,c,d,e,f,i=0,p=0,p3=0;
char arr4[]={"ENTER PASSWORD "};
char arr1[4]={"1234"};
char check[4]={"1355"};
char arr[4]={0};
char arrs[4]={0};
29
"};
void data()
{
RS=1;
EN=1;
30
delay(10);
EN=0;
delay(100);
}
void reset()
{
p3=p1=0;
LCD=0X01;
command();
LCD=0X80;
command();
for(int v=0;v<9;v++)
{
PORTB=key[v];
data();
}
LCD=0Xc0;
command();
while(p3<4)
{
RC0=1;
RC1=0;
RC2=0;
RC3=0;
31
if(RC4==1)
{
while(RC4==1);
PORTB='*';
data();
arrs[p3]='1';
p3++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arrs[p3]='2';
p3++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arrs[p3]='3';
p3++;
}
if(RC7==1)
{
while(RC7==1);
32
PORTB='*';
data();
arrs[p3]='4';
p3++;
}
RC0=0;
RC1=1;
RC2=0;
RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arrs[p3]='5';
p3++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arrs[p3]='6';
p3++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
33
arrs[p3]='7';
p3++;
}
if(RC7==1)
{while(RC7==1);
PORTB='*';
data();
arrs[p3]='8';
p3++;
}
RC2=1;
RC0=RC1=RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arrs[p3]='9';
p3++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arrs[p3]='A';
p3++;
34
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arrs[p3]='B';
p3++;
}
if(RC7==1)
{while(RC7==1);
PORTB='*';
data();
arrs[p3]='C';
p3++;
}
RC3=1;
RC1=RC0=RC2=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arrs[p3]='D';
p3++;
}
if(RC5==1)
{while(RC5==1);
35
PORTB='*';
data();
arrs[p3]='E';
p3++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arrs[p3]='M';
p3++;
}
}
if(arrs[0]==check[0]&&arrs[1]==check[1]&&arrs[2]==check[2]&&arrs[3]==check[3])
{
PORTB=0X01;
command();
PORTB=0X80;
command();
for(int t=0;t<14;t++)
{
LCD=arr5[t];
data();
}
36
LCD=0XC0;
command();
while(p1<4)
{
RC0=1;
RC1=0;
RC2=0;
RC3=0;
if(RC4==1)
{
while(RC4==1);
PORTB='*';
data();
arr1[p1]='1';
p1++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arr1[p1]='2';
p1++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
37
data();
arr1[p1]='3';
p1++;
}
if(RC7==1)
{
while(RC7==1);
PORTB='*';
data();
arr1[p1]='4';
p1++;
}
RC0=0;
RC1=1;
RC2=0;
RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arr1[p1]='5';
p1++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
38
arr1[p1]='6';
p1++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arr1[p1]='7';
p1++;
}
if(RC7==1)
{while(RC7==1);
PORTB='*';
data();
arr1[p1]='8';
p1++;
}
RC2=1;
RC0=RC1=RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arr1[p1]='9';
p1++;
}
if(RC5==1)
39
{while(RC5==1);
PORTB='*';
data();
arr1[p1]='A';
p1++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arr1[p1]='B';
p1++;
}
}
LCD=0X01;
command();
LCD=0X80;
command();
for(int o=0;o<16;o++)
{
LCD=arrt[o];
data();
}
LCD=0X01;
command();
LCD=0X80;
command();
40
for(int r=0;r<16;r++)
{
LCD=arr4[r];
data();
}
LCD=0Xc0;
command();
}
else
{
LCD=0X01;
command();
LCD=0X80;
command();
for(int x=0;x<9;x++)
{
PORTB=key1[x];
data();
}
delay(20000);
LCD=0X01;
command();
LCD=0X80;
command();
for(int r=0;r<16;r++)
{
LCD=arr4[r];
41
data();
}
LCD=0Xc0;
command();
}
}
void main()
{
ANSELH=0X00;
TRISC=0XF0;
TRISD=0X00;
PORTD=0X00;
TRISB=0X00;
LCD=0X38;
command();
LCD=0X01;
command();
LCD=0X0E;
command();
LCD=0X80;
command();
RD0=RD1=RD2=0;
for(int h=0;h<16;h++)
{
PORTB=arr6[h];
42
data();
delay(100);
}
LCD=0Xc0;
command();
for(int j=0;j<16;j++)
{
PORTB=arr8[j];
data();
delay(100);
}
delay(20000);
LCD=0X01;
command();
LCD=0X80;
command();
RD2=1;
while(1)
{
p=0;
LCD=0X80;
command();
for(int k=0;k<16;k++)
{
PORTB=arr4[k];
data();
}
43
LCD=0XC0;
command();
while(p<4)
{
RC0=1;
RC1=0;
RC2=0;
RC3=0;
if(RC4==1)
{
while(RC4==1);
PORTB='*';
data();
arr[p]='1';
p++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arr[p]='2';
p++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
44
arr[p]='3';
p++;
}
if(RC7==1)
{
while(RC7==1);
PORTB='*';
data();
arr[p]='4';
p++;
}
RC0=0;
RC1=1;
RC2=0;
RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arr[p]='5';
p++;
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arr[p]='6';
45
p++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arr[p]='7';
p++;
}
if(RC7==1)
{while(RC7==1);
PORTB='*';
data();
arr[p]='8';
p++;
}
RC2=1;
RC0=RC1=RC3=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arr[p]='9';
p++;
}
if(RC5==1)
{while(RC5==1);
46
PORTB='*';
data();
arr[p]='A';
p++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arr[p]='B';
p++;
}
if(RC7==1)
{while(RC7==1);
PORTB='*';
data();
arr[p]='C';
p++;
}
RC3=1;
RC1=RC0=RC2=0;
if(RC4==1)
{while(RC4==1);
PORTB='*';
data();
arr[p]='D';
p++;
47
}
if(RC5==1)
{while(RC5==1);
PORTB='*';
data();
arr[p]='E';
p++;
}
if(RC6==1)
{while(RC6==1);
PORTB='*';
data();
arr[p]='M';
p++;
}
if(RC7==1)
{
while(RC7==1);
reset();
}
}
if(arr1[0]==arr[0]&&arr1[1]==arr[1]&&arr1[2]==arr[2]&&arr1[3]==arr[3])
{
RD0=1;
LCD=0X01;
command();
LCD=0X80;
48
command();
for(i=0;i<16;i++)
{
LCD=arr2[i];
data();
}
delay(20000);
RD0=0;
//break;
}
else
{
LCD=0X01;
command();
LCD=0X80;
command();
RD1=RD2=1;
for(i=0;i<16;i++)
{
LCD=arr3[i];
data();
}
delay(20000);
RD1=RD2=0;
//break;
}
}
49
3.7 APPLICATIONS
Banking
Home security
Confidential documents
Safe locking system
Radioactive labs
CHAPTER-4
4.1 Conclusion
The microcontroller with LCD makes it user friendly and can be embedded in a single unit. The circuit
has been implemented on bread board and tested for its.
The project did well in performing its desired task. however, we can make the password entry remotely to
make the project more reliable.
51
REFERENCES
Pic microcontroller and Embedded systems by Muhammad Ali Mazidi, Pearson International
www.google.co.in
www.migatron.com
en.wikipedia.org
www.Elecfreaks.com
52