Beruflich Dokumente
Kultur Dokumente
CHAPTER-1 INTRODUCTION
Password Detector is a simple circuit in which on entering a password an individuals name will be displayed on the LCD. By extending the memory we can include more details, such as in industries an employee can get their salary details. In case of educational purpose each student will get their academic report. Since we are living in a busy world where nobody is ready to wait, password detector is of very much use. Long gone are the days of manual work where people used to search for files to collect details which led to wastage of manpower and time. Hence this circuit saves time and money. The system comprises of an LCD, a number keypad and an 8-bit microcontroller AT89C51. This microcontroller has 40 pins arranged in 4 I/O ports, that ports are used here for LCD and keypad interfacing. The microcontroller has a program memory of 4 KB. The microcontroller continuously monitors the keypad and if somebody enters the password it will check the entered password with the password stored in the memory and if it matches then the corresponding individuals name will be displayed on the LCD device. If the entered password is incorrect then INVALID CODE will be displayed on the LCD.
2 PASSWORD DETECTOR
CHAPTER-2 WORKING
2.1 BLOCK DIAGRAM
3 PASSWORD DETECTOR
2.2.2 KEYPAD Keypads are widely used input/output devices of the 8051. At the lowest level keypad is organized in a matrix of rows and columns. The CPU access both the rows and columns through ports. When a key is pressed a row and a column make contact. Otherwise there is no connection between rows and columns. The keypad is used to enter the password. 2.2.3 LCD DISPLAY We use a 2x16 line LCD module. It has got 2 lines and 16 characters per line. We can display the password when it is entered and if its correct, then the name of the user will be displayed.
4 PASSWORD DETECTOR
6 5 4
U4 40 39 38 37 36 35 34 33 32 1 2 3 4 5 6 7 8 1 2 19 18 VCC 31 EA
P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 X1
AT89C51
JP1 P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0 28 27 26 25 24 23 22 21 1 2 3 4 5 6 7 8 8 HEADER GND RST 9 VCC C26
X2
20
10MFD
VCC
LM7805
J10 1 2 3 15-0-15 A A D3 C 1 1N4007 D1 C 2200MFD/25v 1N4007 2 C23 U1 VIN GND VOUT 3 C27 CAP NP
5 PASSWORD DETECTOR
6 PASSWORD DETECTOR
Fig.2.4:Architecture of 8051
7 PASSWORD DETECTOR
PINOUT DESCRIPTION Pins 1-8: Each of these pins can be configured as an input or an output. Pin 8: A logic one on this pin disables the microcontroller and clears the contents of most registers. In other words, the positive voltage on this pin resets the microcontroller. By applying logic zero to this pin, the program starts execution from the beginning. Pins 10-17 Port 0: Similar to port 1, each of these pins can serve as general input or output. Besides, all of them have alternative functions: Pin 10 RXD: Serial asynchronous communication input or Serial synchronous communication output. Pin 11 TXD: Serial asynchronous communication output or Serial synchronous communication clock output. Pin 12 INT0: Interrupt 0 input. Pin 13 INT1: Interrupt 1 input. Pin 14 T0: Counter 0 clock input. Pin 15 T1: Counter 1 clock input. Pin 16: Write to external (additional) RAM. Pin 17: RD Read from external RAM. Pin 18, 19: X2 , X1 Internal oscillator input and output. A quartz crystal which specifies operating frequency is usually connected to these pins. Instead of it, miniature ceramics resonators can also be used for frequency stability. Later versions of microcontrollers operate at a frequency of 0 Hz up to over 50 Hz. Pin 20 GND: Ground. Pin 21-28 Port 2: If there is no intention to use external memory then these port pins are configured as general inputs/outputs. In case external memory is used, the higher address byte, i.e. addresses A8-A15 will appear on this port. Even though memory with capacity of 64Kb is not used, which means that not all eight port bits are used for its addressing, the rest of them are not available as inputs/outputs.
8 PASSWORD DETECTOR
Fig.2.5: Pinout and block diagram of 8051 Pin 29 PSEN: If external ROM is used for storing program then a logic zero (0) appears on it every time the microcontroller reads a byte from memory. Pin 30 ALE: Prior to reading from external memory, the microcontroller puts the lower address byte (A0-A7) on P0 and activates the ALE output. After receiving signal from the ALE pin, the external register memorizes the state of P0 and uses it as a memory chip address. Immediately after that, the ALU pin is returned its previous logic state and P0 is now used as a Data Bus. As seen, port data multiplexing is performed by means of only one additional integrated circuit. In other words, this port is used for both data and address transmission. Pin 31 EA: By applying logic zero to this pin, P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. It means that even there is a program written to the microcontroller, it will not be executed. Instead, the program written to external ROM will be executed. By applying logic one to the EA pin, the microcontroller will use both memories, first internal then external. Pin 32-39 Port 0: Similar to P2, if external memory is not used, these pins can be used as general inputs/outputs. Otherwise, P0 is configured as address output when the ALE pin is driven high or as data output when the ALE pin is driven low. Pin 40 VCC: +5V power supply.
9 PASSWORD DETECTOR
INPUT/OUTPUT PORTS All 8051 microcontrollers have 4 I/O ports each comprising 8 bits which can be configured as inputs or outputs. Accordingly, in total of 32 input/output pins enabling the microcontroller to be connected to peripheral devices are available for use. Pin configuration, i.e. whether it is to be configured as an input (1) or an output (0), depends on its logic state. In order to configure a microcontroller pin as an input, it is necessary to apply a logic zero (0) to appropriate I/O port bit. In this case, voltage level on appropriate pin will be 0. Similarly, in order to configure a microcontroller pin as an input, it is necessary to apply a logic one (1) to appropriate port. In this case, voltage level on appropriate pin will be 5V (as is the case with any TTL input). This may seem confusing but don't loose your patience. It all becomes clear after studying simple electronic circuits connected to an I/O pin.
Fig.2.6: Micro controller is wired with a crystal for clock In the above fig microcontroller is wired with a crystal for clock and each pin of the crystal is connected to ground through a 18 pF capacitor to avoid noise pulses in the clock. Here a 1 MHz crystal is used that gives 1MHz clock for the micro controller.
10 PASSWORD DETECTOR
Fig.2.7: RESET pin of microcontroller is connected to an RC circuit Micro controllers RESET pin is connected to an RC circuit as shown in above figure. This will give a high pulse to the RESET pin at time of starting. This will reset the micro controller means start execution from 0000h. It is essential for a micro controller circuit. When the power is switched ON charge in capacitor will be zero then the reset pin will get high voltage, capacitor starts charging then the voltage across the RST pin will decrease, micro controller starts execution.
11 PASSWORD DETECTOR
2.4.2 KEYPAD
Fig.2.8: 4X3 Matrix type keypad Keypad is used to input the code. Keypad is continously sensed by the microcontroller. Keypad used is a 4'3 matrix type keyboard. Rows and columns are connected to port 2 of microcontroller . The three columns are connected to P2.4, P2.5, and P2.7 which is programmed as input and is set as 0. The four row are connected to P2.0, P2.1, P2.2, and P2.3 which is programmed as output and is continously sensed. When this all this keys at logic high no key is pressed and when any of pin output goes low the two of output is made logic high and even then if the input pin remains low then the key of the column which is not made high is pressed. In this way key pad is sensed by the microcontroller.
12 PASSWORD DETECTOR
2.4.3 LCD DISPLAY Liquid Crystal Displays (LCDs) are cheap and easy way to display text. Various configurations are 1 line by 20 X char upto 8 lines X 80. It is an Integrated controller. The display has two register: 1. command register 2. data register By RS you can select register. Data lines (DB7-DB0) are used to transfer data and commands. PINOUT 1. RS: Register Select. By making RS = 0 Command Register is selected and RS = 1 Data Register is selected. 2. R/W: Read or Write. By making R/W bit =0 we can write the datas and R/W=1 we can read the data/. 3. E: Enable (Latch data): It is used to latch the data present on the data pins. 4. D0-D7: These 8-bit data pins are used to send information to the LCD or read the contents of the LCDs internal registers.
13 PASSWORD DETECTOR
LCD COMMANDS The LCDs internal controller can accept several commands and modify the display accordingly. These commands would be things like: i. Clear screen ii. Return home iii. Decrement/Increment cursor After writing to the LCD, it takes some time for it to complete its internal operations. During this time, it will not accept any new commands or data. We need to insert time delay between any two commands or data sent to LCD. 2.4.4 POWER SUPPLY The operation of power supply circuit built using filter, rectifier, and then voltage regulators. Starting with an ac voltage, a steady dc voltage is obtained by rectifying the ac voltage, then filtering to a dc level, and finally, regulating to obtain a desired fixed dc voltage . The ac voltage, typically 220 V rms is connected to a transformer, which step that ac voltage down to the level for the desired dc output. Diode rectifier then provides a full wave rectified voltage that is initially filtered by simple capacitor filter to produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation. The regulated circuit can use this dc input to provide a dc voltage that not only has much less ripple voltage but also remain the same dc value even if the input voltage vary some what, or the load connected to the output dc voltage changes. This voltage regulation is usually obtained using regulator IC . The voltage regulator plays an important role in a power supply unit .The primary purpose of the regulator is to aid the rectifier and filter circuit in providing a constant dc voltage to the device. Power supplies without regulators have an inherent problem of changing of dc voltage values due to variations in the load or due to fluctuations in the ac linear voltage. With regulator connected to the dc output, the voltage can be maintained with a close tolerant region of the desired output. Voltage regulator comprises a class of widely use ICs. Regulator IC outs contain the circuit for reference source, comparator, amplifier, control device, and overload protection all in a single IC. Although the central construction of the IC is some what difference from that described for discrete voltage regulator circuits, the central operation is much the same .IC units provides regulation of either a fixed positive voltage, a fixed negative voltage or an adjustable set voltage. A power supply can be built using a transformer connected to the ac supply line to step the ac voltage to desired amplitude, then rectifying that ac voltage, filtering with a comparator RC filter, if desired, and finally regulating the dc voltage using IC regulator The fixed voltage regulator has an unregulated dc input voltage, applied to one input terminal and a regulated output dc voltage, from a second terminal, with third terminal connected to the ground. For a selected regulator, IC device specifications list a voltage range over which
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
14 PASSWORD DETECTOR
the input voltage can vary to maintain a regulated output voltage. Over a range of load, current .The specifications also list the amount of output voltage change resulting from a change in load current (load regulation) or input voltage (line regulation).
Table 2.4:78xx series with O/P voltage and min. I/P voltage IC 7805 7806 7808 7810 7812 O/p Voltage (Vo) 5 6 8 10 Minimum I/p Voltage (Vi) 7.3 8.3 10.5 12.5
Example of monolithic regulator s are 78xx/79xxseries and 723general purpose regulators.78xx series are three terminal, positive fixed voltage regulators .In 78xx the last two numbers indicate the output voltage, the 7812 represent a 12 v regulator. The third IC terminal is connected to ground. While the input voltage may vary over some permissible voltage range and the output load may vary over some acceptable range. The output voltage remains constant within specified voltage variation limits. 78xx series are three terminal positive fixed voltage regulators. There are some output voltage options available such as 5, 6, 8, 10 ,12, 18 and 24 v.
15 PASSWORD DETECTOR
16 PASSWORD DETECTOR
LAYOUT APPROACHES The first rule is to prepare each and every PCB layout as viewed from the component side. Another important rule is not to start the designing of a layout unless an absolutely clear circuit diagram is available, if necessary, with a component lists. Among the components the larger ones are placed first and the space between is filled with smaller ones. Components requiring input / output connections come near the connectors. All components are placed in such a manner that disordering of the components is not necessary if they have to be replaced. In the designing of a PCB layout it is very important to divide the circuit into functional subunits. Each of these subunits should be realized on a defined portion of the board. In the designing the inter connections which are usually done by pencil lines, actual space requirements in the artwork must be considered. In addition the layout can be rather roughly sketched and will still be clear enough for artwork designer. BOARD CLEANING The cleaning of the copper surface prior to resist applications in an essential step for any types of PCB process using etch or plating resist. Insufficient cleaningis one of the reasons most often encountered for difficulties in PCB fabrication although it might not always be immediately recognized as this. But it is quiet often the reasons of poor-resist adhesion, uneven photo-resist films, pinholes, poor plating adhesion, etc.Where cleaning has to be done with simplest means or only for a limited quantinty of PCBs, manual-cleaning process is mainly used. In the process we require just a sink with running water, pumice powder, scrubbing brushes and suitable tanks. SCREEN PRINTING This process is particularly suitable for large production schemes. However the preparation of a screen can also be economically attractive for series of 1000 PCBs. Below, while photo printing is basically the non-accurate method to transfer a pattern on to a board surface. With the screen-printing process one can produce PCBs with a conduction of as low as 0.5 + or and a registration error of 0.1mm on an industrial scale with a high reliability. In its basic form, a screen fabric with uniform meshes and opening is stretched and fixed on a solid frame of metal or wood. The circuit pattern is photographically transferred onto the screen, leaving the meshes in the pattern open, while the meshes in the rest of the area are closed. In the actual printing step, ink forced by the moving squeegee through the open meshes onto the surface of the material to be printed.
17 PASSWORD DETECTOR
PLATING
From a practical stand port, printer circuit boards may have to be stocked before being taken for assembly of components. It is expected that the circuit board retain its solder ability for long periods of several months so that reliable solder joints can be produced during assembly. Plating of a metal can be accomplished on a copper pattern by three methods. They are: 1. Immersion plating 2. Electroless plating 3. Electroplating ETCHING This can be done both by manual and mechanical ways by immersing the board onto a solution of formic chloride and hydrochloric acid and finally cleaning the board by soap. In all subtractive PCB processes, etching is one of the most important steps. The copper pattern is formed by selective removal of all unwanted copper, which is not protected by an etch resist. This looks very simple at first glance but in practice there are factors like under etching and overhang which complicate the matter especially in the production of fine and highly precise PCBs. Etching Of PCBs as required in modern electronic equipment production, is usually done in spray type etching machines.
18 PASSWORD DETECTOR
Especially when plated through holes where the solder flows up in the hole, clean lead of at least 1 mm above the board are recommended. DRILLING Drilling of component mounting holes into PCBs by far the most important mechanical machining operation in PCB production processes. Holes are made by drilling wherever a superior hole finish for plated-through hole processes is required and where the tooling costs for a punching tool cannot be justified. Therefore drilling is applied for all the professional grade PCB manufacturers and generally in smaller PCB production laboratories. The importance of hole drilling into PCB has further gone up with electronic component miniaturization and it needs smaller hole diameters and higher package density where hole punching is practically ruled out. SOLDERING Soldering is a process for the joining of metal parts with the aid of a molten metal (solder), where the melting temperature is suited below that of the material joined, and whereby the surface of the parts are wetted, without then becoming molten. Soldering generally implied that the joining process occurs at temperatures below 450-degree centigrade. Solder wets and alloys with the base metals and gets drawn,by capillary action, into the gap between them. This process forms a metallurgical bond between the parts of the joint. Therefore soldier acts by Wetting of base metal surfaces of the relative positioning of the surfaces to be joined, wetting these surfaces with molten solder and allowing the solder to cool down until it has solidified. During these soldering operation, an auxillary medium is mostly used to increase the flow properties of molten solder or to improve the degree of wetting .Such a medium is called flux forming joint flowing between these surfaces, which result in a completely filled space between them. Metallurgical bonding to these surfaces when soldered. Soldering consists . Flowing characteristics are required in a flux: 1. It should provide a liquid cover over the materials and exclusive air up to the soldering temperature. 2. It should dissolve any oxide on the metal surface or on the solder and carry such unwanted elements away. 3. It should be readily displaced from the metal by the molten soldering Operation.Residues should be removable after completion of the solder.To achieve a soldered joint the solder and the base metal must be heated above the melting point of the solder used. The method by which the necessary heat is applied, among other things depends on: 1. Nature and type of the joint 2. Melting point of the solder
19 PASSWORD DETECTOR
FLUX
Generally applied soldering methods are iron soldering, torch soldering, mass soldering, electrical soldering furnace soldering and other methods. Components are basically mounted only one side of the board. In double-sided PCBs, the component side is usually opposite to the major conductor pattern side, unless otherwise dictated by special design requirements.The performance and reliability of solder joints give best result covered with solder and herewith contributing to the actual solder connections. However, lead cutting after soldering is still common in. Particular in smaller industries where hand soldering is used. With the soldered PCB many contaminants can be found which may produce. Difficulties with the functioning of the circuit. The problems usually arise at a much later than during the final functioning testing of the board in the factory. Among the contaminants, we can typically find flux, chips of plastics, metals and other constructional materials, plating sails, oils greases environmental soil and other processing materials. Dissolution or dissolving of organic liquids and solids, e.g., oils, greases, resin flux.Removal of plating salts and silicone oils.Displacing of particulate and other insoluble matters,e.g., chips,dust,and lint.No severe attacks on boards and components to be cleaned, no alteration of ink or paint notations and last but not the least, compatibility with healthy environmental working conditions.
20 PASSWORD DETECTOR
21 PASSWORD DETECTOR
3.3 FLOWCHART
Fig.3.3: Flowchart
22 PASSWORD DETECTOR
23 PASSWORD DETECTOR
BIBLIOGRAPHY
y y y y y
24 PASSWORD DETECTOR
APPENDIX A
25 PASSWORD DETECTOR
SOURCE CODE
.equ com,0fch .equ dat,0fdh .equ eot,0feh .equ n1,0eh .equ n2,0dh .equ n3,0ch .equ n4,0bh .equ n5,0ah .equ n6,09h .equ n7,08h .org 0000h ljmp main .org 0050h main: mov sp,#50h mov p1,#00h mov r0,#00h mov r2,#00h mov r3,#00h
26 PASSWORD DETECTOR
mov r4,#00h clr n1 clr n2 clr n3 clr n4 clr n5 clr n6 clr n7 mov dptr,#msg0 lcall message key12: lcall key lcall store ljmp key12 key: mov p2,#0f7h jb p2.0,skip1 ljmp a0 skip1: jb p2.1,skip2 ljmp a1 skip2: jb p2.2,skip3 ljmp a2 skip3: mov p2,#6fh jb p2.0,skip4
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
27 PASSWORD DETECTOR
ljmp a3 skip4: jb p2.1,skip5 ljmp a4 skip5: jb p2.2,skip6 ljmp a5 skip6: mov p2,#5fh jb p2.0,skip7 ljmp a6 skip7: jb p2.1,skip8 ljmp a7 skip8: jb p2.2,skip9 ljmp a8 skip9: mov p2,#0bfh jb p2.0,skip10 ljmp a9 skip10: jb p2.1,skip11 ljmp a10 skip11: jb p2.2,skip12 ljmp a11 skip12: ljmp key a0: lcall delay3
28 PASSWORD DETECTOR
loop1: jnb p2.1, loop1 lcall delay3 mov a,#'2' ret a2: lcall delay3
loop2: jnb p2.2, loop2 lcall delay3 mov a,#'3' ret a3: lcall delay3
loop3: jnb p2.0, loop3 lcall delay3 mov a,#'4' ret a4: lcall delay3
29 PASSWORD DETECTOR
loop5: jnb p2.2, loop5 lcall delay3 mov a,#'6' ret a6: lcall delay3
loop6: jnb p2.0, loop6 lcall delay3 mov a,#'7' ret a7: lcall delay3
loop7: jnb p2.1, loop7 lcall delay3 mov a,#'8' ret a8: lcall delay3
30 PASSWORD DETECTOR
a9:
lcall delay3
loop9: jnb p2.0, loop9 lcall delay3 mov a,#10h ret a10: lcall delay3 jnb p2.1, loop10
loop10:
lcall delay3 mov a,#30h ret a11: lcall delay3 jnb p2.2, loop11
loop11:
lcall delay3 mov a,#12h ret store: cjne a,#10h,str mov r0,#00h mov dptr,#msg0 lcall message ret str: cjne r0,#04h,str2
31 PASSWORD DETECTOR
cjne a,#12h,str1 mov 74h,#eot mov r0,#00h mov r1,#70h mov dptr,#comp1 lcall compare jb n1,h1 mov dptr,#name1 lcall message str1: h1: ret mov r1,#70h mov dptr,#comp2 lcall compare jb n1,h2 mov dptr,#name2 lcall message ret h2: mov r1,#70h mov dptr,#comp3 lcall compare jb n1,h3 mov dptr,#name3
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
32 PASSWORD DETECTOR
lcall message h3: str2: ret cjne r0,#03h,str3 inc r0 mov 73h,a lcall display ret str3: cjne r0,#02h,str4 inc r0 mov 72h,a lcall display ret str4: cjne r0,#01h,str5 inc r0 mov 71h,a lcall display ret str5: cjne r0,#00h,str6 inc r0 mov 70h,a lcall display str6: ret
33 PASSWORD DETECTOR
compare: clr a movc a,@a+dptr cjne a,#eot,x1 clr n1 ret x1: mov r0,a clr c subb a,@r1 jc x2 mov a,@r1 clr c subb a,r0 jc x2 inc dptr inc r1 sjmp compare x2: mov dptr,#msg2 lcall message setb n1 ret
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
34 PASSWORD DETECTOR
display: lcall ready setb p1.0 mov p0,a clr p1.1 setb p1.2 clr p1.2 ret message:lcall ready clr a movc a,@a+dptr inc dptr cjne a,#eot,comd ret comd: cjne a,#com,data clr p1.0 sjmp message data: cjne a,#dat,sendit setb p1.0 sjmp message
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
35 PASSWORD DETECTOR
sendit: mov p0,a clr p1.1 setb p1.2 clr p1.2 sjmp message ready: mov r7,p1 clr p1.0 mov p0,#0ffh clr p1.2 setb p1.1 wait: clr p1.2 setb p1.2 jb p0.7,wait clr p1.2 mov p1,r7 ret delay: setb psw.3 mov r3,#1Fh s3: s2: mov r0,#0ffh mov r1,#0ffh
36 PASSWORD DETECTOR
s1:
delay1: mov r5,#01h s8: s9: s11: mov r6,#3fh mov r7,#0ffh djnz r7,s11 djnz r6,s9 djnz r5,s8 ret delay3: mov r6,#05h d8 mov tmod,#10h mov tl1,#6ah mov th1,#0aah d9: setb tr1 jnb tf1,d9 clr tf1 djnz r6,d8
DEPARTMENT OF ELETRONICS AND COMMUNICATION SBCE
37 PASSWORD DETECTOR
ret msg0: .db com,3ch,06h,0eh,01h,80h,eot name1: .db com,3ch,06h,0eh,01h,80h,dat,"ARAVIND",eot name2: .db com,3ch,06h,0eh,01h,80h,dat,"TOJI",eot name3: .db com,3ch,06h,0eh,01h,80h,dat,"VIBIN",eot msg2: .db com,3ch,06h,0eh,01h,80h,dat,"INVALID CODE",eot comp1:.db "1234",eot comp2:.db "5678",eot comp3:.db "9012",eot
38 PASSWORD DETECTOR
APPENDIX B
39 PASSWORD DETECTOR
40 PASSWORD DETECTOR
41 PASSWORD DETECTOR
42 PASSWORD DETECTOR
43 PASSWORD DETECTOR
44 PASSWORD DETECTOR
45 PASSWORD DETECTOR
46 PASSWORD DETECTOR
47 PASSWORD DETECTOR
48 PASSWORD DETECTOR
49 PASSWORD DETECTOR
50 PASSWORD DETECTOR
51 PASSWORD DETECTOR