Upload
vandna-sambyal
View
606
Download
29
Tags:
Embed Size (px)
Citation preview
Submitted By :-
Anjali Rai EC4873
Archna Dhiman EC4881
Jyoti Thakur EC 4894
Monika Chauhan EC4904
Neha Verma EC4907
Acknowledgment
Preface
Company profiles
Embedded system
Introduction
Applications of embedded system
Microcontroller
Introduction
Definition of microcontroller
Block diagram
Microprocessor
Introduction
Definition of microprocessor
Block diagram
Difference between microcontroller and microprocessor
TABLE OF CONTENT
TOPIC
Various microcontrollers
8031
8051
AT89C51
8051 microcontroller architecture
Block diagram
Pin diagram
Pin description
Microcontroller memory organization
Program memory
Data memory
Software used
Various steps to use compiler
How to debug the program
Interfacing with various devicesLED InterfacingDC MotorRelayStepper MotorSeven SegmentLCD Interfacing
Project descriptionIntroduction to projectCircuit diagram of Home Security PrototypeProject methodologyProcedureDescription in detailApplication and advantagesFuture development
Reference and Bibliography
COMPANY PROFILES
EEAST is a complete R & D organization dedicated to provide electronics andAdvanced Software Products and Solutions to its clients. Achieving the needs ofour costumer and converting their ideas to real models is our motto.
We are working in the field of Embedded systems, Automation and advancedsystem design for the last five years with the vision of becoming a center ofExcellence to provide Solutions, Services and Training in various fields oftechnologies.
EEAST is an organization providing advanced projects, complete electronicssolutions in development systems like microprocessor, micro-controllers,wireless communications, optical-fiber communications, real time operatingsystems, digital signal processing,
Embedded systems and Micro-sensors including software solution, solution inC, C++, Java, Net, Visual basic, embedded C and embedded LINUX.
INTRODUCTION TO EMBEDDED SYSTEMS
An Embedded System employs a combination of hardware & software (a“ computational engine”) to perform a specific function; is part of alarger system that may not be a “computer works in a reactive and time-constrained environment. Software is used for providing features andflexibility. Hardware ={Processors, ASICs, Memory...} is usedfor performance (& sometimes security )
An embedded system is a special purpose system in which the computeris completely encapsulated by the device it controls.
Unlike a general purpose computer, such as a PC, an embedded systemperforms predefined task’s usually with very specific tasks designengineers can optimize it reducing the size and cost of the product.Embedded systems are often mass produced, so the cost savings may bemultiplied by millions of items.
The core of any embedded system is formed by oneor several microprocessor or micro controllerprogrammed to perform a small number of tasks.In contrast to a general purpose computer, whichcan run any software application, the user chooses,the software on an embedded system is semi-permanent, so it is often called firmware.
APPLICATIONS OF EMBEDDED SYSTEM Automated tiller machines (ATMS). Avionic, such as inertial guidance systems, flight control hardware /software
and letter integrated system in aircraft and missile. Cellular telephones and telephonic switches. Computer network equipment, including routers timeservers and firewalls Computer printers, Copiers .Disk drives (floppy disk drive and hard disk drive) Engine controllers and antilock brake controllers for automobiles. Home automation products like thermostat, air conditioners sprinkles and
security monitoring system. House hold appliances including microwave ovens, washing machines, TV sets
DVD players/recorders. Medical equipment Stationary video game controllers. Wearable computers. Measurement equipment such as digital storage oscilloscopes, logic analyzers
and spectrum analyzers. Multimedia appliances: internet radio receivers, TV set top boxes.
MICROPROCESSOR (MPU)
A microprocessor is a general-purpose digitalcomputer central processing unit (CPU). Althoughpopularly known as a “computer on a chip”is in no sense a complete digital computer. Theblock diagram of a microprocessor CPU is shown,which contains an arithmetic and logical unit (ALU),program counter (PC), a stack pointer (SP),someworking registers, a clock timing circuit, and interruptcircuits.
BLOCK DIAGRAM OF MICROPROCESSOR
The prime use of microprocessor is to read data, performextensive calculations on that data and store them in themass storage device or display it. The prime functions ofmicrocontroller is to read data, perform limitedcalculations on it, control its environment based on thesedata.
Thus the microprocessor is said to be general-purposedigital computers whereas the microcontroller are intendto be special purpose digital controller.
Microprocessor need many opcodes for moving data fromthe external memory to the CPU, microcontroller mayrequire just one or two, also microprocessor may have oneor two types of bit handling instructions whereasmicrocontrollers have many.
Lastly, the microprocessor design accomplishes thegoal of flexibility in the hardware configuration byenabling large amounts of memory and I/O that couldbe connected to the address and data pins on the ICpackage. The microcontroller design uses much morelimited set of single and double byte instructions tomove code and data from internal
Microcontroller Microcontroller, as the name suggests, are small contro
llers. They are like single chip computers that are oftenembedded into other systems to function asprocessing/controlling unit. For example, the remotecontrol you are using probably has microcontrollersinside that do decoding and other controllingfunctions. They are also used in automobiles, washingmachines, microwave ovens, toys ... etc, whereautomation is needed
The key features of microcontrollers include: High Integration of Functionality
Microcontrollers sometimes are called single-chipcomputers because they have on-chip memory andI/O circuitry and other circuitries that enable them tofunction as small stand alone computers without othersupporting circuitry.
Field Programmability, Flexibility
Microcontrollers often use EEPROM or EPROM astheir storage device to allow field programmability sothey are flexible to use. Once the program is tested tobe correct then large quantities of microcontrollerscan be programmed to be used in embedded systems
A Timer module to allow the microcontroller toperform tasks for certain time periods.
A serial I/O port to allow data to flow between themicrocontroller and other devices such as a PC oranother microcontroller.
An ADC to allow the microcontroller to acceptanalogue input data for processing
The design incorporates all of the features found in microprocessor CPU: ALU, PC, SP, and registers. It also added the other features needed to make a complete computer: ROM, RAM, parallel I/O, serial I/O, counters, and clock circuit
DIFFERENCE BETWEEM MICROPROCESSOR AND MICROCONTROLLER
MICROPROCESSORS MICROCONTROLLERS1.Microprocessors contain no 1.
Microcontrollers have an internal RAM or ROM. RAM and a ROM
2. Microprocessor don’t have any I/O 2.Microcontrollers have I/O
ports.Ports.3. Advantage of versatility. 3. Advantage of less power
consumption.4. Expensive. 4. Cheaper in comparison.5. With the addition of external RAM 5. Occupies less space.And ROM, the system is more bulky.
VARIOUS MICROCONTROLLERS First microcontroller is ‘8031’
FEATURES
1. It is Intel’s product. Neither a microprocessor nor amicrocontroller.
2. It is 8-bit controller.
3. Internally no RAM is provided i.e. code is outside the chip.
Second microcontroller is ‘8051’
FEATURES
1. It is first complete 8-bit microcontroller.
2. It is a name of a family. In which the instruction set, pinconfiguration, architecture are same, only memory storagecapacity is different.
3. Internally PROM (programmable read only memory) isprovided so it called one time programmable (OTP)
Third microcontroller is ‘AT89C51’
FEATURES
1. It is similar to 8051 microcontroller i.e. having sameinstruction set, pin configuration, architecture.
2. It is also 8-bit microcontroller. It’s cost is only Rs 10 morethan 8051.
3. It uses EPROM (erasable programmable read onlymemory) or FLASH memory.
4. It is multiple time programmable (MTP) i.e. 1000 times.So it is better than 8051.
ATMEL 89C51 It is a lower-power, high-performance CMOS 8-bit
microcomputer with 4K bytes of Flash programmable anderasable read only memory (PEROM).
The device is manufactured using Atmel’s high-densitynonvolatile memory technology and is compatible with theindustry-standard MCS-51 instruction set and pin out. Theon chip Flash allows the program memory to bereprogrammed in system or by a conventional nonvolatilememory programmer.
By combining a versatile 8-bit CPU with Flash on amonolithic chip, the Atmel AT89C51 is a powerfulmicrocontroller, which provides a highly flexible and cost-effective solution to many embedded control applications.
THE 8051
MICROCONTROLLER
The 8051 provides the following standard features:
• 4k bytes of ROM, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, and five vector two-level interruptarchitecture, a full duplex serial port, on- chip oscillatorand clock circuitry
• In addition, the 8051 is designed with static logic foroperation down to zero frequency and supports twosoftware selectable power saving modes.
ON-CHIP
ROM for
program
code
EXTERNAL
INTERRUPTS
ON-CHIP RAM
ETC.
TIMER 0
CPU
OSCBUS
CONTROL
4 I/O
PORTS
SERIAL
PORT
TXD RXD
BLOCK DIAGRAM OF MICROCONTROLLER
THE 8051 MICROCONTROLLER’S ARCHITECTURE Eight bit CPU with registers A (the accumulator) & B. Sixteen bit program counter (PC) and data pointer (DPTR). Eight bit program status word (PSW). Eight bit stack pointer (SP). Internal ROM or EPROM. Internal RAM of 128 bytes
Four register banks, each containing eight registers.Sixteen bytes, which may be addressed at the bit level.Eight bytes of general-purpose data memory.
Thirty two I/O pins arranged as four-bit ports P0-P3. Two 16-bit timer/counters T0 and T1. Full duplex serial data received/transmitter. Two external and three internal interrupt sources.
PIN DESCRIPTION Vcc
Pin 40 provides supply voltage to the chip. The voltage source is +5 V. GND
Pin 20 is the ground.
X1 and X2
The 8051 have an on-chip oscillator but requires external clock to run it. Mostoften a quartz crystal oscillator is connected to input X1 (pin 19) and X2 (pin18).
RESET
Pin 9 is the reset pin. It is an input and is active high (normally low).
EA
EA, which stands for “external access,” is pin number 31 in the DIPpackages. It is input pin and must be connected to either Vcc or GND. Inother words, it cannot be left unconnected.
PSEN
This is an output pin. PSEN stands for “program store enable.” It is
the read strobe to external program memory
ALE
ALE (Address latch enable) is an output pin and is active high
I/O port pins
The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as output, ready to be used as output ports. To use any of these as input port, it must be programmed.
Software Used
The Keil 8051 Development Tools are designed tosolve the complex problems facing embeddedsoftware developers.
When starting a new project, simply select themicrocontroller you use from the Device Database andthe µVision IDE sets all compiler, assembler, linker,and memory options for you.
INTERFACING WITH VARIOUS DEVICES:LED INTERFACING CIRCUIT DIAGRAM
D3
LED
C?CAP NP
D7
LED
D4
LED
D5
LED
D8
LED
U?
AT89C52
91819 29
30
31
12345678
2122232425262728
1011121314151617
3938373635343332
RSTXTAL2XTAL1 PSEN
ALE/PROG
EA/VPP
P1.0/T2P1.1/T2-EXP1.2P1.3P1.4P1.5P1.6P1.7
P2.0/A8P2.1/A9
P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15
P3.0/RXDP3.1/TXD
P3.2/INTOP3.3/INT1
P3.4/TOP3.5/T1
P3.6/WRP3.7/RD
P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7
D1
LED
R1R
40
D2
LED
Y?
CRYSTAL
VCC
D6
LED
20
Like a normal diode, an LED consists of a chip of semiconductingmaterial impregnated, or doped, with impurities to create a p-njunction.
LEDs are usually built on an n-type substrate, with an electrodeattached to the p-type layer deposited on its surface. P-type substrates,while less common, occur as well.
Many commercial LEDs, especially GaN/InGaN, also use sapphiresubstrate. Substrates that are transparent to the emitted wavelength,and backed by a reflective layer, increase the LED efficiency.
The refractive index of most LED semiconductors is quite high, so inalmost all cases the LED is coupled into a much lower-index medium.
The large index difference makes the reflection quite substantial (perthe Fresnel coefficients), and this is usually one of the dominant causesof LED inefficiency.
Often more than half of the emitted light is reflected back at the LED-package and package-air interfaces impurities to create a p-n junction.
There are two methods of LED interfacing:
Common Anode Method
Common Cathode Method
Here we have employed Common Anode Method
FOUR ON FOUR OFF PATTERN
#include<reg51.h> // this file contains the Ports and SFR address of 8051#include<delay.h> // this file is used to produce seconds and milliseconds delay#define led P1 // 'P1' is given the another name as ‘led’, u can use 'led' Or
directly 'P1'//for programming
Void main () // main program starts from here{while (1) // Repeat forever{led=0xf0; // light on lower 4 leds '0'-> ON (11110000)secdelay (1); // 1 secdelayled=0x0f; // light on upper 4 leds '1'-> OFF (00001111)secdelay (1);}}
DC MOTOR INTERFACINGCircuit Diagram
1 2
VCC
Y1
G R O U N D
1 0 U FU1
8051
31
19
18
9
12131415
12345678
3938373635343332
2122232425262728
1716
29
301110
40
20
EA/VP
X1
X2
RESET
INT0INT1T0T1
P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7
P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7
P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7
RDWR
PSEN
ALE/PTXDRXD
VCC
VSS
SW1
RE
SE
T S
/W
12
VCC
C2
1 2
S 3
1 0 K
S 11 2
S 2
MG2
M O T O R D C
12
U5
U L 2 0 0 3
1
2
3
4
5
6
7
8 9
10
11
12
13
14
15
16IN1
IN2
IN3
IN4
IN5
IN6
IN7
GRD VCC
OUT7
OUT6
OUT5
OUT4
OUT3
OUT2
OUT1
D E V I C E
K1
R E L A Y S P D T
35
412
C3
C
R2
R E S I S T O R S I P 1 0
123456789
10
3 3 P F
C R Y S T A L3 3 P F
VCC
C1
R1
Working Principle
The principle upon which the d.c. motor works is very
simple. If a current carrying conductor is placed in a
magnetic field, mechanical force is experienced on the
conductor, the direction of which is given by the Fleming's
left hand rule and hence the conductor moves in the
direction of force. The magnitude of the mechanical force
experienced on the conductor is given by:
F = B Ic Lc newton
where B is the field strength in teslas,
Ic is the current flowing through the conductor in amperes
and Lc is the length of the conductor in metres.
ON -OFF DC MOTOR
#include<reg51.h>
#include<delay.h>
/* define the motor using sbit as dc motor */
sbit dc_motor=P0^5;
#define ON 1
#define OFF 0
void main()
{
while(1)
{
dc motor=ON; // switch on the Dc motor
secdelay(3);
dc_motor=OFF; // switch OFF the Dc motor
secdelay(2);
}
}
RELAY INTERFACING
ELECTROMAGNETIC solenoid valve
The electromagnetic relay consists of a multi-turn coil,wound on an iron core, to form an electromagnet.
When the coil is energised, by passing current through it,the core becomes temporarily magnetised. The magnetisedcore attracts the iron armature. The armature is pivotedwhich causes it to operate one or more sets of contacts.
When the coil is de-energised the armature and contactsare released. The coil can be energised from a low powersource such as a transistor while the contacts can switchhigh powers such as the mains supply.
The relay can also be situated remotely from the controlsource. Relays can generate a very high voltage across thecoil when switched off. This can damage other componentsin the circuit.
To prevent this a diode is connected across the coil.
As there are always some chances of high voltage spikes back from the switching circuit i.e. heater so an up to coupler/isolator MCT2e is used.
It provides and electrical isolation between the microcontroller and the heater
CIRCUIT DIAGRAM
1 2
VCC
Y1
G R O U N D
1 0 U FU1
8051
31
19
18
9
12131415
12345678
3938373635343332
2122232425262728
1716
29
301110
40
20
EA/VP
X1
X2
RESET
INT0INT1T0T1
P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7
P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7
P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7
RDWR
PSEN
ALE/PTXDRXD
VCC
VSS
SW1
RE
SE
T S
/W
12
VCC
C2
1 2
S 3
1 0 K
S 11 2
S 2
MG2
M O T O R D C
12
U5
U L 2 0 0 3
1
2
3
4
5
6
7
8 9
10
11
12
13
14
15
16IN1
IN2
IN3
IN4
IN5
IN6
IN7
GRD VCC
OUT7
OUT6
OUT5
OUT4
OUT3
OUT2
OUT1
D E V I C E
K1
R E L A Y S P D T
35
412
C3
C
R2
R E S I S T O R S I P 1 0
123456789
10
3 3 P F
C R Y S T A L3 3 P F
VCC
C1
R1
SIMPLE RELAY CONTROL
#include<reg51.h>
#include<delay.h>
sbit dev=P0^6; // define the 220v device using sbit as dev
#define ON 1
#define OFF 0
void main()
{
while(1)
{
dev=ON;
secdelay(5);
dev=OFF;
secdelay(3);
}
}
STEPPER MOTOR A stepper motor is an electromechanical device which converts
electrical pulses into discrete mechanical movements. Steppermotor is a form of ac. motor .
The shaft or spindle of a stepper motor rotates in discrete stepincrements when electrical command pulses are applied to it inthe proper sequence.
The motors rotation has several direct relationships to theseapplied input pulses.
The sequence of the applied pulses is directly related to thedirection of motor shafts rotation.
The speed of the motor shafts rotation is directly related to thefrequency of the input pulses and the length of rotation isdirectly related to the number of input pulses applied
For every input pulse, the motor shaft turns through aspecified number of degrees, called a step.
Its working principle is one step rotation for oneinput pulse. The range of step size may vary from0.72 degree to 90 degree.
A stepper motor differs from a conventional motor (CM)
as under:
Input to SM is in the form of electric pulses whereasinput to a CM is invariably from a constant voltagesource.
A CM has a free running shaft whereas shaft of SMmoves through angular steps.
In control system applications, no feedback loop isrequired when SM is used but a feedback loop isrequired when CM is used.
A SM is a digital electromechanical device whereas aCM is an analog electromechanical device .
CIRCUIT DIAGRAM
R1
VCC
1 0 K
Y1
3 3 P F
VCC
S 11 2
1 2
C1
U1
8051
31
19
18
9
12131415
12345678
3938373635343332
2122232425262728
1716
29
301110
40
20
EA/VP
X1
X2
RESET
INT0INT1T0T1
P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7
P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7
P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7
RDWR
PSEN
ALE/PTXDRXD
VCC
VSS
C R Y S T A L
S 2
C2
VCC
3 3 P F
MG1M O T O R S T E P P E R
123
4 5 6
1 2
C3
1 0 U F
G R O U N D
S 3
U5
U L 2 0 0 3
1
2
3
4
5
6
7
8 9
10
11
12
13
14
15
16IN1
IN2
IN3
IN4
IN5
IN6
IN7
GRD VCC
OUT7
OUT6
OUT5
OUT4
OUT3
OUT2
OUT1
C
R2
R E S I S T O R S I P 1 0
123456789
10
SW1
RE
SE
T S
/W
12
DIRECTION CONTROL
#include<reg51.h>#include<delay.h>sbit m1=P0^0; // define the four windings of stepper motor using sbit m1,m2,m3,m4
sbit m2=P0^1;sbit m3=P0^2;sbit m4=P0^3;void mov_clk(){
m1=1;m2=0;m3=0;m4=0; //give high pulse to m1 motor moves one step angle in// clockwise
ms_delay(200);m1=0;m2=1;m3=0;m4=0; //give high pulse to m2 motor moves two step angle in
// clockwisems_delay(200);
m1=0;m2=0;m3=1;m4=0; //give high pulse to m3 motor moves three step angle in// clockwise
ms_delay(200);m1=0;m2=0;m3=0;m4=1; //give high pulse to m4 motor moves four step angle in// clockwise
ms_delay(200);}
void mov_anticlk(){
m1=0;m2=0;m3=0;m4=1; //give high pulse to m4 motor moves one step angle in
// anti clockwisems_delay(200);
m1=0;m2=0;m3=1;m4=0;ms_delay(200);m1=0;m2=1;m3=0;m4=0;ms_delay(200);m1=1;m2=0;m3=0;m4=0;ms_delay(200);
}void motor_stop(){m1=0;m2=0;m3=0;m4=0;}
void main(){
while(1){
mov clk(); // motor moves in clock wise direction
motor stop(); // motor stopssecdelay(2);mov anticlk(); // motor moves in
anticlock wise direction motor stop(); // motor stopssecdelay(2);
}}
SEVEN SEGMENT INTERFACING
The seven-segment LED display has four individualdigits, each with a decimal point.
Each of the seven segments (and the decimal point) ina given digit contains an individual LED.
When a suitable voltage is applied to a given segmentLED, current flows through and illuminates thatsegment LED. By choosing which segments toilluminate, any of the nine digits can be shown
Seven segment displays come in two varieties -common anode (CA) and common cathode (CC).
In a CA display, the anodes for the seven segments andthe decimal point are joined into a single circuit node.
To illuminate a segment in a CA display, the voltage ona cathode must be at a suitably lower voltage (about.7V) than the anode.
In a CC display, the cathodes are joined together, andthe segments are illuminated by bringing the anodevoltage higher than the cathode node (again, by about.7V).
The Digilab board uses CA displays.
Circuit diagram
VCC
U 2
7 - s e g m e n t
5 4 3 2 110
9876g f
vcc a b
hcvcc
de
1 0 U F
L E D 3
SW1
RE
SE
T S
/W
12
1 2
L E D 7
L E D 4
C2
L E D 2
1 0 K
1 2
U1
8051
31
19
18
9
12131415
12345678
3938373635343332
2122232425262728
1716
29
301110
40
20
EA/VP
X1
X2
RESET
INT0INT1T0T1
P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7
P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7
P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7
RDWR
PSEN
ALE/PTXDRXD
VCC
VSS
S 11 2
VCC
G R O U N D
C R Y S T A L3 3 P F
L E D 1
3 3 P F
Y1
R2
4 7 0 E
S 2
L E D 5
S 3
V C C ( 5 V )
C3
L E D 8
R1
C1
L E D 6
UP COUNTER
#include<reg51.h>#include<delay.h>#define seg_port P2 //define segment port// array is used to store the value of data to be sent on the port to display // any digit on seven segment as belowunsigned char seg_array[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};void main(){unsigned char count;
while(1){
for(count=0;count<10;count++){
seg_port=seg_array[count]; // put array digit value from array to the port secdelay(1);
}}
}
LCD
LCDDisplay
Liquid crystal displays (LCD) are widely used in recentyears as compares to LEDs. This is due to the decliningprices of LCD, the ability to display numbers,characters and graphics, incorporation of a refreshingcontroller into the LCD, their by relieving the CPU ofthe task of refreshing the LCD and also the ease ofprogramming for characters and graphics. HD 44780based LCDs are most commonly used.
LCD pin description
Vcc
1615141312111098
654321
7
1615141312111098
654321
7
D7
E
Vcc
D4
ContrastRS
Gnd
R/W
Gnd
D0
D3
D6D5
13
2
D2D1
Pin Symbol I/O Description
1 VSS - Ground
2 VCC - +5V power supply
3 VEE - Power supply to control contrast
4 RS I RS=0 to select command register, RS=1 to select data register.
5 R/W I R/W=0 for write, R/W=1 for read
6 E I/O Enable
LCD pin description
Pin Symbol I/O Description
7 PB0 I/O The 8 bit data bus
8 PB1 I/O The 8 bit data bus
9 DB2 I/O The 8 bit data bus
10 DB3 I/O The 8 bit data bus
11 DB4 I/O The 8 bit data bus
12 DB5 I/O The 8 bit data bus
13 DB6 I/O The 8 bit data bus
14 DB7 I/O The 8 bit data bus
Circuit diagram
LCD FUNCTION
#include<reg51.h>#include<delay.h>#define DATA P1 // define DATA and Control Pins of LCDsbit RS=P3^5;sbit RW=P3^6;sbit E=P3^7;
void lcd_cmd(unsigned char data x) // function to write command at lcd port {
ms_delay(20);DATA=data x;RS=0; //clear RS (i.e. RS=0) to write commandRW=0; // write operationE=1; // send H-L pulse at E pinms_delay(5);E=0;
}
void lcd_data (unsigned char datax) // function to write data at lcd port {
ms_delay(20);DATA=datax;RS=1; // set RS=1 to write DATARW=0; // write operation
E=1; // send H-L pulse at E pinms_delay (5);E=0;
}void lcd_init() // function to initialize the LCD at power on time{
lcd_cmd(0x38); // 2x16 display selectms_delay(3);lcd_cmd (0x38); // 2x16 display selectms_delay(3);lcd_cmd (0x0c); // display on cursor off commandms_delay(3);lcd_cmd (0x06); // automatic cursor movement to rightms_delay(3);lcd_cmd (0x01); // lcd clear command ms_delay(3);lcd_cmd (0x80); // first row first column select commandms_delay(3);
}
void lcd_puts(unsigned char *str) // function to display string to lcd{
while(*str!='\0'){
lcd_data(*str);str++;
}}
void displaypval(unsigned int datax) // function to display 3 digit decimal value to lcd{unsigned int temp,temparr[3];
for(temp=3;temp>0;temp--){
temparr[temp-1]=datax%10;datax=datax/10;
}for(temp=0;temp<3;temp++){
lcd_data(temparr[temp]+48);}
}
void main(){
lcd_init();while(1){
lcd_cmd(0x80);lcd_puts("Value");
lcd_cmd(0xc0);displaypval(123);
}
}
HOME SECURITY SYSTEM
INTRODUCTION THE NEED
Our doors serve as entrances to our homes and offices.They may also provide access to strangers, criminals andoffenders. So how do we secure our doors and preventintrusions by these people? This is the sole of purpose ofdoor locks. They keep us and our properties safe andprotected
The method of lock picking involves opening the door lockwith a locking tool kit. A basic kit contains a screwdriver orother types of tension wrench and a lock pin, which is along and thin piece of metal that is curved at one end. Incases of emergencies, a hairpin may substitute for the lockpin.
A professional kit, on the other hand, contains severaltypes of tension wrenches in varying in sizes and shapesand lock pins with different dimensions. It may alsocontain a pick gun which is an instrument that vibrates andpush several lock pins at the same time.
The main goal of this project is develop an embeddedpassword security door lock system usingmicrocontroller. In this project we are going to use 4x4keypad to enter the security lock. Heremicrocontroller place major role which is nothing butdecision of door opening. Here predefined passwordis stored in microcontroller. We have to write a codesuch that whenever password is entered from keypadif that password is matches door has to open.Otherwise buzzer has to on.
PROJECT METHODOLOGYComponent Name Quantity1.Power supply section
Plug with wire 1
Step down transformer 1
1N4007 diodes 4
LM7805 1
100µF capacitor 1
ON/OFF switch 1
1K Resistor 1
2. Microcontroller section
Microcontroller IC (AT89C51) with base 1
Crystal oscillator 1
Capacitor 2
Resistor 1
LCD connector 1
3.Buzzer 1
4.LCD 1
5. Stepper motor 1
6.ON/OFF switch 3
Software UsedKeil µ Version3.
Equipment used1. Soldering iron2. Solder 3. Flux
PROCEDUREStep 1Circuit diagram of the proposed system is designed and finalized.(Refer to Figure6.1 )
Step 2All the components and software platform to be used are selected which are also mentioned
above.Step 3All the hardware components are soldered on their respective printed circuit board with the help
of soldering iron, solder and flux according to the hardware schematic shown in the FigureStep 4Code/program of the proposed system is developed using assembly language with the help of
software platform (Keil u vision3).The coding could be seen in sectionStep 5The hex code of the program being created by the software platform is burnt into thef lash code
memory of our microcontroller IC 89C51.Step 6Testing is done at various levels to finalize the appropriate program for the most proper working
of the system.
DESCRIPTION IN DETAIL It mainly consists of following blocks: 1. Microcontroller: This is the CPU (central processing unit) of our
project. We are going to use a microcontroller of 8051 family. The various functions of microcontroller are like:
I. Reading the digital input from KeypadII. Sending this data to LCD so that the person operating this
project should read the passwordIII. Sensing the password using keypad and to check whether it is a
correct password or a wrong password and rotate the stepper motor if the password entered is a correct password.
2. LCD: We are going to use 16×2 alphanumeric Liquid Crystal Display (LCD) which means it can display alphabets along with numbers on 2 lines each containing 16 characters.
3. Keypad: User will enter the password using the keypad. Various keys of keypad are as following,
I. Increment (1 to 9)II. DecrementIII. Enter
Applications and Advantages:
1. This project can be used in offices, companies also at home. It will provide keyless entry.
2. This can be used in Banks for safety lock.
3. User don’t have to carry keys along with him.
Future Development:
1. We can monitor parameters like fire, overheat
2. We can provide voice feedback system
3. We can interface GSM modem which will send sms if invalid attempt is made to open the lock.